summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2015-02-05 15:39:59 -0800
committerAdnan Begovic <adnan@cyngn.com>2015-02-12 14:04:21 -0800
commit5741015b0030991b2a7f5043ddb701d875bb7123 (patch)
treea8e3e58928e7e7d6b7fb59a6a82c424a023a0020
parent006f35ad423a4a8484d57e70d9f94489e69cda56 (diff)
downloadandroid_packages_apps_Trebuchet-5741015b0030991b2a7f5043ddb701d875bb7123.tar.gz
android_packages_apps_Trebuchet-5741015b0030991b2a7f5043ddb701d875bb7123.tar.bz2
android_packages_apps_Trebuchet-5741015b0030991b2a7f5043ddb701d875bb7123.zip
Trebuchet: Add small icon text feature
Change-Id: I3eac9dfddb0ff89ca084ebc62511deb84af07654
-rw-r--r--res/values/cm_strings.xml3
-rw-r--r--res/values/preferences_defaults.xml1
-rw-r--r--src/com/android/launcher3/DynamicGrid.java54
-rw-r--r--src/com/android/launcher3/OverviewSettingsPanel.java1
-rw-r--r--src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java14
-rw-r--r--src/com/android/launcher3/settings/SettingsProvider.java1
6 files changed, 56 insertions, 18 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 1a447d9f1..df151c064 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -64,6 +64,9 @@
<!-- Larger icons -->
<string name="larger_icons_text">Larger icons</string>
+ <!-- Small text -->
+ <string name="small_text_size">Small text size</string>
+
<!-- Icon labels -->
<string name="icon_labels">Icon labels</string>
<string name="icon_labels_show">Show</string>
diff --git a/res/values/preferences_defaults.xml b/res/values/preferences_defaults.xml
index 13fb8ccbe..eae81228b 100644
--- a/res/values/preferences_defaults.xml
+++ b/res/values/preferences_defaults.xml
@@ -12,6 +12,7 @@
<bool name="preferences_interface_drawer_remove_hidden_apps_widgets_default">true</bool>
<bool name="preferences_interface_drawer_hide_icon_labels_default">false</bool>
<bool name="preferences_interface_general_icons_large_default">@bool/config_largeIcons</bool>
+ <bool name="preferences_interface_general_text_small_default">true</bool>
<string name="preferences_interface_general_icons_text_font_family_default">sans-serif-condensed</string>
<integer name="preferences_interface_general_icons_text_font_style_default">0</integer>
</resources>
diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java
index dbcca1e3e..b8f275147 100644
--- a/src/com/android/launcher3/DynamicGrid.java
+++ b/src/com/android/launcher3/DynamicGrid.java
@@ -36,6 +36,8 @@ public class DynamicGrid {
// This is a static that we use for the default icon size on a 4/5-inch phone
static float DEFAULT_ICON_SIZE_DP = 66;
static float DEFAULT_ICON_SIZE_PX = 0;
+ static float DEFAULT_TEXT_SIZE_SMALL = 10;
+ static float DEFAULT_TEXT_SIZE_NORMAL = 13;
public static float dpiFromPx(int size, DisplayMetrics metrics){
float densityRatio = (float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT;
@@ -61,7 +63,6 @@ public class DynamicGrid {
boolean useLargeIcons = SettingsProvider.getBoolean(context,
SettingsProvider.SETTINGS_UI_GENERAL_ICONS_LARGE,
R.bool.preferences_interface_general_icons_large_default);
-
int fourByFourDefaultLayout = R.xml.default_workspace_4x4;
if (LauncherApplication.LAUNCHER_SHORTCUT_ENABLED) {
fourByFourDefaultLayout = R.xml.ct_default_workspace_4x4;
@@ -73,51 +74,68 @@ public class DynamicGrid {
fourByFourDefaultLayout = R.xml.srf_default_workspace;
}
+ boolean useSmallText = SettingsProvider.getBoolean(context,
+ SettingsProvider.SETTINGS_UI_GENERAL_TEXT_SMALL,
+ R.bool.preferences_interface_general_text_small_default);
+ boolean launcherShortcutEnabled = LauncherApplication.LAUNCHER_SHORTCUT_ENABLED;
+ int fourByFourDefaultLayout = launcherShortcutEnabled ? R.xml.ct_default_workspace_4x4
+ : R.xml.default_workspace_4x4;
DEFAULT_ICON_SIZE_PX = pxFromDp(DEFAULT_ICON_SIZE_DP, dm);
// Our phone profiles include the bar sizes in each orientation
deviceProfiles.add(new DeviceProfile("Super Short Stubby",
- 255, 300, 2, 3, (useLargeIcons ? 58 : 46), 13, (hasAA ? 3 : 5),
+ 255, 300, 2, 3, (useLargeIcons ? 58 : 46), (useSmallText ?
+ DEFAULT_TEXT_SIZE_SMALL : DEFAULT_TEXT_SIZE_NORMAL) , (hasAA ? 3 : 5),
(useLargeIcons ? 58 : 46), fourByFourDefaultLayout,
R.xml.default_workspace_4x4_no_all_apps));
deviceProfiles.add(new DeviceProfile("Shorter Stubby",
- 255, 400, 3, 3, (useLargeIcons ? 58 : 46), 13, (hasAA ? 3 : 5),
+ 255, 400, 3, 3, (useLargeIcons ? 58 : 46), (useSmallText ?
+ DEFAULT_TEXT_SIZE_SMALL : DEFAULT_TEXT_SIZE_NORMAL), (hasAA ? 3 : 5),
(useLargeIcons ? 58 : 46), fourByFourDefaultLayout,
R.xml.default_workspace_4x4_no_all_apps));
deviceProfiles.add(new DeviceProfile("Short Stubby",
- 275, 420, 3, 4, (useLargeIcons ? 58 : 46), 13, (hasAA ? 5 : 5),
+ 275, 420, 3, 4, (useLargeIcons ? 58 : 46), (useSmallText ?
+ DEFAULT_TEXT_SIZE_SMALL : DEFAULT_TEXT_SIZE_NORMAL), (hasAA ? 5 : 5),
(useLargeIcons ? 58 : 46), fourByFourDefaultLayout,
R.xml.default_workspace_4x4_no_all_apps));
deviceProfiles.add(new DeviceProfile("Stubby",
- 255, 450, 3, 4, (useLargeIcons ? 58 : 46), 13, (hasAA ? 5 : 5),
+ 255, 450, 3, 4, (useLargeIcons ? 58 : 46), (useSmallText ?
+ DEFAULT_TEXT_SIZE_SMALL : DEFAULT_TEXT_SIZE_NORMAL), (hasAA ? 5 : 5),
(useLargeIcons ? 58 : 46), fourByFourDefaultLayout,
R.xml.default_workspace_4x4_no_all_apps));
deviceProfiles.add(new DeviceProfile("Nexus S",
- 296, 491.33f, 4, 4, (useLargeIcons ? 58 : 46), 13, (hasAA ? 5 : 5),
+ 296, 491.33f, 4, 4, (useLargeIcons ? 58 : 46), (useSmallText ?
+ DEFAULT_TEXT_SIZE_SMALL : DEFAULT_TEXT_SIZE_NORMAL), (hasAA ? 5 : 5),
(useLargeIcons ? 58 : 46), fourByFourDefaultLayout,
R.xml.default_workspace_4x4_no_all_apps));
deviceProfiles.add(new DeviceProfile("Nexus 4",
- 335, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 52), 13, (hasAA ? 5 : 5),
- (useLargeIcons ? 60 : 46), fourByFourDefaultLayout,
+ 335, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 56), (useSmallText ?
+ DEFAULT_TEXT_SIZE_SMALL : DEFAULT_TEXT_SIZE_NORMAL), (hasAA ? 5 : 5),
+ (useLargeIcons ? 60 : 48), fourByFourDefaultLayout,
R.xml.default_workspace_4x4_no_all_apps));
deviceProfiles.add(new DeviceProfile("Nexus 5",
- 359, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 52), 13, (hasAA ? 5 : 5),
- (useLargeIcons ? 60 : 46), fourByFourDefaultLayout,
+ 359, 567, 4, 4, (useLargeIcons ? DEFAULT_ICON_SIZE_DP : 56), (useSmallText ?
+ DEFAULT_TEXT_SIZE_SMALL : DEFAULT_TEXT_SIZE_NORMAL), (hasAA ? 5 : 5),
+ (useLargeIcons ? 60 : 48), fourByFourDefaultLayout,
R.xml.default_workspace_4x4_no_all_apps));
deviceProfiles.add(new DeviceProfile("Large Phone",
- 406, 694, 5, 5, (useLargeIcons ? 68 : 52), 14.4f, 5, (useLargeIcons ? 60 : 44),
- R.xml.default_workspace_5x5, R.xml.default_workspace_5x5_no_all_apps));
+ 406, 694, 5, 5, (useLargeIcons ? 68 : 56), (useSmallText ? 11.4f : 14.4f), 5,
+ (useLargeIcons ? 60 : 48), R.xml.default_workspace_5x5,
+ R.xml.default_workspace_5x5_no_all_apps));
// The tablet profile is odd in that the landscape orientation
// also includes the nav bar on the side
deviceProfiles.add(new DeviceProfile("Nexus 7",
- 575, 904, 5, 6, (useLargeIcons ? 76 : 60), 14.4f, 7, (useLargeIcons ? 64 : 52),
- R.xml.default_workspace_5x6, R.xml.default_workspace_5x6_no_all_apps));
+ 575, 904, 5, 6, (useLargeIcons ? 76 : 60), (useSmallText ? 11.4f : 14.4f), 7,
+ (useLargeIcons ? 64 : 52), R.xml.default_workspace_5x6,
+ R.xml.default_workspace_5x6_no_all_apps));
// Larger tablet profiles always have system bars on the top & bottom
deviceProfiles.add(new DeviceProfile("Nexus 10",
- 727, 1207, 5, 6, (useLargeIcons ? 80 : 64), 14.4f, 7, (useLargeIcons ? 68 : 56),
- R.xml.default_workspace_5x6, R.xml.default_workspace_5x6_no_all_apps));
+ 727, 1207, 5, 6, (useLargeIcons ? 80 : 64), (useSmallText ? 11.4f : 14.4f), 7,
+ (useLargeIcons ? 68 : 56), R.xml.default_workspace_5x6,
+ R.xml.default_workspace_5x6_no_all_apps));
deviceProfiles.add(new DeviceProfile("20-inch Tablet",
- 1527, 2527, 7, 7, (useLargeIcons ? 104 : 80), 20, 7, (useLargeIcons ? 76 : 64),
- fourByFourDefaultLayout, R.xml.default_workspace_4x4_no_all_apps));
+ 1527, 2527, 7, 7, (useLargeIcons ? 104 : 80), (useSmallText ? 17 : 20), 7,
+ (useLargeIcons ? 76 : 64), fourByFourDefaultLayout,
+ R.xml.default_workspace_4x4_no_all_apps));
mMinWidth = dpiFromPx(minWidthPx, dm);
mMinHeight = dpiFromPx(minHeightPx, dm);
mProfile = new DeviceProfile(context, deviceProfiles,
diff --git a/src/com/android/launcher3/OverviewSettingsPanel.java b/src/com/android/launcher3/OverviewSettingsPanel.java
index e07c16e1d..983c5aaf6 100644
--- a/src/com/android/launcher3/OverviewSettingsPanel.java
+++ b/src/com/android/launcher3/OverviewSettingsPanel.java
@@ -55,6 +55,7 @@ public class OverviewSettingsPanel {
String[] valuesApp = new String[] {
res.getString(R.string.larger_icons_text),
+ res.getString(R.string.small_text_size),
res.getString(R.string.protected_app_settings)};
diff --git a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
index 8a77502e8..4e25a3b15 100644
--- a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
+++ b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
@@ -160,6 +160,14 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
: res.getString(R.string.setting_state_off);
((TextView) v.findViewById(R.id.item_state)).setText(state);
break;
+ case 1:
+ current = SettingsProvider.getBoolean(mContext,
+ SettingsProvider.SETTINGS_UI_GENERAL_TEXT_SMALL,
+ R.bool.preferences_interface_general_text_small_default);
+ state = current ? res.getString(R.string.setting_state_on)
+ : res.getString(R.string.setting_state_off);
+ ((TextView) v.findViewById(R.id.item_state)).setText(state);
+ break;
default:
((TextView) v.findViewById(R.id.item_state)).setText("");
}
@@ -309,6 +317,12 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
mLauncher.setUpdateDynamicGrid();
break;
case 1:
+ onSettingsBooleanChanged(v,
+ SettingsProvider.SETTINGS_UI_GENERAL_TEXT_SMALL,
+ R.bool.preferences_interface_general_text_small_default);
+ mLauncher.setUpdateDynamicGrid();
+ break;
+ case 2:
Intent intent = new Intent();
intent.setClassName(OverviewSettingsPanel.ANDROID_SETTINGS,
OverviewSettingsPanel.ANDROID_PROTECTED_APPS);
diff --git a/src/com/android/launcher3/settings/SettingsProvider.java b/src/com/android/launcher3/settings/SettingsProvider.java
index 044c5a016..0bcdc69ae 100644
--- a/src/com/android/launcher3/settings/SettingsProvider.java
+++ b/src/com/android/launcher3/settings/SettingsProvider.java
@@ -40,6 +40,7 @@ public final class SettingsProvider {
public static final String SETTINGS_UI_DRAWER_REMOVE_HIDDEN_APPS_WIDGETS = "ui_drawer_remove_hidden_apps_widgets";
public static final String SETTINGS_UI_DRAWER_HIDE_ICON_LABELS = "ui_drawer_hide_icon_labels";
public static final String SETTINGS_UI_GENERAL_ICONS_LARGE = "ui_general_icons_large";
+ public static final String SETTINGS_UI_GENERAL_TEXT_SMALL = "ui_general_text_small";
public static final String SETTINGS_UI_GENERAL_ICONS_TEXT_FONT_FAMILY = "ui_general_icons_text_font";
public static final String SETTINGS_UI_GENERAL_ICONS_TEXT_FONT_STYLE = "ui_general_icons_text_font_style";
public static final String SETTINGS_UI_DRAWER_SORT_MODE = "ui_drawer_sort_mode";