OSDN Git Service

am 28539897: am 8815f032: Merge "Always set right auth_type value in apn."
[android-x86/packages-apps-Settings.git] / src / com / android / settings / ChooseLockPatternTutorial.java
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package com.android.settings;
18
19 import com.android.internal.widget.LockPatternUtils;
20
21 import android.app.Activity;
22 import android.content.Intent;
23 import android.os.Bundle;
24 import android.view.View;
25
26 public class ChooseLockPatternTutorial extends Activity implements View.OnClickListener {
27     private View mNextButton;
28     private View mSkipButton;
29
30     @Override
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);
40             finish();
41         } else {
42             initViews();
43         }
44     }
45
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);
52     }
53
54     public void onClick(View v) {
55         if (v == mSkipButton) {
56             // Canceling, so finish all
57             setResult(ChooseLockPattern.RESULT_FINISHED);
58             finish();
59         } else if (v == mNextButton) {
60             Intent intent = new Intent(this, ChooseLockPatternExample.class);
61             intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
62             startActivity(intent);
63             finish();
64         }
65     }
66 }
67