Fix color spelling

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