Button für Image-Scan hinzugefügt, für die restliche Implementierung hat sich Kögelhauser bereit erklärt.

This commit is contained in:
JG-Cody 2023-09-17 19:11:34 +02:00
parent ff6ba558cb
commit 0025f37e99
4 changed files with 28 additions and 1 deletions

View File

@ -125,6 +125,7 @@ public class MainActivity extends AppCompatActivity {
binding.fabMenu.setOnClickListener(view -> NavigationUtil.navigate(this, MenuFragment.class, null)); binding.fabMenu.setOnClickListener(view -> NavigationUtil.navigate(this, MenuFragment.class, null));
binding.fabScan.setOnClickListener(view -> scanCode()); binding.fabScan.setOnClickListener(view -> scanCode());
binding.fabScanImage.setOnClickListener(view -> scanCode());
binding.fabInput.setOnClickListener(view -> inputCode()); binding.fabInput.setOnClickListener(view -> inputCode());
Fragment fragment = NavigationUtil.getCurrentFragment(this); Fragment fragment = NavigationUtil.getCurrentFragment(this);

View File

@ -16,11 +16,18 @@ public class FabUtil {
fabScan.animate().translationX(-activity.getResources().getDimension(R.dimen.fab1_offset)); fabScan.animate().translationX(-activity.getResources().getDimension(R.dimen.fab1_offset));
} }
FloatingActionButton fabScanImage = activity.findViewById(R.id.fab_scan_image);
if(fabScanImage != null) {
fabScanImage.setVisibility(View.VISIBLE);
fabScanImage.setClickable(true);
fabScanImage.animate().translationX(-activity.getResources().getDimension(R.dimen.fab2_offset));
}
FloatingActionButton fabInput = activity.findViewById(R.id.fab_input); FloatingActionButton fabInput = activity.findViewById(R.id.fab_input);
if(fabInput != null) { if(fabInput != null) {
fabInput.setVisibility(View.VISIBLE); fabInput.setVisibility(View.VISIBLE);
fabInput.setClickable(true); fabInput.setClickable(true);
fabInput.animate().translationX(-activity.getResources().getDimension(R.dimen.fab2_offset)); fabInput.animate().translationX(-activity.getResources().getDimension(R.dimen.fab3_offset));
} }
} }
@ -31,6 +38,12 @@ public class FabUtil {
fabScan.animate().translationX(0).withEndAction(() -> fabScan.setVisibility(View.GONE)); fabScan.animate().translationX(0).withEndAction(() -> fabScan.setVisibility(View.GONE));
} }
FloatingActionButton fabScanImage = activity.findViewById(R.id.fab_scan_image);
if(fabScan != null) {
fabScanImage.setClickable(false);
fabScanImage.animate().translationX(0).withEndAction(() -> fabScanImage.setVisibility(View.GONE));
}
FloatingActionButton fabInput = activity.findViewById(R.id.fab_input); FloatingActionButton fabInput = activity.findViewById(R.id.fab_input);
if(fabInput != null) { if(fabInput != null) {
fabInput.setClickable(false); fabInput.setClickable(false);

View File

@ -45,6 +45,18 @@
android:backgroundTint="?attr/colorTheme1" android:backgroundTint="?attr/colorTheme1"
android:visibility="gone" /> android:visibility="gone" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_scan_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_marginBottom="16dp"
android:backgroundTint="?attr/colorTheme1"
android:visibility="gone"
app:srcCompat="@drawable/baseline_qr_code_scanner_24"
app:tint="@color/white" />
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_menu" android:id="@+id/fab_menu"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -2,4 +2,5 @@
<dimen name="fab_margin">16dp</dimen> <dimen name="fab_margin">16dp</dimen>
<dimen name="fab1_offset">65dp</dimen> <dimen name="fab1_offset">65dp</dimen>
<dimen name="fab2_offset">130dp</dimen> <dimen name="fab2_offset">130dp</dimen>
<dimen name="fab3_offset">195dp</dimen>
</resources> </resources>