diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-20 03:35:15 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-20 15:45:21 +0200 |
commit | 2d6a45f82456de88c3ee0b10815c62963c5016d7 (patch) | |
tree | c579c05b191e12ed832dcd819140dcb6835f7104 /app/src/main/java | |
parent | ed802336e64bfba9893b831e05babbc7d800dd0e (diff) |
fab: make icons always white
With the new shade of blue, perhaps this simply looks better.
I don't like hard coding the color away from the theme, however.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/com/wireguard/android/activity/ThemeChangeAwareActivity.java | 33 | ||||
-rw-r--r-- | app/src/main/java/com/wireguard/android/widget/fab/FloatingActionsMenu.java | 2 |
2 files changed, 1 insertions, 34 deletions
diff --git a/app/src/main/java/com/wireguard/android/activity/ThemeChangeAwareActivity.java b/app/src/main/java/com/wireguard/android/activity/ThemeChangeAwareActivity.java index d85a0170..de8020f1 100644 --- a/app/src/main/java/com/wireguard/android/activity/ThemeChangeAwareActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/ThemeChangeAwareActivity.java @@ -18,37 +18,6 @@ import com.wireguard.android.Application; import java.lang.reflect.Field; public abstract class ThemeChangeAwareActivity extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener { - private static final String TAG = "WireGuard/" + ThemeChangeAwareActivity.class.getSimpleName(); - - @Nullable private static Resources lastResources; - private static boolean lastDarkMode; - private static synchronized void invalidateDrawableCache(final Resources resources, final boolean darkMode) { - if (resources == lastResources && darkMode == lastDarkMode) - return; - - try { - Field f; - Object o = resources; - try { - f = o.getClass().getDeclaredField("mResourcesImpl"); - f.setAccessible(true); - o = f.get(o); - } catch (final Exception ignored) { } - f = o.getClass().getDeclaredField("mDrawableCache"); - f.setAccessible(true); - o = f.get(o); - try { - o.getClass().getMethod("onConfigurationChange", int.class).invoke(o, -1); - } catch (final Exception ignored) { - o.getClass().getMethod("clear").invoke(o); - } - } catch (final Exception e) { - Log.e(TAG, "Failed to flush drawable cache", e); - } - - lastResources = resources; - lastDarkMode = darkMode; - } @Override @@ -66,12 +35,10 @@ public abstract class ThemeChangeAwareActivity extends AppCompatActivity impleme @Override public void onSharedPreferenceChanged(final SharedPreferences sharedPreferences, final String key) { if ("dark_theme".equals(key)) { - final boolean darkMode = sharedPreferences.getBoolean(key, false); AppCompatDelegate.setDefaultNightMode( sharedPreferences.getBoolean(key, false) ? AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO); - invalidateDrawableCache(getResources(), darkMode); recreate(); } } diff --git a/app/src/main/java/com/wireguard/android/widget/fab/FloatingActionsMenu.java b/app/src/main/java/com/wireguard/android/widget/fab/FloatingActionsMenu.java index 7ca6d976..e0a335d4 100644 --- a/app/src/main/java/com/wireguard/android/widget/fab/FloatingActionsMenu.java +++ b/app/src/main/java/com/wireguard/android/widget/fab/FloatingActionsMenu.java @@ -112,7 +112,7 @@ public class FloatingActionsMenu extends ViewGroup { } private void createAddButton(final Context context) { - final RotatingDrawable rotatingDrawable = new RotatingDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.ic_action_add_inverse, context.getTheme())); + final RotatingDrawable rotatingDrawable = new RotatingDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.ic_action_add_white, context.getTheme())); mRotatingDrawable = rotatingDrawable; final TimeInterpolator interpolator = new OvershootInterpolator(); |