• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // CHECKSTYLE:OFF Generated code
2 /* This file is auto-generated from BrowseErrorActivity.java.  DO NOT MODIFY. */
3 
4 /*
5  * Copyright (C) 2014 The Android Open Source Project
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8  * in compliance with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software distributed under the License
13  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14  * or implied. See the License for the specific language governing permissions and limitations under
15  * the License.
16  */
17 package com.example.android.leanback;
18 
19 import android.support.v4.app.FragmentActivity;
20 import android.support.v4.app.Fragment;
21 import android.os.Bundle;
22 import android.os.Handler;
23 import android.view.Gravity;
24 import android.view.LayoutInflater;
25 import android.view.View;
26 import android.view.ViewGroup;
27 import android.widget.FrameLayout;
28 import android.widget.ProgressBar;
29 
30 public class BrowseErrorSupportActivity extends FragmentActivity
31 {
32     /** Called when the activity is first created. */
33     @Override
onCreate(Bundle savedInstanceState)34     public void onCreate(Bundle savedInstanceState)
35     {
36         super.onCreate(savedInstanceState);
37         setContentView(R.layout.browse_support);
38 
39         testError();
40     }
41 
testError()42     private void testError() {
43         Handler handler = new Handler();
44         handler.postDelayed(new Runnable() {
45             @Override
46             public void run() {
47                 if (getSupportFragmentManager().isDestroyed()) {
48                     return;
49                 }
50                 getSupportFragmentManager().beginTransaction().add(R.id.main_frame,
51                         new ErrorSupportFragment()).commit();
52             }
53         }, 3000);
54     }
55 
56     static public class SpinnerSupportFragment extends Fragment {
57         @Override
onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)58         public View onCreateView(LayoutInflater inflater, ViewGroup container,
59                     Bundle savedInstanceState) {
60             ProgressBar progressBar = new ProgressBar(container.getContext());
61             if (container instanceof FrameLayout) {
62                 FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(100, 100,
63                         Gravity.CENTER);
64                 progressBar.setLayoutParams(layoutParams);
65             }
66             return progressBar;
67         }
68     }
69 }
70