ConfirmConvertToFbe.java revision 019aad4c61da0b358782bc3cc59cc2688bb84a39
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 */
16package com.android.settings.applications;
17
18import android.app.Fragment;
19import android.content.Intent;
20import android.os.Bundle;
21import android.view.LayoutInflater;
22import android.view.View;
23import android.view.ViewGroup;
24import android.widget.Button;
25
26import com.android.internal.logging.MetricsProto.MetricsEvent;
27import com.android.settings.R;
28import com.android.settings.SettingsPreferenceFragment;
29
30public 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