android:excludeFromRecents="true"
/>
+ <activity android:name="SetupChooseLockPattern"
+ android:exported="false"
+ android:theme="@style/SetupWizardDisableAppStartingTheme" />
+
<activity android:name="ChooseLockPattern" android:exported="false"/>
+ <activity android:name="SetupChooseLockPassword"
+ android:exported="false"
+ android:theme="@style/SetupWizardDisableAppStartingTheme"
+ android:windowSoftInputMode="stateVisible|adjustResize" />
+
<activity android:name="ChooseLockPassword" android:exported="false"
android:windowSoftInputMode="stateVisible|adjustResize"/>
--- /dev/null
+<?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:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <RelativeLayout
+ android:layout_weight="1"
+ android:layout_width="match_parent"
+ android:layout_height="0dp">
+
+ <FrameLayout
+ android:id="@+id/title_area"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:background="@drawable/setup_illustration_bg"
+ android:elevation="@dimen/setup_wizard_title_area_elevation">
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/wifi_setup_title"
+ style="@style/SetupTitle"/>
+ </FrameLayout>
+
+ <ScrollView
+ android:id="@+id/bottom_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/title_area"
+ android:layout_alignParentBottom="true"
+ android:fillViewport="true">
+
+ <FrameLayout android:id="@+id/setup_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false"/>
+
+ </ScrollView>
+
+ </RelativeLayout>
+
+ <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar"
+ android:id="@+id/navigation_bar"
+ android:layout_width="match_parent"
+ android:layout_height="56dip"
+ style="@style/setup_wizard_navbar_style"/>
+</LinearLayout>
+
--- /dev/null
+<?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:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <com.android.settings.widget.SetupWizardIllustration
+ android:id="@+id/illustration_tablet"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@drawable/setup_illustration_bg"
+ android:foreground="@drawable/setup_illustration_wifi_wide">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="start|top"
+ android:weightSum="16">
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height"
+ android:layout_weight="6"
+ android:text="@string/wifi_setup_title"
+ style="@style/SetupCardTitle"/>
+
+ <ScrollView
+ android:id="@+id/bottom_scroll_view"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/setup_wizard_card_land_margin_top"
+ android:layout_weight="8"
+ android:background="@drawable/setup_wizard_card_bg"
+ android:elevation="@dimen/setup_wizard_card_elevation"
+ android:fillViewport="true">
+
+ <FrameLayout android:id="@+id/setup_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false"/>
+
+ </ScrollView>
+
+ </LinearLayout>
+
+ </com.android.settings.widget.SetupWizardIllustration>
+
+ <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar"
+ android:id="@+id/navigation_bar"
+ android:layout_width="match_parent"
+ android:layout_height="56dip"
+ style="@style/setup_wizard_navbar_style"/>
+
+</LinearLayout>
+
--- /dev/null
+<?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:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <com.android.settings.widget.SetupWizardIllustration
+ android:id="@+id/illustration_tablet"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@drawable/setup_illustration_bg"
+ android:foreground="@drawable/setup_illustration_wifi_wide">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height"
+ android:orientation="vertical"
+ android:paddingStart="@dimen/setup_wizard_card_port_margin_sides"
+ android:paddingEnd="@dimen/setup_wizard_card_port_margin_sides">
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/wifi_setup_title"
+ style="@style/SetupCardTitle"/>
+
+ <ScrollView
+ android:id="@+id/bottom_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@drawable/setup_wizard_card_bg"
+ android:elevation="@dimen/setup_wizard_card_elevation"
+ android:fillViewport="true">
+
+ <FrameLayout
+ android:id="@+id/setup_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false"/>
+
+ </ScrollView>
+
+ </LinearLayout>
+
+ </com.android.settings.widget.SetupWizardIllustration>
+
+ <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar"
+ android:id="@+id/navigation_bar"
+ android:layout_width="match_parent"
+ android:layout_height="56dip"
+ style="@style/setup_wizard_navbar_style"/>
+
+</LinearLayout>
+
--- /dev/null
+<?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:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+
+ <!-- header text ('Enter Pin') -->
+ <TextView android:id="@+id/headerText"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:lines="2"
+ android:textAppearance="?android:attr/textAppearanceMedium"/>
+
+ <!-- Password entry field -->
+ <EditText android:id="@+id/password_entry"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_marginStart="30dip"
+ android:layout_marginEnd="30dip"
+ android:gravity="center"
+ android:inputType="textPassword"
+ android:imeOptions="actionNext"
+ android:textSize="24sp"
+ style="@style/TextAppearance.PasswordEntry"/>
+
+ <!-- Spacer between password entry and keyboard -->
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ style="@style/SecurityPreferenceButtonContainer">
+
+ <!-- left : cancel -->
+ <Button android:id="@+id/cancel_button"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/lockpassword_cancel_label"
+ style="@style/SecurityPreferenceButton"/>
+
+ <!-- right : continue -->
+ <Button android:id="@+id/next_button"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/lockpassword_continue_label"
+ style="@style/SecurityPreferenceButton"/>
+
+ </LinearLayout>
+
+ <!-- Alphanumeric keyboard -->
+ <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#00000000"
+ android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
+ android:visibility="gone"/>
+
+</LinearLayout>
--- /dev/null
+<?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.
+-->
+
+<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/topLayout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <!-- takes up all space above button bar at bottom -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:orientation="vertical">
+
+ <TextView android:id="@+id/headerText"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:minHeight="50dp"
+ android:textSize="18sp"/>
+
+ <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="4"
+ android:background="@color/lock_pattern_background"/>
+
+ <TextView android:id="@+id/footerText"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:minHeight="50dp"
+ android:textSize="14sp"/>
+
+ </LinearLayout>
+
+ <!-- Buttons are hidden during setup, and use the buttons in setup navigation bar instead -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ style="@style/SecurityPreferenceButtonContainer">
+
+ <!-- left : cancel, or re-try -->
+ <Button android:id="@+id/footerLeftButton"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/lockpattern_tutorial_cancel_label"
+ style="@style/SecurityPreferenceButton"/>
+
+ <!-- right : confirm or ok -->
+ <Button android:id="@+id/footerRightButton"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/lockpattern_tutorial_continue_label"
+ style="@style/SecurityPreferenceButton"/>
+
+ </LinearLayout>
+
+</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
--- /dev/null
+<?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"
+ xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <ScrollView
+ android:id="@+id/bottom_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:fillViewport="true">
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false">
+
+ <com.android.settings.widget.SetupWizardIllustration
+ android:id="@+id/illustration_phone"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:elevation="@dimen/setup_wizard_title_area_elevation"
+ android:background="@drawable/setup_illustration_bg"
+ android:foreground="@drawable/setup_illustration_wifi"
+ android:tag="stickyContainer"
+ settings:aspectRatio="2.22">
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:tag="sticky"
+ android:text="@string/wifi_setup_title"
+ style="@style/SetupTitle"/>
+
+ </com.android.settings.widget.SetupWizardIllustration>
+
+ <FrameLayout
+ android:id="@+id/setup_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/illustration_phone"
+ android:clipChildren="false"/>
+
+ </RelativeLayout>
+
+ </ScrollView>
+
+ <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar"
+ android:id="@+id/navigation_bar"
+ android:layout_width="match_parent"
+ android:layout_height="56dip"
+ style="@style/setup_wizard_navbar_style"/>
+
+</LinearLayout>
+
import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.Activity;
-import android.app.ActivityManagerNative;
import android.app.Fragment;
import android.app.PendingIntent;
import android.app.admin.DevicePolicyManager;
import android.content.pm.UserInfo;
import android.os.Bundle;
import android.os.Process;
-import android.os.RemoteException;
-import android.os.UserHandle;
import android.os.UserManager;
import android.preference.Preference;
import android.preference.PreferenceScreen;
return intent;
}
+ protected Intent getLockPasswordIntent(Context context, int quality,
+ final boolean isFallback, int minLength, final int maxLength,
+ boolean requirePasswordToDecrypt, boolean confirmCredentials) {
+ return ChooseLockPassword.createIntent(context, quality, isFallback, minLength,
+ maxLength, requirePasswordToDecrypt, confirmCredentials);
+ }
+
+ protected Intent getLockPatternIntent(Context context, final boolean isFallback,
+ final boolean requirePassword, final boolean confirmCredentials) {
+ return ChooseLockPattern.createIntent(context, isFallback, requirePassword,
+ confirmCredentials);
+ }
+
/**
* Invokes an activity to change the user's pattern, password or PIN based on given quality
* and minimum quality specified by DevicePolicyManager. If quality is
quality = upgradeQuality(quality, null);
+ final Context context = getActivity();
if (quality >= DevicePolicyManager.PASSWORD_QUALITY_NUMERIC) {
int minLength = mDPM.getPasswordMinimumLength(null);
if (minLength < MIN_PASSWORD_LENGTH) {
minLength = MIN_PASSWORD_LENGTH;
}
final int maxLength = mDPM.getPasswordMaximumLength(quality);
- Intent intent = ChooseLockPassword.createIntent(getActivity(), quality, isFallback,
- minLength, maxLength, mRequirePassword, false /* confirm credentials */);
+ Intent intent = getLockPasswordIntent(context, quality, isFallback, minLength,
+ maxLength, mRequirePassword, /* confirm credentials */false);
if (isFallback) {
startActivityForResult(intent, FALLBACK_REQUEST);
return;
startActivity(intent);
}
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
- Intent intent = ChooseLockPattern.createIntent(getActivity(),
- isFallback, mRequirePassword, false /* confirm credentials */);
+ Intent intent = getLockPatternIntent(context, isFallback, mRequirePassword,
+ /* confirm credentials */false);
if (isFallback) {
startActivityForResult(intent, FALLBACK_REQUEST);
return;
@Override
public Intent getIntent() {
Intent modIntent = new Intent(super.getIntent());
- modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ChooseLockPasswordFragment.class.getName());
+ modIntent.putExtra(EXTRA_SHOW_FRAGMENT, getFragmentClass().getName());
return modIntent;
}
return false;
}
+ /* package */ Class<? extends Fragment> getFragmentClass() {
+ return ChooseLockPasswordFragment.class;
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO: Fix on phones
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.choose_lock_password, container, false);
+ }
- View view = inflater.inflate(R.layout.choose_lock_password, null);
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
mCancelButton = (Button) view.findViewById(R.id.cancel_button);
mCancelButton.setOnClickListener(this);
CharSequence title = getText(id);
sa.setTitle(title);
}
-
- return view;
}
@Override
@Override
public Intent getIntent() {
Intent modIntent = new Intent(super.getIntent());
- modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ChooseLockPatternFragment.class.getName());
+ modIntent.putExtra(EXTRA_SHOW_FRAGMENT, getFragmentClass().getName());
return modIntent;
}
return false;
}
+ /* package */ Class<? extends Fragment> getFragmentClass() {
+ return ChooseLockPatternFragment.class;
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
// requestWindowFeature(Window.FEATURE_NO_TITLE);
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.choose_lock_pattern, container, false);
+ }
- // setupViews()
- View view = inflater.inflate(R.layout.choose_lock_pattern, null);
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
mHeaderText = (TextView) view.findViewById(R.id.headerText);
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener);
updateStage(Stage.values()[savedInstanceState.getInt(KEY_UI_STAGE)]);
}
mDone = false;
- return view;
}
public void onClick(View v) {
import com.android.setupwizard.navigationbar.SetupWizardNavBar;
-
+import android.content.Context;
+import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.PreferenceFragment;
super.onViewCreated(view, savedInstanceState);
SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
}
+
+ @Override
+ protected Intent getLockPasswordIntent(Context context, int quality, boolean isFallback,
+ int minLength, int maxLength, boolean requirePasswordToDecrypt,
+ boolean confirmCredentials) {
+ final Intent intent = SetupChooseLockPassword.createIntent(context, quality,
+ isFallback, minLength, maxLength, requirePasswordToDecrypt, confirmCredentials);
+ SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent);
+ return intent;
+ }
+
+ @Override
+ protected Intent getLockPatternIntent(Context context, boolean isFallback,
+ boolean requirePassword, boolean confirmCredentials) {
+ final Intent intent = SetupChooseLockPattern.createIntent(context, isFallback,
+ requirePassword, confirmCredentials);
+ SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent);
+ return intent;
+ }
}
}
--- /dev/null
+/*
+ * 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.
+ */
+
+package com.android.settings;
+
+import com.android.setupwizard.navigationbar.SetupWizardNavBar;
+
+import android.app.Fragment;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class SetupChooseLockPassword extends ChooseLockPassword
+ implements SetupWizardNavBar.NavigationBarListener {
+
+ public static Intent createIntent(Context context, int quality, final boolean isFallback,
+ int minLength, final int maxLength, boolean requirePasswordToDecrypt,
+ boolean confirmCredentials) {
+ Intent intent = ChooseLockPassword.createIntent(context, quality, isFallback, minLength,
+ maxLength, requirePasswordToDecrypt, confirmCredentials);
+ intent.setClass(context, SetupChooseLockPassword.class);
+ intent.putExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, false);
+ return intent;
+ }
+
+ @Override
+ protected boolean isValidFragment(String fragmentName) {
+ return SetupChooseLockPasswordFragment.class.getName().equals(fragmentName);
+ }
+
+ @Override
+ /* package */ Class<? extends Fragment> getFragmentClass() {
+ return SetupChooseLockPasswordFragment.class;
+ }
+
+ @Override
+ protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
+ resid = SetupWizardUtils.getTheme(getIntent(), resid);
+ super.onApplyThemeResource(theme, resid, first);
+ }
+
+ @Override
+ public void onNavigationBarCreated(SetupWizardNavBar bar) {
+ SetupWizardUtils.setImmersiveMode(this, bar);
+ }
+
+ @Override
+ public void onNavigateBack() {
+ onBackPressed();
+ }
+
+ @Override
+ public void onNavigateNext() {
+ }
+
+ public static class SetupChooseLockPasswordFragment extends ChooseLockPasswordFragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ final View view = inflater.inflate(R.layout.setup_template, container, false);
+ ViewGroup setupContent = (ViewGroup) view.findViewById(R.id.setup_content);
+ inflater.inflate(R.layout.setup_choose_lock_password, setupContent, true);
+ return view;
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.
+ */
+
+package com.android.settings;
+
+import com.android.setupwizard.navigationbar.SetupWizardNavBar;
+
+import android.app.Fragment;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class SetupChooseLockPattern extends ChooseLockPattern
+ implements SetupWizardNavBar.NavigationBarListener {
+
+ public static Intent createIntent(Context context, final boolean isFallback,
+ boolean requirePassword, boolean confirmCredentials) {
+ Intent intent = ChooseLockPattern.createIntent(context, isFallback, requirePassword,
+ confirmCredentials);
+ intent.setClass(context, SetupChooseLockPattern.class);
+ return intent;
+ }
+
+ @Override
+ protected boolean isValidFragment(String fragmentName) {
+ return SetupChooseLockPatternFragment.class.getName().equals(fragmentName);
+ }
+
+ @Override
+ /* package */ Class<? extends Fragment> getFragmentClass() {
+ return SetupChooseLockPatternFragment.class;
+ }
+
+ @Override
+ protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
+ resid = SetupWizardUtils.getTheme(getIntent(), resid);
+ super.onApplyThemeResource(theme, resid, first);
+ }
+
+ @Override
+ public void onNavigationBarCreated(SetupWizardNavBar bar) {
+ SetupWizardUtils.setImmersiveMode(this, bar);
+ }
+
+ @Override
+ public void onNavigateBack() {
+ onBackPressed();
+ }
+
+ @Override
+ public void onNavigateNext() {
+ }
+
+ public static class SetupChooseLockPatternFragment extends ChooseLockPatternFragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ final View view = inflater.inflate(R.layout.setup_template, container, false);
+ ViewGroup setupContent = (ViewGroup) view.findViewById(R.id.setup_content);
+ inflater.inflate(R.layout.setup_choose_lock_pattern, setupContent, true);
+ return view;
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
+ }
+ }
+}
public static void setHeaderText(Activity activity, CharSequence text) {
getHeader(activity).setText(text);
}
+
+ public static void copySetupExtras(Intent fromIntent, Intent toIntent) {
+ toIntent.putExtra(EXTRA_THEME, fromIntent.getStringExtra(EXTRA_THEME));
+ toIntent.putExtra(EXTRA_USE_IMMERSIVE_MODE,
+ fromIntent.getBooleanExtra(EXTRA_USE_IMMERSIVE_MODE, false));
+ }
}