From 70bc9f24ce6098a8c82245ac1ce7721d354ecd3d Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Fri, 12 Oct 2012 22:02:27 -0700 Subject: [PATCH] Fix keyguard dimensions; IME state for password view; layouts Fix a bug where ordering during inflation caused us not to set a keyguard callback early enough to properly modify window flags. Add a gross hack to work around this for now. Fix status layouts to scale a bit more gracefully in the presence of an IME. Fix password layouts to scale more gracefully in the presence of an IME Bug 7343312 Bug 7341795 Bug 7342963 Bug 7343089 Change-Id: Ifb2c06defef11e8f7f9d0e09855632ed491bb31c --- .../res/layout-port/keyguard_host_view.xml | 5 +-- .../keyguard_screen_password_landscape.xml | 1 - .../keyguard_screen_password_portrait.xml | 1 - .../layout/keyguard_glow_pad_container.xml | 2 +- .../res/res/layout/keyguard_password_view.xml | 21 +++++----- .../keyguard_screen_password_landscape.xml | 1 - .../keyguard_screen_password_portrait.xml | 4 +- core/res/res/layout/keyguard_status_view.xml | 40 ++++++++++--------- core/res/res/values/dimens.xml | 4 +- .../impl/keyguard/KeyguardPasswordView.java | 5 ++- .../impl/keyguard/KeyguardViewManager.java | 12 ++++++ 11 files changed, 54 insertions(+), 42 deletions(-) diff --git a/core/res/res/layout-port/keyguard_host_view.xml b/core/res/res/layout-port/keyguard_host_view.xml index 3ce9365af0925..20726d0050bba 100644 --- a/core/res/res/layout-port/keyguard_host_view.xml +++ b/core/res/res/layout-port/keyguard_host_view.xml @@ -29,15 +29,14 @@ + android:layout_height="153dp" /> + android:layout_marginBottom="-80dp"/> \ No newline at end of file diff --git a/core/res/res/layout/keyguard_password_view.xml b/core/res/res/layout/keyguard_password_view.xml index 92a755150553c..ab8aa85ba55c2 100644 --- a/core/res/res/layout/keyguard_password_view.xml +++ b/core/res/res/layout/keyguard_password_view.xml @@ -26,11 +26,12 @@ + android:layout_height="0dp" + android:layout_weight="1"> @@ -114,14 +115,14 @@ android:clickable="true" /> - - + + diff --git a/core/res/res/layout/keyguard_screen_password_landscape.xml b/core/res/res/layout/keyguard_screen_password_landscape.xml index e0a3ce3c13c0f..80d9d61a007ed 100644 --- a/core/res/res/layout/keyguard_screen_password_landscape.xml +++ b/core/res/res/layout/keyguard_screen_password_landscape.xml @@ -143,7 +143,6 @@ android:layout_width="0dip" android:layout_weight="1" android:gravity="center" - android:layout_marginStart="@dimen/keyguard_lockscreen_pin_margin_left" android:layout_gravity="center_vertical" android:singleLine="true" android:textStyle="normal" diff --git a/core/res/res/layout/keyguard_screen_password_portrait.xml b/core/res/res/layout/keyguard_screen_password_portrait.xml index 0212f737c034e..3d61bae5f8fb5 100644 --- a/core/res/res/layout/keyguard_screen_password_portrait.xml +++ b/core/res/res/layout/keyguard_screen_password_portrait.xml @@ -106,12 +106,10 @@ android:layout_marginEnd="16dip"> - - - + + android:layout_marginEnd="@dimen/kg_status_line_font_right_margin" + android:layout_gravity="right"> - + - + + + + diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 31d4ad7275e9b..948a3d3c40c80 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -291,10 +291,10 @@ 16dp - 16dp + 0dp - 6dp + 0dp diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPasswordView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPasswordView.java index 5a1c30f385b55..a6e8f5bc91fc8 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPasswordView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPasswordView.java @@ -207,12 +207,13 @@ public class KeyguardPasswordView extends LinearLayout }); } - // If no icon is visible, reset the left margin on the password field so the text is + // If no icon is visible, reset the start margin on the password field so the text is // still centered. if (!imeOrDeleteButtonVisible) { android.view.ViewGroup.LayoutParams params = mPasswordEntry.getLayoutParams(); if (params instanceof MarginLayoutParams) { - ((MarginLayoutParams)params).leftMargin = 0; + final MarginLayoutParams mlp = (MarginLayoutParams) params; + mlp.setMarginStart(0); mPasswordEntry.setLayoutParams(params); } } diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java index 1ec4176596f94..0ad2404c7d4aa 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java @@ -210,6 +210,18 @@ public class KeyguardViewManager { mKeyguardView.setLockPatternUtils(mLockPatternUtils); mKeyguardView.setViewMediatorCallback(mViewMediatorCallback); + // HACK + // The keyguard view will have set up window flags in onFinishInflate before we set + // the view mediator callback. Make sure it knows the correct IME state. + if (mViewMediatorCallback != null) { + KeyguardPasswordView kpv = (KeyguardPasswordView) mKeyguardView.findViewById( + R.id.keyguard_password_view); + + if (kpv != null) { + mViewMediatorCallback.setNeedsInput(kpv.needsInput()); + } + } + if (options != null) { if (options.getBoolean(LockPatternUtils.KEYGUARD_SHOW_USER_SWITCHER)) { mKeyguardView.goToUserSwitcher();