Add accessibility shortcuts fragment in a11y settings
Accessibility settings category restructure, add accessibility shortcuts fragment for related accessibility services. Bug: 174829936 Test: atest AccessibilityShortcutsFragmentTest, atest AccessibilitySettingsTest Change-Id: I9706906863872bc60d31eae54bbf3a35d70e812e
This commit is contained in:
@@ -372,6 +372,9 @@ public class AccessibilitySettings extends DashboardFragment {
|
||||
} else {
|
||||
getPreferenceScreen().addPreference(downloadedServicesCategory);
|
||||
}
|
||||
|
||||
// Hide screen reader category if it is empty.
|
||||
updatePreferenceCategoryVisibility(CATEGORY_SCREEN_READER);
|
||||
}
|
||||
|
||||
private List<RestrictedPreference> getInstalledAccessibilityList(Context context) {
|
||||
@@ -452,6 +455,16 @@ public class AccessibilitySettings extends DashboardFragment {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the visibility of a category according to its child preference count.
|
||||
*
|
||||
* @param categoryKey The key of the category which needs to check
|
||||
*/
|
||||
private void updatePreferenceCategoryVisibility(String categoryKey) {
|
||||
final PreferenceCategory category = mCategoryToPrefCategoryMap.get(categoryKey);
|
||||
category.setVisible(category.getPreferenceCount() != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates preferences related to system configurations.
|
||||
*/
|
||||
|
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.accessibility;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
|
||||
/** Accessibility settings for accessibility shortcuts. */
|
||||
public class ShortcutsSettingsFragment extends DashboardFragment {
|
||||
|
||||
private static final String TAG = "ShortcutsSettingsFragment";
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.ACCESSIBILITY_SHORTCUTS_SETTINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.accessibility_shortcuts_settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLogTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.accessibility_shortcuts_settings);
|
||||
|
||||
}
|
Reference in New Issue
Block a user