diff --git a/component/scanner/build.gradle b/component/scanner/build.gradle
index 61a9b1de..17887caf 100644
--- a/component/scanner/build.gradle
+++ b/component/scanner/build.gradle
@@ -30,6 +30,8 @@ dependencies {
implementation libs.androidx.appcompat
implementation libs.com.google.android.material
+ implementation libs.androidx.activity
+ implementation libs.androidx.constraintlayout
testImplementation libs.junit
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.espresso.core
@@ -46,4 +48,8 @@ dependencies {
implementation project(':processor')
implementation project(':utils')
+
+ implementation project(':vcs')
+
+ implementation project(':data')
}
\ No newline at end of file
diff --git a/component/scanner/src/main/AndroidManifest.xml b/component/scanner/src/main/AndroidManifest.xml
index a5918e68..74cc7c29 100644
--- a/component/scanner/src/main/AndroidManifest.xml
+++ b/component/scanner/src/main/AndroidManifest.xml
@@ -1,4 +1,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java
new file mode 100644
index 00000000..b8ab64bf
--- /dev/null
+++ b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java
@@ -0,0 +1,181 @@
+package one.nem.lacerta.component.scanner;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.drawable.BitmapDrawable;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.Toast;
+
+import androidx.activity.EdgeToEdge;
+import androidx.annotation.AnimatorRes;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
+
+import com.google.android.material.appbar.MaterialToolbar;
+import com.websitebeaver.documentscanner.DocumentScanner;
+
+import java.util.ArrayList;
+import java.util.Objects;
+
+import javax.inject.Inject;
+
+import dagger.hilt.android.AndroidEntryPoint;
+import one.nem.lacerta.utils.LacertaLogger;
+import one.nem.lacerta.data.Document;
+
+@AndroidEntryPoint
+public class ScannerManagerActivity extends AppCompatActivity {
+
+ String TAG = "ScannerManagerActivity";
+
+ @Inject
+ LacertaLogger logger;
+
+ @Inject
+ Document document;
+
+
+ // Variables
+ private ArrayList croppedImages = new ArrayList<>();
+
+ View view;
+
+ DocumentScanner documentScanner = new DocumentScanner(
+ this,
+ (croppedImageResults) -> {
+ logger.debug(TAG, "croppedImage size: " + croppedImageResults.size());
+ ArrayList croppedImages = new ArrayList<>();
+ for (String result : croppedImageResults) {
+ croppedImages.add(BitmapFactory.decodeFile(result));
+ }
+ processResult(croppedImages);
+ return null;
+ },
+ (errorMessage) -> {
+ // an error happened
+ logger.error(TAG, "Error: " + errorMessage);
+ logger.e_code("543a230e-cb9a-47a2-8131-3beecfe1c458");
+ return null;
+ },
+ () -> {
+ // user canceled document scan
+ logger.debug(TAG, "User canceled document scan");
+ return null;
+ },
+ null,
+ null,
+ null
+ );
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ EdgeToEdge.enable(this);
+ setContentView(R.layout.activity_scanner_manager);
+ ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
+ Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
+ v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
+ return insets;
+ });
+
+ MaterialToolbar toolbar = findViewById(R.id.top_toolbar);
+ setSupportActionBar(toolbar);
+ Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
+
+ documentScanner.startScan();
+ // Init
+
+ this.view = findViewById(R.id.main); // TODO-rca:なんとかする
+
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(android.view.Menu menu) {
+ getMenuInflater().inflate(R.menu.scanner_result_toolbar, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(android.view.MenuItem item) {
+ if (item.getItemId() == R.id.action_save_new) {
+ // 新ドキュメントとして保存
+ Toast.makeText(this, "保存処理", Toast.LENGTH_SHORT).show();
+ saveNewDocument();
+ return true;
+ } else if (item.getItemId() == R.id.action_insert_exist) {
+ // 既存ドキュメントに挿入
+ Toast.makeText(this, "挿入処理", Toast.LENGTH_SHORT).show();
+ insertToExistDocument();
+ return true;
+ } else if (item.getItemId() == android.R.id.home) {
+ finish();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ private void processResult(ArrayList resultImages) {
+ logger.debug(TAG, "processResult");
+
+ if (resultImages.isEmpty()) {
+ logger.debug(TAG, "resultImages(arg) is empty");
+ if (this.croppedImages.isEmpty()) {
+ logger.debug(TAG, "this.resultImages is empty");
+ logger.e_code("7cb0584e-74ef-48ec-848a-c4d14e75e15a");
+ // TODO-rca: なんかする
+ } else {
+ logger.debug(TAG, "this.resultImages is not empty");
+ updateResultView(this.croppedImages);
+ }
+ } else {
+ logger.debug(TAG, "resultImages(arg) is not empty");
+ updateResultView(resultImages);
+ this.croppedImages = resultImages;
+ }
+
+ }
+
+ private void saveNewDocument() {
+ logger.debug(TAG, "saveNewDocument");
+
+ }
+
+ private void insertToExistDocument() {
+ logger.debug(TAG, "insertToExistDocument");
+ // TODO-rca: 実装
+ }
+
+ private void updateResultView(ArrayList resultImages) {
+ logger.debug(TAG, "updateResultView");
+
+ LinearLayout resultView = findViewById(R.id.result_list_container);
+ ImageView selectedImage = findViewById(R.id.selected_image);
+ resultView.removeAllViews();
+
+ for (Bitmap resultImage : resultImages) {
+ View resultImageView = getLayoutInflater().inflate(R.layout.result_image_container_item, null);
+ ImageView imageView = resultImageView.findViewById(R.id.result_image);
+ imageView.setImageBitmap(resultImage);
+ imageView.setOnClickListener(v -> {
+
+ selectedImage.setImageBitmap(resultImage);
+
+ for (int i = 0; i < resultView.getChildCount(); i++) {
+ View child = resultView.getChildAt(i).findViewById(R.id.result_image);
+ child.setSelected(false);
+ }
+
+ v.setSelected(true);
+ });
+
+ resultView.addView(resultImageView);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerFragment.java b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerFragment.java
new file mode 100644
index 00000000..b820111e
--- /dev/null
+++ b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerFragment.java
@@ -0,0 +1,95 @@
+package one.nem.lacerta.component.scanner;
+
+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.websitebeaver.documentscanner.DocumentScanner;
+import com.websitebeaver.documentscanner.DocumentScannerActivity;
+
+import java.util.Objects;
+
+import javax.inject.Inject;
+
+import dagger.hilt.android.AndroidEntryPoint;
+import one.nem.lacerta.utils.LacertaLogger;
+import one.nem.lacerta.vcs.LacertaVcs;
+import one.nem.lacerta.vcs.factory.LacertaVcsFactory;
+
+
+@AndroidEntryPoint
+public class ScannerManagerFragment extends Fragment {
+
+ String TAG = getClass().getSimpleName();
+
+ @Inject
+ LacertaLogger logger;
+
+ @Inject
+ LacertaVcsFactory vcsFactory;
+
+ private static final boolean DEFAULT_SINGLE_PAGE = false;
+ private boolean singlePage;
+
+ public ScannerManagerFragment() {
+ // Required empty public constructor
+ }
+
+// public static ScannerManagerFragment newInstance(boolean singlePage) {
+// ScannerManagerFragment fragment = new ScannerManagerFragment();
+// Bundle args = new Bundle();
+// args.putBoolean("singlePage", singlePage);
+// fragment.setArguments(args);
+// return fragment;
+// }
+
+ public static ScannerManagerFragment newInstance() {
+ ScannerManagerFragment fragment = new ScannerManagerFragment();
+ Bundle args = new Bundle();
+ args.putBoolean("singlePage", DEFAULT_SINGLE_PAGE);
+ fragment.setArguments(args);
+ return fragment;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getArguments() != null) {
+ singlePage = getArguments().getBoolean("singlePage", DEFAULT_SINGLE_PAGE);
+ }
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ View view = inflater.inflate(R.layout.fragment_scanner_manager, container, false);
+
+// ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(
+// ViewGroup.LayoutParams.MATCH_PARENT,
+// ViewGroup.LayoutParams.MATCH_PARENT
+// );
+// view.setLayoutParams(layoutParams);
+
+ return view;
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ // Init
+ logger.debug(TAG, "called");
+
+ view.findViewById(R.id.button_intent_scanner_manager_activity).setOnClickListener(v -> {
+ // DocumentScannerActivityを起動する
+ Intent intent = new Intent(requireActivity().getApplicationContext(), ScannerManagerActivity.class);
+ startActivity(intent);
+ });
+ }
+}
\ No newline at end of file
diff --git a/component/scanner/src/main/res/drawable/result_image_container_item_border.xml b/component/scanner/src/main/res/drawable/result_image_container_item_border.xml
new file mode 100644
index 00000000..e23fb7c8
--- /dev/null
+++ b/component/scanner/src/main/res/drawable/result_image_container_item_border.xml
@@ -0,0 +1,16 @@
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/component/scanner/src/main/res/layout/activity_scanner_manager.xml b/component/scanner/src/main/res/layout/activity_scanner_manager.xml
new file mode 100644
index 00000000..9e14218c
--- /dev/null
+++ b/component/scanner/src/main/res/layout/activity_scanner_manager.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/component/scanner/src/main/res/layout/fragment_scanner_manager.xml b/component/scanner/src/main/res/layout/fragment_scanner_manager.xml
new file mode 100644
index 00000000..c4909a49
--- /dev/null
+++ b/component/scanner/src/main/res/layout/fragment_scanner_manager.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/component/scanner/src/main/res/layout/list_item_scanner_result.xml b/component/scanner/src/main/res/layout/list_item_scanner_result.xml
new file mode 100644
index 00000000..77d9ef65
--- /dev/null
+++ b/component/scanner/src/main/res/layout/list_item_scanner_result.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/component/scanner/src/main/res/layout/result_image_container_item.xml b/component/scanner/src/main/res/layout/result_image_container_item.xml
new file mode 100644
index 00000000..c0217701
--- /dev/null
+++ b/component/scanner/src/main/res/layout/result_image_container_item.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/component/scanner/src/main/res/menu/scanner_result_toolbar.xml b/component/scanner/src/main/res/menu/scanner_result_toolbar.xml
new file mode 100644
index 00000000..3321aadc
--- /dev/null
+++ b/component/scanner/src/main/res/menu/scanner_result_toolbar.xml
@@ -0,0 +1,14 @@
+
+
\ No newline at end of file
diff --git a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuTopFragment.java b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuTopFragment.java
index 92e50e6b..c55914e8 100644
--- a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuTopFragment.java
+++ b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuTopFragment.java
@@ -49,7 +49,8 @@ public class DebugMenuTopFragment extends Fragment {
List debugMenuListItems = new ArrayList<>();
debugMenuListItems.add(new DebugMenuListItem("Document Tester", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuDocumentTesterTopFragment, true));
- debugMenuListItems.add(new DebugMenuListItem("Scanner", "placeholder", R.id.action_debugMenuTopFragment_to_scannerDataManagerStubFragment, true));
+ debugMenuListItems.add(new DebugMenuListItem("ScannerStub", "placeholder", R.id.action_debugMenuTopFragment_to_scannerDataManagerStubFragment, true));
+ debugMenuListItems.add(new DebugMenuListItem("Scanner", "placeholder", R.id.action_debugMenuTopFragment_to_scannerManagerFragment, true));
debugMenuListItems.add(new DebugMenuListItem("Document List", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuLibraryItemListPageFragment, true));
debugMenuListItems.add(new DebugMenuListItem("VCS", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuVcsGeneralFragment, true));
diff --git a/feature/debug/src/main/res/navigation/feature_debug_internal_navigation.xml b/feature/debug/src/main/res/navigation/feature_debug_internal_navigation.xml
index ebd05b44..cf7b1374 100644
--- a/feature/debug/src/main/res/navigation/feature_debug_internal_navigation.xml
+++ b/feature/debug/src/main/res/navigation/feature_debug_internal_navigation.xml
@@ -22,6 +22,9 @@
+
+
\ No newline at end of file
diff --git a/shared/ui/src/main/res/drawable/close_24px.xml b/shared/ui/src/main/res/drawable/close_24px.xml
new file mode 100644
index 00000000..0e4ce1a5
--- /dev/null
+++ b/shared/ui/src/main/res/drawable/close_24px.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/shared/ui/src/main/res/drawable/description_24px.xml b/shared/ui/src/main/res/drawable/description_24px.xml
index fdf492d1..ca7e3ec8 100644
--- a/shared/ui/src/main/res/drawable/description_24px.xml
+++ b/shared/ui/src/main/res/drawable/description_24px.xml
@@ -5,6 +5,6 @@
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
diff --git a/shared/ui/src/main/res/drawable/save_24px.xml b/shared/ui/src/main/res/drawable/save_24px.xml
new file mode 100644
index 00000000..5161a39b
--- /dev/null
+++ b/shared/ui/src/main/res/drawable/save_24px.xml
@@ -0,0 +1,10 @@
+
+
+