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 index f5109892..fed35e21 100644 --- 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 @@ -1,15 +1,45 @@ package one.nem.lacerta.component.scanner; import android.os.Bundle; +import android.util.Log; 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.websitebeaver.documentscanner.DocumentScanner; + +import javax.inject.Inject; + +import dagger.hilt.android.AndroidEntryPoint; + +@AndroidEntryPoint public class ScannerManagerActivity extends AppCompatActivity { + DocumentScanner documentScanner = new DocumentScanner( + this, + (croppedImageResults) -> { + // display the first cropped image + return null; + }, + (errorMessage) -> { + // an error happened + Log.v("documentscannerlogs", errorMessage); + return null; + }, + () -> { + // user canceled document scan + Log.v("documentscannerlogs", "User canceled document scan"); + return null; + }, + null, + null, + 5 + ); + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -20,5 +50,10 @@ public class ScannerManagerActivity extends AppCompatActivity { v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); return insets; }); + + documentScanner.startScan(); + // Init + } + } \ 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 index 7203e691..b820111e 100644 --- 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 @@ -1,5 +1,6 @@ package one.nem.lacerta.component.scanner; +import android.content.Intent; import android.os.Bundle; import androidx.fragment.app.Fragment; @@ -9,6 +10,7 @@ import android.view.View; import android.view.ViewGroup; import com.websitebeaver.documentscanner.DocumentScanner; +import com.websitebeaver.documentscanner.DocumentScannerActivity; import java.util.Objects; @@ -31,8 +33,6 @@ public class ScannerManagerFragment extends Fragment { @Inject LacertaVcsFactory vcsFactory; - DocumentScanner documentScanner; - private static final boolean DEFAULT_SINGLE_PAGE = false; private boolean singlePage; @@ -62,25 +62,6 @@ public class ScannerManagerFragment extends Fragment { if (getArguments() != null) { singlePage = getArguments().getBoolean("singlePage", DEFAULT_SINGLE_PAGE); } - - documentScanner = new DocumentScanner( - requireActivity(), - (croppedImage) -> { - // TODO-rca: 画像を保存する - return null; - }, - (error) -> { - // TODO-rca: エラー処理 - return null; - }, - () -> { - // TODO-rca: キャンセル処理 - return null; - }, - null, - null, - null - ); } @Override @@ -105,10 +86,10 @@ public class ScannerManagerFragment extends Fragment { // Init logger.debug(TAG, "called"); - view.findViewById(R.id.button_start_scan).setOnClickListener(v -> { - if (documentScanner != null) { - documentScanner.startScan(); - } + 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/layout/activity_scanner_manager.xml b/component/scanner/src/main/res/layout/activity_scanner_manager.xml index 1b0b261a..db5c0e80 100644 --- a/component/scanner/src/main/res/layout/activity_scanner_manager.xml +++ b/component/scanner/src/main/res/layout/activity_scanner_manager.xml @@ -7,4 +7,12 @@ android:layout_height="match_parent" tools:context=".ScannerManagerActivity"> +