summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/res/res/layout/keyguard_widget_remove_drop_target.xml3
-rw-r--r--core/res/res/values-land/bools.xml1
-rw-r--r--core/res/res/values-sw600dp/bools.xml1
-rw-r--r--core/res/res/values/bools.xml1
-rw-r--r--core/res/res/values/strings.xml2
-rw-r--r--core/res/res/values/symbols.xml1
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java6
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java40
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java48
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/PagedView.java16
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java2
11 files changed, 104 insertions, 17 deletions
diff --git a/core/res/res/layout/keyguard_widget_remove_drop_target.xml b/core/res/res/layout/keyguard_widget_remove_drop_target.xml
index c4fe9e0fe501..f9f40abdc27a 100644
--- a/core/res/res/layout/keyguard_widget_remove_drop_target.xml
+++ b/core/res/res/layout/keyguard_widget_remove_drop_target.xml
@@ -24,9 +24,10 @@
android:paddingRight="40dp"
android:drawableLeft="@drawable/kg_widget_delete_drop_target"
android:drawablePadding="4dp"
+ android:text="@string/kg_reordering_delete_drop_target_text"
android:textColor="#FFF"
android:textSize="13sp"
android:shadowColor="#000"
android:shadowDy="1.0"
android:shadowRadius="1.0"
- android:visibility="gone" /> \ No newline at end of file
+ android:visibility="gone" />
diff --git a/core/res/res/values-land/bools.xml b/core/res/res/values-land/bools.xml
index 85c64d939afe..a1dd2e46fec6 100644
--- a/core/res/res/values-land/bools.xml
+++ b/core/res/res/values-land/bools.xml
@@ -16,6 +16,7 @@
<resources>
<bool name="kg_enable_camera_default_widget">false</bool>
+ <bool name="kg_top_align_page_shrink_on_bouncer_visible">true</bool>
<bool name="kg_share_status_area">false</bool>
<bool name="kg_sim_puk_account_full_screen">false</bool>
</resources>
diff --git a/core/res/res/values-sw600dp/bools.xml b/core/res/res/values-sw600dp/bools.xml
index 72731f1ba343..00f45c1512a2 100644
--- a/core/res/res/values-sw600dp/bools.xml
+++ b/core/res/res/values-sw600dp/bools.xml
@@ -22,4 +22,5 @@
<!-- No camera for you, tablet user -->
<bool name="kg_enable_camera_default_widget">false</bool>
<bool name="kg_center_small_widgets_vertically">true</bool>
+ <bool name="kg_top_align_page_shrink_on_bouncer_visible">false</bool>
</resources>
diff --git a/core/res/res/values/bools.xml b/core/res/res/values/bools.xml
index b5a902320215..457131a4f84a 100644
--- a/core/res/res/values/bools.xml
+++ b/core/res/res/values/bools.xml
@@ -17,6 +17,7 @@
<resources>
<bool name="kg_enable_camera_default_widget">true</bool>
<bool name="kg_center_small_widgets_vertically">false</bool>
+ <bool name="kg_top_align_page_shrink_on_bouncer_visible">true</bool>
<bool name="action_bar_embed_tabs">true</bool>
<bool name="action_bar_embed_tabs_pre_jb">false</bool>
<bool name="split_action_bar_is_narrow">true</bool>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index caa8f02b3e60..a121927614c0 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -3972,6 +3972,8 @@
<!-- Sequence of characters used to separate message strings in keyguard. Typically just em-dash
with spaces on either side. [CHAR LIMIT=3] -->
<string name="kg_text_message_separator" product="default"> \u2014 </string>
+ <!-- The delete-widget drop target button text -->
+ <string name="kg_reordering_delete_drop_target_text">Remove</string>
<!-- Message shown in dialog when user is attempting to set the music volume above the
recommended maximum level for headphones -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index cd7cb8f9684c..5ebefbd63ce3 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1215,6 +1215,7 @@
<java-symbol type="bool" name="kg_enable_camera_default_widget" />
<java-symbol type="bool" name="kg_share_status_area" />
<java-symbol type="bool" name="kg_sim_puk_account_full_screen" />
+ <java-symbol type="bool" name="kg_top_align_page_shrink_on_bouncer_visible" />
<java-symbol type="bool" name="target_honeycomb_needs_options_menu" />
<java-symbol type="bool" name="kg_center_small_widgets_vertically" />
<java-symbol type="color" name="kg_multi_user_text_active" />
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
index d28656410d99..ad39e53cd587 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -165,9 +165,11 @@ public class KeyguardHostView extends KeyguardViewBase {
mAppWidgetContainer.setViewStateManager(mViewStateManager);
mAppWidgetContainer.setLockPatternUtils(mLockPatternUtils);
+ ChallengeLayout challenge = slider != null ? slider :
+ (ChallengeLayout) findViewById(R.id.multi_pane_challenge);
+ challenge.setOnBouncerStateChangedListener(mViewStateManager);
mViewStateManager.setPagedView(mAppWidgetContainer);
- mViewStateManager.setChallengeLayout(slider != null ? slider :
- (ChallengeLayout) findViewById(R.id.multi_pane_challenge));
+ mViewStateManager.setChallengeLayout(challenge);
mSecurityViewContainer = (KeyguardSecurityViewFlipper) findViewById(R.id.view_flipper);
mKeyguardSelectorView = (KeyguardSelectorView) findViewById(R.id.keyguard_selector_view);
mViewStateManager.setSecurityViewContainer(mSecurityViewContainer);
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
index ddded8e125dc..7d43d80eb038 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
@@ -19,7 +19,9 @@ import android.os.Handler;
import android.os.Looper;
import android.view.View;
-public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChallengeScrolledListener {
+public class KeyguardViewStateManager implements
+ SlidingChallengeLayout.OnChallengeScrolledListener,
+ ChallengeLayout.OnBouncerStateChangedListener {
private KeyguardWidgetPager mPagedView;
private ChallengeLayout mChallengeLayout;
@@ -164,6 +166,7 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle
@Override
public void onScrollStateChanged(int scrollState) {
if (mPagedView == null || mChallengeLayout == null) return;
+
boolean challengeOverlapping = mChallengeLayout.isChallengeOverlapping();
if (scrollState == SlidingChallengeLayout.SCROLL_STATE_IDLE) {
@@ -195,15 +198,24 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle
KeyguardWidgetFrame frame = mPagedView.getWidgetPageAt(mPageListeningToSlider);
if (frame == null) return;
- frame.showFrame(this);
-
- // As soon as the security begins sliding, the widget becomes small (if it wasn't
- // small to begin with).
- if (!frame.isSmall()) {
- // We need to fetch the final page, in case the pages are in motion.
- mPageListeningToSlider = mPagedView.getNextPage();
- frame.shrinkWidget();
+ // Skip showing the frame and shrinking the widget if we are
+ if (!mChallengeLayout.isBouncing()) {
+ frame.showFrame(this);
+
+ // As soon as the security begins sliding, the widget becomes small (if it wasn't
+ // small to begin with).
+ if (!frame.isSmall()) {
+ // We need to fetch the final page, in case the pages are in motion.
+ mPageListeningToSlider = mPagedView.getNextPage();
+ frame.shrinkWidget();
+ }
+ } else {
+ if (!frame.isSmall()) {
+ // We need to fetch the final page, in case the pages are in motion.
+ mPageListeningToSlider = mPagedView.getNextPage();
+ }
}
+
// View is on the move. Pause the security view until it completes.
mKeyguardSecurityContainer.onPause();
}
@@ -245,4 +257,14 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle
public int getTransportState() {
return mTransportState;
}
+
+ // ChallengeLayout.OnBouncerStateChangedListener
+ @Override
+ public void onBouncerStateChanged(boolean bouncerActive) {
+ if (bouncerActive) {
+ mPagedView.zoomOutToBouncer();
+ } else {
+ mPagedView.zoomInFromBouncer();
+ }
+ }
}
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 6fba09959207..493ab920d0c5 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java
@@ -44,7 +44,7 @@ import com.android.internal.widget.LockPatternUtils;
import java.util.ArrayList;
public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwitchListener,
- OnLongClickListener {
+ OnLongClickListener, ChallengeLayout.OnBouncerStateChangedListener {
ZInterpolator mZInterpolator = new ZInterpolator(0.5f);
private static float CAMERA_DISTANCE = 10000;
@@ -74,6 +74,10 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
private boolean mCameraWidgetEnabled;
+ // Bouncer
+ protected int BOUNCER_ZOOM_IN_OUT_DURATION = 250;
+ private float BOUNCER_SCALE_FACTOR = 0.67f;
+
// Background threads to deal with persistence
private HandlerThread mBgPersistenceWorkerThread;
private Handler mBgPersistenceWorkerHandler;
@@ -729,4 +733,46 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
KeyguardWidgetFrame child = getWidgetPageAt(viewIndex);
child.setIsHoveringOverDeleteDropTarget(isHovering);
}
+
+ // ChallengeLayout.OnBouncerStateChangedListener
+ @Override
+ public void onBouncerStateChanged(boolean bouncerActive) {
+ if (bouncerActive) {
+ zoomOutToBouncer();
+ } else {
+ zoomInFromBouncer();
+ }
+ }
+
+ // Zoom in after the bouncer is dismissed
+ void zoomInFromBouncer() {
+ if (mZoomInOutAnim != null && mZoomInOutAnim.isRunning()) {
+ mZoomInOutAnim.cancel();
+ }
+ final View currentPage = getPageAt(getCurrentPage());
+ if (currentPage.getScaleX() < 1f || currentPage.getScaleY() < 1f) {
+ mZoomInOutAnim = new AnimatorSet();
+ mZoomInOutAnim.setDuration(BOUNCER_ZOOM_IN_OUT_DURATION);
+ mZoomInOutAnim.playTogether(
+ ObjectAnimator.ofFloat(currentPage, "scaleX", 1f),
+ ObjectAnimator.ofFloat(currentPage , "scaleY", 1f));
+ mZoomInOutAnim.start();
+ }
+ }
+
+ // Zoom out after the bouncer is initiated
+ void zoomOutToBouncer() {
+ if (mZoomInOutAnim != null && mZoomInOutAnim.isRunning()) {
+ mZoomInOutAnim.cancel();
+ }
+ View currentPage = getPageAt(getCurrentPage());
+ if (!(currentPage.getScaleX() < 1f || currentPage.getScaleY() < 1f)) {
+ mZoomInOutAnim = new AnimatorSet();
+ mZoomInOutAnim.setDuration(BOUNCER_ZOOM_IN_OUT_DURATION);
+ mZoomInOutAnim.playTogether(
+ ObjectAnimator.ofFloat(currentPage, "scaleX", BOUNCER_SCALE_FACTOR),
+ ObjectAnimator.ofFloat(currentPage, "scaleY", BOUNCER_SCALE_FACTOR));
+ mZoomInOutAnim.start();
+ }
+ }
}
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 00a0aede5809..8f4757807205 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java
@@ -24,6 +24,7 @@ import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
+import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Matrix;
@@ -209,7 +210,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
private long REORDERING_DELETE_DROP_TARGET_FADE_DURATION = 150;
private float mMinScale = 1f;
protected View mDragView;
- private AnimatorSet mZoomInOutAnim;
+ protected AnimatorSet mZoomInOutAnim;
private Runnable mSidePageHoverRunnable;
private int mSidePageHoverIndex = -1;
// This variable's scope is only for the duration of startReordering() and endReordering()
@@ -246,6 +247,9 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
// Drop to delete
private View mDeleteDropTarget;
+ // Bouncer
+ private boolean mTopAlignPageWhenShrinkingForBouncer = false;
+
public interface PageSwitchListener {
void onPageSwitching(View newPage, int newPageIndex);
void onPageSwitched(View newPage, int newPageIndex);
@@ -270,8 +274,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
a.getDimensionPixelSize(R.styleable.PagedView_scrollIndicatorPaddingRight, 0);
a.recycle();
- mEdgeSwipeRegionSize =
- getResources().getDimensionPixelSize(R.dimen.kg_edge_swipe_region_size);
+ Resources r = getResources();
+ mEdgeSwipeRegionSize = r.getDimensionPixelSize(R.dimen.kg_edge_swipe_region_size);
+ mTopAlignPageWhenShrinkingForBouncer =
+ r.getBoolean(R.bool.kg_top_align_page_shrink_on_bouncer_visible);
setHapticFeedbackEnabled(false);
init();
@@ -645,6 +651,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
MeasureSpec.makeMeasureSpec(heightSize - verticalPadding, childHeightMode);
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
+ if (mTopAlignPageWhenShrinkingForBouncer) {
+ child.setPivotX(child.getWidth() / 2);
+ child.setPivotY(0f);
+ }
}
setMeasuredDimension(scaledWidthSize, scaledHeightSize);
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java b/policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java
index 16d5728c3ed1..d7d91a3705b3 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java
@@ -518,8 +518,8 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
@Override
public void showBouncer() {
if (mIsBouncing) return;
- showChallenge(true);
mIsBouncing = true;
+ showChallenge(true);
if (mScrimView != null) {
mScrimView.setVisibility(VISIBLE);
}