房间公告入口文字居中,去除CancellationException的toast
This commit is contained in:
@@ -5,6 +5,7 @@ import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.nnbc123.core.utils.toast
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@@ -15,7 +16,11 @@ open class BaseViewModel : ViewModel() {
|
||||
|
||||
fun safeLaunch(
|
||||
needLoading: Boolean = false,
|
||||
onError: (e: Throwable) -> Unit = { it.message.toast() },
|
||||
onError: (e: Throwable) -> Unit = {
|
||||
if (it !is CancellationException) {
|
||||
it.message.toast()
|
||||
}
|
||||
},
|
||||
onComplete: (() -> Unit)? = null,
|
||||
block: suspend CoroutineScope.() -> Unit
|
||||
) {
|
||||
|
@@ -87,7 +87,7 @@ class CpViewModel : BaseViewModel() {
|
||||
fun getCpRelation(uid: Long) {
|
||||
|
||||
safeLaunch(
|
||||
true,
|
||||
false,
|
||||
block = {
|
||||
CpModel.userCpRelation(uid)?.let {
|
||||
_cpRelation.value = it
|
||||
|
@@ -41,8 +41,7 @@
|
||||
android:layout_marginStart="15dp"
|
||||
android:background="@drawable/shape_white_alpha_10_radius_100"
|
||||
android:drawableStart="@drawable/ic_notice_board"
|
||||
android:drawablePadding="3dp"
|
||||
android:gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:onClick="@{click}"
|
||||
android:paddingStart="6dp"
|
||||
|
@@ -25,5 +25,5 @@ only_arm64=false
|
||||
|
||||
channel_file=channel.txt
|
||||
|
||||
version_name=1.0.1
|
||||
version_code=101
|
||||
version_name=1.1.0
|
||||
version_code=110
|
Reference in New Issue
Block a user