mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-04-08 09:27:57 -04:00
LoyaltyCardViewActivity: RTL fixes for buttons
This commit is contained in:
@@ -984,22 +984,33 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements
|
||||
return;
|
||||
}
|
||||
|
||||
final ImageButton prevButton;
|
||||
final ImageButton nextButton;
|
||||
|
||||
if (getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
|
||||
prevButton = binding.mainRightButton;
|
||||
nextButton = binding.mainLeftButton;
|
||||
} else {
|
||||
prevButton = binding.mainLeftButton;
|
||||
nextButton = binding.mainRightButton;
|
||||
}
|
||||
|
||||
// Enable left button if we can go further left
|
||||
if (mainImageIndex > 0) {
|
||||
binding.mainLeftButton.setVisibility(View.VISIBLE);
|
||||
binding.mainLeftButton.setOnClickListener(view -> setMainImage(false, false));
|
||||
prevButton.setVisibility(View.VISIBLE);
|
||||
prevButton.setOnClickListener(view -> setMainImage(false, false));
|
||||
} else {
|
||||
binding.mainLeftButton.setVisibility(View.INVISIBLE);
|
||||
binding.mainLeftButton.setOnClickListener(null);
|
||||
prevButton.setVisibility(View.INVISIBLE);
|
||||
prevButton.setOnClickListener(null);
|
||||
}
|
||||
|
||||
// Enable right button if we can go further right
|
||||
if (mainImageIndex < (imageTypes.size() - 1)) {
|
||||
binding.mainRightButton.setVisibility(View.VISIBLE);
|
||||
binding.mainRightButton.setOnClickListener(view -> setMainImage(true, false));
|
||||
nextButton.setVisibility(View.VISIBLE);
|
||||
nextButton.setOnClickListener(view -> setMainImage(true, false));
|
||||
} else {
|
||||
binding.mainRightButton.setVisibility(View.INVISIBLE);
|
||||
binding.mainRightButton.setOnClickListener(null);
|
||||
nextButton.setVisibility(View.INVISIBLE);
|
||||
nextButton.setOnClickListener(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginEnd="0dp">
|
||||
android:layout_marginEnd="0dp"
|
||||
android:layoutDirection="ltr">
|
||||
|
||||
<!-- We don't use these buttons for Talkback -->
|
||||
<ImageButton
|
||||
@@ -206,6 +207,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layoutDirection="ltr"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
@@ -229,7 +231,7 @@
|
||||
android:id="@+id/bottom_app_bar_info_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:layout_gravity="left"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:background="@android:color/transparent"
|
||||
@@ -253,7 +255,7 @@
|
||||
android:id="@+id/bottom_app_bar_update_balance_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:layout_gravity="right"
|
||||
android:background="@android:color/transparent"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
|
||||
Reference in New Issue
Block a user