1 /* 2 * Copyright (C) 2015 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.android.tv.settings.about; 18 19 import android.content.Context; 20 import android.os.Bundle; 21 import android.support.annotation.Keep; 22 import android.support.v17.preference.LeanbackPreferenceFragment; 23 import android.support.v7.preference.PreferenceScreen; 24 25 import com.android.tv.settings.PreferenceUtils; 26 import com.android.tv.settings.R; 27 28 @Keep 29 public class LegalFragment extends LeanbackPreferenceFragment { 30 31 private static final String KEY_TERMS = "terms"; 32 private static final String KEY_LICENSE = "license"; 33 private static final String KEY_COPYRIGHT = "copyright"; 34 private static final String KEY_WEBVIEW_LICENSE = "webview_license"; 35 private static final String KEY_ADS = "ads"; 36 37 @Override 38 public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { 39 setPreferencesFromResource(R.xml.about_legal, null); 40 final PreferenceScreen screen = getPreferenceScreen(); 41 42 final Context context = getActivity(); 43 PreferenceUtils.resolveSystemActivityOrRemove(context, screen, 44 findPreference(KEY_TERMS), PreferenceUtils.FLAG_SET_TITLE); 45 PreferenceUtils.resolveSystemActivityOrRemove(context, screen, 46 findPreference(KEY_LICENSE), PreferenceUtils.FLAG_SET_TITLE); 47 PreferenceUtils.resolveSystemActivityOrRemove(context, screen, 48 findPreference(KEY_COPYRIGHT), PreferenceUtils.FLAG_SET_TITLE); 49 PreferenceUtils.resolveSystemActivityOrRemove(context, screen, 50 findPreference(KEY_WEBVIEW_LICENSE), PreferenceUtils.FLAG_SET_TITLE); 51 PreferenceUtils.resolveSystemActivityOrRemove(context, screen, 52 findPreference(KEY_ADS), PreferenceUtils.FLAG_SET_TITLE); 53 } 54 } 55