From 0025f37e999b634db0a25d2476b454b965d9e6f8 Mon Sep 17 00:00:00 2001 From: JG-Cody Date: Sun, 17 Sep 2023 19:11:34 +0200 Subject: [PATCH] =?UTF-8?q?Button=20f=C3=BCr=20Image-Scan=20hinzugef=C3=BC?= =?UTF-8?q?gt,=20f=C3=BCr=20die=20restliche=20Implementierung=20hat=20sich?= =?UTF-8?q?=20K=C3=B6gelhauser=20bereit=20erkl=C3=A4rt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cringe_authenticator/MainActivity.java | 1 + .../cringe_authenticator/util/FabUtil.java | 15 ++++++++++++++- app/src/main/res/layout/activity_main.xml | 12 ++++++++++++ app/src/main/res/values/dimens.xml | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java b/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java index 8d25ada..d54dac9 100644 --- a/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java +++ b/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java @@ -125,6 +125,7 @@ public class MainActivity extends AppCompatActivity { binding.fabMenu.setOnClickListener(view -> NavigationUtil.navigate(this, MenuFragment.class, null)); binding.fabScan.setOnClickListener(view -> scanCode()); + binding.fabScanImage.setOnClickListener(view -> scanCode()); binding.fabInput.setOnClickListener(view -> inputCode()); Fragment fragment = NavigationUtil.getCurrentFragment(this); diff --git a/app/src/main/java/com/cringe_studios/cringe_authenticator/util/FabUtil.java b/app/src/main/java/com/cringe_studios/cringe_authenticator/util/FabUtil.java index 65632d3..0862e57 100644 --- a/app/src/main/java/com/cringe_studios/cringe_authenticator/util/FabUtil.java +++ b/app/src/main/java/com/cringe_studios/cringe_authenticator/util/FabUtil.java @@ -16,11 +16,18 @@ public class FabUtil { 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); if(fabInput != null) { fabInput.setVisibility(View.VISIBLE); 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)); } + 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); if(fabInput != null) { fabInput.setClickable(false); diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 4403ed9..822f3b4 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -45,6 +45,18 @@ android:backgroundTint="?attr/colorTheme1" android:visibility="gone" /> + + 16dp 65dp 130dp + 195dp \ No newline at end of file