-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
## MLKit with CameraX | ||
|
||
Aplikasi machine lerning yang menggunakan library MLkit dari firebase dan CameraX sebagai library kamera yang ter-include dalam jetpack component. Aplikasi ini dibuat sebagai hasil research saya belajar tentang machine learning di android dan penggunaan kamera menggunakan library ``CameraX``. | ||
|
||
link download ======> https://dply.me/toowxj | ||
|
||
## Fitur | ||
- Barcode Scanner | ||
- Face Detection | ||
- Object Detection | ||
- OCR (Text Classifier) | ||
|
||
|
||
## ☝🏼 how to use this project ? | ||
|
||
Clone repo ini, kemudian project ada di file mlkit | ||
```bash | ||
git clone https://github.com/farhanroy/android-research/ | ||
``` | ||
## 📱 Screenshots | ||
|
||
<table> | ||
<tr> | ||
<td> | ||
<img src="./screenshot/Screenshot_2021-01-06-11-12-14-68.jpg" width="250"> | ||
</td> | ||
<td> | ||
<img src="./screenshot/Screenshot_2021-01-06-11-11-54-72.jpg" width="250"> | ||
</td> | ||
<td> | ||
<img src="./screenshot/Screenshot_2021-01-06-11-13-42-74.jpg" width="250"> | ||
</td> | ||
<td> | ||
<img src="./screenshot/Screenshot_2021-01-06-11-11-32-40.jpg" width="250"> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
|
||
## Author | ||
|
||
👤 **Farhan Roy** | ||
|
||
- Facebook: [Broding Camel](https://web.facebook.com/farhansekargadung) | ||
- Github: [Farhan Roy](https://github.com/farhanroy) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'kotlin-android' | ||
id 'kotlin-kapt' | ||
} | ||
|
||
|
||
android { | ||
compileSdkVersion 30 | ||
buildToolsVersion "30.0.2" | ||
|
||
defaultConfig { | ||
applicationId "com.detect.me" | ||
minSdkVersion 21 | ||
targetSdkVersion 30 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
buildFeatures { | ||
viewBinding true | ||
} | ||
|
||
buildTypes { | ||
debug { | ||
minifyEnabled true | ||
} | ||
release { | ||
minifyEnabled true | ||
debuggable false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
aaptOptions { | ||
noCompress "tflite" | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
implementation 'androidx.core:core-ktx:1.3.2' | ||
implementation 'androidx.appcompat:appcompat:1.2.0' | ||
implementation 'com.google.android.material:material:1.2.1' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | ||
|
||
implementation "androidx.lifecycle:lifecycle-livedata-ktx:${versions.lifecycle}" | ||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${versions.lifecycle}" | ||
|
||
// Navigation component | ||
implementation "androidx.navigation:navigation-fragment-ktx:$versions.navigation" | ||
implementation "androidx.navigation:navigation-ui-ktx:$versions.navigation" | ||
|
||
// MLKIT | ||
implementation 'com.google.android.gms:play-services-mlkit-text-recognition:16.1.2' | ||
implementation 'com.google.android.gms:play-services-mlkit-face-detection:16.1.2' | ||
implementation 'com.google.mlkit:barcode-scanning:16.1.0' | ||
implementation 'com.google.mlkit:object-detection:16.2.2' | ||
|
||
// CameraX | ||
implementation "androidx.camera:camera-camera2:${versions.cameraX}" | ||
implementation "androidx.camera:camera-core:${versions.cameraX}" | ||
implementation "androidx.camera:camera-lifecycle:${versions.cameraX}" | ||
implementation "androidx.camera:camera-view:1.0.0-alpha20" | ||
implementation 'androidx.legacy:legacy-support-v4:1.0.0' | ||
|
||
testImplementation 'junit:junit:4.+' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.2' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.android.mlkit | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.android.mlkit", appContext.packageName) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.detect.me"> | ||
|
||
<uses-feature android:name="android.hardware.camera.any" /> | ||
|
||
<uses-permission android:name="android.permission.CAMERA" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.Mlkit"> | ||
<activity | ||
android:name=".SplashActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".MainActivity"/> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.detect.me | ||
|
||
import android.content.pm.PackageManager | ||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.core.app.ActivityCompat | ||
import androidx.core.content.ContextCompat | ||
import androidx.navigation.fragment.NavHostFragment | ||
import androidx.navigation.ui.NavigationUI | ||
import com.detect.me.databinding.ActivityMainBinding | ||
|
||
|
||
// Main Class for app | ||
class MainActivity : AppCompatActivity() { | ||
|
||
private lateinit var binding: ActivityMainBinding | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityMainBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
checkPermission() | ||
} | ||
|
||
override fun onRequestPermissionsResult( | ||
requestCode: Int, permissions: Array<String>, grantResults: | ||
IntArray | ||
) { | ||
if (requestCode == REQUEST_CODE_PERMISSIONS) { | ||
if (allPermissionsGranted()) { | ||
setupNavigation() | ||
} else finish() | ||
} | ||
} | ||
|
||
private fun checkPermission() { | ||
if (allPermissionsGranted()) { | ||
setupNavigation() | ||
} else { | ||
ActivityCompat.requestPermissions( | ||
this, | ||
REQUIRED_PERMISSIONS, | ||
REQUEST_CODE_PERMISSIONS | ||
) | ||
} | ||
} | ||
|
||
private fun setupNavigation() { | ||
val navHostFragment = | ||
supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment | ||
val navController = navHostFragment.navController | ||
val bottomNavigationView = binding.bottomNavigationView | ||
NavigationUI.setupWithNavController(bottomNavigationView, navController) | ||
} | ||
|
||
private fun allPermissionsGranted() = REQUIRED_PERMISSIONS.all { | ||
ContextCompat.checkSelfPermission(this, it) == PackageManager.PERMISSION_GRANTED | ||
} | ||
|
||
companion object { | ||
private const val REQUEST_CODE_PERMISSIONS = 10 | ||
private val REQUIRED_PERMISSIONS = arrayOf( | ||
android.Manifest.permission.CAMERA | ||
) | ||
} | ||
|
||
|
||
|
||
|
||
} |