1// CHECKSTYLE:OFF Generated code 2/* This file is auto-generated from ErrorFragment.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.content.Context; 20import android.os.Bundle; 21import android.support.v4.content.res.ResourcesCompat; 22import android.util.Log; 23import android.view.View; 24 25public class ErrorSupportFragment extends android.support.v17.leanback.app.ErrorSupportFragment { 26 private static final String TAG = "leanback.ErrorSupportFragment"; 27 private static final boolean TRANSLUCENT = true; 28 29 @Override 30 public void onCreate(Bundle savedInstanceState) { 31 Log.i(TAG, "onCreate"); 32 super.onCreate(savedInstanceState); 33 34 setTitle("Leanback Sample App"); 35 final Context context = getActivity(); 36 setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), 37 R.drawable.lb_ic_sad_cloud, context.getTheme())); 38 setMessage("An error occurred."); 39 setDefaultBackground(TRANSLUCENT); 40 41 setButtonText("Dismiss"); 42 setButtonClickListener(new View.OnClickListener() { 43 @Override 44 public void onClick(View arg0) { 45 Log.i(TAG, "button clicked"); 46 getFragmentManager().beginTransaction().remove(ErrorSupportFragment.this).commit(); 47 } 48 }); 49 } 50} 51