From e2f396f8c7ee988e5f6591a531c3c50fbc177677 Mon Sep 17 00:00:00 2001 From: juntao Date: Fri, 8 Jan 2021 10:03:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8D=95=E6=8A=93=E8=A7=86=E9=A2=91=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=95=B0=E6=8D=AE=E5=BA=93=E6=BB=A1=E4=BA=86=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gh/common/videolog/VideoRecordUtils.kt | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/gh/common/videolog/VideoRecordUtils.kt b/app/src/main/java/com/gh/common/videolog/VideoRecordUtils.kt index a82dfc46a8..a1d24f00a6 100644 --- a/app/src/main/java/com/gh/common/videolog/VideoRecordUtils.kt +++ b/app/src/main/java/com/gh/common/videolog/VideoRecordUtils.kt @@ -2,7 +2,9 @@ package com.gh.common.videolog import android.annotation.SuppressLint import android.app.Application +import android.database.sqlite.SQLiteFullException import com.gh.common.util.toRequestBody +import com.gh.common.util.toastInInternalRelease import com.gh.gamecenter.manager.UserManager import com.gh.gamecenter.retrofit.BiResponse import com.gh.gamecenter.retrofit.RetrofitManager @@ -26,8 +28,13 @@ object VideoRecordUtils { mApplication = application videoRecordExecutor.execute { - val recordList = videoRecordDao.getAll() - videoRecordSet.addAll(recordList) + try { + val recordList = videoRecordDao.getAll() + videoRecordSet.addAll(recordList) + } catch (e: SQLiteFullException) { + e.printStackTrace() + toastInInternalRelease("数据库/磁盘已满,写入视频新日志失败") + } } } @@ -39,6 +46,9 @@ object VideoRecordUtils { videoRecordDao.insert(entity) } catch (e: Exception) { e.printStackTrace() + if (e is SQLiteFullException) { + toastInInternalRelease("数据库/磁盘已满,写入视频新日志失败") + } } if (videoRecordSet.size >= STORE_SIZE) { commitVideoRecord() @@ -52,7 +62,11 @@ object VideoRecordUtils { uploadVideoRecord() val exposureList = videoRecordSet.toList() videoRecordSet.removeAll(exposureList) - videoRecordDao.deleteMany(exposureList) + try { + videoRecordDao.deleteMany(exposureList) + } catch (e: SQLiteFullException) { + toastInInternalRelease("数据库/磁盘已满,删除视频日志失败") + } } }