From 6c7649d9f37fdd4b2c591d040c1f195e3dabb3ee Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Mon, 4 Mar 2024 13:29:34 +0100 Subject: [PATCH] Modify switch account button so it doesn't overlap with search menu in RootFilesFragment The text below the transparent button needs to still be displayed the exact same way, so we overlay a transparent button to reduce its size independently. By limiting its size we prevent wide switch drive buttons from overlapping with the search menu from the toolbar in RootFilesFragment blocking some clicks that were aimed at the search menu button --- .../com/infomaniak/drive/utils/Extensions.kt | 10 ++-- .../main/res/layout/layout_switch_drive.xml | 53 +++++++++++++++++-- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/infomaniak/drive/utils/Extensions.kt b/app/src/main/java/com/infomaniak/drive/utils/Extensions.kt index a968af883e..f55bd76f0e 100644 --- a/app/src/main/java/com/infomaniak/drive/utils/Extensions.kt +++ b/app/src/main/java/com/infomaniak/drive/utils/Extensions.kt @@ -430,15 +430,15 @@ fun LayoutSwitchDriveBinding.setDriveHeader(currentDrive: Drive) { } fun LayoutSwitchDriveBinding.setupSwitchDriveButton(fragment: Fragment) { - switchDriveButton.apply { - AccountUtils.getCurrentDrive()?.let { setDriveHeader(it) } + AccountUtils.getCurrentDrive()?.let { setDriveHeader(it) } - if (DriveInfosController.hasSingleDrive(AccountUtils.currentUserId)) { + if (DriveInfosController.hasSingleDrive(AccountUtils.currentUserId)) { + switchDriveButton.apply { icon = null isEnabled = false - } else { - setOnClickListener { fragment.safeNavigate(R.id.switchDriveDialog) } } + } else { + offsetOverlayedRipple.setOnClickListener { fragment.safeNavigate(R.id.switchDriveDialog) } } fragment.viewLifecycleOwner.lifecycle.addObserver( diff --git a/app/src/main/res/layout/layout_switch_drive.xml b/app/src/main/res/layout/layout_switch_drive.xml index 034ed397e4..0930ec9ae5 100644 --- a/app/src/main/res/layout/layout_switch_drive.xml +++ b/app/src/main/res/layout/layout_switch_drive.xml @@ -15,12 +15,13 @@ ~ You should have received a copy of the GNU General Public License ~ along with this program. If not, see . --> - @@ -30,8 +31,7 @@ style="@style/TextButton" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginEnd="@dimen/marginStandard" + android:clickable="false" android:contentDescription="@string/buttonSwitchDrive" android:ellipsize="end" android:fontFamily="@font/suisseintl_bold" @@ -45,6 +45,49 @@ app:iconGravity="end" app:iconSize="28dp" app:iconTint="@color/iconColor" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintStart_toStartOf="parent" tools:text="Drive de test dev infomaniak" /> - + + + + + + + + + +