Merge "Bouncer User Switcher UX tweaks"
This commit is contained in:
committed by
Android (Google) Code Review
commit
5d48161c1d
@@ -20,19 +20,18 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/keyguard_bouncer_user_switcher"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:paddingTop="12dp"
|
||||
android:importantForAccessibility="yes"> <!-- Needed because TYPE_WINDOW_STATE_CHANGED is sent
|
||||
from this view when bouncer is shown -->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/user_icon"
|
||||
android:layout_width="@dimen/keyguard_user_switcher_icon_size"
|
||||
android:layout_height="@dimen/keyguard_user_switcher_icon_size" />
|
||||
<ImageView
|
||||
android:id="@+id/user_icon"
|
||||
android:layout_width="@dimen/keyguard_user_switcher_icon_size"
|
||||
android:layout_height="@dimen/keyguard_user_switcher_icon_size" />
|
||||
|
||||
<!-- need to keep this outer view in order to have a correctly sized anchor
|
||||
for the dropdown menu, as well as dropdown background in the right place -->
|
||||
@@ -41,7 +40,7 @@
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:minHeight="48dp">
|
||||
<TextView
|
||||
style="@style/Keyguard.UserSwitcher.Spinner.Header"
|
||||
|
||||
@@ -108,10 +108,10 @@
|
||||
<dimen name="one_handed_bouncer_move_animation_translation">120dp</dimen>
|
||||
|
||||
|
||||
<dimen name="keyguard_user_switcher_header_text_size">24sp</dimen>
|
||||
<dimen name="keyguard_user_switcher_item_text_size">18sp</dimen>
|
||||
<dimen name="keyguard_user_switcher_width">300dp</dimen>
|
||||
<dimen name="keyguard_user_switcher_icon_size">250dp</dimen>
|
||||
<dimen name="keyguard_user_switcher_header_text_size">32sp</dimen>
|
||||
<dimen name="keyguard_user_switcher_item_text_size">32sp</dimen>
|
||||
<dimen name="keyguard_user_switcher_width">320dp</dimen>
|
||||
<dimen name="keyguard_user_switcher_icon_size">310dp</dimen>
|
||||
<dimen name="keyguard_user_switcher_corner">32dp</dimen>
|
||||
<dimen name="keyguard_user_switcher_popup_corner">24dp</dimen>
|
||||
<dimen name="keyguard_user_switcher_item_padding_vertical">15dp</dimen>
|
||||
|
||||
@@ -866,7 +866,6 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
||||
((LayerDrawable) mUserSwitcher.getBackground()).getDrawable(1).setAlpha(255);
|
||||
}
|
||||
|
||||
anchor.setClickable(true);
|
||||
anchor.setOnClickListener((v) -> {
|
||||
if (mFalsingManager.isFalseTap(LOW_PENALTY)) return;
|
||||
|
||||
@@ -877,8 +876,7 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
||||
public void onItemClick(AdapterView parent, View view, int pos, long id) {
|
||||
if (mFalsingManager.isFalseTap(LOW_PENALTY)) return;
|
||||
|
||||
// - 1 to account for the header view
|
||||
UserRecord user = adapter.getItem(pos - 1);
|
||||
UserRecord user = adapter.getItem(pos);
|
||||
if (!user.isCurrent) {
|
||||
adapter.onUserListItemClicked(user);
|
||||
}
|
||||
@@ -907,9 +905,16 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
||||
== Configuration.ORIENTATION_PORTRAIT) {
|
||||
updateViewGravity(mViewFlipper, Gravity.CENTER_HORIZONTAL);
|
||||
updateViewGravity(mUserSwitcherViewGroup, Gravity.CENTER_HORIZONTAL);
|
||||
mUserSwitcherViewGroup.setTranslationY(0);
|
||||
} else {
|
||||
updateViewGravity(mViewFlipper, Gravity.RIGHT | Gravity.BOTTOM);
|
||||
updateViewGravity(mUserSwitcherViewGroup, Gravity.LEFT | Gravity.TOP);
|
||||
updateViewGravity(mUserSwitcherViewGroup, Gravity.LEFT | Gravity.CENTER_VERTICAL);
|
||||
|
||||
// Attempt to reposition a bit higher to make up for this frame being a bit lower
|
||||
// on the device
|
||||
int yTrans = mView.getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.status_bar_height);
|
||||
mUserSwitcherViewGroup.setTranslationY(-yTrans);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,10 @@ package com.android.keyguard;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.ListPopupWindow;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.FalsingManager;
|
||||
@@ -68,12 +66,6 @@ public class KeyguardUserSwitcherPopupMenu extends ListPopupWindow {
|
||||
// This will force the popupwindow to show upward instead of drop down
|
||||
listView.addOnLayoutChangeListener(mLayoutListener);
|
||||
|
||||
TextView header = (TextView) LayoutInflater.from(mContext).inflate(
|
||||
R.layout.keyguard_bouncer_user_switcher_item, listView, false);
|
||||
header.setText(mContext.getResources().getString(
|
||||
R.string.accessibility_multi_user_switch_switcher));
|
||||
listView.addHeaderView(header);
|
||||
|
||||
listView.setOnTouchListener((v, ev) -> {
|
||||
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||
return mFalsingManager.isFalseTap(FalsingManager.LOW_PENALTY);
|
||||
|
||||
@@ -244,7 +244,7 @@ public class KeyguardSecurityContainerTest extends SysuiTestCase {
|
||||
ViewGroup userSwitcher = mKeyguardSecurityContainer.findViewById(
|
||||
R.id.keyguard_bouncer_user_switcher);
|
||||
assertThat(((FrameLayout.LayoutParams) userSwitcher.getLayoutParams()).gravity)
|
||||
.isEqualTo(Gravity.LEFT | Gravity.TOP);
|
||||
.isEqualTo(Gravity.LEFT | Gravity.CENTER_VERTICAL);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user