ErrorSupportFragment.java revision b7087e036a48f5a3db28d02ff7f9b97fbbc46c4f
19b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light/* This file is auto-generated from ErrorFragment.java. DO NOT MODIFY. */ 29b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light 39b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light/* 49b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light * Copyright (C) 2014 The Android Open Source Project 59b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light * 69b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 79b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light * in compliance with the License. You may obtain a copy of the License at 89b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light * 99b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light * http://www.apache.org/licenses/LICENSE-2.0 109b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light * 119b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light * Unless required by applicable law or agreed to in writing, software distributed under the License 129b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 139b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light * or implied. See the License for the specific language governing permissions and limitations under 149b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light * the License. 159b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light */ 169b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Lightpackage com.example.android.leanback; 179b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light 189b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Lightimport android.content.Context; 199b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Lightimport android.os.Bundle; 209b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Lightimport android.support.v4.content.res.ResourcesCompat; 219b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Lightimport android.util.Log; 229b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Lightimport android.view.View; 239b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light 249b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Lightpublic class ErrorSupportFragment extends android.support.v17.leanback.app.ErrorSupportFragment { 259b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light private static final String TAG = "leanback.ErrorSupportFragment"; 269b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light private static final boolean TRANSLUCENT = true; 279b71cad2381cbd67d7e3a9ca2af357ae6998be83Alex Light 28 @Override 29 public void onCreate(Bundle savedInstanceState) { 30 Log.i(TAG, "onCreate"); 31 super.onCreate(savedInstanceState); 32 33 setTitle("Leanback Sample App"); 34 final Context context = getActivity(); 35 setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), 36 R.drawable.lb_ic_sad_cloud, context.getTheme())); 37 setMessage("An error occurred."); 38 setDefaultBackground(TRANSLUCENT); 39 40 setButtonText("Dismiss"); 41 setButtonClickListener(new View.OnClickListener() { 42 @Override 43 public void onClick(View arg0) { 44 Log.i(TAG, "button clicked"); 45 getFragmentManager().beginTransaction().remove(ErrorSupportFragment.this).commit(); 46 } 47 }); 48 } 49} 50