Moves the encryption interstitial to use the list layout
bug:27206957 Change-Id: Ib577440a2696539f44021bb4ba0100e9f1699c6c
This commit is contained in:
@@ -1,57 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
~ Copyright (C) 2014 The Android Open Source Project
|
|
||||||
~
|
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
~ you may not use this file except in compliance with the License.
|
|
||||||
~ You may obtain a copy of the License at
|
|
||||||
~
|
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
~
|
|
||||||
~ Unless required by applicable law or agreed to in writing, software
|
|
||||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
~ See the License for the specific language governing permissions and
|
|
||||||
~ limitations under the License
|
|
||||||
-->
|
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:paddingStart="?attr/side_margin"
|
|
||||||
android:paddingEnd="?attr/side_margin">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/encryption_message"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
|
|
||||||
android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
|
||||||
|
|
||||||
<RadioGroup
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
|
|
||||||
android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
|
|
||||||
android:checkedButton="@+id/encrypt_require_password">
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/encrypt_require_password"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/encrypt_dont_require_password"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp" />
|
|
||||||
|
|
||||||
</RadioGroup>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
27
res/layout/encryption_interstitial_header.xml
Normal file
27
res/layout/encryption_interstitial_header.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2016 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:minHeight="56dp"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
@@ -1,63 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2015 The Android Open Source Project
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License
|
|
||||||
-->
|
|
||||||
|
|
||||||
<com.android.setupwizardlib.SetupWizardLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/setup_wizard_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
settings:suwBackgroundTile="@drawable/setup_illustration_tile"
|
|
||||||
settings:suwHeaderText="@string/encryption_interstitial_header"
|
|
||||||
settings:suwIllustrationHorizontalTile="@drawable/setup_illustration_horizontal_tile"
|
|
||||||
settings:suwIllustrationImage="@drawable/setup_illustration_lock_screen">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
style="@style/SuwContentFrame"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/encryption_message"
|
|
||||||
style="@style/SuwDescription"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
<RadioGroup
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:checkedButton="@+id/encrypt_require_password">
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/encrypt_require_password"
|
|
||||||
style="@style/SuwRadioButton"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/encrypt_dont_require_password"
|
|
||||||
style="@style/SuwRadioButton"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
</RadioGroup>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</com.android.setupwizardlib.SetupWizardLayout>
|
|
28
res/layout/setup_encryption_interstitial_header.xml
Normal file
28
res/layout/setup_encryption_interstitial_header.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2016 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:minHeight="56dp"
|
||||||
|
android:paddingBottom="@dimen/suw_description_margin_bottom"
|
||||||
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
|
android:paddingTop="@dimen/suw_description_margin_top"
|
||||||
|
android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceListItem" />
|
30
res/xml/security_settings_encryption_interstitial.xml
Normal file
30
res/xml/security_settings_encryption_interstitial.xml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2016 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:title="@string/lock_settings_picker_title"
|
||||||
|
android:key="lock_settings_picker">
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="encrypt_require_password"
|
||||||
|
android:persistent="false"/>
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="encrypt_dont_require_password"
|
||||||
|
android:persistent="false"/>
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
@@ -22,17 +22,14 @@ import android.app.Dialog;
|
|||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
import android.support.v7.preference.Preference;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.RadioButton;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
||||||
@@ -63,10 +60,6 @@ public class EncryptionInterstitial extends SettingsActivity {
|
|||||||
public static Intent createStartIntent(Context ctx, int quality,
|
public static Intent createStartIntent(Context ctx, int quality,
|
||||||
boolean requirePasswordDefault, Intent unlockMethodIntent) {
|
boolean requirePasswordDefault, Intent unlockMethodIntent) {
|
||||||
return new Intent(ctx, EncryptionInterstitial.class)
|
return new Intent(ctx, EncryptionInterstitial.class)
|
||||||
.putExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, true)
|
|
||||||
.putExtra(EXTRA_PREFS_SET_BACK_TEXT, (String) null)
|
|
||||||
.putExtra(EXTRA_PREFS_SET_NEXT_TEXT, ctx.getString(
|
|
||||||
R.string.encryption_continue_button))
|
|
||||||
.putExtra(EXTRA_PASSWORD_QUALITY, quality)
|
.putExtra(EXTRA_PASSWORD_QUALITY, quality)
|
||||||
.putExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID, R.string.encryption_interstitial_header)
|
.putExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID, R.string.encryption_interstitial_header)
|
||||||
.putExtra(EXTRA_REQUIRE_PASSWORD, requirePasswordDefault)
|
.putExtra(EXTRA_REQUIRE_PASSWORD, requirePasswordDefault)
|
||||||
@@ -74,12 +67,15 @@ public class EncryptionInterstitial extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class EncryptionInterstitialFragment extends SettingsPreferenceFragment
|
public static class EncryptionInterstitialFragment extends SettingsPreferenceFragment
|
||||||
implements View.OnClickListener, OnClickListener {
|
implements DialogInterface.OnClickListener {
|
||||||
|
|
||||||
private static final int ACCESSIBILITY_WARNING_DIALOG = 1;
|
private static final int ACCESSIBILITY_WARNING_DIALOG = 1;
|
||||||
private RadioButton mRequirePasswordToDecryptButton;
|
private static final String KEY_ENCRYPT_REQUIRE_PASSWORD = "encrypt_require_password";
|
||||||
private RadioButton mDontRequirePasswordToDecryptButton;
|
private static final String KEY_ENCRYPT_DONT_REQUIRE_PASSWORD =
|
||||||
private TextView mEncryptionMessage;
|
"encrypt_dont_require_password";
|
||||||
|
|
||||||
|
private Preference mRequirePasswordToDecrypt;
|
||||||
|
private Preference mDontRequirePasswordToDecrypt;
|
||||||
private boolean mPasswordRequired;
|
private boolean mPasswordRequired;
|
||||||
private Intent mUnlockMethodIntent;
|
private Intent mUnlockMethodIntent;
|
||||||
|
|
||||||
@@ -89,20 +85,13 @@ public class EncryptionInterstitial extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
Bundle savedInstanceState) {
|
super.onCreate(savedInstanceState);
|
||||||
return inflater.inflate(R.layout.encryption_interstitial, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
addPreferencesFromResource(R.xml.security_settings_encryption_interstitial);
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
mRequirePasswordToDecrypt = findPreference(KEY_ENCRYPT_REQUIRE_PASSWORD);
|
||||||
mRequirePasswordToDecryptButton =
|
mDontRequirePasswordToDecrypt = findPreference(KEY_ENCRYPT_DONT_REQUIRE_PASSWORD);
|
||||||
(RadioButton) view.findViewById(R.id.encrypt_require_password);
|
|
||||||
mDontRequirePasswordToDecryptButton =
|
|
||||||
(RadioButton) view.findViewById(R.id.encrypt_dont_require_password);
|
|
||||||
mEncryptionMessage =
|
|
||||||
(TextView) view.findViewById(R.id.encryption_message);
|
|
||||||
boolean forFingerprint = getActivity().getIntent().getBooleanExtra(
|
boolean forFingerprint = getActivity().getIntent().getBooleanExtra(
|
||||||
ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
|
ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
|
||||||
Intent intent = getActivity().getIntent();
|
Intent intent = getActivity().getIntent();
|
||||||
@@ -135,26 +124,22 @@ public class EncryptionInterstitial extends SettingsActivity {
|
|||||||
disableId = R.string.encrypt_dont_require_password;
|
disableId = R.string.encrypt_dont_require_password;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mEncryptionMessage.setText(msgId);
|
TextView message = createHeaderView();
|
||||||
|
message.setText(msgId);
|
||||||
|
setHeaderView(message);
|
||||||
|
|
||||||
mRequirePasswordToDecryptButton.setOnClickListener(this);
|
mRequirePasswordToDecrypt.setTitle(enableId);
|
||||||
mRequirePasswordToDecryptButton.setText(enableId);
|
|
||||||
|
|
||||||
mDontRequirePasswordToDecryptButton.setOnClickListener(this);
|
mDontRequirePasswordToDecrypt.setTitle(disableId);
|
||||||
mDontRequirePasswordToDecryptButton.setText(disableId);
|
|
||||||
|
|
||||||
setRequirePasswordState(getActivity().getIntent().getBooleanExtra(
|
setRequirePasswordState(getActivity().getIntent().getBooleanExtra(
|
||||||
EXTRA_REQUIRE_PASSWORD, true));
|
EXTRA_REQUIRE_PASSWORD, true));
|
||||||
|
}
|
||||||
|
|
||||||
Button nextButton = getNextButton();
|
protected TextView createHeaderView() {
|
||||||
if (nextButton != null) {
|
TextView message = (TextView) LayoutInflater.from(getActivity()).inflate(
|
||||||
nextButton.setOnClickListener(new View.OnClickListener() {
|
R.layout.encryption_interstitial_header, null, false);
|
||||||
@Override
|
return message;
|
||||||
public void onClick(View v) {
|
|
||||||
startLockIntent();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void startLockIntent() {
|
protected void startLockIntent() {
|
||||||
@@ -177,18 +162,22 @@ public class EncryptionInterstitial extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
if (v == mRequirePasswordToDecryptButton) {
|
final String key = preference.getKey();
|
||||||
|
if (key.equals(KEY_ENCRYPT_REQUIRE_PASSWORD)) {
|
||||||
final boolean accEn = AccessibilityManager.getInstance(getActivity()).isEnabled();
|
final boolean accEn = AccessibilityManager.getInstance(getActivity()).isEnabled();
|
||||||
if (accEn && !mPasswordRequired) {
|
if (accEn && !mPasswordRequired) {
|
||||||
setRequirePasswordState(false); // clear the UI state
|
setRequirePasswordState(false); // clear the UI state
|
||||||
showDialog(ACCESSIBILITY_WARNING_DIALOG);
|
showDialog(ACCESSIBILITY_WARNING_DIALOG);
|
||||||
} else {
|
} else {
|
||||||
setRequirePasswordState(true);
|
setRequirePasswordState(true);
|
||||||
|
startLockIntent();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setRequirePasswordState(false);
|
setRequirePasswordState(false);
|
||||||
|
startLockIntent();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -242,14 +231,13 @@ public class EncryptionInterstitial extends SettingsActivity {
|
|||||||
|
|
||||||
private void setRequirePasswordState(boolean required) {
|
private void setRequirePasswordState(boolean required) {
|
||||||
mPasswordRequired = required;
|
mPasswordRequired = required;
|
||||||
mRequirePasswordToDecryptButton.setChecked(required);
|
|
||||||
mDontRequirePasswordToDecryptButton.setChecked(!required);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||||
setRequirePasswordState(true);
|
setRequirePasswordState(true);
|
||||||
|
startLockIntent();
|
||||||
} else if (which == DialogInterface.BUTTON_NEGATIVE) {
|
} else if (which == DialogInterface.BUTTON_NEGATIVE) {
|
||||||
setRequirePasswordState(false);
|
setRequirePasswordState(false);
|
||||||
}
|
}
|
||||||
|
@@ -242,9 +242,18 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
|
|
||||||
protected void setHeaderView(int resource) {
|
protected void setHeaderView(int resource) {
|
||||||
mHeader = new LayoutPreference(getPrefContext(), resource);
|
mHeader = new LayoutPreference(getPrefContext(), resource);
|
||||||
mHeader.setOrder(ORDER_FIRST);
|
addPreferenceToTop(mHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setHeaderView(View view) {
|
||||||
|
mHeader = new LayoutPreference(getPrefContext(), view);
|
||||||
|
addPreferenceToTop(mHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addPreferenceToTop(LayoutPreference preference) {
|
||||||
|
preference.setOrder(ORDER_FIRST);
|
||||||
if (getPreferenceScreen() != null) {
|
if (getPreferenceScreen() != null) {
|
||||||
getPreferenceScreen().addPreference(mHeader);
|
getPreferenceScreen().addPreference(preference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,11 +21,15 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.setupwizardlib.SetupWizardLayout;
|
import com.android.setupwizardlib.SetupWizardLayout;
|
||||||
|
import com.android.setupwizardlib.SetupWizardPreferenceLayout;
|
||||||
import com.android.setupwizardlib.view.NavigationBar;
|
import com.android.setupwizardlib.view.NavigationBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,27 +73,45 @@ public class SetupEncryptionInterstitial extends EncryptionInterstitial {
|
|||||||
public static class SetupEncryptionInterstitialFragment extends EncryptionInterstitialFragment
|
public static class SetupEncryptionInterstitialFragment extends EncryptionInterstitialFragment
|
||||||
implements NavigationBar.NavigationBarListener {
|
implements NavigationBar.NavigationBarListener {
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState) {
|
|
||||||
return inflater.inflate(R.layout.setup_encryption_interstitial, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
final SetupWizardLayout layout =
|
final SetupWizardPreferenceLayout layout = (SetupWizardPreferenceLayout) view;
|
||||||
(SetupWizardLayout) view.findViewById(R.id.setup_wizard_layout);
|
layout.setDividerInset(getContext().getResources().getDimensionPixelSize(
|
||||||
|
R.dimen.suw_items_text_divider_inset));
|
||||||
|
layout.setIllustration(R.drawable.setup_illustration_lock_screen,
|
||||||
|
R.drawable.setup_illustration_horizontal_tile);
|
||||||
|
|
||||||
final NavigationBar navigationBar = layout.getNavigationBar();
|
final NavigationBar navigationBar = layout.getNavigationBar();
|
||||||
navigationBar.setNavigationBarListener(this);
|
navigationBar.setNavigationBarListener(this);
|
||||||
|
Button nextButton = navigationBar.getNextButton();
|
||||||
|
nextButton.setText(null);
|
||||||
|
nextButton.setEnabled(false);
|
||||||
|
|
||||||
|
layout.setHeaderText(R.string.encryption_interstitial_header);
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
activity.setTitle(R.string.encryption_interstitial_header);
|
|
||||||
SetupWizardUtils.setImmersiveMode(activity);
|
SetupWizardUtils.setImmersiveMode(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use the dividers in SetupWizardRecyclerLayout. Suppress the dividers in
|
||||||
|
// PreferenceFragment.
|
||||||
|
setDivider(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TextView createHeaderView() {
|
||||||
|
TextView message = (TextView) LayoutInflater.from(getActivity()).inflate(
|
||||||
|
R.layout.setup_encryption_interstitial_header, null, false);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
SetupWizardPreferenceLayout layout = (SetupWizardPreferenceLayout) parent;
|
||||||
|
return layout.onCreateRecyclerView(inflater, parent, savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -102,7 +124,7 @@ public class SetupEncryptionInterstitial extends EncryptionInterstitial {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNavigateNext() {
|
public void onNavigateNext() {
|
||||||
startLockIntent();
|
// next is handled via the onPreferenceTreeClick method in EncryptionInterstitial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user