honghengqiang il y a 3 ans
Parent
commit
71315068dc
100 fichiers modifiés avec 2327 ajouts et 10 suppressions
  1. 1 0
      .idea/gradle.xml
  2. 3 0
      .idea/misc.xml
  3. 1 0
      app/proguard-rules.pro
  4. 12 0
      app/src/main/java/com/swago/app/SwagoApp.kt
  5. 3 1
      baseswago/build.gradle
  6. 18 0
      baseswago/src/main/java/com/swago/baseswago/model/UserInfoModel.java
  7. BIN
      baseswago/src/main/res/mipmap-xxhdpi/more_small.png
  8. BIN
      baseswago/src/main/res/mipmap-xxhdpi/state_error_empty.png
  9. 12 0
      baseswago/src/main/res/values-zh/strings.xml
  10. 12 0
      baseswago/src/main/res/values/strings.xml
  11. 1 1
      build.gradle
  12. 8 0
      home/src/main/java/com/swago/home/MineFragment.kt
  13. 151 8
      home/src/main/res/layout/fragment_mine.xml
  14. BIN
      home/src/main/res/mipmap-xxhdpi/customer.png
  15. BIN
      home/src/main/res/mipmap-xxhdpi/level.png
  16. BIN
      home/src/main/res/mipmap-xxhdpi/task.png
  17. BIN
      home/src/main/res/mipmap-xxhdpi/topup.png
  18. 1 0
      lib_country_picker/.gitignore
  19. 42 0
      lib_country_picker/build.gradle
  20. 0 0
      lib_country_picker/consumer-rules.pro
  21. 21 0
      lib_country_picker/proguard-rules.pro
  22. 24 0
      lib_country_picker/src/androidTest/java/com/swago/lib_country_picker/ExampleInstrumentedTest.kt
  23. 5 0
      lib_country_picker/src/main/AndroidManifest.xml
  24. 1538 0
      lib_country_picker/src/main/assets/code.json
  25. 104 0
      lib_country_picker/src/main/java/com/swago/lib_country_picker/Country.java
  26. 10 0
      lib_country_picker/src/main/java/com/swago/lib_country_picker/Language.java
  27. 14 0
      lib_country_picker/src/main/java/com/swago/lib_country_picker/LetterHolder.java
  28. 176 0
      lib_country_picker/src/main/java/com/swago/lib_country_picker/PyAdapter.java
  29. 11 0
      lib_country_picker/src/main/java/com/swago/lib_country_picker/PyEntity.java
  30. 159 0
      lib_country_picker/src/main/java/com/swago/lib_country_picker/SideBar.java
  31. BIN
      lib_country_picker/src/main/res/drawable/flag_ac.png
  32. BIN
      lib_country_picker/src/main/res/drawable/flag_ad.png
  33. BIN
      lib_country_picker/src/main/res/drawable/flag_ae.png
  34. BIN
      lib_country_picker/src/main/res/drawable/flag_af.png
  35. BIN
      lib_country_picker/src/main/res/drawable/flag_ag.png
  36. BIN
      lib_country_picker/src/main/res/drawable/flag_ai.png
  37. BIN
      lib_country_picker/src/main/res/drawable/flag_al.png
  38. BIN
      lib_country_picker/src/main/res/drawable/flag_am.png
  39. BIN
      lib_country_picker/src/main/res/drawable/flag_an.png
  40. BIN
      lib_country_picker/src/main/res/drawable/flag_ant.png
  41. BIN
      lib_country_picker/src/main/res/drawable/flag_ao.png
  42. BIN
      lib_country_picker/src/main/res/drawable/flag_aq.png
  43. BIN
      lib_country_picker/src/main/res/drawable/flag_ar.png
  44. BIN
      lib_country_picker/src/main/res/drawable/flag_as.png
  45. BIN
      lib_country_picker/src/main/res/drawable/flag_at.png
  46. BIN
      lib_country_picker/src/main/res/drawable/flag_au.png
  47. BIN
      lib_country_picker/src/main/res/drawable/flag_aw.png
  48. BIN
      lib_country_picker/src/main/res/drawable/flag_ax.png
  49. BIN
      lib_country_picker/src/main/res/drawable/flag_az.png
  50. BIN
      lib_country_picker/src/main/res/drawable/flag_ba.png
  51. BIN
      lib_country_picker/src/main/res/drawable/flag_bb.png
  52. BIN
      lib_country_picker/src/main/res/drawable/flag_bd.png
  53. BIN
      lib_country_picker/src/main/res/drawable/flag_be.png
  54. BIN
      lib_country_picker/src/main/res/drawable/flag_bf.png
  55. BIN
      lib_country_picker/src/main/res/drawable/flag_bg.png
  56. BIN
      lib_country_picker/src/main/res/drawable/flag_bh.png
  57. BIN
      lib_country_picker/src/main/res/drawable/flag_bi.png
  58. BIN
      lib_country_picker/src/main/res/drawable/flag_bj.png
  59. BIN
      lib_country_picker/src/main/res/drawable/flag_bl.png
  60. BIN
      lib_country_picker/src/main/res/drawable/flag_bm.png
  61. BIN
      lib_country_picker/src/main/res/drawable/flag_bn.png
  62. BIN
      lib_country_picker/src/main/res/drawable/flag_bo.png
  63. BIN
      lib_country_picker/src/main/res/drawable/flag_bq.png
  64. BIN
      lib_country_picker/src/main/res/drawable/flag_br.png
  65. BIN
      lib_country_picker/src/main/res/drawable/flag_bs.png
  66. BIN
      lib_country_picker/src/main/res/drawable/flag_bt.png
  67. BIN
      lib_country_picker/src/main/res/drawable/flag_bv.png
  68. BIN
      lib_country_picker/src/main/res/drawable/flag_bw.png
  69. BIN
      lib_country_picker/src/main/res/drawable/flag_by.png
  70. BIN
      lib_country_picker/src/main/res/drawable/flag_bz.png
  71. BIN
      lib_country_picker/src/main/res/drawable/flag_ca.png
  72. BIN
      lib_country_picker/src/main/res/drawable/flag_cc.png
  73. BIN
      lib_country_picker/src/main/res/drawable/flag_cd.png
  74. BIN
      lib_country_picker/src/main/res/drawable/flag_cf.png
  75. BIN
      lib_country_picker/src/main/res/drawable/flag_cg.png
  76. BIN
      lib_country_picker/src/main/res/drawable/flag_ch.png
  77. BIN
      lib_country_picker/src/main/res/drawable/flag_ci.png
  78. BIN
      lib_country_picker/src/main/res/drawable/flag_ck.png
  79. BIN
      lib_country_picker/src/main/res/drawable/flag_cl.png
  80. BIN
      lib_country_picker/src/main/res/drawable/flag_cm.png
  81. BIN
      lib_country_picker/src/main/res/drawable/flag_cn.png
  82. BIN
      lib_country_picker/src/main/res/drawable/flag_co.png
  83. BIN
      lib_country_picker/src/main/res/drawable/flag_cr.png
  84. BIN
      lib_country_picker/src/main/res/drawable/flag_cu.png
  85. BIN
      lib_country_picker/src/main/res/drawable/flag_cv.png
  86. BIN
      lib_country_picker/src/main/res/drawable/flag_cw.png
  87. BIN
      lib_country_picker/src/main/res/drawable/flag_cx.png
  88. BIN
      lib_country_picker/src/main/res/drawable/flag_cy.png
  89. BIN
      lib_country_picker/src/main/res/drawable/flag_cz.png
  90. BIN
      lib_country_picker/src/main/res/drawable/flag_de.png
  91. BIN
      lib_country_picker/src/main/res/drawable/flag_dj.png
  92. BIN
      lib_country_picker/src/main/res/drawable/flag_dk.png
  93. BIN
      lib_country_picker/src/main/res/drawable/flag_dm.png
  94. BIN
      lib_country_picker/src/main/res/drawable/flag_do.png
  95. BIN
      lib_country_picker/src/main/res/drawable/flag_dz.png
  96. BIN
      lib_country_picker/src/main/res/drawable/flag_ec.png
  97. BIN
      lib_country_picker/src/main/res/drawable/flag_ee.png
  98. BIN
      lib_country_picker/src/main/res/drawable/flag_eg.png
  99. BIN
      lib_country_picker/src/main/res/drawable/flag_eh.png
  100. BIN
      lib_country_picker/src/main/res/drawable/flag_er.png

+ 1 - 0
.idea/gradle.xml

@@ -13,6 +13,7 @@
             <option value="$PROJECT_DIR$/app" />
             <option value="$PROJECT_DIR$/app" />
             <option value="$PROJECT_DIR$/baseswago" />
             <option value="$PROJECT_DIR$/baseswago" />
             <option value="$PROJECT_DIR$/home" />
             <option value="$PROJECT_DIR$/home" />
+            <option value="$PROJECT_DIR$/lib_country_picker" />
             <option value="$PROJECT_DIR$/login" />
             <option value="$PROJECT_DIR$/login" />
             <option value="$PROJECT_DIR$/pay" />
             <option value="$PROJECT_DIR$/pay" />
             <option value="$PROJECT_DIR$/room" />
             <option value="$PROJECT_DIR$/room" />

+ 3 - 0
.idea/misc.xml

@@ -67,11 +67,14 @@
         <entry key="tuikit/src/main/res/layout/forward_fragment.xml" value="0.3776041666666667" />
         <entry key="tuikit/src/main/res/layout/forward_fragment.xml" value="0.3776041666666667" />
         <entry key="tuikit/src/main/res/layout/message_adapter_content_image.xml" value="0.303125" />
         <entry key="tuikit/src/main/res/layout/message_adapter_content_image.xml" value="0.303125" />
         <entry key="user/src/main/res/drawable/shape_f7f8fa_top20.xml" value="0.21458333333333332" />
         <entry key="user/src/main/res/drawable/shape_f7f8fa_top20.xml" value="0.21458333333333332" />
+        <entry key="user/src/main/res/layout/activity_country.xml" value="0.3625" />
         <entry key="user/src/main/res/layout/activity_setting.xml" value="0.36302083333333335" />
         <entry key="user/src/main/res/layout/activity_setting.xml" value="0.36302083333333335" />
         <entry key="user/src/main/res/layout/activity_user_edit.xml" value="0.3638968481375358" />
         <entry key="user/src/main/res/layout/activity_user_edit.xml" value="0.3638968481375358" />
         <entry key="user/src/main/res/layout/dialog_sex.xml" value="0.34057971014492755" />
         <entry key="user/src/main/res/layout/dialog_sex.xml" value="0.34057971014492755" />
         <entry key="user/src/main/res/layout/item_black.xml" value="0.34601449275362317" />
         <entry key="user/src/main/res/layout/item_black.xml" value="0.34601449275362317" />
+        <entry key="user/src/main/res/layout/item_country_large_padding.xml" value="0.3625" />
         <entry key="user/src/main/res/layout/item_follow_fan.xml" value="0.39166666666666666" />
         <entry key="user/src/main/res/layout/item_follow_fan.xml" value="0.39166666666666666" />
+        <entry key="user/src/main/res/layout/item_letter.xml" value="0.3625" />
         <entry key="user/src/main/res/layout/layout_list.xml" value="0.39166666666666666" />
         <entry key="user/src/main/res/layout/layout_list.xml" value="0.39166666666666666" />
       </map>
       </map>
     </option>
     </option>

+ 1 - 0
app/proguard-rules.pro

@@ -191,6 +191,7 @@
 -keep class com.swago.baseswago.model.**{*;}
 -keep class com.swago.baseswago.model.**{*;}
 -keep class com.swago.baseswago.util.**{*;}
 -keep class com.swago.baseswago.util.**{*;}
 -keep class com.swago.room.bean.**{*;}
 -keep class com.swago.room.bean.**{*;}
+-keep class com.swago.lib_country_picker.**{*;}
 
 
 -keep class com.tencent.imsdk.** { *; }
 -keep class com.tencent.imsdk.** { *; }
 
 

+ 12 - 0
app/src/main/java/com/swago/app/SwagoApp.kt

@@ -8,6 +8,8 @@ import com.swago.baseswago.util.ActivityManagerUtil
 import com.swago.baseswago.util.AppContext
 import com.swago.baseswago.util.AppContext
 import com.tencent.qcloud.tim.uikit.TUIKit
 import com.tencent.qcloud.tim.uikit.TUIKit
 import com.tencent.qcloud.tim.uikit.config.TUIKitConfigs
 import com.tencent.qcloud.tim.uikit.config.TUIKitConfigs
+import com.zy.multistatepage.MultiStateConfig
+import com.zy.multistatepage.MultiStatePage
 
 
 /**
 /**
  *@date 2021/7/17 10:05
  *@date 2021/7/17 10:05
@@ -25,6 +27,16 @@ class SwagoApp : Application() {
         ActivityManagerUtil.get().init(this)
         ActivityManagerUtil.get().init(this)
         ARouter.init(this)
         ARouter.init(this)
         TUIKit.init(this,AppContext.getContext().resources.getString(R.string.im_id).toInt(), TUIKitConfigs.getConfigs())
         TUIKit.init(this,AppContext.getContext().resources.getString(R.string.im_id).toInt(), TUIKitConfigs.getConfigs())
+
+        val config = MultiStateConfig.Builder()
+            .alphaDuration(300)
+            .errorIcon(R.mipmap.state_error_empty)
+            .emptyIcon(R.mipmap.state_error_empty)
+            .emptyMsg("There is nothing here")
+            .loadingMsg("loading...")
+            .errorMsg("Load data error")
+            .build()
+        MultiStatePage.config(config)
     }
     }
 
 
     override fun attachBaseContext(base: Context?) {
     override fun attachBaseContext(base: Context?) {

+ 3 - 1
baseswago/build.gradle

@@ -93,7 +93,7 @@ dependencies {
     //banner
     //banner
     api 'io.github.youth5201314:banner:2.2.1'
     api 'io.github.youth5201314:banner:2.2.1'
     implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
     implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
-    implementation 'com.github.Zhao-Yan-Yan:MultiStatePage:2.0.2'
+    api 'com.github.Zhao-Yan-Yan:MultiStatePage:2.0.2'
     api "de.hdodenhof:circleimageview:3.1.0"
     api "de.hdodenhof:circleimageview:3.1.0"
     api 'top.zibin:Luban:1.1.8'
     api 'top.zibin:Luban:1.1.8'
     api 'com.github.HuanTanSheng:EasyPhotos:3.1.3'
     api 'com.github.HuanTanSheng:EasyPhotos:3.1.3'
@@ -111,4 +111,6 @@ dependencies {
     api 'com.android.billingclient:billing:3.0.3'
     api 'com.android.billingclient:billing:3.0.3'
     //抓包
     //抓包
     debugImplementation "com.readystatesoftware.chuck:library:1.1.0"
     debugImplementation "com.readystatesoftware.chuck:library:1.1.0"
+    //国家选择
+    api project(path: ':lib_country_picker')
 }
 }

+ 18 - 0
baseswago/src/main/java/com/swago/baseswago/model/UserInfoModel.java

@@ -31,6 +31,8 @@ public class UserInfoModel {
     private String user_constellation;
     private String user_constellation;
     private String group_id;
     private String group_id;
     private String user_country;
     private String user_country;
+    private String user_coins;
+    private String user_diamonds;
 
 
     public String getUser_constellation() {
     public String getUser_constellation() {
         return user_constellation;
         return user_constellation;
@@ -135,4 +137,20 @@ public class UserInfoModel {
     public void setUser_country(String user_country) {
     public void setUser_country(String user_country) {
         this.user_country = user_country;
         this.user_country = user_country;
     }
     }
+
+    public String getUser_coins() {
+        return user_coins;
+    }
+
+    public void setUser_coins(String user_coins) {
+        this.user_coins = user_coins;
+    }
+
+    public String getUser_diamonds() {
+        return user_diamonds;
+    }
+
+    public void setUser_diamonds(String user_diamonds) {
+        this.user_diamonds = user_diamonds;
+    }
 }
 }

BIN
baseswago/src/main/res/mipmap-xxhdpi/more_small.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/state_error_empty.png


+ 12 - 0
baseswago/src/main/res/values-zh/strings.xml

@@ -22,4 +22,16 @@
     <string name="join_room">进入直播间</string>
     <string name="join_room">进入直播间</string>
     <string name="swago_offical_msg">Swago官方信息</string>
     <string name="swago_offical_msg">Swago官方信息</string>
     <string name="message">信息</string>
     <string name="message">信息</string>
+    <string name="coin">金币</string>
+    <string name="diamond">钻石</string>
+    <string name="my_level">我的等级</string>
+    <string name="top_up_center">充值中心</string>
+    <string name="task_center">任务中心</string>
+    <string name="contact_service">联系客服</string>
+    <string name="sex">性别</string>
+    <string name="age">年龄</string>
+    <string name="constellation">星座</string>
+    <string name="country">国家</string>
+    <string name="sign">个性签名</string>
+    <string name="selecte_country">选择国家</string>
 </resources>
 </resources>

+ 12 - 0
baseswago/src/main/res/values/strings.xml

@@ -27,4 +27,16 @@
     <string name="join_room">join room</string>
     <string name="join_room">join room</string>
     <string name="swago_offical_msg">Swago官方信息</string>
     <string name="swago_offical_msg">Swago官方信息</string>
     <string name="message">信息</string>
     <string name="message">信息</string>
+    <string name="coin">金币</string>
+    <string name="diamond">钻石</string>
+    <string name="my_level">我的等级</string>
+    <string name="top_up_center">充值中心</string>
+    <string name="task_center">任务中心</string>
+    <string name="contact_service">联系客服</string>
+    <string name="sex">性别</string>
+    <string name="age">年龄</string>
+    <string name="constellation">星座</string>
+    <string name="country">国家</string>
+    <string name="sign">个性签名</string>
+    <string name="selecte_country">选择国家</string>
 </resources>
 </resources>

+ 1 - 1
build.gradle

@@ -9,7 +9,7 @@ buildscript {
     }
     }
     dependencies {
     dependencies {
         classpath "com.android.tools.build:gradle:4.2.1"
         classpath "com.android.tools.build:gradle:4.2.1"
-        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
+        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0'
 
 
         // NOTE: Do not place your application dependencies here; they belong
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files
         // in the individual module build.gradle files

+ 8 - 0
home/src/main/java/com/swago/home/MineFragment.kt

@@ -4,6 +4,7 @@ import androidx.fragment.app.viewModels
 import com.alibaba.android.arouter.launcher.ARouter
 import com.alibaba.android.arouter.launcher.ARouter
 import com.bumptech.glide.Glide
 import com.bumptech.glide.Glide
 import com.google.gson.Gson
 import com.google.gson.Gson
+import com.swago.baseswago.R
 import com.swago.baseswago.UserVm
 import com.swago.baseswago.UserVm
 import com.swago.baseswago.constant.ARouteConstant
 import com.swago.baseswago.constant.ARouteConstant
 import com.swago.baseswago.fragment.BaseXFragment
 import com.swago.baseswago.fragment.BaseXFragment
@@ -66,6 +67,13 @@ class MineFragment : BaseXFragment<FragmentMineBinding>() {
             binding.tvFansNum.text = it.user_fans_num
             binding.tvFansNum.text = it.user_fans_num
             binding.tvFollowNum.text = it.user_follow_num
             binding.tvFollowNum.text = it.user_follow_num
             binding.tvSign.text = it.user_signature
             binding.tvSign.text = it.user_signature
+            binding.tvCoin.text = it.user_coins
+            binding.tvDiamonds.text = it.user_diamonds
+            if (it.user_sex == 1){
+                binding.ivSex.setImageResource(R.mipmap.info_female)
+            }else if (it.user_sex == 0){
+                binding.ivSex.setImageResource(R.mipmap.info_male)
+            }
         })
         })
     }
     }
 
 

+ 151 - 8
home/src/main/res/layout/fragment_mine.xml

@@ -8,10 +8,11 @@
     <ImageView
     <ImageView
         android:id="@+id/ivBg"
         android:id="@+id/ivBg"
         android:src="@mipmap/female_bg"
         android:src="@mipmap/female_bg"
+        app:layout_constraintDimensionRatio="h,360:248"
         android:background="@drawable/shape_9ffd88_6ef2df"
         android:background="@drawable/shape_9ffd88_6ef2df"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         android:layout_width="match_parent"
         android:layout_width="match_parent"
-        android:layout_height="248dp"/>
+        android:layout_height="0dp"/>
 
 
     <ImageView
     <ImageView
         android:id="@+id/ivSetup"
         android:id="@+id/ivSetup"
@@ -45,6 +46,13 @@
         android:layout_width="50dp"
         android:layout_width="50dp"
         android:layout_height="50dp"/>
         android:layout_height="50dp"/>
 
 
+    <ImageView
+        android:id="@+id/ivSex"
+        app:layout_constraintEnd_toEndOf="@+id/ivAvatar"
+        app:layout_constraintBottom_toBottomOf="@+id/ivAvatar"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"/>
+
     <TextView
     <TextView
         android:id="@+id/tvName"
         android:id="@+id/tvName"
         android:maxLines="1"
         android:maxLines="1"
@@ -84,13 +92,19 @@
         android:layout_height="wrap_content"/>
         android:layout_height="wrap_content"/>
 
 
 
 
+
+
+
     <LinearLayout
     <LinearLayout
         android:id="@+id/llFollow"
         android:id="@+id/llFollow"
+
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toStartOf="@+id/llFans"
         app:layout_constraintBottom_toBottomOf="@+id/ivBg"
         app:layout_constraintBottom_toBottomOf="@+id/ivBg"
-        android:layout_marginStart="20dp"
         android:layout_marginBottom="40dp"
         android:layout_marginBottom="40dp"
-        android:orientation="horizontal"
+        android:orientation="vertical"
+        android:gravity="center"
+        app:layout_constraintHorizontal_chainStyle="spread"
         android:layout_width="wrap_content"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content">
         android:layout_height="wrap_content">
 
 
@@ -105,7 +119,6 @@
         <TextView
         <TextView
             android:textColor="#868686"
             android:textColor="#868686"
             android:textSize="12dp"
             android:textSize="12dp"
-            android:layout_marginStart="5dp"
             android:text="@string/follow"
             android:text="@string/follow"
             android:layout_width="wrap_content"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"/>
             android:layout_height="wrap_content"/>
@@ -115,11 +128,12 @@
 
 
     <LinearLayout
     <LinearLayout
         android:id="@+id/llFans"
         android:id="@+id/llFans"
-        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintStart_toEndOf="@+id/llFollow"
+        app:layout_constraintEnd_toStartOf="@+id/llCoin"
         app:layout_constraintBottom_toBottomOf="@+id/ivBg"
         app:layout_constraintBottom_toBottomOf="@+id/ivBg"
-        android:layout_marginStart="120dp"
         android:layout_marginBottom="40dp"
         android:layout_marginBottom="40dp"
-        android:orientation="horizontal"
+        android:gravity="center"
+        android:orientation="vertical"
         android:layout_width="wrap_content"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content">
         android:layout_height="wrap_content">
 
 
@@ -134,11 +148,140 @@
         <TextView
         <TextView
             android:textColor="#868686"
             android:textColor="#868686"
             android:textSize="12dp"
             android:textSize="12dp"
-            android:layout_marginStart="5dp"
             android:text="@string/fans"
             android:text="@string/fans"
             android:layout_width="wrap_content"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"/>
             android:layout_height="wrap_content"/>
 
 
     </LinearLayout>
     </LinearLayout>
 
 
+
+    <LinearLayout
+        android:id="@+id/llCoin"
+        app:layout_constraintStart_toEndOf="@+id/llFans"
+        app:layout_constraintEnd_toStartOf="@+id/llDiamonds"
+        app:layout_constraintBottom_toBottomOf="@+id/ivBg"
+        android:layout_marginBottom="40dp"
+        android:gravity="center"
+        android:orientation="vertical"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content">
+
+        <TextView
+            android:id="@+id/tvCoin"
+            android:textSize="24dp"
+            android:textColor="#000"
+            tools:text="24"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+
+        <TextView
+            android:textColor="#868686"
+            android:textSize="12dp"
+            android:text="@string/coin"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+
+    </LinearLayout>
+
+
+    <LinearLayout
+        android:id="@+id/llDiamonds"
+        app:layout_constraintStart_toEndOf="@+id/llCoin"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintBottom_toBottomOf="@+id/ivBg"
+        android:layout_marginBottom="40dp"
+        android:gravity="center"
+        android:orientation="vertical"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content">
+
+        <TextView
+            android:id="@+id/tvDiamonds"
+            android:textSize="24dp"
+            android:textColor="#000"
+            tools:text="24"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+
+        <TextView
+            android:textColor="#868686"
+            android:textSize="12dp"
+            android:text="@string/diamond"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+
+    </LinearLayout>
+
+
+
+    <LinearLayout
+        android:background="@drawable/shape_white_top_20"
+        app:layout_constraintTop_toBottomOf="@+id/llFollow"
+        app:layout_constraintBottom_toBottomOf="parent"
+        android:orientation="vertical"
+        android:layout_marginTop="20dp"
+        android:layout_width="match_parent"
+        android:layout_height="0dp">
+
+        <TextView
+            android:id="@+id/tvLevel"
+            android:layout_marginTop="20dp"
+            android:drawablePadding="5dp"
+            android:paddingStart="20dp"
+            android:paddingEnd="20dp"
+            android:textColor="#000"
+            android:textSize="16dp"
+            android:gravity="center_vertical"
+            android:text="@string/my_level"
+            android:layout_width="match_parent"
+            android:layout_height="50dp"
+            app:drawableStartCompat="@mipmap/level"
+            app:drawableEndCompat="@mipmap/more_small" />
+
+        <TextView
+            android:id="@+id/tvTopUp"
+            android:drawablePadding="5dp"
+            android:paddingStart="20dp"
+            android:paddingEnd="20dp"
+            android:textColor="#000"
+            android:textSize="16dp"
+            android:gravity="center_vertical"
+            android:text="@string/top_up_center"
+            android:layout_width="match_parent"
+            android:layout_height="50dp"
+            app:drawableStartCompat="@mipmap/level"
+            app:drawableEndCompat="@mipmap/more_small" />
+
+        <TextView
+            android:id="@+id/tvTask"
+            android:drawablePadding="5dp"
+            android:paddingStart="20dp"
+            android:paddingEnd="20dp"
+            android:textColor="#000"
+            android:textSize="16dp"
+            android:gravity="center_vertical"
+            android:text="@string/task_center"
+            android:layout_width="match_parent"
+            android:layout_height="50dp"
+            app:drawableStartCompat="@mipmap/level"
+            app:drawableEndCompat="@mipmap/more_small" />
+
+        <TextView
+            android:id="@+id/tvCustomer"
+            android:drawablePadding="5dp"
+            android:paddingStart="20dp"
+            android:paddingEnd="20dp"
+            android:textColor="#000"
+            android:textSize="16dp"
+            android:gravity="center_vertical"
+            android:text="@string/contact_service"
+            android:layout_width="match_parent"
+            android:layout_height="50dp"
+            app:drawableStartCompat="@mipmap/level"
+            app:drawableEndCompat="@mipmap/more_small" />
+
+
+    </LinearLayout>
+
+
 </androidx.constraintlayout.widget.ConstraintLayout>
 </androidx.constraintlayout.widget.ConstraintLayout>

BIN
home/src/main/res/mipmap-xxhdpi/customer.png


BIN
home/src/main/res/mipmap-xxhdpi/level.png


BIN
home/src/main/res/mipmap-xxhdpi/task.png


BIN
home/src/main/res/mipmap-xxhdpi/topup.png


+ 1 - 0
lib_country_picker/.gitignore

@@ -0,0 +1 @@
+/build

+ 42 - 0
lib_country_picker/build.gradle

@@ -0,0 +1,42 @@
+plugins {
+    id 'com.android.library'
+    id 'kotlin-android'
+}
+
+android {
+    compileSdkVersion 30
+
+    defaultConfig {
+        minSdkVersion 21
+        targetSdkVersion 30
+        versionCode 1
+        versionName "1.0"
+
+        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+        consumerProguardFiles "consumer-rules.pro"
+    }
+
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+        }
+    }
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_8
+        targetCompatibility JavaVersion.VERSION_1_8
+    }
+    kotlinOptions {
+        jvmTarget = '1.8'
+    }
+}
+
+dependencies {
+
+    implementation 'androidx.core:core-ktx:1.3.2'
+    implementation 'androidx.appcompat:appcompat:1.2.0'
+    implementation 'com.google.android.material:material:1.3.0'
+    testImplementation 'junit:junit:4.+'
+    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+}

+ 0 - 0
lib_country_picker/consumer-rules.pro


+ 21 - 0
lib_country_picker/proguard-rules.pro

@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile

+ 24 - 0
lib_country_picker/src/androidTest/java/com/swago/lib_country_picker/ExampleInstrumentedTest.kt

@@ -0,0 +1,24 @@
+package com.swago.lib_country_picker
+
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.ext.junit.runners.AndroidJUnit4
+
+import org.junit.Test
+import org.junit.runner.RunWith
+
+import org.junit.Assert.*
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+    @Test
+    fun useAppContext() {
+        // Context of the app under test.
+        val appContext = InstrumentationRegistry.getInstrumentation().targetContext
+        assertEquals("com.swago.lib_country_picker.test", appContext.packageName)
+    }
+}

+ 5 - 0
lib_country_picker/src/main/AndroidManifest.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.swago.lib_country_picker">
+
+</manifest>

+ 1538 - 0
lib_country_picker/src/main/assets/code.json

@@ -0,0 +1,1538 @@
+[
+  {
+    "sc": "中国",
+    "code": 86,
+    "pinyin": "ZHONGGUO",
+    "en": "China",
+    "locale": "CN",
+    "tc": "中國"
+  },
+  {
+    "sc": "安哥拉",
+    "code": 244,
+    "pinyin": "ANGELA",
+    "en": "Angola",
+    "locale": "AO",
+    "tc": "安哥拉"
+  },
+  {
+    "sc": "阿富汗",
+    "code": 93,
+    "pinyin": "AFUHAN",
+    "en": "Afghanistan",
+    "locale": "AF",
+    "tc": "阿富汗"
+  },
+  {
+    "sc": "阿尔巴尼亚",
+    "code": 355,
+    "pinyin": "AERBANIYA",
+    "en": "Albania",
+    "locale": "AL",
+    "tc": "阿爾巴尼亞"
+  },
+  {
+    "sc": "阿尔及利亚",
+    "code": 213,
+    "pinyin": "AERJILIYA",
+    "en": "Algeria",
+    "locale": "DZ",
+    "tc": "阿爾及利亞"
+  },
+  {
+    "sc": "安道尔共和国",
+    "code": 376,
+    "pinyin": "ANDAOERGONGHEGUO",
+    "en": "Andorra",
+    "locale": "AD",
+    "tc": "安道爾共和國"
+  },
+  {
+    "sc": "安圭拉岛",
+    "code": 1264,
+    "pinyin": "ANGUILADAO",
+    "en": "Anguilla",
+    "locale": "AI",
+    "tc": "安圭拉島"
+  },
+  {
+    "sc": "安提瓜和巴布达",
+    "code": 1268,
+    "pinyin": "ANTIGUAHEBABUDA",
+    "en": "Antigua and Barbuda",
+    "locale": "AG",
+    "tc": "安提瓜和巴布達"
+  },
+  {
+    "sc": "阿根廷",
+    "code": 54,
+    "pinyin": "AGENTING",
+    "en": "Argentina",
+    "locale": "AR",
+    "tc": "阿根廷"
+  },
+  {
+    "sc": "亚美尼亚",
+    "code": 374,
+    "pinyin": "YAMEINIYA",
+    "en": "Armenia",
+    "locale": "AM",
+    "tc": "亞美尼亞"
+  },
+  {
+    "sc": "阿森松",
+    "code": 247,
+    "pinyin": "ASENSONG",
+    "en": "Ascension",
+    "locale": "AC",
+    "tc": "阿森松"
+  },
+  {
+    "sc": "澳大利亚",
+    "code": 61,
+    "pinyin": "AODALIYA",
+    "en": "Australia",
+    "locale": "AU",
+    "tc": "澳大利亞"
+  },
+  {
+    "sc": "奥地利",
+    "code": 43,
+    "pinyin": "AODILI",
+    "en": "Austria",
+    "locale": "AT",
+    "tc": "奧地利"
+  },
+  {
+    "sc": "阿塞拜疆",
+    "code": 994,
+    "pinyin": "ASAIBAIJIANG",
+    "en": "Azerbaijan",
+    "locale": "AZ",
+    "tc": "阿塞拜疆"
+  },
+  {
+    "sc": "巴哈马",
+    "code": 1242,
+    "pinyin": "BAHAMA",
+    "en": "Bahamas",
+    "locale": "BS",
+    "tc": "巴哈馬"
+  },
+  {
+    "sc": "巴林",
+    "code": 973,
+    "pinyin": "BALIN",
+    "en": "Bahrain",
+    "locale": "BH",
+    "tc": "巴林"
+  },
+  {
+    "sc": "孟加拉国",
+    "code": 880,
+    "pinyin": "MENGJIALAGUO",
+    "en": "Bangladesh",
+    "locale": "BD",
+    "tc": "孟加拉國"
+  },
+  {
+    "sc": "巴巴多斯",
+    "code": 1246,
+    "pinyin": "BABADUOSI",
+    "en": "Barbados",
+    "locale": "BB",
+    "tc": "巴巴多斯"
+  },
+  {
+    "sc": "白俄罗斯",
+    "code": 375,
+    "pinyin": "BAIELUOSI",
+    "en": "Belarus",
+    "locale": "BY",
+    "tc": "白俄羅斯"
+  },
+  {
+    "sc": "比利时",
+    "code": 32,
+    "pinyin": "BILISHI",
+    "en": "Belgium",
+    "locale": "BE",
+    "tc": "比利時"
+  },
+  {
+    "sc": "伯利兹",
+    "code": 501,
+    "pinyin": "BOLIZI",
+    "en": "Belize",
+    "locale": "BZ",
+    "tc": "伯利茲"
+  },
+  {
+    "sc": "贝宁",
+    "code": 229,
+    "pinyin": "BEINING",
+    "en": "Benin",
+    "locale": "BJ",
+    "tc": "貝寧"
+  },
+  {
+    "sc": "百慕大群岛",
+    "code": 1441,
+    "pinyin": "BAIMUDAQUNDAO",
+    "en": "Bermuda Is.",
+    "locale": "BM",
+    "tc": "百慕達群島"
+  },
+  {
+    "sc": "玻利维亚",
+    "code": 591,
+    "pinyin": "BOLIWEIYA",
+    "en": "Bolivia",
+    "locale": "BO",
+    "tc": "玻利維亞"
+  },
+  {
+    "sc": "博茨瓦纳",
+    "code": 267,
+    "pinyin": "BOCIWANA",
+    "en": "Botswana",
+    "locale": "BW",
+    "tc": "博茨瓦納"
+  },
+  {
+    "sc": "巴西",
+    "code": 55,
+    "pinyin": "BAXI",
+    "en": "Brazil",
+    "locale": "BR",
+    "tc": "巴西"
+  },
+  {
+    "sc": "文莱",
+    "code": 673,
+    "pinyin": "WENLAI",
+    "en": "Brunei",
+    "locale": "BN",
+    "tc": "文萊"
+  },
+  {
+    "sc": "保加利亚",
+    "code": 359,
+    "pinyin": "BAOJIALIYA",
+    "en": "Bulgaria",
+    "locale": "BG",
+    "tc": "保加利亞"
+  },
+  {
+    "sc": "布基纳法索",
+    "code": 226,
+    "pinyin": "BUJINAFASUO",
+    "en": "Burkina-faso",
+    "locale": "BF",
+    "tc": "布基納法索"
+  },
+  {
+    "sc": "缅甸",
+    "code": 95,
+    "pinyin": "MIANDIAN",
+    "en": "Burma",
+    "locale": "MM",
+    "tc": "緬甸"
+  },
+  {
+    "sc": "布隆迪",
+    "code": 257,
+    "pinyin": "BULONGDI",
+    "en": "Burundi",
+    "locale": "BI",
+    "tc": "布隆迪"
+  },
+  {
+    "sc": "喀麦隆",
+    "code": 237,
+    "pinyin": "KAMAILONG",
+    "en": "Cameroon",
+    "locale": "CM",
+    "tc": "喀麥隆"
+  },
+  {
+    "sc": "加拿大",
+    "code": 1,
+    "pinyin": "JIANADA",
+    "en": "Canada",
+    "locale": "CA",
+    "tc": "加拿大"
+  },
+  {
+    "sc": "开曼群岛",
+    "code": 1345,
+    "pinyin": "KAIMANQUNDAO",
+    "en": "Cayman Is.",
+    "locale": "KY",
+    "tc": "開曼群島"
+  },
+  {
+    "sc": "中非共和国",
+    "code": 236,
+    "pinyin": "ZHONGFEIGONGHEGUO",
+    "en": "Central African Republic",
+    "locale": "CF",
+    "tc": "中非共和國"
+  },
+  {
+    "sc": "乍得",
+    "code": 235,
+    "pinyin": "ZHADE",
+    "en": "Chad",
+    "locale": "TD",
+    "tc": "乍得"
+  },
+  {
+    "sc": "智利",
+    "code": 56,
+    "pinyin": "ZHILI",
+    "en": "Chile",
+    "locale": "CL",
+    "tc": "智利"
+  },
+  {
+    "sc": "哥伦比亚",
+    "code": 57,
+    "pinyin": "GELUNBIYA",
+    "en": "Colombia",
+    "locale": "CO",
+    "tc": "哥倫比亞"
+  },
+  {
+    "sc": "刚果",
+    "code": 242,
+    "pinyin": "GANGGUO",
+    "en": "Congo",
+    "locale": "CG",
+    "tc": "剛果"
+  },
+  {
+    "sc": "库克群岛",
+    "code": 682,
+    "pinyin": "KUKEQUNDAO",
+    "en": "Cook Is.",
+    "locale": "CK",
+    "tc": "庫克群島"
+  },
+  {
+    "sc": "哥斯达黎加",
+    "code": 506,
+    "pinyin": "GESIDALIJIA",
+    "en": "Costa Rica",
+    "locale": "CR",
+    "tc": "哥斯達黎加"
+  },
+  {
+    "sc": "古巴",
+    "code": 53,
+    "pinyin": "GUBA",
+    "en": "Cuba",
+    "locale": "CU",
+    "tc": "古巴"
+  },
+  {
+    "sc": "塞浦路斯",
+    "code": 357,
+    "pinyin": "SAIPULUSI",
+    "en": "Cyprus",
+    "locale": "CY",
+    "tc": "塞浦路斯"
+  },
+  {
+    "sc": "捷克",
+    "code": 420,
+    "pinyin": "JIEKE",
+    "en": "Czech Republic",
+    "locale": "CZ",
+    "tc": "捷克"
+  },
+  {
+    "sc": "丹麦",
+    "code": 45,
+    "pinyin": "DANMAI",
+    "en": "Denmark",
+    "locale": "DK",
+    "tc": "丹麥"
+  },
+  {
+    "sc": "吉布提",
+    "code": 253,
+    "pinyin": "JIBUTI",
+    "en": "Djibouti",
+    "locale": "DJ",
+    "tc": "吉布堤"
+  },
+  {
+    "sc": "多米尼加共和国",
+    "code": 1890,
+    "pinyin": "DUOMINIJIAGONGHEGUO",
+    "en": "Dominica Rep.",
+    "locale": "DO",
+    "tc": "多明尼加共和國共和國"
+  },
+  {
+    "sc": "厄瓜多尔",
+    "code": 593,
+    "pinyin": "EGUADUOER",
+    "en": "Ecuador",
+    "locale": "EC",
+    "tc": "厄瓜多爾"
+  },
+  {
+    "sc": "埃及",
+    "code": 20,
+    "pinyin": "AIJI",
+    "en": "Egypt",
+    "locale": "EG",
+    "tc": "埃及"
+  },
+  {
+    "sc": "萨尔瓦多",
+    "code": 503,
+    "pinyin": "SAERWADUO",
+    "en": "EI Salvador",
+    "locale": "SV",
+    "tc": "薩爾瓦多"
+  },
+  {
+    "sc": "爱沙尼亚",
+    "code": 372,
+    "pinyin": "AISHANIYA",
+    "en": "Estonia",
+    "locale": "EE",
+    "tc": "愛沙尼亞"
+  },
+  {
+    "sc": "埃塞俄比亚",
+    "code": 251,
+    "pinyin": "AISAIEBIYA",
+    "en": "Ethiopia",
+    "locale": "ET",
+    "tc": "埃塞俄比亞"
+  },
+  {
+    "sc": "斐济",
+    "code": 679,
+    "pinyin": "FEIJI",
+    "en": "Fiji",
+    "locale": "FJ",
+    "tc": "斐濟"
+  },
+  {
+    "sc": "芬兰",
+    "code": 358,
+    "pinyin": "FENLAN",
+    "en": "Finland",
+    "locale": "FI",
+    "tc": "芬蘭"
+  },
+  {
+    "sc": "法国",
+    "code": 33,
+    "pinyin": "FAGUO",
+    "en": "France",
+    "locale": "FR",
+    "tc": "法國"
+  },
+  {
+    "sc": "法属圭亚那",
+    "code": 594,
+    "pinyin": "FASHUGUIYANEI",
+    "en": "French Guiana",
+    "locale": "GF",
+    "tc": "法屬圭亞那"
+  },
+  {
+    "sc": "加蓬",
+    "code": 241,
+    "pinyin": "JIAPENG",
+    "en": "Gabon",
+    "locale": "GA",
+    "tc": "加蓬"
+  },
+  {
+    "sc": "冈比亚",
+    "code": 220,
+    "pinyin": "GANGBIYA",
+    "en": "Gambia",
+    "locale": "GM",
+    "tc": "岡比亞"
+  },
+  {
+    "sc": "格鲁吉亚",
+    "code": 995,
+    "pinyin": "GELUJIYA",
+    "en": "Georgia",
+    "locale": "GE",
+    "tc": "格魯吉亞"
+  },
+  {
+    "sc": "德国",
+    "code": 49,
+    "pinyin": "DEGUO",
+    "en": "Germany",
+    "locale": "DE",
+    "tc": "德國"
+  },
+  {
+    "sc": "加纳",
+    "code": 233,
+    "pinyin": "JIANA",
+    "en": "Ghana",
+    "locale": "GH",
+    "tc": "加納"
+  },
+  {
+    "sc": "直布罗陀",
+    "code": 350,
+    "pinyin": "ZHIBULUOTUO",
+    "en": "Gibraltar",
+    "locale": "GI",
+    "tc": "直布羅陀"
+  },
+  {
+    "sc": "希腊",
+    "code": 30,
+    "pinyin": "XILA",
+    "en": "Greece",
+    "locale": "GR",
+    "tc": "希臘"
+  },
+  {
+    "sc": "格林纳达",
+    "code": 1809,
+    "pinyin": "GELINNADA",
+    "en": "Grenada",
+    "locale": "GD",
+    "tc": "格林納達"
+  },
+  {
+    "sc": "关岛",
+    "code": 1671,
+    "pinyin": "GUANDAO",
+    "en": "Guam",
+    "locale": "GU",
+    "tc": "關島"
+  },
+  {
+    "sc": "危地马拉",
+    "code": 502,
+    "pinyin": "WEIDIMALA",
+    "en": "Guatemala",
+    "locale": "GT",
+    "tc": "危地馬拉"
+  },
+  {
+    "sc": "几内亚",
+    "code": 224,
+    "pinyin": "JINEIYA",
+    "en": "Guinea",
+    "locale": "GN",
+    "tc": "幾內亞"
+  },
+  {
+    "sc": "圭亚那",
+    "code": 592,
+    "pinyin": "GUIYANEI",
+    "en": "Guyana",
+    "locale": "GY",
+    "tc": "圭亞那"
+  },
+  {
+    "sc": "海地",
+    "code": 509,
+    "pinyin": "HAIDI",
+    "en": "Haiti",
+    "locale": "HT",
+    "tc": "海地"
+  },
+  {
+    "sc": "洪都拉斯",
+    "code": 504,
+    "pinyin": "HONGDOULASI",
+    "en": "Honduras",
+    "locale": "HN",
+    "tc": "洪都拉斯"
+  },
+  {
+    "sc": "中国香港",
+    "code": 852,
+    "pinyin": "ZHONGGUOXIANGGANG",
+    "en": "Hongkong",
+    "locale": "HK",
+    "tc": "中國香港"
+  },
+  {
+    "sc": "匈牙利",
+    "code": 36,
+    "pinyin": "XIONGYALI",
+    "en": "Hungary",
+    "locale": "HU",
+    "tc": "匈牙利"
+  },
+  {
+    "sc": "冰岛",
+    "code": 354,
+    "pinyin": "BINGDAO",
+    "en": "Iceland",
+    "locale": "IS",
+    "tc": "冰島"
+  },
+  {
+    "sc": "印度",
+    "code": 91,
+    "pinyin": "YINDU",
+    "en": "India",
+    "locale": "IN",
+    "tc": "印度"
+  },
+  {
+    "sc": "印度尼西亚",
+    "code": 62,
+    "pinyin": "YINDUNIXIYA",
+    "en": "Indonesia",
+    "locale": "ID",
+    "tc": "印度尼西亞"
+  },
+  {
+    "sc": "伊朗",
+    "code": 98,
+    "pinyin": "YILANG",
+    "en": "Iran",
+    "locale": "IR",
+    "tc": "伊朗"
+  },
+  {
+    "sc": "伊拉克",
+    "code": 964,
+    "pinyin": "YILAKE",
+    "en": "Iraq",
+    "locale": "IQ",
+    "tc": "伊拉克"
+  },
+  {
+    "sc": "爱尔兰",
+    "code": 353,
+    "pinyin": "AIERLAN",
+    "en": "Ireland",
+    "locale": "IE",
+    "tc": "愛爾蘭"
+  },
+  {
+    "sc": "以色列",
+    "code": 972,
+    "pinyin": "YISELIE",
+    "en": "Israel",
+    "locale": "IL",
+    "tc": "以色列"
+  },
+  {
+    "sc": "意大利",
+    "code": 39,
+    "pinyin": "YIDALI",
+    "en": "Italy",
+    "locale": "IT",
+    "tc": "意大利"
+  },
+  {
+    "sc": "科特迪瓦",
+    "code": 225,
+    "pinyin": "KETEDIWA",
+    "en": "Ivory Coast",
+    "locale": "CI",
+    "tc": "科特迪瓦"
+  },
+  {
+    "sc": "牙买加",
+    "code": 1876,
+    "pinyin": "YAMAIJIA",
+    "en": "Jamaica",
+    "locale": "JM",
+    "tc": "牙買加"
+  },
+  {
+    "sc": "日本",
+    "code": 81,
+    "pinyin": "RIBEN",
+    "en": "Japan",
+    "locale": "JP",
+    "tc": "日本"
+  },
+  {
+    "sc": "约旦",
+    "code": 962,
+    "pinyin": "YUEDAN",
+    "en": "Jordan",
+    "locale": "JO",
+    "tc": "約旦"
+  },
+  {
+    "sc": "柬埔寨",
+    "code": 855,
+    "pinyin": "JIANPUZHAI",
+    "en": "Kampuchea (Cambodia )",
+    "locale": "KH",
+    "tc": "柬埔寨"
+  },
+  {
+    "sc": "哈萨克斯坦",
+    "code": 327,
+    "pinyin": "HASAKESITAN",
+    "en": "Kazakstan",
+    "locale": "KZ",
+    "tc": "哈薩克"
+  },
+  {
+    "sc": "肯尼亚",
+    "code": 254,
+    "pinyin": "KENNIYA",
+    "en": "Kenya",
+    "locale": "KE",
+    "tc": "肯雅"
+  },
+  {
+    "sc": "韩国",
+    "code": 82,
+    "pinyin": "HANGUO",
+    "en": "Korea",
+    "locale": "KR",
+    "tc": "韓國"
+  },
+  {
+    "sc": "科威特",
+    "code": 965,
+    "pinyin": "KEWEITE",
+    "en": "Kuwait",
+    "locale": "KW",
+    "tc": "科威特"
+  },
+  {
+    "sc": "吉尔吉斯坦",
+    "code": 331,
+    "pinyin": "JIERJISITAN",
+    "en": "Kyrgyzstan",
+    "locale": "KG",
+    "tc": "吉爾吉斯坦"
+  },
+  {
+    "sc": "老挝",
+    "code": 856,
+    "pinyin": "LAOWO",
+    "en": "Laos",
+    "locale": "LA",
+    "tc": "寮國"
+  },
+  {
+    "sc": "拉脱维亚",
+    "code": 371,
+    "pinyin": "LATUOWEIYA",
+    "en": "Latvia",
+    "locale": "LV",
+    "tc": "拉脫維亞"
+  },
+  {
+    "sc": "黎巴嫩",
+    "code": 961,
+    "pinyin": "LIBANEN",
+    "en": "Lebanon",
+    "locale": "LB",
+    "tc": "黎巴嫩"
+  },
+  {
+    "sc": "莱索托",
+    "code": 266,
+    "pinyin": "LAISUOTUO",
+    "en": "Lesotho",
+    "locale": "LS",
+    "tc": "萊索托"
+  },
+  {
+    "sc": "利比里亚",
+    "code": 231,
+    "pinyin": "LIBILIYA",
+    "en": "Liberia",
+    "locale": "LR",
+    "tc": "利比里亞"
+  },
+  {
+    "sc": "利比亚",
+    "code": 218,
+    "pinyin": "LIBIYA",
+    "en": "Libya",
+    "locale": "LY",
+    "tc": "利比亞"
+  },
+  {
+    "sc": "列支敦士登",
+    "code": 423,
+    "pinyin": "LIEZHIDUNSHIDENG",
+    "en": "Liechtenstein",
+    "locale": "LI",
+    "tc": "列支敦士登"
+  },
+  {
+    "sc": "立陶宛",
+    "code": 370,
+    "pinyin": "LITAOWAN",
+    "en": "Lithuania",
+    "locale": "LT",
+    "tc": "立陶宛"
+  },
+  {
+    "sc": "卢森堡",
+    "code": 352,
+    "pinyin": "LUSENBAO",
+    "en": "Luxembourg",
+    "locale": "LU",
+    "tc": "盧森堡"
+  },
+  {
+    "sc": "中国澳门",
+    "code": 853,
+    "pinyin": "ZHONGGUOAOMEN",
+    "en": "Macao",
+    "locale": "MO",
+    "tc": "中國澳門"
+  },
+  {
+    "sc": "马达加斯加",
+    "code": 261,
+    "pinyin": "MADAJIASIJIA",
+    "en": "Madagascar",
+    "locale": "MG",
+    "tc": "馬達加斯加"
+  },
+  {
+    "sc": "马拉维",
+    "code": 265,
+    "pinyin": "MALAWEI",
+    "en": "Malawi",
+    "locale": "MW",
+    "tc": "馬拉維"
+  },
+  {
+    "sc": "马来西亚",
+    "code": 60,
+    "pinyin": "MALAIXIYA",
+    "en": "Malaysia",
+    "locale": "MY",
+    "tc": "馬來西亞"
+  },
+  {
+    "sc": "马尔代夫",
+    "code": 960,
+    "pinyin": "MAERDAIFU",
+    "en": "Maldives",
+    "locale": "MV",
+    "tc": "馬爾代夫"
+  },
+  {
+    "sc": "马里",
+    "code": 223,
+    "pinyin": "MALI",
+    "en": "Mali",
+    "locale": "ML",
+    "tc": "馬里"
+  },
+  {
+    "sc": "马耳他",
+    "code": 356,
+    "pinyin": "MAERTA",
+    "en": "Malta",
+    "locale": "MT",
+    "tc": "馬爾他"
+  },
+  {
+    "sc": "马里亚那群岛",
+    "code": 1670,
+    "pinyin": "MALIYANEIQUNDAO",
+    "en": "Mariana Is",
+    "locale": "MP",
+    "tc": "馬里亞那群島"
+  },
+  {
+    "sc": "马提尼克",
+    "code": 596,
+    "pinyin": "MATINIKE",
+    "en": "Martinique",
+    "locale": "MQ",
+    "tc": "馬提尼克島"
+  },
+  {
+    "sc": "毛里求斯",
+    "code": 230,
+    "pinyin": "MAOLIQIUSI",
+    "en": "Mauritius",
+    "locale": "MU",
+    "tc": "毛里裘斯"
+  },
+  {
+    "sc": "墨西哥",
+    "code": 52,
+    "pinyin": "MOXIGE",
+    "en": "Mexico",
+    "locale": "MX",
+    "tc": "墨西哥"
+  },
+  {
+    "sc": "摩尔多瓦",
+    "code": 373,
+    "pinyin": "MOERDUOWA",
+    "en": "Moldova, Republic of",
+    "locale": "MD",
+    "tc": "摩爾多瓦"
+  },
+  {
+    "sc": "摩纳哥",
+    "code": 377,
+    "pinyin": "MONAGE",
+    "en": "Monaco",
+    "locale": "MC",
+    "tc": "摩納哥"
+  },
+  {
+    "sc": "蒙古",
+    "code": 976,
+    "pinyin": "MENGGU",
+    "en": "Mongolia",
+    "locale": "MN",
+    "tc": "蒙古"
+  },
+  {
+    "sc": "蒙特塞拉特岛",
+    "code": 1664,
+    "pinyin": "MENGTESAILATEDAO",
+    "en": "Montserrat Is",
+    "locale": "MS",
+    "tc": "蒙特塞拉特島"
+  },
+  {
+    "sc": "摩洛哥",
+    "code": 212,
+    "pinyin": "MOLUOGE",
+    "en": "Morocco",
+    "locale": "MA",
+    "tc": "摩洛哥"
+  },
+  {
+    "sc": "莫桑比克",
+    "code": 258,
+    "pinyin": "MOSANGBIKE",
+    "en": "Mozambique",
+    "locale": "MZ",
+    "tc": "莫桑比克"
+  },
+  {
+    "sc": "纳米比亚",
+    "code": 264,
+    "pinyin": "NAMIBIYA",
+    "en": "Namibia",
+    "locale": "NA",
+    "tc": "納米比亞"
+  },
+  {
+    "sc": "瑙鲁",
+    "code": 674,
+    "pinyin": "NAOLU",
+    "en": "Nauru",
+    "locale": "NR",
+    "tc": "瑙魯"
+  },
+  {
+    "sc": "尼泊尔",
+    "code": 977,
+    "pinyin": "NIBOER",
+    "en": "Nepal",
+    "locale": "NP",
+    "tc": "尼泊爾"
+  },
+  {
+    "sc": "荷属安的列斯",
+    "code": 599,
+    "pinyin": "HESHUANDELIESI",
+    "en": "Netheriands Antilles",
+    "locale": "ANT",
+    "tc": "荷屬安地列斯"
+  },
+  {
+    "sc": "荷兰",
+    "code": 31,
+    "pinyin": "HELAN",
+    "en": "Netherlands",
+    "locale": "NL",
+    "tc": "荷蘭"
+  },
+  {
+    "sc": "新西兰",
+    "code": 64,
+    "pinyin": "XINXILAN",
+    "en": "New Zealand",
+    "locale": "NZ",
+    "tc": "新西蘭"
+  },
+  {
+    "sc": "尼加拉瓜",
+    "code": 505,
+    "pinyin": "NIJIALAGUA",
+    "en": "Nicaragua",
+    "locale": "NI",
+    "tc": "尼加拉瓜"
+  },
+  {
+    "sc": "尼日尔",
+    "code": 227,
+    "pinyin": "NIRIER",
+    "en": "Niger",
+    "locale": "NE",
+    "tc": "尼日爾"
+  },
+  {
+    "sc": "尼日利亚",
+    "code": 234,
+    "pinyin": "NIRILIYA",
+    "en": "Nigeria",
+    "locale": "NG",
+    "tc": "尼日利亞"
+  },
+  {
+    "sc": "朝鲜",
+    "code": 850,
+    "pinyin": "CHAOXIAN",
+    "en": "North Korea",
+    "locale": "KP",
+    "tc": "朝鮮"
+  },
+  {
+    "sc": "挪威",
+    "code": 47,
+    "pinyin": "NUOWEI",
+    "en": "Norway",
+    "locale": "NO",
+    "tc": "挪威"
+  },
+  {
+    "sc": "阿曼",
+    "code": 968,
+    "pinyin": "AMAN",
+    "en": "Oman",
+    "locale": "OM",
+    "tc": "阿曼"
+  },
+  {
+    "sc": "巴基斯坦",
+    "code": 92,
+    "pinyin": "BAJISITAN",
+    "en": "Pakistan",
+    "locale": "PK",
+    "tc": "巴基斯坦"
+  },
+  {
+    "sc": "巴拿马",
+    "code": 507,
+    "pinyin": "BANAMA",
+    "en": "Panama",
+    "locale": "PA",
+    "tc": "巴拿馬"
+  },
+  {
+    "sc": "巴布亚新几内亚",
+    "code": 675,
+    "pinyin": "BABUYAXINJINEIYA",
+    "en": "Papua New Cuinea",
+    "locale": "PG",
+    "tc": "巴布亞新畿內亞"
+  },
+  {
+    "sc": "巴拉圭",
+    "code": 595,
+    "pinyin": "BALAGUI",
+    "en": "Paraguay",
+    "locale": "PY",
+    "tc": "巴拉圭"
+  },
+  {
+    "sc": "秘鲁",
+    "code": 51,
+    "pinyin": "MILU",
+    "en": "Peru",
+    "locale": "PE",
+    "tc": "秘魯"
+  },
+  {
+    "sc": "菲律宾",
+    "code": 63,
+    "pinyin": "FEILVBIN",
+    "en": "Philippines",
+    "locale": "PH",
+    "tc": "菲律賓"
+  },
+  {
+    "sc": "波兰",
+    "code": 48,
+    "pinyin": "BOLAN",
+    "en": "Poland",
+    "locale": "PL",
+    "tc": "波蘭"
+  },
+  {
+    "sc": "法属玻利尼西亚",
+    "code": 689,
+    "pinyin": "FASHUBOLINIXIYA",
+    "en": "French Polynesia",
+    "locale": "PF",
+    "tc": "法屬玻利尼西亞"
+  },
+  {
+    "sc": "葡萄牙",
+    "code": 351,
+    "pinyin": "PUTAOYA",
+    "en": "Portugal",
+    "locale": "PT",
+    "tc": "葡萄牙"
+  },
+  {
+    "sc": "波多黎各",
+    "code": 1787,
+    "pinyin": "BODUOLIGE",
+    "en": "Puerto Rico",
+    "locale": "PR",
+    "tc": "波多黎各"
+  },
+  {
+    "sc": "卡塔尔",
+    "code": 974,
+    "pinyin": "KATAER",
+    "en": "Qatar",
+    "locale": "QA",
+    "tc": "卡塔爾"
+  },
+  {
+    "sc": "留尼旺",
+    "code": 262,
+    "pinyin": "LIUNIWANG",
+    "en": "Reunion",
+    "locale": "RE",
+    "tc": "留尼旺"
+  },
+  {
+    "sc": "罗马尼亚",
+    "code": 40,
+    "pinyin": "LUOMANIYA",
+    "en": "Romania",
+    "locale": "RO",
+    "tc": "羅馬尼亞"
+  },
+  {
+    "sc": "俄罗斯",
+    "code": 7,
+    "pinyin": "ELUOSI",
+    "en": "Russia",
+    "locale": "RU",
+    "tc": "俄羅斯"
+  },
+  {
+    "sc": "圣卢西亚",
+    "code": 1758,
+    "pinyin": "SHENGLUXIYA",
+    "en": "Saint Lueia",
+    "locale": "LC",
+    "tc": "聖盧西亞"
+  },
+  {
+    "sc": "圣文森特岛",
+    "code": 1784,
+    "pinyin": "SHENGWENSENTEDAO",
+    "en": "Saint Vincent",
+    "locale": "VC",
+    "tc": "聖文森特島"
+  },
+  {
+    "sc": "东萨摩亚(美)",
+    "code": 684,
+    "pinyin": "DONGSAMOYA(MEI)",
+    "en": "Samoa Eastern",
+    "locale": "AS",
+    "tc": "東薩摩亞(美)"
+  },
+  {
+    "sc": "西萨摩亚",
+    "code": 685,
+    "pinyin": "XISAMOYA",
+    "en": "Samoa Western",
+    "locale": "WS",
+    "tc": "西薩摩亞"
+  },
+  {
+    "sc": "圣马力诺",
+    "code": 378,
+    "pinyin": "SHENGMALINUO",
+    "en": "San Marino",
+    "locale": "SM",
+    "tc": "聖馬力諾"
+  },
+  {
+    "sc": "圣多美和普林西比",
+    "code": 239,
+    "pinyin": "SHENGDUOMEIHEPULINXIBI",
+    "en": "Sao Tome and Principe",
+    "locale": "ST",
+    "tc": "聖多美和普林西比"
+  },
+  {
+    "sc": "沙特阿拉伯",
+    "code": 966,
+    "pinyin": "SHATEALABO",
+    "en": "Saudi Arabia",
+    "locale": "SA",
+    "tc": "沙地阿拉伯"
+  },
+  {
+    "sc": "塞内加尔",
+    "code": 221,
+    "pinyin": "SAINEIJIAER",
+    "en": "Senegal",
+    "locale": "SN",
+    "tc": "塞內加爾"
+  },
+  {
+    "sc": "塞舌尔",
+    "code": 248,
+    "pinyin": "SAISHEER",
+    "en": "Seychelles",
+    "locale": "SC",
+    "tc": "塞舌爾"
+  },
+  {
+    "sc": "塞拉利昂",
+    "code": 232,
+    "pinyin": "SAILALIANG",
+    "en": "Sierra Leone",
+    "locale": "SL",
+    "tc": "塞拉利昂"
+  },
+  {
+    "sc": "新加坡",
+    "code": 65,
+    "pinyin": "XINJIAPO",
+    "en": "Singapore",
+    "locale": "SG",
+    "tc": "新加坡"
+  },
+  {
+    "sc": "斯洛伐克",
+    "code": 421,
+    "pinyin": "SILUOFAKE",
+    "en": "Slovakia",
+    "locale": "SK",
+    "tc": "斯洛伐克"
+  },
+  {
+    "sc": "斯洛文尼亚",
+    "code": 386,
+    "pinyin": "SILUOWENNIYA",
+    "en": "Slovenia",
+    "locale": "SI",
+    "tc": "斯洛文尼亞"
+  },
+  {
+    "sc": "所罗门群岛",
+    "code": 677,
+    "pinyin": "SUOLUOMENQUNDAO",
+    "en": "Solomon Is",
+    "locale": "SB",
+    "tc": "所羅門群島"
+  },
+  {
+    "sc": "索马里",
+    "code": 252,
+    "pinyin": "SUOMALI",
+    "en": "Somali",
+    "locale": "SO",
+    "tc": "索馬里"
+  },
+  {
+    "sc": "南非",
+    "code": 27,
+    "pinyin": "NANFEI",
+    "en": "South Africa",
+    "locale": "ZA",
+    "tc": "南非"
+  },
+  {
+    "sc": "西班牙",
+    "code": 34,
+    "pinyin": "XIBANYA",
+    "en": "Spain",
+    "locale": "ES",
+    "tc": "西班牙"
+  },
+  {
+    "sc": "斯里兰卡",
+    "code": 94,
+    "pinyin": "SILILANKA",
+    "en": "Sri Lanka",
+    "locale": "LK",
+    "tc": "斯裡蘭卡"
+  },
+  {
+    "sc": "圣卢西亚",
+    "code": 1758,
+    "pinyin": "SHENGLUXIYA",
+    "en": "St.Lucia",
+    "locale": "LC",
+    "tc": "聖盧西亞"
+  },
+  {
+    "sc": "圣文森特",
+    "code": 1784,
+    "pinyin": "SHENGWENSENTE",
+    "en": "St.Vincent",
+    "locale": "VC",
+    "tc": "聖文森特"
+  },
+  {
+    "sc": "苏丹",
+    "code": 249,
+    "pinyin": "SUDAN",
+    "en": "Sudan",
+    "locale": "SD",
+    "tc": "蘇丹"
+  },
+  {
+    "sc": "苏里南",
+    "code": 597,
+    "pinyin": "SULINAN",
+    "en": "Suriname",
+    "locale": "SR",
+    "tc": "蘇里南"
+  },
+  {
+    "sc": "斯威士兰",
+    "code": 268,
+    "pinyin": "SIWEISHILAN",
+    "en": "Swaziland",
+    "locale": "SZ",
+    "tc": "斯威士蘭"
+  },
+  {
+    "sc": "瑞典",
+    "code": 46,
+    "pinyin": "RUIDIAN",
+    "en": "Sweden",
+    "locale": "SE",
+    "tc": "瑞典"
+  },
+  {
+    "sc": "瑞士",
+    "code": 41,
+    "pinyin": "RUISHI",
+    "en": "Switzerland",
+    "locale": "CH",
+    "tc": "瑞士"
+  },
+  {
+    "sc": "叙利亚",
+    "code": 963,
+    "pinyin": "XULIYA",
+    "en": "Syria",
+    "locale": "SY",
+    "tc": "敘利亞"
+  },
+  {
+    "sc": "中国台湾",
+    "code": 886,
+    "pinyin": "ZHONGGUOTAIWAN",
+    "en": "Taiwan",
+    "locale": "TW",
+    "tc": "中國台灣"
+  },
+  {
+    "sc": "塔吉克斯坦",
+    "code": 992,
+    "pinyin": "TAJIKESITAN",
+    "en": "Tajikstan",
+    "locale": "TJ",
+    "tc": "塔吉克"
+  },
+  {
+    "sc": "坦桑尼亚",
+    "code": 255,
+    "pinyin": "TANSANGNIYA",
+    "en": "Tanzania",
+    "locale": "TZ",
+    "tc": "坦桑尼亞"
+  },
+  {
+    "sc": "泰国",
+    "code": 66,
+    "pinyin": "TAIGUO",
+    "en": "Thailand",
+    "locale": "TH",
+    "tc": "泰國"
+  },
+  {
+    "sc": "多哥",
+    "code": 228,
+    "pinyin": "DUOGE",
+    "en": "Togo",
+    "locale": "TG",
+    "tc": "多哥"
+  },
+  {
+    "sc": "汤加",
+    "code": 676,
+    "pinyin": "TANGJIA",
+    "en": "Tonga",
+    "locale": "TO",
+    "tc": "湯加"
+  },
+  {
+    "sc": "特立尼达和多巴哥",
+    "code": 1809,
+    "pinyin": "TELINIDAHEDUOBAGE",
+    "en": "Trinidad and Tobago",
+    "locale": "TT",
+    "tc": "特立尼達和多巴哥"
+  },
+  {
+    "sc": "突尼斯",
+    "code": 216,
+    "pinyin": "TUNISI",
+    "en": "Tunisia",
+    "locale": "TN",
+    "tc": "突尼斯"
+  },
+  {
+    "sc": "土耳其",
+    "code": 90,
+    "pinyin": "TUERQI",
+    "en": "Turkey",
+    "locale": "TR",
+    "tc": "土耳其"
+  },
+  {
+    "sc": "土库曼斯坦",
+    "code": 993,
+    "pinyin": "TUKUMANSITAN",
+    "en": "Turkmenistan",
+    "locale": "TM",
+    "tc": "土庫曼"
+  },
+  {
+    "sc": "乌干达",
+    "code": 256,
+    "pinyin": "WUGANDA",
+    "en": "Uganda",
+    "locale": "UG",
+    "tc": "烏幹達"
+  },
+  {
+    "sc": "乌克兰",
+    "code": 380,
+    "pinyin": "WUKELAN",
+    "en": "Ukraine",
+    "locale": "UA",
+    "tc": "烏克蘭"
+  },
+  {
+    "sc": "阿拉伯联合酋长国",
+    "code": 971,
+    "pinyin": "ALABOLIANHEQIUZHANGGUO",
+    "en": "United Arab Emirates",
+    "locale": "AE",
+    "tc": "阿拉伯聯合酋長國"
+  },
+  {
+    "sc": "英国",
+    "code": 44,
+    "pinyin": "YINGGUO",
+    "en": "United Kiongdom",
+    "locale": "GB",
+    "tc": "英國"
+  },
+  {
+    "sc": "美国",
+    "code": 1,
+    "pinyin": "MEIGUO",
+    "en": "United States of America",
+    "locale": "US",
+    "tc": "美國"
+  },
+  {
+    "sc": "乌拉圭",
+    "code": 598,
+    "pinyin": "WULAGUI",
+    "en": "Uruguay",
+    "locale": "UY",
+    "tc": "烏拉圭"
+  },
+  {
+    "sc": "乌兹别克斯坦",
+    "code": 233,
+    "pinyin": "WUZIBIEKESITAN",
+    "en": "Uzbekistan",
+    "locale": "UZ",
+    "tc": "烏茲別克"
+  },
+  {
+    "sc": "委内瑞拉",
+    "code": 58,
+    "pinyin": "WEINEIRUILA",
+    "en": "Venezuela",
+    "locale": "VE",
+    "tc": "委內瑞拉"
+  },
+  {
+    "sc": "越南",
+    "code": 84,
+    "pinyin": "YUENAN",
+    "en": "Vietnam",
+    "locale": "VN",
+    "tc": "越南"
+  },
+  {
+    "sc": "也门",
+    "code": 967,
+    "pinyin": "YEMEN",
+    "en": "Yemen",
+    "locale": "YE",
+    "tc": "也門"
+  },
+  {
+    "sc": "南斯拉夫",
+    "code": 381,
+    "pinyin": "NANSILAFU",
+    "en": "Yugoslavia",
+    "locale": "YU",
+    "tc": "南斯拉夫"
+  },
+  {
+    "sc": "津巴布韦",
+    "code": 263,
+    "pinyin": "JINBABUWEI",
+    "en": "Zimbabwe",
+    "locale": "ZW",
+    "tc": "津巴布韋"
+  },
+  {
+    "sc": "扎伊尔",
+    "code": 243,
+    "pinyin": "ZHAYIER",
+    "en": "Zaire",
+    "locale": "ZR",
+    "tc": "扎伊爾"
+  },
+  {
+    "sc": "赞比亚",
+    "code": 260,
+    "pinyin": "ZANBIYA",
+    "en": "Zambia",
+    "locale": "ZM",
+    "tc": "贊比亞"
+  }
+]

+ 104 - 0
lib_country_picker/src/main/java/com/swago/lib_country_picker/Country.java

@@ -0,0 +1,104 @@
+package com.swago.lib_country_picker;
+
+import android.content.Context;
+import android.text.TextUtils;
+
+import androidx.annotation.NonNull;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+/**
+ * Created by android on 17/10/17.
+ */
+
+public class Country implements PyEntity {
+    private static final String TAG = Country.class.getSimpleName();
+    public int code;
+    public String name, locale, pinyin;
+    public int flag;
+    private static ArrayList<Country> countries = new ArrayList<>();
+
+    public Country(int code, String name, String pinyin, String locale, int flag) {
+        this.code = code;
+        this.name = name;
+        this.flag = flag;
+        this.locale = locale;
+        this.pinyin = pinyin;
+    }
+
+    @Override
+    public String toString() {
+        return "Country{" +
+                "code='" + code + '\'' +
+                "flag='" + flag + '\'' +
+                ", name='" + name + '\'' +
+                '}';
+    }
+
+    public static ArrayList<Country> getAll(){
+        return new ArrayList<>(countries);
+    }
+
+    public static Country fromJson(String json){
+        if(TextUtils.isEmpty(json)) return null;
+        try {
+            JSONObject jo = new JSONObject(json);
+            return new Country(jo.optInt("code"), jo.optString("name"), jo.optString("pinyin"), jo.optString("locale"), jo.optInt("flag"));
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public String toJson() {
+        return "{\"name\":\"" + name + "\", \"code\":" + code + ", \"flag\":" + flag + ", \"pinyin\":" + pinyin + ",\"locale\":\"" + locale + "\"}";
+    }
+
+    public static void load(@NonNull Context ctx, Language language) throws IOException, JSONException {
+        countries = new ArrayList<>();
+        BufferedReader br = new BufferedReader(new InputStreamReader(ctx.getResources().getAssets().open("code.json")));
+        String line;
+        StringBuilder sb = new StringBuilder();
+        while ((line = br.readLine()) != null)
+            sb.append(line);
+        br.close();
+        JSONArray ja = new JSONArray(sb.toString());
+        String key = language.key;
+        for (int i = 0; i < ja.length(); i++) {
+            JSONObject jo = ja.getJSONObject(i);
+            int flag = 0;
+            String locale = jo.getString("locale");
+            if(!TextUtils.isEmpty(locale)) {
+                flag = ctx.getResources().getIdentifier("flag_" + locale.toLowerCase(), "drawable", ctx.getPackageName());
+            }
+            String name = jo.getString(key);
+            countries.add(new Country(
+                    jo.getInt("code"),
+                    name,
+                    language == Language.ENGLISH? name : jo.getString("pinyin"),
+                    locale, flag)
+            );
+        }
+    }
+
+    public static void destroy() {
+        countries.clear();
+    }
+
+    @Override
+    public int hashCode() {
+        return code;
+    }
+
+    @NonNull @Override
+    public String getPinyin() {
+        return pinyin;
+    }
+}

+ 10 - 0
lib_country_picker/src/main/java/com/swago/lib_country_picker/Language.java

@@ -0,0 +1,10 @@
+package com.swago.lib_country_picker;
+
+public enum Language {
+    SIMPLIFIED_CHINESE("sc"), TRADITIONAL_CHINESE("tc"), ENGLISH("en");
+
+    public final String key;
+    private Language(String key) {
+        this.key = key;
+    }
+}

+ 14 - 0
lib_country_picker/src/main/java/com/swago/lib_country_picker/LetterHolder.java

@@ -0,0 +1,14 @@
+package com.swago.lib_country_picker;
+
+import android.view.View;
+import android.widget.TextView;
+
+import androidx.recyclerview.widget.RecyclerView;
+
+public class LetterHolder extends RecyclerView.ViewHolder {
+    public final TextView textView;
+    public LetterHolder(View itemView) {
+        super(itemView);
+        textView = (TextView) itemView;
+    }
+}

+ 176 - 0
lib_country_picker/src/main/java/com/swago/lib_country_picker/PyAdapter.java

@@ -0,0 +1,176 @@
+package com.swago.lib_country_picker;
+
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.WeakHashMap;
+
+/**
+ * Created by android on 3/15/2018.
+ */
+
+public abstract class PyAdapter<VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> implements View.OnClickListener {
+
+    private static final String TAG = PyAdapter.class.getSimpleName();
+    public static final int TYPE_LETTER = 0;
+    public static final int TYPE_OTHER = 1;
+    private WeakHashMap<View, VH> holders = new WeakHashMap<>();
+    public final ArrayList<PyEntity> entityList = new ArrayList<>();
+    public final  HashSet<LetterEntity> letterSet = new HashSet<>();
+    private OnItemClickListener listener = (entity, position) -> {
+
+    };
+    private char specialLetter;
+
+    public PyAdapter(List<? extends PyEntity> entities, char specialLetter){
+        if(entities == null) throw new NullPointerException("entities == null!");
+        this.specialLetter = specialLetter;
+        update(entities);
+    }
+
+    public void update(List<? extends PyEntity> entities){
+        if(entities == null) throw new NullPointerException("entities == null!");
+        entityList.clear();
+        entityList.addAll(entities);
+        letterSet.clear();
+        for (PyEntity entity : entities) {
+            String pinyin = entity.getPinyin();
+            if(!TextUtils.isEmpty(pinyin)) {
+                char letter = pinyin.charAt(0);
+                if(!isLetter(letter))
+                    letter = specialLetter;
+                letterSet.add(new LetterEntity(letter + ""));
+            }
+        }
+        entityList.addAll(letterSet);
+        Collections.sort(entityList, (o1, o2) -> {
+            String pinyin = o1.getPinyin().toLowerCase();
+            String anotherPinyin = o2.getPinyin().toLowerCase();
+            char letter = pinyin.charAt(0);
+            char otherLetter = anotherPinyin.charAt(0);
+            if(isLetter(letter) && isLetter(otherLetter))
+                return pinyin.compareTo(anotherPinyin);
+            else if(isLetter(letter) && !isLetter(otherLetter)) {
+                return -1;
+            } else if(!isLetter(letter) && isLetter(otherLetter)){
+                return 1;
+            } else {
+                if(letter == 35 && o1 instanceof LetterEntity) return -1;
+                else if(otherLetter == 35 && o2 instanceof LetterEntity) return 1;
+                else return pinyin.compareTo(anotherPinyin);
+            }
+        });
+        notifyDataSetChanged();
+    }
+
+    private boolean isLetter(char letter) {
+        return 'a' <= letter && 'z' >= letter || 'A' <= letter && 'Z' >= letter;
+    }
+
+    @Override
+    public final void onBindViewHolder(@NonNull VH holder, int position) {
+        PyEntity entity = entityList.get(position);
+        holders.put(holder.itemView, holder);
+        holder.itemView.setOnClickListener(this);
+        if(entity instanceof LetterEntity) {
+            onBindLetterHolder(holder, (LetterEntity)entity, position);
+        } else {
+            onBindHolder(holder, entity, position);
+        }
+    }
+
+    public int getEntityPosition(PyEntity entity) { return entityList.indexOf(entity); }
+
+    @NonNull
+    @Override
+    public final VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+        return viewType == TYPE_LETTER? onCreateLetterHolder(parent, viewType)
+                : onCreateHolder(parent, viewType);
+    }
+
+    public abstract VH onCreateLetterHolder(ViewGroup parent, int viewType);
+    public abstract VH onCreateHolder(ViewGroup parent, int viewType);
+
+    public int getLetterPosition(String letter){
+        LetterEntity entity = new LetterEntity(letter);
+        return entityList.indexOf(entity);
+    }
+
+    @Override
+    public int getItemViewType(int position) {
+        PyEntity entity = entityList.get(position);
+        return entity instanceof LetterEntity? TYPE_LETTER : getViewType(entity, position);
+    }
+
+    public int getViewType(PyEntity entity, int position) {
+        return TYPE_OTHER;
+    }
+
+    @Override
+    public final int getItemCount() { return entityList.size(); }
+
+    public void onBindLetterHolder(VH holder, LetterEntity entity, int position) {
+
+    }
+
+    public void onBindHolder(VH holder, PyEntity entity, int position) {
+
+    }
+
+    public boolean isLetter(int position) {
+        if(position < 0 || position >= entityList.size()) return false;
+        else return entityList.get(position) instanceof LetterEntity;
+    }
+
+    public interface OnItemClickListener {
+        void onItemClick(PyEntity entity, int position);
+    }
+
+    public void setOnItemClickListener(OnItemClickListener listener) {
+        this.listener = listener;
+    }
+
+    @Override
+    public final void onClick(View v) {
+        VH holder = holders.get(v);
+        if(holder == null) {
+            Log.e(TAG, "Holder onClick event, but why holder == null?");
+            return;
+        }
+        int position = holder.getAdapterPosition();
+        PyEntity pyEntity = entityList.get(position);
+        listener.onItemClick(pyEntity, position);
+    }
+
+    public static final class LetterEntity implements PyEntity {
+
+        public final String letter;
+
+        public LetterEntity(String letter) { this.letter = letter; }
+
+        @Override @NonNull
+        public String getPinyin() { return letter.toLowerCase(); }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            LetterEntity that = (LetterEntity) o;
+
+            return letter.toLowerCase().equals(that.letter.toLowerCase());
+        }
+
+        @Override
+        public int hashCode() { return letter.toLowerCase().hashCode(); }
+    }
+}

+ 11 - 0
lib_country_picker/src/main/java/com/swago/lib_country_picker/PyEntity.java

@@ -0,0 +1,11 @@
+package com.swago.lib_country_picker;
+
+import androidx.annotation.NonNull;
+
+/**
+ * Created by android on 3/15/2018.
+ */
+
+public interface PyEntity {
+    @NonNull String getPinyin();
+}

+ 159 - 0
lib_country_picker/src/main/java/com/swago/lib_country_picker/SideBar.java

@@ -0,0 +1,159 @@
+package com.swago.lib_country_picker;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+
+import androidx.annotation.Nullable;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+
+/**
+ * Created by android on 3/14/2018.
+ */
+
+public class SideBar extends View {
+
+    public final ArrayList<String> indexes = new ArrayList<>();
+    private OnLetterChangeListener onLetterChangeListener;
+    private Paint paint;
+    private float textHeight;
+    private int cellWidth;
+    private int cellHeight;
+    private int currentIndex = -1;
+    private int letterColor;
+    private int selectColor;
+    private int letterSize;
+
+    public SideBar(Context context) { this(context, null); }
+
+    public SideBar(Context context, @Nullable AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public SideBar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+
+        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SideBar, defStyleAttr, 0);
+        letterColor = ta.getColor(R.styleable.SideBar_letterColor, Color.BLACK);
+        selectColor = ta.getColor(R.styleable.SideBar_selectColor, Color.CYAN);
+        letterSize = ta.getDimensionPixelSize(R.styleable.SideBar_letterSize, 24);
+        ta.recycle();
+        paint = new Paint();
+        //消除锯齿
+        paint.setAntiAlias(true);
+        Paint.FontMetrics fontMetrics = paint.getFontMetrics();
+        textHeight = (float) Math.ceil(fontMetrics.descent - fontMetrics.ascent);  //1.1---2   2.1--3
+        String[] letters = {"A", "B", "C", "D",
+                "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q",
+                "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
+        indexes.addAll(Arrays.asList(letters));
+    }
+
+    public void addIndex(String indexStr, int position) {
+        indexes.add(position, indexStr);
+        invalidate();
+    }
+
+    public void removeIndex(String indexStr) {
+        indexes.remove(indexStr);
+        invalidate();
+    }
+
+    public void setLetterSize(int letterSize) {
+        if(this.letterSize == letterSize) return;
+        this.letterSize = letterSize;
+        invalidate();
+    }
+
+    @Override
+    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+        super.onSizeChanged(w, h, oldw, oldh);
+        cellWidth = getMeasuredWidth();
+        cellHeight = getMeasuredHeight() / indexes.size();
+    }
+
+    @Override
+    protected void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+        paint.setTextSize(letterSize);
+        for (int i = 0; i < indexes.size(); i++) {
+            String letter = indexes.get(i);
+            float textWidth = paint.measureText(letter);
+            float x = (cellWidth - textWidth) * 0.5f;
+            float y = (cellHeight + textHeight) * 0.5f + cellHeight * i;
+
+            if (i == currentIndex) {
+                paint.setColor(selectColor);
+            } else {
+                paint.setColor(letterColor);
+            }
+
+            canvas.drawText(letter, x, y, paint);
+        }
+    }
+
+    public OnLetterChangeListener getOnLetterChangeListener() {
+        return onLetterChangeListener;
+    }
+
+    public void setOnLetterChangeListener(OnLetterChangeListener onLetterChangeListener) {
+        this.onLetterChangeListener = onLetterChangeListener;
+    }
+
+    public String getLetter(int position) {
+        if(position < 0 || position >= indexes.size()) return "";
+        return indexes.get(position);
+    }
+
+    public interface OnLetterChangeListener {
+        void onLetterChange(String letter);
+
+        //手指抬起
+        void onReset();
+    }
+
+    /**
+     * 处理 按下 移动 手指抬起
+     */
+    @SuppressLint("ClickableViewAccessibility")
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+        switch (event.getAction()) {
+            case MotionEvent.ACTION_DOWN:
+            case MotionEvent.ACTION_MOVE:
+                int downY = (int) event.getY();
+                //获取当前索引
+                currentIndex = downY / cellHeight;
+                if (currentIndex < 0 || currentIndex > indexes.size() - 1) {
+
+                } else {
+                    if (onLetterChangeListener != null) {
+                        onLetterChangeListener.onLetterChange(indexes.get(currentIndex));
+                    }
+                }
+                //重新绘制
+                invalidate();
+                break;
+            case MotionEvent.ACTION_UP:
+                currentIndex = -1;
+                //手动刷新
+                invalidate();
+                //表示手指抬起了
+                if (onLetterChangeListener != null) {
+                    onLetterChangeListener.onReset();
+                }
+                break;
+        }
+        // 为了 能够接受  move+up事件
+        return true;
+    }
+}

BIN
lib_country_picker/src/main/res/drawable/flag_ac.png


BIN
lib_country_picker/src/main/res/drawable/flag_ad.png


BIN
lib_country_picker/src/main/res/drawable/flag_ae.png


BIN
lib_country_picker/src/main/res/drawable/flag_af.png


BIN
lib_country_picker/src/main/res/drawable/flag_ag.png


BIN
lib_country_picker/src/main/res/drawable/flag_ai.png


BIN
lib_country_picker/src/main/res/drawable/flag_al.png


BIN
lib_country_picker/src/main/res/drawable/flag_am.png


BIN
lib_country_picker/src/main/res/drawable/flag_an.png


BIN
lib_country_picker/src/main/res/drawable/flag_ant.png


BIN
lib_country_picker/src/main/res/drawable/flag_ao.png


BIN
lib_country_picker/src/main/res/drawable/flag_aq.png


BIN
lib_country_picker/src/main/res/drawable/flag_ar.png


BIN
lib_country_picker/src/main/res/drawable/flag_as.png


BIN
lib_country_picker/src/main/res/drawable/flag_at.png


BIN
lib_country_picker/src/main/res/drawable/flag_au.png


BIN
lib_country_picker/src/main/res/drawable/flag_aw.png


BIN
lib_country_picker/src/main/res/drawable/flag_ax.png


BIN
lib_country_picker/src/main/res/drawable/flag_az.png


BIN
lib_country_picker/src/main/res/drawable/flag_ba.png


BIN
lib_country_picker/src/main/res/drawable/flag_bb.png


BIN
lib_country_picker/src/main/res/drawable/flag_bd.png


BIN
lib_country_picker/src/main/res/drawable/flag_be.png


BIN
lib_country_picker/src/main/res/drawable/flag_bf.png


BIN
lib_country_picker/src/main/res/drawable/flag_bg.png


BIN
lib_country_picker/src/main/res/drawable/flag_bh.png


BIN
lib_country_picker/src/main/res/drawable/flag_bi.png


BIN
lib_country_picker/src/main/res/drawable/flag_bj.png


BIN
lib_country_picker/src/main/res/drawable/flag_bl.png


BIN
lib_country_picker/src/main/res/drawable/flag_bm.png


BIN
lib_country_picker/src/main/res/drawable/flag_bn.png


BIN
lib_country_picker/src/main/res/drawable/flag_bo.png


BIN
lib_country_picker/src/main/res/drawable/flag_bq.png


BIN
lib_country_picker/src/main/res/drawable/flag_br.png


BIN
lib_country_picker/src/main/res/drawable/flag_bs.png


BIN
lib_country_picker/src/main/res/drawable/flag_bt.png


BIN
lib_country_picker/src/main/res/drawable/flag_bv.png


BIN
lib_country_picker/src/main/res/drawable/flag_bw.png


BIN
lib_country_picker/src/main/res/drawable/flag_by.png


BIN
lib_country_picker/src/main/res/drawable/flag_bz.png


BIN
lib_country_picker/src/main/res/drawable/flag_ca.png


BIN
lib_country_picker/src/main/res/drawable/flag_cc.png


BIN
lib_country_picker/src/main/res/drawable/flag_cd.png


BIN
lib_country_picker/src/main/res/drawable/flag_cf.png


BIN
lib_country_picker/src/main/res/drawable/flag_cg.png


BIN
lib_country_picker/src/main/res/drawable/flag_ch.png


BIN
lib_country_picker/src/main/res/drawable/flag_ci.png


BIN
lib_country_picker/src/main/res/drawable/flag_ck.png


BIN
lib_country_picker/src/main/res/drawable/flag_cl.png


BIN
lib_country_picker/src/main/res/drawable/flag_cm.png


BIN
lib_country_picker/src/main/res/drawable/flag_cn.png


BIN
lib_country_picker/src/main/res/drawable/flag_co.png


BIN
lib_country_picker/src/main/res/drawable/flag_cr.png


BIN
lib_country_picker/src/main/res/drawable/flag_cu.png


BIN
lib_country_picker/src/main/res/drawable/flag_cv.png


BIN
lib_country_picker/src/main/res/drawable/flag_cw.png


BIN
lib_country_picker/src/main/res/drawable/flag_cx.png


BIN
lib_country_picker/src/main/res/drawable/flag_cy.png


BIN
lib_country_picker/src/main/res/drawable/flag_cz.png


BIN
lib_country_picker/src/main/res/drawable/flag_de.png


BIN
lib_country_picker/src/main/res/drawable/flag_dj.png


BIN
lib_country_picker/src/main/res/drawable/flag_dk.png


BIN
lib_country_picker/src/main/res/drawable/flag_dm.png


BIN
lib_country_picker/src/main/res/drawable/flag_do.png


BIN
lib_country_picker/src/main/res/drawable/flag_dz.png


BIN
lib_country_picker/src/main/res/drawable/flag_ec.png


BIN
lib_country_picker/src/main/res/drawable/flag_ee.png


BIN
lib_country_picker/src/main/res/drawable/flag_eg.png


BIN
lib_country_picker/src/main/res/drawable/flag_eh.png


BIN
lib_country_picker/src/main/res/drawable/flag_er.png


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff