From d1c623694e0b327aee8f005bf894feb444d2bc9a Mon Sep 17 00:00:00 2001 From: Moez Bhatti Date: Wed, 30 Dec 2015 22:32:47 -0500 Subject: [PATCH] Static usages of ThemeManager --- .../java/com/moez/QKSMS/QKSMSAppBase.java | 3 +- .../com/moez/QKSMS/common/FontManager.java | 20 +-- .../com/moez/QKSMS/common/ListviewHelper.java | 6 +- .../com/moez/QKSMS/data/ContactHelper.java | 2 +- .../QKSMS/receiver/NightModeAutoReceiver.java | 6 +- .../receiver/WearableIntentReceiver.java | 2 +- .../transaction/NotificationManager.java | 2 +- .../java/com/moez/QKSMS/ui/MainActivity.java | 6 +- .../java/com/moez/QKSMS/ui/ThemeManager.java | 131 ++++++++---------- .../com/moez/QKSMS/ui/base/QKActivity.java | 4 +- .../moez/QKSMS/ui/base/QKContentFragment.java | 2 +- .../com/moez/QKSMS/ui/base/QKFragment.java | 2 +- .../moez/QKSMS/ui/base/QKPopupActivity.java | 4 +- .../ConversationListAdapter.java | 18 +-- .../ConversationListFragment.java | 16 +-- .../ConversationListViewHolder.java | 2 +- .../ui/dialog/BubblePreferenceDialog.java | 70 +++++----- .../QKSMS/ui/dialog/DefaultSmsHelper.java | 2 +- .../com/moez/QKSMS/ui/dialog/QKDialog.java | 6 +- .../ui/dialog/mms/MMSDialogFragment.java | 6 +- .../ui/messagelist/MessageListAdapter.java | 22 +-- .../ui/messagelist/MessageListFragment.java | 8 +- .../QKSMS/ui/settings/SettingsFragment.java | 18 +-- .../ui/view/AutoCompleteContactView.java | 4 +- .../com/moez/QKSMS/ui/view/AvatarView.java | 8 +- .../com/moez/QKSMS/ui/view/ComposeView.java | 24 ++-- .../com/moez/QKSMS/ui/view/QKEditText.java | 4 +- .../com/moez/QKSMS/ui/view/QKImageView.java | 2 +- .../java/com/moez/QKSMS/ui/view/QKSwitch.java | 16 +-- .../com/moez/QKSMS/ui/view/QKTextView.java | 12 +- .../QKSMS/ui/view/StarredContactsView.java | 10 +- .../QKSMS/ui/welcome/WelcomeActivity.java | 8 +- .../ui/welcome/WelcomeNightFragment.java | 10 +- .../ui/welcome/WelcomeThemeFragment.java | 4 +- .../moez/QKSMS/ui/widget/WidgetProvider.java | 8 +- .../moez/QKSMS/ui/widget/WidgetService.java | 16 +-- 36 files changed, 238 insertions(+), 246 deletions(-) diff --git a/QKSMS/src/main/java/com/moez/QKSMS/QKSMSAppBase.java b/QKSMS/src/main/java/com/moez/QKSMS/QKSMSAppBase.java index 164a4a0a..cbe1d4f1 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/QKSMSAppBase.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/QKSMSAppBase.java @@ -41,6 +41,7 @@ import com.moez.QKSMS.common.google.ThumbnailManager; import com.moez.QKSMS.data.Contact; import com.moez.QKSMS.data.Conversation; import com.moez.QKSMS.transaction.NotificationManager; +import com.moez.QKSMS.ui.ThemeManager; import com.moez.QKSMS.ui.mms.layout.LayoutManager; import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.RefWatcher; @@ -88,6 +89,7 @@ public class QKSMSAppBase extends MultiDexApplication { mPduLoaderManager = new PduLoaderManager(context); mThumbnailManager = new ThumbnailManager(context); + ThemeManager.init(this); MmsConfig.init(this); Contact.init(this); DraftCache.init(this); @@ -97,7 +99,6 @@ public class QKSMSAppBase extends MultiDexApplication { LayoutManager.init(this); NotificationManager.init(this); LiveViewManager.init(this); - //MessagingNotification.init(this); activePendingMessages(); } diff --git a/QKSMS/src/main/java/com/moez/QKSMS/common/FontManager.java b/QKSMS/src/main/java/com/moez/QKSMS/common/FontManager.java index b0ecccad..8c8c1fd5 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/common/FontManager.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/common/FontManager.java @@ -89,26 +89,26 @@ public class FontManager { // Colors and font weight switch (type) { case FontManager.TEXT_TYPE_PRIMARY: - boolean isNight = ThemeManager.getInstance().getTheme() == ThemeManager.Theme.GREY || - ThemeManager.getInstance().getTheme() == ThemeManager.Theme.BLACK; + boolean isNight = ThemeManager.getTheme() == ThemeManager.Theme.GREY || + ThemeManager.getTheme() == ThemeManager.Theme.BLACK; int id = isNight ? R.color.text_primary_dark : R.color.text_primary_light; return context.getResources().getColorStateList(id); case FontManager.TEXT_TYPE_SECONDARY: - return ColorStateList.valueOf(ThemeManager.getInstance().getTextOnBackgroundSecondary()); + return ColorStateList.valueOf(ThemeManager.getTextOnBackgroundSecondary()); case FontManager.TEXT_TYPE_TERTIARY: - return ColorStateList.valueOf(ThemeManager.getInstance().getTextOnBackgroundSecondary()); + return ColorStateList.valueOf(ThemeManager.getTextOnBackgroundSecondary()); case FontManager.TEXT_TYPE_CATEGORY: - return ColorStateList.valueOf(ThemeManager.getInstance().getColor()); + return ColorStateList.valueOf(ThemeManager.getColor()); case FontManager.TEXT_TYPE_DIALOG_TITLE: - return ColorStateList.valueOf(ThemeManager.getInstance().getTextOnBackgroundPrimary()); + return ColorStateList.valueOf(ThemeManager.getTextOnBackgroundPrimary()); case FontManager.TEXT_TYPE_DIALOG_MESSAGE: - return ColorStateList.valueOf(ThemeManager.getInstance().getTextOnBackgroundSecondary()); + return ColorStateList.valueOf(ThemeManager.getTextOnBackgroundSecondary()); case FontManager.TEXT_TYPE_DIALOG_BUTTON: - return ColorStateList.valueOf(ThemeManager.getInstance().getTextOnBackgroundPrimary()); + return ColorStateList.valueOf(ThemeManager.getTextOnBackgroundPrimary()); case FontManager.TEXT_TYPE_TOOLBAR: - return ColorStateList.valueOf(ThemeManager.getInstance().getTextOnColorPrimary()); + return ColorStateList.valueOf(ThemeManager.getTextOnColorPrimary()); } - return ColorStateList.valueOf(ThemeManager.getInstance().getTextOnBackgroundPrimary()); + return ColorStateList.valueOf(ThemeManager.getTextOnBackgroundPrimary()); } public static int getFontWeight(Context context, boolean heavy) { diff --git a/QKSMS/src/main/java/com/moez/QKSMS/common/ListviewHelper.java b/QKSMS/src/main/java/com/moez/QKSMS/common/ListviewHelper.java index bb196dd6..1e614697 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/common/ListviewHelper.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/common/ListviewHelper.java @@ -20,9 +20,9 @@ public class ListviewHelper { try { Drawable drawable = ContextCompat.getDrawable(context, R.drawable.scrollbar); drawable.setColorFilter(Color.argb(64, - Color.red(ThemeManager.getInstance().getTextOnBackgroundSecondary()), - Color.green(ThemeManager.getInstance().getTextOnBackgroundSecondary()), - Color.blue(ThemeManager.getInstance().getTextOnBackgroundSecondary())), + Color.red(ThemeManager.getTextOnBackgroundSecondary()), + Color.green(ThemeManager.getTextOnBackgroundSecondary()), + Color.blue(ThemeManager.getTextOnBackgroundSecondary())), PorterDuff.Mode.SRC_ATOP); Field mScrollCacheField = View.class.getDeclaredField("mScrollCache"); diff --git a/QKSMS/src/main/java/com/moez/QKSMS/data/ContactHelper.java b/QKSMS/src/main/java/com/moez/QKSMS/data/ContactHelper.java index 9f279d72..ea7fff1c 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/data/ContactHelper.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/data/ContactHelper.java @@ -197,7 +197,7 @@ public class ContactHelper { int length = Units.dpToPx(context, 64); Bitmap bitmap = Bitmap.createBitmap(length, length, Bitmap.Config.ARGB_8888); - bitmap.eraseColor(ThemeManager.getInstance().getColor()); + bitmap.eraseColor(ThemeManager.getColor()); Canvas canvas = new Canvas(bitmap); diff --git a/QKSMS/src/main/java/com/moez/QKSMS/receiver/NightModeAutoReceiver.java b/QKSMS/src/main/java/com/moez/QKSMS/receiver/NightModeAutoReceiver.java index 351c468a..cfcb5758 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/receiver/NightModeAutoReceiver.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/receiver/NightModeAutoReceiver.java @@ -19,7 +19,7 @@ public class NightModeAutoReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - ThemeManager.getInstance().loadThemeProperties(context); + ThemeManager.loadThemeProperties(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); if (prefs.getBoolean(SettingsFragment.NIGHT_AUTO, false)) { @@ -42,11 +42,11 @@ public class NightModeAutoReceiver extends BroadcastReceiver { (calendar.get(Calendar.HOUR_OF_DAY) == day.get(Calendar.HOUR_OF_DAY) && calendar.get(Calendar.MINUTE) <= day.get(Calendar.MINUTE))) { Log.i(TAG, "Switching to night mode"); prefs.edit().putString(SettingsFragment.BACKGROUND, ThemeManager.Theme.PREF_GREY).apply(); - ThemeManager.getInstance().setTheme(ThemeManager.Theme.GREY); + ThemeManager.setTheme(ThemeManager.Theme.GREY); } else { Log.i(TAG, "Switching to day mode"); prefs.edit().putString(SettingsFragment.BACKGROUND, ThemeManager.Theme.PREF_OFFWHITE).apply(); - ThemeManager.getInstance().setTheme(ThemeManager.Theme.OFFWHITE); + ThemeManager.setTheme(ThemeManager.Theme.OFFWHITE); } } } diff --git a/QKSMS/src/main/java/com/moez/QKSMS/receiver/WearableIntentReceiver.java b/QKSMS/src/main/java/com/moez/QKSMS/receiver/WearableIntentReceiver.java index 96f94479..f152b28a 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/receiver/WearableIntentReceiver.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/receiver/WearableIntentReceiver.java @@ -56,7 +56,7 @@ public class WearableIntentReceiver extends BroadcastReceiver { background = Bitmap.createBitmap(640, 400, Bitmap.Config.ARGB_8888); // We can't use ThemeManager here because it might not be initialized - background.eraseColor(Integer.parseInt(prefs.getString(SettingsFragment.THEME, "" + ThemeManager.getInstance().DEFAULT_COLOR))); + background.eraseColor(Integer.parseInt(prefs.getString(SettingsFragment.THEME, "" + ThemeManager.DEFAULT_COLOR))); } wearableExtender.setBackground(background); diff --git a/QKSMS/src/main/java/com/moez/QKSMS/transaction/NotificationManager.java b/QKSMS/src/main/java/com/moez/QKSMS/transaction/NotificationManager.java index e1154788..ee788e2b 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/transaction/NotificationManager.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/transaction/NotificationManager.java @@ -680,7 +680,7 @@ public class NotificationManager { .setContentIntent(composePI) .setSmallIcon(R.drawable.ic_compose) .setPriority(NotificationCompat.PRIORITY_MIN) - .setColor(ThemeManager.getInstance().getColor()); + .setColor(ThemeManager.getColor()); NotificationManager.notify(context, NOTIFICATION_ID_QUICKCOMPOSE, builder.build()); } else { diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/MainActivity.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/MainActivity.java index 0018d3e0..2612051a 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/MainActivity.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/MainActivity.java @@ -648,9 +648,9 @@ public class MainActivity extends QKActivity implements LiveView, SlidingMenu.Sl public void refresh() { // Update the background color. This code is important during the welcome screen setup, when the activity // in the ThemeManager isn't the MainActivity - findViewById(R.id.menu_frame).getRootView().setBackgroundColor(ThemeManager.getInstance().getBackgroundColor()); - findViewById(R.id.menu_frame).setBackgroundColor(ThemeManager.getInstance().getBackgroundColor()); - findViewById(R.id.content_frame).setBackgroundColor(ThemeManager.getInstance().getBackgroundColor()); + findViewById(R.id.menu_frame).getRootView().setBackgroundColor(ThemeManager.getBackgroundColor()); + findViewById(R.id.menu_frame).setBackgroundColor(ThemeManager.getBackgroundColor()); + findViewById(R.id.content_frame).setBackgroundColor(ThemeManager.getBackgroundColor()); } public static class DeleteThreadListener implements DialogInterface.OnClickListener { diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/ThemeManager.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/ThemeManager.java index f995097c..2999cf6f 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/ThemeManager.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/ThemeManager.java @@ -220,58 +220,49 @@ public class ThemeManager { 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }}; - private int mColor; - private int mActiveColor; - private int mBackgroundColor; - private Theme mTheme; + private static int mColor; + private static int mActiveColor; + private static int mBackgroundColor; + private static Theme mTheme; - private int mTextOnColorPrimary; - private int mTextOnColorSecondary; - private int mTextOnBackgroundPrimary; - private int mtextOnBackgroundSecondary; - private int mSentBubbleRes; - private int mSentBubbleAltRes; - private boolean mSentBubbleColored; - private int mReceivedBubbleRes; - private int mReceivedBubbleAltRes; - private boolean mReceivedBubbleColored; - private Drawable mRippleBackground; + private static int mTextOnColorPrimary; + private static int mTextOnColorSecondary; + private static int mTextOnBackgroundPrimary; + private static int mtextOnBackgroundSecondary; + private static int mSentBubbleRes; + private static int mSentBubbleAltRes; + private static boolean mSentBubbleColored; + private static int mReceivedBubbleRes; + private static int mReceivedBubbleAltRes; + private static boolean mReceivedBubbleColored; + private static Drawable mRippleBackground; - private Resources mResources; - private SharedPreferences mPrefs; + private static Resources mResources; + private static SharedPreferences mPrefs; - private boolean mStatusTintEnabled = false; - private boolean mNavigationTintEnabled = false; + private static boolean mStatusTintEnabled = false; + private static boolean mNavigationTintEnabled = false; - private QKActivity mActivity; - private Context mContext; - private Window mWindow; + private static QKActivity mActivity; + private static Context mContext; + private static Window mWindow; - private static ThemeManager sInstance; - - public static ThemeManager getInstance() { - if (sInstance == null) { - sInstance = new ThemeManager(); - } - - return sInstance; - } - - private ThemeManager() { + public static void init(Context context) { + mContext = context; + mPrefs = PreferenceManager.getDefaultSharedPreferences(context); + mResources = context.getResources(); } /** * Loads all theme properties. Should be called during onCreate * of each activity that contains fragments that use ThemeManager */ - public void loadThemeProperties(Context context) { - mPrefs = PreferenceManager.getDefaultSharedPreferences(context); - mResources = context.getResources(); + public static void loadThemeProperties(Context context) { mContext = context; - mColor = Integer.parseInt(mPrefs.getString(SettingsFragment.THEME, "" + ThemeManager.getInstance().DEFAULT_COLOR)); + mColor = Integer.parseInt(mPrefs.getString(SettingsFragment.THEME, "" + ThemeManager.DEFAULT_COLOR)); mActiveColor = mColor; if (context instanceof QKActivity) { @@ -296,7 +287,7 @@ public class ThemeManager { } - public void setTheme(Theme theme) { + public static void setTheme(Theme theme) { int startColor = mBackgroundColor; initializeTheme(theme); int endColor = mBackgroundColor; @@ -343,7 +334,7 @@ public class ThemeManager { } } - public void initializeTheme(Theme theme) { + public static void initializeTheme(Theme theme) { mTheme = theme; switch (theme) { @@ -406,7 +397,7 @@ public class ThemeManager { } } - public void setIcon(final QKActivity context) { + public static void setIcon(final QKActivity context) { new QKDialog() .setContext(context) .setTitle(R.string.update_icon_title) @@ -459,66 +450,66 @@ public class ThemeManager { .show(); } - public int getBackgroundColor() { + public static int getBackgroundColor() { return mBackgroundColor; } - public int getTextOnColorPrimary() { + public static int getTextOnColorPrimary() { return mTextOnColorPrimary; } - public int getTextOnColorSecondary() { + public static int getTextOnColorSecondary() { return mTextOnColorSecondary; } - public int getTextOnBackgroundPrimary() { + public static int getTextOnBackgroundPrimary() { return mTextOnBackgroundPrimary; } - public int getTextOnBackgroundSecondary() { + public static int getTextOnBackgroundSecondary() { return mtextOnBackgroundSecondary; } - public int getSentBubbleRes() { + public static int getSentBubbleRes() { return mSentBubbleRes; } - public int getSentBubbleAltRes() { + public static int getSentBubbleAltRes() { return mSentBubbleAltRes; } - public int getSentBubbleColor() { + public static int getSentBubbleColor() { return mSentBubbleColored ? mActiveColor : getNeutralBubbleColor(); } - public int getReceivedBubbleRes() { + public static int getReceivedBubbleRes() { return mReceivedBubbleRes; } - public int getReceivedBubbleAltRes() { + public static int getReceivedBubbleAltRes() { return mReceivedBubbleAltRes; } - public int getReceivedBubbleColor() { + public static int getReceivedBubbleColor() { return mReceivedBubbleColored ? mActiveColor : getNeutralBubbleColor(); } - public void setBubbleStyleNew(boolean styleNew) { + public static void setBubbleStyleNew(boolean styleNew) { mSentBubbleRes = styleNew ? R.drawable.message_sent_2 : R.drawable.message_sent; mSentBubbleAltRes = styleNew ? R.drawable.message_sent_alt_2 : R.drawable.message_sent_alt; mReceivedBubbleRes = styleNew ? R.drawable.message_received_2 : R.drawable.message_received; mReceivedBubbleAltRes = styleNew ? R.drawable.message_received_alt_2 : R.drawable.message_received_alt; } - public void setSentBubbleColored(boolean colored) { + public static void setSentBubbleColored(boolean colored) { mSentBubbleColored = colored; } - public void setReceivedBubbleColored(boolean colored) { + public static void setReceivedBubbleColored(boolean colored) { mReceivedBubbleColored = colored; } - public int getNeutralBubbleColor() { + public static int getNeutralBubbleColor() { if (mTheme == null) { return 0xeeeeee; } @@ -538,27 +529,27 @@ public class ThemeManager { } } - public Drawable getRippleBackground() { + public static Drawable getRippleBackground() { return mRippleBackground; } - public int getColor() { + public static int getColor() { return mActiveColor; } - public int getThemeColor() { + public static int getThemeColor() { return mColor; } - public Theme getTheme() { + public static Theme getTheme() { return mTheme; } - public boolean isNightMode() { + public static boolean isNightMode() { return mTheme == Theme.GREY || mTheme == Theme.BLACK; } - public void showColourSwatchesDialog(final QKActivity context) { + public static void showColourSwatchesDialog(final QKActivity context) { final QKDialog dialog = new QKDialog(); ColorPickerPalette palette = new ColorPickerPalette(context); @@ -578,7 +569,7 @@ public class ThemeManager { dialog.show(); } - private void showColourPickerDialog(final QKActivity context, int swatchColour) { + private static void showColourPickerDialog(final QKActivity context, int swatchColour) { final QKDialog dialog = new QKDialog(); ColorPickerPalette palette = new ColorPickerPalette(context); @@ -598,7 +589,7 @@ public class ThemeManager { } @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public void setStatusBarTintEnabled(boolean enabled) { + public static void setStatusBarTintEnabled(boolean enabled) { if (mStatusTintEnabled != enabled) { mStatusTintEnabled = enabled; int colorFrom = enabled ? mResources.getColor(R.color.black) : mColor; @@ -614,7 +605,7 @@ public class ThemeManager { } @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public void setNavigationBarTintEnabled(boolean enabled) { + public static void setNavigationBarTintEnabled(boolean enabled) { if (mNavigationTintEnabled != enabled) { mNavigationTintEnabled = enabled; int colorFrom = enabled ? mResources.getColor(R.color.black) : mColor; @@ -629,11 +620,11 @@ public class ThemeManager { } } - public String getColorString(int color) { + public static String getColorString(int color) { return String.format("#%08x", color).toUpperCase(); } - public void setColour(int color) { + public static void setColour(int color) { AnalyticsManager.getInstance().sendEvent( AnalyticsManager.CATEGORY_PREFERENCE_CHANGE, @@ -710,7 +701,7 @@ public class ThemeManager { } } - public void setActiveColor(int color) { + public static void setActiveColor(int color) { mActiveColor = color; if (mActivity != null) { @@ -730,7 +721,7 @@ public class ThemeManager { } } - private boolean isColorDarkEnough(int color) { + private static boolean isColorDarkEnough(int color) { for (int i = 0; i < COLOURS.length; i++) { for (int j = 0; j < COLOURS[i].length; j++) { if (color == COLOURS[i][j]) { @@ -742,7 +733,7 @@ public class ThemeManager { return true; } - public int getSwatchColour(int colour) { + public static int getSwatchColour(int colour) { for (int i = 0; i < COLOURS.length; i++) { for (int j = 0; j < COLOURS[i].length; j++) { if (colour == COLOURS[i][j]) { @@ -754,7 +745,7 @@ public class ThemeManager { return colour; } - private int[] getSwatch(int colour) { + private static int[] getSwatch(int colour) { for (int[] swatch : COLOURS) { for (int swatchColor : swatch) { if (colour == swatchColor) { diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKActivity.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKActivity.java index 6e9d4d8d..c85c31af 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKActivity.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKActivity.java @@ -72,7 +72,7 @@ public abstract class QKActivity extends ActionBarActivity { setSupportActionBar(mToolbar); } - ThemeManager.getInstance().loadThemeProperties(this); + ThemeManager.loadThemeProperties(this); } protected void showBackButton(boolean show) { @@ -173,7 +173,7 @@ public abstract class QKActivity extends ActionBarActivity { public boolean onPrepareOptionsMenu(Menu menu) { // Save a reference to the menu so that we can quickly access menu icons later. mMenu = menu; - colorMenuIcons(mMenu, ThemeManager.getInstance().getTextOnColorPrimary()); + colorMenuIcons(mMenu, ThemeManager.getTextOnColorPrimary()); return true; } diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKContentFragment.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKContentFragment.java index 9391c990..2e45c808 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKContentFragment.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKContentFragment.java @@ -102,7 +102,7 @@ public abstract class QKContentFragment extends QKFragment implements LiveView, public void refresh() { View view = getView(); if (view != null) { - view.setBackgroundColor(ThemeManager.getInstance().getBackgroundColor()); + view.setBackgroundColor(ThemeManager.getBackgroundColor()); } } } diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKFragment.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKFragment.java index 17d5d6d7..e071a742 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKFragment.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKFragment.java @@ -37,7 +37,7 @@ public class QKFragment extends Fragment implements LiveView { @Override public void refresh() { if (getView() != null) { - getView().setBackgroundColor(ThemeManager.getInstance().getBackgroundColor()); + getView().setBackgroundColor(ThemeManager.getBackgroundColor()); } } } diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKPopupActivity.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKPopupActivity.java index cd92d99d..68ba6544 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKPopupActivity.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/base/QKPopupActivity.java @@ -29,9 +29,9 @@ public abstract class QKPopupActivity extends QKActivity { setFinishOnTouchOutside(mPrefs.getBoolean(SettingsFragment.QUICKREPLY_TAP_DISMISS, true)); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); setContentView(getLayoutResource()); - ThemeManager.getInstance().loadThemeProperties(this); + ThemeManager.loadThemeProperties(this); - ((QKLinearLayout) findViewById(R.id.popup)).setBackgroundTint(ThemeManager.getInstance().getBackgroundColor()); + ((QKLinearLayout) findViewById(R.id.popup)).setBackgroundTint(ThemeManager.getBackgroundColor()); View title = findViewById(R.id.title); if (title != null && title instanceof AppCompatTextView) { diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/conversationlist/ConversationListAdapter.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/conversationlist/ConversationListAdapter.java index 1ba65cc9..a35bc960 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/conversationlist/ConversationListAdapter.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/conversationlist/ConversationListAdapter.java @@ -80,23 +80,23 @@ public class ConversationListAdapter extends RecyclerCursorAdapter { if (mAdapter.isInMultiSelectMode()) { mAdapter.disableMultiSelectMode(true); @@ -307,11 +307,11 @@ public class ConversationListFragment extends QKFragment implements LoaderManage return; } - mFab.setColorNormal(ThemeManager.getInstance().getColor()); - mFab.setColorPressed(ColorUtils.lighten(ThemeManager.getInstance().getColor())); - mFab.getDrawable().setColorFilter(ThemeManager.getInstance().getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP); + mFab.setColorNormal(ThemeManager.getColor()); + mFab.setColorPressed(ColorUtils.lighten(ThemeManager.getColor())); + mFab.getDrawable().setColorFilter(ThemeManager.getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP); - mEmptyStateIcon.setColorFilter(ThemeManager.getInstance().getTextOnBackgroundPrimary()); + mEmptyStateIcon.setColorFilter(ThemeManager.getTextOnBackgroundPrimary()); } @Override diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/conversationlist/ConversationListViewHolder.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/conversationlist/ConversationListViewHolder.java index dbcd63d0..ae2a9519 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/conversationlist/ConversationListViewHolder.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/conversationlist/ConversationListViewHolder.java @@ -110,7 +110,7 @@ public class ConversationListViewHolder extends ClickyViewHolder i buf.append(mContext.getResources().getString(R.string.draft_separator)); int before = buf.length(); buf.append(mContext.getResources().getString(R.string.has_draft)); - buf.setSpan(new ForegroundColorSpan(ThemeManager.getInstance().getColor()), before, buf.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE); + buf.setSpan(new ForegroundColorSpan(ThemeManager.getColor()), before, buf.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE); } return buf; diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/BubblePreferenceDialog.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/BubblePreferenceDialog.java index f60505cf..eea27319 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/BubblePreferenceDialog.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/BubblePreferenceDialog.java @@ -27,24 +27,24 @@ public class BubblePreferenceDialog extends QKDialog { View view = mContext.getLayoutInflater().inflate(R.layout.dialog_bubbles, null); final QKTextView in1 = (QKTextView) view.findViewById(R.id.in_1); - in1.setBackgroundResource(ThemeManager.getInstance().getReceivedBubbleRes()); - in1.getBackground().setColorFilter(ThemeManager.getInstance().getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); - in1.setOnColorBackground(ThemeManager.getInstance().getReceivedBubbleColor() == ThemeManager.getInstance().getColor()); + in1.setBackgroundResource(ThemeManager.getReceivedBubbleRes()); + in1.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); + in1.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor()); final QKTextView in2 = (QKTextView) view.findViewById(R.id.in_2); - in2.setBackgroundResource(ThemeManager.getInstance().getReceivedBubbleAltRes()); - in2.getBackground().setColorFilter(ThemeManager.getInstance().getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); - in2.setOnColorBackground(ThemeManager.getInstance().getReceivedBubbleColor() == ThemeManager.getInstance().getColor()); + in2.setBackgroundResource(ThemeManager.getReceivedBubbleAltRes()); + in2.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); + in2.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor()); final QKTextView out1 = (QKTextView) view.findViewById(R.id.out_1); - out1.setBackgroundResource(ThemeManager.getInstance().getSentBubbleRes()); - out1.getBackground().setColorFilter(ThemeManager.getInstance().getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); - out1.setOnColorBackground(ThemeManager.getInstance().getSentBubbleColor() == ThemeManager.getInstance().getColor()); + out1.setBackgroundResource(ThemeManager.getSentBubbleRes()); + out1.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); + out1.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor()); final QKTextView out2 = (QKTextView) view.findViewById(R.id.out_2); - out2.setBackgroundResource(ThemeManager.getInstance().getSentBubbleAltRes()); - out2.getBackground().setColorFilter(ThemeManager.getInstance().getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); - out2.setOnColorBackground(ThemeManager.getInstance().getSentBubbleColor() == ThemeManager.getInstance().getColor()); + out2.setBackgroundResource(ThemeManager.getSentBubbleAltRes()); + out2.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); + out2.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor()); Preference.OnPreferenceClickListener onPreferenceClickListener = new Preference.OnPreferenceClickListener() { @Override @@ -52,38 +52,38 @@ public class BubblePreferenceDialog extends QKDialog { Log.d(TAG, preference.getKey()); switch (preference.getKey()) { case SettingsFragment.BUBBLES_NEW: - ThemeManager.getInstance().setBubbleStyleNew(((QKSwitchPreference) preference).isChecked()); - in1.setBackgroundResource(ThemeManager.getInstance().getReceivedBubbleRes()); - in1.getBackground().setColorFilter(ThemeManager.getInstance().getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); - in1.setOnColorBackground(ThemeManager.getInstance().getReceivedBubbleColor() == ThemeManager.getInstance().getColor()); + ThemeManager.setBubbleStyleNew(((QKSwitchPreference) preference).isChecked()); + in1.setBackgroundResource(ThemeManager.getReceivedBubbleRes()); + in1.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); + in1.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor()); - in2.setBackgroundResource(ThemeManager.getInstance().getReceivedBubbleAltRes()); - in2.getBackground().setColorFilter(ThemeManager.getInstance().getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); - in2.setOnColorBackground(ThemeManager.getInstance().getReceivedBubbleColor() == ThemeManager.getInstance().getColor()); + in2.setBackgroundResource(ThemeManager.getReceivedBubbleAltRes()); + in2.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); + in2.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor()); - out1.setBackgroundResource(ThemeManager.getInstance().getSentBubbleRes()); - out1.getBackground().setColorFilter(ThemeManager.getInstance().getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); - out1.setOnColorBackground(ThemeManager.getInstance().getSentBubbleColor() == ThemeManager.getInstance().getColor()); + out1.setBackgroundResource(ThemeManager.getSentBubbleRes()); + out1.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); + out1.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor()); - out2.setBackgroundResource(ThemeManager.getInstance().getSentBubbleAltRes()); - out2.getBackground().setColorFilter(ThemeManager.getInstance().getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); - out2.setOnColorBackground(ThemeManager.getInstance().getSentBubbleColor() == ThemeManager.getInstance().getColor()); + out2.setBackgroundResource(ThemeManager.getSentBubbleAltRes()); + out2.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); + out2.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor()); return true; case SettingsFragment.COLOUR_RECEIVED: - ThemeManager.getInstance().setReceivedBubbleColored(((QKSwitchPreference) preference).isChecked()); - in1.getBackground().setColorFilter(ThemeManager.getInstance().getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); - in1.setOnColorBackground(ThemeManager.getInstance().getReceivedBubbleColor() == ThemeManager.getInstance().getColor()); - in2.getBackground().setColorFilter(ThemeManager.getInstance().getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); - in2.setOnColorBackground(ThemeManager.getInstance().getReceivedBubbleColor() == ThemeManager.getInstance().getColor()); + ThemeManager.setReceivedBubbleColored(((QKSwitchPreference) preference).isChecked()); + in1.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); + in1.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor()); + in2.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); + in2.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor()); return true; case SettingsFragment.COLOUR_SENT: - ThemeManager.getInstance().setSentBubbleColored(((QKSwitchPreference) preference).isChecked()); - out1.getBackground().setColorFilter(ThemeManager.getInstance().getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); - out1.setOnColorBackground(ThemeManager.getInstance().getSentBubbleColor() == ThemeManager.getInstance().getColor()); - out2.getBackground().setColorFilter(ThemeManager.getInstance().getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); - out2.setOnColorBackground(ThemeManager.getInstance().getSentBubbleColor() == ThemeManager.getInstance().getColor()); + ThemeManager.setSentBubbleColored(((QKSwitchPreference) preference).isChecked()); + out1.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); + out1.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor()); + out2.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); + out2.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor()); return true; } return false; diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/DefaultSmsHelper.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/DefaultSmsHelper.java index f6969807..0f92a9f3 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/DefaultSmsHelper.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/DefaultSmsHelper.java @@ -45,7 +45,7 @@ public class DefaultSmsHelper implements ActionClickListener { .type(getSnackBarType()) .text(mMessage) .duration(duration) - .actionColor(ThemeManager.getInstance().getColor()) + .actionColor(ThemeManager.getColor()) .actionLabel(R.string.upgrade_now) .actionListener(this); diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/QKDialog.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/QKDialog.java index c5fa15d7..69d85eed 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/QKDialog.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/QKDialog.java @@ -130,7 +130,7 @@ public class QKDialog extends DialogFragment { mPositiveButtonView = (QKTextView) view.findViewById(R.id.buttonPositive); mPositiveButtonView.setVisibility(View.VISIBLE); mPositiveButtonView.setText(mPositiveButtonText); - mPositiveButtonView.setTextColor(ThemeManager.getInstance().getColor()); + mPositiveButtonView.setTextColor(ThemeManager.getColor()); mPositiveButtonView.setOnClickListener(mPositiveButtonClickListener); } @@ -443,11 +443,11 @@ public class QKDialog extends DialogFragment { } QKTextView title = (QKTextView) convertView.findViewById(R.id.list_item_title); - title.setTextColor(ThemeManager.getInstance().getColor()); + title.setTextColor(ThemeManager.getColor()); title.setText(getItem(position).title); QKTextView subtitle = (QKTextView) convertView.findViewById(R.id.list_item_subtitle); - subtitle.setTextColor(ThemeManager.getInstance().getTextOnBackgroundPrimary()); + subtitle.setTextColor(ThemeManager.getTextOnBackgroundPrimary()); subtitle.setText(getItem(position).subtitle); ((QKTextView) convertView.findViewById(R.id.list_item_body)) diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/mms/MMSDialogFragment.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/mms/MMSDialogFragment.java index 399ed361..97d28454 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/mms/MMSDialogFragment.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/dialog/mms/MMSDialogFragment.java @@ -190,7 +190,7 @@ public class MMSDialogFragment extends DialogFragment { mPositiveButtonView = (QKTextView) view.findViewById(R.id.buttonPositive); mPositiveButtonView.setVisibility(View.VISIBLE); mPositiveButtonView.setText(mPositiveButtonText); - mPositiveButtonView.setTextColor(ThemeManager.getInstance().getColor()); + mPositiveButtonView.setTextColor(ThemeManager.getColor()); mPositiveButtonView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -465,11 +465,11 @@ public class MMSDialogFragment extends DialogFragment { } QKTextView title = (QKTextView) convertView.findViewById(R.id.list_item_title); - title.setTextColor(ThemeManager.getInstance().getColor()); + title.setTextColor(ThemeManager.getColor()); title.setText(getItem(position).title); QKTextView subtitle = (QKTextView) convertView.findViewById(R.id.list_item_subtitle); - subtitle.setTextColor(ThemeManager.getInstance().getTextOnBackgroundPrimary()); + subtitle.setTextColor(ThemeManager.getTextOnBackgroundPrimary()); subtitle.setText(getItem(position).subtitle); ((QKTextView) convertView.findViewById(R.id.list_item_body)) diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/messagelist/MessageListAdapter.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/messagelist/MessageListAdapter.java index 1e61b7e6..0a8bd56a 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/messagelist/MessageListAdapter.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/messagelist/MessageListAdapter.java @@ -136,10 +136,10 @@ public class MessageListAdapter extends RecyclerCursorAdapter { if (messageItem.isMe()) { - holder.mBodyTextView.getBackground().setColorFilter(ThemeManager.getInstance().getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); + holder.mBodyTextView.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); } else { - holder.mBodyTextView.getBackground().setColorFilter(ThemeManager.getInstance().getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); + holder.mBodyTextView.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); } }); holder.refresh(); diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/messagelist/MessageListFragment.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/messagelist/MessageListFragment.java index 02bf35bd..2bf8667a 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/messagelist/MessageListFragment.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/messagelist/MessageListFragment.java @@ -762,7 +762,7 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa mSensorManager.registerListener(this, mProxSensor, SensorManager.SENSOR_DELAY_NORMAL); } - ThemeManager.getInstance().setActiveColor(mConversationPrefs.getColor()); + ThemeManager.setActiveColor(mConversationPrefs.getColor()); } @Override @@ -787,14 +787,14 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa } } - ThemeManager.getInstance().setActiveColor(ThemeManager.getInstance().getThemeColor()); + ThemeManager.setActiveColor(ThemeManager.getThemeColor()); } @Override public void onMenuChanging(float percentOpen) { if (mConversationPrefs != null) { - ThemeManager.getInstance().setActiveColor((int) mArgbEvaluator.evaluate( - percentOpen, 0xFF000000 | mConversationPrefs.getColor(), 0xFF000000 | ThemeManager.getInstance().getThemeColor())); + ThemeManager.setActiveColor((int) mArgbEvaluator.evaluate( + percentOpen, 0xFF000000 | mConversationPrefs.getColor(), 0xFF000000 | ThemeManager.getThemeColor())); } } diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/settings/SettingsFragment.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/settings/SettingsFragment.java index 40aefef0..ea1fc0eb 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/settings/SettingsFragment.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/settings/SettingsFragment.java @@ -381,7 +381,7 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O String valueString = newValue == null ? "null" : newValue.toString(); if (key.equals(NOTIFICATION_LED_COLOR)) { // Format the color as a nice string if it's the LED color. - valueString = ThemeManager.getInstance().getColorString(Integer.parseInt(valueString)); + valueString = ThemeManager.getColorString(Integer.parseInt(valueString)); } Log.d(TAG, "onPreferenceChange key:" + key + " newValue: " + valueString); @@ -393,13 +393,13 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O switch (key) { case BACKGROUND: - ThemeManager.getInstance().setTheme(ThemeManager.Theme.fromString((String) newValue)); + ThemeManager.setTheme(ThemeManager.Theme.fromString((String) newValue)); break; case STATUS_TINT: - ThemeManager.getInstance().setStatusBarTintEnabled((Boolean) newValue); + ThemeManager.setStatusBarTintEnabled((Boolean) newValue); break; case NAVIGATION_TINT: - ThemeManager.getInstance().setNavigationBarTintEnabled((Boolean) newValue); + ThemeManager.setNavigationBarTintEnabled((Boolean) newValue); break; case FONT_FAMILY: preference.setSummary(mFontFamilies[Integer.parseInt("" + newValue)]); @@ -412,10 +412,10 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O preference.setSummary(mFontWeights[i == 2 ? 0 : 1]); break; case COLOUR_SENT: - ThemeManager.getInstance().setSentBubbleColored((Boolean) newValue); + ThemeManager.setSentBubbleColored((Boolean) newValue); break; case COLOUR_RECEIVED: - ThemeManager.getInstance().setReceivedBubbleColored((Boolean) newValue); + ThemeManager.setReceivedBubbleColored((Boolean) newValue); break; case NIGHT_AUTO: updateAlarmManager(mContext, (Boolean) newValue); @@ -519,13 +519,13 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O switch (key) { case THEME: - ThemeManager.getInstance().showColourSwatchesDialog(mContext); + ThemeManager.showColourSwatchesDialog(mContext); break; case BUBBLES: new BubblePreferenceDialog().setContext(mContext).show(); break; case ICON: - ThemeManager.getInstance().setIcon(mContext); + ThemeManager.setIcon(mContext); break; case BLOCKED_FUTURE: BlockedNumberDialog.showDialog(mContext); @@ -701,7 +701,7 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O View view = getView(); if (view != null) { - view.setBackgroundColor(ThemeManager.getInstance().getBackgroundColor()); + view.setBackgroundColor(ThemeManager.getBackgroundColor()); } } diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/AutoCompleteContactView.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/AutoCompleteContactView.java index 75f9e347..3ddb31a1 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/AutoCompleteContactView.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/AutoCompleteContactView.java @@ -61,8 +61,8 @@ public class AutoCompleteContactView extends RecipientEditTextView implements Li FontManager.getFontWeight(mContext, false))); setTextSize(TypedValue.COMPLEX_UNIT_SP, FontManager.getTextSize(mContext, FontManager.TEXT_TYPE_PRIMARY)); - setTextColor(ThemeManager.getInstance().getTextOnBackgroundPrimary()); - setHintTextColor(ThemeManager.getInstance().getTextOnBackgroundSecondary()); + setTextColor(ThemeManager.getTextOnBackgroundPrimary()); + setHintTextColor(ThemeManager.getTextOnBackgroundSecondary()); if (mAdapter != null) { SharedPreferences prefs = mContext.getPrefs(); diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/AvatarView.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/AvatarView.java index c3537b0e..7e5486bb 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/AvatarView.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/AvatarView.java @@ -261,7 +261,7 @@ public class AvatarView extends ImageView implements View.OnClickListener, LiveV getBackground().setColorFilter(0x00000000, PorterDuff.Mode.SRC_ATOP); } else { super.setImageDrawable(TextUtils.isEmpty(mInitial) ? mDefaultDrawable : null); - getBackground().setColorFilter(ThemeManager.getInstance().getColor(), PorterDuff.Mode.SRC_ATOP); + getBackground().setColorFilter(ThemeManager.getColor(), PorterDuff.Mode.SRC_ATOP); } } } @@ -279,13 +279,13 @@ public class AvatarView extends ImageView implements View.OnClickListener, LiveV @Override public void refresh() { - mPaint.setColor(ThemeManager.getInstance().getTextOnColorPrimary()); - mDefaultDrawable.setColorFilter(ThemeManager.getInstance().getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP); + mPaint.setColor(ThemeManager.getTextOnColorPrimary()); + mDefaultDrawable.setColorFilter(ThemeManager.getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP); if (getBackground() == null) { setBackgroundResource(R.drawable.circle); } - getBackground().setColorFilter(ThemeManager.getInstance().getColor(), PorterDuff.Mode.SRC_ATOP); + getBackground().setColorFilter(ThemeManager.getColor(), PorterDuff.Mode.SRC_ATOP); } private class QueryHandler extends AsyncQueryHandler { diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/ComposeView.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/ComposeView.java index 302800ed..2e1ee640 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/ComposeView.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/ComposeView.java @@ -951,24 +951,24 @@ public class ComposeView extends LinearLayout implements View.OnClickListener, L @Override public void refresh() { - mButtonBackground.setColorFilter(ThemeManager.getInstance().getColor(), PorterDuff.Mode.SRC_ATOP); - mButtonBar1.setColorFilter(ThemeManager.getInstance().getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP); - mButtonBar2.setColorFilter(ThemeManager.getInstance().getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP); - mAttachmentPanel.setBackgroundColor(ThemeManager.getInstance().getColor()); - mAttach.setColorFilter(ThemeManager.getInstance().getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP); - mCamera.setColorFilter(ThemeManager.getInstance().getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP); + mButtonBackground.setColorFilter(ThemeManager.getColor(), PorterDuff.Mode.SRC_ATOP); + mButtonBar1.setColorFilter(ThemeManager.getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP); + mButtonBar2.setColorFilter(ThemeManager.getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP); + mAttachmentPanel.setBackgroundColor(ThemeManager.getColor()); + mAttach.setColorFilter(ThemeManager.getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP); + mCamera.setColorFilter(ThemeManager.getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP); updateDelayButton(); - mProgress.setUnfinishedStrokeColor(ThemeManager.getInstance().getTextOnColorSecondary()); - mProgress.setFinishedStrokeColor(ThemeManager.getInstance().getTextOnColorPrimary()); - if (ThemeManager.getInstance().getSentBubbleRes() != 0) mReplyText.setBackgroundResource(ThemeManager.getInstance().getSentBubbleRes()); - mReplyText.getBackground().setColorFilter(ThemeManager.getInstance().getNeutralBubbleColor(), PorterDuff.Mode.SRC_ATOP); + mProgress.setUnfinishedStrokeColor(ThemeManager.getTextOnColorSecondary()); + mProgress.setFinishedStrokeColor(ThemeManager.getTextOnColorPrimary()); + if (ThemeManager.getSentBubbleRes() != 0) mReplyText.setBackgroundResource(ThemeManager.getSentBubbleRes()); + mReplyText.getBackground().setColorFilter(ThemeManager.getNeutralBubbleColor(), PorterDuff.Mode.SRC_ATOP); mReplyText.refresh(); - getBackground().setColorFilter(ThemeManager.getInstance().getBackgroundColor(), PorterDuff.Mode.SRC_ATOP); + getBackground().setColorFilter(ThemeManager.getBackgroundColor(), PorterDuff.Mode.SRC_ATOP); } private void updateDelayButton() { mDelay.setColorFilter(mDelayedMessagingEnabled ? - ThemeManager.getInstance().getTextOnColorPrimary() : ThemeManager.getInstance().getTextOnColorSecondary(), + ThemeManager.getTextOnColorPrimary() : ThemeManager.getTextOnColorSecondary(), PorterDuff.Mode.SRC_ATOP); } } diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKEditText.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKEditText.java index f5dfdb78..5b2ff0cc 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKEditText.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKEditText.java @@ -99,8 +99,8 @@ public class QKEditText extends android.widget.EditText implements LiveView { int fontWeight = FontManager.getFontWeight(mContext, false); setTypeface(TypefaceManager.obtainTypeface(mContext, fontFamily, fontWeight )); - setTextColor(ThemeManager.getInstance().getTextOnBackgroundPrimary()); - setHintTextColor(ThemeManager.getInstance().getTextOnBackgroundSecondary()); + setTextColor(ThemeManager.getTextOnBackgroundPrimary()); + setHintTextColor(ThemeManager.getTextOnBackgroundSecondary()); // Text size int sp = FontManager.getTextSize(mContext, FontManager.TEXT_TYPE_PRIMARY); diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKImageView.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKImageView.java index db4f0165..911b8d25 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKImageView.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKImageView.java @@ -44,7 +44,7 @@ public class QKImageView extends ImageView implements LiveView { mDrawable = drawable; if (mDrawable != null) { - mDrawable.setColorFilter(ThemeManager.getInstance().getColor(), PorterDuff.Mode.SRC_ATOP); + mDrawable.setColorFilter(ThemeManager.getColor(), PorterDuff.Mode.SRC_ATOP); super.setImageDrawable(drawable); } } diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKSwitch.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKSwitch.java index e6039ff8..134629b0 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKSwitch.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKSwitch.java @@ -50,16 +50,16 @@ public class QKSwitch extends SwitchCompat implements LiveView { // Disabled state states[0] = new int[]{-android.R.attr.state_enabled}; - colors[0] = mRes.getColor(ThemeManager.getInstance().isNightMode() ? + colors[0] = mRes.getColor(ThemeManager.isNightMode() ? R.color.switch_thumb_disabled_dark : R.color.switch_thumb_disabled_light); // Checked state states[1] = new int[]{android.R.attr.state_checked}; - colors[1] = ThemeManager.getInstance().getColor(); + colors[1] = ThemeManager.getColor(); // Unchecked enabled state state states[2] = new int[0]; - colors[2] = mRes.getColor(ThemeManager.getInstance().isNightMode() ? + colors[2] = mRes.getColor(ThemeManager.isNightMode() ? R.color.switch_thumb_enabled_dark : R.color.switch_thumb_enabled_light); return new ColorStateList(states, colors); @@ -71,19 +71,19 @@ public class QKSwitch extends SwitchCompat implements LiveView { // Disabled state states[0] = new int[]{-android.R.attr.state_enabled}; - colors[0] = mRes.getColor(ThemeManager.getInstance().isNightMode() ? + colors[0] = mRes.getColor(ThemeManager.isNightMode() ? R.color.switch_track_disabled_dark : R.color.switch_track_disabled_light); // Checked state states[1] = new int[]{android.R.attr.state_checked}; colors[1] = Color.argb(0x4D, // 30% alpha - Color.red(ThemeManager.getInstance().getColor()), - Color.green(ThemeManager.getInstance().getColor()), - Color.blue(ThemeManager.getInstance().getColor())); + Color.red(ThemeManager.getColor()), + Color.green(ThemeManager.getColor()), + Color.blue(ThemeManager.getColor())); // Unchecked enabled state state states[2] = new int[0]; - colors[2] = mRes.getColor(ThemeManager.getInstance().isNightMode() ? + colors[2] = mRes.getColor(ThemeManager.isNightMode() ? R.color.switch_track_enabled_dark : R.color.switch_track_enabled_light); return new ColorStateList(states, colors); diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKTextView.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKTextView.java index 1833f1ba..43956443 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKTextView.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKTextView.java @@ -106,19 +106,19 @@ public class QKTextView extends TextView implements LiveView { if (onColorBackground) { if (mType == FontManager.TEXT_TYPE_PRIMARY) { - setTextColor(ThemeManager.getInstance().getTextOnColorPrimary()); - setLinkTextColor(ThemeManager.getInstance().getTextOnColorPrimary()); + setTextColor(ThemeManager.getTextOnColorPrimary()); + setLinkTextColor(ThemeManager.getTextOnColorPrimary()); } else if (mType == FontManager.TEXT_TYPE_SECONDARY || mType == FontManager.TEXT_TYPE_TERTIARY) { - setTextColor(ThemeManager.getInstance().getTextOnColorSecondary()); + setTextColor(ThemeManager.getTextOnColorSecondary()); } } else { if (mType == FontManager.TEXT_TYPE_PRIMARY) { - setTextColor(ThemeManager.getInstance().getTextOnBackgroundPrimary()); - setLinkTextColor(ThemeManager.getInstance().getColor()); + setTextColor(ThemeManager.getTextOnBackgroundPrimary()); + setLinkTextColor(ThemeManager.getColor()); } else if (mType == FontManager.TEXT_TYPE_SECONDARY || mType == FontManager.TEXT_TYPE_TERTIARY) { - setTextColor(ThemeManager.getInstance().getTextOnBackgroundSecondary()); + setTextColor(ThemeManager.getTextOnBackgroundSecondary()); } } } diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/StarredContactsView.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/StarredContactsView.java index a6883c95..140653a9 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/StarredContactsView.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/StarredContactsView.java @@ -58,7 +58,7 @@ public class StarredContactsView extends LinearLayout implements LoaderManager.L super.onFinishInflate(); mFavoritesBackground = (LinearLayout) findViewById(R.id.starred_contacts); - mFavoritesBackground.setBackgroundColor(ThemeManager.getInstance().getBackgroundColor()); + mFavoritesBackground.setBackgroundColor(ThemeManager.getBackgroundColor()); mTitle = (QKTextView) findViewById(R.id.title); @@ -154,13 +154,13 @@ public class StarredContactsView extends LinearLayout implements LoaderManager.L } public void expand() { - mTitle.setTextColor(ThemeManager.getInstance().getTextOnBackgroundPrimary()); + mTitle.setTextColor(ThemeManager.getTextOnBackgroundPrimary()); mFavorites.setVisibility(View.VISIBLE); mIndicator.setRotation(0f); } public void collapse() { - mTitle.setTextColor(ThemeManager.getInstance().getTextOnBackgroundSecondary()); + mTitle.setTextColor(ThemeManager.getTextOnBackgroundSecondary()); mFavorites.setVisibility(View.GONE); mIndicator.setRotation(90f); } @@ -176,7 +176,7 @@ public class StarredContactsView extends LinearLayout implements LoaderManager.L @Override public void refresh() { - mIndicator.setColorFilter(ThemeManager.getInstance().getTextOnBackgroundSecondary(), PorterDuff.Mode.SRC_ATOP); - mFavoritesBackground.setBackgroundColor(ThemeManager.getInstance().getBackgroundColor()); + mIndicator.setColorFilter(ThemeManager.getTextOnBackgroundSecondary(), PorterDuff.Mode.SRC_ATOP); + mFavoritesBackground.setBackgroundColor(ThemeManager.getBackgroundColor()); } } diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/welcome/WelcomeActivity.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/welcome/WelcomeActivity.java index 67ebc5de..e0291733 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/welcome/WelcomeActivity.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/welcome/WelcomeActivity.java @@ -38,7 +38,7 @@ public class WelcomeActivity extends QKActivity implements ViewPager.OnPageChang getSupportActionBar().hide(); mBackground = findViewById(R.id.welcome); - mBackground.setBackgroundColor(ThemeManager.getInstance().getColor()); + mBackground.setBackgroundColor(ThemeManager.getColor()); mPrevious = (ImageView) findViewById(R.id.welcome_previous); mPrevious.setOnClickListener(this); @@ -63,8 +63,8 @@ public class WelcomeActivity extends QKActivity implements ViewPager.OnPageChang } public void setColor(int color) { - ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), ThemeManager.getInstance().getColor(), color); - colorAnimation.setDuration(ThemeManager.getInstance().TRANSITION_LENGTH); + ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), ThemeManager.getColor(), color); + colorAnimation.setDuration(ThemeManager.TRANSITION_LENGTH); colorAnimation.setInterpolator(new DecelerateInterpolator()); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override @@ -74,7 +74,7 @@ public class WelcomeActivity extends QKActivity implements ViewPager.OnPageChang }); colorAnimation.start(); - ThemeManager.getInstance().setColour(color); + ThemeManager.setColour(color); } public void setColorBackground(int color) { diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/welcome/WelcomeNightFragment.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/welcome/WelcomeNightFragment.java index 2ca8e214..870bf6cd 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/welcome/WelcomeNightFragment.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/welcome/WelcomeNightFragment.java @@ -43,8 +43,8 @@ public class WelcomeNightFragment extends BaseWelcomeFragment implements BaseWel @Override public void onScrollOffsetChanged(WelcomeActivity activity, float offset) { - int colorBackground = (Integer) mArgbEvaluator.evaluate(Math.abs(offset), ThemeManager.getInstance().getBackgroundColor(), ThemeManager.getInstance().getColor()); - int colorAccent = (Integer) mArgbEvaluator.evaluate(1 - Math.abs(offset), 0xFFFFFFFF, ThemeManager.getInstance().getColor()); + int colorBackground = (Integer) mArgbEvaluator.evaluate(Math.abs(offset), ThemeManager.getBackgroundColor(), ThemeManager.getColor()); + int colorAccent = (Integer) mArgbEvaluator.evaluate(1 - Math.abs(offset), 0xFFFFFFFF, ThemeManager.getColor()); activity.setColorBackground(colorBackground); activity.tintIndicators(colorAccent); @@ -66,14 +66,14 @@ public class WelcomeNightFragment extends BaseWelcomeFragment implements BaseWel @Override public void onClick(View v) { if (v.getId() == R.id.welcome_night_hint) { - boolean night = ThemeManager.getInstance().getTheme() == ThemeManager.Theme.OFFWHITE; + boolean night = ThemeManager.getTheme() == ThemeManager.Theme.OFFWHITE; int backgroundColor = mContext.getResources().getColor(night ? R.color.grey_light_mega_ultra : R.color.grey_material); int newBackgroundColor = mContext.getResources().getColor(night ? R.color.grey_material : R.color.grey_light_mega_ultra); - ThemeManager.getInstance().setTheme(night ? ThemeManager.Theme.GREY : ThemeManager.Theme.OFFWHITE); + ThemeManager.setTheme(night ? ThemeManager.Theme.GREY : ThemeManager.Theme.OFFWHITE); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), backgroundColor, newBackgroundColor); - colorAnimation.setDuration(ThemeManager.getInstance().TRANSITION_LENGTH); + colorAnimation.setDuration(ThemeManager.TRANSITION_LENGTH); colorAnimation.setInterpolator(new DecelerateInterpolator()); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/welcome/WelcomeThemeFragment.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/welcome/WelcomeThemeFragment.java index 2fed9738..8001682d 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/welcome/WelcomeThemeFragment.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/welcome/WelcomeThemeFragment.java @@ -21,7 +21,7 @@ public class WelcomeThemeFragment extends BaseWelcomeFragment implements ColorPi mPallette = (ColorPickerPalette) view.findViewById(R.id.welcome_themes); mPallette.init(19, 4, this); - mPallette.drawPalette(ThemeManager.getInstance().PALETTE, ThemeManager.getInstance().getColor()); + mPallette.drawPalette(ThemeManager.PALETTE, ThemeManager.getColor()); return view; } @@ -29,7 +29,7 @@ public class WelcomeThemeFragment extends BaseWelcomeFragment implements ColorPi @Override public void onColorSelected(int color) { ((WelcomeActivity) getActivity()).setColor(color); - mPallette.drawPalette(ThemeManager.getInstance().PALETTE, color); + mPallette.drawPalette(ThemeManager.PALETTE, color); } @Override diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/widget/WidgetProvider.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/widget/WidgetProvider.java index 28a7bda8..85b96b18 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/widget/WidgetProvider.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/widget/WidgetProvider.java @@ -45,7 +45,7 @@ public class WidgetProvider extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); - ThemeManager.getInstance().loadThemeProperties(context); + ThemeManager.loadThemeProperties(context); for (int appWidgetId : appWidgetIds) { updateWidget(context, appWidgetId, isSmallWidget(appWidgetManager, appWidgetId)); @@ -118,10 +118,10 @@ public class WidgetProvider extends AppWidgetProvider { remoteViews.setRemoteAdapter(R.id.conversation_list, intent); remoteViews.setTextViewText(R.id.widget_label, context.getString(R.string.title_conversation_list)); - remoteViews.setTextColor(R.id.widget_label, ThemeManager.getInstance().getTextOnColorPrimary()); + remoteViews.setTextColor(R.id.widget_label, ThemeManager.getTextOnColorPrimary()); - remoteViews.setInt(R.id.conversation_list_background, "setColorFilter", ThemeManager.getInstance().getBackgroundColor()); - remoteViews.setInt(R.id.header_background, "setColorFilter", ThemeManager.getInstance().getColor()); + remoteViews.setInt(R.id.conversation_list_background, "setColorFilter", ThemeManager.getBackgroundColor()); + remoteViews.setInt(R.id.header_background, "setColorFilter", ThemeManager.getColor()); // Open Mms's app conversation list when click on header final Intent convIntent = new Intent(context, MainActivity.class); diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/widget/WidgetService.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/widget/WidgetService.java index 8baf62ff..cbfdbe54 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/widget/WidgetService.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/widget/WidgetService.java @@ -224,9 +224,9 @@ public class WidgetService extends RemoteViewsService { } private void bindIndicators(RemoteViews remoteViews, Conversation conversation) { - remoteViews.setInt(R.id.muted, "setColorFilter", ThemeManager.getInstance().getColor()); - remoteViews.setInt(R.id.error, "setColorFilter", ThemeManager.getInstance().getColor()); - remoteViews.setInt(R.id.unread, "setColorFilter", ThemeManager.getInstance().getColor()); + remoteViews.setInt(R.id.muted, "setColorFilter", ThemeManager.getColor()); + remoteViews.setInt(R.id.error, "setColorFilter", ThemeManager.getColor()); + remoteViews.setInt(R.id.unread, "setColorFilter", ThemeManager.getColor()); remoteViews.setViewVisibility(R.id.muted, new ConversationPrefsHelper(mContext, conversation.getThreadId()) .getNotificationsEnabled() ? View.GONE : View.VISIBLE); remoteViews.setViewVisibility(R.id.error, conversation.hasError() ? View.VISIBLE : View.GONE); @@ -234,15 +234,15 @@ public class WidgetService extends RemoteViewsService { } private void bindName(RemoteViews remoteViews, Conversation conversation) { - SpannableStringBuilder from = addColor(conversation.getRecipients().formatNames(", "), ThemeManager.getInstance().getTextOnBackgroundPrimary()); + SpannableStringBuilder from = addColor(conversation.getRecipients().formatNames(", "), ThemeManager.getTextOnBackgroundPrimary()); if (conversation.hasDraft()) { from.append(mContext.getResources().getString(R.string.draft_separator)); int before = from.length(); from.append(mContext.getResources().getString(R.string.has_draft)); from.setSpan(new TextAppearanceSpan(mContext, android.R.style.TextAppearance_Small, - ThemeManager.getInstance().getTextOnBackgroundPrimary()), before, from.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE); - from.setSpan(new ForegroundColorSpan(ThemeManager.getInstance().getColor()), before, from.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE); + ThemeManager.getTextOnBackgroundPrimary()), before, from.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE); + from.setSpan(new ForegroundColorSpan(ThemeManager.getColor()), before, from.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE); } remoteViews.setTextViewText(R.id.name, from); @@ -250,12 +250,12 @@ public class WidgetService extends RemoteViewsService { private void bindDate(RemoteViews remoteViews, Conversation conversation) { remoteViews.setTextViewText(R.id.date, addColor(MessageUtils.formatTimeStampString(mContext, conversation.getDate()), - conversation.hasUnreadMessages() ? ThemeManager.getInstance().getColor() : ThemeManager.getInstance().getTextOnBackgroundSecondary())); + conversation.hasUnreadMessages() ? ThemeManager.getColor() : ThemeManager.getTextOnBackgroundSecondary())); } private void bindSnippet(RemoteViews remoteViews, Conversation conversation) { remoteViews.setTextViewText(R.id.snippet, addColor(conversation.getSnippet(), conversation.hasUnreadMessages() ? - ThemeManager.getInstance().getTextOnBackgroundPrimary() : ThemeManager.getInstance().getTextOnBackgroundSecondary())); + ThemeManager.getTextOnBackgroundPrimary() : ThemeManager.getTextOnBackgroundSecondary())); } /**