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.tv.settings.connectivity;
18 
19 import android.support.annotation.Nullable;
20 import android.os.Bundle;
21 import android.view.LayoutInflater;
22 import android.view.View;
23 import android.view.ViewGroup;
24 import android.view.ViewGroup.LayoutParams;
25 import android.widget.FrameLayout;
26 
27 import com.android.tv.settings.R;
28 import com.android.tv.settings.dialog.ProgressDialogFragment;
29 
30 /**
31  * Displays a UI for showing that WPS is active
32  */
33 public class WpsScanningFragment extends ProgressDialogFragment {
34 
newInstance()35     public static WpsScanningFragment newInstance() {
36         return new WpsScanningFragment();
37     }
38 
39     // The progress dialog fragment is not full screen, but fragment transition assumes all
40     // fragments are fullscreen.  This class adds a FrameLayout to hold the actual content.
41     @Override
onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)42     public View onCreateView(
43             LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
44         View view = super.onCreateView(inflater, container, savedInstanceState);
45         FrameLayout holder = new FrameLayout(getActivity());
46         holder.setLayoutParams(
47                 new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
48         holder.addView(view);
49         return holder;
50     }
51 
52     @Override
onViewCreated(View view, @Nullable Bundle savedInstanceState)53     public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
54         super.onViewCreated(view, savedInstanceState);
55         setTitle(R.string.wifi_wps_title);
56         setSummary(R.string.wifi_wps_instructions);
57         setIcon(R.drawable.setup_wps);
58     }
59 }
60