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

Commit bae720ff authored by menghanli's avatar menghanli
Browse files

Provides TC ID for accessibility framework feature for "about" and "learn more" part

Goal: Improve readability which is a bit difficult because of string concatenation for accurate translation.
Root cause: In some locales, framework features name would be a word rather than a product name. Hence it need to be in the different position in a sentence.
Solution: Use whole sentence to translate instead of concatenating the string could solve this issue.

Bug: 185478543
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AccessibilityFooterPreferenceControllerTest
Change-Id: Id198805329be9c773df87f38a074ae956e4d0cdb
parent 7cbff107
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -5256,10 +5256,18 @@
    <string name="select_to_speak_summary">Tap items on your screen to hear them read aloud</string>
    <!-- Title for the accessibility preference screen to enable video captioning. [CHAR LIMIT=35] -->
    <string name="accessibility_captioning_title">Caption preferences</string>
    <!-- Title for accessibility captioning footer. [CHAR LIMIT=60] -->
    <string name="accessibility_captioning_about_title">About caption preferences</string>
    <!-- Accessibility captioning footer link content description [CHAR LIMIT=NONE] -->
    <string name="accessibility_captioning_footer_learn_more_content_description">Learn more about caption preferences</string>
    <!-- Title for the accessibility preference screen to enable screen magnification. [CHAR LIMIT=35] -->
    <string name="accessibility_screen_magnification_title">Magnification</string>
    <!-- Title for accessibility shortcut preference for magnification. [CHAR LIMIT=60] -->
    <string name="accessibility_screen_magnification_shortcut_title">Magnification shortcut</string>
    <!-- Title for screen magnification footer. [CHAR LIMIT=60] -->
    <string name="accessibility_screen_magnification_about_title">About magnification</string>
    <!-- Screen magnification footer link content description [CHAR LIMIT=NONE] -->
    <string name="accessibility_screen_magnification_footer_learn_more_content_description">Learn more about magnification</string>
    <!-- Title for the accessibility preference screen to edit magnification area. [CHAR LIMIT=35] -->
    <string name="accessibility_magnification_mode_title">Magnification type</string>
    <!-- Message for the accessibility preference screen to edit magnification area dialog. [CHAR LIMIT=none] -->
@@ -5410,6 +5418,12 @@
    <string name="accessibility_button_title">Accessibility button</string>
    <!-- Title for the accessibility button & gesture page. [CHAR LIMIT=35] -->
    <string name="accessibility_button_gesture_title">Accessibility button &amp; gesture</string>
    <!-- Title for the accessibility button footer. [CHAR LIMIT=35] -->
    <string name="accessibility_button_about_title">About accessibility button</string>
    <!-- Title for the accessibility button & gesture footer. [CHAR LIMIT=55] -->
    <string name="accessibility_button_gesture_about_title">About accessibility button &amp; gesture</string>
    <!-- Accessibility button & gestures footer link content description [CHAR LIMIT=NONE] -->
    <string name="accessibility_button_gesture_footer_learn_more_content_description">Learn more about accessibility button &amp; gesture</string>
    <!-- Intro for the accessibility button page. [CHAR LIMIT=100] -->
    <string name="accessibility_button_intro">Using the accessibility button. The gesture isn\u2019t available with 3-button navigation.</string>
    <!-- Summary text for the accessibility button preference. [CHAR LIMIT=50] -->
@@ -5471,6 +5485,10 @@
    <string name="accessibility_timeout_2mins">2 minutes</string>
    <!-- Title for accessibility settings timeout item. [CHAR LIMIT=43] -->
    <string name="accessibility_setting_item_control_timeout_title">Time to take action (Accessibility timeout)</string>
    <!-- Title for accessibility timeout footer. [CHAR LIMIT=65] -->
    <string name="accessibility_control_timeout_about_title">About time to take action (Accessibility timeout)</string>
    <!-- Accessibility timeout footer link content description [CHAR LIMIT=NONE] -->
    <string name="accessibility_control_timeout_footer_learn_more_content_description">Learn more about time to take action (Accessibility timeout)</string>
    <!-- Title for accessibility preference to accessibility timeout. [CHAR LIMIT=35] -->
    <string name="accessibility_control_timeout_preference_title">Time to take action</string>
    <!-- Descriptive text for accessibility preference to accessibility control timeout. [CHAR LIMIT=NONE] -->
@@ -5497,6 +5515,10 @@
    </string>
    <!-- Title for accessibility preference for configuring feature that performs click action soon after mouse/trackpad pointer stops moving. [CHAR LIMIT=NONE] -->
    <string name="accessibility_autoclick_preference_title">Autoclick (dwell timing)</string>
    <!-- Title for accessibility dwell timing footer. [CHAR LIMIT=35] -->
    <string name="accessibility_autoclick_about_title">About autoclick (dwell timing)</string>
    <!-- Accessibility dwell timing footer link content description [CHAR LIMIT=NONE] -->
    <string name="accessibility_autoclick_footer_learn_more_content_description">Learn more about autoclick (dwell timing)</string>
    <!-- Footer text to explain what autoclick does -->
    <string name="accessibility_autoclick_description">Autoclick works with a connected mouse. You can set the mouse cursor to click automatically when the cursor stops moving for a certain amount of time.</string>
    <!-- Option heading to leave the auto click requirement for accessibility users at its default level. [CHAR LIMIT=50] -->
@@ -5537,6 +5559,14 @@
    <string name="accessibility_daltonizer_primary_switch_title">Use color correction</string>
    <!-- Title for accessibility shortcut preference for color correction. [CHAR LIMIT=60] -->
    <string name="accessibility_daltonizer_shortcut_title">Color correction shortcut</string>
    <!-- Title for Color correction footer. [CHAR LIMIT=35] -->
    <string name="accessibility_daltonizer_about_title">About color correction</string>
    <!-- Color inversion footer link content description [CHAR LIMIT=NONE] -->
    <string name="accessibility_daltonizer_footer_learn_more_content_description">Learn more about color correction</string>
    <!-- Title for Color inversion footer. [CHAR LIMIT=35] -->
    <string name="accessibility_color_inversion_about_title">About color inversion</string>
    <!-- Color correction footer link content description [CHAR LIMIT=NONE] -->
    <string name="accessibility_color_inversion_footer_learn_more_content_description">Learn more about color inversion</string>
    <!-- Title for Captions settings screen to control turning on/off the feature entirely [CHAR LIMIT=60] -->
    <string name="accessibility_caption_primary_switch_title">Show captions</string>
    <!-- Summary for Captions settings screen to control turning on/off the feature entirely [CHAR LIMIT=NONE] -->
@@ -5618,6 +5648,8 @@
    <string name="reduce_bright_colors_switch_title">Make screen extra dim</string>
    <!-- Title for accessibility shortcut preference for Reduce Brightness. [CHAR LIMIT=60] -->
    <string name="reduce_bright_colors_shortcut_title">Extra dim shortcut</string>
    <!-- Title for Reduce Brightness feature footer. [CHAR LIMIT=35] -->
    <string name="reduce_bright_colors_about_title">About extra dim</string>
    <!-- Summary for the accessibility preference to configure Reduce Brightness feature. [CHAR LIMIT=NONE] -->
    <string name="reduce_bright_colors_preference_summary" product="default">Dim screen beyond your phone\u2019s minimum brightness</string>
    <!-- Summary for the accessibility preference to configure Reduce Brightness feature. [CHAR LIMIT=NONE] -->
+8 −2
Original line number Diff line number Diff line
@@ -33,8 +33,14 @@ public class AccessibilityButtonFooterPreferenceController extends
    }

    @Override
    protected String getLabelName() {
        return mContext.getString(R.string.accessibility_button_title);
    protected String getLearnMoreContentDescription() {
        return mContext.getString(
            R.string.accessibility_button_gesture_footer_learn_more_content_description);
    }

    @Override
    protected String getIntroductionTitle() {
        return mContext.getString(R.string.accessibility_button_about_title);
    }

    @Override
+8 −2
Original line number Diff line number Diff line
@@ -31,8 +31,14 @@ public class AccessibilityControlTimeoutFooterPreferenceController extends
    }

    @Override
    protected String getLabelName() {
        return mContext.getString(R.string.accessibility_setting_item_control_timeout_title);
    protected String getLearnMoreContentDescription() {
        return mContext.getString(
            R.string.accessibility_control_timeout_footer_learn_more_content_description);
    }

    @Override
    protected String getIntroductionTitle() {
        return mContext.getString(R.string.accessibility_control_timeout_about_title);
    }

    @Override
+51 −15
Original line number Diff line number Diff line
@@ -21,14 +21,18 @@ import android.content.Intent;

import androidx.preference.PreferenceScreen;

import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.HelpUtils;

/**
 * Base class for accessibility preference footer.
 * Preference controller that controls the help link and customizes the preference title in {@link
 * AccessibilityFooterPreference}.
 */
public abstract class AccessibilityFooterPreferenceController extends BasePreferenceController {
public class AccessibilityFooterPreferenceController extends BasePreferenceController {

    private int mHelpResource;
    private String mLearnMoreContentDescription;
    private String mIntroductionTitle;

    public AccessibilityFooterPreferenceController(Context context, String key) {
        super(context, key);
@@ -49,23 +53,55 @@ public abstract class AccessibilityFooterPreferenceController extends BasePrefer
    }

    /**
     * Override this if showing a help item in the footer bar, by returning the resource id.
     * Setups a help item in the {@link AccessibilityFooterPreference} with specific content
     * description.
     */
    public void setupHelpLink(int helpResource, String learnMoreContentDescription) {
        mHelpResource = helpResource;
        mLearnMoreContentDescription = learnMoreContentDescription;
    }

    /**
     * Overrides this if showing a help item in the {@link AccessibilityFooterPreference}, by
     * returning the resource id.
     *
     * @return the resource id for the help url
     */
    protected int getHelpResource() {
        return 0;
        return mHelpResource;
    }

    /** Returns the accessibility feature name. */
    protected abstract String getLabelName();
    /**
     * Overrides this if showing a help item in the {@link AccessibilityFooterPreference} with
     * specific content description.
     *
     * @return the content description for the help url
     */
    protected String getLearnMoreContentDescription() {
        return mLearnMoreContentDescription;
    }

    /**
     * Sets the announcement the specific features introduction in the {@link
     * AccessibilityFooterPreference}.
     */
    public void setIntroductionTitle(String introductionTitle) {
        mIntroductionTitle = introductionTitle;
    }

    /**
     * Overrides this if announcement the specific features introduction in the {@link
     * AccessibilityFooterPreference}.
     *
     * @return the extended content description for specific features introduction
     */
    protected String getIntroductionTitle() {
        return mIntroductionTitle;
    }

    private void updateFooterPreferences(AccessibilityFooterPreference footerPreference) {
        final StringBuffer sb = new StringBuffer();
        sb.append(mContext.getString(
                R.string.accessibility_introduction_title, getLabelName()))
                .append("\n\n")
                .append(footerPreference.getTitle());
        sb.append(getIntroductionTitle()).append("\n\n").append(footerPreference.getTitle());
        footerPreference.setContentDescription(sb);

        if (getHelpResource() != 0) {
@@ -75,10 +111,10 @@ public abstract class AccessibilityFooterPreferenceController extends BasePrefer
                        mContext.getClass().getName());
                view.startActivityForResult(helpIntent, 0);
            });

            final String learnMoreContentDescription = mContext.getString(
                    R.string.footer_learn_more_content_description, getLabelName());
            footerPreference.setLearnMoreContentDescription(learnMoreContentDescription);
            footerPreference.setLearnMoreContentDescription(getLearnMoreContentDescription());
            footerPreference.setLinkEnabled(true);
        } else {
            footerPreference.setLinkEnabled(false);
        }
    }
}
+9 −3
Original line number Diff line number Diff line
@@ -30,8 +30,14 @@ public class CaptionFooterPreferenceController extends AccessibilityFooterPrefer
    }

    @Override
    protected String getLabelName() {
        return mContext.getString(R.string.accessibility_captioning_title);
    protected String getLearnMoreContentDescription() {
        return mContext.getString(
            R.string.accessibility_captioning_footer_learn_more_content_description);
    }

    @Override
    protected String getIntroductionTitle() {
        return mContext.getString(R.string.accessibility_captioning_about_title);
    }

    @Override
Loading