• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package com.android.settings.inputmethod;
18 
19 import android.app.settings.SettingsEnums;
20 import android.content.Context;
21 import android.os.Bundle;
22 import android.util.FeatureFlagUtils;
23 
24 import androidx.annotation.NonNull;
25 
26 import com.android.settings.R;
27 import com.android.settings.dashboard.DashboardFragment;
28 import com.android.settings.search.BaseSearchIndexProvider;
29 import com.android.settingslib.search.SearchIndexable;
30 
31 @SearchIndexable
32 public class TouchpadAndMouseSettings extends DashboardFragment {
33 
34     private static final String TAG = TouchpadAndMouseSettings.class.getSimpleName();
35 
36     @Override
onAttach(@onNull Context context)37     public void onAttach(@NonNull Context context) {
38         super.onAttach(context);
39         use(TouchpadGesturesTutorialButtonPreferenceController.class).setFragment(this /*parent*/);
40     }
41 
42     @Override
onCreate(@onNull Bundle icicle)43     public void onCreate(@NonNull Bundle icicle) {
44         super.onCreate(icicle);
45         getPreferenceScreen().setTitle(
46                 InputPeripheralsSettingsUtils.getTouchpadAndMouseTitleTitleResId());
47     }
48 
49     @Override
getMetricsCategory()50     public int getMetricsCategory() {
51         return SettingsEnums.SETTINGS_KEYBOARDS_TOUCHPAD;
52     }
53 
54     @Override
getLogTag()55     protected String getLogTag() {
56         return TAG;
57     }
58 
59     @Override
getPreferenceScreenResId()60     protected int getPreferenceScreenResId() {
61         return R.xml.touchpad_and_mouse_settings;
62     }
63 
64     public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
65             new BaseSearchIndexProvider(R.xml.touchpad_and_mouse_settings) {
66                 @Override
67                 protected boolean isPageSearchEnabled(Context context) {
68                     return FeatureFlagUtils
69                             .isEnabled(context, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD)
70                             && InputPeripheralsSettingsUtils.isTouchpad();
71                 }
72             };
73 }
74