Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MDD Simulator Caller App
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open_share
MDD Simulator Caller App
Commits
69eb9e25
Commit
69eb9e25
authored
Jun 08, 2022
by
Dean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add FingerPrintFragment.kt
parent
c0001036
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
152 additions
and
0 deletions
+152
-0
build.gradle
app/build.gradle
+1
-0
FingerPrintFragment.kt
...java/com/mdd/mddsimulatorcallerapp/FingerPrintFragment.kt
+111
-0
MainActivity.kt
...c/main/java/com/mdd/mddsimulatorcallerapp/MainActivity.kt
+4
-0
fragment_finger_print.xml
app/src/main/res/layout/fragment_finger_print.xml
+16
-0
menu_main.xml
app/src/main/res/menu/menu_main.xml
+5
-0
nav_graph.xml
app/src/main/res/navigation/nav_graph.xml
+13
-0
strings.xml
app/src/main/res/values/strings.xml
+2
-0
No files found.
app/build.gradle
View file @
69eb9e25
...
...
@@ -43,6 +43,7 @@ dependencies {
implementation
'androidx.constraintlayout:constraintlayout:2.1.0'
implementation
'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation
'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation
'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation
'junit:junit:4.+'
androidTestImplementation
'androidx.test.ext:junit:1.1.3'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.4.0'
...
...
app/src/main/java/com/mdd/mddsimulatorcallerapp/FingerPrintFragment.kt
0 → 100644
View file @
69eb9e25
package
com.mdd.mddsimulatorcallerapp
import
android.app.AlertDialog
import
android.content.ActivityNotFoundException
import
android.content.Intent
import
android.content.IntentFilter
import
android.os.Bundle
import
androidx.fragment.app.Fragment
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
com.mdd.mddsimulatorcallerapp.databinding.FragmentFingerPrintBinding
import
com.mdd.mddsimulatorcallerapp.databinding.FragmentSecondBinding
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private
const
val
ARG_PARAM1
=
"param1"
private
const
val
ARG_PARAM2
=
"param2"
/**
* A simple [Fragment] subclass.
* Use the [FingerPrintFragment.newInstance] factory method to
* create an instance of this fragment.
*/
class
FingerPrintFragment
:
Fragment
()
{
// TODO: Rename and change types of parameters
private
var
param1
:
String
?
=
null
private
var
param2
:
String
?
=
null
private
var
_binding
:
FragmentFingerPrintBinding
?
=
null
// This property is only valid between onCreateView and
// onDestroyView.
private
val
binding
get
()
=
_binding
!!
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
arguments
?.
let
{
param1
=
it
.
getString
(
ARG_PARAM1
)
param2
=
it
.
getString
(
ARG_PARAM2
)
}
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
{
// Inflate the layout for this fragment
MyBroadcastReceiver
.
typeReceiver
=
"ISIINAJA"
_binding
=
FragmentFingerPrintBinding
.
inflate
(
inflater
,
container
,
false
)
return
binding
.
root
}
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
binding
.
enrollBtn
.
setOnClickListener
{
context
?.
let
{
act
->
// WAJIB -> compileSdkVersion 29, minSdkVersion 22, targetSdkVersion 29
val
br
:
MyBroadcastReceiver
=
MyBroadcastReceiver
()
MyBroadcastReceiver
.
typeReceiver
=
"ISIINAJA"
val
receiverPath
=
"com.mdd.mddsimulatorcallerapp.ON_RESULT"
val
filter
=
IntentFilter
(
receiverPath
)
act
.
registerReceiver
(
br
,
filter
)
val
intent
=
Intent
(
Intent
.
ACTION_SEND
)
intent
.
`package`
=
"co.id.mdd.fingerprintscanner"
intent
.
addCategory
(
Intent
.
CATEGORY_DEFAULT
)
intent
.
let
{
intent
->
intent
.
putExtra
(
"BroadcastReceiver"
,
receiverPath
)
try
{
startActivity
(
intent
)
}
catch
(
e
:
ActivityNotFoundException
)
{
showErrorMessage
(
e
)
}
}
}
}
}
override
fun
onDestroyView
()
{
super
.
onDestroyView
()
_binding
=
null
}
private
fun
showErrorMessage
(
e
:
Exception
)
{
AlertDialog
.
Builder
(
context
)
.
setMessage
(
e
.
message
)
.
show
()
}
companion
object
{
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment FingerPrintFragment.
*/
// TODO: Rename and change types and number of parameters
@JvmStatic
fun
newInstance
(
param1
:
String
,
param2
:
String
)
=
FingerPrintFragment
().
apply
{
arguments
=
Bundle
().
apply
{
putString
(
ARG_PARAM1
,
param1
)
putString
(
ARG_PARAM2
,
param2
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/mdd/mddsimulatorcallerapp/MainActivity.kt
View file @
69eb9e25
...
...
@@ -64,6 +64,10 @@ class MainActivity : AppCompatActivity() {
findNavController
(
R
.
id
.
nav_host_fragment_content_main
).
navigate
(
R
.
id
.
action_FirstFragment_to_SecondFragment
)
true
}
R
.
id
.
action_To_FingerPrint
->
{
findNavController
(
R
.
id
.
nav_host_fragment_content_main
).
navigate
(
R
.
id
.
action_To_FingerPrint
)
true
}
else
->
super
.
onOptionsItemSelected
(
item
)
}
}
...
...
app/src/main/res/layout/fragment_finger_print.xml
0 → 100644
View file @
69eb9e25
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".FingerPrintFragment"
>
<Button
android:id=
"@+id/enrollBtn"
android:layout_marginTop=
"40dp"
android:layout_marginLeft=
"20dp"
android:text=
"Enroll FingerPrint"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
</FrameLayout>
\ No newline at end of file
app/src/main/res/menu/menu_main.xml
View file @
69eb9e25
...
...
@@ -17,4 +17,9 @@
android:orderInCategory=
"100"
android:title=
"ALPR CAMERA"
app:showAsAction=
"never"
/>
<item
android:id=
"@+id/action_To_FingerPrint"
android:orderInCategory=
"100"
android:title=
"Finger Print Scanner"
app:showAsAction=
"never"
/>
</menu>
\ No newline at end of file
app/src/main/res/navigation/nav_graph.xml
View file @
69eb9e25
...
...
@@ -16,6 +16,12 @@
app:popUpTo=
"@+id/FirstFragment"
app:popUpToInclusive=
"true"
/>
<action
android:id=
"@+id/action_To_FingerPrint"
app:destination=
"@id/FingerPrintFragment"
app:popUpTo=
"@+id/FingerPrintFragment"
app:popUpToInclusive=
"true"
/>
<fragment
android:id=
"@+id/FirstFragment"
android:name=
"com.mdd.mddsimulatorcallerapp.FirstFragment"
...
...
@@ -28,4 +34,11 @@
android:label=
"ALPR CAMERA"
tools:layout=
"@layout/fragment_second"
>
</fragment>
<fragment
android:id=
"@+id/FingerPrintFragment"
android:name=
"com.mdd.mddsimulatorcallerapp.FingerPrintFragment"
android:label=
"FingerPrint"
tools:layout=
"@layout/fragment_finger_print"
>
</fragment>
</navigation>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
69eb9e25
...
...
@@ -9,4 +9,6 @@
<string
name=
"hello_first_fragment"
>
Hello first fragment
</string>
<string
name=
"hello_second_fragment"
>
Hello second fragment. Arg: %1$s
</string>
<!-- TODO: Remove or change this placeholder text -->
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
</resources>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment