Home | History | Annotate | Download | only in about
      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.v7.preference.PreferenceScreen;
     23 
     24 import com.android.internal.logging.nano.MetricsProto;
     25 import com.android.tv.settings.PreferenceUtils;
     26 import com.android.tv.settings.R;
     27 import com.android.tv.settings.SettingsPreferenceFragment;
     28 
     29 @Keep
     30 public class LegalFragment extends SettingsPreferenceFragment {
     31 
     32     private static final String KEY_TERMS = "terms";
     33     private static final String KEY_LICENSE = "license";
     34     private static final String KEY_COPYRIGHT = "copyright";
     35     private static final String KEY_WEBVIEW_LICENSE = "webview_license";
     36     private static final String KEY_ADS = "ads";
     37 
     38     @Override
     39     public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
     40         setPreferencesFromResource(R.xml.about_legal, null);
     41         final PreferenceScreen screen = getPreferenceScreen();
     42 
     43         final Context context = getActivity();
     44         PreferenceUtils.resolveSystemActivityOrRemove(context, screen,
     45                 findPreference(KEY_TERMS), PreferenceUtils.FLAG_SET_TITLE);
     46         PreferenceUtils.resolveSystemActivityOrRemove(context, screen,
     47                 findPreference(KEY_LICENSE), PreferenceUtils.FLAG_SET_TITLE);
     48         PreferenceUtils.resolveSystemActivityOrRemove(context, screen,
     49                 findPreference(KEY_COPYRIGHT), PreferenceUtils.FLAG_SET_TITLE);
     50         PreferenceUtils.resolveSystemActivityOrRemove(context, screen,
     51                 findPreference(KEY_WEBVIEW_LICENSE), PreferenceUtils.FLAG_SET_TITLE);
     52         PreferenceUtils.resolveSystemActivityOrRemove(context, screen,
     53                 findPreference(KEY_ADS), PreferenceUtils.FLAG_SET_TITLE);
     54     }
     55 
     56     @Override
     57     public int getMetricsCategory() {
     58         return MetricsProto.MetricsEvent.ABOUT_LEGAL_SETTINGS;
     59     }
     60 }
     61