Merge "Update suggested wallpaper dimensions in onResume" into jb-ub-now-kermit
diff --git a/res/values-land/styles.xml b/res/values-land/styles.xml
index ccb5fcb..d18a57b 100644
--- a/res/values-land/styles.xml
+++ b/res/values-land/styles.xml
@@ -27,7 +27,7 @@
</style>
<style name="DropTargetButtonContainer">
<item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">0dp</item>
+ <item name="android:layout_height">wrap_content</item>
</style>
<style name="DropTargetButton">
<item name="android:layout_width">wrap_content</item>
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 9e1f1a7..511b718 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -73,6 +73,7 @@
boolean isLandscape;
boolean isTablet;
boolean isLargeTablet;
+ boolean isLayoutRtl;
boolean transposeLayoutWithOrientation;
int desiredWorkspaceLeftRightMarginPx;
@@ -356,10 +357,11 @@
void updateFromConfiguration(Context context, Resources resources, int wPx, int hPx,
int awPx, int ahPx) {
- isLandscape = (resources.getConfiguration().orientation ==
- Configuration.ORIENTATION_LANDSCAPE);
+ Configuration configuration = resources.getConfiguration();
+ isLandscape = (configuration.orientation == Configuration.ORIENTATION_LANDSCAPE);
isTablet = resources.getBoolean(R.bool.is_tablet);
isLargeTablet = resources.getBoolean(R.bool.is_large_tablet);
+ isLayoutRtl = (configuration.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL);
widthPx = wPx;
heightPx = hPx;
availableWidthPx = awPx;
@@ -437,7 +439,13 @@
Rect bounds = new Rect();
if (orientation == CellLayout.LANDSCAPE &&
transposeLayoutWithOrientation) {
- bounds.set(0, edgeMarginPx, searchBarSpaceHeightPx, availableHeightPx - edgeMarginPx);
+ if (isLayoutRtl) {
+ bounds.set(availableWidthPx - searchBarSpaceHeightPx, edgeMarginPx,
+ availableWidthPx, availableHeightPx - edgeMarginPx);
+ } else {
+ bounds.set(0, edgeMarginPx, searchBarSpaceHeightPx,
+ availableHeightPx - edgeMarginPx);
+ }
} else {
if (isTablet()) {
// Pad the left and right of the workspace to ensure consistent spacing
@@ -472,8 +480,13 @@
if (orientation == CellLayout.LANDSCAPE &&
transposeLayoutWithOrientation) {
// Pad the left and right of the workspace with search/hotseat bar sizes
- padding.set(searchBarBounds.right, edgeMarginPx,
- hotseatBarHeightPx, edgeMarginPx);
+ if (isLayoutRtl) {
+ padding.set(hotseatBarHeightPx, edgeMarginPx,
+ searchBarBounds.width(), edgeMarginPx);
+ } else {
+ padding.set(searchBarBounds.width(), edgeMarginPx,
+ hotseatBarHeightPx, edgeMarginPx);
+ }
} else {
if (isTablet()) {
// Pad the left and right of the workspace to ensure consistent spacing
@@ -627,7 +640,7 @@
lp = (FrameLayout.LayoutParams) hotseat.getLayoutParams();
if (hasVerticalBarLayout) {
// Vertical hotseat
- lp.gravity = Gravity.RIGHT;
+ lp.gravity = Gravity.END;
lp.width = hotseatBarHeightPx;
lp.height = LayoutParams.MATCH_PARENT;
hotseat.findViewById(R.id.layout).setPadding(0, 2 * edgeMarginPx, 0, 2 * edgeMarginPx);
@@ -703,7 +716,8 @@
paddingTB = Math.min(paddingTB, (int)((paddingLR + paddingTB) * 0.75f));
int maxAllAppsWidth = (allAppsNumCols * (allAppsCellWidthPx + 2 * paddingLR));
int gridPaddingLR = (availableWidthPx - maxAllAppsWidth) / 2;
- if (gridPaddingLR > (allAppsCellWidthPx / 4)) {
+ // Only adjust the side paddings on landscape phones, or tablets
+ if ((isTablet() || isLandscape) && gridPaddingLR > (allAppsCellWidthPx / 4)) {
padding.left = padding.right = gridPaddingLR;
}
// The icons are centered, so we can't just offset by the page indicator height
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 12c087f..e2301ba 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1765,7 +1765,7 @@
}
// Reset the apps customize page
- if (mAppsCustomizeTabHost != null) {
+ if (!alreadyOnHome && mAppsCustomizeTabHost != null) {
mAppsCustomizeTabHost.reset();
}
@@ -2375,7 +2375,7 @@
* @param v The view that was clicked.
*/
public void onClickAllAppsButton(View v) {
- showAllApps(true, AppsCustomizePagedView.ContentType.Applications, true);
+ showAllApps(true, AppsCustomizePagedView.ContentType.Applications, false);
}
public void onTouchDownAllAppsButton(View v) {
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 4d9dff9..74f28b3 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -2298,7 +2298,7 @@
r = new Runnable() {
public void run() {
Callbacks callbacks = tryGetCallbacks(oldCallbacks);
- if (callbacks != null) {
+ if (callbacks != null && currentScreen >= 0) {
callbacks.onPageBoundSynchronously(currentScreen);
}
}
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 54de635..27b7dae 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -72,7 +72,7 @@
static final String AUTHORITY = ProviderConfig.AUTHORITY;
// Should we attempt to load anything from the com.android.launcher2 provider?
- static final boolean IMPORT_LAUNCHER2_DATABASE = false;
+ static final boolean IMPORT_LAUNCHER2_DATABASE = true;
static final String TABLE_FAVORITES = "favorites";
static final String TABLE_WORKSPACE_SCREENS = "workspaceScreens";
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 2c7114b..c216f92 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -1398,7 +1398,7 @@
if (finishedScrolling) {
mTouchState = TOUCH_STATE_REST;
- if (!mScroller.isFinished()) {
+ if (!mScroller.isFinished() && !mFreeScroll) {
setCurrentPage(getNextPage());
pageEndMoving();
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 936d573..bf4f561 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -4279,7 +4279,9 @@
if (mSavedStates != null) {
mRestoredPages.add(child);
CellLayout cl = (CellLayout) getChildAt(child);
- cl.restoreInstanceState(mSavedStates);
+ if (cl != null) {
+ cl.restoreInstanceState(mSavedStates);
+ }
}
}