1 /*
2  * Copyright (C) 2022 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 package com.android.tv.ui.sidepanel;
17 
18 import com.android.tv.R;
19 import com.android.tv.util.TvSettings;
20 import java.util.ArrayList;
21 import java.util.List;
22 
23 public class InteractiveAppSettingsFragment extends SideFragment {
24     private static final String TRACKER_LABEL = "Interactive Application Settings";
25     @Override
getTitle()26     protected String getTitle() {
27         return getString(R.string.interactive_app_settings);
28     }
29     @Override
getTrackerLabel()30     public String getTrackerLabel() {
31         return TRACKER_LABEL;
32     }
33     @Override
getItemList()34     protected List<Item> getItemList() {
35         List<Item> items = new ArrayList<>();
36         items.add(
37                 new SwitchItem(
38                         getString(R.string.tv_iapp_on),
39                         getString(R.string.tv_iapp_off)) {
40                     @Override
41                     protected void onUpdate() {
42                         super.onUpdate();
43                         setChecked(TvSettings.isTvIAppOn(getContext()));
44                     }
45                     @Override
46                     protected void onSelected() {
47                         super.onSelected();
48                         boolean checked = isChecked();
49                         TvSettings.setTvIAppOn(getContext(), checked);
50                     }
51                 });
52         return items;
53     }
54 }
55