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 ee788e2b..2098a4b1 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/transaction/NotificationManager.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/transaction/NotificationManager.java @@ -184,7 +184,7 @@ public class NotificationManager { } if (conversationPrefs.getNotificationLedEnabled()) { - builder.setLights(getLedColour(conversationPrefs), 1000, 1000); + builder.setLights(getLedColor(conversationPrefs), 1000, 1000); } Integer privateNotifications = conversationPrefs.getPrivateNotificationsSetting(); @@ -275,7 +275,7 @@ public class NotificationManager { .setAutoCancel(true); if (conversationPrefs.getNotificationLedEnabled()) { - builder.setLights(getLedColour(conversationPrefs), 1000, 1000); + builder.setLights(getLedColor(conversationPrefs), 1000, 1000); } Integer privateNotifications = conversationPrefs.getPrivateNotificationsSetting(); @@ -359,7 +359,7 @@ public class NotificationManager { } if (sPrefs.getBoolean(SettingsFragment.NOTIFICATION_LED, true)) { - builder.setLights(getLedColour(new ConversationPrefsHelper(context, 0)), 1000, 1000); + builder.setLights(getLedColor(new ConversationPrefsHelper(context, 0)), 1000, 1000); } if (sPrefs.getBoolean(SettingsFragment.NOTIFICATION_TICKER, false)) { @@ -692,18 +692,18 @@ public class NotificationManager { } } - private static int getLedColour(ConversationPrefsHelper conversationPrefs) { - int colour = Integer.parseInt(conversationPrefs.getNotificationLedColor()); + private static int getLedColor(ConversationPrefsHelper conversationPrefs) { + int color = Integer.parseInt(conversationPrefs.getNotificationLedColor()); - if (colour == sRes.getColor(R.color.blue_light) || colour == sRes.getColor(R.color.blue_dark)) + if (color == sRes.getColor(R.color.blue_light) || color == sRes.getColor(R.color.blue_dark)) return sRes.getColor(R.color.blue_dark); - if (colour == sRes.getColor(R.color.purple_light) || colour == sRes.getColor(R.color.purple_dark)) + if (color == sRes.getColor(R.color.purple_light) || color == sRes.getColor(R.color.purple_dark)) return sRes.getColor(R.color.purple_dark); - if (colour == sRes.getColor(R.color.green_light) || colour == sRes.getColor(R.color.green_dark)) + if (color == sRes.getColor(R.color.green_light) || color == sRes.getColor(R.color.green_dark)) return sRes.getColor(R.color.green_dark); - if (colour == sRes.getColor(R.color.yellow_light) || colour == sRes.getColor(R.color.yellow_dark)) + if (color == sRes.getColor(R.color.yellow_light) || color == sRes.getColor(R.color.yellow_dark)) return sRes.getColor(R.color.yellow_dark); - if (colour == sRes.getColor(R.color.red_light) || colour == sRes.getColor(R.color.red_dark)) + if (color == sRes.getColor(R.color.red_light) || color == sRes.getColor(R.color.red_dark)) return sRes.getColor(R.color.red_dark); return sRes.getColor(R.color.white_pure); 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 c1a0ea08..2a39bd9d 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/ThemeManager.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/ThemeManager.java @@ -67,8 +67,8 @@ public class ThemeManager { } } - // Colours copied from http://www.google.com/design/spec/style/color.html#color-ui-color-palette - private static final int[][] COLOURS = {{ + // Colors copied from http://www.google.com/design/spec/style/color.html#color-ui-color-palette + private static final int[][] COLORS = {{ // Red 0xfffde0dc, 0xfff9bdbb, 0xfff69988, 0xfff36c60, 0xffe84e40, 0xffe51c23, 0xffdd191d, 0xffd01716, @@ -151,25 +151,25 @@ public class ThemeManager { * These are the colors that go in the initial palette. */ public static final int[] PALETTE = { - COLOURS[0][5], // Red - COLOURS[1][5], // Pink - COLOURS[2][5], // Purple - COLOURS[3][5], // Deep purple - COLOURS[4][5], // Indigo - COLOURS[5][5], // Blue - COLOURS[6][5], // Light Blue - COLOURS[7][5], // Cyan - COLOURS[8][5], // Teal - COLOURS[9][5], // Green - COLOURS[10][5], // Light Green - COLOURS[11][5], // Lime - COLOURS[12][5], // Yellow - COLOURS[13][5], // Amber - COLOURS[14][5], // Orange - COLOURS[15][5], // Deep Orange - COLOURS[16][5], // Brown - COLOURS[17][5], // Grey - COLOURS[18][5] // Blue Grey + COLORS[0][5], // Red + COLORS[1][5], // Pink + COLORS[2][5], // Purple + COLORS[3][5], // Deep purple + COLORS[4][5], // Indigo + COLORS[5][5], // Blue + COLORS[6][5], // Light Blue + COLORS[7][5], // Cyan + COLORS[8][5], // Teal + COLORS[9][5], // Green + COLORS[10][5], // Light Green + COLORS[11][5], // Lime + COLORS[12][5], // Yellow + COLORS[13][5], // Amber + COLORS[14][5], // Orange + COLORS[15][5], // Deep Orange + COLORS[16][5], // Brown + COLORS[17][5], // Grey + COLORS[18][5] // Blue Grey }; /** @@ -367,8 +367,8 @@ public class ThemeManager { mTextOnColorSecondary = mResources.getColor(isColorDarkEnough(mColor) ? R.color.theme_dark_text_secondary : R.color.theme_light_text_secondary); - setSentBubbleColored(mPrefs.getBoolean(SettingsFragment.COLOUR_SENT, true)); - setReceivedBubbleColored(mPrefs.getBoolean(SettingsFragment.COLOUR_RECEIVED, false)); + setSentBubbleColored(mPrefs.getBoolean(SettingsFragment.COLOR_SENT, true)); + setReceivedBubbleColored(mPrefs.getBoolean(SettingsFragment.COLOR_RECEIVED, false)); setBubbleStyleNew(mPrefs.getBoolean(SettingsFragment.BUBBLES_NEW, true)); LiveViewManager.refreshViews(QKPreference.BACKGROUND); @@ -400,7 +400,7 @@ public class ThemeManager { // Save the enabled component so we can kill the app with this one when // it's all done. - if (getSwatchColour(mColor) == PALETTE[i]) { + if (getSwatchColor(mColor) == PALETTE[i]) { enabledComponent = componentClassName; } else { @@ -533,14 +533,14 @@ public class ThemeManager { palette.setGravity(Gravity.CENTER); palette.init(19, 4, color -> { palette.init(getSwatch(color).length, 4, color2 -> { - setColour(context, color2); + setColor(context, color2); dialog.dismiss(); }); palette.drawPalette(getSwatch(color), mColor); }); - palette.drawPalette(PALETTE, getSwatchColour(mColor)); + palette.drawPalette(PALETTE, getSwatchColor(mColor)); dialog.setContext(context) .setTitle(R.string.pref_theme) @@ -586,7 +586,7 @@ public class ThemeManager { return String.format("#%08x", color).toUpperCase(); } - public static void setColour(QKActivity activity, int color) { + public static void setColor(QKActivity activity, int color) { AnalyticsManager.getInstance().sendEvent( AnalyticsManager.CATEGORY_PREFERENCE_CHANGE, @@ -594,20 +594,20 @@ public class ThemeManager { getColorString(color) ); - int colourFrom = mColor; + int colorFrom = mColor; mColor = color; mActiveColor = color; mPrefs.edit().putString(SettingsFragment.THEME, "" + color).apply(); - setSentBubbleColored(mPrefs.getBoolean(SettingsFragment.COLOUR_SENT, true)); - setReceivedBubbleColored(mPrefs.getBoolean(SettingsFragment.COLOUR_RECEIVED, false)); + setSentBubbleColored(mPrefs.getBoolean(SettingsFragment.COLOR_SENT, true)); + setReceivedBubbleColored(mPrefs.getBoolean(SettingsFragment.COLOR_RECEIVED, false)); mTextOnColorPrimary = mResources.getColor(isColorDarkEnough(mColor) ? R.color.theme_dark_text_primary : R.color.theme_light_text_primary); mTextOnColorSecondary = mResources.getColor(isColorDarkEnough(mColor) ? R.color.theme_dark_text_secondary : R.color.theme_light_text_secondary); - ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colourFrom, color); + ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, color); colorAnimation.setDuration(TRANSITION_LENGTH); colorAnimation.setInterpolator(new DecelerateInterpolator()); colorAnimation.addUpdateListener(animation -> { @@ -664,9 +664,9 @@ public class ThemeManager { } 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]) { + for (int i = 0; i < COLORS.length; i++) { + for (int j = 0; j < COLORS[i].length; j++) { + if (color == COLORS[i][j]) { return TEXT_MODE[i][j] == 1; } } @@ -675,22 +675,22 @@ public class ThemeManager { return true; } - 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]) { + public static int getSwatchColor(int color) { + for (int i = 0; i < COLORS.length; i++) { + for (int j = 0; j < COLORS[i].length; j++) { + if (color == COLORS[i][j]) { return PALETTE[i]; } } } - return colour; + return color; } - private static int[] getSwatch(int colour) { - for (int[] swatch : COLOURS) { + private static int[] getSwatch(int color) { + for (int[] swatch : COLORS) { for (int swatchColor : swatch) { - if (colour == swatchColor) { + if (color == swatchColor) { return swatch; } } 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 eea27319..5399f562 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 @@ -70,7 +70,7 @@ public class BubblePreferenceDialog extends QKDialog { out2.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor()); return true; - case SettingsFragment.COLOUR_RECEIVED: + case SettingsFragment.COLOR_RECEIVED: ThemeManager.setReceivedBubbleColored(((QKSwitchPreference) preference).isChecked()); in1.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP); in1.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor()); @@ -78,7 +78,7 @@ public class BubblePreferenceDialog extends QKDialog { in2.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor()); return true; - case SettingsFragment.COLOUR_SENT: + case SettingsFragment.COLOR_SENT: ThemeManager.setSentBubbleColored(((QKSwitchPreference) preference).isChecked()); out1.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP); out1.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor()); @@ -93,9 +93,9 @@ public class BubblePreferenceDialog extends QKDialog { LinearLayout prefsLayout = (LinearLayout) view.findViewById(R.id.prefs); prefsLayout.addView(new QKSwitchPreference(mContext, onPreferenceClickListener, SettingsFragment.BUBBLES_NEW, prefs, true, R.string.pref_bubble_style_new, 0).getView()); - prefsLayout.addView(new QKSwitchPreference(mContext, onPreferenceClickListener, SettingsFragment.COLOUR_RECEIVED, + prefsLayout.addView(new QKSwitchPreference(mContext, onPreferenceClickListener, SettingsFragment.COLOR_RECEIVED, prefs, false, R.string.pref_color_received, 0).getView()); - prefsLayout.addView(new QKSwitchPreference(mContext, onPreferenceClickListener, SettingsFragment.COLOUR_SENT, + prefsLayout.addView(new QKSwitchPreference(mContext, onPreferenceClickListener, SettingsFragment.COLOR_SENT, prefs, true, R.string.pref_color_sent, 0).getView()); setTitle(R.string.pref_bubbles); 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 aff9d45c..8563586a 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 @@ -88,8 +88,8 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O public static final String BACKGROUND = "pref_key_background"; public static final String BUBBLES = "pref_key_bubbles"; public static final String BUBBLES_NEW = "pref_key_new_bubbles"; - public static final String COLOUR_SENT = "pref_key_colour_sent"; - public static final String COLOUR_RECEIVED = "pref_key_colour_received"; + public static final String COLOR_SENT = "pref_key_colour_sent"; + public static final String COLOR_RECEIVED = "pref_key_colour_received"; public static final String HIDE_AVATAR_CONVERSATIONS = "pref_key_hide_avatar_conversations"; public static final String HIDE_AVATAR_SENT = "pref_key_hide_avatar_sent"; public static final String HIDE_AVATAR_RECEIVED = "pref_key_hide_avatar_received"; @@ -416,10 +416,10 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O int i = Integer.parseInt("" + newValue); preference.setSummary(mFontWeights[i == 2 ? 0 : 1]); break; - case COLOUR_SENT: + case COLOR_SENT: ThemeManager.setSentBubbleColored((Boolean) newValue); break; - case COLOUR_RECEIVED: + case COLOR_RECEIVED: ThemeManager.setReceivedBubbleColored((Boolean) newValue); break; case NIGHT_AUTO: 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 be12acb5..5241e117 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 @@ -74,7 +74,7 @@ public class WelcomeActivity extends QKActivity implements ViewPager.OnPageChang }); colorAnimation.start(); - ThemeManager.setColour(this, color); + ThemeManager.setColor(this, color); } public void setColorBackground(int color) { diff --git a/QKSMS/src/main/res/values/colours.xml b/QKSMS/src/main/res/values/colors.xml similarity index 100% rename from QKSMS/src/main/res/values/colours.xml rename to QKSMS/src/main/res/values/colors.xml