diff --git a/core/res/res/layout-land/keyguard_host_view.xml b/core/res/res/layout-land/keyguard_host_view.xml
index 980f6990b1a4c..bb455bdecbba0 100644
--- a/core/res/res/layout-land/keyguard_host_view.xml
+++ b/core/res/res/layout-land/keyguard_host_view.xml
@@ -34,13 +34,13 @@
android:clipChildren="false">
-
+ android:id="@+id/app_widget_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ androidprv:layout_centerWithinArea="0.55"
+ androidprv:layout_childType="widget"
+ androidprv:layout_maxWidth="480dp"
+ androidprv:layout_maxHeight="480dp" />
+
+
+
+
+
diff --git a/core/res/res/layout-port/keyguard_host_view.xml b/core/res/res/layout-port/keyguard_host_view.xml
index ccc1692861a0c..15e984443092d 100644
--- a/core/res/res/layout-port/keyguard_host_view.xml
+++ b/core/res/res/layout-port/keyguard_host_view.xml
@@ -39,9 +39,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+ android:id="@+id/app_widget_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"/>
+ android:id="@+id/app_widget_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ androidprv:layout_centerWithinArea="0.55"
+ androidprv:layout_childType="widget"
+ androidprv:layout_maxWidth="480dp"
+ androidprv:layout_maxHeight="480dp" />
diff --git a/core/res/res/values-sw600dp/integers.xml b/core/res/res/values-sw600dp/integers.xml
new file mode 100644
index 0000000000000..de9829c2cf958
--- /dev/null
+++ b/core/res/res/values-sw600dp/integers.xml
@@ -0,0 +1,21 @@
+
+
+
+ 60
+
diff --git a/core/res/res/values/integers.xml b/core/res/res/values/integers.xml
index 6d49a91e4d26f..91ad5d8eecf17 100644
--- a/core/res/res/values/integers.xml
+++ b/core/res/res/values/integers.xml
@@ -17,6 +17,7 @@
*/
-->
+ 75
75
75
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index f697d65e2f6a6..60a2e9139cf51 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1335,6 +1335,7 @@
+
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetCarousel.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetCarousel.java
new file mode 100644
index 0000000000000..02c32d4d6e327
--- /dev/null
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetCarousel.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+package com.android.internal.policy.impl.keyguard;
+
+import android.content.Context;
+import android.util.AttributeSet;
+
+import com.android.internal.R;
+
+public class KeyguardWidgetCarousel extends KeyguardWidgetPager {
+
+ private float mAdjacentPagesAngle;
+ private static float CAMERA_DISTANCE = 10000;
+
+ public KeyguardWidgetCarousel(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public KeyguardWidgetCarousel(Context context) {
+ this(context, null, 0);
+ }
+
+ public KeyguardWidgetCarousel(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ mAdjacentPagesAngle = context.getResources().getInteger(R.integer.kg_carousel_angle);
+ }
+
+ protected float getMaxScrollProgress() {
+ return 1.5f;
+ }
+
+ private void updatePageAlphaValues(int screenCenter) {
+ boolean isInOverscroll = mOverScrollX < 0 || mOverScrollX > mMaxScrollX;
+ if (!isInOverscroll) {
+ for (int i = 0; i < getChildCount(); i++) {
+ KeyguardWidgetFrame child = getWidgetPageAt(i);
+ if (child != null) {
+ float scrollProgress = getScrollProgress(screenCenter, child, i);
+ if (!isReordering(false)) {
+ child.setBackgroundAlphaMultiplier(
+ backgroundAlphaInterpolator(Math.abs(scrollProgress)));
+ } else {
+ child.setBackgroundAlphaMultiplier(1f);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void screenScrolled(int screenCenter) {
+ updatePageAlphaValues(screenCenter);
+ for (int i = 0; i < getChildCount(); i++) {
+ KeyguardWidgetFrame v = getWidgetPageAt(i);
+ if (v == mDragView) continue;
+ if (v != null) {
+ float scrollProgress = getScrollProgress(screenCenter, v, i);
+ int width = v.getMeasuredWidth();
+ float pivotX = (width / 2f) + scrollProgress * (width / 2f);
+ float pivotY = v.getMeasuredHeight() / 2;
+ float rotationY = - mAdjacentPagesAngle * scrollProgress;
+ v.setCameraDistance(CAMERA_DISTANCE);
+ v.setPivotX(pivotX);
+ v.setPivotY(pivotY);
+ v.setRotationY(rotationY);
+ }
+ }
+ }
+}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java
index 612b8e0b950de..49bc4a14113da 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java
@@ -37,12 +37,9 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
ZInterpolator mZInterpolator = new ZInterpolator(0.5f);
private static float CAMERA_DISTANCE = 10000;
- private static float TRANSITION_SCALE_FACTOR = 0.74f;
- private static float TRANSITION_PIVOT = 0.65f;
private static float TRANSITION_MAX_ROTATION = 30;
private static final boolean PERFORM_OVERSCROLL_ROTATION = true;
- private AccelerateInterpolator mAlphaInterpolator = new AccelerateInterpolator(0.9f);
- private DecelerateInterpolator mLeftScreenAlphaInterpolator = new DecelerateInterpolator(4);
+
private KeyguardViewStateManager mViewStateManager;
private LockPatternUtils mLockPatternUtils;
@@ -56,7 +53,6 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
private float mSidePagesAlpha = 1f;
private static final long CUSTOM_WIDGET_USER_ACTIVITY_TIMEOUT = 30000;
- private static final boolean CAFETERIA_TRAY = false;
private int mPage = 0;
private Callbacks mCallbacks;
@@ -317,7 +313,7 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
}
float backgroundAlphaInterpolator(float r) {
- return r;
+ return Math.min(1f, r);
}
private void updatePageAlphaValues(int screenCenter) {
@@ -327,7 +323,6 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
KeyguardWidgetFrame child = getWidgetPageAt(i);
if (child != null) {
float scrollProgress = getScrollProgress(screenCenter, child, i);
- // TODO: Set content alpha
if (!isReordering(false)) {
child.setBackgroundAlphaMultiplier(
backgroundAlphaInterpolator(Math.abs(scrollProgress)));
@@ -339,73 +334,37 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
}
}
- // In apps customize, we have a scrolling effect which emulates pulling cards off of a stack.
@Override
protected void screenScrolled(int screenCenter) {
- super.screenScrolled(screenCenter);
updatePageAlphaValues(screenCenter);
for (int i = 0; i < getChildCount(); i++) {
KeyguardWidgetFrame v = getWidgetPageAt(i);
if (v == mDragView) continue;
if (v != null) {
float scrollProgress = getScrollProgress(screenCenter, v, i);
- float interpolatedProgress =
- mZInterpolator.getInterpolation(Math.abs(Math.min(scrollProgress, 0)));
- float scale = 1.0f;
- float translationX = 0;
float alpha = 1.0f;
- if (CAFETERIA_TRAY) {
- scale = (1 - interpolatedProgress) +
- interpolatedProgress * TRANSITION_SCALE_FACTOR;
- translationX = Math.min(0, scrollProgress) * v.getMeasuredWidth();
-
- if (scrollProgress < 0) {
- alpha = scrollProgress < 0 ? mAlphaInterpolator.getInterpolation(
- 1 - Math.abs(scrollProgress)) : 1.0f;
- } else {
- // On large screens we need to fade the page as it nears its leftmost position
- alpha = mLeftScreenAlphaInterpolator.getInterpolation(1 - scrollProgress);
- }
- }
-
v.setCameraDistance(mDensity * CAMERA_DISTANCE);
- int pageWidth = v.getMeasuredWidth();
- int pageHeight = v.getMeasuredHeight();
if (PERFORM_OVERSCROLL_ROTATION) {
if (i == 0 && scrollProgress < 0) {
- // Overscroll to the left
- v.setPivotX(TRANSITION_PIVOT * pageWidth);
+ // Over scroll to the left
v.setRotationY(-TRANSITION_MAX_ROTATION * scrollProgress);
v.setOverScrollAmount(Math.abs(scrollProgress), true);
- scale = 1.0f;
alpha = 1.0f;
// On the first page, we don't want the page to have any lateral motion
- translationX = 0;
} else if (i == getChildCount() - 1 && scrollProgress > 0) {
- // Overscroll to the right
- v.setPivotX((1 - TRANSITION_PIVOT) * pageWidth);
+ // Over scroll to the right
v.setRotationY(-TRANSITION_MAX_ROTATION * scrollProgress);
- scale = 1.0f;
alpha = 1.0f;
v.setOverScrollAmount(Math.abs(scrollProgress), false);
// On the last page, we don't want the page to have any lateral motion.
- translationX = 0;
} else {
- v.setPivotY(pageHeight / 2.0f);
- v.setPivotX(pageWidth / 2.0f);
v.setRotationY(0f);
v.setOverScrollAmount(0, false);
}
}
-
- if (CAFETERIA_TRAY) {
- v.setTranslationX(translationX);
- v.setScaleX(scale);
- v.setScaleY(scale);
- }
v.setAlpha(alpha);
// If the view has 0 alpha, we set it to be invisible so as to prevent
@@ -418,7 +377,6 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
}
}
}
-
@Override
protected void onStartReordering() {
super.onStartReordering();
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java b/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java
index bf29a5534c84e..754a8985a20f3 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java
@@ -696,22 +696,6 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
protected void screenScrolled(int screenCenter) {
- if (isScrollingIndicatorEnabled()) {
- updateScrollingIndicator();
- }
- boolean isInOverscroll = mOverScrollX < 0 || mOverScrollX > mMaxScrollX;
-
- if (mFadeInAdjacentScreens && !isInOverscroll) {
- for (int i = 0; i < getChildCount(); i++) {
- View child = getChildAt(i);
- if (child != null && child != mDragView) {
- float scrollProgress = getScrollProgress(screenCenter, child, i);
- float alpha = 1 - Math.abs(scrollProgress);
- child.setAlpha(alpha);
- }
- }
- invalidate();
- }
}
@Override
@@ -1164,6 +1148,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
}
+ protected float getMaxScrollProgress() {
+ return 1.0f;
+ }
+
protected float getScrollProgress(int screenCenter, View v, int page) {
final int halfScreenSize = getMinScaledMeasuredWidth() / 2;
@@ -1172,8 +1160,8 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
getRelativeChildOffset(page) + halfScreenSize);
float scrollProgress = delta / (totalDistance * 1.0f);
- scrollProgress = Math.min(scrollProgress, 1.0f);
- scrollProgress = Math.max(scrollProgress, -1.0f);
+ scrollProgress = Math.min(scrollProgress, getMaxScrollProgress());
+ scrollProgress = Math.max(scrollProgress, - getMaxScrollProgress());
return scrollProgress;
}