summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/ChooseLockPatternTutorial.java
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2010-12-07 20:41:41 -0800
committerJim Miller <jaggies@google.com>2010-12-08 16:45:52 -0800
commit17e9e1933055b207473b488595b2887bfcaea32e (patch)
tree7b3f0f0ac2d5fcf62ea7dc4300f7927488250cab /src/com/android/settings/ChooseLockPatternTutorial.java
parent1c7e49ba670ad70822d34234e3677fef53e94569 (diff)
downloadpackages_apps_settings-17e9e1933055b207473b488595b2887bfcaea32e.zip
packages_apps_settings-17e9e1933055b207473b488595b2887bfcaea32e.tar.gz
packages_apps_settings-17e9e1933055b207473b488595b2887bfcaea32e.tar.bz2
Fix 3148496: Initial pass at fragmentizing lockscreen settings.
This converts most of the existing activities to fragments and wraps them in PreferenceActivities so they can be launched as before (e.g. by a DevicePolicyManager) Upload after sync/rebase. Change-Id: I4f351b75d9fca0498bcb04b4e11ff3b70765a4ba
Diffstat (limited to 'src/com/android/settings/ChooseLockPatternTutorial.java')
-rw-r--r--src/com/android/settings/ChooseLockPatternTutorial.java89
1 files changed, 55 insertions, 34 deletions
diff --git a/src/com/android/settings/ChooseLockPatternTutorial.java b/src/com/android/settings/ChooseLockPatternTutorial.java
index e699abf..da600c4 100644
--- a/src/com/android/settings/ChooseLockPatternTutorial.java
+++ b/src/com/android/settings/ChooseLockPatternTutorial.java
@@ -18,49 +18,70 @@ package com.android.settings;
import com.android.internal.widget.LockPatternUtils;
-import android.app.Activity;
+import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
+import android.preference.PreferenceActivity;
+import android.view.LayoutInflater;
import android.view.View;
+import android.view.ViewGroup;
-public class ChooseLockPatternTutorial extends Activity implements View.OnClickListener {
- private View mNextButton;
- private View mSkipButton;
+public class ChooseLockPatternTutorial extends PreferenceActivity {
+
+ // required constructor for fragments
+ public ChooseLockPatternTutorial() {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- // Don't show the tutorial if the user has seen it before.
- LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
- if (savedInstanceState == null && lockPatternUtils.isPatternEverChosen()) {
- Intent intent = new Intent(this, ChooseLockPattern.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
- intent.putExtra("confirm_credentials", false);
- startActivity(intent);
- finish();
- } else {
- initViews();
- }
}
- private void initViews() {
- setContentView(R.layout.choose_lock_pattern_tutorial);
- mNextButton = findViewById(R.id.next_button);
- mNextButton.setOnClickListener(this);
- mSkipButton = findViewById(R.id.skip_button);
- mSkipButton.setOnClickListener(this);
+ @Override
+ public Intent getIntent() {
+ Intent modIntent = new Intent(super.getIntent());
+ modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ChooseLockPatternTutorialFragment.class.getName());
+ modIntent.putExtra(EXTRA_NO_HEADERS, true);
+ return modIntent;
}
- public void onClick(View v) {
- if (v == mSkipButton) {
- // Canceling, so finish all
- setResult(ChooseLockPattern.RESULT_FINISHED);
- finish();
- } else if (v == mNextButton) {
- Intent intent = new Intent(this, ChooseLockPatternExample.class);
- intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
- startActivity(intent);
- finish();
+ public static class ChooseLockPatternTutorialFragment extends Fragment
+ implements View.OnClickListener {
+ private View mNextButton;
+ private View mSkipButton;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ // Don't show the tutorial if the user has seen it before.
+ LockPatternUtils lockPatternUtils = new LockPatternUtils(getActivity());
+ if (savedInstanceState == null && lockPatternUtils.isPatternEverChosen()) {
+ Intent intent = new Intent(getActivity(), ChooseLockPattern.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+ intent.putExtra("confirm_credentials", false);
+ startActivity(intent);
+ getActivity().finish();
+ }
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View view = inflater.inflate(R.layout.choose_lock_pattern_tutorial, null);
+ mNextButton = view.findViewById(R.id.next_button);
+ mNextButton.setOnClickListener(this);
+ mSkipButton = view.findViewById(R.id.skip_button);
+ mSkipButton.setOnClickListener(this);
+ return view;
+ }
+
+ public void onClick(View v) {
+ if (v == mSkipButton) {
+ // Canceling, so finish all
+ getActivity().setResult(ChooseLockPattern.RESULT_FINISHED);
+ getActivity().finish();
+ } else if (v == mNextButton) {
+ Intent intent = new Intent(getActivity(), ChooseLockPatternExample.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+ startActivity(intent);
+ getActivity().finish();
+ }
}
}
}