Merge "Don't handle click events on the emergency button in bouncer mode" into jb-mr1-lockscreen-dev
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 030dfef..75fef24 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -1167,6 +1167,10 @@
public boolean removeAppWidget(int widgetId) {
int[] widgets = getAppWidgets();
+ if (widgets.length == 0) {
+ return false;
+ }
+
int[] newWidgets = new int[widgets.length - 1];
for (int i = 0, j = 0; i < widgets.length; i++) {
if (widgets[i] == widgetId) {
@@ -1331,7 +1335,7 @@
public boolean getPowerButtonInstantlyLocks() {
return getBoolean(LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS, true);
}
-
+
public static boolean isSafeModeEnabled() {
try {
return IWindowManager.Stub.asInterface(
diff --git a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
index e4d6d8b..aad285a 100644
--- a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
@@ -114,6 +114,7 @@
private int mMaxTargetHeight;
private int mMaxTargetWidth;
private float mRingScaleFactor = 1f;
+ private boolean mAllowScaling;
private float mOuterRadius = 0.0f;
private float mSnapMargin = 0.0f;
@@ -222,6 +223,7 @@
mVibrationDuration);
mFeedbackCount = a.getInt(R.styleable.GlowPadView_feedbackCount,
mFeedbackCount);
+ mAllowScaling = a.getBoolean(R.styleable.GlowPadView_allowScaling, false);
TypedValue handle = a.peekValue(R.styleable.GlowPadView_handleDrawable);
mHandleDrawable = new TargetDrawable(res, handle != null ? handle.resourceId : 0);
mHandleDrawable.setState(TargetDrawable.STATE_INACTIVE);
@@ -793,8 +795,12 @@
}
private void updateGlowPosition(float x, float y) {
- mPointCloud.glowManager.setX(x);
- mPointCloud.glowManager.setY(y);
+ float dx = x - mOuterRing.getX();
+ float dy = y - mOuterRing.getY();
+ dx *= 1f / mRingScaleFactor;
+ dy *= 1f / mRingScaleFactor;
+ mPointCloud.glowManager.setX(mOuterRing.getX() + dx);
+ mPointCloud.glowManager.setY(mOuterRing.getY() + dy);
}
private void handleDown(MotionEvent event) {
@@ -863,7 +869,7 @@
if (mDragging) {
// For multiple targets, snap to the one that matches
- final float snapRadius = mOuterRadius - mSnapMargin;
+ final float snapRadius = mRingScaleFactor * mOuterRadius - mSnapMargin;
final float snapDistance2 = snapRadius * snapRadius;
// Find first target in range
for (int i = 0; i < ntargets; i++) {
@@ -948,7 +954,8 @@
onTouchEvent(event);
event.setAction(action);
}
- return super.onHoverEvent(event);
+ super.onHoverEvent(event);
+ return true;
}
/**
@@ -1034,6 +1041,10 @@
*/
private float computeScaleFactor(int desiredWidth, int desiredHeight,
int actualWidth, int actualHeight) {
+
+ // Return unity if scaling is not allowed.
+ if (!mAllowScaling) return 1f;
+
final int layoutDirection = getLayoutDirection();
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
diff --git a/core/res/res/drawable-hdpi/kg_widget_bg_padded.9.png b/core/res/res/drawable-hdpi/kg_widget_bg_padded.9.png
new file mode 100644
index 0000000..dff1dfa
--- /dev/null
+++ b/core/res/res/drawable-hdpi/kg_widget_bg_padded.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/kg_widget_bg_padded.9.png b/core/res/res/drawable-mdpi/kg_widget_bg_padded.9.png
new file mode 100644
index 0000000..c313df1
--- /dev/null
+++ b/core/res/res/drawable-mdpi/kg_widget_bg_padded.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/kg_widget_bg_padded.9.png b/core/res/res/drawable-xhdpi/kg_widget_bg_padded.9.png
new file mode 100644
index 0000000..a84bfa3
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/kg_widget_bg_padded.9.png
Binary files differ
diff --git a/core/res/res/layout-land/keyguard_host_view.xml b/core/res/res/layout-land/keyguard_host_view.xml
index 2f67606..6b36235 100644
--- a/core/res/res/layout-land/keyguard_host_view.xml
+++ b/core/res/res/layout-land/keyguard_host_view.xml
@@ -37,7 +37,8 @@
android:id="@+id/keyguard_widget_pager_delete_target"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="top|center_horizontal" />
+ android:layout_gravity="top|center_horizontal"
+ androidprv:layout_childType="pageDeleteDropTarget" />
<include layout="@layout/keyguard_widget_pager"
android:id="@+id/app_widget_container"
diff --git a/core/res/res/layout-land/keyguard_status_area.xml b/core/res/res/layout-land/keyguard_status_area.xml
index f562d9f..51ee740 100644
--- a/core/res/res/layout-land/keyguard_status_area.xml
+++ b/core/res/res/layout-land/keyguard_status_area.xml
@@ -53,43 +53,4 @@
android:drawablePadding="4dip"
/>
- <TextView
- android:id="@+id/owner_info"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="end"
- android:layout_marginTop="4dp"
- android:layout_marginEnd="@dimen/kg_status_line_font_right_margin"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearance"
- android:textSize="@dimen/kg_status_line_font_size"
- />
-
- <TextView
- android:id="@+id/status1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="end"
- android:layout_marginTop="4dp"
- android:layout_marginEnd="@dimen/kg_status_line_font_right_margin"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearance"
- android:textSize="@dimen/kg_status_line_font_size"
- />
-
- <TextView
- android:id="@+id/status_security_message"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:gravity="right"
- android:layout_marginTop="12dp"
- android:singleLine="false"
- android:maxLines="3"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearance"
- android:textSize="16dp"
- />
</LinearLayout>
\ No newline at end of file
diff --git a/core/res/res/layout-port/keyguard_host_view.xml b/core/res/res/layout-port/keyguard_host_view.xml
index 73f07d5..fb25f9c 100644
--- a/core/res/res/layout-port/keyguard_host_view.xml
+++ b/core/res/res/layout-port/keyguard_host_view.xml
@@ -35,7 +35,8 @@
<FrameLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ androidprv:layout_childType="pageDeleteDropTarget">
<include layout="@layout/keyguard_widget_remove_drop_target"
android:id="@+id/keyguard_widget_pager_delete_target"
android:layout_width="wrap_content"
diff --git a/core/res/res/layout-port/keyguard_status_area.xml b/core/res/res/layout-port/keyguard_status_area.xml
index c1f6aab..d274457 100644
--- a/core/res/res/layout-port/keyguard_status_area.xml
+++ b/core/res/res/layout-port/keyguard_status_area.xml
@@ -56,43 +56,4 @@
/>
</LinearLayout>
- <TextView
- android:id="@+id/owner_info"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right"
- android:layout_marginTop="4dp"
- android:layout_marginEnd="@dimen/kg_status_line_font_right_margin"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearance"
- android:textSize="@dimen/kg_status_line_font_size"
- />
-
- <TextView
- android:id="@+id/status1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right"
- android:layout_marginTop="4dp"
- android:layout_marginEnd="@dimen/kg_status_line_font_right_margin"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearance"
- android:textSize="@dimen/kg_status_line_font_size"
- />
-
- <TextView
- android:id="@+id/status_security_message"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right"
- android:layout_marginTop="4dp"
- android:layout_marginEnd="@dimen/kg_status_line_font_right_margin"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearance"
- android:textSize="@dimen/kg_status_line_font_size"
- />
-
</LinearLayout>
diff --git a/core/res/res/layout-sw600dp-port/keyguard_host_view.xml b/core/res/res/layout-sw600dp-port/keyguard_host_view.xml
index a23771b..e3d577d 100644
--- a/core/res/res/layout-sw600dp-port/keyguard_host_view.xml
+++ b/core/res/res/layout-sw600dp-port/keyguard_host_view.xml
@@ -38,7 +38,8 @@
android:id="@+id/keyguard_widget_pager_delete_target"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="top|center_horizontal" />
+ android:layout_gravity="top|center_horizontal"
+ androidprv:layout_childType="pageDeleteDropTarget" />
<include layout="@layout/keyguard_widget_pager"
android:id="@+id/app_widget_container"
diff --git a/core/res/res/layout-sw600dp-port/keyguard_status_area.xml b/core/res/res/layout-sw600dp-port/keyguard_status_area.xml
index 405ac14..88dd760 100644
--- a/core/res/res/layout-sw600dp-port/keyguard_status_area.xml
+++ b/core/res/res/layout-sw600dp-port/keyguard_status_area.xml
@@ -53,29 +53,4 @@
android:drawablePadding="4dip"
/>
- <TextView
- android:id="@+id/owner_info"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="end"
- android:layout_marginTop="4dp"
- android:layout_marginEnd="@dimen/kg_status_line_font_right_margin"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearance"
- android:textSize="@dimen/kg_status_line_font_size"
- />
-
- <TextView
- android:id="@+id/status1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="end"
- android:layout_marginTop="4dp"
- android:layout_marginEnd="@dimen/kg_status_line_font_right_margin"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearance"
- android:textSize="@dimen/kg_status_line_font_size"
- />
</LinearLayout>
diff --git a/core/res/res/layout/keyguard_glow_pad_view.xml b/core/res/res/layout/keyguard_glow_pad_view.xml
index ef1c133..cfd8160 100644
--- a/core/res/res/layout/keyguard_glow_pad_view.xml
+++ b/core/res/res/layout/keyguard_glow_pad_view.xml
@@ -42,4 +42,5 @@
prvandroid:feedbackCount="1"
prvandroid:vibrationDuration="20"
prvandroid:glowRadius="@*android:dimen/glowpadview_glow_radius"
- prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot" />
+ prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot"
+ prvandroid:allowScaling="true" />
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 f9f40ab..294c386 100644
--- a/core/res/res/layout/keyguard_widget_remove_drop_target.xml
+++ b/core/res/res/layout/keyguard_widget_remove_drop_target.xml
@@ -19,9 +19,9 @@
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center"
- android:padding="20dp"
- android:paddingLeft="40dp"
- android:paddingRight="40dp"
+ android:padding="30dp"
+ android:paddingLeft="60dp"
+ android:paddingRight="60dp"
android:drawableLeft="@drawable/kg_widget_delete_drop_target"
android:drawablePadding="4dp"
android:text="@string/kg_reordering_delete_drop_target_text"
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index bd424b1..447daab 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -5484,6 +5484,11 @@
<attr name="magneticTargets" format="boolean" />
<attr name="gravity" />
+
+ <!-- Determine whether the glow pad is allowed to scale to fit the bounds indicated
+ by its parent. If this is set to false, no scaling will occur. If this is set to true
+ scaling will occur to fit for any axis in which gravity is set to center. -->
+ <attr name="allowScaling" format="boolean" />
</declare-styleable>
<!-- =============================== -->
@@ -5815,6 +5820,8 @@
<!-- This is a handle that is used for expanding the
security challenge container when it is collapsed. -->
<enum name="expandChallengeHandle" value="6" />
+ <!-- Delete drop target. This will be the drop target to delete pages. -->
+ <enum name="pageDeleteDropTarget" value="7" />
</attr>
<declare-styleable name="SlidingChallengeLayout_Layout">
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index f2e4d51..86f8665 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1257,7 +1257,7 @@
<java-symbol type="drawable" name="magnified_region_frame" />
<java-symbol type="drawable" name="menu_background" />
<java-symbol type="drawable" name="stat_sys_secure" />
- <java-symbol type="drawable" name="kg_bouncer_bg_white" />
+ <java-symbol type="drawable" name="kg_widget_bg_padded" />
<java-symbol type="id" name="action_mode_bar_stub" />
<java-symbol type="id" name="alarm_status" />
<java-symbol type="id" name="backspace" />
@@ -1343,7 +1343,6 @@
<java-symbol type="id" name="clock_text" />
<java-symbol type="id" name="clock_view" />
<java-symbol type="id" name="keyguard_multi_user_selector" />
- <java-symbol type="id" name="status_security_message" />
<java-symbol type="id" name="sliding_layout" />
<java-symbol type="id" name="keyguard_add_widget" />
<java-symbol type="id" name="keyguard_add_widget_view" />
diff --git a/packages/SystemUI/res/drawable-hdpi/search_light.png b/packages/SystemUI/res/drawable-hdpi/search_light.png
new file mode 100644
index 0000000..c8b5a2e
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/search_light.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/search_light.png b/packages/SystemUI/res/drawable-mdpi/search_light.png
new file mode 100644
index 0000000..4b5b2a4
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/search_light.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/search_light.png b/packages/SystemUI/res/drawable-xhdpi/search_light.png
new file mode 100644
index 0000000..3aa890f
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/search_light.png
Binary files differ
diff --git a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
index afa4cfc..2669c7e 100644
--- a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
+++ b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
@@ -146,7 +146,7 @@
android:id="@+id/search_light"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
- android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:src="@drawable/search_light"
android:scaleType="center"
android:visibility="gone"
/>
@@ -287,7 +287,7 @@
android:id="@+id/search_light"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
- android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:src="@drawable/search_light"
android:scaleType="center"
android:visibility="gone"
/>
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
index 133f79d..440a4e1 100644
--- a/packages/SystemUI/res/layout/navigation_bar.xml
+++ b/packages/SystemUI/res/layout/navigation_bar.xml
@@ -150,7 +150,7 @@
android:id="@+id/search_light"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
- android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:src="@drawable/search_light"
android:scaleType="center"
android:visibility="gone"
/>
@@ -294,7 +294,7 @@
android:layout_height="80dp"
android:layout_width="match_parent"
android:layout_gravity="center_vertical"
- android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:src="@drawable/search_light"
android:scaleType="center"
android:visibility="gone"
/>
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index d733369..54bf20d 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -3899,14 +3899,18 @@
}
public void dismissKeyguardLw() {
- if (mKeyguardMediator.isDismissable()) {
- if (mKeyguardMediator.isShowing()) {
- mHandler.post(new Runnable() {
- public void run() {
+ if (mKeyguardMediator.isShowing()) {
+ mHandler.post(new Runnable() {
+ public void run() {
+ if (mKeyguardMediator.isDismissable()) {
+ // Can we just finish the keyguard straight away?
mKeyguardMediator.keyguardDone(false, true);
+ } else {
+ // ask the keyguard to prompt the user to authenticate if necessary
+ mKeyguardMediator.dismiss();
}
- });
- }
+ }
+ });
}
}
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 83ba6fe..e89888c 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -790,6 +790,9 @@
// Once the screen turns off, we no longer consider this to be first boot and we want the
// biometric unlock to start next time keyguard is shown.
KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true);
+ // We use mAppWidgetToShow to show a particular widget after you add it-- once the screen
+ // turns off we reset that behavior
+ clearAppWidgetToShow();
checkAppWidgetConsistency();
showPrimarySecurityScreen(true);
getSecurityView(mCurrentSecuritySelection).onPause();
@@ -799,6 +802,10 @@
}
}
+ public void clearAppWidgetToShow() {
+ mAppWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID;
+ }
+
@Override
public void show() {
if (DEBUG) Log.d(TAG, "show()");
@@ -1176,6 +1183,7 @@
static class SavedState extends BaseSavedState {
int transportState;
+ int appWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID;
SavedState(Parcelable superState) {
super(superState);
@@ -1184,12 +1192,14 @@
private SavedState(Parcel in) {
super(in);
this.transportState = in.readInt();
+ this.appWidgetToShow = in.readInt();
}
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeInt(this.transportState);
+ out.writeInt(this.appWidgetToShow);
}
public static final Parcelable.Creator<SavedState> CREATOR
@@ -1210,6 +1220,7 @@
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState);
ss.transportState = mViewStateManager.getTransportState();
+ ss.appWidgetToShow = mAppWidgetToShow;
return ss;
}
@@ -1223,6 +1234,7 @@
SavedState ss = (SavedState) state;
super.onRestoreInstanceState(ss.getSuperState());
mViewStateManager.setTransportState(ss.transportState);
+ mAppWidgetToShow = ss.appWidgetToShow;
post(mSwitchPageRunnable);
}
@@ -1275,7 +1287,6 @@
for (int i = 0; i < childCount; i++) {
if (mAppWidgetContainer.getWidgetPageAt(i).getContentAppWidgetId()
== mAppWidgetToShow) {
- mAppWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID;
return i;
}
}
@@ -1300,7 +1311,7 @@
if (!UserManager.supportsMultipleUsers()) {
return; // device doesn't support multi-user mode
}
- UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
+ final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
if (um == null) {
Throwable t = new Throwable();
t.fillInStackTrace();
@@ -1309,7 +1320,7 @@
}
// if there are multiple users, we need to enable to multi-user switcher
- List<UserInfo> users = um.getUsers(true);
+ final List<UserInfo> users = um.getUsers(true);
if (users == null) {
Throwable t = new Throwable();
t.fillInStackTrace();
@@ -1317,8 +1328,15 @@
return;
}
+ final View multiUserView = findViewById(R.id.keyguard_user_selector);
+ if (multiUserView == null) {
+ Throwable t = new Throwable();
+ t.fillInStackTrace();
+ Log.e(TAG, "can't find user_selector in layout.", t);
+ return;
+ }
+
if (users.size() > 1) {
- View multiUserView = findViewById(R.id.keyguard_user_selector);
if (multiUserView instanceof KeyguardMultiUserSelectorView) {
KeyguardMultiUserSelectorView multiUser =
(KeyguardMultiUserSelectorView) multiUserView;
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusView.java
index f2cb522..35b8509 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusView.java
@@ -17,14 +17,52 @@
package com.android.internal.policy.impl.keyguard;
import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Typeface;
+import android.text.TextUtils;
+import android.text.format.DateFormat;
import android.util.AttributeSet;
+import android.util.Slog;
+import android.view.View;
import android.widget.GridLayout;
+import android.widget.TextView;
+import com.android.internal.R;
import com.android.internal.widget.LockPatternUtils;
+import java.util.Date;
+
public class KeyguardStatusView extends GridLayout {
- @SuppressWarnings("unused")
- private KeyguardStatusViewManager mStatusViewManager;
+ private static final boolean DEBUG = KeyguardViewMediator.DEBUG;
+ private static final String TAG = "KeyguardStatusView";
+
+ public static final int LOCK_ICON = 0; // R.drawable.ic_lock_idle_lock;
+ public static final int ALARM_ICON = com.android.internal.R.drawable.ic_lock_idle_alarm;
+ public static final int CHARGING_ICON = 0; //R.drawable.ic_lock_idle_charging;
+ public static final int BATTERY_LOW_ICON = 0; //R.drawable.ic_lock_idle_low_battery;
+
+ private CharSequence mDateFormatString;
+ private LockPatternUtils mLockPatternUtils;
+
+ private TextView mDateView;
+ private TextView mAlarmStatusView;
+ private ClockView mClockView;
+
+ private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
+
+ @Override
+ public void onTimeChanged() {
+ refresh();
+ }
+
+ @Override
+ void onKeyguardVisibilityChanged(boolean showing) {
+ if (showing) {
+ if (DEBUG) Slog.v(TAG, "refresh statusview showing:" + showing);
+ refresh();
+ }
+ };
+ };
public KeyguardStatusView(Context context) {
this(context, null, 0);
@@ -38,19 +76,76 @@
super(context, attrs, defStyle);
}
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ Resources res = getContext().getResources();
+ mDateFormatString =
+ res.getText(com.android.internal.R.string.abbrev_wday_month_day_no_year);
+ mDateView = (TextView) findViewById(R.id.date);
+ mAlarmStatusView = (TextView) findViewById(R.id.alarm_status);
+ mClockView = (ClockView) findViewById(R.id.clock_view);
+ mLockPatternUtils = new LockPatternUtils(getContext());
+
+ // Use custom font in mDateView
+ mDateView.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
+
+ // Required to get Marquee to work.
+ final View marqueeViews[] = { mDateView, mAlarmStatusView };
+ for (int i = 0; i < marqueeViews.length; i++) {
+ View v = marqueeViews[i];
+ if (v == null) {
+ throw new RuntimeException("Can't find widget at index " + i);
+ }
+ v.setSelected(true);
+ }
+ refresh();
+ }
+
+ protected void refresh() {
+ mClockView.updateTime();
+ refreshDate();
+ refreshAlarmStatus(); // might as well
+ }
+
+ void refreshAlarmStatus() {
+ // Update Alarm status
+ String nextAlarm = mLockPatternUtils.getNextAlarm();
+ if (!TextUtils.isEmpty(nextAlarm)) {
+ maybeSetUpperCaseText(mAlarmStatusView, nextAlarm);
+ mAlarmStatusView.setCompoundDrawablesWithIntrinsicBounds(ALARM_ICON, 0, 0, 0);
+ mAlarmStatusView.setVisibility(View.VISIBLE);
+ } else {
+ mAlarmStatusView.setVisibility(View.GONE);
+ }
+ }
+
+ void refreshDate() {
+ maybeSetUpperCaseText(mDateView, DateFormat.format(mDateFormatString, new Date()));
+ }
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mInfoCallback);
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mInfoCallback);
+ }
+
public int getAppWidgetId() {
return LockPatternUtils.ID_DEFAULT_STATUS_WIDGET;
}
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
-
- // StatusView manages all of the widgets in this view.
- mStatusViewManager = new KeyguardStatusViewManager(this);
- }
-
- KeyguardStatusViewManager getManager() {
- return mStatusViewManager;
+ private void maybeSetUpperCaseText(TextView textView, CharSequence text) {
+ if (KeyguardViewManager.USE_UPPER_CASE
+ && textView.getId() != R.id.owner_info) { // currently only required for date view
+ textView.setText(text != null ? text.toString().toUpperCase() : null);
+ } else {
+ textView.setText(text);
+ }
}
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java
deleted file mode 100644
index 3435619..0000000
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright (C) 2011 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.ContentResolver;
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Typeface;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.UserHandle;
-import android.provider.Settings;
-import android.text.TextUtils;
-import android.text.format.DateFormat;
-import android.util.Log;
-import android.view.View;
-import android.widget.TextView;
-
-import com.android.internal.R;
-import com.android.internal.telephony.IccCardConstants;
-import com.android.internal.widget.LockPatternUtils;
-
-import java.util.Date;
-
-import libcore.util.MutableInt;
-
-/***
- * Manages a number of views inside of the given layout. See below for a list of widgets.
- */
-class KeyguardStatusViewManager implements SecurityMessageDisplay {
- private static final boolean DEBUG = false;
- private static final String TAG = "KeyguardStatusView";
-
- public static final int LOCK_ICON = 0; // R.drawable.ic_lock_idle_lock;
- public static final int ALARM_ICON = com.android.internal.R.drawable.ic_lock_idle_alarm;
- public static final int CHARGING_ICON = 0; //R.drawable.ic_lock_idle_charging;
- public static final int BATTERY_LOW_ICON = 0; //R.drawable.ic_lock_idle_low_battery;
-
- private CharSequence mDateFormatString;
-
- // Views that this class controls.
- private TextView mDateView;
- private TextView mStatus1View;
- private TextView mOwnerInfoView;
- private TextView mAlarmStatusView;
- private TextView mSecurityMessage;
- private static final int SECURITY_MESSAGE_DURATION = 5000;
- private static final boolean SECURITY_MESSAGE_TIMES_OUT = false;
-
- // Top-level container view for above views
- private View mContainer;
-
- // are we showing battery information?
- private boolean mShowingBatteryInfo = false;
-
- // last known plugged in state
- private boolean mPluggedIn = false;
-
- // Whether to use the last line as a combined line to either display owner info / charging.
- // If false, each item will be given a dedicated space.
- private boolean mShareStatusRegion = false;
-
- // last known battery level
- private int mBatteryLevel = 100;
-
- // last known SIM state
- protected IccCardConstants.State mSimState;
-
- private LockPatternUtils mLockPatternUtils;
- private KeyguardUpdateMonitor mUpdateMonitor;
-
- // Shadowed text values
- private ClockView mClockView;
- protected boolean mBatteryCharged;
- protected boolean mBatteryIsLow;
-
- private Handler mHandler;
- private Runnable mClearSecurityMessageRunnable;
- private CharSequence mSecurityMessageContents = "";
-
- private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
- @Override
- public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) {
- mShowingBatteryInfo = status.isPluggedIn() || status.isBatteryLow();
- mPluggedIn = status.isPluggedIn();
- mBatteryLevel = status.level;
- mBatteryCharged = status.isCharged();
- mBatteryIsLow = status.isBatteryLow();
- updateStatusLines();
- }
-
- @Override
- public void onTimeChanged() {
- refreshDate();
- }
- };
-
- /**
- * @param view the containing view of all widgets
- */
- public KeyguardStatusViewManager(View view) {
- if (DEBUG) Log.v(TAG, "KeyguardStatusViewManager()");
- mContainer = view;
- Resources res = getContext().getResources();
- mDateFormatString =
- res.getText(com.android.internal.R.string.abbrev_wday_month_day_no_year);
- mShareStatusRegion = res.getBoolean(com.android.internal.R.bool.kg_share_status_area);
- mLockPatternUtils = new LockPatternUtils(view.getContext());
- mUpdateMonitor = KeyguardUpdateMonitor.getInstance(view.getContext());
-
- mDateView = (TextView) view.findViewById(R.id.date);
- mStatus1View = (TextView) view.findViewById(R.id.status1);
- mAlarmStatusView = (TextView) view.findViewById(R.id.alarm_status);
- mOwnerInfoView = (TextView) view.findViewById(R.id.owner_info);
- mClockView = (ClockView) view.findViewById(R.id.clock_view);
- mSecurityMessage = (TextView) view.findViewById(R.id.status_security_message);
-
- // This is required to ensure marquee works
- if (mSecurityMessage != null) {
- mSecurityMessage.setSelected(true);
- }
-
- // Use custom font in mDateView
- mDateView.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
-
- // Required to get Marquee to work.
- final View marqueeViews[] = { mDateView, mStatus1View, mOwnerInfoView, mAlarmStatusView };
- for (int i = 0; i < marqueeViews.length; i++) {
- View v = marqueeViews[i];
- if (v == null) {
- throw new RuntimeException("Can't find widget at index " + i);
- }
- v.setSelected(true);
- }
-
- // Registering this callback immediately updates the battery state, among other things.
- mUpdateMonitor.registerCallback(mInfoCallback);
-
- refreshDate();
- resetStatusInfo();
-
- mHandler = new Handler(Looper.myLooper());
- mClearSecurityMessageRunnable = new Runnable() {
- @Override
- public void run() {
- mSecurityMessageContents = "";
- updateStatusLines();
- }
- };
- }
-
- public void onPause() {
- if (DEBUG) Log.v(TAG, "onPause()");
- mUpdateMonitor.removeCallback(mInfoCallback);
- }
-
- /** {@inheritDoc} */
- public void onResume(int reason) {
- if (DEBUG) Log.v(TAG, "onResume()");
-
- // Force-update the time when we show this view.
- mClockView.updateTime();
-
- mUpdateMonitor.registerCallback(mInfoCallback);
- resetStatusInfo();
- }
-
- void resetStatusInfo() {
- updateStatusLines();
- }
-
- public void setMessage(CharSequence msg, boolean important) {
- if (!important) {
- mSecurityMessageContents = "";
- } else {
- mSecurityMessageContents = msg;
- }
- securityMessageChanged();
- }
-
- public void setMessage(int resId, boolean important) {
- if (resId != 0 && important) {
- mSecurityMessageContents = getContext().getResources().getText(resId);
- } else {
- mSecurityMessageContents = "";
- }
- securityMessageChanged();
- }
-
- public void setMessage(int resId, boolean important, Object... formatArgs) {
- if (resId != 0 && important) {
- mSecurityMessageContents = getContext().getString(resId, formatArgs);
- } else {
- mSecurityMessageContents = "";
- }
- securityMessageChanged();
- }
-
- public void securityMessageChanged() {
- updateStatusLines();
- if (SECURITY_MESSAGE_TIMES_OUT) {
- mHandler.removeCallbacks(mClearSecurityMessageRunnable);
- mHandler.postDelayed(mClearSecurityMessageRunnable, SECURITY_MESSAGE_DURATION);
- }
- mSecurityMessage.announceForAccessibility(mSecurityMessage.getText());
- }
-
- /**
- * Update the status lines based on these rules:
- * AlarmStatus: Alarm state always gets it's own line.
- * Status1 is shared between help, battery status and generic unlock instructions,
- * prioritized in that order.
- * @param showStatusLines status lines are shown if true
- */
- void updateStatusLines() {
- updateAlarmInfo();
- boolean statusAreaUsed = updateSecurityMessage();
- statusAreaUsed = updateStatus1(statusAreaUsed) || statusAreaUsed;
- updateOwnerInfo(statusAreaUsed);
- }
-
- private boolean updateSecurityMessage() {
- if (mSecurityMessage == null) return false;
- if (!TextUtils.isEmpty(mSecurityMessageContents)) {
- mSecurityMessage.setText(mSecurityMessageContents);
- mSecurityMessage.setVisibility(View.VISIBLE);
- return true;
- } else {
- mSecurityMessage.setVisibility(View.GONE);
- return false;
- }
- }
-
- private void updateAlarmInfo() {
- String nextAlarm = mLockPatternUtils.getNextAlarm();
- if (!TextUtils.isEmpty(nextAlarm)) {
- maybeSetUpperCaseText(mAlarmStatusView, nextAlarm);
- mAlarmStatusView.setCompoundDrawablesWithIntrinsicBounds(ALARM_ICON, 0, 0, 0);
- mAlarmStatusView.setVisibility(View.VISIBLE);
- } else {
- mAlarmStatusView.setVisibility(View.GONE);
- }
- }
-
- private boolean updateStatus1(boolean statusAreaUsed) {
- MutableInt icon = new MutableInt(0);
- CharSequence string = getPriorityTextMessage(icon);
-
- boolean dontShow = statusAreaUsed && mShareStatusRegion;
- if (!dontShow && !TextUtils.isEmpty(string)) {
- maybeSetUpperCaseText(mStatus1View, string);
- mStatus1View.setCompoundDrawablesWithIntrinsicBounds(icon.value, 0, 0, 0);
- mStatus1View.setVisibility(View.VISIBLE);
- return true;
- } else {
- mStatus1View.setVisibility(View.GONE);
- return false;
- }
- }
-
- private void updateOwnerInfo(boolean statusAreaUsed) {
- final ContentResolver res = getContext().getContentResolver();
- final boolean ownerInfoEnabled = Settings.Secure.getIntForUser(res,
- Settings.Secure.LOCK_SCREEN_OWNER_INFO_ENABLED, 1, UserHandle.USER_CURRENT) != 0;
- String text = Settings.Secure.getStringForUser(res, Settings.Secure.LOCK_SCREEN_OWNER_INFO,
- UserHandle.USER_CURRENT);
-
- boolean dontShow = statusAreaUsed && mShareStatusRegion;
- if (!dontShow && ownerInfoEnabled && !TextUtils.isEmpty(text)) {
- text = text.trim(); // Remove trailing newlines
- maybeSetUpperCaseText(mOwnerInfoView, text);
- mOwnerInfoView.setVisibility(View.VISIBLE);
- } else {
- mOwnerInfoView.setVisibility(View.GONE);
- }
- }
-
- private CharSequence getPriorityTextMessage(MutableInt icon) {
- CharSequence string = null;
- if (mShowingBatteryInfo) {
- // Battery status
- if (mPluggedIn) {
- // Charging, charged or waiting to charge.
- string = getContext().getString(mBatteryCharged ?
- com.android.internal.R.string.lockscreen_charged
- :com.android.internal.R.string.lockscreen_plugged_in, mBatteryLevel);
- icon.value = CHARGING_ICON;
- } else if (mBatteryIsLow) {
- // Battery is low
- string = getContext().getString(
- com.android.internal.R.string.lockscreen_low_battery);
- icon.value = BATTERY_LOW_ICON;
- }
- }
- return string;
- }
-
- void refreshDate() {
- maybeSetUpperCaseText(mDateView, DateFormat.format(mDateFormatString, new Date()));
- }
-
- private void maybeSetUpperCaseText(TextView textView, CharSequence text) {
- if (KeyguardViewManager.USE_UPPER_CASE
- && textView.getId() != R.id.owner_info) { // currently only required for date view
- textView.setText(text != null ? text.toString().toUpperCase() : null);
- } else {
- textView.setText(text);
- }
- }
-
- private Context getContext() {
- return mContainer.getContext();
- }
-
- @Override
- public void showBouncer(int duration) {
- }
-
- @Override
- public void hideBouncer(int duration) {
- }
-
- @Override
- public void setTimeout(int timeout_ms) {
- }
-
-}
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 4fdf7d8..b82d7c7 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
@@ -15,6 +15,7 @@
*/
package com.android.internal.policy.impl.keyguard;
+import android.appwidget.AppWidgetManager;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
@@ -115,6 +116,11 @@
scl.fadeOutChallenge();
mPageIndexOnPageBeginMoving = mKeyguardWidgetPager.getCurrentPage();
}
+ // We use mAppWidgetToShow to show a particular widget after you add it--
+ // once the user swipes a page we clear that behavior
+ if (mKeyguardHostView != null) {
+ mKeyguardHostView.clearAppWidgetToShow();
+ }
if (mHideHintsRunnable != null) {
mMainQueue.removeCallbacks(mHideHintsRunnable);
mHideHintsRunnable = null;
@@ -214,7 +220,9 @@
mKeyguardWidgetPager.setWidgetToResetOnPageFadeOut(mPageListeningToSlider);
}
}
- frame.hideFrame(this);
+ if (scrollState != SlidingChallengeLayout.SCROLL_STATE_FADING) {
+ frame.hideFrame(this);
+ }
updateEdgeSwiping();
if (mChallengeLayout.isChallengeShowing()) {
@@ -233,7 +241,9 @@
// Skip showing the frame and shrinking the widget if we are
if (!mChallengeLayout.isBouncing()) {
- frame.showFrame(this);
+ if (scrollState != SlidingChallengeLayout.SCROLL_STATE_FADING) {
+ frame.showFrame(this);
+ }
// As soon as the security begins sliding, the widget becomes small (if it wasn't
// small to begin with).
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java
index fa1a1ae..d9953bf 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java
@@ -110,13 +110,13 @@
int padding = (int) (res.getDisplayMetrics().density * 8);
setPadding(padding, padding, padding, padding);
- mFrameStrokeAdjustment = (int) (2 * density);
+ mFrameStrokeAdjustment = 2 + (int) (2 * density);
// This will be overriden on phones based on the current security mode, however on tablets
// we need to specify a height.
mSmallWidgetHeight =
res.getDimensionPixelSize(com.android.internal.R.dimen.kg_small_widget_height);
- mBackgroundDrawable = res.getDrawable(R.drawable.kg_bouncer_bg_white);
+ mBackgroundDrawable = res.getDrawable(R.drawable.kg_widget_bg_padded);
mGradientColor = res.getColor(com.android.internal.R.color.kg_widget_pager_gradient);
mGradientPaint.setXfermode(sAddBlendMode);
}
@@ -372,6 +372,10 @@
public void setFrameHeight(int height) {
mFrameHeight = height;
mBackgroundRect.set(0, 0, getMeasuredWidth(), Math.min(mFrameHeight, getMeasuredHeight()));
+ mForegroundRect.set(mFrameStrokeAdjustment, mFrameStrokeAdjustment,getMeasuredWidth() -
+ mFrameStrokeAdjustment, Math.min(getMeasuredHeight(), mFrameHeight) -
+ mFrameStrokeAdjustment);
+ updateGradient();
invalidate();
}
@@ -401,27 +405,30 @@
mFrameFade.start();
}
- @Override
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
- super.onSizeChanged(w, h, oldw, oldh);
-
- // mFrameStrokeAdjustment is a cludge to prevent the overlay from drawing outside the
- // rounded rect background.
- mForegroundRect.set(mFrameStrokeAdjustment, mFrameStrokeAdjustment,
- w - mFrameStrokeAdjustment, h - mFrameStrokeAdjustment);
-
+ private void updateGradient() {
float x0 = mLeftToRight ? 0 : mForegroundRect.width();
float x1 = mLeftToRight ? mForegroundRect.width(): 0;
mLeftToRightGradient = new LinearGradient(x0, 0f, x1, 0f,
mGradientColor, 0, Shader.TileMode.CLAMP);
mRightToLeftGradient = new LinearGradient(x1, 0f, x0, 0f,
mGradientColor, 0, Shader.TileMode.CLAMP);
+ }
+
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ super.onSizeChanged(w, h, oldw, oldh);
if (!mIsSmall) {
mFrameHeight = h;
}
+ // mFrameStrokeAdjustment is a cludge to prevent the overlay from drawing outside the
+ // rounded rect background.
+ mForegroundRect.set(mFrameStrokeAdjustment, mFrameStrokeAdjustment,
+ w - mFrameStrokeAdjustment, Math.min(h, mFrameHeight) - mFrameStrokeAdjustment);
+
mBackgroundRect.set(0, 0, getMeasuredWidth(), Math.min(h, mFrameHeight));
+ updateGradient();
invalidate();
}
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 f20b8d4..685e8ee 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java
@@ -476,6 +476,10 @@
v.setCameraDistance(mDensity * CAMERA_DISTANCE);
if (isOverScrollChild(i, scrollProgress) && PERFORM_OVERSCROLL_ROTATION) {
+ float pivotX = v.getMeasuredWidth() / 2;
+ float pivotY = v.getMeasuredHeight() / 2;
+ v.setPivotX(pivotX);
+ v.setPivotY(pivotY);
v.setRotationY(- OVERSCROLL_MAX_ROTATION * scrollProgress);
v.setOverScrollAmount(Math.abs(scrollProgress), scrollProgress < 0);
} else {
@@ -507,14 +511,17 @@
return false;
}
+ /**
+ * Returns the bounded set of pages that are re-orderable. The range is fully inclusive.
+ */
@Override
void boundByReorderablePages(boolean isReordering, int[] range) {
if (isReordering) {
// Remove non-widget pages from the range
- while (range[1] > range[0] && !isWidgetPage(range[1])) {
+ while (range[1] >= range[0] && !isWidgetPage(range[1])) {
range[1]--;
}
- while (range[0] < range[1] && !isWidgetPage(range[0])) {
+ while (range[0] <= range[1] && !isWidgetPage(range[0])) {
range[0]++;
}
}
@@ -762,6 +769,8 @@
mZoomInOutAnim.cancel();
}
View currentPage = getPageAt(getCurrentPage());
+ currentPage.setPivotY(0);
+ currentPage.setPivotX(currentPage.getMeasuredWidth() / 2);
if (!(currentPage.getScaleX() < 1f || currentPage.getScaleY() < 1f)) {
mZoomInOutAnim = new AnimatorSet();
mZoomInOutAnim.setDuration(BOUNCER_ZOOM_IN_OUT_DURATION);
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/MultiPaneChallengeLayout.java b/policy/src/com/android/internal/policy/impl/keyguard/MultiPaneChallengeLayout.java
index f4940a2..026f1bd 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/MultiPaneChallengeLayout.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/MultiPaneChallengeLayout.java
@@ -48,6 +48,7 @@
private OnBouncerStateChangedListener mBouncerListener;
private final Rect mTempRect = new Rect();
+ private final Rect mZeroPadding = new Rect();
private final DisplayMetrics mDisplayMetrics;
@@ -77,6 +78,8 @@
final Resources res = getResources();
mDisplayMetrics = res.getDisplayMetrics();
+
+ setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
@Override
@@ -187,6 +190,8 @@
// on the window. We want to avoid resizing widgets when possible as it can
// be ugly/expensive. This lets us simply clip them instead.
return virtualHeight - heightUsed;
+ } else if (lp.childType == LayoutParams.CHILD_TYPE_PAGE_DELETE_DROP_TARGET) {
+ return height;
}
return Math.min(virtualHeight - heightUsed, height);
}
@@ -330,6 +335,7 @@
final int count = getChildCount();
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
+ LayoutParams lp = (LayoutParams) child.getLayoutParams();
// We did the user switcher above if we have one.
if (child == mUserSwitcherView || child.getVisibility() == GONE) continue;
@@ -337,6 +343,9 @@
if (child == mScrimView) {
child.layout(0, 0, width, height);
continue;
+ } else if (lp.childType == LayoutParams.CHILD_TYPE_PAGE_DELETE_DROP_TARGET) {
+ layoutWithGravity(width, height, child, mZeroPadding, false);
+ continue;
}
layoutWithGravity(width, height, child, padding, false);
@@ -467,6 +476,7 @@
public static final int CHILD_TYPE_CHALLENGE = 2;
public static final int CHILD_TYPE_USER_SWITCHER = 3;
public static final int CHILD_TYPE_SCRIM = 4;
+ public static final int CHILD_TYPE_PAGE_DELETE_DROP_TARGET = 7;
public int gravity = Gravity.NO_GRAVITY;
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 2f25835..3900ab4 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java
@@ -233,6 +233,7 @@
private Matrix mTmpInvMatrix = new Matrix();
private float[] mTmpPoint = new float[2];
private Rect mTmpRect = new Rect();
+ private Rect mAltTmpRect = new Rect();
// Fling to delete
private int FLING_TO_DELETE_FADE_OUT_DURATION = 350;
@@ -658,10 +659,6 @@
MeasureSpec.makeMeasureSpec(heightSize - verticalPadding, childHeightMode);
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
- if (shouldSetTopAlignedPivotForWidget(i)) {
- child.setPivotX(child.getWidth() / 2);
- child.setPivotY(0f);
- }
}
setMeasuredDimension(scaledWidthSize, scaledHeightSize);
@@ -2455,7 +2452,13 @@
/* Drag to delete */
private boolean isHoveringOverDeleteDropTarget(int x, int y) {
if (mDeleteDropTarget != null) {
+ mAltTmpRect.set(0, 0, 0, 0);
+ View parent = (View) mDeleteDropTarget.getParent();
+ if (parent != null) {
+ parent.getGlobalVisibleRect(mAltTmpRect);
+ }
mDeleteDropTarget.getGlobalVisibleRect(mTmpRect);
+ mTmpRect.offset(-mAltTmpRect.left, -mAltTmpRect.top);
return mTmpRect.contains(x, y);
}
return false;
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 6d7d0f0..c734423 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java
@@ -260,6 +260,7 @@
mChallengeBottomBound = res.getDimensionPixelSize(R.dimen.kg_widget_pager_bottom_padding);
setWillNotDraw(false);
+ setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
public void setHandleAlpha(float alpha) {