Updated app icon

This commit is contained in:
Moez Bhatti
2016-07-09 18:54:29 -10:00
parent c7dd045f79
commit 3c905c465e
29 changed files with 113 additions and 70 deletions
+47 -22
View File
@@ -39,7 +39,7 @@
<application <application
android:name=".QKSMSApp" android:name=".QKSMSApp"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher_teal" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:largeHeap="true" android:largeHeap="true"
android:theme="@style/AppThemeDark"> android:theme="@style/AppThemeDark">
@@ -66,7 +66,8 @@
</activity> </activity>
<activity <activity
android:name=".ui.MainActivity" android:name=".ui.MainActivity"
android:icon="@mipmap/ic_launcher_teal" android:enabled="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:logo="@color/transparent" android:logo="@color/transparent"
android:screenOrientation="user" android:screenOrientation="user"
@@ -110,9 +111,33 @@
android:windowSoftInputMode="adjustResize" /> android:windowSoftInputMode="adjustResize" />
<activity-alias <activity-alias
android:name=".ui.MainActivity-Teal" android:name=".ui.MainActivity-Default"
android:enabled="true" android:enabled="true"
android:icon="@mipmap/ic_launcher_teal" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".ui.MainActivity-Dark"
android:enabled="false"
android:icon="@mipmap/ic_launcher_dark"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".ui.MainActivity-Teal"
android:enabled="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -124,7 +149,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-Red" android:name=".ui.MainActivity-Red"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_red" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -136,7 +161,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-Pink" android:name=".ui.MainActivity-Pink"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_pink" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -148,7 +173,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-Purple" android:name=".ui.MainActivity-Purple"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_purple" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -160,7 +185,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-DeepPurple" android:name=".ui.MainActivity-DeepPurple"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_deep_purple" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -172,7 +197,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-Indigo" android:name=".ui.MainActivity-Indigo"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_indigo" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -184,7 +209,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-Blue" android:name=".ui.MainActivity-Blue"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_blue" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -196,7 +221,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-LightBlue" android:name=".ui.MainActivity-LightBlue"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_light_blue" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -208,7 +233,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-Cyan" android:name=".ui.MainActivity-Cyan"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_cyan" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -220,7 +245,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-Green" android:name=".ui.MainActivity-Green"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_green" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -232,7 +257,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-LightGreen" android:name=".ui.MainActivity-LightGreen"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_light_green" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -244,7 +269,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-Lime" android:name=".ui.MainActivity-Lime"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_lime" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -256,7 +281,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-Yellow" android:name=".ui.MainActivity-Yellow"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_yellow" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -268,7 +293,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-Amber" android:name=".ui.MainActivity-Amber"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_amber" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -280,7 +305,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-Orange" android:name=".ui.MainActivity-Orange"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_orange" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -292,7 +317,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-DeepOrange" android:name=".ui.MainActivity-DeepOrange"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_deep_orange" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -304,7 +329,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-Brown" android:name=".ui.MainActivity-Brown"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_brown" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -316,7 +341,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-Grey" android:name=".ui.MainActivity-Grey"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_grey" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -328,7 +353,7 @@
<activity-alias <activity-alias
android:name=".ui.MainActivity-BlueGrey" android:name=".ui.MainActivity-BlueGrey"
android:enabled="false" android:enabled="false"
android:icon="@mipmap/ic_launcher_blue_grey" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"> android:targetActivity=".ui.MainActivity">
<intent-filter> <intent-filter>
@@ -93,6 +93,7 @@ public class QKSMSAppBase extends MultiDexApplication {
registerActivityLifecycleCallbacks(new LifecycleHandler()); registerActivityLifecycleCallbacks(new LifecycleHandler());
ThemeManager.init(this); ThemeManager.init(this);
ThemeManager.migrateIcon(this); // TODO a few versions after 2.7, we can phase this out along with the old alias
MmsConfig.init(this); MmsConfig.init(this);
Contact.init(this); Contact.init(this);
DraftCache.init(this); DraftCache.init(this);
@@ -95,7 +95,8 @@ public enum QKPreference {
CONVERSATION_THEME("conversation_theme"), CONVERSATION_THEME("conversation_theme"),
// Storage // Storage
COMPOSE_DRAFT("compose_draft", ""); COMPOSE_DRAFT("compose_draft", ""),
MIGRATED_ICON("migrated_icon", false);
private String mKey; private String mKey;
private Object mDefaultValue; private Object mDefaultValue;
@@ -326,7 +326,7 @@ public class ThemeManager {
LiveViewManager.refreshViews(QKPreference.BACKGROUND); LiveViewManager.refreshViews(QKPreference.BACKGROUND);
} }
public static void setIcon(final QKActivity context) { public static void setIcon(final QKActivity context, boolean dark) {
new QKDialog() new QKDialog()
.setContext(context) .setContext(context)
.setTitle(R.string.update_icon_title) .setTitle(R.string.update_icon_title)
@@ -335,50 +335,65 @@ public class ThemeManager {
.setPositiveButton(R.string.okay, v -> { .setPositiveButton(R.string.okay, v -> {
PackageManager packageManager = context.getPackageManager(); PackageManager packageManager = context.getPackageManager();
String[] colors = { String defaultComponent = "com.moez.QKSMS.ui.MainActivity-Default";
"Red", "Pink", "Purple", "DeepPurple", "Indigo", "Blue", String darkComponent = "com.moez.QKSMS.ui.MainActivity-Dark";
"LightBlue", "Cyan", "Teal", "Green", "LightGreen", "Lime",
"Yellow", "Amber", "Orange", "DeepOrange", "Brown", "Grey",
"BlueGrey"
};
// Disable all of the color aliases, except for the alias with the current packageManager.setComponentEnabledSetting(
// color. new ComponentName(context, dark ? defaultComponent : darkComponent),
String enabledComponent = null; PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
for (int i = 0; i < colors.length; i++) { // Don't kill the app while we're in the loop! This will
String componentClassName = String.format( // prevent the other component enabled settings from
"com.moez.QKSMS.ui.MainActivity-%s", colors[i] // changing, i.e. they will all be disabled and the app
); // won't show up to the user.
PackageManager.DONT_KILL_APP
// Save the enabled component so we can kill the app with this one when );
// it's all done.
if (getSwatchColor(mColor) == PALETTE[i]) {
enabledComponent = componentClassName;
} else {
packageManager.setComponentEnabledSetting(
new ComponentName(context, componentClassName),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
// Don't kill the app while we're in the loop! This will
// prevent the other component enabled settings from
// changing, i.e. they will all be disabled and the app
// won't show up to the user.
PackageManager.DONT_KILL_APP
);
}
}
// Broadcast an intent to a receiver that will: // Broadcast an intent to a receiver that will:
// 1) enable the last component; and // 1) enable the last component; and
// 2) relaunch QKSMS with the new component name. // 2) relaunch QKSMS with the new component name.
Intent intent = new Intent(IconColorReceiver.ACTION_ICON_COLOR_CHANGED); Intent intent = new Intent(IconColorReceiver.ACTION_ICON_COLOR_CHANGED);
intent.putExtra(IconColorReceiver.EXTRA_COMPONENT_NAME, enabledComponent); intent.putExtra(IconColorReceiver.EXTRA_COMPONENT_NAME, dark ? darkComponent : defaultComponent);
context.sendBroadcast(intent); context.sendBroadcast(intent);
}) })
.setNegativeButton(R.string.cancel, null) .setCancelOnTouchOutside(false)
.show(); .show();
} }
public static void migrateIcon(Context context) {
PackageManager packageManager = context.getPackageManager();
// If we've already migrated to use the MainActivity-Default component, we don't need to do anything
if (mPrefs.getBoolean(QKPreference.MIGRATED_ICON.getKey(), (Boolean) QKPreference.MIGRATED_ICON.getDefaultValue())) {
return;
}
mPrefs.edit().putBoolean(QKPreference.MIGRATED_ICON.getKey(), true).apply();
String[] colors = {
"Red", "Pink", "Purple", "DeepPurple", "Indigo", "Blue",
"LightBlue", "Cyan", "Teal", "Green", "LightGreen", "Lime",
"Yellow", "Amber", "Orange", "DeepOrange", "Brown", "Grey",
"BlueGrey"
};
// Disable all of the old components
for (String color : colors) {
String componentClassName = String.format("com.moez.QKSMS.ui.MainActivity-%s", color);
packageManager.setComponentEnabledSetting(
new ComponentName(context, componentClassName),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP
);
}
// Enable the new component
ComponentName componentName = new ComponentName(context, "com.moez.QKSMS.ui.MainActivity-Default");
packageManager.setComponentEnabledSetting(componentName,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP
);
}
@ColorInt @ColorInt
public static int getBackgroundColor() { public static int getBackgroundColor() {
return mBackgroundColor; return mBackgroundColor;
@@ -80,7 +80,7 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
public static final String CATEGORY_APPEARANCE_SYSTEM_BARS = "pref_key_category_appearance_system_bars"; public static final String CATEGORY_APPEARANCE_SYSTEM_BARS = "pref_key_category_appearance_system_bars";
public static final String THEME = "pref_key_theme"; public static final String THEME = "pref_key_theme";
public static final String ICON = "pref_key_icon"; public static final String ICON = "pref_key_icon_dark";
public static final String STATUS_TINT = "pref_key_status_tint"; public static final String STATUS_TINT = "pref_key_status_tint";
public static final String NAVIGATION_TINT = "pref_key_navigation_tint"; public static final String NAVIGATION_TINT = "pref_key_navigation_tint";
public static final String BACKGROUND = "pref_key_background"; public static final String BACKGROUND = "pref_key_background";
@@ -410,6 +410,9 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
case BACKGROUND: case BACKGROUND:
ThemeManager.setTheme(ThemeManager.Theme.fromString((String) newValue)); ThemeManager.setTheme(ThemeManager.Theme.fromString((String) newValue));
break; break;
case ICON:
ThemeManager.setIcon(mContext, (Boolean) newValue);
break;
case STATUS_TINT: case STATUS_TINT:
ThemeManager.setStatusBarTintEnabled(mContext, (Boolean) newValue); ThemeManager.setStatusBarTintEnabled(mContext, (Boolean) newValue);
break; break;
@@ -537,9 +540,6 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
case BUBBLES: case BUBBLES:
new BubblePreferenceDialog().setContext(mContext).show(); new BubblePreferenceDialog().setContext(mContext).show();
break; break;
case ICON:
ThemeManager.setIcon(mContext);
break;
case BLOCKED_FUTURE: case BLOCKED_FUTURE:
BlockedNumberDialog.showDialog(mContext); BlockedNumberDialog.showDialog(mContext);
break; break;
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

+3 -3
View File
@@ -125,8 +125,8 @@
<string name="pref_theme">Theme color</string> <string name="pref_theme">Theme color</string>
<string name="pref_theme_summary_alt">Tap to change theme</string> <string name="pref_theme_summary_alt">Tap to change theme</string>
<string name="pref_icon">Update QKSMS icon color</string> <string name="pref_icon_dark">Use dark icon</string>
<string name="pref_icon_summary">Update the QKSMS icon to match your theme color</string> <string name="pref_icon_dark_summary">Use the dark version of the QKSMS icon on your homescreen, to better match your wallpaper</string>
<string name="pref_status_tint">Tinted status bar</string> <string name="pref_status_tint">Tinted status bar</string>
<string name="pref_navigation_tint">Tinted navigation bar</string> <string name="pref_navigation_tint">Tinted navigation bar</string>
<string name="pref_background">Background color</string> <string name="pref_background">Background color</string>
@@ -583,7 +583,7 @@
<!-- Dialog title for updating app icon color --> <!-- Dialog title for updating app icon color -->
<string name="update_icon_title">Update icon color</string> <string name="update_icon_title">Update icon color</string>
<!-- Dialog message for updating app icon color --> <!-- Dialog message for updating app icon color -->
<string name="update_icon_message">QKSMS must be restarted when changing the icon color. Restart now?</string> <string name="update_icon_message">QKSMS must be restarted when changing the icon color</string>
<string name="dialog_conversation_details_title">Conversation details</string> <string name="dialog_conversation_details_title">Conversation details</string>
<string name="dialog_conversation_details_last_message_date">Last message date</string> <string name="dialog_conversation_details_last_message_date">Last message date</string>
+1 -1
View File
@@ -4,7 +4,7 @@
android:defaultValue="-16746133" android:defaultValue="-16746133"
android:key="pref_key_theme" /> android:key="pref_key_theme" />
<Preference <Preference
android:key="pref_key_icon" /> android:key="pref_key_icon_dark" />
<Preference <Preference
android:defaultValue="@bool/hasL" android:defaultValue="@bool/hasL"
android:key="pref_key_status_tint" /> android:key="pref_key_status_tint" />
@@ -10,12 +10,13 @@
android:layout="@layout/list_item_preference" android:layout="@layout/list_item_preference"
android:summary="@string/pref_theme_summary_alt" android:summary="@string/pref_theme_summary_alt"
android:title="@string/pref_theme" /> android:title="@string/pref_theme" />
<Preference <CheckBoxPreference
android:defaultValue="-16746133" android:defaultValue="false"
android:key="pref_key_icon" android:key="pref_key_icon_dark"
android:layout="@layout/list_item_preference" android:layout="@layout/list_item_preference"
android:summary="@string/pref_icon_summary" android:summary="@string/pref_icon_dark_summary"
android:title="@string/pref_icon" /> android:title="@string/pref_icon_dark"
android:widgetLayout="@layout/view_switch" />
<ListPreference <ListPreference
android:defaultValue="light" android:defaultValue="light"
android:entries="@array/background_titles" android:entries="@array/background_titles"