update_mahbubi
|
@ -0,0 +1,2 @@
|
|||
#Sat Apr 06 02:50:57 WIB 2024
|
||||
gradle.version=8.0
|
|
@ -0,0 +1,2 @@
|
|||
#Sat Mar 02 21:43:57 WIB 2024
|
||||
java.home=/opt/android-studio/jbr
|
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
|
@ -0,0 +1,328 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="WizardSettings">
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="imageWizard">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="imageAssetPanel">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="actionbar">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="clipArt">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
<entry key="imagePath" value="/tmp/ic_android_black_24dp.xml" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="text">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="textAsset">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="launcher">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="foregroundClipArt">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="imagePath" value="/tmp/ic_android_black_24dp.xml" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="foregroundImage">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
<entry key="imagePath" value="$USER_HOME$/Pictures/gambar_ayam_ras.jpg" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="foregroundText">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="foregroundTextAsset">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="launcherLegacy">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="clipArt">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
<entry key="imagePath" value="/tmp/ic_android_black_24dp.xml" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="text">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="textAsset">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="notification">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="clipArt">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
<entry key="imagePath" value="/tmp/ic_android_black_24dp.xml" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="text">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="textAsset">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="tvBanner">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="foregroundText">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="tvChannel">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="foregroundClipArt">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="imagePath" value="/tmp/ic_android_black_24dp.xml" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="foregroundImage">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="foregroundText">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="foregroundTextAsset">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="000000" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="vectorWizard">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="vectorAssetStep">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="clipartAsset">
|
||||
<value>
|
||||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="url" value="file:$USER_HOME$/Android/Sdk/icons/material/materialicons/navigate_next/baseline_navigate_next_24.xml" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="fc9f5b" />
|
||||
<entry key="outputName" value="ic_next" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,123 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<JetCodeStyleSettings>
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
<option name="FORCE_REARRANGE_MODE" value="1" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
<arrangement>
|
||||
<rules>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:android</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:id</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:name</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>name</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>style</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>ANDROID_ATTRIBUTE_ORDER</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
</rules>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="kotlin">
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
|
@ -0,0 +1,5 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="17" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetSelector">
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="Unnamed">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
</SelectionState>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2024-04-05T18:04:50.959444573Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=e45090f40402" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
<DialogSelection />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.9.0" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,9 @@
|
|||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,122 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="navEditor-manualLayoutAlgorithm2">
|
||||
<option name="myPositions">
|
||||
<map>
|
||||
<entry key="nav_app.xml">
|
||||
<value>
|
||||
<LayoutPositions>
|
||||
<option name="myPositions">
|
||||
<map>
|
||||
<entry key="classificationFragment">
|
||||
<value>
|
||||
<LayoutPositions>
|
||||
<option name="myPosition">
|
||||
<Point>
|
||||
<option name="x" value="178" />
|
||||
<option name="y" value="-51" />
|
||||
</Point>
|
||||
</option>
|
||||
</LayoutPositions>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="homeFragment">
|
||||
<value>
|
||||
<LayoutPositions>
|
||||
<option name="myPosition">
|
||||
<Point>
|
||||
<option name="x" value="-335" />
|
||||
<option name="y" value="-48" />
|
||||
</Point>
|
||||
</option>
|
||||
<option name="myPositions">
|
||||
<map>
|
||||
<entry key="action_homeFragment_to_kualitasSedangFragment">
|
||||
<value>
|
||||
<LayoutPositions />
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="action_homeFragment_to_kualitasTelurBagusFragment">
|
||||
<value>
|
||||
<LayoutPositions />
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="action_homeFragment_to_kualitasTelurJelekFragment">
|
||||
<value>
|
||||
<LayoutPositions />
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</LayoutPositions>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="kualitasSedangFragment">
|
||||
<value>
|
||||
<LayoutPositions>
|
||||
<option name="myPosition">
|
||||
<Point>
|
||||
<option name="x" value="-488" />
|
||||
<option name="y" value="-480" />
|
||||
</Point>
|
||||
</option>
|
||||
</LayoutPositions>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="kualitasTelurBagusFragment">
|
||||
<value>
|
||||
<LayoutPositions>
|
||||
<option name="myPosition">
|
||||
<Point>
|
||||
<option name="x" value="-676" />
|
||||
<option name="y" value="-482" />
|
||||
</Point>
|
||||
</option>
|
||||
</LayoutPositions>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="kualitasTelurJelekFragment">
|
||||
<value>
|
||||
<LayoutPositions>
|
||||
<option name="myPosition">
|
||||
<Point>
|
||||
<option name="x" value="-304" />
|
||||
<option name="y" value="-480" />
|
||||
</Point>
|
||||
</option>
|
||||
</LayoutPositions>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="locationFragment">
|
||||
<value>
|
||||
<LayoutPositions>
|
||||
<option name="myPosition">
|
||||
<Point>
|
||||
<option name="x" value="-105" />
|
||||
<option name="y" value="-52" />
|
||||
</Point>
|
||||
</option>
|
||||
</LayoutPositions>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="profileFragment">
|
||||
<value>
|
||||
<LayoutPositions>
|
||||
<option name="myPosition">
|
||||
<Point>
|
||||
<option name="x" value="392" />
|
||||
<option name="y" value="-50" />
|
||||
</Point>
|
||||
</option>
|
||||
</LayoutPositions>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</LayoutPositions>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1 @@
|
|||
/build
|
|
@ -0,0 +1,77 @@
|
|||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.example.apk_deteksi_kualitas_telur'
|
||||
compileSdk 33
|
||||
|
||||
viewBinding {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.example.apk_deteksi_kualitas_telur"
|
||||
minSdk 21
|
||||
targetSdk 33
|
||||
renderscriptSupportModeEnabled true
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled 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'
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
mlModelBinding true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.core:core-ktx:1.7.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'com.google.android.material:material:1.9.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'com.google.android.gms:play-services-maps:18.1.0'
|
||||
implementation 'org.tensorflow:tensorflow-lite-gpu:2.3.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
|
||||
//html
|
||||
implementation 'androidx.core:core-ktx:1.6.0'
|
||||
|
||||
//card view
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
|
||||
// navigation Fragemnt
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
|
||||
|
||||
//tensorflow
|
||||
implementation 'org.tensorflow:tensorflow-lite-support:0.3.1'
|
||||
implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.0'
|
||||
implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly-SNAPSHOT'
|
||||
|
||||
//card view
|
||||
implementation "androidx.cardview:cardview:1.0.0"
|
||||
|
||||
//image circular
|
||||
implementation 'de.hdodenhof:circleimageview:3.1.0'
|
||||
|
||||
}
|
|
@ -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
|
|
@ -0,0 +1,24 @@
|
|||
package com.example.apk_deteksi_kualitas_telur
|
||||
|
||||
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.example.apk_deteksi_kualitas_telur", appContext.packageName)
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 314 KiB |
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector
|
||||
android:height="108dp"
|
||||
android:width="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 133 KiB |
After Width: | Height: | Size: 49 KiB |
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Apk_deteksi_kualitas_telur"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".Ui.Activity.AyamRasActivity"
|
||||
android:exported="false">
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".Ui.Activity.KualitastelurJelekActivity"
|
||||
android:exported="false">
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".Ui.Activity.KualitasTelurSedangActivity"
|
||||
android:exported="false">
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".Ui.Activity.KualitasTelurBagusActivity"
|
||||
android:exported="false">
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="" />
|
||||
</activity>
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.geo.API_KEY"
|
||||
android:value="@string/google_maps_key" />
|
||||
|
||||
<activity
|
||||
android:name=".Ui.Activity.ObjekDeteksiMainActivity"
|
||||
android:exported="false">
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="" />
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,90 @@
|
|||
orang
|
||||
sepeda
|
||||
mobil
|
||||
sepedaMotor
|
||||
pesawat terbang
|
||||
bis
|
||||
kereta
|
||||
truk
|
||||
kapal
|
||||
lampu lalulintas
|
||||
keran kebakaran
|
||||
???
|
||||
tanda berhenti
|
||||
meteran parkir
|
||||
bangku
|
||||
burung
|
||||
kucing
|
||||
anjing
|
||||
kuda
|
||||
domba
|
||||
sapi
|
||||
gajah
|
||||
beruang
|
||||
zebra
|
||||
jerapah
|
||||
???
|
||||
ransel
|
||||
payung
|
||||
???
|
||||
???
|
||||
tas tangan
|
||||
mengikat
|
||||
koper
|
||||
frisbee
|
||||
ski
|
||||
papan seluncur
|
||||
bola olahraga
|
||||
layang-layang
|
||||
tongkat pemukul baseball
|
||||
sarung baseball
|
||||
skateboard
|
||||
papan luncur
|
||||
raket tenis
|
||||
botol
|
||||
???
|
||||
gelas anggur
|
||||
cangkir
|
||||
garpu
|
||||
pisau
|
||||
sendok
|
||||
mangkuk
|
||||
pisang
|
||||
apel
|
||||
sandwich
|
||||
oranye
|
||||
Brokoli
|
||||
wortel
|
||||
Hot Dog
|
||||
Pizza
|
||||
donat
|
||||
kue
|
||||
kursi
|
||||
sofa
|
||||
tanaman di dalam pot
|
||||
tempat Tidur
|
||||
???
|
||||
meja makan
|
||||
???
|
||||
???
|
||||
toilet
|
||||
???
|
||||
televisi
|
||||
laptop
|
||||
mouse
|
||||
terpencil
|
||||
keyboard
|
||||
telepon selular
|
||||
gelombang mikro
|
||||
oven
|
||||
pemanggang roti
|
||||
tenggelam
|
||||
lemari es
|
||||
???
|
||||
buku
|
||||
jam
|
||||
vas
|
||||
gunting
|
||||
beruang teddy
|
||||
pengering rambut
|
||||
sikat gigi
|
|
@ -0,0 +1,5 @@
|
|||
telur_bagus
|
||||
telur_jelek
|
||||
tidak_ada_telur
|
||||
telur_sedang
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.example.apk_deteksi_kualitas_telur
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.example.apk_deteksi_kualitas_telur.Ui.Activity.ObjekDeteksiMainActivity
|
||||
import com.example.apk_deteksi_kualitas_telur.Ui.Fragment.ClassificationFragment
|
||||
import com.example.apk_deteksi_kualitas_telur.Ui.Fragment.HomeFragment
|
||||
import com.example.apk_deteksi_kualitas_telur.Ui.Fragment.LocationFragment
|
||||
import com.example.apk_deteksi_kualitas_telur.Ui.Fragment.ProfileFragment
|
||||
import com.example.apk_deteksi_kualitas_telur.databinding.ActivityMainBinding
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityMainBinding
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
replaceFragment(HomeFragment())
|
||||
navigationButton()
|
||||
}
|
||||
|
||||
private fun navigationButton() {
|
||||
binding.fabClassification.setOnClickListener {
|
||||
val intent = Intent(this, ObjekDeteksiMainActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
binding.bottomNavigationView.setOnItemSelectedListener {
|
||||
when (it.itemId) {
|
||||
R.id.homeFragment -> replaceFragment(HomeFragment())
|
||||
R.id.locationFragment -> replaceFragment(LocationFragment())
|
||||
R.id.classificationFragment -> replaceFragment(ClassificationFragment())
|
||||
R.id.profileFragment -> replaceFragment(ProfileFragment())
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
private fun replaceFragment(fragment: Fragment) {
|
||||
val fragmentManager = supportFragmentManager
|
||||
val fragmentTransaction = fragmentManager.beginTransaction()
|
||||
fragmentTransaction.replace(R.id.frame_layout, fragment)
|
||||
fragmentTransaction.commit()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
package com.example.apk_deteksi_kualitas_telur.Ui.Activity
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Typeface
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.text.style.StyleSpan
|
||||
import android.text.style.UnderlineSpan
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.example.apk_deteksi_kualitas_telur.R
|
||||
import com.example.apk_deteksi_kualitas_telur.databinding.ActivityAyamRasBinding
|
||||
|
||||
class AyamRasActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityAyamRasBinding
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityAyamRasBinding.inflate(layoutInflater)
|
||||
selectQualityAyamImg()
|
||||
expandedTextViewAyam()
|
||||
setContentView(binding.root)
|
||||
}
|
||||
|
||||
//pilih gambar dan akan menampilkan pada CardView
|
||||
private fun selectQualityAyamImg() {
|
||||
binding.imgItem1.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.ayam_ras01))
|
||||
}
|
||||
binding.imgItem2.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.ayam_ras02))
|
||||
}
|
||||
binding.imgItem3.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.ayam_ras03))
|
||||
}
|
||||
binding.imgItem4.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.ayam_ras04))
|
||||
}
|
||||
}
|
||||
|
||||
//tampilkan sedikit dan banyak pada text view ketika di klik
|
||||
private fun expandedTextViewAyam() {
|
||||
val penjelasanAyamRas = getString(R.string.penjelasan_ayam_ras)
|
||||
val tampilkanSemua = getString(R.string.tamplkan_semua)
|
||||
val fullText = textStyleOutputPenjelasan(penjelasanAyamRas, tampilkanSemua)
|
||||
binding.tvPenjelasanTelurBagus.text = fullText
|
||||
binding.tvPenjelasanTelurBagus.maxLines = 3
|
||||
|
||||
var isExpanded = false
|
||||
binding.tvPenjelasanTelurBagus.setOnClickListener {
|
||||
isExpanded = !isExpanded
|
||||
if (isExpanded) {
|
||||
val penjelasanAyamRasFull = getString(R.string.penjelasan_ayam_ras_full)
|
||||
val tampilkanSedikit = getString(R.string.tampilkan_sedikit)
|
||||
val fullText = textStyleOutputPenjelasan(penjelasanAyamRasFull, tampilkanSedikit)
|
||||
|
||||
binding.tvPenjelasanTelurBagus.text = fullText
|
||||
binding.tvPenjelasanTelurBagus.maxLines = 10000
|
||||
} else {
|
||||
val penjelasanAyamRas = getString(R.string.penjelasan_ayam_ras)
|
||||
val tampilkanSemua = getString(R.string.tamplkan_semua)
|
||||
val fullText = textStyleOutputPenjelasan(penjelasanAyamRas, tampilkanSemua)
|
||||
binding.tvPenjelasanTelurBagus.text = fullText
|
||||
binding.tvPenjelasanTelurBagus.maxLines = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun textStyleOutputPenjelasan(textAwal: String, textAkhir: String): SpannableString {
|
||||
val spannableString = SpannableString("$textAwal$textAkhir")
|
||||
//text underline
|
||||
val startIndex = spannableString.indexOf(textAkhir)
|
||||
val colorSpan = ContextCompat.getColor(this, R.color.coklatTelur)
|
||||
|
||||
val boldSpan = StyleSpan(Typeface.BOLD)
|
||||
val underlineSpan = UnderlineSpan()
|
||||
|
||||
if (startIndex != -1) {
|
||||
val endIndex = startIndex + textAkhir.length
|
||||
//memberi garis bawah
|
||||
spannableString.setSpan(
|
||||
underlineSpan, startIndex, endIndex, Spanned.SPAN_INCLUSIVE_INCLUSIVE
|
||||
)
|
||||
//memberi warna akhir color text
|
||||
spannableString.setSpan(
|
||||
ForegroundColorSpan(colorSpan),
|
||||
startIndex,
|
||||
endIndex,
|
||||
Spanned.SPAN_INCLUSIVE_INCLUSIVE
|
||||
)
|
||||
|
||||
//memberi warna akhir color text
|
||||
spannableString.setSpan(
|
||||
boldSpan, startIndex, endIndex, Spanned.SPAN_INCLUSIVE_INCLUSIVE
|
||||
)
|
||||
}
|
||||
return spannableString
|
||||
}
|
||||
|
||||
private fun getSampleImage(drawable: Int): Bitmap {
|
||||
return BitmapFactory.decodeResource(resources, drawable, BitmapFactory.Options().apply {
|
||||
inMutable = true
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
package com.example.apk_deteksi_kualitas_telur.Ui.Activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Typeface
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.text.style.StyleSpan
|
||||
import android.text.style.UnderlineSpan
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.example.apk_deteksi_kualitas_telur.MainActivity
|
||||
import com.example.apk_deteksi_kualitas_telur.R
|
||||
import com.example.apk_deteksi_kualitas_telur.databinding.ActivityKualitasTelurBagusBinding
|
||||
|
||||
class KualitasTelurBagusActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityKualitasTelurBagusBinding
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityKualitasTelurBagusBinding.inflate(layoutInflater)
|
||||
selectQualityTelurImg()
|
||||
expandedTextViewTelur()
|
||||
binding.imgBack.setOnClickListener {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
setContentView(binding.root)
|
||||
}
|
||||
|
||||
//pilih gambar dan akan menampilkan pada CardView
|
||||
private fun selectQualityTelurImg() {
|
||||
binding.imgItem1.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.bagus01))
|
||||
}
|
||||
binding.imgItem2.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.bagus02))
|
||||
}
|
||||
binding.imgItem3.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.bagus03))
|
||||
}
|
||||
binding.imgItem4.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.bagus04))
|
||||
}
|
||||
}
|
||||
|
||||
//tampilkan sedikit dan banyak pada text view ketika di klik
|
||||
private fun expandedTextViewTelur() {
|
||||
var isExpanded = false
|
||||
val penjelasanTelurBagus = getString(R.string.penjelasan_telur_bagus)
|
||||
val tampilkanSemua = getString(R.string.tamplkan_semua)
|
||||
val textTampilanSedikit = textStyleOutputPenjelasan(penjelasanTelurBagus, tampilkanSemua)
|
||||
binding.tvPenjelasanTelurBagus.text = textTampilanSedikit
|
||||
|
||||
binding.tvPenjelasanTelurBagus.setOnClickListener {
|
||||
isExpanded = !isExpanded
|
||||
if (isExpanded) {
|
||||
|
||||
val penjelasanTelurBagusFull = getString(R.string.penjelasan_telur_bagus_full)
|
||||
val tampilkanSedikit = getString(R.string.tampilkan_sedikit)
|
||||
|
||||
val fullText = textStyleOutputPenjelasan(penjelasanTelurBagusFull, tampilkanSedikit)
|
||||
binding.tvPenjelasanTelurBagus.text = fullText
|
||||
|
||||
binding.tvPenjelasanTelurBagus.maxLines = 10000
|
||||
} else {
|
||||
val penjelasanTelurBagus = getString(R.string.penjelasan_telur_bagus)
|
||||
val tampilkanSemua = getString(R.string.tamplkan_semua)
|
||||
|
||||
val fullText = textStyleOutputPenjelasan(penjelasanTelurBagus, tampilkanSemua)
|
||||
|
||||
binding.tvPenjelasanTelurBagus.text = fullText
|
||||
binding.tvPenjelasanTelurBagus.maxLines = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun textStyleOutputPenjelasan(textAwal: String, textAkhir: String): SpannableString {
|
||||
val spannableString = SpannableString("$textAwal$textAkhir")
|
||||
//text underline
|
||||
val startIndex = spannableString.indexOf(textAkhir)
|
||||
val colorSpan = ContextCompat.getColor(this, R.color.coklatTelur)
|
||||
|
||||
val boldSpan = StyleSpan(Typeface.BOLD)
|
||||
val underlineSpan = UnderlineSpan()
|
||||
|
||||
if (startIndex != -1) {
|
||||
val endIndex = startIndex + textAkhir.length
|
||||
//memberi garis bawah
|
||||
spannableString.setSpan(
|
||||
underlineSpan, startIndex, endIndex, Spanned.SPAN_INCLUSIVE_INCLUSIVE
|
||||
)
|
||||
//memberi warna akhir color text
|
||||
spannableString.setSpan(
|
||||
ForegroundColorSpan(colorSpan),
|
||||
startIndex,
|
||||
endIndex,
|
||||
Spanned.SPAN_INCLUSIVE_INCLUSIVE
|
||||
)
|
||||
|
||||
//memberi warna akhir color text
|
||||
spannableString.setSpan(
|
||||
boldSpan, startIndex, endIndex, Spanned.SPAN_INCLUSIVE_INCLUSIVE
|
||||
)
|
||||
}
|
||||
return spannableString
|
||||
}
|
||||
|
||||
private fun getSampleImage(drawable: Int): Bitmap {
|
||||
return BitmapFactory.decodeResource(resources, drawable, BitmapFactory.Options().apply {
|
||||
inMutable = true
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
package com.example.apk_deteksi_kualitas_telur.Ui.Activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Typeface
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.text.style.StyleSpan
|
||||
import android.text.style.UnderlineSpan
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.text.HtmlCompat
|
||||
import com.example.apk_deteksi_kualitas_telur.MainActivity
|
||||
import com.example.apk_deteksi_kualitas_telur.R
|
||||
import com.example.apk_deteksi_kualitas_telur.databinding.ActivityKualitasTelurSedangBinding
|
||||
|
||||
class KualitasTelurSedangActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityKualitasTelurSedangBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityKualitasTelurSedangBinding.inflate(layoutInflater)
|
||||
binding.imgBack.setOnClickListener {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
selectQualityTelurImgSedang()
|
||||
expandedTextViewTelurSedang()
|
||||
setContentView(binding.root)
|
||||
}
|
||||
|
||||
//pilih gambar dan akan menampilkan pada CardView
|
||||
private fun selectQualityTelurImgSedang() {
|
||||
binding.imgItem1.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.sedang01))
|
||||
}
|
||||
binding.imgItem2.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.sedang02))
|
||||
}
|
||||
binding.imgItem3.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.sedang03))
|
||||
}
|
||||
binding.imgItem4.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.sedang04))
|
||||
}
|
||||
}
|
||||
|
||||
//tampilkan sedikit dan banyak pada text view ketika di klik
|
||||
private fun expandedTextViewTelurSedang() {
|
||||
var isExpanded = false
|
||||
val penjelasanTelurSedang = getString(R.string.penjelasan_telur_sedang)
|
||||
val tampilkanLebihBanyak = getString(R.string.tamplkan_semua)
|
||||
val fullText = textStyleOutputPenjelasan(penjelasanTelurSedang, tampilkanLebihBanyak)
|
||||
binding.tvPenjelasanTelurSedang.text = fullText
|
||||
|
||||
binding.tvPenjelasanTelurSedang.setOnClickListener {
|
||||
isExpanded = !isExpanded
|
||||
if (isExpanded) {
|
||||
val penjelasanTelurSedangFull = getString(R.string.penjelasan_telur_sedang_full)
|
||||
val tampilkanSedikit = getString(R.string.tampilkan_sedikit)
|
||||
val fullText =
|
||||
textStyleOutputPenjelasan(penjelasanTelurSedangFull, tampilkanSedikit)
|
||||
binding.tvPenjelasanTelurSedang.text = fullText
|
||||
binding.tvPenjelasanTelurSedang.maxLines = 10000
|
||||
} else {
|
||||
val penjelasanTelurSedang = getString(R.string.penjelasan_telur_sedang)
|
||||
val tampilkanLebihBanyak = getString(R.string.tamplkan_semua)
|
||||
val fullText =
|
||||
textStyleOutputPenjelasan(penjelasanTelurSedang, tampilkanLebihBanyak)
|
||||
binding.tvPenjelasanTelurSedang.text = fullText
|
||||
binding.tvPenjelasanTelurSedang.maxLines = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun textStyleOutputPenjelasan(textAwal: String, textAkhir: String): SpannableString {
|
||||
val spannableString = SpannableString("$textAwal$textAkhir")
|
||||
|
||||
val startIndex = spannableString.indexOf(textAkhir)
|
||||
val colorSpan = ContextCompat.getColor(this, R.color.coklatTelur)
|
||||
|
||||
val boldSpan = StyleSpan(Typeface.BOLD)
|
||||
val underlineSpan = UnderlineSpan()
|
||||
|
||||
if (startIndex != -1) {
|
||||
val endIndex = startIndex + textAkhir.length
|
||||
//memberi garis bawah
|
||||
spannableString.setSpan(
|
||||
underlineSpan, startIndex, endIndex, Spanned.SPAN_INCLUSIVE_INCLUSIVE
|
||||
)
|
||||
|
||||
//memberi warna akhir color text
|
||||
spannableString.setSpan(
|
||||
ForegroundColorSpan(colorSpan),
|
||||
startIndex,
|
||||
endIndex,
|
||||
Spanned.SPAN_INCLUSIVE_INCLUSIVE
|
||||
)
|
||||
|
||||
//memberi warna akhir color text
|
||||
spannableString.setSpan(
|
||||
boldSpan, startIndex, endIndex, Spanned.SPAN_INCLUSIVE_INCLUSIVE
|
||||
)
|
||||
}
|
||||
return spannableString
|
||||
}
|
||||
|
||||
private fun getSampleImage(drawable: Int): Bitmap {
|
||||
return BitmapFactory.decodeResource(resources, drawable, BitmapFactory.Options().apply {
|
||||
inMutable = true
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
package com.example.apk_deteksi_kualitas_telur.Ui.Activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Typeface
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.text.style.StyleSpan
|
||||
import android.text.style.UnderlineSpan
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.example.apk_deteksi_kualitas_telur.MainActivity
|
||||
import com.example.apk_deteksi_kualitas_telur.R
|
||||
import com.example.apk_deteksi_kualitas_telur.databinding.ActivityKualitastelurJelekBinding
|
||||
|
||||
class KualitastelurJelekActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityKualitastelurJelekBinding
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityKualitastelurJelekBinding.inflate(layoutInflater)
|
||||
binding.imgBack.setOnClickListener {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
selectQualityTelurImgJelek()
|
||||
expandedTextViewTelurJelek()
|
||||
setContentView(binding.root)
|
||||
}
|
||||
|
||||
//pilih gambar dan akan menampilkan pada CardView
|
||||
private fun selectQualityTelurImgJelek() {
|
||||
binding.imgItem1.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.jelek01))
|
||||
}
|
||||
binding.imgItem2.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.jelek02))
|
||||
}
|
||||
binding.imgItem3.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.jelek03))
|
||||
}
|
||||
binding.imgItem4.setOnClickListener {
|
||||
binding.imgViewShow.setImageBitmap(getSampleImage(R.drawable.jelek04))
|
||||
}
|
||||
}
|
||||
|
||||
//tampilkan sedikit dan banyak pada text view ketika di klik
|
||||
private fun expandedTextViewTelurJelek() {
|
||||
var isExpanded = false
|
||||
|
||||
val penjelasanTelurJelek = getString(R.string.penjelasan_telur_jelek)
|
||||
val tampilkanLebihBanyak = getString(R.string.tamplkan_semua)
|
||||
val fullText = textStyleOutputPenjelasan(penjelasanTelurJelek, tampilkanLebihBanyak)
|
||||
binding.tvPenjelasanTelurjelek.text = fullText
|
||||
|
||||
binding.tvPenjelasanTelurjelek.setOnClickListener {
|
||||
isExpanded = !isExpanded
|
||||
if (isExpanded) {
|
||||
val penjelasanTelurJelekFull = getString(R.string.penjelasan_telur_jelek_full)
|
||||
val tampilkanSedikit = getString(R.string.tampilkan_sedikit)
|
||||
|
||||
val fullText = textStyleOutputPenjelasan(penjelasanTelurJelekFull, tampilkanSedikit)
|
||||
|
||||
binding.tvPenjelasanTelurjelek.text = fullText
|
||||
binding.tvPenjelasanTelurjelek.maxLines = 10000
|
||||
} else {
|
||||
val penjelasanTelurJelek = getString(R.string.penjelasan_telur_jelek)
|
||||
val tampilkanLebihBanyak = getString(R.string.tamplkan_semua)
|
||||
val fullText = textStyleOutputPenjelasan(penjelasanTelurJelek, tampilkanLebihBanyak)
|
||||
binding.tvPenjelasanTelurjelek.text = fullText
|
||||
binding.tvPenjelasanTelurjelek.maxLines = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun textStyleOutputPenjelasan(textAwal: String, textAkhir: String): SpannableString {
|
||||
val spannableString = SpannableString("$textAwal$textAkhir")
|
||||
|
||||
val startIndex = spannableString.indexOf(textAkhir)
|
||||
val colorSpan = ContextCompat.getColor(this, R.color.coklatTelur)
|
||||
|
||||
val boldSpan = StyleSpan(Typeface.BOLD)
|
||||
val underlineSpan = UnderlineSpan()
|
||||
|
||||
if (startIndex != -1) {
|
||||
val endIndex = startIndex + textAkhir.length
|
||||
//memberi garis bawah
|
||||
spannableString.setSpan(
|
||||
underlineSpan, startIndex, endIndex, Spanned.SPAN_INCLUSIVE_INCLUSIVE
|
||||
)
|
||||
//memberi warna akhir color text
|
||||
spannableString.setSpan(
|
||||
ForegroundColorSpan(colorSpan),
|
||||
startIndex,
|
||||
endIndex,
|
||||
Spanned.SPAN_INCLUSIVE_INCLUSIVE
|
||||
)
|
||||
|
||||
//memberi warna akhir color text
|
||||
spannableString.setSpan(
|
||||
boldSpan, startIndex, endIndex, Spanned.SPAN_INCLUSIVE_INCLUSIVE
|
||||
)
|
||||
}
|
||||
return spannableString
|
||||
}
|
||||
|
||||
private fun getSampleImage(drawable: Int): Bitmap {
|
||||
return BitmapFactory.decodeResource(resources, drawable, BitmapFactory.Options().apply {
|
||||
inMutable = true
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
package com.example.apk_deteksi_kualitas_telur.Ui.Activity
|
||||
|
||||
import android.Manifest
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.*
|
||||
import android.hardware.camera2.CameraCaptureSession
|
||||
import android.hardware.camera2.CameraDevice
|
||||
import android.hardware.camera2.CameraManager
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.HandlerThread
|
||||
import android.view.Surface
|
||||
import android.view.TextureView
|
||||
import android.widget.ImageView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.example.apk_deteksi_kualitas_telur.databinding.ActivityObjekDeteksiMainBinding
|
||||
import com.example.apk_deteksi_kualitas_telur.ml.SsdMobilenetV11Metadata1
|
||||
import org.tensorflow.lite.support.common.FileUtil
|
||||
import org.tensorflow.lite.support.image.ImageProcessor
|
||||
import org.tensorflow.lite.support.image.TensorImage
|
||||
import org.tensorflow.lite.support.image.ops.ResizeOp
|
||||
|
||||
//klasifikasi secara realtime
|
||||
class ObjekDeteksiMainActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityObjekDeteksiMainBinding
|
||||
private lateinit var labels: List<String>
|
||||
|
||||
var colors = listOf<Int>(
|
||||
Color.BLUE,
|
||||
Color.GREEN,
|
||||
Color.RED,
|
||||
Color.CYAN,
|
||||
Color.GRAY,
|
||||
Color.BLACK,
|
||||
Color.DKGRAY,
|
||||
Color.MAGENTA,
|
||||
Color.YELLOW,
|
||||
Color.RED
|
||||
)
|
||||
|
||||
val paint = Paint()
|
||||
lateinit var imageProcessor: ImageProcessor
|
||||
lateinit var bitmap: Bitmap
|
||||
lateinit var cameraDevice: CameraDevice
|
||||
lateinit var handler: Handler
|
||||
lateinit var cameraManager: CameraManager
|
||||
lateinit var textureView: TextureView
|
||||
lateinit var model: SsdMobilenetV11Metadata1
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityObjekDeteksiMainBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
getPermission()
|
||||
initializedTensorflow()
|
||||
}
|
||||
|
||||
private fun initializedTensorflow() {
|
||||
labels = FileUtil.loadLabels(this, "label.txt")
|
||||
// menentukan input berapa pixel
|
||||
imageProcessor =
|
||||
ImageProcessor.Builder().add(ResizeOp(300, 300, ResizeOp.ResizeMethod.BILINEAR)).build()
|
||||
model = SsdMobilenetV11Metadata1.newInstance(this)
|
||||
val handlerThread = HandlerThread("videoThread")
|
||||
handlerThread.start()
|
||||
handler = Handler(handlerThread.looper)
|
||||
textureView = binding.textureView
|
||||
textureView.surfaceTextureListener = object : TextureView.SurfaceTextureListener {
|
||||
override fun onSurfaceTextureAvailable(
|
||||
surface: SurfaceTexture, width: Int, height: Int
|
||||
) {
|
||||
openCamera()
|
||||
}
|
||||
|
||||
override fun onSurfaceTextureSizeChanged(
|
||||
surface: SurfaceTexture, width: Int, height: Int
|
||||
) {
|
||||
openCamera()
|
||||
}
|
||||
|
||||
override fun onSurfaceTextureDestroyed(surface: SurfaceTexture): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onSurfaceTextureUpdated(surface: SurfaceTexture) {
|
||||
bitmap = textureView.bitmap!!
|
||||
|
||||
var image = TensorImage.fromBitmap(bitmap)
|
||||
image = imageProcessor.process(image)
|
||||
|
||||
val outputs = model.process(image)
|
||||
val locations = outputs.locationsAsTensorBuffer.floatArray
|
||||
val classes = outputs.classesAsTensorBuffer.floatArray
|
||||
val scores = outputs.scoresAsTensorBuffer.floatArray
|
||||
|
||||
var mutable = bitmap.copy(Bitmap.Config.ARGB_8888, true)
|
||||
val canvas = Canvas(mutable)
|
||||
|
||||
val h = mutable.height
|
||||
val w = mutable.width
|
||||
paint.textSize = h / 15f
|
||||
paint.strokeWidth = h / 85f
|
||||
var x = 0
|
||||
scores.forEachIndexed { index, fl ->
|
||||
x = index
|
||||
x *= 4
|
||||
if (fl > 0.5) {
|
||||
paint.setColor(colors.get(index))
|
||||
paint.style = Paint.Style.STROKE
|
||||
canvas.drawRect(
|
||||
RectF(
|
||||
locations.get(x + 1) * w,
|
||||
locations.get(x) * h,
|
||||
locations.get(x + 3) * w,
|
||||
locations.get(x + 2) * h
|
||||
), paint
|
||||
)
|
||||
paint.style = Paint.Style.FILL
|
||||
canvas.drawText(
|
||||
labels.get(
|
||||
classes.get(index).toInt()
|
||||
) + " " + fl.toString(),
|
||||
locations.get(x + 1) * w,
|
||||
locations.get(x) * h,
|
||||
paint
|
||||
)
|
||||
}
|
||||
binding.imageView.setImageBitmap(mutable)
|
||||
}
|
||||
}
|
||||
}
|
||||
cameraManager = getSystemService(CAMERA_SERVICE) as CameraManager
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
private fun openCamera() {
|
||||
cameraManager.openCamera(
|
||||
cameraManager.cameraIdList[0], object : CameraDevice.StateCallback() {
|
||||
override fun onOpened(p0: CameraDevice) {
|
||||
cameraDevice = p0
|
||||
|
||||
var surfaceTexture = textureView.surfaceTexture
|
||||
var surface = Surface(surfaceTexture)
|
||||
|
||||
var captureRequest =
|
||||
cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW)
|
||||
captureRequest.addTarget(surface)
|
||||
|
||||
cameraDevice.createCaptureSession(
|
||||
listOf(surface), object : CameraCaptureSession.StateCallback() {
|
||||
override fun onConfigured(p0: CameraCaptureSession) {
|
||||
p0.setRepeatingRequest(captureRequest.build(), null, null)
|
||||
}
|
||||
|
||||
override fun onConfigureFailed(p0: CameraCaptureSession) {
|
||||
}
|
||||
}, handler
|
||||
)
|
||||
}
|
||||
|
||||
override fun onDisconnected(p0: CameraDevice) {
|
||||
|
||||
}
|
||||
|
||||
override fun onError(p0: CameraDevice, p1: Int) {
|
||||
|
||||
}
|
||||
}, handler
|
||||
)
|
||||
}
|
||||
|
||||
private fun getPermission() {
|
||||
if (ContextCompat.checkSelfPermission(
|
||||
this, Manifest.permission.CAMERA
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
requestPermissions(arrayOf(Manifest.permission.CAMERA), 101)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int, permissions: Array<out String>, grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (grantResults[0] != PackageManager.PERMISSION_GRANTED) {
|
||||
getPermission()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
model.close()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
package com.example.apk_deteksi_kualitas_telur.Ui.Fragment
|
||||
|
||||
import android.Manifest
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.SurfaceTexture
|
||||
import android.hardware.camera2.CameraCaptureSession
|
||||
import android.hardware.camera2.CameraDevice
|
||||
import android.hardware.camera2.CameraManager
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.HandlerThread
|
||||
import android.view.*
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.example.apk_deteksi_kualitas_telur.databinding.FragmentClassificationBinding
|
||||
import com.example.apk_deteksi_kualitas_telur.ml.ModelMobilenetv3Telur9967NewCrop
|
||||
import org.tensorflow.lite.DataType
|
||||
import org.tensorflow.lite.support.common.FileUtil
|
||||
import org.tensorflow.lite.support.image.ImageProcessor
|
||||
import org.tensorflow.lite.support.image.TensorImage
|
||||
import org.tensorflow.lite.support.image.ops.ResizeOp
|
||||
import org.tensorflow.lite.support.tensorbuffer.TensorBuffer
|
||||
|
||||
class ClassificationFragment : Fragment() {
|
||||
private var _binding: FragmentClassificationBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
|
||||
private lateinit var labels: List<String>
|
||||
lateinit var imageProcessor: ImageProcessor
|
||||
lateinit var bitmap: Bitmap
|
||||
lateinit var cameraDevice: CameraDevice
|
||||
lateinit var handler: Handler
|
||||
lateinit var cameraManager: CameraManager
|
||||
lateinit var textureView: TextureView
|
||||
lateinit var models: ModelMobilenetv3Telur9967NewCrop
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View? {
|
||||
_binding = FragmentClassificationBinding.inflate(inflater, container, false)
|
||||
getPermission()
|
||||
initializedTensorflow()
|
||||
return binding.root
|
||||
}
|
||||
|
||||
private fun initializedTensorflow() {
|
||||
labels = FileUtil.loadLabels(requireContext(), "labels.txt")
|
||||
// menentukan input berapa pixel
|
||||
imageProcessor =
|
||||
ImageProcessor.Builder().add(ResizeOp(224, 224, ResizeOp.ResizeMethod.BILINEAR)).build()
|
||||
|
||||
val handlerThread = HandlerThread("videoThread")
|
||||
handlerThread.start()
|
||||
|
||||
handler = Handler(handlerThread.looper)
|
||||
textureView = binding.textureView
|
||||
|
||||
textureView.surfaceTextureListener = object : TextureView.SurfaceTextureListener {
|
||||
override fun onSurfaceTextureAvailable(
|
||||
surface: SurfaceTexture, width: Int, height: Int
|
||||
) {
|
||||
openCamera()
|
||||
}
|
||||
|
||||
override fun onSurfaceTextureSizeChanged(
|
||||
surface: SurfaceTexture, width: Int, height: Int
|
||||
) {
|
||||
openCamera()
|
||||
}
|
||||
|
||||
override fun onSurfaceTextureDestroyed(surface: SurfaceTexture): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onSurfaceTextureUpdated(surface: SurfaceTexture) {
|
||||
bitmap = textureView.bitmap!!
|
||||
|
||||
var mutable = bitmap.copy(Bitmap.Config.ARGB_8888, true)
|
||||
|
||||
var tensorImage = TensorImage(DataType.FLOAT32)
|
||||
tensorImage.load(bitmap)
|
||||
|
||||
tensorImage = imageProcessor.process(tensorImage)
|
||||
models = ModelMobilenetv3Telur9967NewCrop.newInstance(requireContext())
|
||||
|
||||
val inputFeature0 =
|
||||
TensorBuffer.createFixedSize(intArrayOf(1, 224, 224, 3), DataType.FLOAT32)
|
||||
|
||||
inputFeature0.loadBuffer(tensorImage.buffer)
|
||||
|
||||
val outputs = models.process(inputFeature0)
|
||||
val outputFeature0 = outputs.outputFeature0AsTensorBuffer.floatArray
|
||||
|
||||
|
||||
var maxIdx = 0
|
||||
outputFeature0.forEachIndexed { index, fl ->
|
||||
if (outputFeature0[maxIdx] < fl) {
|
||||
maxIdx = index
|
||||
}
|
||||
}
|
||||
val prediksiLabel = labels[maxIdx]
|
||||
|
||||
binding.tvViewKlasifikasi.text = prediksiLabel
|
||||
// binding.tvViewKlasifikasiNilai.text = "$(Akurasi: $accuracyPercentage%)"
|
||||
binding.imageView.setImageBitmap(mutable)
|
||||
}
|
||||
}
|
||||
|
||||
cameraManager = requireContext().getSystemService(Context.CAMERA_SERVICE) as CameraManager
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
private fun openCamera() {
|
||||
cameraManager.openCamera(
|
||||
cameraManager.cameraIdList[0], object : CameraDevice.StateCallback() {
|
||||
override fun onOpened(p0: CameraDevice) {
|
||||
cameraDevice = p0
|
||||
|
||||
var surfaceTexture = textureView.surfaceTexture
|
||||
var surface = Surface(surfaceTexture)
|
||||
|
||||
var captureRequest =
|
||||
cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW)
|
||||
captureRequest.addTarget(surface)
|
||||
|
||||
cameraDevice.createCaptureSession(
|
||||
listOf(surface), object : CameraCaptureSession.StateCallback() {
|
||||
override fun onConfigured(p0: CameraCaptureSession) {
|
||||
p0.setRepeatingRequest(captureRequest.build(), null, null)
|
||||
}
|
||||
|
||||
override fun onConfigureFailed(p0: CameraCaptureSession) {
|
||||
}
|
||||
}, handler
|
||||
)
|
||||
}
|
||||
|
||||
override fun onDisconnected(p0: CameraDevice) {
|
||||
|
||||
}
|
||||
|
||||
override fun onError(p0: CameraDevice, p1: Int) {
|
||||
|
||||
}
|
||||
}, handler
|
||||
)
|
||||
}
|
||||
|
||||
private fun getPermission() {
|
||||
if (ContextCompat.checkSelfPermission(
|
||||
requireContext(), Manifest.permission.CAMERA
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
requestPermissions(arrayOf(Manifest.permission.CAMERA), 101)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int, permissions: Array<out String>, grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (grantResults[0] != PackageManager.PERMISSION_GRANTED) {
|
||||
getPermission()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
_binding = null
|
||||
models.close()
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.example.apk_deteksi_kualitas_telur.Ui.Fragment
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.example.apk_deteksi_kualitas_telur.R
|
||||
import com.example.apk_deteksi_kualitas_telur.Ui.Activity.AyamRasActivity
|
||||
import com.example.apk_deteksi_kualitas_telur.Ui.Activity.KualitasTelurBagusActivity
|
||||
import com.example.apk_deteksi_kualitas_telur.Ui.Activity.KualitasTelurSedangActivity
|
||||
import com.example.apk_deteksi_kualitas_telur.Ui.Activity.KualitastelurJelekActivity
|
||||
import com.example.apk_deteksi_kualitas_telur.databinding.FragmentHomeBinding
|
||||
|
||||
|
||||
class HomeFragment : Fragment() {
|
||||
private var _binding: FragmentHomeBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View? {
|
||||
_binding = FragmentHomeBinding.inflate(inflater, container, false)
|
||||
movePageKualtasTelur()
|
||||
return binding.root
|
||||
}
|
||||
|
||||
private fun movePageKualtasTelur() {
|
||||
binding.cvBagus.setOnClickListener {
|
||||
val intent = Intent(requireContext(), KualitasTelurBagusActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
binding.cvSedang.setOnClickListener {
|
||||
val intent = Intent(requireContext(), KualitasTelurSedangActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
binding.cvJelek.setOnClickListener {
|
||||
val intent = Intent(requireContext(), KualitastelurJelekActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
binding.cvAyamRas.setOnClickListener {
|
||||
val intent = Intent(requireContext(), AyamRasActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
_binding = null
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.example.apk_deteksi_kualitas_telur.Ui.Fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.example.apk_deteksi_kualitas_telur.R
|
||||
import com.example.apk_deteksi_kualitas_telur.databinding.FragmentLocationBinding
|
||||
import com.google.android.gms.maps.CameraUpdateFactory
|
||||
import com.google.android.gms.maps.GoogleMap
|
||||
import com.google.android.gms.maps.OnMapReadyCallback
|
||||
import com.google.android.gms.maps.SupportMapFragment
|
||||
import com.google.android.gms.maps.model.LatLng
|
||||
import com.google.android.gms.maps.model.MarkerOptions
|
||||
|
||||
class LocationFragment : Fragment(), OnMapReadyCallback {
|
||||
private var _binding: FragmentLocationBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var googleMap: GoogleMap
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View? {
|
||||
_binding = FragmentLocationBinding.inflate(inflater, container, false)
|
||||
val mapFragment =
|
||||
childFragmentManager.findFragmentById(R.id.mapContainer) as SupportMapFragment
|
||||
mapFragment.getMapAsync(this)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onMapReady(map: GoogleMap) {
|
||||
googleMap = map
|
||||
val lokasiMahbubi = LatLng(-7.0853847, 113.5983155153)
|
||||
googleMap.addMarker(MarkerOptions().position(lokasiMahbubi).title("Madura-Pamekasan"))
|
||||
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(lokasiMahbubi, 15f))
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.example.apk_deteksi_kualitas_telur.Ui.Fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.example.apk_deteksi_kualitas_telur.R
|
||||
import com.example.apk_deteksi_kualitas_telur.databinding.FragmentProfileBinding
|
||||
|
||||
|
||||
class ProfileFragment : Fragment() {
|
||||
private var _binding: FragmentProfileBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View? {
|
||||
_binding = FragmentProfileBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
_binding = null
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 266 KiB |
After Width: | Height: | Size: 208 KiB |
After Width: | Height: | Size: 250 KiB |
After Width: | Height: | Size: 217 KiB |
After Width: | Height: | Size: 119 KiB |