1 /* 2 * Copyright 2025 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 static android.app.settings.SettingsEnums.ACTION_BOUNCE_KEYS_CUSTOM_VALUE_CHANGE; 20 21 import android.hardware.input.InputSettings; 22 import android.os.Bundle; 23 24 import com.android.settings.R; 25 26 public class KeyboardAccessibilityBounceKeysDialogFragment extends 27 KeyboardAccessibilityKeysDialogFragment { 28 getInstance()29 static KeyboardAccessibilityBounceKeysDialogFragment getInstance() { 30 final KeyboardAccessibilityBounceKeysDialogFragment result = 31 new KeyboardAccessibilityBounceKeysDialogFragment(); 32 Bundle bundle = new Bundle(); 33 bundle.putInt(EXTRA_TITLE_RES, R.string.bounce_keys_dialog_title); 34 bundle.putInt(EXTRA_SUBTITLE_RES, R.string.bounce_keys_dialog_subtitle); 35 bundle.putInt(EXTRA_SEEKBAR_CONTENT_DESCRIPTION, 36 R.string.input_setting_bounce_keys_seekbar_desc); 37 result.setArguments(bundle); 38 return result; 39 } 40 41 @Override updateInputSettingKeysValue(int thresholdTimeMillis)42 protected void updateInputSettingKeysValue(int thresholdTimeMillis) { 43 InputSettings.setAccessibilityBounceKeysThreshold(getContext(), thresholdTimeMillis); 44 } 45 46 @Override onCustomValueUpdated(int thresholdTimeMillis)47 protected void onCustomValueUpdated(int thresholdTimeMillis) { 48 mMetricsFeatureProvider.action(getContext(), ACTION_BOUNCE_KEYS_CUSTOM_VALUE_CHANGE, 49 thresholdTimeMillis); 50 } 51 52 @Override getInputSettingKeysValue()53 protected int getInputSettingKeysValue() { 54 return InputSettings.getAccessibilityBounceKeysThreshold(getContext()); 55 } 56 } 57