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