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

Commit 8d13ea9e authored by Tom Hsu's avatar Tom Hsu Committed by Android (Google) Code Review
Browse files

Merge "[Regional Preference] Create each page for regional preferences"

parents c1472929 278f2b07
Loading
Loading
Loading
Loading
+27 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2023 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.

  -->

<!-- Settings button -->
<ImageView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tick_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:scaleType="center"
    android:src="@drawable/ic_check_24dp" />
 No newline at end of file
+35 −0
Original line number Original line Diff line number Diff line
@@ -1360,4 +1360,39 @@
         [CHAR LIMIT=NONE] -->
         [CHAR LIMIT=NONE] -->
    <string-array name="allowlist_hide_summary_in_battery_usage" translatable="false">
    <string-array name="allowlist_hide_summary_in_battery_usage" translatable="false">
    </string-array>
    </string-array>

    <!-- A list for all temperature units. [CHAR LIMIT=NONE] -->
    <string-array name="temperature_units">
        <item>default</item>
        <item>celsius</item>
        <item>fahrenheit</item>
        <item>kelvin</item>
    </string-array>

    <!-- A list for all days of a week. [CHAR LIMIT=NONE] -->
    <string-array name="first_day_of_week">
        <item>default</item>
        <item>sun</item>
        <item>mon</item>
        <item>tue</item>
        <item>wed</item>
        <item>thu</item>
        <item>fri</item>
        <item>sat</item>
    </string-array>

    <!-- A list for all supported calendar types. [CHAR LIMIT=NONE] -->
    <string-array name="calendar_type">
        <item>default</item>
        <item>chinese</item>
        <item>dangi</item>
        <item>hebrew</item>
        <item>indian</item>
        <item>islamic</item>
        <item>islamic-rgsa</item>
        <item>islamic-tbla</item>
        <item>islamic-umalqura</item>
        <item>persian</item>
    </string-array>

</resources>
</resources>
+20 −0
Original line number Original line Diff line number Diff line
@@ -371,6 +371,26 @@
    <string name="numbers_preferences_title">Numbers</string>
    <string name="numbers_preferences_title">Numbers</string>
    <!-- The summary of default string for each regional preference. [CHAR LIMIT=50] -->
    <!-- The summary of default string for each regional preference. [CHAR LIMIT=50] -->
    <string name="default_string_of_regional_preference">[No preference]</string>
    <string name="default_string_of_regional_preference">[No preference]</string>
    <!-- The title of Celsius for preference of temperature unit. [CHAR LIMIT=50] -->
    <string name="celsius_temperature_unit">Celsius</string>
    <!-- The title of Fahrenheit for preference of temperature unit. [CHAR LIMIT=50] -->
    <string name="fahrenheit_temperature_unit">Fahrenheit</string>
    <!-- The title of Kevin for preference of temperature unit. [CHAR LIMIT=50] -->
    <string name="kevin_temperature_unit">Kevin</string>
    <!-- The title of sunday for preference of first day of week. [CHAR LIMIT=50] -->
    <string name="sunday_first_day_of_week">Sunday</string>
    <!-- The title of monday for preference of first day of week. [CHAR LIMIT=50] -->
    <string name="monday_first_day_of_week">Monday</string>
    <!-- The title of tuesday for preference of first day of week. [CHAR LIMIT=50] -->
    <string name="tuesday_first_day_of_week">Tuesday</string>
    <!-- The title of wednesday for preference of first day of week. [CHAR LIMIT=50] -->
    <string name="wednesday_first_day_of_week">Wednesday</string>
    <!-- The title of thursday for preference of first day of week. [CHAR LIMIT=50] -->
    <string name="thursday_first_day_of_week">Thursday</string>
    <!-- The title of friday for preference of first day of week. [CHAR LIMIT=50] -->
    <string name="friday_first_day_of_week">Friday</string>
    <!-- The title of saturday for preference of first day of week. [CHAR LIMIT=50] -->
    <string name="saturday_first_day_of_week">Saturday</string>
    <!-- The title of the confirmation dialog shown when the user selects one / several languages and tries to remove them [CHAR LIMIT=60] -->
    <!-- The title of the confirmation dialog shown when the user selects one / several languages and tries to remove them [CHAR LIMIT=60] -->
    <string name="dlg_remove_locales_title">{count, plural,
    <string name="dlg_remove_locales_title">{count, plural,
+18 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2023 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">

</PreferenceScreen>
 No newline at end of file
+29 −3
Original line number Original line Diff line number Diff line
@@ -16,11 +16,17 @@


package com.android.settings.regionalpreferences;
package com.android.settings.regionalpreferences;


import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Context;
import android.os.Bundle;
import android.provider.Settings;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;

import androidx.preference.Preference;


import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.SubSettingLauncher;


import java.util.Locale;
import java.util.Locale;


@@ -28,6 +34,7 @@ import java.util.Locale;
 * A controller for the entry of Calendar types' page
 * A controller for the entry of Calendar types' page
 */
 */
public class CalendarTypeController extends BasePreferenceController {
public class CalendarTypeController extends BasePreferenceController {
    private static final String TAG = CalendarTypeController.class.getSimpleName();
    public CalendarTypeController(Context context, String preferenceKey) {
    public CalendarTypeController(Context context, String preferenceKey) {
        super(context, preferenceKey);
        super(context, preferenceKey);
    }
    }
@@ -60,7 +67,26 @@ public class CalendarTypeController extends BasePreferenceController {
        if (result.isEmpty()) {
        if (result.isEmpty()) {
            result = LocalePreferences.getCalendarType(false);
            result = LocalePreferences.getCalendarType(false);
        }
        }
        return result.isEmpty()

                ? mContext.getString(R.string.default_string_of_regional_preference) : result;
        String inputStr = result.isEmpty() ? RegionalPreferencesFragment.TYPE_DEFAULT : result;
        return RegionalPreferencesDataUtils.calendarConverter(mContext, inputStr);
    }

    @Override
    public boolean handlePreferenceTreeClick(Preference preference) {
        if (!TextUtils.equals(preference.getKey(), mPreferenceKey)) {
            Log.e(TAG, "not the key " + preference.getKey() + " / " + mPreferenceKey);
            return false;
        }

        final Bundle extra = new Bundle();
        extra.putString(RegionalPreferencesFragment.TYPE_OF_REGIONAL_PREFERENCE,
                RegionalPreferencesFragment.TYPE_CALENDAR);
        new SubSettingLauncher(preference.getContext())
                .setDestination(RegionalPreferencesFragment.class.getName())
                .setSourceMetricsCategory(SettingsEnums.REGIONAL_PREFERENCE)
                .setArguments(extra)
                .launch();
        return true;
    }
    }
}
}
Loading