From d01f5b9c79e464f15c11761d1876e3bdc9231a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Tue, 16 Jan 2024 11:50:50 +0900 Subject: [PATCH] =?UTF-8?q?ToolBar=E5=AE=9F=E8=A3=85=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scanner/ScannerManagerActivity.java | 23 +++++++++++++++++++ .../res/layout/activity_scanner_manager.xml | 16 ++++++++++++- .../main/res/menu/scanner_result_toolbar.xml | 14 +++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 component/scanner/src/main/res/menu/scanner_result_toolbar.xml 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 74f0872d..bed03b42 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 @@ -17,6 +17,7 @@ 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; @@ -76,6 +77,9 @@ public class ScannerManagerActivity extends AppCompatActivity { return insets; }); + MaterialToolbar toolbar = findViewById(R.id.top_toolbar); + setSupportActionBar(toolbar); + documentScanner.startScan(); // Init @@ -83,6 +87,25 @@ public class ScannerManagerActivity extends AppCompatActivity { } + @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_close) { + finish(); + return true; + } else if (item.getItemId() == R.id.action_save) { + // TODO-rca: 保存処理 + Toast.makeText(this, "保存処理", Toast.LENGTH_SHORT).show(); + return true; + } + return super.onOptionsItemSelected(item); + } + private void processResult(ArrayList resultImages) { logger.debug(TAG, "processResult"); 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 27b1fa64..9e14218c 100644 --- a/component/scanner/src/main/res/layout/activity_scanner_manager.xml +++ b/component/scanner/src/main/res/layout/activity_scanner_manager.xml @@ -2,9 +2,23 @@ + + + app:layout_constraintTop_toBottomOf="@id/top_toolbar" /> + + + + \ No newline at end of file