Merge "add market welcome back integration point." into jb-ub-now-indigo-rose
diff --git a/res/layout-land/first_run_cling.xml b/res/layout-land/first_run_cling.xml
index f827380..3b21e14 100644
--- a/res/layout-land/first_run_cling.xml
+++ b/res/layout-land/first_run_cling.xml
@@ -34,9 +34,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
+ android:layout_marginBottom="10dp"
android:text="@string/first_run_cling_title"
- android:textColor="#49C0EC"
- android:textSize="32sp" />
+ android:textColor="#FFFFFFFF"
+ android:textSize="30sp" />
<TextView
style="@style/ClingAltTitleText"
android:layout_width="wrap_content"
@@ -47,22 +48,28 @@
</LinearLayout>
<TextView
style="@style/ClingHintText"
+ android:id="@+id/search_bar_hint"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_marginEnd="10dp"
android:layout_marginTop="80dp"
- android:text="@string/first_run_cling_search_bar_hint"
- android:visibility="gone" />
+ android:visibility="gone"
+ android:drawableTop="@drawable/cling_arrow_up"
+ android:drawablePadding="5dp"
+ android:text="@string/first_run_cling_search_bar_hint" />
<TextView
style="@style/ClingHintText"
+ android:id="@+id/custom_content_hint"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginStart="10dp"
android:layout_marginTop="100dp"
- android:text="@string/first_run_cling_custom_content_hint"
- android:visibility="gone" />
+ android:visibility="gone"
+ android:drawableStart="@drawable/cling_arrow_left"
+ android:drawablePadding="10dp"
+ android:text="@string/first_run_cling_custom_content_hint" />
<TextView
style="@style/ClingHintText"
android:layout_width="160dp"
@@ -70,8 +77,9 @@
android:layout_gravity="bottom|end"
android:layout_marginEnd="10dp"
android:layout_marginBottom="100dp"
- android:text="@string/first_run_cling_create_screens_hint"
- android:visibility="gone" />
+ android:drawableEnd="@drawable/cling_arrow_right"
+ android:drawablePadding="5dp"
+ android:text="@string/first_run_cling_create_screens_hint" />
</FrameLayout>
<Button
style="@style/ClingButton"
diff --git a/res/layout-port/first_run_cling.xml b/res/layout-port/first_run_cling.xml
index cdc49b9..3b21e14 100644
--- a/res/layout-port/first_run_cling.xml
+++ b/res/layout-port/first_run_cling.xml
@@ -36,7 +36,7 @@
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:text="@string/first_run_cling_title"
- android:textColor="#49C0EC"
+ android:textColor="#FFFFFFFF"
android:textSize="30sp" />
<TextView
style="@style/ClingAltTitleText"
@@ -48,19 +48,27 @@
</LinearLayout>
<TextView
style="@style/ClingHintText"
+ android:id="@+id/search_bar_hint"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_marginEnd="10dp"
android:layout_marginTop="80dp"
+ android:visibility="gone"
+ android:drawableTop="@drawable/cling_arrow_up"
+ android:drawablePadding="5dp"
android:text="@string/first_run_cling_search_bar_hint" />
<TextView
style="@style/ClingHintText"
+ android:id="@+id/custom_content_hint"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginStart="10dp"
android:layout_marginTop="100dp"
+ android:visibility="gone"
+ android:drawableStart="@drawable/cling_arrow_left"
+ android:drawablePadding="10dp"
android:text="@string/first_run_cling_custom_content_hint" />
<TextView
style="@style/ClingHintText"
@@ -70,6 +78,7 @@
android:layout_marginEnd="10dp"
android:layout_marginBottom="100dp"
android:drawableEnd="@drawable/cling_arrow_right"
+ android:drawablePadding="5dp"
android:text="@string/first_run_cling_create_screens_hint" />
</FrameLayout>
<Button
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index b01add9..e488601 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -16,7 +16,7 @@
<com.android.launcher3.AppsCustomizeTabHost
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
- android:background="#FF000000">
+ android:background="#80FFFFFF">
<LinearLayout
android:id="@+id/apps_customize_content"
android:orientation="vertical"
diff --git a/res/layout/apps_customize_widget.xml b/res/layout/apps_customize_widget.xml
index ad677e9..f2d2342 100644
--- a/res/layout/apps_customize_widget.xml
+++ b/res/layout/apps_customize_widget.xml
@@ -35,8 +35,7 @@
android:paddingStart="@dimen/app_widget_preview_padding_left"
android:paddingEnd="@dimen/app_widget_preview_padding_right"
android:scaleType="matrix"
- android:background="@drawable/widget_container_holo" />
-
+ android:background="@drawable/screenpanel" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -57,7 +56,10 @@
android:textColor="#FFFFFFFF"
android:textSize="13sp"
- android:textAlignment="viewStart" />
+ android:textAlignment="viewStart"
+ android:fontFamily="sans-serif-condensed"
+ android:shadowRadius="2.0"
+ android:shadowColor="#B0000000" />
<!-- The original dimensions of the widget (can't be the same text as above due to different
style. -->
@@ -70,8 +72,11 @@
android:layout_weight="0"
android:gravity="start"
- android:textColor="#FF555555"
- android:textSize="12sp" />
+ android:textColor="#FFAAAAAA"
+ android:textSize="12sp"
+ android:fontFamily="sans-serif-condensed"
+ android:shadowRadius="2.0"
+ android:shadowColor="#B0000000" />
</LinearLayout>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 48a06fc..43a856d 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -35,4 +35,6 @@
<color name="wallpaper_picker_translucent_gray">#66000000</color>
<color name="folder_items_text_color">#FF333333</color>
<color name="outline_color">#FFFFFFFF</color>
+
+ <color name="first_run_cling_circle_background_color">#FF83AEE8</color>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index e6bb935..9f2a105 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -94,10 +94,11 @@
</style>
<style name="WorkspaceIcon.AppsCustomize">
- <item name="android:shadowRadius">0.0</item> <!-- Don't use text shadow -->
<item name="android:background">@null</item>
<item name="android:textColor">@color/apps_customize_icon_text_color</item>
<item name="android:drawablePadding">4dp</item>
+ <item name="android:shadowRadius">4.0</item>
+ <item name="android:shadowColor">#FF000000</item>
</style>
<style name="QSBBar">
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index 213e50a..dd870e4 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -499,13 +499,7 @@
if (mPressedIcon != null) {
mPressedIcon.lockDrawableState();
}
-
- // NOTE: We want all transitions from launcher to act as if the wallpaper were enabled
- // to be consistent. So re-enable the flag here, and we will re-disable it as necessary
- // when Launcher resumes and we are still in AllApps.
- mLauncher.updateWallpaperVisibility(true);
mLauncher.startActivitySafely(v, appInfo.intent, appInfo);
-
} else if (v instanceof PagedViewWidget) {
// Let the user know that they have to long press to add a widget
if (mWidgetInstructionToast != null) {
diff --git a/src/com/android/launcher3/AppsCustomizeTabHost.java b/src/com/android/launcher3/AppsCustomizeTabHost.java
index 89e74b2..bfcf92a 100644
--- a/src/com/android/launcher3/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher3/AppsCustomizeTabHost.java
@@ -22,6 +22,7 @@
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Resources;
+import android.graphics.Color;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -81,13 +82,6 @@
setOnTabChangedListener(this);
}
- void selectAppsTab() {
- setContentTypeImmediate(AppsCustomizePagedView.ContentType.Applications);
- }
- void selectWidgetsTab() {
- setContentTypeImmediate(AppsCustomizePagedView.ContentType.Widgets);
- }
-
@Override
public void setInsets(Rect insets) {
mInsets.set(insets);
@@ -203,6 +197,9 @@
}
private void onTabChangedEnd(AppsCustomizePagedView.ContentType type) {
+ int bgAlpha = (int) (255 * (getResources().getInteger(
+ R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f));
+ setBackgroundColor(Color.argb(bgAlpha, 0, 0, 0));
mAppsCustomizePane.setContentType(type);
}
@@ -439,6 +436,7 @@
ViewGroup parent = (ViewGroup) getParent();
if (parent == null) return;
+ View overviewPanel = ((Launcher) getContext()).getOverviewPanel();
final int count = parent.getChildCount();
if (!isChildrenDrawingOrderEnabled()) {
for (int i = 0; i < count; i++) {
@@ -446,7 +444,7 @@
if (child == this) {
break;
} else {
- if (child.getVisibility() == GONE) {
+ if (child.getVisibility() == GONE || child == overviewPanel) {
continue;
}
child.setVisibility(visibility);
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 30ca737..22492ac 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -949,9 +949,11 @@
int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
+ int childWidthSize = widthSize - (getPaddingLeft() + getPaddingRight());
+ int childHeightSize = heightSize - (getPaddingTop() + getPaddingBottom());
if (mFixedCellWidth < 0 || mFixedCellHeight < 0) {
- int cw = grid.calculateCellWidth(widthSize, mCountX);
- int ch = grid.calculateCellHeight(heightSize, mCountY);
+ int cw = grid.calculateCellWidth(childWidthSize, mCountX);
+ int ch = grid.calculateCellHeight(childHeightSize, mCountY);
if (cw != mCellWidth || ch != mCellHeight) {
mCellWidth = cw;
mCellHeight = ch;
@@ -960,8 +962,8 @@
}
}
- int newWidth = widthSize;
- int newHeight = heightSize;
+ int newWidth = childWidthSize;
+ int newHeight = childHeightSize;
if (mFixedWidth > 0 && mFixedHeight > 0) {
newWidth = mFixedWidth;
newHeight = mFixedHeight;
@@ -973,8 +975,8 @@
int numHeightGaps = mCountY - 1;
if (mOriginalWidthGap < 0 || mOriginalHeightGap < 0) {
- int hSpace = widthSize - getPaddingLeft() - getPaddingRight();
- int vSpace = heightSize - getPaddingTop() - getPaddingBottom();
+ int hSpace = childWidthSize;
+ int vSpace = childHeightSize;
int hFreeSpace = hSpace - (mCountX * mCellWidth);
int vFreeSpace = vSpace - (mCountY * mCellHeight);
mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0);
@@ -990,15 +992,19 @@
int maxHeight = 0;
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
- int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(newWidth - getPaddingLeft() -
- getPaddingRight(), MeasureSpec.EXACTLY);
- int childheightMeasureSpec = MeasureSpec.makeMeasureSpec(newHeight - getPaddingTop() -
- getPaddingBottom(), MeasureSpec.EXACTLY);
+ int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(newWidth,
+ MeasureSpec.EXACTLY);
+ int childheightMeasureSpec = MeasureSpec.makeMeasureSpec(newHeight,
+ MeasureSpec.EXACTLY);
child.measure(childWidthMeasureSpec, childheightMeasureSpec);
maxWidth = Math.max(maxWidth, child.getMeasuredWidth());
maxHeight = Math.max(maxHeight, child.getMeasuredHeight());
}
- setMeasuredDimension(maxWidth, maxHeight);
+ if (mFixedWidth > 0 && mFixedHeight > 0) {
+ setMeasuredDimension(maxWidth, maxHeight);
+ } else {
+ setMeasuredDimension(widthSize, heightSize);
+ }
}
@Override
@@ -1006,8 +1012,11 @@
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
- child.layout(getPaddingLeft(), getPaddingTop(),
- r - l - getPaddingRight(), b - t - getPaddingBottom());
+ int left = getPaddingLeft();
+ int top = getPaddingTop();
+ child.layout(left, top,
+ left + r - l,
+ top + b - t);
}
}
diff --git a/src/com/android/launcher3/Cling.java b/src/com/android/launcher3/Cling.java
index 963702a..7ca6990 100644
--- a/src/com/android/launcher3/Cling.java
+++ b/src/com/android/launcher3/Cling.java
@@ -24,6 +24,7 @@
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
@@ -55,7 +56,7 @@
private static String FOLDER_LANDSCAPE = "folder_landscape";
private static String FOLDER_LARGE = "folder_large";
- private static float FIRST_RUN_CIRCLE_BUFFER_DPS = 40;
+ private static float FIRST_RUN_CIRCLE_BUFFER_DPS = 60;
private static float WORKSPACE_INNER_CIRCLE_RADIUS_DPS = 50;
private static float WORKSPACE_OUTER_CIRCLE_RADIUS_DPS = 60;
private static float WORKSPACE_CIRCLE_Y_OFFSET_DPS = 30;
@@ -101,8 +102,10 @@
mErasePaint.setAlpha(0);
mErasePaint.setAntiAlias(true);
+ int circleColor = getResources().getColor(
+ R.color.first_run_cling_circle_background_color);
mBubblePaint = new Paint();
- mBubblePaint.setColor(0xFFFFFF);
+ mBubblePaint.setColor(circleColor);
mBubblePaint.setAntiAlias(true);
mDotPaint = new Paint();
diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java
index 664a99c..495e930 100644
--- a/src/com/android/launcher3/DynamicGrid.java
+++ b/src/com/android/launcher3/DynamicGrid.java
@@ -290,8 +290,7 @@
Rect getWorkspacePadding(int orientation) {
Rect padding = new Rect();
- if (orientation == CellLayout.LANDSCAPE &&
- transposeLayoutWithOrientation) {
+ if (isVerticalBarLayout()) {
// Pad the left and right of the workspace with search/hotseat bar sizes
padding.set(searchBarSpaceHeightPx, edgeMarginPx,
hotseatBarHeightPx, edgeMarginPx);
@@ -321,6 +320,17 @@
return padding;
}
+ // The rect returned will be extended to below the system ui that covers the workspace
+ Rect getHotseatRect() {
+ if (isVerticalBarLayout()) {
+ return new Rect(availableWidthPx - hotseatBarHeightPx, 0,
+ Integer.MAX_VALUE, availableHeightPx);
+ } else {
+ return new Rect(0, availableHeightPx - hotseatBarHeightPx,
+ availableWidthPx, Integer.MAX_VALUE);
+ }
+ }
+
int calculateCellWidth(int width, int countX) {
return width / countX;
}
@@ -338,11 +348,14 @@
return isLargeTablet;
}
+ boolean isVerticalBarLayout() {
+ return isLandscape && transposeLayoutWithOrientation;
+ }
+
public void layout(Launcher launcher) {
FrameLayout.LayoutParams lp;
Resources res = launcher.getResources();
- boolean hasVerticalBarLayout = isLandscape &&
- res.getBoolean(R.bool.hotseat_transpose_layout_with_orientation);
+ boolean hasVerticalBarLayout = isVerticalBarLayout();
// Layout the search bar space
View searchBarSpace = launcher.findViewById(R.id.qsb_bar);
@@ -430,7 +443,7 @@
lp.gravity = Gravity.BOTTOM;
lp.width = LayoutParams.MATCH_PARENT;
lp.height = hotseatBarHeightPx;
- hotseat.setPadding(2 * edgeMarginPx, 0,
+ hotseat.findViewById(R.id.layout).setPadding(2 * edgeMarginPx, 0,
2 * edgeMarginPx, 0);
}
hotseat.setLayoutParams(lp);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 3bbb39e..8959e7e 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -274,6 +274,7 @@
private boolean mVisible = false;
private boolean mAttached = false;
private static final boolean DISABLE_CLINGS = true;
+ private static final boolean DISABLE_CUSTOM_CLINGS = true;
private static LocaleConfiguration sLocaleConfiguration = null;
@@ -895,11 +896,6 @@
@Override
protected void onPause() {
- // NOTE: We want all transitions from launcher to act as if the wallpaper were enabled
- // to be consistent. So re-enable the flag here, and we will re-disable it as necessary
- // when Launcher resumes and we are still in AllApps.
- updateWallpaperVisibility(true);
-
// Ensure that items added to Launcher are queued until Launcher returns
InstallShortcutReceiver.enableInstallQueue();
@@ -2646,16 +2642,6 @@
view.setPivotY(view.getHeight() / 2.0f);
}
- void disableWallpaperIfInAllApps() {
- // Only disable it if we are in all apps
- if (isAllAppsVisible()) {
- if (mAppsCustomizeTabHost != null &&
- !mAppsCustomizeTabHost.isTransitioning()) {
- updateWallpaperVisibility(false);
- }
- }
- }
-
private void setWorkspaceBackground(boolean workspace) {
mLauncherView.setBackground(workspace ?
mWorkspaceBackgroundDrawable : null);
@@ -2815,7 +2801,6 @@
@Override
public void onAnimationStart(Animator animation) {
- updateWallpaperVisibility(true);
// Prepare the position
toView.setTranslationX(0.0f);
toView.setTranslationY(0.0f);
@@ -2827,10 +2812,6 @@
dispatchOnLauncherTransitionEnd(fromView, animated, false);
dispatchOnLauncherTransitionEnd(toView, animated, false);
- if (!animationCancelled) {
- updateWallpaperVisibility(false);
- }
-
// Hide the search bar
if (mSearchDropTargetBar != null) {
mSearchDropTargetBar.hideSearchBar(false);
@@ -2904,7 +2885,6 @@
dispatchOnLauncherTransitionPrepare(toView, animated, false);
dispatchOnLauncherTransitionStart(toView, animated, false);
dispatchOnLauncherTransitionEnd(toView, animated, false);
- updateWallpaperVisibility(false);
}
}
@@ -2941,7 +2921,6 @@
}
setPivotsForZoom(fromView, scaleFactor);
- updateWallpaperVisibility(true);
showHotseat(animated);
if (animated) {
final LauncherViewPropertyAnimator scaleAnim =
@@ -2973,7 +2952,6 @@
mStateAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
- updateWallpaperVisibility(true);
fromView.setVisibility(View.GONE);
dispatchOnLauncherTransitionEnd(fromView, animated, true);
dispatchOnLauncherTransitionEnd(toView, animated, true);
@@ -3011,30 +2989,13 @@
}
}
- @Override
- public void onWindowFocusChanged(boolean hasFocus) {
- if (!hasFocus) {
- // When another window occludes launcher (like the notification shade, or recents),
- // ensure that we enable the wallpaper flag so that transitions are done correctly.
- updateWallpaperVisibility(true);
- } else {
- // When launcher has focus again, disable the wallpaper if we are in AllApps
- mWorkspace.postDelayed(new Runnable() {
- @Override
- public void run() {
- disableWallpaperIfInAllApps();
- }
- }, 500);
- }
- }
-
void showWorkspace(boolean animated) {
showWorkspace(animated, null);
}
void showWorkspace(boolean animated, Runnable onCompleteRunnable) {
if (mState != State.WORKSPACE) {
- boolean wasInSpringLoadedMode = (mState == State.APPS_CUSTOMIZE_SPRING_LOADED);
+ boolean wasInSpringLoadedMode = (mState != State.WORKSPACE);
mWorkspace.setVisibility(View.VISIBLE);
hideAppsCustomizeHelper(State.WORKSPACE, animated, false, onCompleteRunnable);
@@ -4166,16 +4127,33 @@
// If we're not using the default workspace layout, replace workspace cling
// with a custom workspace cling (usually specified in an overlay)
// For now, only do this on tablets
- if (mSharedPrefs.getInt(LauncherProvider.DEFAULT_WORKSPACE_RESOURCE_ID, 0) != 0 &&
- getResources().getBoolean(R.bool.config_useCustomClings)) {
- // Use a custom cling
- View cling = findViewById(R.id.workspace_cling);
- ViewGroup clingParent = (ViewGroup) cling.getParent();
- int clingIndex = clingParent.indexOfChild(cling);
- clingParent.removeViewAt(clingIndex);
- View customCling = mInflater.inflate(R.layout.custom_workspace_cling, clingParent, false);
- clingParent.addView(customCling, clingIndex);
- customCling.setId(R.id.workspace_cling);
+ if (!DISABLE_CUSTOM_CLINGS) {
+ if (mSharedPrefs.getInt(LauncherProvider.DEFAULT_WORKSPACE_RESOURCE_ID, 0) != 0 &&
+ getResources().getBoolean(R.bool.config_useCustomClings)) {
+ // Use a custom cling
+ View cling = findViewById(R.id.workspace_cling);
+ ViewGroup clingParent = (ViewGroup) cling.getParent();
+ int clingIndex = clingParent.indexOfChild(cling);
+ clingParent.removeViewAt(clingIndex);
+ View customCling = mInflater.inflate(R.layout.custom_workspace_cling, clingParent, false);
+ clingParent.addView(customCling, clingIndex);
+ customCling.setId(R.id.workspace_cling);
+ }
+ }
+ Cling cling = (Cling) findViewById(R.id.first_run_cling);
+ if (cling != null) {
+ String sbHintStr = getFirstRunClingSearchBarHint();
+ String ccHintStr = getFirstRunCustomContentHint();
+ if (!sbHintStr.isEmpty()) {
+ TextView sbHint = (TextView) cling.findViewById(R.id.search_bar_hint);
+ sbHint.setText(sbHintStr);
+ sbHint.setVisibility(View.VISIBLE);
+ }
+ if (!ccHintStr.isEmpty()) {
+ TextView ccHint = (TextView) cling.findViewById(R.id.custom_content_hint);
+ ccHint.setText(ccHintStr);
+ ccHint.setVisibility(View.VISIBLE);
+ }
}
initCling(R.id.first_run_cling, null, false, true);
} else {
@@ -4183,6 +4161,13 @@
}
}
+ protected String getFirstRunClingSearchBarHint() {
+ return "";
+ }
+ protected String getFirstRunCustomContentHint() {
+ return "";
+ }
+
public void showFirstRunWorkspaceCling() {
// Enable the clings only if they have not been dismissed before
if (isClingsEnabled() &&
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 31a9797..1ae2943 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -911,8 +911,9 @@
mPageScrolls[i] = childLeft - scrollOffset - offsetX;
if (i != endIndex - delta) {
+ childLeft += childWidth + scrollOffset;
int nextScrollOffset = (getViewportWidth() - getChildWidth(i + delta)) / 2;
- childLeft += childWidth + nextScrollOffset;
+ childLeft += nextScrollOffset;
}
}
}
@@ -1039,9 +1040,6 @@
protected int getChildOffset(int index) {
if (index < 0 || index > getChildCount() - 1) return 0;
- final boolean isRtl = isLayoutRtl();
-
- if (isRtl) index = getChildCount() - index - 1;
int offset = getPageAt(index).getLeft() - getViewportOffsetX();
return offset;
@@ -1056,33 +1054,43 @@
final int pageCount = getChildCount();
mTmpIntPoint[0] = mTmpIntPoint[1] = 0;
+ range[0] = -1;
+ range[1] = -1;
+
if (pageCount > 0) {
int viewportWidth = getViewportWidth();
- int leftScreen = 0;
- int rightScreen = 0;
+ int curScreen = 0;
- for (leftScreen = getNextPage(); leftScreen >= 0; --leftScreen) {
- View currPage = getPageAt(leftScreen);
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ View currPage = getPageAt(i);
- // Check if the right edge of the page is in the viewport
+ mTmpIntPoint[0] = 0;
+ Utilities.getDescendantCoordRelativeToParent(currPage, this, mTmpIntPoint, false);
+ if (mTmpIntPoint[0] > viewportWidth) {
+ if (range[0] == -1) {
+ continue;
+ } else {
+ break;
+ }
+ }
+
mTmpIntPoint[0] = currPage.getMeasuredWidth();
Utilities.getDescendantCoordRelativeToParent(currPage, this, mTmpIntPoint, false);
if (mTmpIntPoint[0] < 0) {
- break;
+ if (range[0] == -1) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ curScreen = i;
+ if (range[0] < 0) {
+ range[0] = curScreen;
}
}
- for (rightScreen = getNextPage(); rightScreen < getChildCount(); ++rightScreen) {
- View currPage = getPageAt(rightScreen);
- // Check if the left edge of the page is in the viewport
- mTmpIntPoint[0] = 0;
- Utilities.getDescendantCoordRelativeToParent(currPage, this, mTmpIntPoint, false);
- if (mTmpIntPoint[0] >= viewportWidth) {
- break;
- }
- }
- range[0] = Math.max(0, leftScreen);
- range[1] = Math.min(rightScreen, getChildCount() - 1);
+ range[1] = curScreen;
} else {
range[0] = -1;
range[1] = -1;
@@ -1558,8 +1566,13 @@
if (!mFreeScroll) {
snapToPage(snapPage);
} else {
- mFreeScrollMinScrollX = getScrollForPage(mTempVisiblePagesRange[0]);
- mFreeScrollMaxScrollX = getScrollForPage(mTempVisiblePagesRange[1]);
+ if (isLayoutRtl()) {
+ mFreeScrollMinScrollX = getScrollForPage(mTempVisiblePagesRange[1]);
+ mFreeScrollMaxScrollX = getScrollForPage(mTempVisiblePagesRange[0]);
+ } else {
+ mFreeScrollMinScrollX = getScrollForPage(mTempVisiblePagesRange[0]);
+ mFreeScrollMaxScrollX = getScrollForPage(mTempVisiblePagesRange[1]);
+ }
if (getCurrentPage() < mTempVisiblePagesRange[0]) {
setCurrentPage(mTempVisiblePagesRange[0]);
diff --git a/src/com/android/launcher3/PagedViewIcon.java b/src/com/android/launcher3/PagedViewIcon.java
index fa9ec5a..c6d5e49 100644
--- a/src/com/android/launcher3/PagedViewIcon.java
+++ b/src/com/android/launcher3/PagedViewIcon.java
@@ -18,6 +18,9 @@
import android.content.Context;
import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Region;
+import android.graphics.Region.Op;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.TextView;
@@ -99,4 +102,27 @@
setAlpha(1f);
}
}
+
+ @Override
+ public void draw(Canvas canvas) {
+ // If text is transparent, don't draw any shadow
+ if (getCurrentTextColor() == getResources().getColor(android.R.color.transparent)) {
+ getPaint().clearShadowLayer();
+ super.draw(canvas);
+ return;
+ }
+
+ // We enhance the shadow by drawing the shadow twice
+ getPaint().setShadowLayer(BubbleTextView.SHADOW_LARGE_RADIUS, 0.0f,
+ BubbleTextView.SHADOW_Y_OFFSET, BubbleTextView.SHADOW_LARGE_COLOUR);
+ super.draw(canvas);
+ canvas.save(Canvas.CLIP_SAVE_FLAG);
+ canvas.clipRect(getScrollX(), getScrollY() + getExtendedPaddingTop(),
+ getScrollX() + getWidth(),
+ getScrollY() + getHeight(), Region.Op.INTERSECT);
+ getPaint().setShadowLayer(BubbleTextView.SHADOW_SMALL_RADIUS, 0.0f, 0.0f,
+ BubbleTextView.SHADOW_SMALL_COLOUR);
+ super.draw(canvas);
+ canvas.restore();
+ }
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index aab0a63..ada41a0 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -933,8 +933,9 @@
boolean passRightSwipesToCustomContent =
(mTouchDownTime - mCustomContentShowTime) > CUSTOM_CONTENT_GESTURE_DELAY;
- if (deltaX > 0 && getScreenIdForPageIndex(getCurrentPage()) == CUSTOM_CONTENT_SCREEN_ID
- && passRightSwipesToCustomContent) {
+ boolean swipeInIgnoreDirection = isLayoutRtl() ? deltaX < 0 : deltaX > 0;
+ if (swipeInIgnoreDirection && getScreenIdForPageIndex(getCurrentPage()) ==
+ CUSTOM_CONTENT_SCREEN_ID && passRightSwipesToCustomContent) {
// Pass swipes to the right to the custom content page.
return;
}
@@ -1363,9 +1364,15 @@
if (hasCustomContent()) {
int index = mScreenOrder.indexOf(CUSTOM_CONTENT_SCREEN_ID);
int scrollDelta = getScrollForPage(index + 1) - getScrollX();
- translationX = Math.max(scrollDelta, 0);
+ translationX = scrollDelta;
progress = (1.0f * scrollDelta) /
(getScrollForPage(index + 1) - getScrollForPage(index));
+
+ if (isLayoutRtl()) {
+ translationX = Math.min(0, translationX);
+ } else {
+ translationX = Math.max(0, translationX);
+ }
progress = Math.max(0, progress);
}
@@ -1396,7 +1403,10 @@
updateStateForCustomContent(screenCenter);
enableHwLayersOnVisiblePages();
- if ((mOverScrollX < 0 && !hasCustomContent()) || mOverScrollX > mMaxScrollX) {
+ boolean shouldOverScroll = (mOverScrollX < 0 && (!hasCustomContent() || isLayoutRtl())) ||
+ (mOverScrollX > mMaxScrollX && (!hasCustomContent() || !isLayoutRtl()));
+
+ if (shouldOverScroll) {
int index = 0;
float pivotX = 0f;
final float leftBiasedPivot = 0.25f;
@@ -1836,10 +1846,10 @@
final boolean stateIsSpringLoaded = (state == State.SPRING_LOADED);
final boolean stateIsSmall = (state == State.SMALL);
final boolean stateIsOverview = (state == State.OVERVIEW);
- float finalBackgroundAlpha = stateIsSpringLoaded ? 1.0f : 0f;
+ float finalBackgroundAlpha = (stateIsSpringLoaded || stateIsOverview) ? 1.0f : 0f;
float finalHotseatAndPageIndicatorAlpha = (stateIsOverview || stateIsSmall) ? 0f : 1f;
float finalOverviewPanelAlpha = stateIsOverview ? 1f : 0f;
- float finalSearchBarAlpha = stateIsOverview ? 0f : 1f;
+ float finalSearchBarAlpha = !stateIsNormal ? 0f : 1f;
float finalWorkspaceTranslationY = stateIsOverview ? getOverviewModeTranslationY() : 0;
boolean zoomIn = true;
@@ -1857,13 +1867,11 @@
} else if (stateIsOverview) {
mNewScale = mOverviewModeShrinkFactor;
} else if (stateIsSmall){
- mNewScale = mOverviewModeShrinkFactor - 0.1f;
+ mNewScale = mOverviewModeShrinkFactor - 0.3f;
}
if (oldStateIsNormal && stateIsSmall) {
zoomIn = false;
updateChildrenLayersEnabled(false);
- } else {
- finalBackgroundAlpha = 1.0f;
}
}
final int duration = zoomIn ?
@@ -1871,24 +1879,9 @@
getResources().getInteger(R.integer.config_appsCustomizeWorkspaceShrinkTime);
for (int i = 0; i < getChildCount(); i++) {
final CellLayout cl = (CellLayout) getChildAt(i);
- float finalAlpha = (!mWorkspaceFadeInAdjacentScreens || stateIsSpringLoaded ||
- (i == mCurrentPage)) ? 1f : 0f;
- float currentAlpha = cl.getShortcutsAndWidgets().getAlpha();
- float initialAlpha = currentAlpha;
-
- // Determine the pages alpha during the state transition
- if ((oldStateIsSmall && stateIsNormal) ||
- (oldStateIsNormal && stateIsSmall)) {
- // To/from workspace - only show the current page unless the transition is not
- // animated and the animation end callback below doesn't run;
- // or, if we're in spring-loaded mode
- if (i == mCurrentPage || !animated || oldStateIsSpringLoaded) {
- finalAlpha = 1f;
- } else {
- initialAlpha = 0f;
- finalAlpha = 0f;
- }
- }
+ float finalAlpha = (!mWorkspaceFadeInAdjacentScreens ||
+ (i == mCurrentPage)) && !stateIsSmall ? 1f : 0f;
+ float initialAlpha = cl.getShortcutsAndWidgets().getAlpha();
mOldAlphas[i] = initialAlpha;
mNewAlphas[i] = finalAlpha;
@@ -1901,7 +1894,9 @@
}
}
- View searchBar = mLauncher.getQsbBar();
+ final View searchBar = mLauncher.getQsbBar();
+ final View overviewPanel = mLauncher.getOverviewPanel();
+ final View hotseat = mLauncher.getHotseat();
if (animated) {
LauncherViewPropertyAnimator scale = new LauncherViewPropertyAnimator(this);
scale.scaleX(mNewScale)
@@ -1917,7 +1912,6 @@
cl.setBackgroundAlpha(mNewBackgroundAlphas[i]);
cl.setShortcutAndWidgetAlpha(mNewAlphas[i]);
} else {
-
if (mOldAlphas[i] != mNewAlphas[i] || currentAlpha != mNewAlphas[i]) {
LauncherViewPropertyAnimator alphaAnim =
new LauncherViewPropertyAnimator(cl.getShortcutsAndWidgets());
@@ -1947,29 +1941,32 @@
pageIndicatorAlpha = ObjectAnimator.ofFloat(getPageIndicator(), "alpha",
finalHotseatAndPageIndicatorAlpha);
}
- ObjectAnimator hotseatAlpha = ObjectAnimator.ofFloat(mLauncher.getHotseat(), "alpha",
+ ObjectAnimator hotseatAlpha = ObjectAnimator.ofFloat(hotseat, "alpha",
finalHotseatAndPageIndicatorAlpha);
ObjectAnimator searchBarAlpha = ObjectAnimator.ofFloat(searchBar,
"alpha", finalSearchBarAlpha);
- ObjectAnimator overviewPanelAlpha = ObjectAnimator.ofFloat(mLauncher.getOverviewPanel(),
+ ObjectAnimator overviewPanelAlpha = ObjectAnimator.ofFloat(overviewPanel,
"alpha", finalOverviewPanelAlpha);
- overviewPanelAlpha.addUpdateListener(new AlphaUpdateListener(
- mLauncher.getOverviewPanel()));
- hotseatAlpha.addUpdateListener(new AlphaUpdateListener(mLauncher.getHotseat()));
+
+ overviewPanelAlpha.addUpdateListener(new AlphaUpdateListener(overviewPanel));
+ hotseatAlpha.addUpdateListener(new AlphaUpdateListener(hotseat));
searchBarAlpha.addUpdateListener(new AlphaUpdateListener(searchBar));
+
if (getPageIndicator() != null) {
pageIndicatorAlpha.addUpdateListener(new AlphaUpdateListener(getPageIndicator()));
}
+
+
anim.play(overviewPanelAlpha);
anim.play(hotseatAlpha);
anim.play(searchBarAlpha);
anim.play(pageIndicatorAlpha);
anim.setStartDelay(delay);
} else {
- mLauncher.getOverviewPanel().setAlpha(finalOverviewPanelAlpha);
- AlphaUpdateListener.updateVisibility(mLauncher.getOverviewPanel());
- mLauncher.getHotseat().setAlpha(finalHotseatAndPageIndicatorAlpha);
- AlphaUpdateListener.updateVisibility(mLauncher.getHotseat());
+ overviewPanel.setAlpha(finalOverviewPanelAlpha);
+ AlphaUpdateListener.updateVisibility(overviewPanel);
+ hotseat.setAlpha(finalHotseatAndPageIndicatorAlpha);
+ AlphaUpdateListener.updateVisibility(hotseat);
if (getPageIndicator() != null) {
getPageIndicator().setAlpha(finalHotseatAndPageIndicatorAlpha);
AlphaUpdateListener.updateVisibility(getPageIndicator());
@@ -2917,7 +2914,10 @@
mTempPt[0] = x;
mTempPt[1] = y;
mLauncher.getDragLayer().getDescendantCoordRelativeToSelf(this, mTempPt, true);
- mLauncher.getHotseat().getHitRect(r);
+
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+ r = grid.getHotseatRect();
if (r.contains(mTempPt[0], mTempPt[1])) {
return true;
}