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

Commit 22133806 authored by Kevin Chang's avatar Kevin Chang Committed by Android (Google) Code Review
Browse files

Merge "Change the string of Captions and reorder the feature in audio category"

parents 4824f3a7 23c53ad5
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
@@ -104,6 +104,54 @@
        -->
    </string-array>

    <!-- List containing the order of services in screen reader category by componentname.
         All componentnames in a category need to be specified to guarantee correct behavior.-->
    <string-array name="config_order_screen_reader_services" translatable="false">
        <!--
        <item>com.example.package.first/com.example.class.FirstService</item>
        <item>com.example.package.second/com.example.class.SecondService</item>
        -->
    </string-array>

    <!-- List containing the order of services in audio and caption category by preference key
         or componentname. All preference keys in a category need to be specified to guarantee
         correct behavior.-->
    <string-array name="config_order_audio_and_caption_services" translatable="false">
        <!--
        <item>com.example.package.first/com.example.class.FirstService</item>
        <item>com.example.package.second/com.example.class.SecondService</item>
        <item>toggle_master_mono</item>
        <item>seekbar_master_balance</item>
        <item>...</item>
        -->
    </string-array>

    <!-- List containing the order of services in display category by preference key
         or componentname. All preference keys in a category need to be specified to guarantee
         correct behavior.-->
    <string-array name="config_order_display_services" translatable="false">
        <!--
        <item>com.example.package.first/com.example.class.FirstService</item>
        <item>com.example.package.second/com.example.class.SecondService</item>
        <item>font_size_preference_screen</item>
        <item>dark_ui_mode_accessibility</item>
        <item>...</item>
        -->
    </string-array>

    <!-- List containing the order of services in interaction control category by preference key
         or componentname. All preference keys in a category need to be specified to guarantee
         correct behavior.-->
    <string-array name="config_order_interaction_control_services" translatable="false">
        <!--
        <item>com.example.package.first/com.example.class.FirstService</item>
        <item>com.example.package.second/com.example.class.SecondService</item>
        <item>autoclick_preference</item>
        <item>toggle_power_button_ends_call_preference</item>
        <item>...</item>
        -->
    </string-array>

    <!-- List of packages that should be whitelisted for slice uri access. Do not translate -->
    <string-array name="slice_whitelist_package_names" translatable="false"/>

+1 −1
Original line number Diff line number Diff line
@@ -4803,7 +4803,7 @@
    <!-- Summary for the Select to Speak Accessibility Service. [CHAR_LIMIT=none] -->
    <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">Captions</string>
    <string name="accessibility_captioning_title">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 the accessibility preference screen to enable triple-tap gesture screen magnification. [CHAR LIMIT=35] -->
+33 −0
Original line number Diff line number Diff line
@@ -660,6 +660,16 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
            mServicePreferenceToPreferenceCategoryMap.put(preference, prefCategory);
        }

        // Update the order of all the category according to the order defined in xml file.
        updateCategoryOrderFromArray(CATEGORY_SCREEN_READER,
            R.array.config_order_screen_reader_services);
        updateCategoryOrderFromArray(CATEGORY_AUDIO_AND_CAPTIONS,
            R.array.config_order_audio_and_caption_services);
        updateCategoryOrderFromArray(CATEGORY_INTERACTION_CONTROL,
            R.array.config_order_interaction_control_services);
        updateCategoryOrderFromArray(CATEGORY_DISPLAY,
            R.array.config_order_display_services);

        // If the user has not installed any additional services, hide the category.
        if (downloadedServicesCategory.getPreferenceCount() == 0) {
            final PreferenceScreen screen = getPreferenceScreen();
@@ -676,6 +686,29 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
        }
    }

    /**
     * Update the order of perferences in the category by matching their preference
     * key with the string array of preference order which is defined in the xml.
     *
     * @param categoryKey The key of the category need to update the order
     * @param key The key of the string array which defines the order of category
     */
    private void updateCategoryOrderFromArray(String categoryKey, int key) {
        String[] services = getResources().getStringArray(key);
        PreferenceCategory category = mCategoryToPrefCategoryMap.get(categoryKey);
        int preferenceCount = category.getPreferenceCount();
        int serviceLength = services.length;
        for (int preferenceIndex = 0; preferenceIndex < preferenceCount; preferenceIndex++) {
            for (int serviceIndex = 0; serviceIndex < serviceLength; serviceIndex++) {
                if (category.getPreference(preferenceIndex).getKey()
                        .equals(services[serviceIndex])) {
                    category.getPreference(preferenceIndex).setOrder(serviceIndex);
                    break;
                }
            }
        }
    }

    protected void updateSystemPreferences() {
        // Move color inversion and color correction preferences to Display category if device
        // supports HWC hardware-accelerated color transform.