1 /* 2 * Copyright (C) 2016 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.google.android.car.kitchensink.setting; 18 19 import android.os.Bundle; 20 import android.preference.PreferenceActivity; 21 import android.view.View; 22 import android.widget.Button; 23 24 import com.google.android.car.kitchensink.R; 25 26 import java.util.List; 27 28 public class CarServiceSettingsActivity extends PreferenceActivity { 29 private static final String TAG = CarServiceSettingsActivity.class.getSimpleName(); 30 31 @Override 32 public void onCreate(Bundle savedInstanceState) { 33 super.onCreate(savedInstanceState); 34 Button button = new Button(this); 35 button.setText("Finish"); 36 button.setOnClickListener(new View.OnClickListener() { 37 @Override 38 public void onClick(View view) { 39 finish(); 40 } 41 }); 42 setListFooter(button); 43 } 44 45 @Override 46 public void onBuildHeaders(List<Header> target) { 47 loadHeadersFromResource(R.xml.preference_header, target); 48 } 49 50 @Override 51 protected boolean isValidFragment(String fragmentName) { 52 if (GarageModeSettingsFragment.class.getName().equals(fragmentName) 53 || UsbManagerFragment.class.getName().equals(fragmentName)) { 54 return true; 55 } 56 return false; 57 } 58 } 59