summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2015-09-25 13:33:33 -0700
committerAbhisek Devkota <ciwrl@cyanogenmod.com>2015-09-25 22:34:09 -0700
commite5859166f3452f296b33bb66ff95f8fdce1053d0 (patch)
tree120a2a02c9c3b27a1f3531100e00f399afbf5418
parentf741c43181075438f0d96eebcdb305747fa63aac (diff)
downloadandroid_packages_providers_ThemesProvider-e5859166f3452f296b33bb66ff95f8fdce1053d0.tar.gz
android_packages_providers_ThemesProvider-e5859166f3452f296b33bb66ff95f8fdce1053d0.tar.bz2
android_packages_providers_ThemesProvider-e5859166f3452f296b33bb66ff95f8fdce1053d0.zip
Use DialerNext icon when available
DialerNext is switching to com.cyngn.dialer instead of com.android.dialer so we need to choose the correct component when generating icon previews. Change-Id: I2f2b5f5823f754e1f3f3c2f0c085c5611f68e8b0 TICKET: CYNGNOS-1096 (cherry picked from commit 0559bec52ce3f120b636ab62c42e8bb8e0f761e1)
-rw-r--r--res/layout/controls_preview.xml2
-rw-r--r--src/org/cyanogenmod/themes/provider/util/IconPreviewGenerator.java13
2 files changed, 14 insertions, 1 deletions
diff --git a/res/layout/controls_preview.xml b/res/layout/controls_preview.xml
index b15ef43..04ab237 100644
--- a/res/layout/controls_preview.xml
+++ b/res/layout/controls_preview.xml
@@ -46,7 +46,7 @@
android:layout_width="96dp"
android:layout_height="30dp"
android:layout_marginEnd="72dp"
- android:textSize="12sp"
+ android:textSize="10dp"
android:text="@string/controls_preview_button_text" />
<Switch
diff --git a/src/org/cyanogenmod/themes/provider/util/IconPreviewGenerator.java b/src/org/cyanogenmod/themes/provider/util/IconPreviewGenerator.java
index b1857d8..abac13a 100644
--- a/src/org/cyanogenmod/themes/provider/util/IconPreviewGenerator.java
+++ b/src/org/cyanogenmod/themes/provider/util/IconPreviewGenerator.java
@@ -24,6 +24,8 @@ import android.graphics.drawable.BitmapDrawable;
public class IconPreviewGenerator {
private static final ComponentName COMPONENT_DIALER =
new ComponentName("com.android.dialer", "com.android.dialer.DialtactsActivity");
+ private static final ComponentName COMPONENT_DIALERNEXT =
+ new ComponentName("com.cyngn.dialer", "com.cyngn.dialer.DialtactsActivity");
private static final ComponentName COMPONENT_MESSAGING =
new ComponentName("com.android.mms", "com.android.mms.ui.ConversationList");
private static final ComponentName COMPONENT_CAMERANEXT =
@@ -38,7 +40,9 @@ public class IconPreviewGenerator {
new ComponentName("com.android.calendar", "com.android.calendar.AllInOneActivity");
private static final ComponentName COMPONENT_GALERY =
new ComponentName("com.android.gallery3d", "com.android.gallery3d.app.GalleryActivity");
+
private static final String CAMERA_NEXT_PACKAGE = "com.cyngn.cameranext";
+ private static final String DIALER_NEXT_PACKAGE = "com.cyngn.dialer";
private ComponentName[] mIconComponents;
@@ -74,6 +78,15 @@ public class IconPreviewGenerator {
if (!pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
mIconComponents[0] = COMPONENT_CALENDAR;
mIconComponents[1] = COMPONENT_GALERY;
+ } else {
+ // decide on which dialer icon to use
+ try {
+ if (pm.getPackageInfo(DIALER_NEXT_PACKAGE, 0) != null) {
+ mIconComponents[0] = COMPONENT_DIALERNEXT;
+ }
+ } catch (PackageManager.NameNotFoundException e) {
+ // default to COMPONENT_DIALER
+ }
}
if (!pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {