2 * Copyright (C) 2008 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.settings;
19 import com.android.internal.widget.LockPatternUtils;
21 import android.app.Activity;
22 import android.content.Intent;
23 import android.os.Bundle;
24 import android.view.View;
26 public class ChooseLockPatternTutorial extends Activity implements View.OnClickListener {
27 private View mNextButton;
28 private View mSkipButton;
31 protected void onCreate(Bundle savedInstanceState) {
32 super.onCreate(savedInstanceState);
33 // Don't show the tutorial if the user has seen it before.
34 LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
35 if (savedInstanceState == null && lockPatternUtils.isPatternEverChosen()) {
36 Intent intent = new Intent(this, ChooseLockPattern.class);
37 intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
38 intent.putExtra("confirm_credentials", false);
39 startActivity(intent);
46 private void initViews() {
47 setContentView(R.layout.choose_lock_pattern_tutorial);
48 mNextButton = findViewById(R.id.next_button);
49 mNextButton.setOnClickListener(this);
50 mSkipButton = findViewById(R.id.skip_button);
51 mSkipButton.setOnClickListener(this);
54 public void onClick(View v) {
55 if (v == mSkipButton) {
56 // Canceling, so finish all
57 setResult(ChooseLockPattern.RESULT_FINISHED);
59 } else if (v == mNextButton) {
60 Intent intent = new Intent(this, ChooseLockPatternExample.class);
61 intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
62 startActivity(intent);