| danielwbhuang | 6125f9a | 2023-01-07 23:06:46 +0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.settings.inputmethod; |
| 18 | |
| 19 | import android.content.Context; |
| Josep del Rio | 8411d1c | 2023-02-05 21:20:23 +0000 | [diff] [blame] | 20 | import android.hardware.input.InputSettings; |
| danielwbhuang | 6125f9a | 2023-01-07 23:06:46 +0800 | [diff] [blame] | 21 | |
| 22 | import com.android.settings.R; |
| 23 | import com.android.settings.core.TogglePreferenceController; |
| 24 | |
| 25 | public class TrackpadReverseScrollingPreferenceController extends TogglePreferenceController { |
| 26 | |
| danielwbhuang | 6125f9a | 2023-01-07 23:06:46 +0800 | [diff] [blame] | 27 | public TrackpadReverseScrollingPreferenceController(Context context, String key) { |
| 28 | super(context, key); |
| danielwbhuang | 6125f9a | 2023-01-07 23:06:46 +0800 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | @Override |
| 32 | public boolean isChecked() { |
| danielwbhuang | 0b79c92 | 2023-05-03 23:59:55 +0800 | [diff] [blame] | 33 | return !InputSettings.useTouchpadNaturalScrolling(mContext); |
| danielwbhuang | 6125f9a | 2023-01-07 23:06:46 +0800 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | @Override |
| 37 | public boolean setChecked(boolean isChecked) { |
| danielwbhuang | 0b79c92 | 2023-05-03 23:59:55 +0800 | [diff] [blame] | 38 | InputSettings.setTouchpadNaturalScrolling(mContext, !isChecked); |
| danielwbhuang | 6125f9a | 2023-01-07 23:06:46 +0800 | [diff] [blame] | 39 | 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 | } |