<ImageView
android:id="@+id/suw_layout_icon"
- style="@style/LockPatternIconStyle"
+ style="@style/SuwGlifIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_lock" />
style="@style/SuwDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginHorizontal="?attr/suwMarginSides"
android:minLines="2" />
<TextView android:id="@+id/headerText"
<ImageView
android:id="@+id/suw_layout_icon"
- style="@style/LockPatternIconStyle"
+ style="@style/SuwGlifIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="?attr/suwGlifHeaderGravity"
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (C) 2017 The Android Open Source Project
+ Copyright (C) 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<resources>
- <!-- Unhide the icon on bigger screens -->
- <style name="LockPatternIconStyle" parent="SuwGlifIcon" />
+ <!-- Whether to use a UI variant that minimizes the number of UI elements on screen. This is
+ typically used when there is not enough space to display everything, because pattern view
+ doesn't interact well with scroll view -->
+ <bool name="config_lock_pattern_minimal_ui">false</bool>
-</resources>
+</resources>
\ No newline at end of file
<!-- Whether or not new device intro suggestion is supported for this device -->
<bool name="config_new_device_intro_suggestion_supported">false</bool>
+
+ <!-- Whether to use a UI variant that minimizes the number of UI elements on screen. This is
+ typically used when there is not enough space to display everything, because pattern view
+ doesn't interact well with scroll view -->
+ <bool name="config_lock_pattern_minimal_ui">true</bool>
+
</resources>
<item name="*android:successColor">@color/setup_lock_pattern_view_success_color_light</item>
</style>
- <!-- Overridden in sw400dp -->
- <style name="LockPatternIconStyle" parent="SuwGlifIcon">
- <item name="android:visibility">gone</item>
- </style>
-
<style name="SuggestionConditionStyle">
<item name="android:background">@color/suggestion_condition_background</item>
</style>
final GlifLayout layout = (GlifLayout) inflater.inflate(
R.layout.choose_lock_pattern, container, false);
layout.setHeaderText(getActivity().getTitle());
- if (mForFingerprint) {
- layout.setIcon(getActivity().getDrawable(R.drawable.ic_fingerprint_header));
+ if (getResources().getBoolean(R.bool.config_lock_pattern_minimal_ui)) {
+ View iconView = layout.findViewById(R.id.suw_layout_icon);
+ if (iconView != null) {
+ iconView.setVisibility(View.GONE);
+ }
+ } else {
+ if (mForFingerprint) {
+ layout.setIcon(getActivity().getDrawable(R.drawable.ic_fingerprint_header));
+ }
}
return layout;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- Button optionsButton = (Button) view.findViewById(R.id.screen_lock_options);
- optionsButton.setVisibility(View.VISIBLE);
- optionsButton.setOnClickListener((btn) ->
- ChooseLockTypeDialogFragment.newInstance(mUserId)
- .show(getChildFragmentManager(), null));
+ if (!getResources().getBoolean(R.bool.config_lock_pattern_minimal_ui)) {
+ Button optionsButton = view.findViewById(R.id.screen_lock_options);
+ optionsButton.setVisibility(View.VISIBLE);
+ optionsButton.setOnClickListener((btn) ->
+ ChooseLockTypeDialogFragment.newInstance(mUserId)
+ .show(getChildFragmentManager(), null));
+ }
}
@Override
import android.content.Intent;
import android.os.UserHandle;
+import android.view.View;
import com.android.settings.R;
import com.android.settings.TestConfig;
.isEqualTo(123);
}
+ @Config(qualifiers = "sw400dp")
@Test
- public void assertThat_chooseLockIconChanged_WhenFingerprintExtraSet() {
+ public void fingerprintExtraSet_shouldDisplayFingerprintIcon() {
ChooseLockPattern activity = createActivity(true);
ChooseLockPatternFragment fragment = (ChooseLockPatternFragment)
activity.getFragmentManager().findFragmentById(R.id.main_content);
+
ShadowDrawable drawable = Shadows.shadowOf(((GlifLayout) fragment.getView()).getIcon());
assertThat(drawable.getCreatedFromResId()).isEqualTo(R.drawable.ic_fingerprint_header);
}
+ @Test
+ public void smallScreens_shouldHideIcon() {
+ ChooseLockPattern activity = createActivity(true);
+ ChooseLockPatternFragment fragment = (ChooseLockPatternFragment)
+ activity.getFragmentManager().findFragmentById(R.id.main_content);
+
+ View iconView = fragment.getView().findViewById(R.id.suw_layout_icon);
+ assertThat(iconView.getVisibility()).isEqualTo(View.GONE);
+ }
+
private ChooseLockPattern createActivity(boolean addFingerprintExtra) {
return Robolectric.buildActivity(
ChooseLockPattern.class,
* limitations under the License
*/
-package com.android.settings;
+package com.android.settings.password;
import static com.google.common.truth.Truth.assertThat;
import android.view.View;
import android.widget.Button;
+import com.android.settings.R;
+import com.android.settings.SetupRedactionInterstitial;
+import com.android.settings.TestConfig;
import com.android.settings.password.ChooseLockPattern.ChooseLockPatternFragment;
import com.android.settings.password.ChooseLockPattern.IntentBuilder;
-import com.android.settings.password.SetupChooseLockPattern;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowResources;
import com.android.settings.testutils.shadow.SettingsShadowResourcesImpl;
.isEqualTo(PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
}
+ @Config(qualifiers = "sw400dp")
@Test
- public void screenLockOptions_shouldBeVisible() {
+ public void sw400dp_shouldShowScreenLockOptions() {
Button button = mActivity.findViewById(R.id.screen_lock_options);
assertThat(button).isNotNull();
assertThat(button.getVisibility()).isEqualTo(View.VISIBLE);
}
@Test
+ public void smallScreens_shouldHideScreenLockOptions() {
+ Button button = mActivity.findViewById(R.id.screen_lock_options);
+ assertThat(button).isNotNull();
+ assertThat(button.getVisibility()).isEqualTo(View.GONE);
+ }
+
+ @Test
public void skipButton_shouldBeVisible_duringNonFingerprintFlow() {
Button button = mActivity.findViewById(R.id.footerLeftButton);
assertThat(button).isNotNull();