Loading java/res/drawable/ic_ime_switch.xml +11 −7 Original line number Diff line number Diff line <vector xmlns:android="http://schemas.android.com/apk/res/android" android:viewportWidth="24" android:viewportHeight="24" android:width="24dp" android:height="24dp"> android:viewportWidth="48" android:viewportHeight="48" android:width="match_parent" android:height="match_parent"> <group android:translateX="12" android:translateY="12"> <path android:pathData="M11.48 19.69c2.72 0 4.91 -2.2 4.91 -4.92l0.02 -9.84c0 -2.72 -2.2 -4.92 -4.92 -4.92s-4.92 2.2 -4.92 4.92v9.84c0 2.72 2.2 4.92 4.92 4.92ZM20.18 14.77c0 4.92 -4.17 8.37 -8.7 8.37S2.79 19.69 2.79 14.77H0c0 5.59 4.46 10.22 9.84 11.03v5.38h3.28v-5.38c5.38 -0.79 9.84 -5.41 9.84 -11.03h-2.79Z" android:fillColor="#DEADB5B9" /> </group> </vector> No newline at end of file java/res/layout/main_keyboard_frame.xml +12 −17 Original line number Diff line number Diff line Loading @@ -48,15 +48,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout> <FrameLayout android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="top|end"> <ImageButton android:id="@+id/floating_button" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_width="48dp" android:layout_height="48dp" android:layout_gravity="top|end" android:background="@android:color/transparent" android:src="@drawable/ic_ime_switch" android:contentDescription="@string/ime_switch_button" Loading @@ -65,4 +61,3 @@ android:padding="0dp" android:scaleType="fitCenter"/> </FrameLayout> </FrameLayout> java/src/com/android/inputmethod/latin/LatinIME.java +18 −21 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.inputmethodservice.InputMethodService; Loading Loading @@ -913,6 +914,23 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen manageFloatingButtonVisibility(); } private void updateFloatingButtonTint(View view) { int currentNightMode = view.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; int tintColor = ContextCompat.getColor(view.getContext(), Color.BLACK); //Light mode is black if (currentNightMode == Configuration.UI_MODE_NIGHT_YES) { tintColor = ContextCompat.getColor(view.getContext(), Color.WHITE); } Drawable icon = ContextCompat.getDrawable(view.getContext(), R.drawable.ic_ime_switch); if (icon != null) { icon = DrawableCompat.wrap(icon.mutate()); DrawableCompat.setTint(icon, tintColor); floatingButton.setImageDrawable(icon); } } private void manageFloatingButtonVisibility() { final SettingsValues currentSettingsValues = mSettings.getCurrent(); if (shouldShowFloatingButton() && currentSettingsValues.mInputAttributes.mShouldShowSuggestions) { Loading Loading @@ -2138,25 +2156,4 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen w.getDecorView().setSystemUiVisibility(flags); } } private void updateFloatingButtonTint(View view) { ImageButton floatingButton = view.findViewById(R.id.floating_button); if (floatingButton == null) return; int currentNightMode = view.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; int tintColor; if (currentNightMode == Configuration.UI_MODE_NIGHT_YES) { tintColor = ContextCompat.getColor(view.getContext(), 0xFFFFFFFF); } else { tintColor = ContextCompat.getColor(view.getContext(), 0xFF000000); } Drawable icon = ContextCompat.getDrawable(view.getContext(), R.drawable.ic_ime_switch); if (icon != null) { icon = DrawableCompat.wrap(icon.mutate()); DrawableCompat.setTint(icon, tintColor); floatingButton.setImageDrawable(icon); } } } Loading
java/res/drawable/ic_ime_switch.xml +11 −7 Original line number Diff line number Diff line <vector xmlns:android="http://schemas.android.com/apk/res/android" android:viewportWidth="24" android:viewportHeight="24" android:width="24dp" android:height="24dp"> android:viewportWidth="48" android:viewportHeight="48" android:width="match_parent" android:height="match_parent"> <group android:translateX="12" android:translateY="12"> <path android:pathData="M11.48 19.69c2.72 0 4.91 -2.2 4.91 -4.92l0.02 -9.84c0 -2.72 -2.2 -4.92 -4.92 -4.92s-4.92 2.2 -4.92 4.92v9.84c0 2.72 2.2 4.92 4.92 4.92ZM20.18 14.77c0 4.92 -4.17 8.37 -8.7 8.37S2.79 19.69 2.79 14.77H0c0 5.59 4.46 10.22 9.84 11.03v5.38h3.28v-5.38c5.38 -0.79 9.84 -5.41 9.84 -11.03h-2.79Z" android:fillColor="#DEADB5B9" /> </group> </vector> No newline at end of file
java/res/layout/main_keyboard_frame.xml +12 −17 Original line number Diff line number Diff line Loading @@ -48,15 +48,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout> <FrameLayout android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="top|end"> <ImageButton android:id="@+id/floating_button" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_width="48dp" android:layout_height="48dp" android:layout_gravity="top|end" android:background="@android:color/transparent" android:src="@drawable/ic_ime_switch" android:contentDescription="@string/ime_switch_button" Loading @@ -65,4 +61,3 @@ android:padding="0dp" android:scaleType="fitCenter"/> </FrameLayout> </FrameLayout>
java/src/com/android/inputmethod/latin/LatinIME.java +18 −21 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.inputmethodservice.InputMethodService; Loading Loading @@ -913,6 +914,23 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen manageFloatingButtonVisibility(); } private void updateFloatingButtonTint(View view) { int currentNightMode = view.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; int tintColor = ContextCompat.getColor(view.getContext(), Color.BLACK); //Light mode is black if (currentNightMode == Configuration.UI_MODE_NIGHT_YES) { tintColor = ContextCompat.getColor(view.getContext(), Color.WHITE); } Drawable icon = ContextCompat.getDrawable(view.getContext(), R.drawable.ic_ime_switch); if (icon != null) { icon = DrawableCompat.wrap(icon.mutate()); DrawableCompat.setTint(icon, tintColor); floatingButton.setImageDrawable(icon); } } private void manageFloatingButtonVisibility() { final SettingsValues currentSettingsValues = mSettings.getCurrent(); if (shouldShowFloatingButton() && currentSettingsValues.mInputAttributes.mShouldShowSuggestions) { Loading Loading @@ -2138,25 +2156,4 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen w.getDecorView().setSystemUiVisibility(flags); } } private void updateFloatingButtonTint(View view) { ImageButton floatingButton = view.findViewById(R.id.floating_button); if (floatingButton == null) return; int currentNightMode = view.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; int tintColor; if (currentNightMode == Configuration.UI_MODE_NIGHT_YES) { tintColor = ContextCompat.getColor(view.getContext(), 0xFFFFFFFF); } else { tintColor = ContextCompat.getColor(view.getContext(), 0xFF000000); } Drawable icon = ContextCompat.getDrawable(view.getContext(), R.drawable.ic_ime_switch); if (icon != null) { icon = DrawableCompat.wrap(icon.mutate()); DrawableCompat.setTint(icon, tintColor); floatingButton.setImageDrawable(icon); } } }