blob: 225fe46dcbdfa263a648ecff54d26b827cd2a8f1 [file] [log] [blame]
Maurice Lamecd2b7b2014-12-01 10:41:49 -08001/*
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
17package com.android.settings;
18
Maurice Lamecd2b7b2014-12-01 10:41:49 -080019import android.content.Intent;
20import android.content.res.Resources;
Maurice Lamecd2b7b2014-12-01 10:41:49 -080021import android.os.Bundle;
22import android.view.LayoutInflater;
23import android.view.View;
24import android.view.ViewGroup;
Maurice Lam190ec1c2016-04-22 16:41:18 -070025import android.widget.Button;
Udam Saini71fde522016-03-30 13:38:05 -070026import android.widget.LinearLayout;
Maurice Lam25e30812015-06-04 17:17:07 -070027
28import com.android.settings.notification.RedactionInterstitial;
Maurice Lamecd2b7b2014-12-01 10:41:49 -080029
30/**
31 * Setup Wizard's version of RedactionInterstitial screen. It inherits the logic and basic structure
32 * from RedactionInterstitial class, and should remain similar to that behaviorally. This class
33 * should only overload base methods for minor theme and behavior differences specific to Setup
34 * Wizard. Other changes should be done to RedactionInterstitial class instead and let this class
35 * inherit those changes.
36 */
Maurice Lam83301b52015-04-18 20:11:59 -070037public class SetupRedactionInterstitial extends RedactionInterstitial {
Maurice Lamecd2b7b2014-12-01 10:41:49 -080038
Maurice Lamecd2b7b2014-12-01 10:41:49 -080039 @Override
40 public Intent getIntent() {
41 Intent modIntent = new Intent(super.getIntent());
42 modIntent.putExtra(EXTRA_SHOW_FRAGMENT,
Udam Sainidd05ab72016-03-21 17:35:08 -070043 SetupRedactionInterstitialFragment.class.getName());
Maurice Lamecd2b7b2014-12-01 10:41:49 -080044 return modIntent;
45 }
46
47 @Override
48 protected boolean isValidFragment(String fragmentName) {
Udam Sainidd05ab72016-03-21 17:35:08 -070049 return SetupRedactionInterstitialFragment.class.getName().equals(fragmentName);
Maurice Lamecd2b7b2014-12-01 10:41:49 -080050 }
51
52 @Override
53 protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
Maurice Lam598be1e2015-04-08 21:13:42 -070054 resid = SetupWizardUtils.getTheme(getIntent());
Maurice Lamecd2b7b2014-12-01 10:41:49 -080055 super.onApplyThemeResource(theme, resid, first);
56 }
57
Udam Saini71fde522016-03-30 13:38:05 -070058 @Override
59 protected void onCreate(Bundle savedInstance) {
60 super.onCreate(savedInstance);
61 LinearLayout layout = (LinearLayout) findViewById(R.id.content_parent);
62 layout.setFitsSystemWindows(false);
63 }
64
Udam Sainidd05ab72016-03-21 17:35:08 -070065 public static class SetupRedactionInterstitialFragment extends RedactionInterstitialFragment
Maurice Lam190ec1c2016-04-22 16:41:18 -070066 implements View.OnClickListener {
Maurice Lamecd2b7b2014-12-01 10:41:49 -080067
68 @Override
69 public View onCreateView(LayoutInflater inflater, ViewGroup container,
70 Bundle savedInstanceState) {
Maurice Lam25e30812015-06-04 17:17:07 -070071 return inflater.inflate(R.layout.setup_redaction_interstitial, container, false);
72 }
Maurice Lam83301b52015-04-18 20:11:59 -070073
Maurice Lam25e30812015-06-04 17:17:07 -070074 @Override
75 public void onViewCreated(View view, Bundle savedInstanceState) {
76 super.onViewCreated(view, savedInstanceState);
Maurice Lam190ec1c2016-04-22 16:41:18 -070077 final Button button = (Button) view.findViewById(R.id.redaction_next_button);
78 button.setOnClickListener(this);
Maurice Lamecd2b7b2014-12-01 10:41:49 -080079 }
80
81 @Override
Maurice Lam190ec1c2016-04-22 16:41:18 -070082 public void onClick(View v) {
83 if (v.getId() == R.id.redaction_next_button) {
84 final SetupRedactionInterstitial activity =
85 (SetupRedactionInterstitial) getActivity();
86 if (activity != null) {
87 activity.setResult(RESULT_OK, activity.getResultIntentData());
88 finish();
89 }
Maurice Lam83301b52015-04-18 20:11:59 -070090 }
Maurice Lamecd2b7b2014-12-01 10:41:49 -080091 }
92 }
93}