diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt index c5352c5e3..224b58325 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt @@ -176,6 +176,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList val mimeType = getUriMimeType(mUri.toString(), newUri) Intent(applicationContext, VideoPlayerActivity::class.java).apply { setDataAndType(newUri, mimeType) + addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT) if (intent.extras != null) { putExtras(intent.extras!!) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index e87253269..2bc592402 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -1,5 +1,7 @@ package com.simplemobiletools.gallery.pro.activities +import android.app.Activity +import android.content.Intent import android.content.pm.ActivityInfo import android.content.res.Configuration import android.graphics.Color @@ -547,11 +549,19 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen } private fun handleNextFile() { - + Intent().apply { + putExtra(GO_TO_NEXT_ITEM, true) + setResult(Activity.RESULT_OK, this) + } + finish() } private fun handlePrevFile() { - + Intent().apply { + putExtra(GO_TO_PREV_ITEM, true) + setResult(Activity.RESULT_OK, this) + } + finish() } private fun resetPlayWhenReady() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index dfe90ffc5..6edf32c38 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -910,18 +910,18 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) { - if (requestCode == REQUEST_EDIT_IMAGE) { - if (resultCode == Activity.RESULT_OK && resultData != null) { - mPos = -1 - mPrevHashcode = 0 - refreshViewPager() + if (requestCode == REQUEST_EDIT_IMAGE && resultCode == Activity.RESULT_OK && resultData != null) { + mPos = -1 + mPrevHashcode = 0 + refreshViewPager() + } else if (requestCode == REQUEST_SET_AS && resultCode == Activity.RESULT_OK) { + toast(R.string.wallpaper_set_successfully) + } else if (requestCode == REQUEST_VIEW_VIDEO && resultCode == Activity.RESULT_OK && resultData != null) { + if (resultData.getBooleanExtra(GO_TO_NEXT_ITEM, false)) { + goToNextItem() + } else if (resultData.getBooleanExtra(GO_TO_PREV_ITEM, false)) { + goToPrevItem() } - } else if (requestCode == REQUEST_SET_AS) { - if (resultCode == Activity.RESULT_OK) { - toast(R.string.wallpaper_set_successfully) - } - } else if (requestCode == REQUEST_VIEW_VIDEO) { - } super.onActivityResult(requestCode, resultCode, resultData) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index 1e06716ea..d0c1d72e4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -94,13 +94,13 @@ const val SHOW_FAVORITES = "show_favorites" const val SHOW_RECYCLE_BIN = "show_recycle_bin" const val SHOW_NEXT_ITEM = "show_next_item" const val SHOW_PREV_ITEM = "show_prev_item" +const val GO_TO_NEXT_ITEM = "go_to_next_item" +const val GO_TO_PREV_ITEM = "go_to_prev_item" const val MAX_COLUMN_COUNT = 20 const val SHOW_TEMP_HIDDEN_DURATION = 300000L const val CLICK_MAX_DURATION = 150 const val DRAG_THRESHOLD = 8 const val MONTH_MILLISECONDS = MONTH_SECONDS * 1000L -const val HIDE_PLAY_PAUSE_DELAY = 500L -const val PLAY_PAUSE_VISIBLE_ALPHA = 0.8f const val MIN_SKIP_LENGTH = 2000 const val DIRECTORY = "directory"