Home | History | Annotate | Download | only in password
      1 /*
      2  * Copyright (C) 2014 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.password;
     18 
     19 import android.app.Fragment;
     20 import android.content.Context;
     21 import android.content.Intent;
     22 
     23 import com.android.settings.SetupRedactionInterstitial;
     24 
     25 /**
     26  * Setup Wizard's version of ChooseLockPattern screen. It inherits the logic and basic structure
     27  * from ChooseLockPattern class, and should remain similar to that behaviorally. This class should
     28  * only overload base methods for minor theme and behavior differences specific to Setup Wizard.
     29  * Other changes should be done to ChooseLockPattern class instead and let this class inherit
     30  * those changes.
     31  */
     32 public class SetupChooseLockPattern extends ChooseLockPattern {
     33 
     34     public static Intent modifyIntentForSetup(Context context, Intent chooseLockPatternIntent) {
     35         chooseLockPatternIntent.setClass(context, SetupChooseLockPattern.class);
     36         return chooseLockPatternIntent;
     37     }
     38 
     39     @Override
     40     protected boolean isValidFragment(String fragmentName) {
     41         return SetupChooseLockPatternFragment.class.getName().equals(fragmentName);
     42     }
     43 
     44     @Override
     45     /* package */ Class<? extends Fragment> getFragmentClass() {
     46         return SetupChooseLockPatternFragment.class;
     47     }
     48 
     49     public static class SetupChooseLockPatternFragment extends ChooseLockPatternFragment {
     50 
     51         @Override
     52         protected Intent getRedactionInterstitialIntent(Context context) {
     53             // Setup wizard's redaction interstitial is deferred to optional step. Enable that
     54             // optional step if the lock screen was set up.
     55             SetupRedactionInterstitial.setEnabled(context, true);
     56             return null;
     57         }
     58     }
     59 }
     60