summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornebkat <nebkat@teamhacksung.org>2012-03-28 18:08:22 +0100
committernebkat <nebkat@teamhacksung.org>2012-12-24 10:12:26 +0000
commit3c512865bfc4243ccab4103320407dcd1e58d874 (patch)
treeb1e03685752187600c90fcdc0899fd1e2fc9ac1a
parent1650f04a9d18c97589176962e1b89b658d65bca8 (diff)
downloadpackages_apps_trebuchet-3c512865bfc4243ccab4103320407dcd1e58d874.zip
packages_apps_trebuchet-3c512865bfc4243ccab4103320407dcd1e58d874.tar.gz
packages_apps_trebuchet-3c512865bfc4243ccab4103320407dcd1e58d874.tar.bz2
Hotseat: Number Icons
Conflicts: res/values/strings.xml res/xml/preferences.xml src/com/beansoft/launcher/preference/PreferencesProvider.java src/com/cyanogenmod/trebuchet/Hotseat.java Change-Id: I839171c99f4050ad9dc03fbe82c8ed7be41cb4c0
-rw-r--r--res/values/strings.xml4
-rw-r--r--res/xml/preferences_dock.xml6
-rw-r--r--src/com/cyanogenmod/trebuchet/Hotseat.java26
-rw-r--r--src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java7
4 files changed, 26 insertions, 17 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 281b01b..849b964 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -384,8 +384,10 @@ s -->
<string name="preferences_interface_dock_title">Dock</string>
<string name="preferences_interface_dock_pages_title">Pages</string>
<string name="preferences_interface_dock_pages_summary">Number of pages in the dock</string>
- <string name="preferences_interface_dock_default_page_title">Default Page</string>
+ <string name="preferences_interface_dock_default_page_title">Default page</string>
<string name="preferences_interface_dock_default_page_summary">Choose the default page</string>
+ <string name="preferences_interface_dock_icons_title">Icons</string>
+ <string name="preferences_interface_dock_icons_summary">Number of icons/columns in the dock</string>
<string name="preferences_interface_dock_divider_title">Show dock divider</string>
<string name="preferences_interface_dock_divider_summary">Show divider between homescreen and dock</string>
diff --git a/res/xml/preferences_dock.xml b/res/xml/preferences_dock.xml
index 7f5de96..3e85c95 100644
--- a/res/xml/preferences_dock.xml
+++ b/res/xml/preferences_dock.xml
@@ -31,6 +31,12 @@
launcher:maxExternal="ui_dock_pages"
launcher:max="3"
launcher:min="1" />
+ <com.cyanogenmod.trebuchet.preference.NumberPickerPreference android:key="ui_dock_icons"
+ android:title="@string/preferences_interface_dock_icons_title"
+ android:summary="@string/preferences_interface_dock_icons_summary"
+ android:defaultValue="@integer/hotseat_cell_count"
+ launcher:max="@integer/hotseat_cell_count"
+ launcher:min="3" />
<CheckBoxPreference android:key="ui_dock_divider"
android:title="@string/preferences_interface_dock_divider_title"
android:summary="@string/preferences_interface_dock_divider_summary"
diff --git a/src/com/cyanogenmod/trebuchet/Hotseat.java b/src/com/cyanogenmod/trebuchet/Hotseat.java
index 7812913..84a8796 100644
--- a/src/com/cyanogenmod/trebuchet/Hotseat.java
+++ b/src/com/cyanogenmod/trebuchet/Hotseat.java
@@ -58,25 +58,30 @@ public class Hotseat extends PagedView {
int hotseatPages = PreferencesProvider.Interface.Dock.getNumberPages();
int defaultPage = PreferencesProvider.Interface.Dock.getDefaultPage(hotseatPages / 2);
- LayoutInflater inflater =
- (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- for (int i = 0; i < hotseatPages; i++) {
- inflater.inflate(R.layout.hotseat_page, this);
- }
mCurrentPage = defaultPage;
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.Hotseat, defStyle, 0);
Resources r = context.getResources();
- mCellCountX = a.getInt(R.styleable.Hotseat_cellCountX, -1);
- mCellCountY = a.getInt(R.styleable.Hotseat_cellCountY, -1);
+ mCellCountX = a.getInt(R.styleable.Hotseat_cellCountX, DEFAULT_CELL_COUNT_X);
+ mCellCountY = a.getInt(R.styleable.Hotseat_cellCountY, DEFAULT_CELL_COUNT_Y);
+ mCellCountX = PreferencesProvider.Interface.Dock.getNumberIcons(mCellCountX);
mAllAppsButtonRank = r.getInteger(R.integer.hotseat_all_apps_index);
mTransposeLayoutWithOrientation =
r.getBoolean(R.bool.hotseat_transpose_layout_with_orientation);
mIsLandscape = context.getResources().getConfiguration().orientation ==
Configuration.ORIENTATION_LANDSCAPE;
+ LayoutInflater inflater =
+ (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ for (int i = 0; i < hotseatPages; i++) {
+ CellLayout cl = (CellLayout) inflater.inflate(R.layout.hotseat_page, null);
+ cl.setGridSize(mCellCountX, mCellCountY);
+ cl.setIsHotseat(true);
+ addView(cl);
+ }
+
// No data needed
setDataIsReady();
}
@@ -118,13 +123,6 @@ public class Hotseat extends PagedView {
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- if (mCellCountX < 0) mCellCountX = DEFAULT_CELL_COUNT_X;
- if (mCellCountY < 0) mCellCountY = DEFAULT_CELL_COUNT_Y;
- for (int i = 0; i < getChildCount(); i++) {
- CellLayout cl = (CellLayout) getPageAt(i);
- cl.setGridSize(mCellCountX, mCellCountY);
- cl.setIsHotseat(true);
- }
resetLayout();
}
diff --git a/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
index a6094ef..98cfd1a 100644
--- a/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
+++ b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
@@ -179,11 +179,14 @@ public final class PreferencesProvider {
}
public static class Dock {
+ public static int getNumberPages() {
+ return getInt("ui_dock_pages", 1);
+ }
public static int getDefaultPage(int def) {
return getInt("ui_dock_default_page", def + 1) - 1;
}
- public static int getNumberPages() {
- return getInt("ui_dock_pages", 1);
+ public static int getNumberIcons(int def) {
+ return getInt("ui_dock_icons", def);
}
public static boolean getShowDivider() {
return getBoolean("ui_dock_divider", true);