diff options
author | Nebojsa Cvetkovic <nebkat@gmail.com> | 2013-12-15 20:50:59 +0000 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2014-01-24 16:25:19 -0800 |
commit | 04d59a5a3bda757080acf34a974474317e7a6ab3 (patch) | |
tree | 1fe989b84bb78abb4a2211a846326ff95e02ef56 | |
parent | 9d02fc3d0e2ee6e164227737045f1375902eb018 (diff) | |
download | android_packages_apps_Trebuchet-04d59a5a3bda757080acf34a974474317e7a6ab3.tar.gz android_packages_apps_Trebuchet-04d59a5a3bda757080acf34a974474317e7a6ab3.tar.bz2 android_packages_apps_Trebuchet-04d59a5a3bda757080acf34a974474317e7a6ab3.zip |
DynamicGrid: Use large icons
Change-Id: I4cdd15c82bbedd7b54051c3a79d63b6c1238a71a
-rw-r--r-- | res/values-sw340dp/config.xml | 3 | ||||
-rw-r--r-- | res/values/cm_strings.xml | 5 | ||||
-rw-r--r-- | res/values/config.xml | 1 | ||||
-rw-r--r-- | res/values/preferences_defaults.xml | 1 | ||||
-rw-r--r-- | res/xml/preferences_general.xml | 25 | ||||
-rw-r--r-- | res/xml/preferences_headers.xml | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/DynamicGrid.java | 20 | ||||
-rw-r--r-- | src/com/android/launcher3/settings/SettingsActivity.java | 9 | ||||
-rw-r--r-- | src/com/android/launcher3/settings/SettingsProvider.java | 1 |
9 files changed, 54 insertions, 12 deletions
diff --git a/res/values-sw340dp/config.xml b/res/values-sw340dp/config.xml new file mode 100644 index 000000000..221a1039c --- /dev/null +++ b/res/values-sw340dp/config.xml @@ -0,0 +1,3 @@ +<resources> + <bool name="config_largeIcons">true</bool> +</resources> diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 0fd8d9a34..eb0db0dbc 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -31,9 +31,8 @@ <!-- Dock --> <string name="preferences_interface_dock_title">Dock</string> - <!-- Icons --> - <string name="preferences_interface_icons_title">Icons</string> - <!-- General --> <string name="preferences_interface_general_title">General</string> + <string name="preferences_interface_general_large_icons_title">Larger icons</string> + <string name="preferences_interface_general_large_icons_summary">Use extra large application icons in homescreen and drawer</string> </resources>
\ No newline at end of file diff --git a/res/values/config.xml b/res/values/config.xml index 8014c79f6..3c1dc36f7 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -3,6 +3,7 @@ <bool name="is_tablet">false</bool> <bool name="is_large_tablet">false</bool> <bool name="allow_rotation">false</bool> + <bool name="config_largeIcons">false</bool> <!-- Max number of page indicators to show --> <integer name="config_maxNumberOfPageIndicatorsToShow">21</integer> diff --git a/res/values/preferences_defaults.xml b/res/values/preferences_defaults.xml index b84e8f612..0fb4ed863 100644 --- a/res/values/preferences_defaults.xml +++ b/res/values/preferences_defaults.xml @@ -2,4 +2,5 @@ <resources> <bool name="preferences_interface_homescreen_search_default">true</bool> <bool name="preferences_interface_homescreen_scrolling_show_outlines_default">@bool/config_workspaceDefaultShowOutlines</bool> + <bool name="preferences_interface_general_large_icons_default">@bool/config_largeIcons</bool> </resources>
\ No newline at end of file diff --git a/res/xml/preferences_general.xml b/res/xml/preferences_general.xml new file mode 100644 index 000000000..24010b361 --- /dev/null +++ b/res/xml/preferences_general.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:launcher="http://schemas.android.com/apk/res/com.cyanogenmod.trebuchet" + android:key="ui_general" + android:title="@string/preferences_interface_general_title"> + <CheckBoxPreference android:key="ui_general_large_icons" + android:title="@string/preferences_interface_general_large_icons_title" + android:summary="@string/preferences_interface_general_large_icons_summary" + android:defaultValue="@bool/preferences_interface_general_large_icons_default" /> +</PreferenceScreen>
\ No newline at end of file diff --git a/res/xml/preferences_headers.xml b/res/xml/preferences_headers.xml index b90ec1eb4..303532e8f 100644 --- a/res/xml/preferences_headers.xml +++ b/res/xml/preferences_headers.xml @@ -28,6 +28,7 @@ android:title="@string/preferences_interface_dock_title" /> <header android:id="@+id/preferences_general_section" + android:fragment="org.cyanogenmod.trebuchet.settings.SettingsActivity$GeneralFragment" android:title="@string/preferences_interface_general_title" /> <header android:id="@+id/preferences_application_section" diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java index a6a143c1e..5bbb9214f 100644 --- a/src/com/android/launcher3/DynamicGrid.java +++ b/src/com/android/launcher3/DynamicGrid.java @@ -512,26 +512,28 @@ public class DynamicGrid { ArrayList<DeviceProfile> deviceProfiles = new ArrayList<DeviceProfile>(); boolean hasAA = !AppsCustomizePagedView.DISABLE_ALL_APPS; + boolean useLargeIcons = SettingsProvider.getBoolean(context, SettingsProvider.SETTINGS_UI_GENERAL_LARGE_ICONS, + R.bool.preferences_interface_general_large_icons_default); // Our phone profiles include the bar sizes in each orientation deviceProfiles.add(new DeviceProfile("Super Short Stubby", - 255, 300, 2, 3, 48, 13, (hasAA ? 5 : 4), 48)); + 255, 300, 2, 3, (useLargeIcons ? 54 : 48), 13, (hasAA ? 5 : 4), (useLargeIcons ? 54 : 48))); deviceProfiles.add(new DeviceProfile("Shorter Stubby", - 255, 400, 3, 3, 48, 13, (hasAA ? 5 : 4), 48)); + 255, 400, 3, 3, (useLargeIcons ? 54 : 48), 13, (hasAA ? 5 : 4), (useLargeIcons ? 54 : 48))); deviceProfiles.add(new DeviceProfile("Short Stubby", - 275, 420, 3, 4, 48, 13, (hasAA ? 5 : 4), 48)); + 275, 420, 3, 4, (useLargeIcons ? 54 : 48), 13, (hasAA ? 5 : 4), (useLargeIcons ? 54 : 48))); deviceProfiles.add(new DeviceProfile("Stubby", - 255, 450, 3, 4, 48, 13, (hasAA ? 5 : 4), 48)); + 255, 450, 3, 4, (useLargeIcons ? 54 : 48), 13, (hasAA ? 5 : 4), (useLargeIcons ? 54 : 48))); deviceProfiles.add(new DeviceProfile("Nexus S", - 296, 491.33f, 4, 4, 48, 13, (hasAA ? 5 : 4), 48)); + 296, 491.33f, 4, 4, (useLargeIcons ? 56 : 48), 13, (hasAA ? 5 : 4), (useLargeIcons ? 56 : 48))); deviceProfiles.add(new DeviceProfile("Nexus 4", - 359, 518, 4, 4, 60, 13, (hasAA ? 5 : 4), 56)); + 359, 518, 4, 4, (useLargeIcons ? 60 : 52), 13, (hasAA ? 5 : 4), (useLargeIcons ? 56 : 48))); // 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, 6, 6, 72, 14.4f, 7, 60)); + 575, 904, 6, 6, (useLargeIcons ? 72 : 60), 14.4f, 7, (useLargeIcons ? 60 : 52))); // Larger tablet profiles always have system bars on the top & bottom deviceProfiles.add(new DeviceProfile("Nexus 10", - 727, 1207, 5, 8, 80, 14.4f, 9, 64)); + 727, 1207, 5, 8, (useLargeIcons ? 80 : 64), 14.4f, 9, (useLargeIcons ? 64 : 56))); /* deviceProfiles.add(new DeviceProfile("Nexus 7", 600, 960, 5, 5, 72, 14.4f, 5, 60)); @@ -539,7 +541,7 @@ public class DynamicGrid { 800, 1280, 5, 5, 80, 14.4f, (hasAA ? 7 : 6), 64)); */ deviceProfiles.add(new DeviceProfile("20-inch Tablet", - 1527, 2527, 7, 7, 100, 20, 7, 72)); + 1527, 2527, 7, 7, (useLargeIcons ? 100 : 80), 20, 7, (useLargeIcons ? 72 : 64))); mMinWidth = dpiFromPx(minWidthPx, dm); mMinHeight = dpiFromPx(minHeightPx, dm); mProfile = new DeviceProfile(context, deviceProfiles, diff --git a/src/com/android/launcher3/settings/SettingsActivity.java b/src/com/android/launcher3/settings/SettingsActivity.java index 45b98c86c..d06c3095c 100644 --- a/src/com/android/launcher3/settings/SettingsActivity.java +++ b/src/com/android/launcher3/settings/SettingsActivity.java @@ -129,6 +129,15 @@ public class SettingsActivity extends PreferenceActivity } } + public static class GeneralFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + addPreferencesFromResource(R.xml.preferences_general); + } + } + private static class HeaderAdapter extends ArrayAdapter<Header> { private static final int HEADER_TYPE_NORMAL = 0; private static final int HEADER_TYPE_CATEGORY = 1; diff --git a/src/com/android/launcher3/settings/SettingsProvider.java b/src/com/android/launcher3/settings/SettingsProvider.java index 679452126..abe46b1ee 100644 --- a/src/com/android/launcher3/settings/SettingsProvider.java +++ b/src/com/android/launcher3/settings/SettingsProvider.java @@ -27,6 +27,7 @@ public final class SettingsProvider { public static final String SETTINGS_UI_HOMESCREEN_DEFAULT_SCREEN_ID = "ui_homescreen_default_screen_id"; public static final String SETTINGS_UI_HOMESCREEN_SEARCH = "ui_homescreen_search"; public static final String SETTINGS_UI_HOMESCREEN_SCROLLING_SHOW_OUTLINES = "ui_homescreen_scrolling_show_outlines"; + public static final String SETTINGS_UI_GENERAL_LARGE_ICONS = "ui_general_large_icons"; public static SharedPreferences get(Context context) { return context.getSharedPreferences(SETTINGS_KEY, 0); |