fix: bugfix
This commit is contained in:
@@ -115,7 +115,7 @@ class RoomLuckyBagDialog : BaseDialogFragment<DialogRoomLuckyBagBinding>() {
|
|||||||
if (mIsGiftReview) {
|
if (mIsGiftReview) {
|
||||||
if (position.isVerify(mGiftDataSelect)) {
|
if (position.isVerify(mGiftDataSelect)) {
|
||||||
val data = mGiftDataSelect[position]
|
val data = mGiftDataSelect[position]
|
||||||
data.count = data.count.plus(1)
|
data.count = data.count.plus(1).coerceAtMost(99)
|
||||||
mGiftAdapter.notifyItemChanged(position,1)
|
mGiftAdapter.notifyItemChanged(position,1)
|
||||||
mGiftDataSelectPos.forEach { (t, u) ->
|
mGiftDataSelectPos.forEach { (t, u) ->
|
||||||
if (u.giftId == data.giftId) {
|
if (u.giftId == data.giftId) {
|
||||||
@@ -128,7 +128,7 @@ class RoomLuckyBagDialog : BaseDialogFragment<DialogRoomLuckyBagBinding>() {
|
|||||||
}else{
|
}else{
|
||||||
if (position.isVerify(mGiftData)) {
|
if (position.isVerify(mGiftData)) {
|
||||||
val data = mGiftData[position]
|
val data = mGiftData[position]
|
||||||
data.count = data.count.plus(1)
|
data.count = data.count.plus(1).coerceAtMost(99)
|
||||||
mGiftAdapter.notifyItemChanged(position,1)
|
mGiftAdapter.notifyItemChanged(position,1)
|
||||||
mGiftDataSelectPos[position] = data
|
mGiftDataSelectPos[position] = data
|
||||||
}
|
}
|
||||||
|
@@ -934,12 +934,22 @@ open class BaseRoomFragment<V : IBaseRoomView?, P1 : BaseRoomPresenter<V>?> :
|
|||||||
|
|
||||||
//todo do - 发送图片消息
|
//todo do - 发送图片消息
|
||||||
private fun sendImgMsg() {
|
private fun sendImgMsg() {
|
||||||
if (VipHelper.roomPicScreen(UserModel.get().cacheLoginUserInfo)) {
|
UserModel.get().cacheLoginUserInfo?.let {
|
||||||
activity?.let {
|
UserModel.get().getUserInfoFromServerUpdate(it.uid,true)
|
||||||
PhotoPickActivity.startImg(it)
|
.compose(bindToLifecycle())
|
||||||
}
|
.doOnSuccess { user->
|
||||||
} else {
|
if (VipHelper.roomPicScreen(user)) {
|
||||||
dialogManager?.showOkDialog(R.string._ver_24_sentImgVipError.getString())
|
activity?.let { act->
|
||||||
|
PhotoPickActivity.startImg(act)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dialogManager?.showOkDialog(R.string._ver_24_sentImgVipError.getString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.doOnError {
|
||||||
|
it?.message?.doToast()
|
||||||
|
}
|
||||||
|
.subscribe()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1750,7 +1750,7 @@ public class MessageView extends FrameLayout {
|
|||||||
TextView tvCpContent = baseViewHolder.itemView.findViewById(R.id.cpTv);
|
TextView tvCpContent = baseViewHolder.itemView.findViewById(R.id.cpTv);
|
||||||
if (tvContent != null && tvCpContent != null ) {
|
if (tvContent != null && tvCpContent != null ) {
|
||||||
|
|
||||||
OtherExtKt.setAutoSizeModel(tvCpContent);
|
OtherExtKt.setAutoSizeModel(tvCpContent,8,14);
|
||||||
|
|
||||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent);
|
TextSpannableBuilder text = new TextSpannableBuilder(tvContent);
|
||||||
MsgAttachment attachment = chatRoomMessage.getAttachment();
|
MsgAttachment attachment = chatRoomMessage.getAttachment();
|
||||||
@@ -1886,16 +1886,15 @@ public class MessageView extends FrameLayout {
|
|||||||
|
|
||||||
|
|
||||||
if (data.isCpInRoom()) {
|
if (data.isCpInRoom()) {
|
||||||
message = ResourcesKtxKt.getString(R.string._ver_24_cpInRoomTips, cpNickStr,cpNameStr, nickStr);
|
if (OtherExtKt.isRtl(getContext())) {
|
||||||
|
message = ResourcesKtxKt.getString(R.string._ver_24_cpInRoomTips, cpNickStr, nickStr,cpNameStr);
|
||||||
|
} else {
|
||||||
|
message = ResourcesKtxKt.getString(R.string._ver_24_cpInRoomTips, cpNickStr,cpNameStr, nickStr);
|
||||||
|
}
|
||||||
tvCpContent.setBackgroundResource(R.drawable.ic_msg_room_msg_cp_bg_enter);
|
tvCpContent.setBackgroundResource(R.drawable.ic_msg_room_msg_cp_bg_enter);
|
||||||
|
|
||||||
if (OtherExtKt.isRtl(tvCpContent.getContext())) {
|
textStyles.add(cpNick);
|
||||||
textStyles.add(cpNick);
|
textStyles.add(nick);
|
||||||
textStyles.add(nick);
|
|
||||||
} else {
|
|
||||||
textStyles.add(cpNick);
|
|
||||||
textStyles.add(nick);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (data.isCpUpMic()) {
|
} else if (data.isCpUpMic()) {
|
||||||
message = ResourcesKtxKt.getString(R.string._ver_24_cpUpMicTips, cpNameStr, nickStr,cpNickStr);
|
message = ResourcesKtxKt.getString(R.string._ver_24_cpUpMicTips, cpNameStr, nickStr,cpNickStr);
|
||||||
|
@@ -8,7 +8,6 @@ import com.chwl.app.R
|
|||||||
import com.chwl.app.application.IReportConstants
|
import com.chwl.app.application.IReportConstants
|
||||||
import com.chwl.app.application.ReportManager
|
import com.chwl.app.application.ReportManager
|
||||||
import com.chwl.app.avroom.adapter.CommonVPAdapter
|
import com.chwl.app.avroom.adapter.CommonVPAdapter
|
||||||
import com.chwl.app.avroom.dialog.RoomLuckyBagDialog
|
|
||||||
import com.chwl.app.base.BaseViewBindingFragment
|
import com.chwl.app.base.BaseViewBindingFragment
|
||||||
import com.chwl.app.databinding.FragmentHomeBinding
|
import com.chwl.app.databinding.FragmentHomeBinding
|
||||||
import com.chwl.app.home.adapter.HomeIndicatorAdapter
|
import com.chwl.app.home.adapter.HomeIndicatorAdapter
|
||||||
@@ -16,7 +15,6 @@ import com.chwl.app.ui.search.SearchActivity
|
|||||||
import com.chwl.app.ui.widget.magicindicator.ViewPagerHelper
|
import com.chwl.app.ui.widget.magicindicator.ViewPagerHelper
|
||||||
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
|
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||||
import com.chwl.app.utils.HomeUIManager
|
import com.chwl.app.utils.HomeUIManager
|
||||||
import com.chwl.app.utils.RoomHelperManager
|
|
||||||
import com.chwl.core.DemoCache
|
import com.chwl.core.DemoCache
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,11 +42,9 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
|||||||
|
|
||||||
// val i = 1/0
|
// val i = 1/0
|
||||||
// DemoActivity.start(it)
|
// DemoActivity.start(it)
|
||||||
RoomHelperManager.test {
|
// RoomHelperManager.test {
|
||||||
RoomLuckyBagDialog().show(context)
|
// RoomLuckyBagDialog().show(context)
|
||||||
}
|
// }
|
||||||
// R.string._ver_24_cpInRoomTips.getString("string-1", "string-2", "string-3").doToastDeBug()
|
|
||||||
// R.string._ver_24_cpUpMicTips.getString("string-1", "string-2", "string-3").doToastDeBug()
|
|
||||||
// GiftDialog(it,3224,false,false,false).show()
|
// GiftDialog(it,3224,false,false,false).show()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -85,27 +85,33 @@ class GiveGoldToUserActivity : BaseViewBindingActivity<ActivityGiveGoldToUserBin
|
|||||||
}
|
}
|
||||||
val initInfo = InitialModel.get().cacheInitInfo
|
val initInfo = InitialModel.get().cacheInitInfo
|
||||||
val userInfo = UserModel.get().cacheLoginUserInfo
|
val userInfo = UserModel.get().cacheLoginUserInfo
|
||||||
val diamondList = initInfo?.giveDiamondErbanNoList
|
|
||||||
val giftList = initInfo?.giveGiftErbanNoList
|
|
||||||
|
val diamondList = initInfo?.giveDiamondErbanNoList //金币
|
||||||
|
val giftList = initInfo?.giveGiftErbanNoList // ,礼物
|
||||||
val levelSep = userInfo?.userLevelVo?.experLevelSeq ?: 0
|
val levelSep = userInfo?.userLevelVo?.experLevelSeq ?: 0
|
||||||
if (diamondList?.contains(userInfo?.erbanNo) == true || levelSep >= (initInfo?.giveDiamondExperLevel
|
|
||||||
?: 0)
|
if (userInfo?.isRechargeUser == true) {
|
||||||
) {
|
|
||||||
binding.tvDiamondTab.visibility = View.VISIBLE
|
binding.tvDiamondTab.visibility = View.VISIBLE
|
||||||
binding.groupDiamond.visibility = View.VISIBLE
|
binding.groupDiamond.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
binding.tvDiamondTab.visibility = View.GONE
|
if (diamondList?.contains(userInfo?.erbanNo) == true || levelSep >= (initInfo?.giveDiamondExperLevel ?: 0)) {
|
||||||
binding.groupDiamond.visibility = View.GONE
|
binding.tvDiamondTab.visibility = View.VISIBLE
|
||||||
|
binding.groupDiamond.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
binding.tvDiamondTab.visibility = View.GONE
|
||||||
|
binding.groupDiamond.visibility = View.GONE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (giftList?.contains(userInfo?.erbanNo) == true || levelSep >= (initInfo?.giveGiftExperLevel
|
|
||||||
?: 0)
|
if (giftList?.contains(userInfo?.erbanNo) == true || levelSep >= (initInfo?.giveGiftExperLevel ?: 0)) {
|
||||||
) {
|
|
||||||
binding.tvGiftTab.visibility = View.VISIBLE
|
binding.tvGiftTab.visibility = View.VISIBLE
|
||||||
binding.groupGift.visibility = View.VISIBLE
|
binding.groupGift.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
binding.tvGiftTab.visibility = View.GONE
|
binding.tvGiftTab.visibility = View.GONE
|
||||||
binding.groupGift.visibility = View.GONE
|
binding.groupGift.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.viewPagerEntrance.addOnPageChangeListener(object : OnPageSelectedListener() {
|
binding.viewPagerEntrance.addOnPageChangeListener(object : OnPageSelectedListener() {
|
||||||
override fun onPageSelected(position: Int) {
|
override fun onPageSelected(position: Int) {
|
||||||
centerIndex = position
|
centerIndex = position
|
||||||
|
@@ -144,34 +144,44 @@ object RoomHelperManager {
|
|||||||
fun sendPicMsg(fragment: BaseRoomFragment<*, *>, data: Intent?) {
|
fun sendPicMsg(fragment: BaseRoomFragment<*, *>, data: Intent?) {
|
||||||
fragment?.context?.let { context ->
|
fragment?.context?.let { context ->
|
||||||
data?.data?.let { uri ->
|
data?.data?.let { uri ->
|
||||||
val date = Date(System.currentTimeMillis())
|
try {
|
||||||
val dateFormat = SimpleDateFormat("MMddHHmmssSS")
|
val date = Date(System.currentTimeMillis())
|
||||||
val nowTime = dateFormat.format(date)
|
val dateFormat = SimpleDateFormat("MMddHHmmssSS")
|
||||||
val localeUri = Uri.parse("file://${FileHelper.getRootCacheDir()?.path}/${nowTime}.jpg")
|
val nowTime = dateFormat.format(date)
|
||||||
|
val localeUri = Uri.parse("file://${FileHelper.getRootCacheDir()?.path}/${nowTime}.jpg")
|
||||||
|
|
||||||
val isCopy = MyUriUtils.copyFileToUrl(context, uri, localeUri)
|
val isCopy = MyUriUtils.copyFileToUrl(context, uri, localeUri)
|
||||||
if (isCopy) {
|
if (isCopy) {
|
||||||
if (MyUriUtils.isGif(context, localeUri)) {
|
if (MyUriUtils.isGif(context, localeUri)) {
|
||||||
ToastUtils.show(R.string.error_file_type)
|
ToastUtils.show(R.string.error_file_type)
|
||||||
|
} else {
|
||||||
|
FileModel.get().uploadFile(localeUri.path)
|
||||||
|
.compose(fragment.bindToLifecycle())
|
||||||
|
.doOnSuccess { ossUrl ->
|
||||||
|
"图片上传oss成功".doToastDeBug()
|
||||||
|
try {
|
||||||
|
postSendPic(AvRoomDataManager.get().roomUid, ossUrl)
|
||||||
|
.compose(fragment.bindToLifecycle())
|
||||||
|
.doOnSuccess {
|
||||||
|
R.string.sent_success.doToast()
|
||||||
|
}
|
||||||
|
.doOnError {
|
||||||
|
it?.message?.doToast()
|
||||||
|
}
|
||||||
|
.subscribe()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
R.string.avroom_activity_roomblacklistactivity_015.doToast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.doOnError {
|
||||||
|
it?.message?.doToast()
|
||||||
|
}.subscribe()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
FileModel.get().uploadFile(localeUri.path)
|
R.string.avroom_activity_roomblacklistactivity_015.doToast()
|
||||||
.compose(fragment.bindToLifecycle())
|
|
||||||
.doOnSuccess { ossUrl ->
|
|
||||||
"图片上传oss成功".doToastDeBug()
|
|
||||||
postSendPic(AvRoomDataManager.get().roomUid, ossUrl)
|
|
||||||
.compose(fragment.bindToLifecycle())
|
|
||||||
.doOnSuccess {
|
|
||||||
R.string.sent_success.doToast()
|
|
||||||
}
|
|
||||||
.doOnError {
|
|
||||||
it?.message?.doToast()
|
|
||||||
}
|
|
||||||
.subscribe()
|
|
||||||
}
|
|
||||||
.doOnError {
|
|
||||||
it?.message?.doToast()
|
|
||||||
}.subscribe()
|
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
R.string.avroom_activity_roomblacklistactivity_015.doToast()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -72,6 +72,8 @@
|
|||||||
app:borderColor="#ffd168"
|
app:borderColor="#ffd168"
|
||||||
app:borderRadius="50dp"
|
app:borderRadius="50dp"
|
||||||
app:borderWidth="2dp"
|
app:borderWidth="2dp"
|
||||||
|
android:padding="2dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tabLayout" />
|
app:layout_constraintTop_toBottomOf="@id/tabLayout" />
|
||||||
|
@@ -21,7 +21,9 @@
|
|||||||
android:layout_height="77dp"
|
android:layout_height="77dp"
|
||||||
app:borderColor="@color/color_FFEA5C"
|
app:borderColor="@color/color_FFEA5C"
|
||||||
app:borderWidth="1dp"
|
app:borderWidth="1dp"
|
||||||
|
android:padding="1dp"
|
||||||
app:borderRadius="50dp"
|
app:borderRadius="50dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
android:src="@drawable/default_avatar"
|
android:src="@drawable/default_avatar"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
@@ -17,11 +17,15 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_number"
|
android:id="@+id/tv_number"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/tv_pay_diamond"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:textColor="@color/color_1F1A4E"
|
android:textColor="@color/color_1F1A4E"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
|
android:lines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginBottom="3dp"
|
android:layout_marginBottom="3dp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintBottom_toTopOf="@id/erBanNo"
|
app:layout_constraintBottom_toTopOf="@id/erBanNo"
|
||||||
|
@@ -16,12 +16,15 @@
|
|||||||
<com.chwl.core.widget.img.MyCircleImageView
|
<com.chwl.core.widget.img.MyCircleImageView
|
||||||
android:id="@+id/avatar"
|
android:id="@+id/avatar"
|
||||||
android:layout_width="26dp"
|
android:layout_width="26dp"
|
||||||
|
android:src="@drawable/default_avatar"
|
||||||
android:layout_height="26dp"
|
android:layout_height="26dp"
|
||||||
android:layout_marginStart="9dp"
|
android:layout_marginStart="9dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
android:layout_marginTop="9dp"
|
android:layout_marginTop="9dp"
|
||||||
app:borderColor="@color/color_FFEA5C"
|
app:borderColor="@color/color_FFEA5C"
|
||||||
app:borderRadius="50dp"
|
app:borderRadius="25dp"
|
||||||
app:borderWidth="1dp"
|
android:padding="1dp"
|
||||||
|
app:borderWidth="2dp"
|
||||||
app:layout_constraintStart_toStartOf="@id/bg"
|
app:layout_constraintStart_toStartOf="@id/bg"
|
||||||
app:layout_constraintTop_toTopOf="@id/bg" />
|
app:layout_constraintTop_toTopOf="@id/bg" />
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textSize="15sp"
|
android:textSize="@dimen/sp_15"
|
||||||
tools:text="@string/layout_list_item_chatrrom_msg_01"
|
tools:text="@string/layout_list_item_chatrrom_msg_01"
|
||||||
tools:textColor="#000" />
|
tools:textColor="#000" />
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:gravity="start|center_vertical"
|
android:gravity="start|center_vertical"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textSize="13sp"
|
android:textSize="@dimen/sp_13"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:paddingStart="9dp"
|
android:paddingStart="9dp"
|
||||||
|
@@ -12,10 +12,14 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="100dp"/>
|
android:layout_height="100dp"/>
|
||||||
|
|
||||||
<ImageView
|
<com.chwl.core.widget.img.MyCircleImageView
|
||||||
android:id="@+id/avatar"
|
android:id="@+id/avatar"
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
|
app:borderColor="#ffd168"
|
||||||
|
app:borderWidth="2dp"
|
||||||
|
app:borderRadius="25dp"
|
||||||
|
android:padding="1dp"
|
||||||
android:layout_marginStart="18dp"
|
android:layout_marginStart="18dp"
|
||||||
android:layout_marginBottom="7dp"
|
android:layout_marginBottom="7dp"
|
||||||
android:src="@drawable/default_avatar"
|
android:src="@drawable/default_avatar"
|
||||||
|
@@ -5406,7 +5406,7 @@
|
|||||||
<string name="_ver_24_lucky_bag_bili_sent">أرسلت حقيبة الحظ</string>
|
<string name="_ver_24_lucky_bag_bili_sent">أرسلت حقيبة الحظ</string>
|
||||||
<string name="_ver_24_Mins_s">دقائق</string>
|
<string name="_ver_24_Mins_s">دقائق</string>
|
||||||
|
|
||||||
<string name="_ver_24_cpInRoomTips">لقد دخل %2$s %3$s من %1$s إلى الغرفة.</string>
|
<string name="_ver_24_cpInRoomTips">لقد دخل %s %s من %s إلى الغرفة.</string>
|
||||||
<string name="_ver_24_cpUpMicTips">%1$s %2$s & %3$s كلاهما على الميكروفون!</string>
|
<string name="_ver_24_cpUpMicTips">%1$s %2$s & %3$s كلاهما على الميكروفون!</string>
|
||||||
<string name="_ver_24_lucky_bag_room_notify_coin">نرسل حقيبة الحظ عملة! تعال وانضم إلينا!</string>
|
<string name="_ver_24_lucky_bag_room_notify_coin">نرسل حقيبة الحظ عملة! تعال وانضم إلينا!</string>
|
||||||
<string name="Sweet_Duo">ثنائي رائع</string>
|
<string name="Sweet_Duo">ثنائي رائع</string>
|
||||||
|
@@ -158,9 +158,16 @@ object MyUriUtils {
|
|||||||
try {
|
try {
|
||||||
val contentResolver = context.contentResolver
|
val contentResolver = context.contentResolver
|
||||||
contentResolver?.openInputStream(uri)?.use { uriStream ->
|
contentResolver?.openInputStream(uri)?.use { uriStream ->
|
||||||
contentResolver?.openOutputStream(outUri, "wt")?.use { outStream ->
|
try {
|
||||||
uriStream.copyTo(outStream)
|
contentResolver?.openOutputStream(outUri, "wt")?.use { outStream ->
|
||||||
return true
|
try {
|
||||||
|
uriStream.copyTo(outStream)
|
||||||
|
return true
|
||||||
|
} catch (e: Exception) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@@ -5,6 +5,7 @@ import android.graphics.Color
|
|||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.text.Spannable
|
import android.text.Spannable
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import android.util.TypedValue
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewGroup.MarginLayoutParams
|
import android.view.ViewGroup.MarginLayoutParams
|
||||||
@@ -129,11 +130,19 @@ fun TextView.setString(str:String) {
|
|||||||
this.text = str
|
this.text = str
|
||||||
}
|
}
|
||||||
|
|
||||||
fun TextView.setAutoSizeModel() {
|
fun TextView.setAutoSizeModel(minSize:Int?=null,maxSize:Int?=null) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
this.setAutoSizeTextTypeWithDefaults(TextView.AUTO_SIZE_TEXT_TYPE_UNIFORM)
|
if (minSize != null && maxSize != null) {
|
||||||
|
this.setAutoSizeTextTypeUniformWithConfiguration(minSize, maxSize, 1, TypedValue.COMPLEX_UNIT_SP)
|
||||||
|
} else {
|
||||||
|
this.setAutoSizeTextTypeWithDefaults(TextView.AUTO_SIZE_TEXT_TYPE_UNIFORM)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
TextViewCompat.setAutoSizeTextTypeWithDefaults(this,TextViewCompat.AUTO_SIZE_TEXT_TYPE_UNIFORM)
|
if (minSize != null && maxSize != null) {
|
||||||
|
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(this,minSize, maxSize, 1, TypedValue.COMPLEX_UNIT_SP)
|
||||||
|
} else {
|
||||||
|
TextViewCompat.setAutoSizeTextTypeWithDefaults(this,TextViewCompat.AUTO_SIZE_TEXT_TYPE_UNIFORM)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user