implement the prev/next button functionality
This commit is contained in:
parent
81857948be
commit
7f32e650c7
4 changed files with 26 additions and 15 deletions
|
@ -176,6 +176,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
val mimeType = getUriMimeType(mUri.toString(), newUri)
|
val mimeType = getUriMimeType(mUri.toString(), newUri)
|
||||||
Intent(applicationContext, VideoPlayerActivity::class.java).apply {
|
Intent(applicationContext, VideoPlayerActivity::class.java).apply {
|
||||||
setDataAndType(newUri, mimeType)
|
setDataAndType(newUri, mimeType)
|
||||||
|
addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT)
|
||||||
if (intent.extras != null) {
|
if (intent.extras != null) {
|
||||||
putExtras(intent.extras!!)
|
putExtras(intent.extras!!)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simplemobiletools.gallery.pro.activities
|
package com.simplemobiletools.gallery.pro.activities
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Intent
|
||||||
import android.content.pm.ActivityInfo
|
import android.content.pm.ActivityInfo
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
|
@ -547,11 +549,19 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleNextFile() {
|
private fun handleNextFile() {
|
||||||
|
Intent().apply {
|
||||||
|
putExtra(GO_TO_NEXT_ITEM, true)
|
||||||
|
setResult(Activity.RESULT_OK, this)
|
||||||
|
}
|
||||||
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handlePrevFile() {
|
private fun handlePrevFile() {
|
||||||
|
Intent().apply {
|
||||||
|
putExtra(GO_TO_PREV_ITEM, true)
|
||||||
|
setResult(Activity.RESULT_OK, this)
|
||||||
|
}
|
||||||
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun resetPlayWhenReady() {
|
private fun resetPlayWhenReady() {
|
||||||
|
|
|
@ -910,18 +910,18 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
||||||
if (requestCode == REQUEST_EDIT_IMAGE) {
|
if (requestCode == REQUEST_EDIT_IMAGE && resultCode == Activity.RESULT_OK && resultData != null) {
|
||||||
if (resultCode == Activity.RESULT_OK && resultData != null) {
|
mPos = -1
|
||||||
mPos = -1
|
mPrevHashcode = 0
|
||||||
mPrevHashcode = 0
|
refreshViewPager()
|
||||||
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)
|
super.onActivityResult(requestCode, resultCode, resultData)
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,13 +94,13 @@ const val SHOW_FAVORITES = "show_favorites"
|
||||||
const val SHOW_RECYCLE_BIN = "show_recycle_bin"
|
const val SHOW_RECYCLE_BIN = "show_recycle_bin"
|
||||||
const val SHOW_NEXT_ITEM = "show_next_item"
|
const val SHOW_NEXT_ITEM = "show_next_item"
|
||||||
const val SHOW_PREV_ITEM = "show_prev_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 MAX_COLUMN_COUNT = 20
|
||||||
const val SHOW_TEMP_HIDDEN_DURATION = 300000L
|
const val SHOW_TEMP_HIDDEN_DURATION = 300000L
|
||||||
const val CLICK_MAX_DURATION = 150
|
const val CLICK_MAX_DURATION = 150
|
||||||
const val DRAG_THRESHOLD = 8
|
const val DRAG_THRESHOLD = 8
|
||||||
const val MONTH_MILLISECONDS = MONTH_SECONDS * 1000L
|
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 MIN_SKIP_LENGTH = 2000
|
||||||
|
|
||||||
const val DIRECTORY = "directory"
|
const val DIRECTORY = "directory"
|
||||||
|
|
Loading…
Reference in a new issue