Merge "Migrate Text Reading" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
421bd753c4
9
aconfig/catalyst/accessibility.aconfig
Normal file
9
aconfig/catalyst/accessibility.aconfig
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package: "com.android.settings.flags"
|
||||||
|
container: "system"
|
||||||
|
|
||||||
|
flag {
|
||||||
|
name: "catalyst_text_reading_screen"
|
||||||
|
namespace: "android_settings"
|
||||||
|
description: "Flag for Display size and text"
|
||||||
|
bug: "323791114"
|
||||||
|
}
|
@@ -30,6 +30,8 @@ import android.view.View;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.IntDef;
|
import androidx.annotation.IntDef;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -313,4 +315,9 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
|
|||||||
|
|
||||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
new BaseSearchIndexProvider(R.xml.accessibility_text_reading_options);
|
new BaseSearchIndexProvider(R.xml.accessibility_text_reading_options);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String getPreferenceScreenBindingKey(@NonNull Context context) {
|
||||||
|
return TextReadingScreen.KEY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
44
src/com/android/settings/accessibility/TextReadingScreen.kt
Normal file
44
src/com/android/settings/accessibility/TextReadingScreen.kt
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 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.content.Context
|
||||||
|
import com.android.settings.R
|
||||||
|
import com.android.settings.flags.Flags
|
||||||
|
import com.android.settingslib.metadata.ProvidePreferenceScreen
|
||||||
|
import com.android.settingslib.metadata.preferenceHierarchy
|
||||||
|
import com.android.settingslib.preference.PreferenceScreenCreator
|
||||||
|
|
||||||
|
@ProvidePreferenceScreen
|
||||||
|
class TextReadingScreen : PreferenceScreenCreator {
|
||||||
|
override val key: String
|
||||||
|
get() = KEY
|
||||||
|
|
||||||
|
override val title: Int
|
||||||
|
get() = R.string.accessibility_text_reading_options_title
|
||||||
|
|
||||||
|
override fun isFlagEnabled(context: Context) = Flags.catalystTextReadingScreen()
|
||||||
|
|
||||||
|
override fun fragmentClass() = TextReadingPreferenceFragment::class.java
|
||||||
|
|
||||||
|
override fun hasCompleteHierarchy() = false
|
||||||
|
|
||||||
|
override fun getPreferenceHierarchy(context: Context) = preferenceHierarchy(this) {}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val KEY = "text_reading_screen"
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 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 androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
import com.android.settings.flags.Flags
|
||||||
|
import com.android.settingslib.preference.CatalystScreenTestCase
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
class TextReadingScreenTest : CatalystScreenTestCase() {
|
||||||
|
|
||||||
|
override val preferenceScreenCreator = TextReadingScreen()
|
||||||
|
|
||||||
|
override val flagName: String
|
||||||
|
get() = Flags.FLAG_CATALYST_TEXT_READING_SCREEN
|
||||||
|
|
||||||
|
override fun migration() {}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun key() {
|
||||||
|
assertThat(preferenceScreenCreator.key).isEqualTo(TextReadingScreen.KEY)
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user