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 */ 17package com.example.android.leanback; 18 19import android.os.Bundle; 20import android.os.Handler; 21import android.view.Gravity; 22import android.view.LayoutInflater; 23import android.view.View; 24import android.view.ViewGroup; 25import android.widget.FrameLayout; 26import android.widget.ProgressBar; 27 28import androidx.fragment.app.Fragment; 29import androidx.fragment.app.FragmentActivity; 30 31public class BrowseErrorSupportActivity extends FragmentActivity 32{ 33 /** Called when the activity is first created. */ 34 @Override 35 public void onCreate(Bundle savedInstanceState) 36 { 37 super.onCreate(savedInstanceState); 38 setContentView(R.layout.browse_support); 39 40 testError(); 41 } 42 43 private void testError() { 44 Handler handler = new Handler(); 45 handler.postDelayed(new Runnable() { 46 @Override 47 public void run() { 48 if (getSupportFragmentManager().isDestroyed()) { 49 return; 50 } 51 getSupportFragmentManager().beginTransaction().add(R.id.main_frame, 52 new ErrorSupportFragment()).commit(); 53 } 54 }, 3000); 55 } 56 57 static public class SpinnerSupportFragment extends Fragment { 58 @Override 59 public View onCreateView(LayoutInflater inflater, ViewGroup container, 60 Bundle savedInstanceState) { 61 ProgressBar progressBar = new ProgressBar(container.getContext()); 62 if (container instanceof FrameLayout) { 63 FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(100, 100, 64 Gravity.CENTER); 65 progressBar.setLayoutParams(layoutParams); 66 } 67 return progressBar; 68 } 69 } 70} 71