|
@@ -1,7 +1,9 @@
|
|
package com.swago.baseswago.util
|
|
package com.swago.baseswago.util
|
|
|
|
|
|
import android.Manifest
|
|
import android.Manifest
|
|
|
|
+import android.content.Context
|
|
import android.os.Build
|
|
import android.os.Build
|
|
|
|
+import android.telephony.TelephonyManager
|
|
import android.text.TextUtils
|
|
import android.text.TextUtils
|
|
import com.permissionx.guolindev.PermissionX
|
|
import com.permissionx.guolindev.PermissionX
|
|
import java.io.*
|
|
import java.io.*
|
|
@@ -44,7 +46,17 @@ object SwagoInfo {
|
|
languageId = 5
|
|
languageId = 5
|
|
}
|
|
}
|
|
"zh" -> {
|
|
"zh" -> {
|
|
- languageCode = "zh"
|
|
|
|
|
|
+ val country = Locale.getDefault().country
|
|
|
|
+ languageCode = when(country){
|
|
|
|
+ "CN" ->{
|
|
|
|
+ "zh-t"
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ else ->{
|
|
|
|
+ "zh"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
languageId = 1
|
|
languageId = 1
|
|
}
|
|
}
|
|
else -> {
|
|
else -> {
|
|
@@ -99,6 +111,13 @@ object SwagoInfo {
|
|
return "Android ${Build.VERSION.RELEASE}"
|
|
return "Android ${Build.VERSION.RELEASE}"
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ fun getNetworkOperatorName(): String {
|
|
|
|
+ val context = AppContext.getContext()
|
|
|
|
+ val telephonyManager = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
|
|
|
|
+ val networkOperatorName = telephonyManager.networkOperatorName
|
|
|
|
+ return networkOperatorName
|
|
|
|
+ }
|
|
|
|
+
|
|
private fun getUniqueDeviceId():String{
|
|
private fun getUniqueDeviceId():String{
|
|
if (PermissionX.isGranted(AppContext.getContext(), Manifest.permission.READ_EXTERNAL_STORAGE)){
|
|
if (PermissionX.isGranted(AppContext.getContext(), Manifest.permission.READ_EXTERNAL_STORAGE)){
|
|
if (AppContext.getContext().getExternalFilesDir(null) == null){
|
|
if (AppContext.getContext().getExternalFilesDir(null) == null){
|