├── .gitignore
├── README.md
├── SelectCityModule.iml
├── app
├── .gitignore
├── app.iml
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── socks
│ │ └── selectcitymodule
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── socks
│ │ │ └── selectcitymodule
│ │ │ ├── MainActivity.java
│ │ │ ├── SortAdapter.java
│ │ │ └── view
│ │ │ ├── CharacterParser.java
│ │ │ ├── CitySortModel.java
│ │ │ ├── PinyinComparator.java
│ │ │ └── SideBar.java
│ └── res
│ │ ├── drawable-hdpi
│ │ └── ic_city_location.png
│ │ ├── drawable-xhdpi
│ │ └── ic_city_location.png
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ └── item_select_city.xml
│ │ ├── menu
│ │ └── menu_main.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── arrays.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── socks
│ └── selectcitymodule
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | /.idea
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SelectCityModule
2 | 选择省份或者是城市模块,可以直接拿来用
3 |
4 | 效果图
5 | 
6 |
7 | 本项目改造自[http://blog.csdn.net/xiaanming/article/details/12684155](http://blog.csdn.net/xiaanming/article/details/12684155)
8 |
9 | 修复了几个BUG和界面效果
10 |
--------------------------------------------------------------------------------
/SelectCityModule.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | generateDebugAndroidTestSources
19 | generateDebugSources
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 22
5 | buildToolsVersion "23.0.0"
6 |
7 | defaultConfig {
8 | applicationId "com.socks.selectcitymodule"
9 | minSdkVersion 9
10 | targetSdkVersion 22
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:22.2.1'
26 | compile 'com.android.support:design:22.2.1'
27 | }
28 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/zhaokaiqiang/Develop/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/socks/selectcitymodule/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.socks.selectcitymodule;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/socks/selectcitymodule/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.socks.selectcitymodule;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.support.v7.widget.Toolbar;
6 | import android.view.View;
7 | import android.widget.AdapterView;
8 | import android.widget.AdapterView.OnItemClickListener;
9 | import android.widget.ListView;
10 | import android.widget.TextView;
11 | import android.widget.Toast;
12 |
13 | import com.socks.selectcitymodule.view.CharacterParser;
14 | import com.socks.selectcitymodule.view.CitySortModel;
15 | import com.socks.selectcitymodule.view.PinyinComparator;
16 | import com.socks.selectcitymodule.view.SideBar;
17 |
18 | import java.util.ArrayList;
19 | import java.util.Collections;
20 | import java.util.List;
21 |
22 | public class MainActivity extends AppCompatActivity {
23 |
24 | private ListView sortListView;
25 | private SideBar sideBar;
26 | private TextView dialog;
27 | private SortAdapter adapter;
28 | private CharacterParser characterParser;
29 | private List SourceDateList;
30 |
31 | private Toolbar toolbar;
32 |
33 | @Override
34 | protected void onCreate(Bundle savedInstanceState) {
35 | super.onCreate(savedInstanceState);
36 | setContentView(R.layout.activity_main);
37 |
38 | toolbar = (Toolbar) findViewById(R.id.toolbar);
39 | setSupportActionBar(toolbar);
40 | toolbar.setTitle("选择城市");
41 |
42 | initViews();
43 | }
44 |
45 | private void initViews() {
46 | characterParser = CharacterParser.getInstance();
47 |
48 | sideBar = (SideBar) findViewById(R.id.sidrbar);
49 | dialog = (TextView) findViewById(R.id.dialog);
50 | sideBar.setTextView(dialog);
51 | sideBar.setOnTouchingLetterChangedListener(new SideBar.OnTouchingLetterChangedListener() {
52 |
53 | @Override
54 | public void onTouchingLetterChanged(String s) {
55 | int position = adapter.getPositionForSection(s.charAt(0));
56 | if (position != -1) {
57 | sortListView.setSelection(position + 1);
58 | }
59 |
60 | }
61 | });
62 |
63 | sortListView = (ListView) findViewById(R.id.country_lvcountry);
64 | sortListView.setOnItemClickListener(new OnItemClickListener() {
65 |
66 | @Override
67 | public void onItemClick(AdapterView> parent, View view,
68 | int position, long id) {
69 | Toast.makeText(getApplication(),
70 | ((CitySortModel) adapter.getItem(position - 1)).getName(),
71 | Toast.LENGTH_SHORT).show();
72 | }
73 | });
74 |
75 | SourceDateList = filledData(getResources().getStringArray(R.array.provinces));
76 | Collections.sort(SourceDateList, new PinyinComparator());
77 | adapter = new SortAdapter(this, SourceDateList);
78 | sortListView.addHeaderView(initHeadView());
79 | sortListView.setAdapter(adapter);
80 | }
81 |
82 |
83 | private View initHeadView() {
84 | View headView = getLayoutInflater().inflate(R.layout.item_select_city, null);
85 | TextView tv_catagory = (TextView) headView.findViewById(R.id.tv_catagory);
86 | TextView tv_city_name = (TextView) headView.findViewById(R.id.tv_city_name);
87 | tv_catagory.setText("自动定位");
88 | tv_city_name.setText("北京");
89 | tv_city_name.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.ic_city_location), null, null, null);
90 | tv_city_name.setCompoundDrawablePadding(24);
91 | return headView;
92 | }
93 |
94 | private List filledData(String[] date) {
95 | List mSortList = new ArrayList<>();
96 | ArrayList indexString = new ArrayList<>();
97 |
98 | for (int i = 0; i < date.length; i++) {
99 | CitySortModel sortModel = new CitySortModel();
100 | sortModel.setName(date[i]);
101 | String pinyin = characterParser.getSelling(date[i]);
102 | String sortString = pinyin.substring(0, 1).toUpperCase();
103 | if (sortString.matches("[A-Z]")) {
104 |
105 | //对重庆多音字做特殊处理
106 | if (pinyin.startsWith("zhongqing")) {
107 | sortString = "C";
108 | sortModel.setSortLetters("C");
109 | } else {
110 | sortModel.setSortLetters(sortString.toUpperCase());
111 | }
112 |
113 | if (!indexString.contains(sortString)) {
114 | indexString.add(sortString);
115 | }
116 | }
117 |
118 | mSortList.add(sortModel);
119 | }
120 | Collections.sort(indexString);
121 | sideBar.setIndexText(indexString);
122 | return mSortList;
123 |
124 | }
125 |
126 | }
127 |
--------------------------------------------------------------------------------
/app/src/main/java/com/socks/selectcitymodule/SortAdapter.java:
--------------------------------------------------------------------------------
1 | package com.socks.selectcitymodule;
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.SectionIndexer;
9 | import android.widget.TextView;
10 |
11 | import com.socks.selectcitymodule.view.CitySortModel;
12 |
13 | import java.util.List;
14 |
15 | public class SortAdapter extends BaseAdapter implements SectionIndexer {
16 | private List list = null;
17 | private Context mContext;
18 |
19 | public SortAdapter(Context mContext, List list) {
20 | this.mContext = mContext;
21 | this.list = list;
22 | }
23 |
24 | public int getCount() {
25 | return this.list.size();
26 | }
27 |
28 | public Object getItem(int position) {
29 | return list.get(position);
30 | }
31 |
32 | public long getItemId(int position) {
33 | return position;
34 | }
35 |
36 | public View getView(final int position, View view, ViewGroup arg2) {
37 | ViewHolder viewHolder = null;
38 | final CitySortModel mContent = list.get(position);
39 | if (view == null) {
40 | viewHolder = new ViewHolder();
41 | view = LayoutInflater.from(mContext).inflate(R.layout.item_select_city, null);
42 | viewHolder.tvTitle = (TextView) view.findViewById(R.id.tv_city_name);
43 | viewHolder.tvLetter = (TextView) view.findViewById(R.id.tv_catagory);
44 | view.setTag(viewHolder);
45 | } else {
46 | viewHolder = (ViewHolder) view.getTag();
47 | }
48 |
49 | int section = getSectionForPosition(position);
50 |
51 | if (position == getPositionForSection(section)) {
52 | viewHolder.tvLetter.setVisibility(View.VISIBLE);
53 | viewHolder.tvLetter.setText(mContent.getSortLetters());
54 | } else {
55 | viewHolder.tvLetter.setVisibility(View.GONE);
56 | }
57 |
58 | viewHolder.tvTitle.setText(this.list.get(position).getName());
59 |
60 | return view;
61 |
62 | }
63 |
64 |
65 | final static class ViewHolder {
66 | TextView tvLetter;
67 | TextView tvTitle;
68 | }
69 |
70 |
71 | public int getSectionForPosition(int position) {
72 | return list.get(position).getSortLetters().charAt(0);
73 | }
74 |
75 |
76 | public int getPositionForSection(int section) {
77 | for (int i = 0; i < getCount(); i++) {
78 | String sortStr = list.get(i).getSortLetters();
79 | char firstChar = sortStr.toUpperCase().charAt(0);
80 | if (firstChar == section) {
81 | return i;
82 | }
83 | }
84 |
85 | return -1;
86 | }
87 |
88 |
89 | @Override
90 | public Object[] getSections() {
91 | return null;
92 | }
93 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/socks/selectcitymodule/view/CharacterParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Filename CharacterParser.java
3 | * Company �Ϻ�����-�ֶ��ֹ�˾��
4 | * @author LuRuihui
5 | * @version 0.1
6 | */
7 | package com.socks.selectcitymodule.view;
8 |
9 | public class CharacterParser {
10 | private static int[] pyvalue = new int[]{-20319, -20317, -20304, -20295, -20292, -20283, -20265, -20257, -20242, -20230, -20051, -20036, -20032,
11 | -20026, -20002, -19990, -19986, -19982, -19976, -19805, -19784, -19775, -19774, -19763, -19756, -19751, -19746, -19741, -19739, -19728,
12 | -19725, -19715, -19540, -19531, -19525, -19515, -19500, -19484, -19479, -19467, -19289, -19288, -19281, -19275, -19270, -19263, -19261,
13 | -19249, -19243, -19242, -19238, -19235, -19227, -19224, -19218, -19212, -19038, -19023, -19018, -19006, -19003, -18996, -18977, -18961,
14 | -18952, -18783, -18774, -18773, -18763, -18756, -18741, -18735, -18731, -18722, -18710, -18697, -18696, -18526, -18518, -18501, -18490,
15 | -18478, -18463, -18448, -18447, -18446, -18239, -18237, -18231, -18220, -18211, -18201, -18184, -18183, -18181, -18012, -17997, -17988,
16 | -17970, -17964, -17961, -17950, -17947, -17931, -17928, -17922, -17759, -17752, -17733, -17730, -17721, -17703, -17701, -17697, -17692,
17 | -17683, -17676, -17496, -17487, -17482, -17468, -17454, -17433, -17427, -17417, -17202, -17185, -16983, -16970, -16942, -16915, -16733,
18 | -16708, -16706, -16689, -16664, -16657, -16647, -16474, -16470, -16465, -16459, -16452, -16448, -16433, -16429, -16427, -16423, -16419,
19 | -16412, -16407, -16403, -16401, -16393, -16220, -16216, -16212, -16205, -16202, -16187, -16180, -16171, -16169, -16158, -16155, -15959,
20 | -15958, -15944, -15933, -15920, -15915, -15903, -15889, -15878, -15707, -15701, -15681, -15667, -15661, -15659, -15652, -15640, -15631,
21 | -15625, -15454, -15448, -15436, -15435, -15419, -15416, -15408, -15394, -15385, -15377, -15375, -15369, -15363, -15362, -15183, -15180,
22 | -15165, -15158, -15153, -15150, -15149, -15144, -15143, -15141, -15140, -15139, -15128, -15121, -15119, -15117, -15110, -15109, -14941,
23 | -14937, -14933, -14930, -14929, -14928, -14926, -14922, -14921, -14914, -14908, -14902, -14894, -14889, -14882, -14873, -14871, -14857,
24 | -14678, -14674, -14670, -14668, -14663, -14654, -14645, -14630, -14594, -14429, -14407, -14399, -14384, -14379, -14368, -14355, -14353,
25 | -14345, -14170, -14159, -14151, -14149, -14145, -14140, -14137, -14135, -14125, -14123, -14122, -14112, -14109, -14099, -14097, -14094,
26 | -14092, -14090, -14087, -14083, -13917, -13914, -13910, -13907, -13906, -13905, -13896, -13894, -13878, -13870, -13859, -13847, -13831,
27 | -13658, -13611, -13601, -13406, -13404, -13400, -13398, -13395, -13391, -13387, -13383, -13367, -13359, -13356, -13343, -13340, -13329,
28 | -13326, -13318, -13147, -13138, -13120, -13107, -13096, -13095, -13091, -13076, -13068, -13063, -13060, -12888, -12875, -12871, -12860,
29 | -12858, -12852, -12849, -12838, -12831, -12829, -12812, -12802, -12607, -12597, -12594, -12585, -12556, -12359, -12346, -12320, -12300,
30 | -12120, -12099, -12089, -12074, -12067, -12058, -12039, -11867, -11861, -11847, -11831, -11798, -11781, -11604, -11589, -11536, -11358,
31 | -11340, -11339, -11324, -11303, -11097, -11077, -11067, -11055, -11052, -11045, -11041, -11038, -11024, -11020, -11019, -11018, -11014,
32 | -10838, -10832, -10815, -10800, -10790, -10780, -10764, -10587, -10544, -10533, -10519, -10331, -10329, -10328, -10322, -10315, -10309,
33 | -10307, -10296, -10281, -10274, -10270, -10262, -10260, -10256, -10254};
34 | public static String[] pystr = new String[]{"a", "ai", "an", "ang", "ao", "ba", "bai", "ban", "bang", "bao", "bei", "ben", "beng", "bi", "bian",
35 | "biao", "bie", "bin", "bing", "bo", "bu", "ca", "cai", "can", "cang", "cao", "ce", "ceng", "cha", "chai", "chan", "chang", "chao", "che",
36 | "chen", "cheng", "chi", "chong", "chou", "chu", "chuai", "chuan", "chuang", "chui", "chun", "chuo", "ci", "cong", "cou", "cu", "cuan",
37 | "cui", "cun", "cuo", "da", "dai", "dan", "dang", "dao", "de", "deng", "di", "dian", "diao", "die", "ding", "diu", "dong", "dou", "du",
38 | "duan", "dui", "dun", "duo", "e", "en", "er", "fa", "fan", "fang", "fei", "fen", "feng", "fo", "fou", "fu", "ga", "gai", "gan", "gang",
39 | "gao", "ge", "gei", "gen", "geng", "gong", "gou", "gu", "gua", "guai", "guan", "guang", "gui", "gun", "guo", "ha", "hai", "han", "hang",
40 | "hao", "he", "hei", "hen", "heng", "hong", "hou", "hu", "hua", "huai", "huan", "huang", "hui", "hun", "huo", "ji", "jia", "jian",
41 | "jiang", "jiao", "jie", "jin", "jing", "jiong", "jiu", "ju", "juan", "jue", "jun", "ka", "kai", "kan", "kang", "kao", "ke", "ken",
42 | "keng", "kong", "kou", "ku", "kua", "kuai", "kuan", "kuang", "kui", "kun", "kuo", "la", "lai", "lan", "lang", "lao", "le", "lei", "leng",
43 | "li", "lia", "lian", "liang", "liao", "lie", "lin", "ling", "liu", "long", "lou", "lu", "lv", "luan", "lue", "lun", "luo", "ma", "mai",
44 | "man", "mang", "mao", "me", "mei", "men", "meng", "mi", "mian", "miao", "mie", "min", "ming", "miu", "mo", "mou", "mu", "na", "nai",
45 | "nan", "nang", "nao", "ne", "nei", "nen", "neng", "ni", "nian", "niang", "niao", "nie", "nin", "ning", "niu", "nong", "nu", "nv", "nuan",
46 | "nue", "nuo", "o", "ou", "pa", "pai", "pan", "pang", "pao", "pei", "pen", "peng", "pi", "pian", "piao", "pie", "pin", "ping", "po", "pu",
47 | "qi", "qia", "qian", "qiang", "qiao", "qie", "qin", "qing", "qiong", "qiu", "qu", "quan", "que", "qun", "ran", "rang", "rao", "re",
48 | "ren", "reng", "ri", "rong", "rou", "ru", "ruan", "rui", "run", "ruo", "sa", "sai", "san", "sang", "sao", "se", "sen", "seng", "sha",
49 | "shai", "shan", "shang", "shao", "she", "shen", "sheng", "shi", "shou", "shu", "shua", "shuai", "shuan", "shuang", "shui", "shun",
50 | "shuo", "si", "song", "sou", "su", "suan", "sui", "sun", "suo", "ta", "tai", "tan", "tang", "tao", "te", "teng", "ti", "tian", "tiao",
51 | "tie", "ting", "tong", "tou", "tu", "tuan", "tui", "tun", "tuo", "wa", "wai", "wan", "wang", "wei", "wen", "weng", "wo", "wu", "xi",
52 | "xia", "xian", "xiang", "xiao", "xie", "xin", "xing", "xiong", "xiu", "xu", "xuan", "xue", "xun", "ya", "yan", "yang", "yao", "ye", "yi",
53 | "yin", "ying", "yo", "yong", "you", "yu", "yuan", "yue", "yun", "za", "zai", "zan", "zang", "zao", "ze", "zei", "zen", "zeng", "zha",
54 | "zhai", "zhan", "zhang", "zhao", "zhe", "zhen", "zheng", "zhi", "zhong", "zhou", "zhu", "zhua", "zhuai", "zhuan", "zhuang", "zhui",
55 | "zhun", "zhuo", "zi", "zong", "zou", "zu", "zuan", "zui", "zun", "zuo"};
56 | private StringBuilder buffer;
57 | private String resource;
58 | private static CharacterParser characterParser = new CharacterParser();
59 |
60 | public static CharacterParser getInstance() {
61 | return characterParser;
62 | }
63 |
64 | public String getResource() {
65 | return resource;
66 | }
67 |
68 | public void setResource(String resource) {
69 | this.resource = resource;
70 | }
71 |
72 | private int getChsAscii(String chs) {
73 | int asc = 0;
74 | try {
75 | byte[] bytes = chs.getBytes("gb2312");
76 | if (bytes == null || bytes.length > 2 || bytes.length <= 0) {
77 | throw new RuntimeException("illegal resource string");
78 | }
79 | if (bytes.length == 1) {
80 | asc = bytes[0];
81 | }
82 | if (bytes.length == 2) {
83 | int hightByte = 256 + bytes[0];
84 | int lowByte = 256 + bytes[1];
85 | asc = (256 * hightByte + lowByte) - 256 * 256;
86 | }
87 | } catch (Exception e) {
88 | System.out.println("ERROR:ChineseSpelling.class-getChsAscii(String chs)" + e);
89 | }
90 | return asc;
91 | }
92 |
93 | public String convert(String str) {
94 | String result = null;
95 | int ascii = getChsAscii(str);
96 | if (ascii > 0 && ascii < 160) {
97 | result = String.valueOf((char) ascii);
98 | } else {
99 | for (int i = (pyvalue.length - 1); i >= 0; i--) {
100 | if (pyvalue[i] <= ascii) {
101 | result = pystr[i];
102 | break;
103 | }
104 | }
105 | }
106 | return result;
107 | }
108 |
109 | public String getSelling(String chs) {
110 | String key, value;
111 | buffer = new StringBuilder();
112 | for (int i = 0; i < chs.length(); i++) {
113 | key = chs.substring(i, i + 1);
114 | if (key.getBytes().length >= 2) {
115 | value = (String) convert(key);
116 | if (value == null) {
117 | value = "unknown";
118 | }
119 | } else {
120 | value = key;
121 | }
122 | buffer.append(value);
123 | }
124 | return buffer.toString();
125 | }
126 |
127 | }
128 |
--------------------------------------------------------------------------------
/app/src/main/java/com/socks/selectcitymodule/view/CitySortModel.java:
--------------------------------------------------------------------------------
1 | package com.socks.selectcitymodule.view;
2 |
3 | public class CitySortModel {
4 |
5 | private String name;
6 | private String sortLetters;
7 |
8 | public String getName() {
9 | return name;
10 | }
11 |
12 | public void setName(String name) {
13 | this.name = name;
14 | }
15 |
16 | public String getSortLetters() {
17 | return sortLetters;
18 | }
19 |
20 | public void setSortLetters(String sortLetters) {
21 | this.sortLetters = sortLetters;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/socks/selectcitymodule/view/PinyinComparator.java:
--------------------------------------------------------------------------------
1 | package com.socks.selectcitymodule.view;
2 |
3 | import java.util.Comparator;
4 |
5 | public class PinyinComparator implements Comparator {
6 |
7 | public int compare(CitySortModel o1, CitySortModel o2) {
8 | if (o1.getSortLetters().equals("@")
9 | || o2.getSortLetters().equals("#")) {
10 | return -1;
11 | } else if (o1.getSortLetters().equals("#")
12 | || o2.getSortLetters().equals("@")) {
13 | return 1;
14 | } else {
15 | return o1.getSortLetters().compareTo(o2.getSortLetters());
16 | }
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/socks/selectcitymodule/view/SideBar.java:
--------------------------------------------------------------------------------
1 | package com.socks.selectcitymodule.view;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.Paint;
7 | import android.graphics.Typeface;
8 | import android.util.AttributeSet;
9 | import android.view.MotionEvent;
10 | import android.view.View;
11 | import android.widget.TextView;
12 |
13 | import java.util.ArrayList;
14 | import java.util.Arrays;
15 | import java.util.List;
16 |
17 | public class SideBar extends View {
18 |
19 | public static String[] INDEX_STRING = {"A", "B", "C", "D", "E", "F", "G", "H", "I",
20 | "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
21 | "W", "X", "Y", "Z"};
22 |
23 | private OnTouchingLetterChangedListener onTouchingLetterChangedListener;
24 | private List indexStrings;
25 | private int choose = -1;
26 | private Paint paint = new Paint();
27 | private TextView mTextDialog;
28 |
29 | public SideBar(Context context) {
30 | this(context, null);
31 | }
32 |
33 | public SideBar(Context context, AttributeSet attrs) {
34 | this(context, attrs, 0);
35 | }
36 |
37 | public SideBar(Context context, AttributeSet attrs, int defStyle) {
38 | super(context, attrs, defStyle);
39 | init();
40 | }
41 |
42 | private void init() {
43 | setBackgroundColor(Color.WHITE);
44 | indexStrings = Arrays.asList(INDEX_STRING);
45 | }
46 |
47 | protected void onDraw(Canvas canvas) {
48 | super.onDraw(canvas);
49 | int height = getHeight();
50 | int width = getWidth();
51 | int singleHeight = height / indexStrings.size();
52 |
53 | for (int i = 0; i < indexStrings.size(); i++) {
54 | paint.setColor(Color.parseColor("#00BFFF"));
55 | paint.setTypeface(Typeface.DEFAULT_BOLD);
56 | paint.setAntiAlias(true);
57 | paint.setTextSize(24);
58 | if (i == choose) {
59 | paint.setColor(Color.parseColor("#3399ff"));
60 | paint.setFakeBoldText(true);
61 | }
62 |
63 | float xPos = width / 2 - paint.measureText(indexStrings.get(i)) / 2;
64 | float yPos = singleHeight * i + singleHeight;
65 | canvas.drawText(indexStrings.get(i), xPos, yPos, paint);
66 | paint.reset();
67 | }
68 |
69 | }
70 |
71 | @Override
72 | public boolean dispatchTouchEvent(MotionEvent event) {
73 | final int action = event.getAction();
74 | final float y = event.getY();
75 | final int oldChoose = choose;
76 | final OnTouchingLetterChangedListener listener = onTouchingLetterChangedListener;
77 | final int c = (int) (y / getHeight() * indexStrings.size());
78 |
79 | switch (action) {
80 | case MotionEvent.ACTION_UP:
81 | setBackgroundColor(Color.WHITE);
82 | choose = -1;
83 | invalidate();
84 | if (mTextDialog != null) {
85 | mTextDialog.setVisibility(View.GONE);
86 | }
87 | break;
88 | default:
89 | if (oldChoose != c) {
90 | if (c >= 0 && c < indexStrings.size()) {
91 | if (listener != null) {
92 | listener.onTouchingLetterChanged(indexStrings.get(c));
93 | }
94 | if (mTextDialog != null) {
95 | mTextDialog.setText(indexStrings.get(c));
96 | mTextDialog.setVisibility(View.VISIBLE);
97 | }
98 |
99 | choose = c;
100 | invalidate();
101 | }
102 | }
103 |
104 | break;
105 | }
106 | return true;
107 | }
108 |
109 | public void setIndexText(ArrayList indexStrings) {
110 | this.indexStrings = indexStrings;
111 | invalidate();
112 | }
113 |
114 |
115 | public void setTextView(TextView mTextDialog) {
116 | this.mTextDialog = mTextDialog;
117 | }
118 |
119 | public void setOnTouchingLetterChangedListener(
120 | OnTouchingLetterChangedListener onTouchingLetterChangedListener) {
121 | this.onTouchingLetterChangedListener = onTouchingLetterChangedListener;
122 | }
123 |
124 | public interface OnTouchingLetterChangedListener {
125 | void onTouchingLetterChanged(String s);
126 | }
127 |
128 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_city_location.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZhaoKaiQiang/SelectCityModule/3481e71e2ba7121e9198cd4c48e56c15b82723ff/app/src/main/res/drawable-hdpi/ic_city_location.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_city_location.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZhaoKaiQiang/SelectCityModule/3481e71e2ba7121e9198cd4c48e56c15b82723ff/app/src/main/res/drawable-xhdpi/ic_city_location.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
17 |
18 |
25 |
26 |
38 |
39 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_select_city.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
19 |
20 |
29 |
30 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZhaoKaiQiang/SelectCityModule/3481e71e2ba7121e9198cd4c48e56c15b82723ff/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZhaoKaiQiang/SelectCityModule/3481e71e2ba7121e9198cd4c48e56c15b82723ff/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZhaoKaiQiang/SelectCityModule/3481e71e2ba7121e9198cd4c48e56c15b82723ff/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZhaoKaiQiang/SelectCityModule/3481e71e2ba7121e9198cd4c48e56c15b82723ff/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZhaoKaiQiang/SelectCityModule/3481e71e2ba7121e9198cd4c48e56c15b82723ff/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/arrays.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 | - 新疆
30 | - 西藏
31 | - 云南
32 | - 甘肃
33 | - 贵州
34 | - 广西
35 | - 海南
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | SelectCityModule
3 | Settings
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/test/java/com/socks/selectcitymodule/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.socks.selectcitymodule;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.3.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZhaoKaiQiang/SelectCityModule/3481e71e2ba7121e9198cd4c48e56c15b82723ff/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Sep 22 10:42:38 CST 2015
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-2.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
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 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
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 Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------