diff --git a/.github/ISSUE_TEMPLATE/新機能用テンプレート.md b/.github/ISSUE_TEMPLATE/新機能用テンプレート.md new file mode 100644 index 00000000..5518f596 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/新機能用テンプレート.md @@ -0,0 +1,10 @@ +--- +name: 新機能用テンプレート +about: 新規開発Issue用テンプレート +title: '' +labels: '' +assignees: '' + +--- + +WIP diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 00000000..86eae3b4 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Lacerta \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 00000000..b589d56e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 00000000..0c0c3383 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 00000000..29b2542d --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,18 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 00000000..0c622ae3 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,38 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 00000000..f8051a6f --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..8978d23d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index ea8ca76d..8f9e28fc 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ # Lacerta WIP +## モジュール設計 + +![Untitled Diagram(2)](https://github.com/lacerta-doc/Lacerta/assets/66072112/9daabaca-5cdc-49f8-ac66-196c588a47c9) + +## メモ +- アイコン: Google Material Icons https://fonts.google.com/icons (Weight:300, Grade:0, Optical size: 24px) + +## コーディング規則/推奨(WIP) +### 規則 +- `// TODO`コメントには任意のsuffixを付ける + - 全員が同じ`// TODO:`を使っていると検索がむずかしくなるため + - (例: `// TODO-rca:`) +### 推奨 +- マジックナンバーは控える(必要な場合もあるので) + diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 00000000..2538a406 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,90 @@ +plugins { + id 'com.android.application' + id 'com.google.dagger.hilt.android' +} + +android { + namespace 'one.nem.lacerta' + compileSdk 34 + + defaultConfig { + applicationId "one.nem.lacerta" + minSdk 26 + targetSdk 33 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + debug { // 開発メンバー用 + debuggable true + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + + applicationIdSuffix ".debug" + matchingFallbacks = ['release'] + } + beta_release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + + applicationIdSuffix ".beta" + matchingFallbacks = ['release'] + } + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + implementation libs.androidx.appcompat + implementation libs.com.google.android.material + implementation libs.androidx.constraintlayout + testImplementation libs.junit + androidTestImplementation libs.androidx.test.ext.junit + androidTestImplementation libs.androidx.test.espresso.core + + // 内部モジュール + // Feature + implementation project(':feature:home') + implementation project(':feature:search') + implementation project(':feature:library') + implementation project(':feature:scan') + implementation project(':feature:debug') // デバッグメニュー + +// // Component +// implementation project(':component:common') +// implementation project(':component:scanner') +// implementation project(':component:viewer') + +// // Data +// implementation project(':data:repository') +// +// // Source +// implementation project(':data:source:database') +// implementation project(':data:source:preference') +// + implementation project(':data') + + implementation project(':shared:ui') + + implementation project(':shared:icon') + + // Hilt (DI) + implementation libs.com.google.dagger.hilt.android + annotationProcessor libs.com.google.dagger.hilt.compiler + + // Navigation + implementation libs.navigation.fragment + implementation libs.navigation.ui + implementation libs.navigation.dynamic.features.fragment + +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/app/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/app/src/androidTest/java/one/nem/lacerta/ExampleInstrumentedTest.java b/app/src/androidTest/java/one/nem/lacerta/ExampleInstrumentedTest.java new file mode 100644 index 00000000..be866444 --- /dev/null +++ b/app/src/androidTest/java/one/nem/lacerta/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package one.nem.lacerta; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("one.nem.lacerta", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..6ad838c8 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/one/nem/lacerta/LacertaApplication.java b/app/src/main/java/one/nem/lacerta/LacertaApplication.java new file mode 100644 index 00000000..d2d838af --- /dev/null +++ b/app/src/main/java/one/nem/lacerta/LacertaApplication.java @@ -0,0 +1,18 @@ +package one.nem.lacerta; + +import android.app.Application; + +import com.google.android.material.color.DynamicColors; + +import dagger.hilt.android.HiltAndroidApp; + +@HiltAndroidApp +public class LacertaApplication extends Application { + @Override + public void onCreate() { + super.onCreate(); + + // DynamicColorを有効化 + DynamicColors.applyToActivitiesIfAvailable(this); + } +} diff --git a/app/src/main/java/one/nem/lacerta/MainActivity.java b/app/src/main/java/one/nem/lacerta/MainActivity.java new file mode 100644 index 00000000..404debd0 --- /dev/null +++ b/app/src/main/java/one/nem/lacerta/MainActivity.java @@ -0,0 +1,40 @@ +package one.nem.lacerta; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.FragmentManager; +import androidx.navigation.NavController; +import androidx.navigation.fragment.NavHostFragment; +import androidx.navigation.ui.NavigationUI; + +import android.os.Bundle; +import android.widget.Toast; + +import com.google.android.material.bottomnavigation.BottomNavigationView; + + + + +import dagger.hilt.android.AndroidEntryPoint; +import javax.inject.Inject; + +@AndroidEntryPoint +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + // Debug + FragmentManager supportFragmentManager = getSupportFragmentManager(); + + NavHostFragment navHostFragment = (NavHostFragment) supportFragmentManager.findFragmentById(R.id.nav_host_fragment); + NavController navController = navHostFragment.getNavController(); + BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_nav); + + NavigationUI.setupWithNavController(bottomNavigationView, navController); + + Toast.makeText(this, "testMessage", Toast.LENGTH_SHORT).show(); + } + +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..2117b2e1 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,32 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/bottom_nav_menu.xml b/app/src/main/res/menu/bottom_nav_menu.xml new file mode 100644 index 00000000..9742222d --- /dev/null +++ b/app/src/main/res/menu/bottom_nav_menu.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi/ic_launcher.xml b/app/src/main/res/mipmap-anydpi/ic_launcher.xml new file mode 100644 index 00000000..6f3b755b --- /dev/null +++ b/app/src/main/res/mipmap-anydpi/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml new file mode 100644 index 00000000..6f3b755b --- /dev/null +++ b/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..c209e78e Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..b2dfe3d1 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4f0f1d64 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..62b611da Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..948a3070 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..1b9a6956 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..28d4b77f Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9287f508 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..aa7d6427 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9126ae37 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/navigation/main_nav.xml b/app/src/main/res/navigation/main_nav.xml new file mode 100644 index 00000000..c1e9ce8c --- /dev/null +++ b/app/src/main/res/navigation/main_nav.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..b3b9e87e --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Lacerta + \ No newline at end of file diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 00000000..fa0f996d --- /dev/null +++ b/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 00000000..9ee9997b --- /dev/null +++ b/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/test/java/one/nem/lacerta/ExampleUnitTest.java b/app/src/test/java/one/nem/lacerta/ExampleUnitTest.java new file mode 100644 index 00000000..db946740 --- /dev/null +++ b/app/src/test/java/one/nem/lacerta/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package one.nem.lacerta; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..e06cad1c --- /dev/null +++ b/build.gradle @@ -0,0 +1,6 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '8.0.2' apply false + id 'com.google.dagger.hilt.android' version '2.44' apply false + id 'com.android.library' version '8.0.2' apply false +} \ No newline at end of file diff --git a/component/common/.gitignore b/component/common/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/component/common/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/component/common/build.gradle b/component/common/build.gradle new file mode 100644 index 00000000..5ffcc098 --- /dev/null +++ b/component/common/build.gradle @@ -0,0 +1,35 @@ +plugins { + alias(libs.plugins.com.android.library) +} + +android { + namespace 'one.nem.lacerta.component.common' + compileSdk 33 + + defaultConfig { + minSdk 26 + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation libs.androidx.appcompat + implementation libs.com.google.android.material + testImplementation libs.junit + androidTestImplementation libs.androidx.test.ext.junit + androidTestImplementation libs.androidx.test.espresso.core +} \ No newline at end of file diff --git a/component/common/consumer-rules.pro b/component/common/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/component/common/proguard-rules.pro b/component/common/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/component/common/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/component/common/src/androidTest/java/one/nem/lacerta/component/common/ExampleInstrumentedTest.java b/component/common/src/androidTest/java/one/nem/lacerta/component/common/ExampleInstrumentedTest.java new file mode 100644 index 00000000..8ff3b10c --- /dev/null +++ b/component/common/src/androidTest/java/one/nem/lacerta/component/common/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package one.nem.lacerta.component.common; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("one.nem.lacerta.component.common.test", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/component/common/src/main/AndroidManifest.xml b/component/common/src/main/AndroidManifest.xml new file mode 100644 index 00000000..a5918e68 --- /dev/null +++ b/component/common/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/component/common/src/test/java/one/nem/lacerta/component/common/ExampleUnitTest.java b/component/common/src/test/java/one/nem/lacerta/component/common/ExampleUnitTest.java new file mode 100644 index 00000000..d01b441e --- /dev/null +++ b/component/common/src/test/java/one/nem/lacerta/component/common/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package one.nem.lacerta.component.common; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/component/scanner/.gitignore b/component/scanner/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/component/scanner/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/component/scanner/build.gradle b/component/scanner/build.gradle new file mode 100644 index 00000000..ee9a16a8 --- /dev/null +++ b/component/scanner/build.gradle @@ -0,0 +1,37 @@ +plugins { + alias(libs.plugins.com.android.library) +} + +android { + namespace 'one.nem.lacerta.component.scanner' + compileSdk 33 + + defaultConfig { + minSdk 26 + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation libs.androidx.appcompat + implementation libs.com.google.android.material + testImplementation libs.junit + androidTestImplementation libs.androidx.test.ext.junit + androidTestImplementation libs.androidx.test.espresso.core + + implementation 'com.websitebeaver:documentscanner:1.0.0' +} \ No newline at end of file diff --git a/component/scanner/consumer-rules.pro b/component/scanner/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/component/scanner/proguard-rules.pro b/component/scanner/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/component/scanner/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/component/scanner/src/androidTest/java/one/nem/lacerta/component/scanner/ExampleInstrumentedTest.java b/component/scanner/src/androidTest/java/one/nem/lacerta/component/scanner/ExampleInstrumentedTest.java new file mode 100644 index 00000000..0fd35155 --- /dev/null +++ b/component/scanner/src/androidTest/java/one/nem/lacerta/component/scanner/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package one.nem.lacerta.component.scanner; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("one.nem.lacerta.component.scanner.test", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/component/scanner/src/main/AndroidManifest.xml b/component/scanner/src/main/AndroidManifest.xml new file mode 100644 index 00000000..a5918e68 --- /dev/null +++ b/component/scanner/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerScanFragment.java b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerScanFragment.java new file mode 100644 index 00000000..54ba513e --- /dev/null +++ b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerScanFragment.java @@ -0,0 +1,75 @@ +package one.nem.lacerta.component.scanner; + +import android.graphics.BitmapFactory; +import android.os.Bundle; + +import androidx.constraintlayout.utils.widget.ImageFilterView; +import androidx.fragment.app.Fragment; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.websitebeaver.documentscanner.DocumentScanner; + +/** + * A simple {@link Fragment} subclass. + * Use the {@link ScannerScanFragment#newInstance} factory method to + * create an instance of this fragment. + */ +public class ScannerScanFragment extends Fragment { + + // TODO: Rename parameter arguments, choose names that match + // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER +// private static final String MAX_SCAN_COUNT = "max_scan_count"; // 規定値 + + // TODO: Rename and change types of parameters + private String mParam1; + + + public ScannerScanFragment() { + // Required empty public constructor + } + + public static ScannerScanFragment newInstance(String param1) { + ScannerScanFragment fragment = new ScannerScanFragment(); + Bundle args = new Bundle(); +// args.putString(MAX_SCAN_COUNT, param1); + fragment.setArguments(args); + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (getArguments() != null) { +// mParam1 = getArguments().getString(MAX_SCAN_COUNT); +// scan(Integer.parseInt(mParam1)); + } + } + + + public DocumentScanner getDocumentScanner() { + return new DocumentScanner( + this, + (croppedImageResults) -> { + // display the first cropped image + croppedImageView.setImageBitmap( + BitmapFactory.decodeFile(croppedImageResults.get(0)) + ); + return null; + }, + (errorMessage) -> { + // an error happened + return null; + }, + () -> { + // user canceled document scan + return null; + }, + null, + null, + null + ); + } +} \ No newline at end of file diff --git a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerScanResultFragment.java b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerScanResultFragment.java new file mode 100644 index 00000000..beffe3d0 --- /dev/null +++ b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerScanResultFragment.java @@ -0,0 +1,64 @@ +package one.nem.lacerta.component.scanner; + +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +/** + * A simple {@link Fragment} subclass. + * Use the {@link ScannerScanResultFragment#newInstance} factory method to + * create an instance of this fragment. + */ +public class ScannerScanResultFragment extends Fragment { + + // TODO: Rename parameter arguments, choose names that match + // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER + private static final String ARG_PARAM1 = "param1"; + private static final String ARG_PARAM2 = "param2"; + + // TODO: Rename and change types of parameters + private String mParam1; + private String mParam2; + + public ScannerScanResultFragment() { + // Required empty public constructor + } + + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * + * @param param1 Parameter 1. + * @param param2 Parameter 2. + * @return A new instance of fragment ScannerScanResultFragment. + */ + // TODO: Rename and change types and number of parameters + public static ScannerScanResultFragment newInstance(String param1, String param2) { + ScannerScanResultFragment fragment = new ScannerScanResultFragment(); + Bundle args = new Bundle(); + args.putString(ARG_PARAM1, param1); + args.putString(ARG_PARAM2, param2); + fragment.setArguments(args); + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (getArguments() != null) { + mParam1 = getArguments().getString(ARG_PARAM1); + mParam2 = getArguments().getString(ARG_PARAM2); + } + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_scanner_scan_result, container, false); + } +} \ No newline at end of file diff --git a/component/scanner/src/main/res/layout/fragment_scanner_scan.xml b/component/scanner/src/main/res/layout/fragment_scanner_scan.xml new file mode 100644 index 00000000..cf20c76f --- /dev/null +++ b/component/scanner/src/main/res/layout/fragment_scanner_scan.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/component/scanner/src/main/res/layout/fragment_scanner_scan_result.xml b/component/scanner/src/main/res/layout/fragment_scanner_scan_result.xml new file mode 100644 index 00000000..2ecaf967 --- /dev/null +++ b/component/scanner/src/main/res/layout/fragment_scanner_scan_result.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +