Merge "Fix pattern rotation header text." into udc-d1-dev
This commit is contained in:
@@ -442,7 +442,8 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
protected boolean mForFace;
|
||||
protected boolean mForBiometrics;
|
||||
|
||||
private static final String KEY_UI_STAGE = "uiStage";
|
||||
@VisibleForTesting
|
||||
static final String KEY_UI_STAGE = "uiStage";
|
||||
private static final String KEY_PATTERN_CHOICE = "chosenPattern";
|
||||
private static final String KEY_CURRENT_PATTERN = "currentPattern";
|
||||
|
||||
@@ -718,10 +719,6 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
final GlifLayout layout = getActivity().findViewById(R.id.setup_wizard_layout);
|
||||
mUiStage = stage;
|
||||
|
||||
if (stage == Stage.Introduction) {
|
||||
layout.setDescriptionText(stage.headerMessage);
|
||||
}
|
||||
|
||||
// header text, footer text, visibility and
|
||||
// enabled state all known from the stage
|
||||
if (stage == Stage.ChoiceTooShort) {
|
||||
@@ -744,17 +741,14 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
Theme theme = getActivity().getTheme();
|
||||
theme.resolveAttribute(R.attr.colorError, typedValue, true);
|
||||
mHeaderText.setTextColor(typedValue.data);
|
||||
|
||||
} else {
|
||||
if (mDefaultHeaderColorList != null) {
|
||||
} else if (mDefaultHeaderColorList != null) {
|
||||
mHeaderText.setTextColor(mDefaultHeaderColorList);
|
||||
}
|
||||
|
||||
if (stage == Stage.NeedToConfirm) {
|
||||
mHeaderText.setText(stage.headerMessage);
|
||||
|
||||
if (stage == Stage.ConfirmWrong || stage == Stage.NeedToConfirm) {
|
||||
layout.setHeaderText(R.string.lockpassword_draw_your_pattern_again_header);
|
||||
}
|
||||
}
|
||||
|
||||
updateFooterLeftButton(stage);
|
||||
|
||||
|
@@ -18,12 +18,15 @@ package com.android.settings.password;
|
||||
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
|
||||
|
||||
import static com.android.settings.password.ChooseLockPattern.ChooseLockPatternFragment.KEY_UI_STAGE;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth.assertWithMessage;
|
||||
|
||||
import static org.robolectric.RuntimeEnvironment.application;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.view.View;
|
||||
|
||||
@@ -34,6 +37,8 @@ import com.android.settings.password.ChooseLockPattern.ChooseLockPatternFragment
|
||||
import com.android.settings.password.ChooseLockPattern.IntentBuilder;
|
||||
import com.android.settings.testutils.shadow.ShadowUtils;
|
||||
|
||||
import com.google.android.setupdesign.GlifLayout;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -119,6 +124,21 @@ public class ChooseLockPatternTest {
|
||||
assertThat(flags & FLAG_SECURE).isEqualTo(FLAG_SECURE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void headerText_stageConfirmWrong() {
|
||||
ChooseLockPattern activity = createActivity(true);
|
||||
ChooseLockPatternFragment fragment = (ChooseLockPatternFragment)
|
||||
activity.getSupportFragmentManager().findFragmentById(R.id.main_content);
|
||||
final GlifLayout layout = fragment.getView().findViewById(R.id.setup_wizard_layout);
|
||||
Bundle savedInstanceState = new Bundle();
|
||||
savedInstanceState.putInt(KEY_UI_STAGE,
|
||||
ChooseLockPatternFragment.Stage.ConfirmWrong.ordinal());
|
||||
|
||||
fragment.onViewCreated(layout, savedInstanceState);
|
||||
assertThat(layout.getHeaderText().toString()).isEqualTo(activity.getResources().getString(
|
||||
R.string.lockpassword_draw_your_pattern_again_header));
|
||||
}
|
||||
|
||||
private ChooseLockPattern createActivity(boolean addFingerprintExtra) {
|
||||
return Robolectric.buildActivity(
|
||||
ChooseLockPattern.class,
|
||||
|
Reference in New Issue
Block a user