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; 18 19 import android.content.Context; 20 import android.content.Intent; 21 import android.content.res.Resources; 22 import android.os.Bundle; 23 import android.widget.LinearLayout; 24 25 /** 26 * Setup Wizard's version of EncryptionInterstitial screen. It inherits the logic and basic 27 * structure from EncryptionInterstitial class, and should remain similar to that behaviorally. This 28 * class should only overload base methods for minor theme and behavior differences specific to 29 * Setup Wizard. Other changes should be done to EncryptionInterstitial class instead and let this 30 * class inherit those changes. 31 */ 32 public class SetupEncryptionInterstitial extends EncryptionInterstitial { 33 createStartIntent(Context ctx, int quality, boolean requirePasswordDefault, Intent unlockMethodIntent)34 public static Intent createStartIntent(Context ctx, int quality, 35 boolean requirePasswordDefault, Intent unlockMethodIntent) { 36 Intent startIntent = EncryptionInterstitial.createStartIntent(ctx, quality, 37 requirePasswordDefault, unlockMethodIntent); 38 startIntent.setClass(ctx, SetupEncryptionInterstitial.class); 39 startIntent.putExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, false) 40 .putExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID, -1); 41 return startIntent; 42 } 43 44 @Override getIntent()45 public Intent getIntent() { 46 Intent modIntent = new Intent(super.getIntent()); 47 modIntent.putExtra(EXTRA_SHOW_FRAGMENT, 48 SetupEncryptionInterstitialFragment.class.getName()); 49 return modIntent; 50 } 51 52 @Override isValidFragment(String fragmentName)53 protected boolean isValidFragment(String fragmentName) { 54 return SetupEncryptionInterstitialFragment.class.getName().equals(fragmentName); 55 } 56 57 @Override onApplyThemeResource(Resources.Theme theme, int resid, boolean first)58 protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) { 59 resid = SetupWizardUtils.getTheme(getIntent()); 60 super.onApplyThemeResource(theme, resid, first); 61 } 62 63 @Override onCreate(Bundle savedInstance)64 protected void onCreate(Bundle savedInstance) { 65 super.onCreate(savedInstance); 66 LinearLayout layout = (LinearLayout) findViewById(R.id.content_parent); 67 layout.setFitsSystemWindows(false); 68 } 69 70 public static class SetupEncryptionInterstitialFragment extends EncryptionInterstitialFragment { 71 } 72 } 73