Skip to content

Commit

Permalink
fix(android): Auto-mirror back and forward arrows for RTL support
Browse files Browse the repository at this point in the history
  • Loading branch information
darcywong00 committed Aug 20, 2024
1 parent 9d9a091 commit c9bc396
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void onCreate(Bundle savedInstanceState) {
hashMap = new HashMap<>();
final String customHelpLink = kbd.getHelpLink();
// Check if app declared FileProvider
icon = String.valueOf(R.drawable.ic_arrow_forward);
icon = String.valueOf(R.drawable.ic_action_forward);
// Don't show help link arrow if File Provider unavailable, or custom help doesn't exist
if ( (customHelpLink != null && !FileProviderUtils.exists(context)) ||
(customHelpLink == null && !packageID.equals(KMManager.KMDefault_UndefinedPackageID)) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void onCreate(Bundle savedInstanceState) {
updateActiveLexicalModel();

ImageView imageView = (ImageView) layout.findViewById(R.id.image1);
imageView.setImageResource(R.drawable.ic_arrow_forward);
imageView.setImageResource(R.drawable.ic_action_forward);
layout.setEnabled(true);
layout.setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -198,7 +198,7 @@ public void onClick(View v) {
* textView = (TextView) layout.findViewById(R.id.text1);
* textView.setText(getString(R.string.manage_dictionary));
* imageView = (ImageView) layout.findViewById(R.id.image1);
* imageView.setImageResource(R.drawable.ic_arrow_forward);
* imageView.setImageResource(R.drawable.ic_action_forward);
*/

listView.setAdapter(adapter);
Expand Down Expand Up @@ -346,7 +346,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
}

holder.text.setText(kbd.getResourceName());
holder.img.setImageResource(R.drawable.ic_arrow_forward);
holder.img.setImageResource(R.drawable.ic_action_forward);

return convertView;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
}

holder.textLang.setText(data.name);
holder.img.setImageResource(R.drawable.ic_arrow_forward);
holder.img.setImageResource(R.drawable.ic_action_forward);

holder.textCount.setText(getContext().getResources().getQuantityString(R.plurals.keyboard_count, data.keyboards.size(), data.keyboards.size()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void onCreate(Bundle savedInstanceState) {
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put(titleKey, keyboardName);
hashMap.put(subtitleKey, pkgID);
String icon = String.valueOf(R.drawable.ic_arrow_forward);
String icon = String.valueOf(R.drawable.ic_action_forward);
hashMap.put(iconKey, icon);
list.add(hashMap);
}
Expand Down

This file was deleted.

5 changes: 3 additions & 2 deletions android/KMAPro/kMAPro/src/main/res/layout/activity_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
<ImageButton
android:id="@+id/back_button"
style="?android:attr/actionButtonStyle"
app:tint="@color/image_button_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:contentDescription="@string/label_back"
android:src="@drawable/ic_navigation_back" />
android:src="@drawable/ic_action_back" />

<ImageButton
android:id="@+id/forward_button"
Expand All @@ -32,7 +33,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/label_forward"
android:src="@drawable/ic_navigation_forward" />
android:src="@drawable/ic_action_forward" />

<ImageButton
android:id="@+id/close_button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
android:layout_marginEnd="5dp"
android:layout_weight="1"
android:contentDescription="@string/image_button"
android:src="@drawable/ic_navigation_back" />
android:src="@drawable/ic_action_back" />

<ImageButton
android:id="@+id/forwardButton"
Expand All @@ -45,7 +45,7 @@
android:layout_marginEnd="5dp"
android:layout_weight="1"
android:contentDescription="@string/image_button"
android:src="@drawable/ic_navigation_forward" />
android:src="@drawable/ic_action_forward" />

<ImageButton
android:id="@+id/bookmarksButton"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/preference_icon"
android:layout_height="@dimen/preference_icon"
android:src="@drawable/ic_arrow_forward" />
android:src="@drawable/ic_action_forward" />
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void onCreate(Bundle savedInstanceState) {
hashMap = new HashMap<String, String>();
final String customHelpLink = kbd.getHelpLink();
// Check if app declared FileProvider
String icon = String.valueOf(R.drawable.ic_arrow_forward);
String icon = String.valueOf(R.drawable.ic_action_forward);
// Don't show help link arrow if it's a local help file and File Provider unavailable,
// or custom help doesn't exist
if ( (customHelpLink != null && ! KMManager.isTestMode() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void onCreate(Bundle savedInstanceState) {
final String customHelpLink = lm.getHelpLink();
// Check if app declared FileProvider
// Currently, model help only available if custom link exists
icon = String.valueOf(R.drawable.ic_arrow_forward);
icon = String.valueOf(R.drawable.ic_action_forward);
// Don't show help link arrow if both custom help and File Provider don't exist
// TODO: Update this when model help available on help.keyman.com
if ( (!customHelpLink.equals("") && !FileProviderUtils.exists(context)) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
// once it has its own backing Dataset instance.
// Is this an installed model or not?

holder.imgDetails.setImageResource(R.drawable.ic_arrow_forward);
holder.imgDetails.setImageResource(R.drawable.ic_action_forward);
if (KeyboardPickerActivity.containsLexicalModel(context, modelKey)) {
holder.imgInstalled.setImageResource(R.drawable.ic_check);
} else {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions android/KMEA/app/src/main/res/drawable/ic_action_back.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_arrow_back"
android:tint="@android:color/black"
android:autoMirrored="true" />
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_arrow_forward"
android:tint="@color/keyman_blue" />
android:tint="@android:color/black"
android:autoMirrored="true"/>
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:src="@drawable/ic_arrow_forward"
android:src="@drawable/ic_action_forward"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="12dp"
Expand Down

0 comments on commit c9bc396

Please sign in to comment.