Purchases screen RTL fixes

This commit is contained in:
cepprice 2021-04-19 16:35:26 +05:00
parent cf26ccc7ab
commit 2be03d04ed
8 changed files with 12 additions and 9 deletions

View file

@ -64,7 +64,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/content_padding_small"
android:layout_gravity="center_vertical"
android:paddingStart="@dimen/content_padding_small"
android:paddingLeft="@dimen/content_padding_small"
android:paddingTop="@dimen/content_padding_small_half"

View file

@ -32,7 +32,6 @@
android:id="@+id/troubleshooting_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/map_widget_height"
android:layout_marginRight="@dimen/map_widget_height"
android:paddingBottom="@dimen/dialog_content_bottom_margin"

View file

@ -442,15 +442,14 @@ public class UiUtilities {
} catch (Throwable e) { }
}
public static void rotateImageByLayoutDirection(ImageView image, int layoutDirection) {
if (image == null) {
public static void rotateImageByLayoutDirection(ImageView image, Context context) {
if (image == null || context == null) {
return;
}
int rotation = layoutDirection == ViewCompat.LAYOUT_DIRECTION_RTL ? 180 : 0;
int rotation = AndroidUtils.getLayoutDirection(context) == ViewCompat.LAYOUT_DIRECTION_RTL ? 180 : 0;
image.setRotationY(rotation);
}
public static void updateCustomRadioButtons(Context app, View buttonsView, boolean nightMode,
CustomRadioButtonType buttonType) {
int activeColor = ContextCompat.getColor(app, nightMode

View file

@ -109,7 +109,7 @@ public class PluginInfoFragment extends BaseOsmAndFragment implements PluginStat
}
}
});
UiUtilities.rotateImageByLayoutDirection(closeButton, AndroidUtils.getLayoutDirection(app));
UiUtilities.rotateImageByLayoutDirection(closeButton, app);
Drawable pluginImage = plugin.getAssetResourceImage();
if (pluginImage != null) {

View file

@ -101,7 +101,7 @@ public class PluginsFragment extends BaseOsmAndFragment implements PluginStateLi
}
}
});
UiUtilities.rotateImageByLayoutDirection(closeButton, AndroidUtils.getLayoutDirection(app));
UiUtilities.rotateImageByLayoutDirection(closeButton, app);
adapter = new PluginsListAdapter(requireContext());

View file

@ -493,7 +493,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
});
if (closeButton instanceof ImageView) {
UiUtilities.rotateImageByLayoutDirection(
(ImageView) closeButton, AndroidUtils.getLayoutDirection(app));
(ImageView) closeButton, app);
}
}

View file

@ -152,6 +152,7 @@ public class PurchasesFragment extends BaseOsmAndFragment implements InAppPurcha
}
});
ImageButton backButton = toolbar.findViewById(R.id.close_button);
UiUtilities.rotateImageByLayoutDirection(backButton, getContext());
backButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View file

@ -7,10 +7,12 @@ import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.StyleSpan;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
import net.osmand.plus.inapp.InAppPurchaseHelper;
@ -74,6 +76,9 @@ public class TroubleshootingOrPurchasingCard extends BaseCard {
} else {
AndroidUtils.setBackground(mapActivity, getItButton, nightMode, R.drawable.btn_unstroked_light, R.drawable.btn_unstroked_dark);
}
ImageView getItArrow = view.findViewById(R.id.additional_button_icon);
UiUtilities.rotateImageByLayoutDirection(getItArrow, app);
}
}