reordering some functions
This commit is contained in:
parent
0f5fef8509
commit
61f51a340f
7 changed files with 64 additions and 71 deletions
|
@ -308,6 +308,36 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
||||||
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
|
if (requestCode == PICK_MEDIA && resultData != null) {
|
||||||
|
val resultIntent = Intent()
|
||||||
|
var resultUri: Uri? = null
|
||||||
|
if (mIsThirdPartyIntent) {
|
||||||
|
when {
|
||||||
|
intent.extras?.containsKey(MediaStore.EXTRA_OUTPUT) == true && intent.flags and Intent.FLAG_GRANT_WRITE_URI_PERMISSION != 0 -> {
|
||||||
|
resultUri = fillExtraOutput(resultData)
|
||||||
|
}
|
||||||
|
resultData.extras?.containsKey(PICKED_PATHS) == true -> fillPickedPaths(resultData, resultIntent)
|
||||||
|
else -> fillIntentPath(resultData, resultIntent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultUri != null) {
|
||||||
|
resultIntent.data = resultUri
|
||||||
|
resultIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||||
|
}
|
||||||
|
|
||||||
|
setResult(Activity.RESULT_OK, resultIntent)
|
||||||
|
finish()
|
||||||
|
} else if (requestCode == PICK_WALLPAPER) {
|
||||||
|
setResult(Activity.RESULT_OK)
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.onActivityResult(requestCode, resultCode, resultData)
|
||||||
|
}
|
||||||
|
|
||||||
private fun refreshMenuItems() {
|
private fun refreshMenuItems() {
|
||||||
if (!mIsThirdPartyIntent) {
|
if (!mIsThirdPartyIntent) {
|
||||||
main_menu.getToolbar().menu.apply {
|
main_menu.getToolbar().menu.apply {
|
||||||
|
@ -802,36 +832,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
|
|
||||||
private fun isVideoType(intent: Intent) = (intent.type?.startsWith("video/") == true || intent.type == Video.Media.CONTENT_TYPE)
|
private fun isVideoType(intent: Intent) = (intent.type?.startsWith("video/") == true || intent.type == Video.Media.CONTENT_TYPE)
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
|
||||||
if (requestCode == PICK_MEDIA && resultData != null) {
|
|
||||||
val resultIntent = Intent()
|
|
||||||
var resultUri: Uri? = null
|
|
||||||
if (mIsThirdPartyIntent) {
|
|
||||||
when {
|
|
||||||
intent.extras?.containsKey(MediaStore.EXTRA_OUTPUT) == true && intent.flags and Intent.FLAG_GRANT_WRITE_URI_PERMISSION != 0 -> {
|
|
||||||
resultUri = fillExtraOutput(resultData)
|
|
||||||
}
|
|
||||||
resultData.extras?.containsKey(PICKED_PATHS) == true -> fillPickedPaths(resultData, resultIntent)
|
|
||||||
else -> fillIntentPath(resultData, resultIntent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resultUri != null) {
|
|
||||||
resultIntent.data = resultUri
|
|
||||||
resultIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
|
||||||
}
|
|
||||||
|
|
||||||
setResult(Activity.RESULT_OK, resultIntent)
|
|
||||||
finish()
|
|
||||||
} else if (requestCode == PICK_WALLPAPER) {
|
|
||||||
setResult(Activity.RESULT_OK)
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.onActivityResult(requestCode, resultCode, resultData)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun fillExtraOutput(resultData: Intent): Uri? {
|
private fun fillExtraOutput(resultData: Intent): Uri? {
|
||||||
val file = File(resultData.data!!.path!!)
|
val file = File(resultData.data!!.path!!)
|
||||||
var inputStream: InputStream? = null
|
var inputStream: InputStream? = null
|
||||||
|
|
|
@ -228,6 +228,16 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
||||||
|
if (requestCode == REQUEST_EDIT_IMAGE) {
|
||||||
|
if (resultCode == Activity.RESULT_OK && resultData != null) {
|
||||||
|
mMedia.clear()
|
||||||
|
refreshItems()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.onActivityResult(requestCode, resultCode, resultData)
|
||||||
|
}
|
||||||
|
|
||||||
private fun refreshMenuItems() {
|
private fun refreshMenuItems() {
|
||||||
val isDefaultFolder = !config.defaultFolder.isEmpty() && File(config.defaultFolder).compareTo(File(mPath)) == 0
|
val isDefaultFolder = !config.defaultFolder.isEmpty() && File(config.defaultFolder).compareTo(File(mPath)) == 0
|
||||||
|
|
||||||
|
@ -777,16 +787,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
|
|
||||||
private fun isSetWallpaperIntent() = intent.getBooleanExtra(SET_WALLPAPER_INTENT, false)
|
private fun isSetWallpaperIntent() = intent.getBooleanExtra(SET_WALLPAPER_INTENT, false)
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
|
||||||
if (requestCode == REQUEST_EDIT_IMAGE) {
|
|
||||||
if (resultCode == Activity.RESULT_OK && resultData != null) {
|
|
||||||
mMedia.clear()
|
|
||||||
refreshItems()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.onActivityResult(requestCode, resultCode, resultData)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun itemClicked(path: String) {
|
private fun itemClicked(path: String) {
|
||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
if (isSetWallpaperIntent()) {
|
if (isSetWallpaperIntent()) {
|
||||||
|
|
|
@ -85,6 +85,11 @@ open class PanoramaPhotoActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||||
|
super.onConfigurationChanged(newConfig)
|
||||||
|
setupButtonMargins()
|
||||||
|
}
|
||||||
|
|
||||||
private fun checkIntent() {
|
private fun checkIntent() {
|
||||||
val path = intent.getStringExtra(PATH)
|
val path = intent.getStringExtra(PATH)
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
|
@ -135,11 +140,6 @@ open class PanoramaPhotoActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
|
||||||
super.onConfigurationChanged(newConfig)
|
|
||||||
setupButtonMargins()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getBitmapToLoad(path: String): Bitmap? {
|
private fun getBitmapToLoad(path: String): Bitmap? {
|
||||||
val options = BitmapFactory.Options()
|
val options = BitmapFactory.Options()
|
||||||
options.inSampleSize = 1
|
options.inSampleSize = 1
|
||||||
|
|
|
@ -88,6 +88,11 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||||
|
super.onConfigurationChanged(newConfig)
|
||||||
|
setupButtons()
|
||||||
|
}
|
||||||
|
|
||||||
private fun checkIntent() {
|
private fun checkIntent() {
|
||||||
val path = intent.getStringExtra(PATH)
|
val path = intent.getStringExtra(PATH)
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
|
@ -168,11 +173,6 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
|
||||||
super.onConfigurationChanged(newConfig)
|
|
||||||
setupButtons()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setupDuration(duration: Long) {
|
private fun setupDuration(duration: Long) {
|
||||||
mDuration = (duration / 1000).toInt()
|
mDuration = (duration / 1000).toInt()
|
||||||
video_seekbar.max = mDuration
|
video_seekbar.max = mDuration
|
||||||
|
|
|
@ -37,7 +37,6 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
|
|
||||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
showTransparentTop = true
|
showTransparentTop = true
|
||||||
//showTransparentNavigation = true
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.fragment_holder)
|
setContentView(R.layout.fragment_holder)
|
||||||
|
@ -71,6 +70,19 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||||
|
super.onConfigurationChanged(newConfig)
|
||||||
|
initBottomActionsLayout()
|
||||||
|
|
||||||
|
top_shadow.layoutParams.height = statusBarHeight + actionBarHeight
|
||||||
|
(fragment_viewer_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight
|
||||||
|
if (!portrait && navigationBarOnSide && navigationBarWidth > 0) {
|
||||||
|
fragment_viewer_toolbar.setPadding(0, 0, navigationBarWidth, 0)
|
||||||
|
} else {
|
||||||
|
fragment_viewer_toolbar.setPadding(0, 0, 0, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun refreshMenuItems() {
|
fun refreshMenuItems() {
|
||||||
val visibleBottomActions = if (config.bottomActions) config.visibleBottomActions else 0
|
val visibleBottomActions = if (config.bottomActions) config.visibleBottomActions else 0
|
||||||
|
|
||||||
|
@ -279,19 +291,6 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
|
||||||
super.onConfigurationChanged(newConfig)
|
|
||||||
initBottomActionsLayout()
|
|
||||||
|
|
||||||
top_shadow.layoutParams.height = statusBarHeight + actionBarHeight
|
|
||||||
(fragment_viewer_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight
|
|
||||||
if (!portrait && navigationBarOnSide && navigationBarWidth > 0) {
|
|
||||||
fragment_viewer_toolbar.setPadding(0, 0, navigationBarWidth, 0)
|
|
||||||
} else {
|
|
||||||
fragment_viewer_toolbar.setPadding(0, 0, 0, 0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun sendViewPagerIntent(path: String) {
|
private fun sendViewPagerIntent(path: String) {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
if (isPathPresentInMediaStore(path)) {
|
if (isPathPresentInMediaStore(path)) {
|
||||||
|
|
|
@ -60,8 +60,6 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
||||||
|
|
||||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
showTransparentTop = true
|
showTransparentTop = true
|
||||||
//showTransparentNavigation = true
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_video_player)
|
setContentView(R.layout.activity_video_player)
|
||||||
setupOptionsMenu()
|
setupOptionsMenu()
|
||||||
|
@ -189,7 +187,6 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
||||||
video_prev_file.beVisibleIf(intent.getBooleanExtra(SHOW_PREV_ITEM, false))
|
video_prev_file.beVisibleIf(intent.getBooleanExtra(SHOW_PREV_ITEM, false))
|
||||||
video_prev_file.setOnClickListener { handlePrevFile() }
|
video_prev_file.setOnClickListener { handlePrevFile() }
|
||||||
|
|
||||||
|
|
||||||
val gestureDetector = GestureDetector(this, object : GestureDetector.SimpleOnGestureListener() {
|
val gestureDetector = GestureDetector(this, object : GestureDetector.SimpleOnGestureListener() {
|
||||||
override fun onDoubleTap(e: MotionEvent): Boolean {
|
override fun onDoubleTap(e: MotionEvent): Boolean {
|
||||||
handleDoubleTap(e.rawX)
|
handleDoubleTap(e.rawX)
|
||||||
|
@ -658,8 +655,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
||||||
mIsDragged = false
|
mIsDragged = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSurfaceTextureUpdated(surface: SurfaceTexture) {
|
override fun onSurfaceTextureUpdated(surface: SurfaceTexture) {}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSurfaceTextureDestroyed(surface: SurfaceTexture) = false
|
override fun onSurfaceTextureDestroyed(surface: SurfaceTexture) = false
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
showTransparentTop = true
|
showTransparentTop = true
|
||||||
//showTransparentNavigation = true
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_medium)
|
setContentView(R.layout.activity_medium)
|
||||||
setupOptionsMenu()
|
setupOptionsMenu()
|
||||||
|
|
Loading…
Reference in a new issue