RTL: fix Live Updates screen

This commit is contained in:
nazar-kutz 2021-04-22 14:12:49 +03:00
parent fe9a5c43bd
commit 1ac919b8d3
5 changed files with 30 additions and 7 deletions

View file

@ -0,0 +1,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:bottomLeftRadius="@dimen/list_item_button_padding"
android:topLeftRadius="@dimen/list_item_button_padding" />
<solid android:color="@color/list_background_color_dark" />
</shape>

View file

@ -0,0 +1,11 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/active_buttons_and_links_trans_light">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<corners
android:bottomLeftRadius="@dimen/list_item_button_padding"
android:topLeftRadius="@dimen/list_item_button_padding" />
<solid android:color="@color/active_color_primary_light" />
</shape>
</item>
</ripple>

View file

@ -445,6 +445,9 @@ public class ContextMenuAdapter {
ImageView imageView = (ImageView) convertView.findViewById(R.id.secondary_icon); ImageView imageView = (ImageView) convertView.findViewById(R.id.secondary_icon);
imageView.setImageDrawable(drawable); imageView.setImageDrawable(drawable);
imageView.setVisibility(View.VISIBLE); imageView.setVisibility(View.VISIBLE);
if (secondaryDrawable == R.drawable.ic_action_additional_option) {
UiUtilities.rotateImageByLayoutDirection(imageView);
}
} else { } else {
ImageView imageView = (ImageView) convertView.findViewById(R.id.secondary_icon); ImageView imageView = (ImageView) convertView.findViewById(R.id.secondary_icon);
if (imageView != null) { if (imageView != null) {

View file

@ -275,16 +275,14 @@ public class LiveUpdatesFragment extends BaseOsmAndDialogFragment implements OnL
TextViewEx toolbarTitle = (TextViewEx) toolbar.findViewById(R.id.toolbar_title); TextViewEx toolbarTitle = (TextViewEx) toolbar.findViewById(R.id.toolbar_title);
toolbarTitle.setText(R.string.osm_live); toolbarTitle.setText(R.string.osm_live);
View closeButton = toolbar.findViewById(R.id.close_button); ImageView closeButton = (ImageView) toolbar.findViewById(R.id.close_button);
UiUtilities.rotateImageByLayoutDirection(closeButton);
closeButton.setOnClickListener(new View.OnClickListener() { closeButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
dismiss(); dismiss();
} }
}); });
if (closeButton instanceof ImageView) {
UiUtilities.rotateImageByLayoutDirection((ImageView) closeButton);
}
FrameLayout iconHelpContainer = toolbar.findViewById(R.id.action_button); FrameLayout iconHelpContainer = toolbar.findViewById(R.id.action_button);
int iconColorResId = nightMode ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light; int iconColorResId = nightMode ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light;
@ -443,6 +441,8 @@ public class LiveUpdatesFragment extends BaseOsmAndDialogFragment implements OnL
boolean isLastChild, View convertView, ViewGroup parent) { boolean isLastChild, View convertView, ViewGroup parent) {
LayoutInflater inflater = UiUtilities.getInflater(app, nightMode); LayoutInflater inflater = UiUtilities.getInflater(app, nightMode);
convertView = inflater.inflate(R.layout.list_item_triple_row_icon_and_menu, parent, false); convertView = inflater.inflate(R.layout.list_item_triple_row_icon_and_menu, parent, false);
ImageView secondaryIcon = (ImageView) convertView.findViewById(R.id.secondary_icon);
UiUtilities.rotateImageByLayoutDirection(secondaryIcon);
LiveMapsViewHolder viewHolder = new LiveMapsViewHolder(convertView); LiveMapsViewHolder viewHolder = new LiveMapsViewHolder(convertView);
convertView.setTag(viewHolder); convertView.setTag(viewHolder);
viewHolder.bindLocalIndexInfo(getChild(groupPosition, childPosition).getFileName()); viewHolder.bindLocalIndexInfo(getChild(groupPosition, childPosition).getFileName());

View file

@ -134,6 +134,7 @@ public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet {
public static void updateCustomButtonView(OsmandApplication app, ApplicationMode mode, View customView, boolean checked, boolean nightMode) { public static void updateCustomButtonView(OsmandApplication app, ApplicationMode mode, View customView, boolean checked, boolean nightMode) {
Context themedCtx = UiUtilities.getThemedContext(app, nightMode); Context themedCtx = UiUtilities.getThemedContext(app, nightMode);
boolean isLayoutRtl = AndroidUtils.isLayoutRtl(themedCtx);
LinearLayout buttonView = customView.findViewById(R.id.button_container); LinearLayout buttonView = customView.findViewById(R.id.button_container);
int bgColor; int bgColor;
@ -149,10 +150,11 @@ public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet {
ContextCompat.getColor(app, getActivePrimaryColorId(nightMode)), checked ? 0.3f : 0.5f); ContextCompat.getColor(app, getActivePrimaryColorId(nightMode)), checked ? 0.3f : 0.5f);
} }
int bgResId = R.drawable.rectangle_rounded_right; int bgResId = isLayoutRtl ? R.drawable.rectangle_rounded_left : R.drawable.rectangle_rounded_right;
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
int selectableResId = R.drawable.ripple_rectangle_rounded_right; int selectableResId = isLayoutRtl ?
R.drawable.ripple_rectangle_rounded_left :
R.drawable.ripple_rectangle_rounded_right;
Drawable bgDrawable = app.getUIUtilities().getPaintedIcon(bgResId, bgColor); Drawable bgDrawable = app.getUIUtilities().getPaintedIcon(bgResId, bgColor);
Drawable selectable = app.getUIUtilities().getPaintedIcon(selectableResId, selectedColor); Drawable selectable = app.getUIUtilities().getPaintedIcon(selectableResId, selectedColor);
Drawable[] layers = {bgDrawable, selectable}; Drawable[] layers = {bgDrawable, selectable};