終了ボタンを実装

This commit is contained in:
ろむねこ 2024-01-16 11:58:42 +09:00
parent d01f5b9c79
commit 24e54ec0f0
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -21,6 +21,7 @@ import com.google.android.material.appbar.MaterialToolbar;
import com.websitebeaver.documentscanner.DocumentScanner; import com.websitebeaver.documentscanner.DocumentScanner;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects;
import javax.inject.Inject; import javax.inject.Inject;
@ -79,6 +80,7 @@ public class ScannerManagerActivity extends AppCompatActivity {
MaterialToolbar toolbar = findViewById(R.id.top_toolbar); MaterialToolbar toolbar = findViewById(R.id.top_toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
documentScanner.startScan(); documentScanner.startScan();
// Init // Init
@ -102,6 +104,9 @@ public class ScannerManagerActivity extends AppCompatActivity {
// TODO-rca: 保存処理 // TODO-rca: 保存処理
Toast.makeText(this, "保存処理", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "保存処理", Toast.LENGTH_SHORT).show();
return true; return true;
} else if (item.getItemId() == android.R.id.home) {
finish();
return true;
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }