fix #948, add third party intent files in the db at Review intent action

This commit is contained in:
tibbi 2018-12-17 16:14:51 +01:00
parent d0f580dec7
commit 050a62ca80

View file

@ -80,6 +80,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
var screenHeight = 0 var screenHeight = 0
} }
@TargetApi(Build.VERSION_CODES.P)
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_medium) setContentView(R.layout.activity_medium)
@ -337,6 +338,24 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
} }
} }
if (intent.action == "com.android.camera.action.REVIEW") {
Thread {
if (galleryDB.MediumDao().getMediaFromPath(mPath).isEmpty()) {
val type = when {
mPath.isVideoFast() -> TYPE_VIDEOS
mPath.isGif() -> TYPE_GIFS
mPath.isSvg() -> TYPE_SVGS
mPath.isRawFast() -> TYPE_RAWS
else -> TYPE_IMAGES
}
val duration = if (type == TYPE_VIDEOS) mPath.getVideoDuration() else 0
val medium = Medium(null, mPath.getFilenameFromPath(), mPath, mPath.getParentPath(), System.currentTimeMillis(), System.currentTimeMillis(), File(mPath).length(), type, duration, false, 0)
galleryDB.MediumDao().insert(medium)
}
}.start()
}
} }
private fun initBottomActions() { private fun initBottomActions() {