feat : 新增 土耳其语 ; bugfix

This commit is contained in:
eggmanQQQ
2024-10-23 17:11:50 +08:00
parent 9e590ada9e
commit 0404d203b3
8 changed files with 5431 additions and 5 deletions

View File

@@ -20,7 +20,7 @@ android {
flavorDimensions 'default'
buildConfigField "boolean", "ISOLATION_MODE", "$isolationMode"
resConfigs "en", "zh-rTW", "ar"
resConfigs "en", "zh-rTW", "ar","tr"
if (isolationMode) {
resValue "string", "app_launch_name", "Mo-debug"
} else {
@@ -328,7 +328,7 @@ aabResGuard {
enableFilterStrings = false // switch of filter strings
unusedStringPath = file("unused.txt").toPath() // strings will be filtered in this file
languageWhiteList = ["en", "zh", "ar", "zh-rTW"] // keep en,en-xx,zh,zh-xx etc. remove others.
languageWhiteList = ["en", "zh", "ar", "zh-rTW","tr"] // keep en,en-xx,zh,zh-xx etc. remove others.
}
//以下均为非必须

View File

@@ -67,6 +67,10 @@ class UploadRoomAlbumDialogFragment : BottomSheetDialogFragment() {
if (ActivityResultContracts.PickVisualMedia.isPhotoPickerAvailable(requireContext())) {
pickMedia = registerForActivityResult(ActivityResultContracts.PickVisualMedia()) { uri ->
uri?.let {
if (MyUriUtils.isGif(requireContext(), uri)) {
ToastUtils.show(R.string.error_file_type)
return@let
}
val file = MyUriUtils.copyFile(requireContext(),uri)
if (file != null) {
compressPhotos(mutableListOf(file.path))

View File

@@ -43,6 +43,7 @@ class LanguageActivity : BaseViewBindingActivity<LanguageActivityBinding>(), ILo
adapter.addData(LanguageItem(Locale.ENGLISH, "English"))
adapter.addData(LanguageItem(Locale.TRADITIONAL_CHINESE, "繁體中文"))
adapter.addData(LanguageItem(Locale("ar"), "بالعربية"))
adapter.addData(LanguageItem(Locale("tr"), "哈士奇"))
binding.recyclerView.adapter = adapter
adapter.setOnItemClickListener { _, view, position ->
adapter.getItem(position)?.locale?.let {

View File

@@ -552,7 +552,17 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
val photos = PhotoProvider.getResultPhotoList(it)
if (!photos.isNullOrEmpty()) {
val photo = photos[0]
crop(photo.uri, photo.size, mUri)
if (isGif) {
mUri?.let {
val isCopy = MyUriUtils.copyFileToUrl(this,photo.uri, it)
if (isCopy) {
onActivityResult(UCrop.REQUEST_CROP,RESULT_OK,null)
}
}
} else {
crop(photo.uri, photo.size, mUri)
}
} else {
toast(R.string.empty_data)
}

File diff suppressed because it is too large Load Diff

View File

@@ -201,6 +201,11 @@ public class PublishActivity extends BaseMvpActivity<IPublishView, PublishPresen
public void onActivityResult(Uri uri) {
if (uri != null && uri.getPath() != null){
if (MyUriUtils.INSTANCE.isGif(context, uri)) {
ToastUtils.show(R.string.error_file_type);
return;
}
File file = MyUriUtils.INSTANCE.copyFile(PublishActivity.this, uri);
if (file != null) {
LogUtil.e("选择 file = "+file.getName());

View File

@@ -52,6 +52,18 @@ object MyUriUtils {
}
fun getFileType(context: Context, uri: Uri) : String {
var type = ""
context.contentResolver?.let {
type = it.getType(uri).toString()
}
return type
}
fun isGif(context: Context, uri: Uri) :Boolean{
return getFileType(context,uri) == "image/gif"
}
fun copyFileToUrl(context: Context, uri: Uri,outUri:Uri) : Boolean{
val contentResolver = context.contentResolver
contentResolver?.openInputStream(uri)?.use { uriStream ->

View File

@@ -17,6 +17,7 @@ object LanguageHelper : ILog {
const val ZH = "zh"
const val EN = "en"
const val AR = "ar"
const val TR = "tr"
private var currentLocale: Locale? = null
@@ -59,6 +60,8 @@ object LanguageHelper : ILog {
ZH
} else if (locale.language.equals("ar", true)) {
return AR
} else if (locale.language.equals("tr", true)) {
return TR
} else {
EN
}
@@ -67,11 +70,13 @@ object LanguageHelper : ILog {
fun getH5GameLeaderccLan(): String {
val locale = getCurrentLanguage()
return if (locale == Locale.ENGLISH) {
"en-Us"
"en-US"
} else if (locale == Locale.TRADITIONAL_CHINESE) {
"zh-Tw"
"zh-TW"
} else if (locale.language.equals("ar", true)) {
return "ar-EG"
} else if (locale.language.equals("tr", true)) {
return "tr-TR"
} else {
"en-Us"
}
@@ -94,6 +99,9 @@ object LanguageHelper : ILog {
AR -> {
Locale("ar")
}
TR -> {
Locale("tr")
}
else -> {
null
@@ -191,6 +199,9 @@ object LanguageHelper : ILog {
AR -> {
return Locale("ar")
}
TR -> {
return Locale("tr")
}
EN -> {
return Locale.ENGLISH