fixing some crashes
This commit is contained in:
parent
e599087b81
commit
654b3c353b
3 changed files with 13 additions and 9 deletions
|
@ -1122,7 +1122,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
dirs.removeAll(invalidDirs)
|
||||
setupAdapter(dirs)
|
||||
invalidDirs.forEach {
|
||||
try {
|
||||
mDirectoryDao.deleteDirPath(it.path)
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.database.Cursor
|
||||
import android.database.sqlite.SQLiteException
|
||||
import android.graphics.Point
|
||||
import android.graphics.drawable.PictureDrawable
|
||||
import android.media.AudioManager
|
||||
|
@ -477,7 +476,7 @@ fun Context.getCachedDirectories(getVideosOnly: Boolean = false, getImagesOnly:
|
|||
Thread {
|
||||
val directories = try {
|
||||
directoryDao.getAll() as ArrayList<Directory>
|
||||
} catch (e: SQLiteException) {
|
||||
} catch (e: Exception) {
|
||||
ArrayList<Directory>()
|
||||
}
|
||||
|
||||
|
|
|
@ -243,12 +243,14 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
// avoid GIFs being skewed, played in wrong aspect ratio
|
||||
if (mMedium.isGIF()) {
|
||||
mView.onGlobalLayout {
|
||||
if (activity != null) {
|
||||
measureScreen()
|
||||
Handler().postDelayed({
|
||||
mView.gif_view_frame.controller.resetState()
|
||||
loadGif()
|
||||
}, 50)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
hideZoomableView()
|
||||
loadImage()
|
||||
|
@ -286,7 +288,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
|
||||
private fun measureScreen() {
|
||||
val metrics = DisplayMetrics()
|
||||
activity!!.windowManager.defaultDisplay.getRealMetrics(metrics)
|
||||
activity?.windowManager?.defaultDisplay?.getRealMetrics(metrics)
|
||||
mScreenWidth = metrics.widthPixels
|
||||
mScreenHeight = metrics.heightPixels
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue