Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 421bd753 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Migrate Text Reading" into main

parents 198579af 3d2f06fd
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
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"
}
 No newline at end of file
+7 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ import android.view.View;
import android.widget.Toast;

import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;

import com.android.settings.R;
@@ -313,4 +315,9 @@ public class TextReadingPreferenceFragment extends DashboardFragment {

    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
            new BaseSearchIndexProvider(R.xml.accessibility_text_reading_options);

    @Override
    public @Nullable String getPreferenceScreenBindingKey(@NonNull Context context) {
        return TextReadingScreen.KEY;
    }
}
+44 −0
Original line number Diff line number Diff line
/*
 * 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"
    }
}
+39 −0
Original line number Diff line number Diff line
/*
 * 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)
    }
}