Merge "[Catalyst] Initial migration for "Display size and text" screen" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
11127f729e
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2025 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.settingslib.metadata.PreferenceMetadata
|
||||||
|
import com.android.settingslib.preference.PreferenceBinding
|
||||||
|
|
||||||
|
internal class TextReadingDisplaySizePreference : PreferenceMetadata, PreferenceBinding {
|
||||||
|
|
||||||
|
override val key: String
|
||||||
|
get() = KEY
|
||||||
|
|
||||||
|
override val title: Int
|
||||||
|
get() = R.string.screen_zoom_title
|
||||||
|
|
||||||
|
override val summary: Int
|
||||||
|
get() = R.string.screen_zoom_short_summary
|
||||||
|
|
||||||
|
override val keywords: Int
|
||||||
|
get() = R.string.keywords_display_size
|
||||||
|
|
||||||
|
override fun createWidget(context: Context) =
|
||||||
|
AccessibilitySeekBarPreference(context, /* attrs= */ null).apply {
|
||||||
|
setIconStart(R.drawable.ic_remove_24dp)
|
||||||
|
setIconStartContentDescription(R.string.screen_zoom_make_smaller_desc)
|
||||||
|
setIconEnd(R.drawable.ic_add_24dp)
|
||||||
|
setIconEndContentDescription(R.string.screen_zoom_make_larger_desc)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val KEY = "display_size"
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2025 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 android.provider.Settings.System.FONT_SCALE
|
||||||
|
import com.android.settings.R
|
||||||
|
import com.android.settingslib.metadata.PreferenceMetadata
|
||||||
|
import com.android.settingslib.preference.PreferenceBinding
|
||||||
|
|
||||||
|
internal class TextReadingFontSizePreference : PreferenceMetadata, PreferenceBinding {
|
||||||
|
|
||||||
|
override val key: String
|
||||||
|
get() = KEY
|
||||||
|
|
||||||
|
override val title: Int
|
||||||
|
get() = R.string.title_font_size
|
||||||
|
|
||||||
|
override val summary: Int
|
||||||
|
get() = R.string.short_summary_font_size
|
||||||
|
|
||||||
|
override val keywords: Int
|
||||||
|
get() = R.string.keywords_font_size
|
||||||
|
|
||||||
|
override fun createWidget(context: Context) =
|
||||||
|
AccessibilitySeekBarPreference(context, /* attrs= */ null).apply {
|
||||||
|
setIconStart(R.drawable.ic_remove_24dp)
|
||||||
|
setIconStartContentDescription(R.string.font_size_make_smaller_desc)
|
||||||
|
setIconEnd(R.drawable.ic_add_24dp)
|
||||||
|
setIconEndContentDescription(R.string.font_size_make_larger_desc)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val KEY = FONT_SCALE
|
||||||
|
}
|
||||||
|
}
|
33
src/com/android/settings/accessibility/TextReadingPreview.kt
Normal file
33
src/com/android/settings/accessibility/TextReadingPreview.kt
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2025 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.settingslib.metadata.PreferenceMetadata
|
||||||
|
import com.android.settingslib.preference.PreferenceBinding
|
||||||
|
|
||||||
|
internal class TextReadingPreview : PreferenceMetadata, PreferenceBinding {
|
||||||
|
override val key: String
|
||||||
|
get() = KEY
|
||||||
|
|
||||||
|
override fun createWidget(context: Context) =
|
||||||
|
TextReadingPreviewPreference(context).apply { isSelectable = false }
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val KEY = "preview"
|
||||||
|
}
|
||||||
|
}
|
@@ -18,11 +18,10 @@ package com.android.settings.accessibility
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import com.android.settings.R
|
import com.android.settings.R
|
||||||
import com.android.settings.flags.Flags
|
import com.android.settings.flags.Flags
|
||||||
import com.android.settingslib.metadata.ProvidePreferenceScreen
|
|
||||||
import com.android.settingslib.metadata.preferenceHierarchy
|
import com.android.settingslib.metadata.preferenceHierarchy
|
||||||
import com.android.settingslib.preference.PreferenceScreenCreator
|
import com.android.settingslib.preference.PreferenceScreenCreator
|
||||||
|
|
||||||
@ProvidePreferenceScreen(TextReadingScreen.KEY)
|
// @ProvidePreferenceScreen(TextReadingScreen.KEY)
|
||||||
class TextReadingScreen : PreferenceScreenCreator {
|
class TextReadingScreen : PreferenceScreenCreator {
|
||||||
override val key: String
|
override val key: String
|
||||||
get() = KEY
|
get() = KEY
|
||||||
@@ -34,9 +33,12 @@ class TextReadingScreen : PreferenceScreenCreator {
|
|||||||
|
|
||||||
override fun fragmentClass() = TextReadingPreferenceFragment::class.java
|
override fun fragmentClass() = TextReadingPreferenceFragment::class.java
|
||||||
|
|
||||||
override fun hasCompleteHierarchy() = false
|
override fun getPreferenceHierarchy(context: Context) =
|
||||||
|
preferenceHierarchy(context, this) {
|
||||||
override fun getPreferenceHierarchy(context: Context) = preferenceHierarchy(context, this) {}
|
+TextReadingPreview()
|
||||||
|
+TextReadingFontSizePreference()
|
||||||
|
+TextReadingDisplaySizePreference()
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val KEY = "text_reading_screen"
|
const val KEY = "text_reading_screen"
|
||||||
|
Reference in New Issue
Block a user