Merge "Parameter to hide bottom affordances"

This commit is contained in:
TreeHugger Robot
2018-01-08 07:33:19 +00:00
committed by Android (Google) Code Review
3 changed files with 15 additions and 3 deletions

View File

@@ -76,8 +76,11 @@
<!-- Vibration duration for GlowPadView used in SearchPanelView -->
<integer translatable="false" name="config_search_panel_view_vibration_duration">20</integer>
<!-- Show mic or phone affordance on Keyguard -->
<bool name="config_keyguardShowLeftAffordance">false</bool>
<!-- Show camera affordance on Keyguard -->
<bool name="config_keyguardShowCameraAffordance">true</bool>
<bool name="config_keyguardShowCameraAffordance">false</bool>
<!-- Whether we should use SRC drawing mode when drawing the scrim behind. If this flag is set,
we change the canvas opacity so libhwui doesn't call glClear on our surface, and then we

View File

@@ -529,6 +529,13 @@ public class KeyguardAffordanceHelper {
KeyguardAffordanceView targetView = left ? mLeftIcon : mRightIcon;
KeyguardAffordanceView otherView = left ? mRightIcon : mLeftIcon;
startSwiping(targetView);
// Do not animate the circle expanding if the affordance isn't visible,
// otherwise the circle will be meaningless.
if (targetView.getVisibility() != View.VISIBLE) {
animate = false;
}
if (animate) {
fling(0, false, !left);
updateIcon(otherView, 0.0f, 0, true, false, true, false);

View File

@@ -822,8 +822,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
@Override
public IconState getIcon() {
mLeftIsVoiceAssist = canLaunchVoiceAssist();
final boolean showAffordance =
getResources().getBoolean(R.bool.config_keyguardShowLeftAffordance);
if (mLeftIsVoiceAssist) {
mIconState.isVisible = mUserSetupComplete;
mIconState.isVisible = mUserSetupComplete && showAffordance;
if (mLeftAssistIcon == null) {
mIconState.drawable = mContext.getDrawable(R.drawable.ic_mic_26dp);
} else {
@@ -832,7 +834,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
mIconState.contentDescription = mContext.getString(
R.string.accessibility_voice_assist_button);
} else {
mIconState.isVisible = mUserSetupComplete && isPhoneVisible();
mIconState.isVisible = mUserSetupComplete && showAffordance && isPhoneVisible();
mIconState.drawable = mContext.getDrawable(R.drawable.ic_phone_24dp);
mIconState.contentDescription = mContext.getString(
R.string.accessibility_phone_button);