mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Static usages of ThemeManager
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -80,23 +80,23 @@ public class ConversationListAdapter extends RecyclerCursorAdapter<ConversationL
|
||||
|
||||
if (conversation.hasUnreadMessages()) {
|
||||
holder.unreadView.setVisibility(View.VISIBLE);
|
||||
holder.snippetView.setTextColor(ThemeManager.getInstance().getTextOnBackgroundPrimary());
|
||||
holder.dateView.setTextColor(ThemeManager.getInstance().getColor());
|
||||
holder.snippetView.setTextColor(ThemeManager.getTextOnBackgroundPrimary());
|
||||
holder.dateView.setTextColor(ThemeManager.getColor());
|
||||
} else {
|
||||
holder.unreadView.setVisibility(View.GONE);
|
||||
holder.snippetView.setTextColor(ThemeManager.getInstance().getTextOnBackgroundSecondary());
|
||||
holder.dateView.setTextColor(ThemeManager.getInstance().getTextOnBackgroundSecondary());
|
||||
holder.snippetView.setTextColor(ThemeManager.getTextOnBackgroundSecondary());
|
||||
holder.dateView.setTextColor(ThemeManager.getTextOnBackgroundSecondary());
|
||||
}
|
||||
|
||||
if (isInMultiSelectMode()) {
|
||||
holder.mSelected.setVisibility(View.VISIBLE);
|
||||
if (isSelected(conversation.getThreadId())) {
|
||||
holder.mSelected.setImageResource(R.drawable.ic_selected);
|
||||
holder.mSelected.setColorFilter(ThemeManager.getInstance().getColor());
|
||||
holder.mSelected.setColorFilter(ThemeManager.getColor());
|
||||
holder.mSelected.setAlpha(1f);
|
||||
} else {
|
||||
holder.mSelected.setImageResource(R.drawable.ic_unselected);
|
||||
holder.mSelected.setColorFilter(ThemeManager.getInstance().getTextOnBackgroundSecondary());
|
||||
holder.mSelected.setColorFilter(ThemeManager.getTextOnBackgroundSecondary());
|
||||
holder.mSelected.setAlpha(0.5f);
|
||||
}
|
||||
} else {
|
||||
@@ -127,9 +127,9 @@ public class ConversationListAdapter extends RecyclerCursorAdapter<ConversationL
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
mMuted.setColorFilter(ThemeManager.getInstance().getColor(), PorterDuff.Mode.SRC_ATOP);
|
||||
mUnread.setColorFilter(ThemeManager.getInstance().getColor(), PorterDuff.Mode.SRC_ATOP);
|
||||
mError.setColorFilter(ThemeManager.getInstance().getColor(), PorterDuff.Mode.SRC_ATOP);
|
||||
mMuted.setColorFilter(ThemeManager.getColor(), PorterDuff.Mode.SRC_ATOP);
|
||||
mUnread.setColorFilter(ThemeManager.getColor(), PorterDuff.Mode.SRC_ATOP);
|
||||
mError.setColorFilter(ThemeManager.getColor(), PorterDuff.Mode.SRC_ATOP);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -88,16 +88,16 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
||||
View view = inflater.inflate(R.layout.fragment_conversations, null);
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
mEmptyStateIcon.setColorFilter(ThemeManager.getInstance().getTextOnBackgroundPrimary());
|
||||
mEmptyStateIcon.setColorFilter(ThemeManager.getTextOnBackgroundPrimary());
|
||||
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
mFab.setColorNormal(ThemeManager.getInstance().getColor());
|
||||
mFab.setColorPressed(ColorUtils.lighten(ThemeManager.getInstance().getColor()));
|
||||
mFab.setColorNormal(ThemeManager.getColor());
|
||||
mFab.setColorPressed(ColorUtils.lighten(ThemeManager.getColor()));
|
||||
mFab.attachToRecyclerView(mRecyclerView);
|
||||
mFab.setColorFilter(ThemeManager.getInstance().getTextOnColorPrimary());
|
||||
mFab.setColorFilter(ThemeManager.getTextOnColorPrimary());
|
||||
mFab.setOnClickListener(v -> {
|
||||
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
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ public class ConversationListViewHolder extends ClickyViewHolder<Conversation> 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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -136,10 +136,10 @@ public class MessageListAdapter extends RecyclerCursorAdapter<MessageListViewHol
|
||||
|
||||
if (sent) {
|
||||
// set up colors
|
||||
holder.mBodyTextView.setOnColorBackground(ThemeManager.getInstance().getSentBubbleColor() != ThemeManager.getInstance().getNeutralBubbleColor());
|
||||
holder.mBodyTextView.setOnColorBackground(ThemeManager.getSentBubbleColor() != ThemeManager.getNeutralBubbleColor());
|
||||
holder.mDateView.setOnColorBackground(false);
|
||||
holder.mDeliveredIndicator.setColorFilter(ThemeManager.getInstance().getTextOnBackgroundSecondary(), PorterDuff.Mode.SRC_ATOP);
|
||||
holder.mLockedIndicator.setColorFilter(ThemeManager.getInstance().getTextOnBackgroundSecondary(), PorterDuff.Mode.SRC_ATOP);
|
||||
holder.mDeliveredIndicator.setColorFilter(ThemeManager.getTextOnBackgroundSecondary(), PorterDuff.Mode.SRC_ATOP);
|
||||
holder.mLockedIndicator.setColorFilter(ThemeManager.getTextOnBackgroundSecondary(), PorterDuff.Mode.SRC_ATOP);
|
||||
|
||||
// set up avatar
|
||||
holder.mAvatarView.setImageDrawable(Contact.getMe(true).getAvatar(mContext, null));
|
||||
@@ -151,10 +151,10 @@ public class MessageListAdapter extends RecyclerCursorAdapter<MessageListViewHol
|
||||
}
|
||||
} else {
|
||||
// set up colors
|
||||
holder.mBodyTextView.setOnColorBackground(ThemeManager.getInstance().getReceivedBubbleColor() != ThemeManager.getInstance().getNeutralBubbleColor());
|
||||
holder.mBodyTextView.setOnColorBackground(ThemeManager.getReceivedBubbleColor() != ThemeManager.getNeutralBubbleColor());
|
||||
holder.mDateView.setOnColorBackground(false);
|
||||
holder.mDeliveredIndicator.setColorFilter(ThemeManager.getInstance().getTextOnBackgroundSecondary(), PorterDuff.Mode.SRC_ATOP);
|
||||
holder.mLockedIndicator.setColorFilter(ThemeManager.getInstance().getTextOnBackgroundSecondary(), PorterDuff.Mode.SRC_ATOP);
|
||||
holder.mDeliveredIndicator.setColorFilter(ThemeManager.getTextOnBackgroundSecondary(), PorterDuff.Mode.SRC_ATOP);
|
||||
holder.mLockedIndicator.setColorFilter(ThemeManager.getTextOnBackgroundSecondary(), PorterDuff.Mode.SRC_ATOP);
|
||||
|
||||
// set up avatar
|
||||
if (mPrefs.getBoolean(SettingsFragment.HIDE_AVATAR_RECEIVED, false)) {
|
||||
@@ -308,15 +308,15 @@ public class MessageListAdapter extends RecyclerCursorAdapter<MessageListViewHol
|
||||
|
||||
holder.mDateView.setVisibility(showTimestamp ? View.VISIBLE : View.GONE);
|
||||
holder.mSpace.setVisibility(showAvatar ? View.VISIBLE : View.GONE);
|
||||
holder.mBodyTextView.setBackgroundResource(showAvatar ? (messageItem.isMe() ? ThemeManager.getInstance().getSentBubbleRes() :
|
||||
ThemeManager.getInstance().getReceivedBubbleRes()) : (messageItem.isMe() ?
|
||||
ThemeManager.getInstance().getSentBubbleAltRes() : ThemeManager.getInstance().getReceivedBubbleAltRes()));
|
||||
holder.mBodyTextView.setBackgroundResource(showAvatar ? (messageItem.isMe() ? ThemeManager.getSentBubbleRes() :
|
||||
ThemeManager.getReceivedBubbleRes()) : (messageItem.isMe() ?
|
||||
ThemeManager.getSentBubbleAltRes() : ThemeManager.getReceivedBubbleAltRes()));
|
||||
|
||||
holder.setLiveViewCallback(() -> {
|
||||
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();
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user