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
android:name=".QKSMSApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher_teal"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/AppThemeDark">
@@ -66,7 +66,8 @@
</activity>
<activity
android:name=".ui.MainActivity"
android:icon="@mipmap/ic_launcher_teal"
android:enabled="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:logo="@color/transparent"
android:screenOrientation="user"
@@ -110,9 +111,33 @@
android:windowSoftInputMode="adjustResize" />
<activity-alias
android:name=".ui.MainActivity-Teal"
android:name=".ui.MainActivity-Default"
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:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -124,7 +149,7 @@
<activity-alias
android:name=".ui.MainActivity-Red"
android:enabled="false"
android:icon="@mipmap/ic_launcher_red"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -136,7 +161,7 @@
<activity-alias
android:name=".ui.MainActivity-Pink"
android:enabled="false"
android:icon="@mipmap/ic_launcher_pink"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -148,7 +173,7 @@
<activity-alias
android:name=".ui.MainActivity-Purple"
android:enabled="false"
android:icon="@mipmap/ic_launcher_purple"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -160,7 +185,7 @@
<activity-alias
android:name=".ui.MainActivity-DeepPurple"
android:enabled="false"
android:icon="@mipmap/ic_launcher_deep_purple"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -172,7 +197,7 @@
<activity-alias
android:name=".ui.MainActivity-Indigo"
android:enabled="false"
android:icon="@mipmap/ic_launcher_indigo"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -184,7 +209,7 @@
<activity-alias
android:name=".ui.MainActivity-Blue"
android:enabled="false"
android:icon="@mipmap/ic_launcher_blue"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -196,7 +221,7 @@
<activity-alias
android:name=".ui.MainActivity-LightBlue"
android:enabled="false"
android:icon="@mipmap/ic_launcher_light_blue"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -208,7 +233,7 @@
<activity-alias
android:name=".ui.MainActivity-Cyan"
android:enabled="false"
android:icon="@mipmap/ic_launcher_cyan"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -220,7 +245,7 @@
<activity-alias
android:name=".ui.MainActivity-Green"
android:enabled="false"
android:icon="@mipmap/ic_launcher_green"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -232,7 +257,7 @@
<activity-alias
android:name=".ui.MainActivity-LightGreen"
android:enabled="false"
android:icon="@mipmap/ic_launcher_light_green"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -244,7 +269,7 @@
<activity-alias
android:name=".ui.MainActivity-Lime"
android:enabled="false"
android:icon="@mipmap/ic_launcher_lime"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -256,7 +281,7 @@
<activity-alias
android:name=".ui.MainActivity-Yellow"
android:enabled="false"
android:icon="@mipmap/ic_launcher_yellow"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -268,7 +293,7 @@
<activity-alias
android:name=".ui.MainActivity-Amber"
android:enabled="false"
android:icon="@mipmap/ic_launcher_amber"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -280,7 +305,7 @@
<activity-alias
android:name=".ui.MainActivity-Orange"
android:enabled="false"
android:icon="@mipmap/ic_launcher_orange"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -292,7 +317,7 @@
<activity-alias
android:name=".ui.MainActivity-DeepOrange"
android:enabled="false"
android:icon="@mipmap/ic_launcher_deep_orange"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -304,7 +329,7 @@
<activity-alias
android:name=".ui.MainActivity-Brown"
android:enabled="false"
android:icon="@mipmap/ic_launcher_brown"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -316,7 +341,7 @@
<activity-alias
android:name=".ui.MainActivity-Grey"
android:enabled="false"
android:icon="@mipmap/ic_launcher_grey"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -328,7 +353,7 @@
<activity-alias
android:name=".ui.MainActivity-BlueGrey"
android:enabled="false"
android:icon="@mipmap/ic_launcher_blue_grey"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity">
<intent-filter>
@@ -93,6 +93,7 @@ public class QKSMSAppBase extends MultiDexApplication {
registerActivityLifecycleCallbacks(new LifecycleHandler());
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);
Contact.init(this);
DraftCache.init(this);
@@ -95,7 +95,8 @@ public enum QKPreference {
CONVERSATION_THEME("conversation_theme"),
// Storage
COMPOSE_DRAFT("compose_draft", "");
COMPOSE_DRAFT("compose_draft", ""),
MIGRATED_ICON("migrated_icon", false);
private String mKey;
private Object mDefaultValue;
@@ -326,7 +326,7 @@ public class ThemeManager {
LiveViewManager.refreshViews(QKPreference.BACKGROUND);
}
public static void setIcon(final QKActivity context) {
public static void setIcon(final QKActivity context, boolean dark) {
new QKDialog()
.setContext(context)
.setTitle(R.string.update_icon_title)
@@ -335,50 +335,65 @@ public class ThemeManager {
.setPositiveButton(R.string.okay, v -> {
PackageManager packageManager = context.getPackageManager();
String[] colors = {
"Red", "Pink", "Purple", "DeepPurple", "Indigo", "Blue",
"LightBlue", "Cyan", "Teal", "Green", "LightGreen", "Lime",
"Yellow", "Amber", "Orange", "DeepOrange", "Brown", "Grey",
"BlueGrey"
};
String defaultComponent = "com.moez.QKSMS.ui.MainActivity-Default";
String darkComponent = "com.moez.QKSMS.ui.MainActivity-Dark";
// Disable all of the color aliases, except for the alias with the current
// color.
String enabledComponent = null;
for (int i = 0; i < colors.length; i++) {
String componentClassName = String.format(
"com.moez.QKSMS.ui.MainActivity-%s", colors[i]
);
// 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
);
}
}
packageManager.setComponentEnabledSetting(
new ComponentName(context, dark ? defaultComponent : darkComponent),
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:
// 1) enable the last component; and
// 2) relaunch QKSMS with the new component name.
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);
})
.setNegativeButton(R.string.cancel, null)
.setCancelOnTouchOutside(false)
.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
public static int getBackgroundColor() {
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 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 NAVIGATION_TINT = "pref_key_navigation_tint";
public static final String BACKGROUND = "pref_key_background";
@@ -410,6 +410,9 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
case BACKGROUND:
ThemeManager.setTheme(ThemeManager.Theme.fromString((String) newValue));
break;
case ICON:
ThemeManager.setIcon(mContext, (Boolean) newValue);
break;
case STATUS_TINT:
ThemeManager.setStatusBarTintEnabled(mContext, (Boolean) newValue);
break;
@@ -537,9 +540,6 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
case BUBBLES:
new BubblePreferenceDialog().setContext(mContext).show();
break;
case ICON:
ThemeManager.setIcon(mContext);
break;
case BLOCKED_FUTURE:
BlockedNumberDialog.showDialog(mContext);
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_summary_alt">Tap to change theme</string>
<string name="pref_icon">Update QKSMS icon color</string>
<string name="pref_icon_summary">Update the QKSMS icon to match your theme color</string>
<string name="pref_icon_dark">Use dark icon</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_navigation_tint">Tinted navigation bar</string>
<string name="pref_background">Background color</string>
@@ -583,7 +583,7 @@
<!-- Dialog title for updating app icon color -->
<string name="update_icon_title">Update icon color</string>
<!-- 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_last_message_date">Last message date</string>
+1 -1
View File
@@ -4,7 +4,7 @@
android:defaultValue="-16746133"
android:key="pref_key_theme" />
<Preference
android:key="pref_key_icon" />
android:key="pref_key_icon_dark" />
<Preference
android:defaultValue="@bool/hasL"
android:key="pref_key_status_tint" />
@@ -10,12 +10,13 @@
android:layout="@layout/list_item_preference"
android:summary="@string/pref_theme_summary_alt"
android:title="@string/pref_theme" />
<Preference
android:defaultValue="-16746133"
android:key="pref_key_icon"
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_key_icon_dark"
android:layout="@layout/list_item_preference"
android:summary="@string/pref_icon_summary"
android:title="@string/pref_icon" />
android:summary="@string/pref_icon_dark_summary"
android:title="@string/pref_icon_dark"
android:widgetLayout="@layout/view_switch" />
<ListPreference
android:defaultValue="light"
android:entries="@array/background_titles"