Home | History | Annotate | Download | only in applications
      1 /*
      2  * Copyright (C) 2016 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 package com.android.settings.applications;
     17 
     18 import android.app.Fragment;
     19 import android.content.Intent;
     20 import android.os.Bundle;
     21 import android.view.LayoutInflater;
     22 import android.view.View;
     23 import android.view.ViewGroup;
     24 import android.widget.Button;
     25 
     26 import com.android.internal.logging.MetricsProto.MetricsEvent;
     27 import com.android.settings.R;
     28 import com.android.settings.SettingsPreferenceFragment;
     29 
     30 public class ConfirmConvertToFbe extends SettingsPreferenceFragment {
     31     static final String TAG = "ConfirmConvertToFBE";
     32 
     33     @Override
     34     public View onCreateView(LayoutInflater inflater, ViewGroup container,
     35                 Bundle savedInstanceState) {
     36         View rootView = inflater.inflate(R.layout.confirm_convert_fbe, null);
     37 
     38         final Button button = (Button) rootView.findViewById(R.id.button_confirm_convert_fbe);
     39         button.setOnClickListener(new View.OnClickListener() {
     40             public void onClick(View v) {
     41                 Intent intent = new Intent(Intent.ACTION_MASTER_CLEAR);
     42                 intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
     43                 intent.putExtra(Intent.EXTRA_REASON, "convert_fbe");
     44                 getActivity().sendBroadcast(intent);
     45             }
     46         });
     47 
     48         return rootView;
     49     }
     50 
     51     @Override
     52     protected int getMetricsCategory() {
     53         return MetricsEvent.CONVERT_FBE_CONFIRM;
     54     }
     55 }
     56