Update CrashHandler

This commit is contained in:
Ash 2022-04-08 22:45:18 +08:00
parent 25009e9036
commit ed808c768a
5 changed files with 10 additions and 18 deletions

View File

@ -13,8 +13,8 @@ android {
applicationId "me.ash.reader" applicationId "me.ash.reader"
minSdk 26 minSdk 26
targetSdk 32 targetSdk 32
versionCode 3 versionCode 4
versionName "0.6.5" versionName "0.7.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables { vectorDrawables {

View File

@ -11,8 +11,8 @@
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"attributes": [], "attributes": [],
"versionCode": 3, "versionCode": 4,
"versionName": "0.6.5", "versionName": "0.7.0",
"outputFile": "app-release.apk" "outputFile": "app-release.apk"
} }
], ],

View File

@ -6,14 +6,13 @@ import java.lang.Thread.UncaughtExceptionHandler
import kotlin.system.exitProcess import kotlin.system.exitProcess
class CrashHandler(private val context: Context) : UncaughtExceptionHandler { class CrashHandler(private val context: Context) : UncaughtExceptionHandler {
private val mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
init { init {
Thread.setDefaultUncaughtExceptionHandler(this) Thread.setDefaultUncaughtExceptionHandler(this)
} }
override fun uncaughtException(p0: Thread, p1: Throwable) { override fun uncaughtException(p0: Thread, p1: Throwable) {
Toast.makeText(context, p1.message, Toast.LENGTH_LONG).show() Toast.makeText(context, p1.message, Toast.LENGTH_LONG).show()
p1.printStackTrace()
android.os.Process.killProcess(android.os.Process.myPid()); android.os.Process.killProcess(android.os.Process.myPid());
exitProcess(1) exitProcess(1)
} }

View File

@ -174,9 +174,9 @@ class LocalRssRepository @Inject constructor(
return ArticleNotify(listOf(), false) return ArticleNotify(listOf(), false)
} }
try { try {
if (feed.icon == null && !articles.isNullOrEmpty()) { // if (feed.icon == null && !articles.isNullOrEmpty()) {
rssHelper.queryRssIcon(feedDao, feed, articles.first().link) // rssHelper.queryRssIcon(feedDao, feed, articles.first().link)
} // }
} catch (e: Exception) { } catch (e: Exception) {
Log.e("RLog", "queryRssIcon[${feed.name}]: ${e.message}") Log.e("RLog", "queryRssIcon[${feed.name}]: ${e.message}")
return ArticleNotify(listOf(), false) return ArticleNotify(listOf(), false)

View File

@ -4,10 +4,7 @@ import androidx.activity.compose.BackHandler
import androidx.compose.animation.* import androidx.compose.animation.*
import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.ArrowBack import androidx.compose.material.icons.rounded.ArrowBack
@ -31,7 +28,6 @@ import androidx.navigation.NavHostController
import androidx.paging.LoadState import androidx.paging.LoadState
import androidx.paging.compose.collectAsLazyPagingItems import androidx.paging.compose.collectAsLazyPagingItems
import androidx.work.WorkInfo import androidx.work.WorkInfo
import com.google.accompanist.pager.PagerState
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import me.ash.reader.R import me.ash.reader.R
@ -173,6 +169,7 @@ fun FlowPage(
// ) // )
// } // }
LazyColumn( LazyColumn(
modifier = Modifier.fillMaxSize(),
state = viewState.listState, state = viewState.listState,
) { ) {
item { item {
@ -185,8 +182,6 @@ fun FlowPage(
}, },
desc = if (isSyncing) stringResource(R.string.syncing) else "", desc = if (isSyncing) stringResource(R.string.syncing) else "",
) )
}
item {
AnimatedVisibility( AnimatedVisibility(
visible = markAsRead, visible = markAsRead,
enter = fadeIn() + expandVertically(), enter = fadeIn() + expandVertically(),
@ -211,8 +206,6 @@ fun FlowPage(
) )
) )
} }
}
item {
AnimatedVisibility( AnimatedVisibility(
visible = onSearch, visible = onSearch,
enter = fadeIn() + expandVertically(), enter = fadeIn() + expandVertically(),