summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanesh Mondegarian <daneshm90@gmail.com>2013-10-23 04:02:41 (GMT)
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-10-23 04:02:41 (GMT)
commitf2a85b1a0ab23ccc9463be0f13e65615ffa6c4b9 (patch)
tree7242c271d91ad96d1a1bf7fc1065ff014152ced9
parent7769abd65dea641e1aca2b53120bfa17d4afe395 (diff)
parentefa4b8d18459243abf379bb0135ee0a89165a50a (diff)
downloadandroid_packages_apps_Trebuchet-f2a85b1a0ab23ccc9463be0f13e65615ffa6c4b9.zip
android_packages_apps_Trebuchet-f2a85b1a0ab23ccc9463be0f13e65615ffa6c4b9.tar.gz
android_packages_apps_Trebuchet-f2a85b1a0ab23ccc9463be0f13e65615ffa6c4b9.tar.bz2
Merge "Trebuchet : Fix dynamic padding" into cm-10.2
-rw-r--r--res/values/cm_strings.xml2
-rw-r--r--res/xml/preferences_homescreen.xml4
-rw-r--r--src/com/cyanogenmod/trebuchet/CellLayout.java27
-rw-r--r--src/com/cyanogenmod/trebuchet/Workspace.java11
-rw-r--r--src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java3
5 files changed, 19 insertions, 28 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 5ef593b..4fad354 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -81,8 +81,6 @@
<string name="preferences_interface_homescreen_general_grid_summary">Choose the number of rows/columns on the homescreen</string>
<string name="preferences_interface_homescreen_general_grid_rows_title">Rows</string>
<string name="preferences_interface_homescreen_general_grid_columns_title">Columns</string>
- <string name="preferences_interface_homescreen_general_stretch_screens_title">Stretch screens</string>
- <string name="preferences_interface_homescreen_general_stretch_screens_summary">Expand homescreens to fill the size of display</string>
<string name="preferences_interface_homescreen_general_hide_icon_labels_title">Hide icon labels</string>
<string name="preferences_interface_homescreen_general_hide_icon_labels_summary">Hide homescreen icon labels</string>
<string name="preferences_interface_homescreen_scrolling_category">Scrolling</string>
diff --git a/res/xml/preferences_homescreen.xml b/res/xml/preferences_homescreen.xml
index ec4ef8d..1834225 100644
--- a/res/xml/preferences_homescreen.xml
+++ b/res/xml/preferences_homescreen.xml
@@ -45,10 +45,6 @@
launcher:maxExternal="ui_homescreen_screens"
launcher:max="5"
launcher:min="1" />
- <CheckBoxPreference android:key="ui_homescreen_stretch_screens"
- android:title="@string/preferences_interface_homescreen_general_stretch_screens_title"
- android:summary="@string/preferences_interface_homescreen_general_stretch_screens_summary"
- android:defaultValue="true" />
<CheckBoxPreference android:key="ui_homescreen_general_search"
android:title="@string/preferences_interface_homescreen_general_search_title"
android:summary="@string/preferences_interface_homescreen_general_search_summary"
diff --git a/src/com/cyanogenmod/trebuchet/CellLayout.java b/src/com/cyanogenmod/trebuchet/CellLayout.java
index eab7d1e..2118a95 100644
--- a/src/com/cyanogenmod/trebuchet/CellLayout.java
+++ b/src/com/cyanogenmod/trebuchet/CellLayout.java
@@ -74,7 +74,6 @@ public class CellLayout extends ViewGroup {
private int mOriginalHeightGap;
private int mWidthGap;
private int mHeightGap;
- private int mMaxGap;
private boolean mScrollingTransformsDirty = false;
private final Rect mRect = new Rect();
@@ -191,7 +190,6 @@ public class CellLayout extends ViewGroup {
mCellHeight = mOriginalCellHeight = a.getDimensionPixelSize(R.styleable.CellLayout_cellHeight, 10);
mWidthGap = mOriginalWidthGap = a.getDimensionPixelSize(R.styleable.CellLayout_widthGap, 0);
mHeightGap = mOriginalHeightGap = a.getDimensionPixelSize(R.styleable.CellLayout_heightGap, 0);
- mMaxGap = a.getDimensionPixelSize(R.styleable.CellLayout_maxGap, 0);
mCountX = LauncherModel.getWorkspaceCellCountX();
mCountY = LauncherModel.getWorkspaceCellCountY();
mOccupied = new boolean[mCountX][mCountY];
@@ -283,11 +281,6 @@ public class CellLayout extends ViewGroup {
mShortcutsAndWidgets = new ShortcutAndWidgetContainer(context);
- if (!LauncherApplication.isScreenLarge()){
- mCellWidth = (mCellWidth * res.getInteger(R.integer.default_cell_count_x)) / mCountX;
- mCellHeight = (mCellHeight * res.getInteger(R.integer.default_cell_count_y)) / mCountY;
- }
-
mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap);
addView(mShortcutsAndWidgets);
}
@@ -999,10 +992,26 @@ public class CellLayout extends ViewGroup {
if (mOriginalWidthGap < 0 || mOriginalHeightGap < 0) {
int hSpace = widthSpecSize - getPaddingLeft() - getPaddingRight();
int vSpace = heightSpecSize - getPaddingTop() - getPaddingBottom();
+
+ if (hSpace - (mCountX * mCellWidth) < 0) {
+ mCellWidth = hSpace / mCountX;
+ }
+ if (vSpace - (mCountY * mCellHeight) < 0) {
+ mCellHeight = vSpace / mCountY;
+ }
+
int hFreeSpace = hSpace - (mCountX * mCellWidth);
int vFreeSpace = vSpace - (mCountY * mCellHeight);
- mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0);
- mHeightGap = Math.min(mMaxGap,numHeightGaps > 0 ? (vFreeSpace / numHeightGaps) : 0);
+
+ mWidthGap = 0;
+ mHeightGap = 0;
+
+ if (numWidthGaps > 0) {
+ mWidthGap = hFreeSpace / numWidthGaps;
+ }
+ if (numHeightGaps > 0) {
+ mHeightGap = vFreeSpace / numHeightGaps;
+ }
mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap);
} else {
mWidthGap = mOriginalWidthGap;
diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java
index 0321e2b..ac07d6c 100644
--- a/src/com/cyanogenmod/trebuchet/Workspace.java
+++ b/src/com/cyanogenmod/trebuchet/Workspace.java
@@ -305,7 +305,6 @@ public class Workspace extends PagedView
// Preferences
private int mNumberHomescreens;
private int mDefaultHomescreen;
- private boolean mStretchScreens;
private boolean mShowSearchBar;
private boolean mShowHotseat;
private boolean mHideIconLabels;
@@ -393,12 +392,6 @@ public class Workspace extends PagedView
mDefaultHomescreen = mNumberHomescreens / 2;
}
- mStretchScreens = PreferencesProvider.Interface.Homescreen.getStretchScreens();
- // Large screen has calculated dimensions always, unless specified by config_workspaceTabletGrid option
- boolean workspaceTabletGrid = getResources().getBoolean(R.bool.config_workspaceTabletGrid);
- if (LauncherApplication.isScreenLarge() && workspaceTabletGrid == false) {
- mStretchScreens = false;
- }
mShowSearchBar = PreferencesProvider.Interface.Homescreen.getShowSearchBar();
mShowHotseat = PreferencesProvider.Interface.Dock.getShowDock();
mHideIconLabels = PreferencesProvider.Interface.Homescreen.getHideIconLabels();
@@ -531,9 +524,7 @@ public class Workspace extends PagedView
(LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for (int i = 0; i < mNumberHomescreens; i++) {
CellLayout screen = (CellLayout) inflater.inflate(R.layout.workspace_screen, null);
- if (mStretchScreens) {
- screen.setCellGaps(-1, -1);
- }
+ screen.setCellGaps(-1, -1);
addView(screen);
}
diff --git a/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
index cd88bb5..0cf38ae 100644
--- a/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
+++ b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
@@ -93,9 +93,6 @@ public final class PreferencesProvider {
return def;
}
}
- public static boolean getStretchScreens() {
- return getBoolean("ui_homescreen_stretch_screens", true);
- }
public static boolean getShowSearchBar() {
return getBoolean("ui_homescreen_general_search", true);
}