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
c0001036
Commit
c0001036
authored
Jun 03, 2022
by
Dean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add MDD ALPR CAMERA
parent
004b86ff
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
192 additions
and
23 deletions
+192
-23
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-2
FirstFragment.kt
.../main/java/com/mdd/mddsimulatorcallerapp/FirstFragment.kt
+4
-0
MainActivity.kt
...c/main/java/com/mdd/mddsimulatorcallerapp/MainActivity.kt
+19
-1
MyBroadcastReceiver.kt
...java/com/mdd/mddsimulatorcallerapp/MyBroadcastReceiver.kt
+20
-4
SecondFragment.kt
...main/java/com/mdd/mddsimulatorcallerapp/SecondFragment.kt
+64
-3
activity_main.xml
app/src/main/res/layout/activity_main.xml
+1
-0
fragment_second.xml
app/src/main/res/layout/fragment_second.xml
+59
-2
menu_main.xml
app/src/main/res/menu/menu_main.xml
+11
-1
nav_graph.xml
app/src/main/res/navigation/nav_graph.xml
+13
-10
No files found.
app/src/main/AndroidManifest.xml
View file @
c0001036
...
...
@@ -7,8 +7,7 @@
android:icon=
"@mipmap/ic_launcher"
android:label=
"@string/app_name"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/Theme.MddSimulatorCallerApp"
>
android:supportsRtl=
"true"
>
<activity
android:name=
".MainActivity"
android:label=
"@string/app_name"
...
...
app/src/main/java/com/mdd/mddsimulatorcallerapp/FirstFragment.kt
View file @
c0001036
...
...
@@ -30,6 +30,7 @@ class FirstFragment : Fragment() {
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
{
MyBroadcastReceiver
.
typeReceiver
=
"ISIINAJA"
_binding
=
FragmentFirstBinding
.
inflate
(
inflater
,
container
,
false
)
return
binding
.
root
...
...
@@ -47,6 +48,7 @@ class FirstFragment : Fragment() {
)
val
br
:
BroadcastReceiver
=
MyBroadcastReceiver
()
MyBroadcastReceiver
.
typeReceiver
=
"ISIINAJA"
val
receiverPath
=
"com.mdd.mddsimulatorcallerapp.ON_RESULT"
val
filter
=
IntentFilter
(
receiverPath
)
...
...
@@ -77,6 +79,7 @@ class FirstFragment : Fragment() {
)
val
br
:
BroadcastReceiver
=
MyBroadcastReceiver
()
MyBroadcastReceiver
.
typeReceiver
=
"ISIINAJA"
val
receiverPath
=
"com.mdd.mddsimulatorcallerapp.ON_RESULT"
val
filter
=
IntentFilter
(
receiverPath
)
...
...
@@ -99,6 +102,7 @@ class FirstFragment : Fragment() {
context
?.
let
{
act
->
// WAJIB -> compileSdkVersion 29, minSdkVersion 22, targetSdkVersion 29
val
br
:
BroadcastReceiver
=
MyBroadcastReceiver
()
MyBroadcastReceiver
.
typeReceiver
=
"ISIINAJA"
val
receiverPath
=
"com.mdd.mddsimulatorcallerapp.ON_RESULT"
val
filter
=
IntentFilter
(
receiverPath
)
...
...
app/src/main/java/com/mdd/mddsimulatorcallerapp/MainActivity.kt
View file @
c0001036
package
com.mdd.mddsimulatorcallerapp
import
android.app.ActionBar
import
android.os.Bundle
import
android.view.Menu
import
android.view.MenuItem
...
...
@@ -37,6 +38,13 @@ class MainActivity : AppCompatActivity() {
override
fun
onCreateOptionsMenu
(
menu
:
Menu
):
Boolean
{
// Inflate the menu; this adds items to the action bar if it is present.
menuInflater
.
inflate
(
R
.
menu
.
menu_main
,
menu
)
// val actionBar = supportActionBar
// if (actionBar != null) {
// actionBar.setHomeButtonEnabled(false) // disable the button
// actionBar.setDisplayHomeAsUpEnabled(false) // remove the left caret
// actionBar.setDisplayShowHomeEnabled(false) // remove the icon
// actionBar.setHomeAsUpIndicator(null)
// }
return
true
}
...
...
@@ -45,7 +53,17 @@ class MainActivity : AppCompatActivity() {
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
return
when
(
item
.
itemId
)
{
R
.
id
.
action_settings
->
true
R
.
id
.
action_settings
->
{
true
}
R
.
id
.
action_ToFirst
->
{
findNavController
(
R
.
id
.
nav_host_fragment_content_main
).
navigate
(
R
.
id
.
action_SecondFragment_to_FirstFragment
)
true
}
R
.
id
.
action_ToSeconds
->
{
findNavController
(
R
.
id
.
nav_host_fragment_content_main
).
navigate
(
R
.
id
.
action_FirstFragment_to_SecondFragment
)
true
}
else
->
super
.
onOptionsItemSelected
(
item
)
}
}
...
...
app/src/main/java/com/mdd/mddsimulatorcallerapp/MyBroadcastReceiver.kt
View file @
c0001036
...
...
@@ -8,11 +8,27 @@ import android.content.Intent;
import
android.util.Log
class
MyBroadcastReceiver
:
BroadcastReceiver
()
{
companion
object
{
var
typeReceiver
:
String
=
"ISIINAJA"
}
override
fun
onReceive
(
context
:
Context
?,
intent
:
Intent
)
{
try
{
Log
.
i
(
"onReceive"
,
"new_message"
)
if
(
typeReceiver
==
"ISIINAJA"
){
Log
.
i
(
"onReceive"
,
"ISIINAJA"
)
val
result
=
intent
.
getStringExtra
(
"Result"
)
val
status
=
intent
.
getStringExtra
(
"Status"
)
showMessage
(
context
,
result
,
status
)
}
else
if
(
typeReceiver
==
"ALPRCAMERA"
){
Log
.
i
(
"onReceive"
,
"ALPRCAMERA"
)
val
plateNumber
=
intent
.
getStringExtra
(
"PlateNumber"
)
val
result
=
intent
.
getStringExtra
(
"ALPR_RESULT"
)
showMessage
(
context
,
result
,
plateNumber
)
}
context
?.
unregisterReceiver
(
this
)
}
catch
(
ex
:
Exception
){
Log
.
e
(
"onReceive"
,
ex
.
toString
())
}
}
private
fun
showMessage
(
context
:
Context
?,
s
:
String
,
title
:
String
)
{
Log
.
i
(
"MESSAGE"
,
s
)
...
...
app/src/main/java/com/mdd/mddsimulatorcallerapp/SecondFragment.kt
View file @
c0001036
package
com.mdd.mddsimulatorcallerapp
import
android.app.AlertDialog
import
android.content.ActivityNotFoundException
import
android.content.BroadcastReceiver
import
android.content.Intent
import
android.content.IntentFilter
import
android.graphics.Color
import
android.os.Bundle
import
androidx.fragment.app.Fragment
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.core.content.ContextCompat
import
androidx.navigation.fragment.findNavController
import
com.mdd.mddsimulatorcallerapp.databinding.FragmentSecondBinding
...
...
@@ -23,7 +30,7 @@ class SecondFragment : Fragment() {
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
{
MyBroadcastReceiver
.
typeReceiver
=
"ALPRCAMERA"
_binding
=
FragmentSecondBinding
.
inflate
(
inflater
,
container
,
false
)
return
binding
.
root
...
...
@@ -31,9 +38,58 @@ class SecondFragment : Fragment() {
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
binding
.
buttonSecond
.
setOnClickListener
{
findNavController
().
navigate
(
R
.
id
.
action_SecondFragment_to_FirstFragment
)
context
?.
let
{
act
->
// WAJIB -> compileSdkVersion 29, minSdkVersion 22, targetSdkVersion 29
val
br
:
MyBroadcastReceiver
=
MyBroadcastReceiver
()
MyBroadcastReceiver
.
typeReceiver
=
"ALPRCAMERA"
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.mddalprcamera"
intent
.
addCategory
(
Intent
.
CATEGORY_DEFAULT
)
intent
?.
let
{
intent
->
intent
.
putExtra
(
"BroadcastReceiver"
,
receiverPath
)
intent
.
putExtra
(
"ACTIVATION_SERVER_URL"
,
""
)
intent
.
putExtra
(
"ACTIVATION_MASTER_OR_SLAVE_KEY"
,
""
)
// intent.putExtra("CONFIG_KLASS_LPCI_ENABLED", CONFIG_KLASS_LPCI_ENABLED) <- optional, untuk get license plate per negara
// intent.putExtra("CONFIG_KLASS_VBSR_ENABLED", CONFIG_KLASS_VBSR_ENABLED) <- optional, untuk get tipe body mobil
// intent.putExtra("CONFIG_KLASS_VCR_ENABLED", CONFIG_KLASS_VCR_ENABLED) <- optional, untuk get warna mobil
// intent.putExtra("CONFIG_KLASS_VMMR_ENABLED", CONFIG_KLASS_VMMR_ENABLED) <- optional, untuk get produsen mobil
// intent.putExtra("SavePhotoToFile", imageFilePath) <- optional, file path absolute image yg akan di save ke file
// intent.putExtra("GetAllJSON", true) <- optional
// intent.putExtra("CONFIG_DETECT_MINSCORE", binding.configDetectMinscore.text.toString().toDouble()) <- optional
// intent.putExtra("CONFIG_RECOGN_MINSCORE", binding.configRecognMinscore.text.toString().toDouble()) <- optional
try
{
intent
.
putExtra
(
"CONFIG_DETECT_MINSCORE"
,
binding
.
configDetectMinscore
.
text
.
toString
().
toDouble
())
}
catch
(
ex
:
Exception
){
ex
.
printStackTrace
()
}
try
{
intent
.
putExtra
(
"CONFIG_RECOGN_MINSCORE"
,
binding
.
configRecognMinscore
.
text
.
toString
().
toDouble
())
}
catch
(
ex
:
Exception
){
ex
.
printStackTrace
()
}
intent
.
putExtra
(
"CONFIG_KLASS_LPCI_ENABLED"
,
binding
.
configKLASSLPCIENABLED
.
isChecked
)
intent
.
putExtra
(
"CONFIG_KLASS_VBSR_ENABLED"
,
binding
.
configKLASSVBSRENABLED
.
isChecked
)
intent
.
putExtra
(
"CONFIG_KLASS_VCR_ENABLED"
,
binding
.
configKLASSVCRENABLED
.
isChecked
)
intent
.
putExtra
(
"CONFIG_KLASS_VMMR_ENABLED"
,
binding
.
configKLASSVMMRENABLED
.
isChecked
)
intent
.
putExtra
(
"IS_SCREEN_ORIENTATION_LANDSCAPE"
,
binding
.
configLANDSCAPE
.
isChecked
)
intent
.
putExtra
(
"GetAllJSON"
,
true
)
try
{
startActivity
(
intent
)
}
catch
(
e
:
ActivityNotFoundException
)
{
showErrorMessage
(
e
)
}
}
}
}
}
...
...
@@ -41,4 +97,9 @@ class SecondFragment : Fragment() {
super
.
onDestroyView
()
_binding
=
null
}
private
fun
showErrorMessage
(
e
:
Exception
)
{
AlertDialog
.
Builder
(
context
)
.
setMessage
(
e
.
message
)
.
show
()
}
}
\ No newline at end of file
app/src/main/res/layout/activity_main.xml
View file @
c0001036
...
...
@@ -16,6 +16,7 @@
android:layout_width=
"match_parent"
android:layout_height=
"?attr/actionBarSize"
android:background=
"?attr/colorPrimary"
app:navigationIcon=
"@color/black"
app:popupTheme=
"@style/Theme.MddSimulatorCallerApp.PopupOverlay"
/>
</com.google.android.material.appbar.AppBarLayout>
...
...
app/src/main/res/layout/fragment_second.xml
View file @
c0001036
...
...
@@ -6,6 +6,64 @@
android:layout_height=
"match_parent"
tools:context=
".SecondFragment"
>
<EditText
android:id=
"@+id/config_detect_minscore"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
android:hint=
"CONFIG DETECT MINSCORE, EX: 0.25"
/>
<EditText
android:id=
"@+id/config_recogn_minscore"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/config_detect_minscore"
android:hint=
"CONFIG RECOGN MINSCORE, EX: 0.3"
/>
<CheckBox
android:id=
"@+id/config_KLASS_LPCI_ENABLED"
app:layout_constraintTop_toBottomOf=
"@+id/config_recogn_minscore"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
android:text=
"CONFIG_KLASS_LPCI_ENABLED"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<CheckBox
android:id=
"@+id/config_KLASS_VCR_ENABLED"
app:layout_constraintTop_toBottomOf=
"@id/config_KLASS_LPCI_ENABLED"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
android:text=
"CONFIG_KLASS_VCR_ENABLED"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<CheckBox
android:id=
"@+id/config_KLASS_VMMR_ENABLED"
app:layout_constraintTop_toBottomOf=
"@id/config_KLASS_VCR_ENABLED"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
android:text=
"CONFIG_KLASS_VMMR_ENABLED"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<CheckBox
android:id=
"@+id/config_KLASS_VBSR_ENABLED"
app:layout_constraintTop_toBottomOf=
"@id/config_KLASS_VMMR_ENABLED"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
android:text=
"CONFIG_KLASS_VBSR_ENABLED"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<CheckBox
android:id=
"@+id/config_LANDSCAPE"
app:layout_constraintTop_toBottomOf=
"@id/config_KLASS_VBSR_ENABLED"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
android:text=
"CONFIG_LANDSCAPE"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<TextView
android:id=
"@+id/textview_second"
android:layout_width=
"wrap_content"
...
...
@@ -14,12 +72,11 @@
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<Button
android:id=
"@+id/button_second"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"
@string/previous
"
android:text=
"
ALPR CAMERA
"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
...
app/src/main/res/menu/menu_main.xml
View file @
c0001036
...
...
@@ -5,6 +5,16 @@
<item
android:id=
"@+id/action_settings"
android:orderInCategory=
"100"
android:title=
"@string/action_settings"
android:title=
"Settings"
app:showAsAction=
"never"
/>
<item
android:id=
"@+id/action_ToFirst"
android:orderInCategory=
"100"
android:title=
"ISIIN AJA"
app:showAsAction=
"never"
/>
<item
android:id=
"@+id/action_ToSeconds"
android:orderInCategory=
"100"
android:title=
"ALPR CAMERA"
app:showAsAction=
"never"
/>
</menu>
\ No newline at end of file
app/src/main/res/navigation/nav_graph.xml
View file @
c0001036
...
...
@@ -4,25 +4,28 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/nav_graph"
app:startDestination=
"@id/FirstFragment"
>
<action
android:id=
"@+id/action_FirstFragment_to_SecondFragment"
app:destination=
"@id/SecondFragment"
app:popUpTo=
"@+id/SecondFragment"
app:popUpToInclusive=
"true"
/>
<action
android:id=
"@+id/action_SecondFragment_to_FirstFragment"
app:destination=
"@id/FirstFragment"
app:popUpTo=
"@+id/FirstFragment"
app:popUpToInclusive=
"true"
/>
<fragment
android:id=
"@+id/FirstFragment"
android:name=
"com.mdd.mddsimulatorcallerapp.FirstFragment"
android:label=
"Isiin Aja simulator"
tools:layout=
"@layout/fragment_first"
>
<action
android:id=
"@+id/action_FirstFragment_to_SecondFragment"
app:destination=
"@id/SecondFragment"
/>
</fragment>
<fragment
android:id=
"@+id/SecondFragment"
android:name=
"com.mdd.mddsimulatorcallerapp.SecondFragment"
android:label=
"
@string/second_fragment_label
"
android:label=
"
ALPR CAMERA
"
tools:layout=
"@layout/fragment_second"
>
<action
android:id=
"@+id/action_SecondFragment_to_FirstFragment"
app:destination=
"@id/FirstFragment"
/>
</fragment>
</navigation>
\ 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