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

Commit 23a9f51c authored by kaiyiz's avatar kaiyiz Committed by Gerrit - the friendly Code Review server
Browse files

Regional: Customize features for regional package

-Customize default Date&Time display format.
-Customize mock and Dock on or off for carrier.
-Customize accessibility on or off for carrier.
-Customize default input method.
-Customize default enable data roaming or not.
-Customize default enable mobile data or not.
-Customize default network.

Change-Id: I3a74d0113d6b730c4d7935aaa2da307ebe500566
parent ea1eecb4
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2010 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -41,6 +44,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.ArrayList;
import java.util.Arrays;

public class LocalePicker extends ListFragment {
    private static final String TAG = "LocalePicker";
@@ -83,11 +87,23 @@ public class LocalePicker extends ListFragment {
        }
    }

    public static ArrayList<String> getLocaleArray(String[] locales, Resources resources) {
        String locale_codes = resources.getString(R.string.locale_codes);
        String[] localeCodesArray = null;
        if (locale_codes != null && !"".equals(locale_codes.trim())) {
            localeCodesArray = locale_codes.split(",");
        }
        ArrayList<String> localeList = new ArrayList<String>(
            Arrays.asList((localeCodesArray == null || localeCodesArray.length == 0) ? locales
                : localeCodesArray));
        return localeList;
    }

    public static List<LocaleInfo> getAllAssetLocales(Context context, boolean isInDeveloperMode) {
        final Resources resources = context.getResources();

        final String[] locales = Resources.getSystem().getAssets().getLocales();
        List<String> localeList = new ArrayList<String>(locales.length);
        String[] locales = Resources.getSystem().getAssets().getLocales();
        ArrayList<String> localeList = getLocaleArray(locales, resources);
        Collections.addAll(localeList, locales);

        // Don't show the pseudolocales unless we're in developer mode. http://b/17190407.
+5 −0
Original line number Diff line number Diff line
@@ -35,4 +35,9 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    -->
    <bool name="def_telephony_spn_spec_enabled">false</bool>

    <!-- Used in LocalePicker, default language must be contained -->
    <string name="locale_codes" translatable="false"></string>

    <!-- custom date format or not  -->
    <bool name="def_custom_dateformat">false</bool>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -248,6 +248,7 @@
  <java-symbol type="attr" name="windowFixedHeightMinor" />
  <java-symbol type="attr" name="accessibilityFocusedDrawable"/>

  <java-symbol type="bool" name="def_custom_dateformat" />
  <java-symbol type="bool" name="action_bar_embed_tabs" />
  <java-symbol type="bool" name="action_bar_embed_tabs_pre_jb" />
  <java-symbol type="bool" name="action_bar_expanded_action_views_exclusive" />
@@ -424,6 +425,7 @@
  <java-symbol type="dimen" name="immersive_mode_cling_width" />
  <java-symbol type="dimen" name="circular_display_mask_offset" />

  <java-symbol type="string" name="locale_codes" />
  <java-symbol type="string" name="add_account_button_label" />
  <java-symbol type="string" name="addToDictionary" />
  <java-symbol type="string" name="action_bar_home_description" />
+17 −4
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,6 +25,7 @@ import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.provider.AlarmClock;
import android.provider.Settings;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.util.AttributeSet;
@@ -223,10 +227,20 @@ public class KeyguardStatusView extends GridLayout {
                    : R.string.abbrev_wday_month_day_no_year);
            final String clockView12Skel = res.getString(R.string.clock_12hr_format);
            final String clockView24Skel = res.getString(R.string.clock_24hr_format);
            final String key = locale.toString() + dateViewSkel + clockView12Skel + clockView24Skel;
            if (key.equals(cacheKey)) return;

            if (res.getBoolean(com.android.internal.R.bool.def_custom_dateformat)) {
                final String dateformat = Settings.System.getString(context.getContentResolver(),
                        Settings.System.DATE_FORMAT);
                dateView = dateformat.equals(dateView) ? dateView : dateformat;
            } else {
                final String key = locale.toString() + dateViewSkel + clockView12Skel
                        + clockView24Skel;
                if (key.equals(cacheKey)) {
                    return;
                }
                dateView = DateFormat.getBestDateTimePattern(locale, dateViewSkel);
                cacheKey = key;
            }

            clockView12 = DateFormat.getBestDateTimePattern(locale, clockView12Skel);
            // CLDR insists on adding an AM/PM indicator even though it wasn't in the skeleton
@@ -241,7 +255,6 @@ public class KeyguardStatusView extends GridLayout {
            clockView24 = clockView24.replace(':', '\uee01');
            clockView12 = clockView12.replace(':', '\uee01');

            cacheKey = key;
        }
    }
}
+63 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2014, The Linux Foundation. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above
      copyright notice, this list of conditions and the following
      disclaimer in the documentation and/or other materials provided
      with the distribution.
    * Neither the name of The Linux Foundation nor the names of its
      contributors may be used to endorse or promote products derived
      from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<resources>

    <!-- Time format,default vlaue is 24 : 24 format,other value is 12 format -->
    <string name="def_time_format" translatable="false">24</string>

    <!-- Date format,yyyy-MM-dd: 2013/07/30; MM-dd-yyyy:07/30/2013; dd-MM-yyyy:30/07/2013 -->
    <string name="def_date_format" translatable="false">MM-dd-yyyy</string>

    <!--
         Default Input Method, its value is from inputmethod's package name and main class name
              such as "com.android.inputmethod.pinyin/.PinyinIME"
    -->
    <string name="def_input_method" translatable="false"></string>

    <!-- Default for Settings.Global.DATA_ROAMING -->
    <bool name="def_enable_data_roaming">true</bool>

    <!-- Default for Settings.Global.MOBILE_DATA -->
    <bool name="def_enable_mobile_data">true</bool>

    <!--
        Default Enable InputMethods, its value is from inputmethod's package name and main class name
              such as "com.android.inputmethod.pinyin/.PinyinIME" ;This is a string
         containing the IDs of all enabled input methods, each ID separated by ':'.
    -->
    <string name="def_enable_input_methods" translatable="false"></string>

    <!-- enable accessiblity or not,1:enable;0:disable -->
    <integer name="def_enable_accessiblity" translatable="false">0</integer>

    <!-- for enable accessiblity services,split by ":" ,example "com.google.android.marvin.talkback/com.google.android.marvin.talkback.TalkBackService" -->
    <string name="def_enable_accessiblity_services" translatable="false"></string>

</resources>
Loading