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

Commit f676ff2b authored by PETER LIANG's avatar PETER LIANG Committed by Android (Google) Code Review
Browse files

Merge changes I502e52f6,Iabf58566,Ida773967,Ic6c48861,If9e5cc6e, ...

* changes:
  New feature “Text and reading options” for SetupWizard, Wallpaper, and Settings (15/n).
  New feature “Text and reading options” for SetupWizard, Wallpaper, and Settings (14/n).
  New feature “Text and reading options” for SetupWizard, Wallpaper, and Settings (13/n).
  New feature “Text and reading options” for SetupWizard, Wallpaper, and Settings (12/n).
  New feature “Text and reading options” for SetupWizard, Wallpaper, and Settings (11/n).
  New feature “Text and reading options” for SetupWizard, Wallpaper, and Settings (10/n).
parents f8ba876f 696fc420
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2022 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.
-->

<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:shape="rectangle">

    <corners android:radius="100dp" />
    <solid android:color="?androidprv:attr/colorAccentPrimary" />
</shape>
+36 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2022 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.
-->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:paddingStart="?android:attr/listPreferredItemPaddingStart">

    <Button
        android:id="@+id/reset_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="@drawable/accessibility_text_reading_reset_button_background"
        android:paddingHorizontal="24dp"
        android:paddingVertical="14dp"
        android:text="@string/accessibility_text_reading_reset_button_title"
        android:textAppearance="?android:attr/textAppearanceMedium" />
</FrameLayout>
+2 −0
Original line number Diff line number Diff line
@@ -5236,6 +5236,8 @@
    <string name="accessibility_text_reading_preview_mail_from">From: bill@email.com</string>
    <!-- Content for the mail content of the accessibility text reading preview. [CHAR LIMIT=NONE] -->
    <string name="accessibility_text_reading_preview_mail_content">Good morning! Following up on our last conversation, I’d like to check in on the progress of your time machine development plan. Will you be able to have a prototype ready to demo at E3 this year?</string>
    <!-- Title for the reset button of the accessibility text reading page to reset all preferences state. [CHAR LIMIT=NONE] -->
    <string name="accessibility_text_reading_reset_button_title">Reset</string>
    <!-- Title for the footer text to explain what option accessibility service does. [CHAR LIMIT=35] -->
    <string name="accessibility_screen_option">Options</string>
    <!-- Summary for the accessibility preference to enable screen magnification. [CHAR LIMIT=25] -->
+32 −4
Original line number Diff line number Diff line
@@ -21,16 +21,44 @@
    android:persistent="false"
    android:title="@string/accessibility_text_reading_options_title">

    <com.android.settings.accessibility.TextReadingPreviewPreference
        android:key="preview"
        android:selectable="false"/>

    <com.android.settings.widget.LabeledSeekBarPreference
        android:key="font_size"
        android:selectable="false"
        android:summary="@string/short_summary_font_size"
        android:title="@string/title_font_size"
        settings:iconEnd="@drawable/ic_add_24dp"
        settings:iconEndContentDescription="@string/font_size_make_larger_desc"
        settings:iconStart="@drawable/ic_remove_24dp"
        settings:iconStartContentDescription="@string/font_size_make_smaller_desc"/>

    <com.android.settings.widget.LabeledSeekBarPreference
        android:key="display_size"
        android:selectable="false"
        android:summary="@string/screen_zoom_short_summary"
        android:title="@string/screen_zoom_title"
        settings:iconEnd="@drawable/ic_add_24dp"
        settings:iconEndContentDescription="@string/screen_zoom_make_larger_desc"
        settings:iconStart="@drawable/ic_remove_24dp"
        settings:iconStartContentDescription="@string/screen_zoom_make_smaller_desc"/>

    <SwitchPreference
        android:key="toggle_force_bold_text"
        android:persistent="false"
        android:title="@string/force_bold_text"
        settings:keywords="@string/keywords_bold_text"
        settings:controller="com.android.settings.accessibility.FontWeightAdjustmentPreferenceController"/>
        settings:keywords="@string/keywords_bold_text" />

    <SwitchPreference
        android:key="toggle_high_text_contrast_preference"
        android:persistent="false"
        android:title="@string/accessibility_toggle_high_text_contrast_preference_title"
        settings:controller="com.android.settings.accessibility.HighTextContrastPreferenceController"/>
        android:title="@string/accessibility_toggle_high_text_contrast_preference_title" />

    <com.android.settingslib.widget.LayoutPreference
        android:key="reset"
        android:layout="@layout/accessibility_text_reading_reset_button"
        android:persistent="false"
        android:selectable="false" />
</PreferenceScreen>
+65 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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.content.res.Resources;
import android.view.Display;

import com.android.settingslib.display.DisplayDensityConfiguration;
import com.android.settingslib.display.DisplayDensityUtils;

import java.util.Arrays;
import java.util.Collections;
import java.util.stream.Collectors;

/**
 * Data class for storing the configurations related to the display size.
 */
class DisplaySizeData extends PreviewSizeData<Integer> {
    DisplaySizeData(Context context) {
        super(context);

        final DisplayDensityUtils density = new DisplayDensityUtils(getContext());
        final int initialIndex = density.getCurrentIndex();
        if (initialIndex < 0) {
            // Failed to obtain default density, which means we failed to
            // connect to the window manager service. Just use the current
            // density and don't let the user change anything.
            final Resources resources = getContext().getResources();
            final int densityDpi = resources.getDisplayMetrics().densityDpi;
            setDefaultValue(densityDpi);
            setInitialIndex(0);
            setValues(Collections.singletonList(densityDpi));
        } else {
            setDefaultValue(density.getDefaultDensity());
            setInitialIndex(initialIndex);
            setValues(Arrays.stream(density.getValues()).boxed().collect(Collectors.toList()));
        }
    }

    @Override
    void commit(int currentProgress) {
        final int densityDpi = getValues().get(currentProgress);
        if (densityDpi == getDefaultValue()) {
            DisplayDensityConfiguration.clearForcedDisplayDensity(Display.DEFAULT_DISPLAY);
        } else {
            DisplayDensityConfiguration.setForcedDisplayDensity(Display.DEFAULT_DISPLAY,
                    densityDpi);
        }
    }
}
Loading