├── app
├── .gitignore
├── libs
│ └── pinyin4j-2.5.0.jar
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── left.png
│ │ │ │ ├── clean.png
│ │ │ │ ├── search.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── drawable
│ │ │ │ ├── touch_bg.xml
│ │ │ │ ├── touch_press.xml
│ │ │ │ ├── area_select_num_bg.xml
│ │ │ │ ├── touch_transparent.xml
│ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── item_area.xml
│ │ │ │ └── act_area_select.xml
│ │ │ └── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── dlong
│ │ │ │ └── rep
│ │ │ │ └── dl10sidebar
│ │ │ │ ├── bean
│ │ │ │ └── AreaPhoneBean.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ ├── utils
│ │ │ │ ├── ReadAssetsJsonUtil.java
│ │ │ │ └── PinyinUtils.java
│ │ │ │ ├── adapter
│ │ │ │ └── AreaCodeListAdapter.java
│ │ │ │ └── AreaSelectActivity.java
│ │ └── assets
│ │ │ └── area_phone_code.json
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── dlong
│ │ │ └── rep
│ │ │ └── dl10sidebar
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── dlong
│ │ └── rep
│ │ └── dl10sidebar
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── dlsidebar
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles.xml
│ │ │ │ ├── attrs.xml
│ │ │ │ ├── array.xml
│ │ │ │ └── defaults.xml
│ │ │ ├── drawable
│ │ │ │ └── dialog_text_bg.xml
│ │ │ └── layout
│ │ │ │ └── dl_dialog.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── dlong
│ │ │ └── rep
│ │ │ └── dlsidebar
│ │ │ ├── DLTextDialog.java
│ │ │ └── DLSideBar.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── dlong
│ │ │ └── rep
│ │ │ └── dlsidebar
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── dlong
│ │ └── rep
│ │ └── dlsidebar
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── .DS_Store
├── .gitattributes
├── img
└── sidebar.gif
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── vcs.xml
├── modules.xml
├── misc.xml
├── runConfigurations.xml
└── codeStyles
│ └── Project.xml
├── README.md
├── gradle.properties
├── .gitignore
├── gradlew.bat
├── gradlew
└── LICENSE
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/dlsidebar/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':dlsidebar'
2 |
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/.DS_Store
--------------------------------------------------------------------------------
/dlsidebar/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/img/sidebar.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/img/sidebar.gif
--------------------------------------------------------------------------------
/app/libs/pinyin4j-2.5.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/libs/pinyin4j-2.5.0.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/src/main/res/mipmap-xxxhdpi/left.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/clean.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/src/main/res/mipmap-xxxhdpi/clean.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/src/main/res/mipmap-xxxhdpi/search.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/dlsidebar/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/D10NGYANG/DL10SideBar/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DL10SideBar
3 |
4 | area_phone_code.json
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DL10SideBar
2 | 侧边栏选择器--------仿微信国家地区代码选择页面
3 |
4 | 说明链接:https://blog.csdn.net/sinat_38184748/article/details/88956329
5 |
6 | # jetpack compose
7 | 最新的 jetpack compose 的库[在这里](https://github.com/D10NGYANG/DLSideBar_Compose)
8 |
9 | # 效果
10 | 
11 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Apr 01 09:50:14 CST 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/touch_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/touch_press.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/area_select_num_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/touch_transparent.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/dlsidebar/src/main/res/drawable/dialog_text_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dlsidebar/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 14sp
4 | 20sp
5 | 4dp
6 | 100dp
7 | 100dp
8 |
--------------------------------------------------------------------------------
/dlsidebar/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #ff646464
4 | #ffffffff
5 | #ffb2b2b2
6 | #ffffffff
7 | #80000000
8 |
--------------------------------------------------------------------------------
/app/src/test/java/com/dlong/rep/dl10sidebar/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.dlong.rep.dl10sidebar;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/dlsidebar/src/test/java/com/dlong/rep/dlsidebar/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.dlong.rep.dlsidebar;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/dlsidebar/src/main/res/layout/dl_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/dlsidebar/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 |
--------------------------------------------------------------------------------
/dlsidebar/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dlong/rep/dl10sidebar/bean/AreaPhoneBean.java:
--------------------------------------------------------------------------------
1 | package com.dlong.rep.dl10sidebar.bean;
2 |
3 | import java.io.Serializable;
4 | import java.util.Comparator;
5 |
6 | public class AreaPhoneBean implements Serializable {
7 | public String name; //地区名称
8 | public String name_py; //地区名称拼音
9 | public String fisrtSpell; //地区名称首字母
10 | public String code; //地区代码
11 | public String locale; //地区时区
12 | public String en_name; //英文名
13 |
14 |
15 | /**
16 | * 按拼音进行排序
17 | */
18 | public static class ComparatorPY implements Comparator {
19 | @Override
20 | public int compare(AreaPhoneBean lhs, AreaPhoneBean rhs) {
21 | String str1 = lhs.name_py;
22 | String str2 = rhs.name_py;
23 | return str1.compareToIgnoreCase(str2);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/dlong/rep/dl10sidebar/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.dlong.rep.dl10sidebar;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.dlong.rep.dl10sidebar", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/dlsidebar/src/androidTest/java/com/dlong/rep/dlsidebar/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.dlong.rep.dlsidebar;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.dlong.rep.dlsidebar.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/dlsidebar/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 | defaultConfig {
7 | minSdkVersion 18
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 |
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 |
14 | }
15 |
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 |
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(dir: 'libs', include: ['*.jar'])
27 |
28 | implementation 'com.android.support:appcompat-v7:28.0.0'
29 | testImplementation 'junit:junit:4.12'
30 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
31 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
32 | }
33 |
--------------------------------------------------------------------------------
/dlsidebar/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dlsidebar/src/main/res/values/array.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | - \u2191
6 | - \u2606
7 | - \u0041
8 | - \u0042
9 | - \u0043
10 | - \u0044
11 | - \u0045
12 | - \u0046
13 | - \u0047
14 | - \u0048
15 | - \u0049
16 | - \u004a
17 | - \u004b
18 | - \u004c
19 | - \u004d
20 | - \u004e
21 | - \u004f
22 | - \u0050
23 | - \u0051
24 | - \u0052
25 | - \u0053
26 | - \u0054
27 | - \u0055
28 | - \u0056
29 | - \u0057
30 | - \u0058
31 | - \u0059
32 | - \u005a
33 | - \u0023
34 |
35 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.dlong.rep.dl10sidebar"
7 | minSdkVersion 18
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(include: ['*.jar'], dir: 'libs')
23 | implementation 'com.android.support:appcompat-v7:28.0.0'
24 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
25 | testImplementation 'junit:junit:4.12'
26 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
28 | implementation project(':dlsidebar')
29 |
30 | // 拼音
31 | implementation files('libs/pinyin4j-2.5.0.jar')
32 | }
33 |
--------------------------------------------------------------------------------
/dlsidebar/src/main/res/values/defaults.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | @color/sidebar_default_side_text_color
6 |
7 | @color/sidebar_default_side_text_select_color
8 |
9 | @dimen/sidebar_default_side_text_size
10 |
11 | @color/sidebar_default_side_background
12 |
13 | @color/sidebar_default_dialog_text_color
14 |
15 | @dimen/sidebar_default_dialog_text_size
16 |
17 | @drawable/dialog_text_bg
18 |
19 | @dimen/sidebar_default_dialog_text_background_width
20 |
21 | @dimen/sidebar_default_dialog_text_background_height
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 | *.aab
5 |
6 | # Files for the ART/Dalvik VM
7 | *.dex
8 |
9 | # Java class files
10 | *.class
11 |
12 | # Generated files
13 | bin/
14 | gen/
15 | out/
16 |
17 | # Gradle files
18 | .gradle/
19 | build/
20 |
21 | # Local configuration file (sdk path, etc)
22 | local.properties
23 |
24 | # Proguard folder generated by Eclipse
25 | proguard/
26 |
27 | # Log Files
28 | *.log
29 |
30 | # Android Studio Navigation editor temp files
31 | .navigation/
32 |
33 | # Android Studio captures folder
34 | captures/
35 |
36 | # IntelliJ
37 | *.iml
38 | .idea/workspace.xml
39 | .idea/tasks.xml
40 | .idea/gradle.xml
41 | .idea/assetWizardSettings.xml
42 | .idea/dictionaries
43 | .idea/libraries
44 | .idea/caches
45 |
46 | # Keystore files
47 | # Uncomment the following lines if you do not want to check your keystore files in.
48 | #*.jks
49 | #*.keystore
50 |
51 | # External native build folder generated in Android Studio 2.2 and later
52 | .externalNativeBuild
53 |
54 | # Google Services (e.g. APIs or Firebase)
55 | google-services.json
56 |
57 | # Freeline
58 | freeline.py
59 | freeline/
60 | freeline_project_description.json
61 |
62 | # fastlane
63 | fastlane/report.xml
64 | fastlane/Preview.html
65 | fastlane/screenshots
66 | fastlane/test_output
67 | fastlane/readme.md
68 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
28 |
29 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dlong/rep/dl10sidebar/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.dlong.rep.dl10sidebar;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.os.Bundle;
8 | import android.view.View;
9 | import android.widget.Button;
10 | import android.widget.TextView;
11 |
12 | public class MainActivity extends AppCompatActivity {
13 | private Context mContext = this;
14 |
15 | private Button button;
16 | private TextView txt;
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_main);
22 |
23 | button = findViewById(R.id.button);
24 | txt = findViewById(R.id.txt_tips);
25 |
26 | button.setOnClickListener(new View.OnClickListener() {
27 | @Override
28 | public void onClick(View v) {
29 | Intent intent = new Intent();
30 | intent.setClass(mContext, AreaSelectActivity.class);
31 | startActivityForResult(intent, 1);
32 | }
33 | });
34 | }
35 |
36 | @Override
37 | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
38 | switch (requestCode){
39 | case 1:
40 | if (resultCode != RESULT_OK) return;
41 | if (data == null) return;
42 | String str = data.getStringExtra("string");
43 | txt.setText(str);
44 | break;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dlong/rep/dl10sidebar/utils/ReadAssetsJsonUtil.java:
--------------------------------------------------------------------------------
1 | package com.dlong.rep.dl10sidebar.utils;
2 |
3 | import android.content.Context;
4 | import android.content.res.AssetManager;
5 |
6 | import org.json.JSONArray;
7 | import org.json.JSONException;
8 |
9 | import java.io.BufferedReader;
10 | import java.io.IOException;
11 | import java.io.InputStreamReader;
12 |
13 | /**
14 | * 读取assets资源文件夹下的JSON文件
15 | * @author dlong
16 | * created at 2019/3/26 11:55 AM
17 | */
18 | public class ReadAssetsJsonUtil {
19 |
20 | /**
21 | * 将JSON文件读取成JSONObject
22 | * @param fileName
23 | * @param context
24 | * @return
25 | */
26 | public static JSONArray getJSONArray(String fileName, Context context){
27 | try {
28 | return new JSONArray(getJson(fileName, context));
29 | } catch (JSONException e) {
30 | e.printStackTrace();
31 | }
32 | return null;
33 | }
34 |
35 | private static String getJson(String fileName, Context context){
36 | StringBuilder stringBuilder = new StringBuilder();
37 | try {
38 | //获取assets资源管理器
39 | AssetManager assetManager = context.getAssets();
40 | //通过管理器打开文件并读取
41 | BufferedReader bf = new BufferedReader(new InputStreamReader(
42 | assetManager.open(fileName)));
43 | String line;
44 | while ((line = bf.readLine()) != null) {
45 | stringBuilder.append(line);
46 | }
47 | } catch (IOException e) {
48 | e.printStackTrace();
49 | }
50 | return stringBuilder.toString();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/dlsidebar/src/main/java/com/dlong/rep/dlsidebar/DLTextDialog.java:
--------------------------------------------------------------------------------
1 | package com.dlong.rep.dlsidebar;
2 |
3 | import android.app.Dialog;
4 | import android.content.Context;
5 | import android.graphics.drawable.Drawable;
6 | import android.view.Gravity;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.Window;
10 | import android.view.WindowManager;
11 | import android.widget.RelativeLayout;
12 | import android.widget.TextView;
13 |
14 | public class DLTextDialog {
15 |
16 | private Dialog select_dialog;
17 | private RelativeLayout RL;
18 | private TextView TXT;
19 |
20 | public void dismissD(){
21 | if (select_dialog != null && select_dialog.isShowing()){
22 | select_dialog.dismiss();
23 | }
24 | }
25 |
26 | public void showD(String str) {
27 | if (TXT != null) TXT.setText(str);
28 | if (select_dialog != null && !select_dialog.isShowing()){
29 | select_dialog.show();
30 | }
31 | }
32 |
33 | public DLTextDialog(Context context, int weight, int hight, int textColor, float textSize, Drawable bg){
34 | select_dialog = new Dialog(context, R.style.dialog);
35 | View view = LayoutInflater.from(context).inflate(R.layout.dl_dialog, null);
36 | RL = (RelativeLayout) view.findViewById(R.id.rl);
37 | TXT = (TextView) view.findViewById(R.id.txt);
38 |
39 | RL.setBackground(bg);
40 | TXT.setTextColor(textColor);
41 | TXT.setTextSize(textSize);
42 |
43 | select_dialog.getWindow().setGravity(Gravity.BOTTOM);
44 | select_dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
45 | Window window = select_dialog.getWindow();
46 | window.getDecorView().setPadding(0, 0, 0, 0); //消除边距
47 | WindowManager.LayoutParams lp = window.getAttributes();
48 | lp.width = weight; //设置宽度充满屏幕
49 | lp.height = hight;
50 | lp.gravity = Gravity.CENTER;
51 | window.setAttributes(lp);
52 | select_dialog.setContentView(view);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_area.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
23 |
24 |
28 |
29 |
37 |
38 |
54 |
55 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dlong/rep/dl10sidebar/utils/PinyinUtils.java:
--------------------------------------------------------------------------------
1 | package com.dlong.rep.dl10sidebar.utils;
2 |
3 |
4 | import net.sourceforge.pinyin4j.PinyinHelper;
5 | import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
6 | import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
7 | import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
8 | import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
9 | import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
10 |
11 | public class PinyinUtils {
12 |
13 | /**
14 | * 将字符串中的中文转化为拼音,其他字符不变
15 | * @param inputString
16 | * @return
17 | */
18 | public static String getPinYin(String inputString){
19 | HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
20 | format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
21 | format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
22 | format.setVCharType(HanyuPinyinVCharType.WITH_V);
23 |
24 | char[] input = inputString.trim().toCharArray();
25 | String outPut = "";
26 | try {
27 | for (char curchar : input){
28 | if (Character.toString(curchar).matches("[\\u4E00-\\u9FA5]+")){
29 | String[] temp = PinyinHelper.toHanyuPinyinStringArray(curchar, format);
30 | outPut += temp[0];
31 | }else {
32 | outPut += Character.toString(curchar);
33 | }
34 | }
35 | } catch (BadHanyuPinyinOutputFormatCombination badHanyuPinyinOutputFormatCombination) {
36 | badHanyuPinyinOutputFormatCombination.printStackTrace();
37 | }
38 | return outPut;
39 | }
40 |
41 | /**
42 | * 汉字转换为汉语拼音首字母,英文字符不变
43 | * @param chinese
44 | * @return
45 | */
46 | public static String getFirstSpell(String chinese){
47 | StringBuffer pybf = new StringBuffer();
48 | char[] arr = chinese.toCharArray();
49 | HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
50 | defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
51 | defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
52 | for (char curchar : arr){
53 | if (curchar > 128){
54 | try {
55 | String[] temp = PinyinHelper.toHanyuPinyinStringArray(curchar, defaultFormat);
56 | if (temp != null) {
57 | pybf.append(temp[0].charAt(0));
58 | }
59 | } catch (BadHanyuPinyinOutputFormatCombination e) {
60 | e.printStackTrace();
61 | }
62 | }else {
63 | pybf.append(curchar);
64 | }
65 | }
66 | return pybf.toString().replaceAll("\\W", "").trim();
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/act_area_select.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
15 |
16 |
22 |
23 |
32 |
33 |
40 |
41 |
51 |
52 |
53 |
54 |
57 |
58 |
66 |
67 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dlong/rep/dl10sidebar/adapter/AreaCodeListAdapter.java:
--------------------------------------------------------------------------------
1 | package com.dlong.rep.dl10sidebar.adapter;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import com.dlong.rep.dl10sidebar.R;
12 | import com.dlong.rep.dl10sidebar.bean.AreaPhoneBean;
13 |
14 | import java.util.ArrayList;
15 |
16 | /**
17 | * 国家地区列表适配器
18 | * @author dlong
19 | * created at 2019/3/26 11:46 AM
20 | */
21 | public class AreaCodeListAdapter extends BaseAdapter {
22 | private Context mContext;
23 | private ArrayList mBeans;
24 |
25 | public AreaCodeListAdapter(Context context, ArrayList beans){
26 | mContext = context;
27 | mBeans = beans;
28 | }
29 |
30 | //当列表数据发生变化时,用此方法来更新列表
31 | public void updateListView(ArrayList beans){
32 | this.mBeans = beans;
33 | notifyDataSetChanged();
34 | }
35 |
36 | // 获得当前列表数据
37 | public ArrayList getList(){
38 | return mBeans;
39 | }
40 |
41 | @Override
42 | public int getCount() {
43 | return mBeans.size();
44 | }
45 |
46 | @Override
47 | public Object getItem(int position) {
48 | return mBeans.get(position);
49 | }
50 |
51 | @Override
52 | public long getItemId(int position) {
53 | return position;
54 | }
55 |
56 | @Override
57 | public View getView(int position, View convertView, ViewGroup parent) {
58 | final ViewHolder mHolder;
59 | if (convertView == null) {
60 | mHolder = new ViewHolder();
61 | convertView = LayoutInflater.from(mContext).inflate(R.layout.item_area, parent, false);
62 | mHolder.txtName = (TextView) convertView.findViewById(R.id.txt_name);
63 | mHolder.txtTag = (TextView) convertView.findViewById(R.id.txt_tag);
64 | mHolder.txtNum = (TextView) convertView.findViewById(R.id.txt_num);
65 | mHolder.imgLine = (ImageView) convertView.findViewById(R.id.img_line);
66 | convertView.setTag(mHolder);
67 | } else {
68 | mHolder = (ViewHolder) convertView.getTag();
69 | }
70 | convertView.setId(position);
71 | mHolder.txtName.setText(mBeans.get(position).name);
72 | mHolder.txtNum.setText(mBeans.get(position).code);
73 | String fisrtSpell = mBeans.get(position).fisrtSpell.toUpperCase();
74 | if (position == 0){
75 | mHolder.txtTag.setVisibility(View.VISIBLE);
76 | mHolder.txtTag.setText(fisrtSpell);
77 | mHolder.imgLine.setVisibility(View.VISIBLE);
78 | }else {
79 | String lastFisrtSpell = mBeans.get(position-1).fisrtSpell.toUpperCase();
80 | if (fisrtSpell.equals(lastFisrtSpell)){
81 | mHolder.txtTag.setVisibility(View.GONE);
82 | mHolder.imgLine.setVisibility(View.GONE);
83 | }else {
84 | mHolder.txtTag.setVisibility(View.VISIBLE);
85 | mHolder.txtTag.setText(fisrtSpell);
86 | mHolder.imgLine.setVisibility(View.VISIBLE);
87 | }
88 | }
89 | return convertView;
90 | }
91 |
92 | private class ViewHolder {
93 | private TextView txtName,txtTag,txtNum;
94 | private ImageView imgLine;
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dlong/rep/dl10sidebar/AreaSelectActivity.java:
--------------------------------------------------------------------------------
1 | package com.dlong.rep.dl10sidebar;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.text.Editable;
8 | import android.text.TextWatcher;
9 | import android.view.View;
10 | import android.view.WindowManager;
11 | import android.widget.AdapterView;
12 | import android.widget.EditText;
13 | import android.widget.ImageView;
14 | import android.widget.ListView;
15 | import android.widget.TextView;
16 |
17 | import com.dlong.rep.dl10sidebar.adapter.AreaCodeListAdapter;
18 | import com.dlong.rep.dl10sidebar.bean.AreaPhoneBean;
19 | import com.dlong.rep.dl10sidebar.utils.PinyinUtils;
20 | import com.dlong.rep.dl10sidebar.utils.ReadAssetsJsonUtil;
21 | import com.dlong.rep.dlsidebar.DLSideBar;
22 |
23 | import org.json.JSONArray;
24 |
25 | import java.util.ArrayList;
26 | import java.util.Collections;
27 |
28 | public class AreaSelectActivity extends AppCompatActivity implements View.OnClickListener{
29 | private Context mContext = this;
30 | private AreaCodeListAdapter mAdapter;
31 | private ArrayList mBeans = new ArrayList<>();
32 |
33 | /** 记录当前是否是search图标 */
34 | private boolean IS_SEARCH_ICON = true;
35 |
36 | private ImageView imgSearch;
37 | private ImageView imgBack;
38 | private TextView txtTittle;
39 | private EditText etSearch;
40 | private ListView lvArea;
41 | private DLSideBar sbIndex;
42 |
43 | @Override
44 | protected void onCreate(Bundle savedInstanceState) {
45 | super.onCreate(savedInstanceState);
46 | setContentView(R.layout.act_area_select);
47 | // 防止输入法压缩布局
48 | getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
49 |
50 | initView();
51 | initData();
52 | }
53 |
54 | private void initView() {
55 | imgSearch = findViewById(R.id.img_search);
56 | imgBack = findViewById(R.id.img_back);
57 | txtTittle = findViewById(R.id.txt_tittle);
58 | etSearch = findViewById(R.id.et_search);
59 | lvArea = findViewById(R.id.lv_area);
60 | sbIndex = findViewById(R.id.sb_index);
61 |
62 | imgSearch.setOnClickListener(this);
63 | imgBack.setOnClickListener(this);
64 |
65 | // 配置列表适配器
66 | lvArea.setVerticalScrollBarEnabled(false);
67 | lvArea.setFastScrollEnabled(false);
68 | mAdapter = new AreaCodeListAdapter(mContext, mBeans);
69 | lvArea.setAdapter(mAdapter);
70 | lvArea.setOnItemClickListener(mItemClickListener);
71 | // 配置右侧index
72 | sbIndex.setOnTouchingLetterChangedListener(mSBTouchListener);
73 | // 配置搜索
74 | etSearch.addTextChangedListener(mTextWatcher);
75 | }
76 |
77 | private void initData() {
78 | mBeans.clear();
79 | JSONArray array = ReadAssetsJsonUtil.getJSONArray(getResources().getString(R.string.area_select_json_name), mContext);
80 | if (null == array) array = new JSONArray();
81 | for (int i = 0; i < array.length(); i++) {
82 | AreaPhoneBean bean = new AreaPhoneBean();
83 | bean.name = array.optJSONObject(i).optString("zh");
84 | bean.fisrtSpell = PinyinUtils.getFirstSpell(bean.name.substring(0,1));
85 | bean.name_py = PinyinUtils.getPinYin(bean.name);
86 | bean.code = array.optJSONObject(i).optString("code");
87 | bean.locale = array.optJSONObject(i).optString("locale");
88 | bean.en_name = array.optJSONObject(i).optString("en");
89 | mBeans.add(bean);
90 | }
91 | // 根据拼音为数组进行排序
92 | Collections.sort(mBeans, new AreaPhoneBean.ComparatorPY());
93 | // 数据更新
94 | mAdapter.notifyDataSetChanged();
95 | }
96 |
97 | /**
98 | * 右侧index选项监听
99 | */
100 | private DLSideBar.OnTouchingLetterChangedListener mSBTouchListener = new DLSideBar.OnTouchingLetterChangedListener() {
101 | @Override
102 | public void onTouchingLetterChanged(String str) {
103 | //触摸字母列时,将品牌列表更新到首字母出现的位置
104 | if (mBeans.size()>0){
105 | for (int i=0;i parent, View view, int position, long id) {
148 | ArrayList bs = mAdapter.getList();
149 | AreaPhoneBean bean =bs.get(position);
150 | Intent data = new Intent();
151 | data.putExtra("string", bean.name + "(+" + bean.code + ")");
152 | setResult(RESULT_OK, data);
153 | finish();
154 | }
155 | };
156 |
157 | /**
158 | * 比对筛选
159 | * @param filterStr
160 | */
161 | private void filterContacts(String filterStr){
162 | ArrayList filters = new ArrayList<>();
163 | //遍历数组,筛选出包含关键字的item
164 | for (int i = 0; i < mBeans.size(); i++) {
165 | //过滤的条件
166 | if (isStrInString(mBeans.get(i).name_py,filterStr)
167 | ||mBeans.get(i).name.contains(filterStr)
168 | ||isStrInString(mBeans.get(i).fisrtSpell,filterStr)){
169 | //将筛选出来的item重新添加到数组中
170 | AreaPhoneBean filter = mBeans.get(i);
171 | filters.add(filter);
172 | }
173 | }
174 |
175 | //将列表更新为过滤的联系人
176 | mAdapter.updateListView(filters);
177 | }
178 |
179 | /**
180 | * 判断字符串是否包含
181 | * @param bigStr
182 | * @param smallStr
183 | * @return
184 | */
185 | public boolean isStrInString(String bigStr,String smallStr){
186 | return bigStr.toUpperCase().contains(smallStr.toUpperCase());
187 | }
188 |
189 | /**
190 | * 修改当前显示
191 | */
192 | private void changeMode(){
193 | if (IS_SEARCH_ICON){
194 | imgSearch.setImageResource(R.mipmap.search);
195 | imgSearch.setVisibility(View.VISIBLE);
196 | etSearch.setText("");
197 | etSearch.setVisibility(View.GONE);
198 | txtTittle.setVisibility(View.VISIBLE);
199 | } else {
200 | imgSearch.setImageResource(R.mipmap.clean);
201 | imgSearch.setVisibility(View.INVISIBLE);
202 | etSearch.setVisibility(View.VISIBLE);
203 | etSearch.setFocusable(true);
204 | txtTittle.setVisibility(View.GONE);
205 | }
206 | }
207 |
208 | @Override
209 | public void onClick(View v) {
210 | switch (v.getId()){
211 | case R.id.img_back:
212 | if (IS_SEARCH_ICON){
213 | finish();
214 | } else {
215 | IS_SEARCH_ICON = true;
216 | changeMode();
217 | }
218 | break;
219 | case R.id.img_search:
220 | if (IS_SEARCH_ICON){
221 | IS_SEARCH_ICON = false;
222 | changeMode();
223 | } else {
224 | etSearch.setText("");
225 | }
226 | break;
227 | }
228 | }
229 | }
230 |
--------------------------------------------------------------------------------
/dlsidebar/src/main/java/com/dlong/rep/dlsidebar/DLSideBar.java:
--------------------------------------------------------------------------------
1 | package com.dlong.rep.dlsidebar;
2 |
3 | import android.content.Context;
4 | import android.content.res.Resources;
5 | import android.content.res.TypedArray;
6 | import android.graphics.Canvas;
7 | import android.graphics.Paint;
8 | import android.graphics.Typeface;
9 | import android.graphics.drawable.ColorDrawable;
10 | import android.graphics.drawable.Drawable;
11 | import android.support.annotation.Nullable;
12 | import android.util.AttributeSet;
13 | import android.view.MotionEvent;
14 | import android.view.View;
15 |
16 | import static android.graphics.Paint.ANTI_ALIAS_FLAG;
17 |
18 | public class DLSideBar extends View {
19 | private Context mContext;
20 | private int mChoose = -1;
21 | private Paint mSideTextPaint = new Paint(ANTI_ALIAS_FLAG);
22 | private Paint mSideSelectTextPaint = new Paint(ANTI_ALIAS_FLAG);
23 | private OnTouchingLetterChangedListener onTouchingLetterChangedListener;
24 | private DLTextDialog mTextDialog;
25 |
26 | /** sidebar的字符列表 **/
27 | private CharSequence[] mStringArray;
28 | /** sidebar的字符颜色 **/
29 | private int mSideTextColor;
30 | /** sidebar的字符选中时的颜色 **/
31 | private int mSideTextSelectColor;
32 | /** sidebar的字符大小 **/
33 | private float mSideTextSize;
34 | /** sidebar的背景颜色 **/
35 | private Drawable mSideBackground;
36 | /** 选中弹窗字符颜色 **/
37 | private int mDialogTextColor;
38 | /** 选中弹窗字符大小 **/
39 | private float mDialogTextSize;
40 | /** 选中弹窗字符背景颜色 **/
41 | private Drawable mDialogTextBackground;
42 | /** 选中弹窗字符背景宽度 **/
43 | private int mDialogTextBackgroundWidth;
44 | /** 选中弹窗字符背景高度 **/
45 | private int mDialogTextBackgroundHeight;
46 |
47 | /**
48 | * 自定义接口
49 | */
50 | public interface OnTouchingLetterChangedListener {
51 | void onTouchingLetterChanged(String str);
52 | }
53 |
54 | public DLSideBar(Context context) {
55 | super(context);
56 | mContext = context;
57 | initData(null);
58 | }
59 |
60 | public DLSideBar(Context context, @Nullable AttributeSet attrs) {
61 | super(context, attrs);
62 | mContext = context;
63 | initData(attrs);
64 | }
65 |
66 | public DLSideBar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
67 | super(context, attrs, defStyleAttr);
68 | mContext = context;
69 | initData(attrs);
70 | }
71 |
72 | /**
73 | * 初始化数据
74 | * @param attrs
75 | */
76 | private void initData(@Nullable AttributeSet attrs) {
77 | // 加载默认资源
78 | final Resources res = getResources();
79 | final CharSequence[] defaultStringArray = res.getTextArray(R.array.dl_side_bar_def_list);
80 | final int defaultSideTextColor = res.getColor(R.color.default_side_text_color);
81 | final int defaultSideTextSelectColor = res.getColor(R.color.default_side_text_select_color);
82 | final float defaultSideTextSize = res.getDimension(R.dimen.default_side_text_size);
83 | final Drawable defaultSideBackground = res.getDrawable(R.drawable.default_side_background);
84 | final int defaultDialogTextColor = res.getColor(R.color.default_dialog_text_color);
85 | final float defaultDialogTextSize = res.getDimension(R.dimen.default_dialog_text_size);
86 | final Drawable defaultDialogTextBackground = res.getDrawable(R.drawable.default_dialog_text_background);
87 | final int defaultDialogTextBackgroundWidth = res.getDimensionPixelSize(R.dimen.default_dialog_text_background_width);
88 | final int defaultDialogTextBackgroundHeight = res.getDimensionPixelSize(R.dimen.default_dialog_text_background_height);
89 | // 读取配置信息
90 | TypedArray a = mContext.obtainStyledAttributes(attrs, R.styleable.DLSideBar);
91 | mStringArray = a.getTextArray(R.styleable.DLSideBar_sideTextArray);
92 | if (null == mStringArray||mStringArray.length <= 0){
93 | mStringArray = defaultStringArray;
94 | }
95 | mSideTextColor = a.getColor(R.styleable.DLSideBar_sideTextColor, defaultSideTextColor);
96 | mSideTextSelectColor = a.getColor(R.styleable.DLSideBar_sideTextSelectColor, defaultSideTextSelectColor);
97 | mSideTextSize = a.getDimension(R.styleable.DLSideBar_sideTextSize, defaultSideTextSize);
98 | mSideBackground = a.getDrawable(R.styleable.DLSideBar_sideBackground);
99 | if (null == mSideBackground){
100 | mSideBackground = defaultSideBackground;
101 | }
102 | mDialogTextColor = a.getColor(R.styleable.DLSideBar_dialogTextColor, defaultDialogTextColor);
103 | mDialogTextSize = a.getDimension(R.styleable.DLSideBar_dialogTextSize, defaultDialogTextSize);
104 | mDialogTextBackground = a.getDrawable(R.styleable.DLSideBar_dialogTextBackground);
105 | if (null == mDialogTextBackground){
106 | mDialogTextBackground = defaultDialogTextBackground;
107 | }
108 | mDialogTextBackgroundWidth = a.getDimensionPixelSize(R.styleable.DLSideBar_dialogTextBackgroundWidth, defaultDialogTextBackgroundWidth);
109 | mDialogTextBackgroundHeight = a.getDimensionPixelSize(R.styleable.DLSideBar_dialogTextBackgroundHeight, defaultDialogTextBackgroundHeight);
110 | // 释放内存,回收资源
111 | a.recycle();
112 | mTextDialog = new DLTextDialog(mContext, mDialogTextBackgroundWidth, mDialogTextBackgroundHeight,
113 | mDialogTextColor, mDialogTextSize, mDialogTextBackground);
114 | }
115 |
116 | @Override
117 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
118 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
119 | }
120 |
121 | @Override
122 | protected void onDraw(Canvas canvas) {
123 | super.onDraw(canvas);
124 | // get the height
125 | int height = getHeight();
126 | // get the width
127 | int width = getWidth();
128 | // get one letter height
129 | int singleHeight = height / mStringArray.length;
130 |
131 | mSideTextPaint.setColor(mSideTextColor);
132 | mSideTextPaint.setTextSize(mSideTextSize);
133 | mSideTextPaint.setTypeface(Typeface.DEFAULT);
134 |
135 | mSideSelectTextPaint.setColor(mSideTextSelectColor);
136 | mSideSelectTextPaint.setTextSize(mSideTextSize);
137 | mSideSelectTextPaint.setTypeface(Typeface.DEFAULT);
138 | mSideSelectTextPaint.setFakeBoldText(true);
139 |
140 | for (int i = 0; i < mStringArray.length; i++) {
141 | String text = mStringArray[i].toString();
142 | // if choosed
143 | if(i == mChoose) {
144 | float x = (float) width / 2 - mSideSelectTextPaint.measureText(text) / 2;
145 | float y = singleHeight * i + singleHeight;
146 | canvas.drawText(text, x, y, mSideSelectTextPaint);
147 | } else {
148 | float x = (float) width / 2 - mSideTextPaint.measureText(text) / 2;
149 | float y = singleHeight * i + singleHeight;
150 | canvas.drawText(text, x, y, mSideTextPaint);
151 | }
152 | }
153 | }
154 |
155 | @Override
156 | public boolean dispatchTouchEvent(MotionEvent event) {
157 | final int action = event.getAction();
158 | // get the Y
159 | final float y = event.getY();
160 | final int oldChoose = mChoose;
161 | final OnTouchingLetterChangedListener changedListener = onTouchingLetterChangedListener;
162 | final int letterPos = (int)( y / getHeight() * mStringArray.length);
163 |
164 | switch (action) {
165 | case MotionEvent.ACTION_UP:
166 | setBackgroundDrawable(new ColorDrawable(0x00000000));
167 | mChoose = -1;
168 | invalidate();
169 | if (mTextDialog != null) mTextDialog.dismissD();
170 | break;
171 |
172 | default:
173 | setBackground(mSideBackground);
174 | if (oldChoose != letterPos) {
175 | if (letterPos >= 0 && letterPos < mStringArray.length) {
176 | if (changedListener != null)
177 | changedListener.onTouchingLetterChanged(mStringArray[letterPos].toString());
178 | if (mTextDialog != null) mTextDialog.showD(mStringArray[letterPos].toString());
179 | mChoose = letterPos;
180 | invalidate();
181 | }
182 | }
183 | break;
184 | }
185 | return true;
186 | }
187 |
188 | /**
189 | * 设定回调接口
190 | * @param changedListener
191 | */
192 | public void setOnTouchingLetterChangedListener(OnTouchingLetterChangedListener changedListener) {
193 | this.onTouchingLetterChangedListener = changedListener;
194 | }
195 | }
196 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
--------------------------------------------------------------------------------
/app/src/main/assets/area_phone_code.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "code": 86,
4 | "tw": "中國",
5 | "en": "China",
6 | "locale": "CN",
7 | "zh": "中国"
8 | },
9 | {
10 | "code": 244,
11 | "tw": "安哥拉",
12 | "en": "Angola",
13 | "locale": "AO",
14 | "zh": "安哥拉"
15 | },
16 | {
17 | "code": 93,
18 | "tw": "阿富汗",
19 | "en": "Afghanistan",
20 | "locale": "AF",
21 | "zh": "阿富汗"
22 | },
23 | {
24 | "code": 355,
25 | "tw": "阿爾巴尼亞",
26 | "en": "Albania",
27 | "locale": "AL",
28 | "zh": "阿尔巴尼亚"
29 | },
30 | {
31 | "code": 213,
32 | "tw": "阿爾及利亞",
33 | "en": "Algeria",
34 | "locale": "DZ",
35 | "zh": "阿尔及利亚"
36 | },
37 | {
38 | "code": 376,
39 | "tw": "安道爾共和國",
40 | "en": "Andorra",
41 | "locale": "AD",
42 | "zh": "安道尔共和国"
43 | },
44 | {
45 | "code": 1264,
46 | "tw": "安圭拉島",
47 | "en": "Anguilla",
48 | "locale": "AI",
49 | "zh": "安圭拉岛"
50 | },
51 | {
52 | "code": 1268,
53 | "tw": "安提瓜和巴布達",
54 | "en": "Antigua and Barbuda",
55 | "locale": "AG",
56 | "zh": "安提瓜和巴布达"
57 | },
58 | {
59 | "code": 54,
60 | "tw": "阿根廷",
61 | "en": "Argentina",
62 | "locale": "AR",
63 | "zh": "阿根廷"
64 | },
65 | {
66 | "code": 374,
67 | "tw": "亞美尼亞",
68 | "en": "Armenia",
69 | "locale": "AM",
70 | "zh": "亚美尼亚"
71 | },
72 | {
73 | "code": 247,
74 | "tw": "阿森松",
75 | "en": "Ascension",
76 | "locale": " ",
77 | "zh": "阿森松"
78 | },
79 | {
80 | "code": 61,
81 | "tw": "澳大利亞",
82 | "en": "Australia",
83 | "locale": "AU",
84 | "zh": "澳大利亚"
85 | },
86 | {
87 | "code": 43,
88 | "tw": "奧地利",
89 | "en": "Austria",
90 | "locale": "AT",
91 | "zh": "奥地利"
92 | },
93 | {
94 | "code": 994,
95 | "tw": "阿塞拜疆",
96 | "en": "Azerbaijan",
97 | "locale": "AZ",
98 | "zh": "阿塞拜疆"
99 | },
100 | {
101 | "code": 1242,
102 | "tw": "巴哈馬",
103 | "en": "Bahamas",
104 | "locale": "BS",
105 | "zh": "巴哈马"
106 | },
107 | {
108 | "code": 973,
109 | "tw": "巴林",
110 | "en": "Bahrain",
111 | "locale": "BH",
112 | "zh": "巴林"
113 | },
114 | {
115 | "code": 880,
116 | "tw": "孟加拉國",
117 | "en": "Bangladesh",
118 | "locale": "BD",
119 | "zh": "孟加拉国"
120 | },
121 | {
122 | "code": 1246,
123 | "tw": "巴巴多斯",
124 | "en": "Barbados",
125 | "locale": "BB",
126 | "zh": "巴巴多斯"
127 | },
128 | {
129 | "code": 375,
130 | "tw": "白俄羅斯",
131 | "en": "Belarus",
132 | "locale": "BY",
133 | "zh": "白俄罗斯"
134 | },
135 | {
136 | "code": 32,
137 | "tw": "比利時",
138 | "en": "Belgium",
139 | "locale": "BE",
140 | "zh": "比利时"
141 | },
142 | {
143 | "code": 501,
144 | "tw": "伯利茲",
145 | "en": "Belize",
146 | "locale": "BZ",
147 | "zh": "伯利兹"
148 | },
149 | {
150 | "code": 229,
151 | "tw": "貝寧",
152 | "en": "Benin",
153 | "locale": "BJ",
154 | "zh": "贝宁"
155 | },
156 | {
157 | "code": 1441,
158 | "tw": "百慕達群島",
159 | "en": "Bermuda Is.",
160 | "locale": "BM",
161 | "zh": "百慕大群岛"
162 | },
163 | {
164 | "code": 591,
165 | "tw": "玻利維亞",
166 | "en": "Bolivia",
167 | "locale": "BO",
168 | "zh": "玻利维亚"
169 | },
170 | {
171 | "code": 267,
172 | "tw": "博茨瓦納",
173 | "en": "Botswana",
174 | "locale": "BW",
175 | "zh": "博茨瓦纳"
176 | },
177 | {
178 | "code": 55,
179 | "tw": "巴西",
180 | "en": "Brazil",
181 | "locale": "BR",
182 | "zh": "巴西"
183 | },
184 | {
185 | "code": 673,
186 | "tw": "文萊",
187 | "en": "Brunei",
188 | "locale": "BN",
189 | "zh": "文莱"
190 | },
191 | {
192 | "code": 359,
193 | "tw": "保加利亞",
194 | "en": "Bulgaria",
195 | "locale": "BG",
196 | "zh": "保加利亚"
197 | },
198 | {
199 | "code": 226,
200 | "tw": "布基納法索",
201 | "en": "Burkina-faso",
202 | "locale": "BF",
203 | "zh": "布基纳法索"
204 | },
205 | {
206 | "code": 95,
207 | "tw": "緬甸",
208 | "en": "Burma",
209 | "locale": "MM",
210 | "zh": "缅甸"
211 | },
212 | {
213 | "code": 257,
214 | "tw": "布隆迪",
215 | "en": "Burundi",
216 | "locale": "BI",
217 | "zh": "布隆迪"
218 | },
219 | {
220 | "code": 237,
221 | "tw": "喀麥隆",
222 | "en": "Cameroon",
223 | "locale": "CM",
224 | "zh": "喀麦隆"
225 | },
226 | {
227 | "code": 1,
228 | "tw": "加拿大",
229 | "en": "Canada",
230 | "locale": "CA",
231 | "zh": "加拿大"
232 | },
233 | {
234 | "code": 1345,
235 | "tw": "開曼群島",
236 | "en": "Cayman Is.",
237 | "locale": " ",
238 | "zh": "开曼群岛"
239 | },
240 | {
241 | "code": 236,
242 | "tw": "中非共和國",
243 | "en": "Central African Republic",
244 | "locale": "CF",
245 | "zh": "中非共和国"
246 | },
247 | {
248 | "code": 235,
249 | "tw": "乍得",
250 | "en": "Chad",
251 | "locale": "TD",
252 | "zh": "乍得"
253 | },
254 | {
255 | "code": 56,
256 | "tw": "智利",
257 | "en": "Chile",
258 | "locale": "CL",
259 | "zh": "智利"
260 | },
261 | {
262 | "code": 57,
263 | "tw": "哥倫比亞",
264 | "en": "Colombia",
265 | "locale": "CO",
266 | "zh": "哥伦比亚"
267 | },
268 | {
269 | "code": 242,
270 | "tw": "剛果",
271 | "en": "Congo",
272 | "locale": "CG",
273 | "zh": "刚果"
274 | },
275 | {
276 | "code": 682,
277 | "tw": "庫克群島",
278 | "en": "Cook Is.",
279 | "locale": "CK",
280 | "zh": "库克群岛"
281 | },
282 | {
283 | "code": 506,
284 | "tw": "哥斯達黎加",
285 | "en": "Costa Rica",
286 | "locale": "CR",
287 | "zh": "哥斯达黎加"
288 | },
289 | {
290 | "code": 53,
291 | "tw": "古巴",
292 | "en": "Cuba",
293 | "locale": "CU",
294 | "zh": "古巴"
295 | },
296 | {
297 | "code": 357,
298 | "tw": "塞浦路斯",
299 | "en": "Cyprus",
300 | "locale": "CY",
301 | "zh": "塞浦路斯"
302 | },
303 | {
304 | "code": 420,
305 | "tw": "捷克",
306 | "en": "Czech Republic",
307 | "locale": "CZ",
308 | "zh": "捷克"
309 | },
310 | {
311 | "code": 45,
312 | "tw": "丹麥",
313 | "en": "Denmark",
314 | "locale": "DK",
315 | "zh": "丹麦"
316 | },
317 | {
318 | "code": 253,
319 | "tw": "吉布堤",
320 | "en": "Djibouti",
321 | "locale": "DJ",
322 | "zh": "吉布提"
323 | },
324 | {
325 | "code": 1890,
326 | "tw": "多明尼加共和國共和國",
327 | "en": "Dominica Rep.",
328 | "locale": "DO",
329 | "zh": "多米尼加共和国"
330 | },
331 | {
332 | "code": 593,
333 | "tw": "厄瓜多爾",
334 | "en": "Ecuador",
335 | "locale": "EC",
336 | "zh": "厄瓜多尔"
337 | },
338 | {
339 | "code": 20,
340 | "tw": "埃及",
341 | "en": "Egypt",
342 | "locale": "EG",
343 | "zh": "埃及"
344 | },
345 | {
346 | "code": 503,
347 | "tw": "薩爾瓦多",
348 | "en": "EI Salvador",
349 | "locale": "SV",
350 | "zh": "萨尔瓦多"
351 | },
352 | {
353 | "code": 372,
354 | "tw": "愛沙尼亞",
355 | "en": "Estonia",
356 | "locale": "EE",
357 | "zh": "爱沙尼亚"
358 | },
359 | {
360 | "code": 251,
361 | "tw": "埃塞俄比亞",
362 | "en": "Ethiopia",
363 | "locale": "ET",
364 | "zh": "埃塞俄比亚"
365 | },
366 | {
367 | "code": 679,
368 | "tw": "斐濟",
369 | "en": "Fiji",
370 | "locale": "FJ",
371 | "zh": "斐济"
372 | },
373 | {
374 | "code": 358,
375 | "tw": "芬蘭",
376 | "en": "Finland",
377 | "locale": "FI",
378 | "zh": "芬兰"
379 | },
380 | {
381 | "code": 33,
382 | "tw": "法國",
383 | "en": "France",
384 | "locale": "FR",
385 | "zh": "法国"
386 | },
387 | {
388 | "code": 594,
389 | "tw": "法屬圭亞那",
390 | "en": "French Guiana",
391 | "locale": "GF",
392 | "zh": "法属圭亚那"
393 | },
394 | {
395 | "code": 241,
396 | "tw": "加蓬",
397 | "en": "Gabon",
398 | "locale": "GA",
399 | "zh": "加蓬"
400 | },
401 | {
402 | "code": 220,
403 | "tw": "岡比亞",
404 | "en": "Gambia",
405 | "locale": "GM",
406 | "zh": "冈比亚"
407 | },
408 | {
409 | "code": 995,
410 | "tw": "格魯吉亞",
411 | "en": "Georgia",
412 | "locale": "GE",
413 | "zh": "格鲁吉亚"
414 | },
415 | {
416 | "code": 49,
417 | "tw": "德國",
418 | "en": "Germany",
419 | "locale": "DE",
420 | "zh": "德国"
421 | },
422 | {
423 | "code": 233,
424 | "tw": "加納",
425 | "en": "Ghana",
426 | "locale": "GH",
427 | "zh": "加纳"
428 | },
429 | {
430 | "code": 350,
431 | "tw": "直布羅陀",
432 | "en": "Gibraltar",
433 | "locale": "GI",
434 | "zh": "直布罗陀"
435 | },
436 | {
437 | "code": 30,
438 | "tw": "希臘",
439 | "en": "Greece",
440 | "locale": "GR",
441 | "zh": "希腊"
442 | },
443 | {
444 | "code": 1809,
445 | "tw": "格林納達",
446 | "en": "Grenada",
447 | "locale": "GD",
448 | "zh": "格林纳达"
449 | },
450 | {
451 | "code": 1671,
452 | "tw": "關島",
453 | "en": "Guam",
454 | "locale": "GU",
455 | "zh": "关岛"
456 | },
457 | {
458 | "code": 502,
459 | "tw": "危地馬拉",
460 | "en": "Guatemala",
461 | "locale": "GT",
462 | "zh": "危地马拉"
463 | },
464 | {
465 | "code": 224,
466 | "tw": "幾內亞",
467 | "en": "Guinea",
468 | "locale": "GN",
469 | "zh": "几内亚"
470 | },
471 | {
472 | "code": 592,
473 | "tw": "圭亞那",
474 | "en": "Guyana",
475 | "locale": "GY",
476 | "zh": "圭亚那"
477 | },
478 | {
479 | "code": 509,
480 | "tw": "海地",
481 | "en": "Haiti",
482 | "locale": "HT",
483 | "zh": "海地"
484 | },
485 | {
486 | "code": 504,
487 | "tw": "洪都拉斯",
488 | "en": "Honduras",
489 | "locale": "HN",
490 | "zh": "洪都拉斯"
491 | },
492 | {
493 | "code": 852,
494 | "tw": "中國香港",
495 | "en": "Hongkong",
496 | "locale": "HK",
497 | "zh": "中国香港"
498 | },
499 | {
500 | "code": 36,
501 | "tw": "匈牙利",
502 | "en": "Hungary",
503 | "locale": "HU",
504 | "zh": "匈牙利"
505 | },
506 | {
507 | "code": 354,
508 | "tw": "冰島",
509 | "en": "Iceland",
510 | "locale": "IS",
511 | "zh": "冰岛"
512 | },
513 | {
514 | "code": 91,
515 | "tw": "印度",
516 | "en": "India",
517 | "locale": "IN",
518 | "zh": "印度"
519 | },
520 | {
521 | "code": 62,
522 | "tw": "印度尼西亞",
523 | "en": "Indonesia",
524 | "locale": "ID",
525 | "zh": "印度尼西亚"
526 | },
527 | {
528 | "code": 98,
529 | "tw": "伊朗",
530 | "en": "Iran",
531 | "locale": "IR",
532 | "zh": "伊朗"
533 | },
534 | {
535 | "code": 964,
536 | "tw": "伊拉克",
537 | "en": "Iraq",
538 | "locale": "IQ",
539 | "zh": "伊拉克"
540 | },
541 | {
542 | "code": 353,
543 | "tw": "愛爾蘭",
544 | "en": "Ireland",
545 | "locale": "IE",
546 | "zh": "爱尔兰"
547 | },
548 | {
549 | "code": 972,
550 | "tw": "以色列",
551 | "en": "Israel",
552 | "locale": "IL",
553 | "zh": "以色列"
554 | },
555 | {
556 | "code": 39,
557 | "tw": "意大利",
558 | "en": "Italy",
559 | "locale": "IT",
560 | "zh": "意大利"
561 | },
562 | {
563 | "code": 225,
564 | "tw": "科特迪瓦",
565 | "en": "Ivory Coast",
566 | "locale": " ",
567 | "zh": "科特迪瓦"
568 | },
569 | {
570 | "code": 1876,
571 | "tw": "牙買加",
572 | "en": "Jamaica",
573 | "locale": "JM",
574 | "zh": "牙买加"
575 | },
576 | {
577 | "code": 81,
578 | "tw": "日本",
579 | "en": "Japan",
580 | "locale": "JP",
581 | "zh": "日本"
582 | },
583 | {
584 | "code": 962,
585 | "tw": "約旦",
586 | "en": "Jordan",
587 | "locale": "JO",
588 | "zh": "约旦"
589 | },
590 | {
591 | "code": 855,
592 | "tw": "柬埔寨",
593 | "en": "Kampuchea (Cambodia )",
594 | "locale": "KH",
595 | "zh": "柬埔寨"
596 | },
597 | {
598 | "code": 327,
599 | "tw": "哈薩克",
600 | "en": "Kazakstan",
601 | "locale": "KZ",
602 | "zh": "哈萨克斯坦"
603 | },
604 | {
605 | "code": 254,
606 | "tw": "肯雅",
607 | "en": "Kenya",
608 | "locale": "KE",
609 | "zh": "肯尼亚"
610 | },
611 | {
612 | "code": 82,
613 | "tw": "韓國",
614 | "en": "Korea",
615 | "locale": "KR",
616 | "zh": "韩国"
617 | },
618 | {
619 | "code": 965,
620 | "tw": "科威特",
621 | "en": "Kuwait",
622 | "locale": "KW",
623 | "zh": "科威特"
624 | },
625 | {
626 | "code": 331,
627 | "tw": "吉爾吉斯坦",
628 | "en": "Kyrgyzstan",
629 | "locale": "KG",
630 | "zh": "吉尔吉斯坦"
631 | },
632 | {
633 | "code": 856,
634 | "tw": "寮國",
635 | "en": "Laos",
636 | "locale": "LA",
637 | "zh": "老挝"
638 | },
639 | {
640 | "code": 371,
641 | "tw": "拉脫維亞",
642 | "en": "Latvia",
643 | "locale": "LV",
644 | "zh": "拉脱维亚"
645 | },
646 | {
647 | "code": 961,
648 | "tw": "黎巴嫩",
649 | "en": "Lebanon",
650 | "locale": "LB",
651 | "zh": "黎巴嫩"
652 | },
653 | {
654 | "code": 266,
655 | "tw": "萊索托",
656 | "en": "Lesotho",
657 | "locale": "LS",
658 | "zh": "莱索托"
659 | },
660 | {
661 | "code": 231,
662 | "tw": "利比里亞",
663 | "en": "Liberia",
664 | "locale": "LR",
665 | "zh": "利比里亚"
666 | },
667 | {
668 | "code": 218,
669 | "tw": "利比亞",
670 | "en": "Libya",
671 | "locale": "LY",
672 | "zh": "利比亚"
673 | },
674 | {
675 | "code": 423,
676 | "tw": "列支敦士登",
677 | "en": "Liechtenstein",
678 | "locale": "LI",
679 | "zh": "列支敦士登"
680 | },
681 | {
682 | "code": 370,
683 | "tw": "立陶宛",
684 | "en": "Lithuania",
685 | "locale": "LT",
686 | "zh": "立陶宛"
687 | },
688 | {
689 | "code": 352,
690 | "tw": "盧森堡",
691 | "en": "Luxembourg",
692 | "locale": "LU",
693 | "zh": "卢森堡"
694 | },
695 | {
696 | "code": 853,
697 | "tw": "中國澳門",
698 | "en": "Macao",
699 | "locale": "MO",
700 | "zh": "中国澳门"
701 | },
702 | {
703 | "code": 261,
704 | "tw": "馬達加斯加",
705 | "en": "Madagascar",
706 | "locale": "MG",
707 | "zh": "马达加斯加"
708 | },
709 | {
710 | "code": 265,
711 | "tw": "馬拉維",
712 | "en": "Malawi",
713 | "locale": "MW",
714 | "zh": "马拉维"
715 | },
716 | {
717 | "code": 60,
718 | "tw": "馬來西亞",
719 | "en": "Malaysia",
720 | "locale": "MY",
721 | "zh": "马来西亚"
722 | },
723 | {
724 | "code": 960,
725 | "tw": "馬爾代夫",
726 | "en": "Maldives",
727 | "locale": "MV",
728 | "zh": "马尔代夫"
729 | },
730 | {
731 | "code": 223,
732 | "tw": "馬里",
733 | "en": "Mali",
734 | "locale": "ML",
735 | "zh": "马里"
736 | },
737 | {
738 | "code": 356,
739 | "tw": "馬爾他",
740 | "en": "Malta",
741 | "locale": "MT",
742 | "zh": "马耳他"
743 | },
744 | {
745 | "code": 1670,
746 | "tw": "馬里亞那群島",
747 | "en": "Mariana Is",
748 | "locale": " ",
749 | "zh": "马里亚那群岛"
750 | },
751 | {
752 | "code": 596,
753 | "tw": "馬提尼克島",
754 | "en": "Martinique",
755 | "locale": " ",
756 | "zh": "马提尼克"
757 | },
758 | {
759 | "code": 230,
760 | "tw": "毛里裘斯",
761 | "en": "Mauritius",
762 | "locale": "MU",
763 | "zh": "毛里求斯"
764 | },
765 | {
766 | "code": 52,
767 | "tw": "墨西哥",
768 | "en": "Mexico",
769 | "locale": "MX",
770 | "zh": "墨西哥"
771 | },
772 | {
773 | "code": 373,
774 | "tw": "摩爾多瓦",
775 | "en": "Moldova, Republic of",
776 | "locale": "MD",
777 | "zh": "摩尔多瓦"
778 | },
779 | {
780 | "code": 377,
781 | "tw": "摩納哥",
782 | "en": "Monaco",
783 | "locale": "MC",
784 | "zh": "摩纳哥"
785 | },
786 | {
787 | "code": 976,
788 | "tw": "蒙古",
789 | "en": "Mongolia",
790 | "locale": "MN",
791 | "zh": "蒙古"
792 | },
793 | {
794 | "code": 1664,
795 | "tw": "蒙特塞拉特島",
796 | "en": "Montserrat Is",
797 | "locale": "MS",
798 | "zh": "蒙特塞拉特岛"
799 | },
800 | {
801 | "code": 212,
802 | "tw": "摩洛哥",
803 | "en": "Morocco",
804 | "locale": "MA",
805 | "zh": "摩洛哥"
806 | },
807 | {
808 | "code": 258,
809 | "tw": "莫桑比克",
810 | "en": "Mozambique",
811 | "locale": "MZ",
812 | "zh": "莫桑比克"
813 | },
814 | {
815 | "code": 264,
816 | "tw": "納米比亞",
817 | "en": "Namibia",
818 | "locale": "NA",
819 | "zh": "纳米比亚"
820 | },
821 | {
822 | "code": 674,
823 | "tw": "瑙魯",
824 | "en": "Nauru",
825 | "locale": "NR",
826 | "zh": "瑙鲁"
827 | },
828 | {
829 | "code": 977,
830 | "tw": "尼泊爾",
831 | "en": "Nepal",
832 | "locale": "NP",
833 | "zh": "尼泊尔"
834 | },
835 | {
836 | "code": 599,
837 | "tw": "荷屬安地列斯",
838 | "en": "Netheriands Antilles",
839 | "locale": " ",
840 | "zh": "荷属安的列斯"
841 | },
842 | {
843 | "code": 31,
844 | "tw": "荷蘭",
845 | "en": "Netherlands",
846 | "locale": "NL",
847 | "zh": "荷兰"
848 | },
849 | {
850 | "code": 64,
851 | "tw": "新西蘭",
852 | "en": "New Zealand",
853 | "locale": "NZ",
854 | "zh": "新西兰"
855 | },
856 | {
857 | "code": 505,
858 | "tw": "尼加拉瓜",
859 | "en": "Nicaragua",
860 | "locale": "NI",
861 | "zh": "尼加拉瓜"
862 | },
863 | {
864 | "code": 227,
865 | "tw": "尼日爾",
866 | "en": "Niger",
867 | "locale": "NE",
868 | "zh": "尼日尔"
869 | },
870 | {
871 | "code": 234,
872 | "tw": "尼日利亞",
873 | "en": "Nigeria",
874 | "locale": "NG",
875 | "zh": "尼日利亚"
876 | },
877 | {
878 | "code": 850,
879 | "tw": "朝鮮",
880 | "en": "North Korea",
881 | "locale": "KP",
882 | "zh": "朝鲜"
883 | },
884 | {
885 | "code": 47,
886 | "tw": "挪威",
887 | "en": "Norway",
888 | "locale": "NO",
889 | "zh": "挪威"
890 | },
891 | {
892 | "code": 968,
893 | "tw": "阿曼",
894 | "en": "Oman",
895 | "locale": "OM",
896 | "zh": "阿曼"
897 | },
898 | {
899 | "code": 92,
900 | "tw": "巴基斯坦",
901 | "en": "Pakistan",
902 | "locale": "PK",
903 | "zh": "巴基斯坦"
904 | },
905 | {
906 | "code": 507,
907 | "tw": "巴拿馬",
908 | "en": "Panama",
909 | "locale": "PA",
910 | "zh": "巴拿马"
911 | },
912 | {
913 | "code": 675,
914 | "tw": "巴布亞新畿內亞",
915 | "en": "Papua New Cuinea",
916 | "locale": "PG",
917 | "zh": "巴布亚新几内亚"
918 | },
919 | {
920 | "code": 595,
921 | "tw": "巴拉圭",
922 | "en": "Paraguay",
923 | "locale": "PY",
924 | "zh": "巴拉圭"
925 | },
926 | {
927 | "code": 51,
928 | "tw": "秘魯",
929 | "en": "Peru",
930 | "locale": "PE",
931 | "zh": "秘鲁"
932 | },
933 | {
934 | "code": 63,
935 | "tw": "菲律賓",
936 | "en": "Philippines",
937 | "locale": "PH",
938 | "zh": "菲律宾"
939 | },
940 | {
941 | "code": 48,
942 | "tw": "波蘭",
943 | "en": "Poland",
944 | "locale": "PL",
945 | "zh": "波兰"
946 | },
947 | {
948 | "code": 689,
949 | "tw": "法屬玻利尼西亞",
950 | "en": "French Polynesia",
951 | "locale": "PF",
952 | "zh": "法属玻利尼西亚"
953 | },
954 | {
955 | "code": 351,
956 | "tw": "葡萄牙",
957 | "en": "Portugal",
958 | "locale": "PT",
959 | "zh": "葡萄牙"
960 | },
961 | {
962 | "code": 1787,
963 | "tw": "波多黎各",
964 | "en": "Puerto Rico",
965 | "locale": "PR",
966 | "zh": "波多黎各"
967 | },
968 | {
969 | "code": 974,
970 | "tw": "卡塔爾",
971 | "en": "Qatar",
972 | "locale": "QA",
973 | "zh": "卡塔尔"
974 | },
975 | {
976 | "code": 262,
977 | "tw": "留尼旺",
978 | "en": "Reunion",
979 | "locale": " ",
980 | "zh": "留尼旺"
981 | },
982 | {
983 | "code": 40,
984 | "tw": "羅馬尼亞",
985 | "en": "Romania",
986 | "locale": "RO",
987 | "zh": "罗马尼亚"
988 | },
989 | {
990 | "code": 7,
991 | "tw": "俄羅斯",
992 | "en": "Russia",
993 | "locale": "RU",
994 | "zh": "俄罗斯"
995 | },
996 | {
997 | "code": 1758,
998 | "tw": "聖盧西亞",
999 | "en": "Saint Lueia",
1000 | "locale": "LC",
1001 | "zh": "圣卢西亚"
1002 | },
1003 | {
1004 | "code": 1784,
1005 | "tw": "聖文森特島",
1006 | "en": "Saint Vincent",
1007 | "locale": "VC",
1008 | "zh": "圣文森特岛"
1009 | },
1010 | {
1011 | "code": 684,
1012 | "tw": "東薩摩亞(美)",
1013 | "en": "Samoa Eastern",
1014 | "locale": " ",
1015 | "zh": "东萨摩亚(美)"
1016 | },
1017 | {
1018 | "code": 685,
1019 | "tw": "西薩摩亞",
1020 | "en": "Samoa Western",
1021 | "locale": " ",
1022 | "zh": "西萨摩亚"
1023 | },
1024 | {
1025 | "code": 378,
1026 | "tw": "聖馬力諾",
1027 | "en": "San Marino",
1028 | "locale": "SM",
1029 | "zh": "圣马力诺"
1030 | },
1031 | {
1032 | "code": 239,
1033 | "tw": "聖多美和普林西比",
1034 | "en": "Sao Tome and Principe",
1035 | "locale": "ST",
1036 | "zh": "圣多美和普林西比"
1037 | },
1038 | {
1039 | "code": 966,
1040 | "tw": "沙地阿拉伯",
1041 | "en": "Saudi Arabia",
1042 | "locale": "SA",
1043 | "zh": "沙特阿拉伯"
1044 | },
1045 | {
1046 | "code": 221,
1047 | "tw": "塞內加爾",
1048 | "en": "Senegal",
1049 | "locale": "SN",
1050 | "zh": "塞内加尔"
1051 | },
1052 | {
1053 | "code": 248,
1054 | "tw": "塞舌爾",
1055 | "en": "Seychelles",
1056 | "locale": "SC",
1057 | "zh": "塞舌尔"
1058 | },
1059 | {
1060 | "code": 232,
1061 | "tw": "塞拉利昂",
1062 | "en": "Sierra Leone",
1063 | "locale": "SL",
1064 | "zh": "塞拉利昂"
1065 | },
1066 | {
1067 | "code": 65,
1068 | "tw": "新加坡",
1069 | "en": "Singapore",
1070 | "locale": "SG",
1071 | "zh": "新加坡"
1072 | },
1073 | {
1074 | "code": 421,
1075 | "tw": "斯洛伐克",
1076 | "en": "Slovakia",
1077 | "locale": "SK",
1078 | "zh": "斯洛伐克"
1079 | },
1080 | {
1081 | "code": 386,
1082 | "tw": "斯洛文尼亞",
1083 | "en": "Slovenia",
1084 | "locale": "SI",
1085 | "zh": "斯洛文尼亚"
1086 | },
1087 | {
1088 | "code": 677,
1089 | "tw": "所羅門群島",
1090 | "en": "Solomon Is",
1091 | "locale": "SB",
1092 | "zh": "所罗门群岛"
1093 | },
1094 | {
1095 | "code": 252,
1096 | "tw": "索馬里",
1097 | "en": "Somali",
1098 | "locale": "SO",
1099 | "zh": "索马里"
1100 | },
1101 | {
1102 | "code": 27,
1103 | "tw": "南非",
1104 | "en": "South Africa",
1105 | "locale": "ZA",
1106 | "zh": "南非"
1107 | },
1108 | {
1109 | "code": 34,
1110 | "tw": "西班牙",
1111 | "en": "Spain",
1112 | "locale": "ES",
1113 | "zh": "西班牙"
1114 | },
1115 | {
1116 | "code": 94,
1117 | "tw": "斯裡蘭卡",
1118 | "en": "Sri Lanka",
1119 | "locale": "LK",
1120 | "zh": "斯里兰卡"
1121 | },
1122 | {
1123 | "code": 1758,
1124 | "tw": "聖盧西亞",
1125 | "en": "St.Lucia",
1126 | "locale": "LC",
1127 | "zh": "圣卢西亚"
1128 | },
1129 | {
1130 | "code": 1784,
1131 | "tw": "聖文森特",
1132 | "en": "St.Vincent",
1133 | "locale": "VC",
1134 | "zh": "圣文森特"
1135 | },
1136 | {
1137 | "code": 249,
1138 | "tw": "蘇丹",
1139 | "en": "Sudan",
1140 | "locale": "SD",
1141 | "zh": "苏丹"
1142 | },
1143 | {
1144 | "code": 597,
1145 | "tw": "蘇里南",
1146 | "en": "Suriname",
1147 | "locale": "SR",
1148 | "zh": "苏里南"
1149 | },
1150 | {
1151 | "code": 268,
1152 | "tw": "斯威士蘭",
1153 | "en": "Swaziland",
1154 | "locale": "SZ",
1155 | "zh": "斯威士兰"
1156 | },
1157 | {
1158 | "code": 46,
1159 | "tw": "瑞典",
1160 | "en": "Sweden",
1161 | "locale": "SE",
1162 | "zh": "瑞典"
1163 | },
1164 | {
1165 | "code": 41,
1166 | "tw": "瑞士",
1167 | "en": "Switzerland",
1168 | "locale": "CH",
1169 | "zh": "瑞士"
1170 | },
1171 | {
1172 | "code": 963,
1173 | "tw": "敘利亞",
1174 | "en": "Syria",
1175 | "locale": "SY",
1176 | "zh": "叙利亚"
1177 | },
1178 | {
1179 | "code": 886,
1180 | "tw": "中國台灣",
1181 | "en": "Taiwan",
1182 | "locale": "TW",
1183 | "zh": "中国台湾"
1184 | },
1185 | {
1186 | "code": 992,
1187 | "tw": "塔吉克",
1188 | "en": "Tajikstan",
1189 | "locale": "TJ",
1190 | "zh": "塔吉克斯坦"
1191 | },
1192 | {
1193 | "code": 255,
1194 | "tw": "坦桑尼亞",
1195 | "en": "Tanzania",
1196 | "locale": "TZ",
1197 | "zh": "坦桑尼亚"
1198 | },
1199 | {
1200 | "code": 66,
1201 | "tw": "泰國",
1202 | "en": "Thailand",
1203 | "locale": "TH",
1204 | "zh": "泰国"
1205 | },
1206 | {
1207 | "code": 228,
1208 | "tw": "多哥",
1209 | "en": "Togo",
1210 | "locale": "TG",
1211 | "zh": "多哥"
1212 | },
1213 | {
1214 | "code": 676,
1215 | "tw": "湯加",
1216 | "en": "Tonga",
1217 | "locale": "TO",
1218 | "zh": "汤加"
1219 | },
1220 | {
1221 | "code": 1809,
1222 | "tw": "特立尼達和多巴哥",
1223 | "en": "Trinidad and Tobago",
1224 | "locale": "TT",
1225 | "zh": "特立尼达和多巴哥"
1226 | },
1227 | {
1228 | "code": 216,
1229 | "tw": "突尼斯",
1230 | "en": "Tunisia",
1231 | "locale": "TN",
1232 | "zh": "突尼斯"
1233 | },
1234 | {
1235 | "code": 90,
1236 | "tw": "土耳其",
1237 | "en": "Turkey",
1238 | "locale": "TR",
1239 | "zh": "土耳其"
1240 | },
1241 | {
1242 | "code": 993,
1243 | "tw": "土庫曼",
1244 | "en": "Turkmenistan",
1245 | "locale": "TM",
1246 | "zh": "土库曼斯坦"
1247 | },
1248 | {
1249 | "code": 256,
1250 | "tw": "烏幹達",
1251 | "en": "Uganda",
1252 | "locale": "UG",
1253 | "zh": "乌干达"
1254 | },
1255 | {
1256 | "code": 380,
1257 | "tw": "烏克蘭",
1258 | "en": "Ukraine",
1259 | "locale": "UA",
1260 | "zh": "乌克兰"
1261 | },
1262 | {
1263 | "code": 971,
1264 | "tw": "阿拉伯聯合酋長國",
1265 | "en": "United Arab Emirates",
1266 | "locale": "AE",
1267 | "zh": "阿拉伯联合酋长国"
1268 | },
1269 | {
1270 | "code": 44,
1271 | "tw": "英國",
1272 | "en": "United Kiongdom",
1273 | "locale": "GB",
1274 | "zh": "英国"
1275 | },
1276 | {
1277 | "code": 1,
1278 | "tw": "美國",
1279 | "en": "United States of America",
1280 | "locale": "US",
1281 | "zh": "美国"
1282 | },
1283 | {
1284 | "code": 598,
1285 | "tw": "烏拉圭",
1286 | "en": "Uruguay",
1287 | "locale": "UY",
1288 | "zh": "乌拉圭"
1289 | },
1290 | {
1291 | "code": 233,
1292 | "tw": "烏茲別克",
1293 | "en": "Uzbekistan",
1294 | "locale": "UZ",
1295 | "zh": "乌兹别克斯坦"
1296 | },
1297 | {
1298 | "code": 58,
1299 | "tw": "委內瑞拉",
1300 | "en": "Venezuela",
1301 | "locale": "VE",
1302 | "zh": "委内瑞拉"
1303 | },
1304 | {
1305 | "code": 84,
1306 | "tw": "越南",
1307 | "en": "Vietnam",
1308 | "locale": "VN",
1309 | "zh": "越南"
1310 | },
1311 | {
1312 | "code": 967,
1313 | "tw": "也門",
1314 | "en": "Yemen",
1315 | "locale": "YE",
1316 | "zh": "也门"
1317 | },
1318 | {
1319 | "code": 381,
1320 | "tw": "南斯拉夫",
1321 | "en": "Yugoslavia",
1322 | "locale": "YU",
1323 | "zh": "南斯拉夫"
1324 | },
1325 | {
1326 | "code": 263,
1327 | "tw": "津巴布韋",
1328 | "en": "Zimbabwe",
1329 | "locale": "ZW",
1330 | "zh": "津巴布韦"
1331 | },
1332 | {
1333 | "code": 243,
1334 | "tw": "扎伊爾",
1335 | "en": "Zaire",
1336 | "locale": "ZR",
1337 | "zh": "扎伊尔"
1338 | },
1339 | {
1340 | "code": 260,
1341 | "tw": "贊比亞",
1342 | "en": "Zambia",
1343 | "locale": "ZM",
1344 | "zh": "赞比亚"
1345 | }
1346 | ]
--------------------------------------------------------------------------------