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() {
|
||||
if (!mIsThirdPartyIntent) {
|
||||
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)
|
||||
|
||||
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? {
|
||||
val file = File(resultData.data!!.path!!)
|
||||
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() {
|
||||
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)
|
||||
|
||||
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) {
|
||||
hideKeyboard()
|
||||
if (isSetWallpaperIntent()) {
|
||||
|
|
|
@ -85,6 +85,11 @@ open class PanoramaPhotoActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
setupButtonMargins()
|
||||
}
|
||||
|
||||
private fun checkIntent() {
|
||||
val path = intent.getStringExtra(PATH)
|
||||
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? {
|
||||
val options = BitmapFactory.Options()
|
||||
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() {
|
||||
val path = intent.getStringExtra(PATH)
|
||||
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) {
|
||||
mDuration = (duration / 1000).toInt()
|
||||
video_seekbar.max = mDuration
|
||||
|
|
|
@ -37,7 +37,6 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
showTransparentTop = true
|
||||
//showTransparentNavigation = true
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
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() {
|
||||
val visibleBottomActions = if (config.bottomActions) config.visibleBottomActions else 0
|
||||
|
||||
|
@ -279,19 +291,6 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
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) {
|
||||
ensureBackgroundThread {
|
||||
if (isPathPresentInMediaStore(path)) {
|
||||
|
|
|
@ -60,8 +60,6 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
|||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
showTransparentTop = true
|
||||
//showTransparentNavigation = true
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_video_player)
|
||||
setupOptionsMenu()
|
||||
|
@ -189,7 +187,6 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
|||
video_prev_file.beVisibleIf(intent.getBooleanExtra(SHOW_PREV_ITEM, false))
|
||||
video_prev_file.setOnClickListener { handlePrevFile() }
|
||||
|
||||
|
||||
val gestureDetector = GestureDetector(this, object : GestureDetector.SimpleOnGestureListener() {
|
||||
override fun onDoubleTap(e: MotionEvent): Boolean {
|
||||
handleDoubleTap(e.rawX)
|
||||
|
@ -658,8 +655,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
|||
mIsDragged = false
|
||||
}
|
||||
|
||||
override fun onSurfaceTextureUpdated(surface: SurfaceTexture) {
|
||||
}
|
||||
override fun onSurfaceTextureUpdated(surface: SurfaceTexture) {}
|
||||
|
||||
override fun onSurfaceTextureDestroyed(surface: SurfaceTexture) = false
|
||||
|
||||
|
|
|
@ -90,8 +90,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
showTransparentTop = true
|
||||
//showTransparentNavigation = true
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_medium)
|
||||
setupOptionsMenu()
|
||||
|
|
Loading…
Reference in a new issue