mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03:15 +00:00
ToolBar実装 WIP
This commit is contained in:
parent
8502bcdcab
commit
d01f5b9c79
|
@ -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<Bitmap> resultImages) {
|
||||
logger.debug(TAG, "processResult");
|
||||
|
||||
|
|
|
@ -2,9 +2,23 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/main"
|
||||
android:theme="@style/Theme.Lacerta"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/top_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/colorPrimaryContainer"
|
||||
app:titleTextColor="@color/colorOnPrimaryContainer"
|
||||
app:title="Preview"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="?attr/actionBarTheme"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/selected_image"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -14,7 +28,7 @@
|
|||
app:layout_constraintBottom_toTopOf="@+id/horizontal_scroll"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@id/top_toolbar" />
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/horizontal_scroll"
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_close"
|
||||
android:icon="@drawable/close_24px"
|
||||
android:title="Close"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/action_save"
|
||||
android:icon="@drawable/save_24px"
|
||||
android:title="Save"
|
||||
app:showAsAction="ifRoom"/>
|
||||
</menu>
|
Loading…
Reference in New Issue
Block a user