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

Commit fffe0540 authored by danielwbhuang's avatar danielwbhuang
Browse files

Add measurement system

1. add UX
2. add main functionality

Bug: 375979373
Flag: com.android.settings.flags.regional_preferences_api_enabled
Test: manual, atest
Change-Id: Ie0c82551ff4e9ab0c70fa5d3c32c62d1d7e26b87
parent 13d90e80
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1425,6 +1425,14 @@
        <item>sat</item>
    </string-array>

    <!-- A list for measurement system. [DO NOT TRANSLATE] -->
    <string-array name="measurement_system">
        <item>default</item>
        <item>metric</item>
        <item>ussystem</item>
        <item>uksystem</item>
    </string-array>

    <!-- Screen flash notification color when activating -->
    <array name="screen_flash_notification_preset_opacity_colors">
        <item>@color/screen_flash_preset_opacity_color_01</item>
+8 −0
Original line number Diff line number Diff line
@@ -490,6 +490,8 @@
    <string name="first_day_of_week_preferences_title">First day of week</string>
    <!-- The title of the menu entry of Numbers system preference. [CHAR LIMIT=50]  -->
    <string name="numbers_preferences_title">Numbers preferences</string>
    <!-- The title of the  menu entry of Measurement system preference. [CHAR LIMIT=50]  -->
    <string name="measurement_system_preferences_title">Measurement system</string>
    <!-- The summary of default string for each regional preference. [CHAR LIMIT=50] -->
    <string name="default_string_of_regional_preference">Use default</string>
    <!-- The title of Celsius for preference of temperature unit. [CHAR LIMIT=50] -->
@@ -516,6 +518,12 @@
    <string name="desc_regional_pref_footer_learn_more">Learn more about language preferences.</string>
    <!-- Support link for the regional preference page. [CHAR LIMIT=NONE]-->
    <string name="regional_pref_footer_learn_more_link" translatable="false">https://support.google.com/android?p=regional_preferences</string>
    <!-- The title of metric for preference of measurement system. [CHAR LIMIT=50] -->
    <string name="metric_measurement_system">Metric</string>
    <!-- The title of imperial US for preference of measurement system. [CHAR LIMIT=50] -->
    <string name="us_measurement_system">Imperial (US)</string>
    <!-- The title of imperial UK for preference of measurement system. [CHAR LIMIT=50] -->
    <string name="uk_measurement_system">Imperial (UK)</string>
    <!-- Category for the terms of address. [CHAR LIMIT=NONE]-->
    <string name="category_title_terms_of_address">Additional preferences</string>
+11 −0
Original line number Diff line number Diff line
@@ -81,6 +81,17 @@
                android:value="mu"/>
        </Preference>

        <Preference
            android:key="key_measurement_system"
            android:title="@string/measurement_system_preferences_title"
            android:summary="@string/default_string_of_regional_preference"
            settings:controller="com.android.settings.regionalpreferences.MeasurementSystemController"
            settings:fragment="com.android.settings.regionalpreferences.MeasurementSystemItemFragment">
            <extra
                android:name="arg_key_regional_preference"
                android:value="ms"/>
        </Preference>

        <Preference
            android:key="first_day_of_week_preference"
            android:title="@string/first_day_of_week_preferences_title"
+34 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:title="@string/measurement_system_preferences_title"
    android:key="regional_preference_measurement_system">

  <com.android.settingslib.widget.TopIntroPreference
      android:key="measurement_system_intro"
      android:title="@string/regional_preferences_option_page_sub_title"
      android:persistent="false" />

  <PreferenceCategory
      android:key="measurement_system_item_category"
      android:title="@string/summary_placeholder"
      android:layout="@layout/preference_category_no_label"
      settings:controller="com.android.settings.regionalpreferences.MeasurementSystemItemCategoryController"/>

</PreferenceScreen>
+3 −1
Original line number Diff line number Diff line
@@ -25,12 +25,14 @@ public class ExtensionTypes {
    public static final String FIRST_DAY_OF_WEEK = "fw";
    public static final String NUMBERING_SYSTEM = "nu";
    public static final String TEMPERATURE_UNIT = "mu";
    public static final String MEASUREMENT_SYSTEM = "ms";

    @StringDef({
            FIRST_DAY_OF_WEEK,
            CALENDAR,
            TEMPERATURE_UNIT,
            NUMBERING_SYSTEM
            NUMBERING_SYSTEM,
            MEASUREMENT_SYSTEM
    })
    public @interface Values {}
}
Loading