blob: 10d30139b6ca9841afd057e93fb5e0b1777e3ce5 [file] [log] [blame]
danielwbhuang6125f9a2023-01-07 23:06:46 +08001/*
2 * Copyright (C) 2023 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
17package com.android.settings.inputmethod;
18
19import android.content.Context;
Josep del Rio8411d1c2023-02-05 21:20:23 +000020import android.hardware.input.InputSettings;
danielwbhuang6125f9a2023-01-07 23:06:46 +080021
22import com.android.settings.R;
23import com.android.settings.core.TogglePreferenceController;
24
25public class TrackpadReverseScrollingPreferenceController extends TogglePreferenceController {
26
danielwbhuang6125f9a2023-01-07 23:06:46 +080027 public TrackpadReverseScrollingPreferenceController(Context context, String key) {
28 super(context, key);
danielwbhuang6125f9a2023-01-07 23:06:46 +080029 }
30
31 @Override
32 public boolean isChecked() {
danielwbhuang0b79c922023-05-03 23:59:55 +080033 return !InputSettings.useTouchpadNaturalScrolling(mContext);
danielwbhuang6125f9a2023-01-07 23:06:46 +080034 }
35
36 @Override
37 public boolean setChecked(boolean isChecked) {
danielwbhuang0b79c922023-05-03 23:59:55 +080038 InputSettings.setTouchpadNaturalScrolling(mContext, !isChecked);
danielwbhuang6125f9a2023-01-07 23:06:46 +080039 return true;
40 }
41
42 @Override
43 public int getAvailabilityStatus() {
44 return AVAILABLE;
45 }
46
47 @Override
48 public int getSliceHighlightMenuRes() {
49 return R.string.menu_key_system;
50 }
51}