Commit 5983d0ad authored by Nicolas Pomepuy's avatar Nicolas Pomepuy Committed by Geoffrey Métais
Browse files

Force Activity restart when changing medialib folders from empty view

Fixes #1051
parent 53e0e04b
...@@ -42,10 +42,7 @@ import org.videolan.vlc.gui.helpers.UiTools ...@@ -42,10 +42,7 @@ import org.videolan.vlc.gui.helpers.UiTools
import org.videolan.vlc.gui.tv.TvUtil import org.videolan.vlc.gui.tv.TvUtil
import org.videolan.vlc.gui.video.VideoGridFragment import org.videolan.vlc.gui.video.VideoGridFragment
import org.videolan.vlc.reloadLibrary import org.videolan.vlc.reloadLibrary
import org.videolan.vlc.util.AndroidDevices import org.videolan.vlc.util.*
import org.videolan.vlc.util.KEY_FOLDER
import org.videolan.vlc.util.KEY_GROUP
import org.videolan.vlc.util.RESULT_RESCAN
@ExperimentalCoroutinesApi @ExperimentalCoroutinesApi
@ObsoleteCoroutinesApi @ObsoleteCoroutinesApi
...@@ -143,7 +140,10 @@ class SecondaryActivity : ContentActivity() { ...@@ -143,7 +140,10 @@ class SecondaryActivity : ContentActivity() {
} }
} }
} }
STORAGE_BROWSER -> fragment = StorageBrowserFragment() STORAGE_BROWSER -> {
fragment = StorageBrowserFragment()
setResult(RESULT_RESTART)
}
else -> throw IllegalArgumentException("Wrong fragment id.") else -> throw IllegalArgumentException("Wrong fragment id.")
} }
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
package org.videolan.vlc.gui.view package org.videolan.vlc.gui.view
import android.app.Activity
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.util.AttributeSet import android.util.AttributeSet
...@@ -35,6 +36,7 @@ import androidx.annotation.StringRes ...@@ -35,6 +36,7 @@ import androidx.annotation.StringRes
import kotlinx.android.synthetic.main.view_empty_loading.view.* import kotlinx.android.synthetic.main.view_empty_loading.view.*
import org.videolan.vlc.R import org.videolan.vlc.R
import org.videolan.vlc.gui.SecondaryActivity import org.videolan.vlc.gui.SecondaryActivity
import org.videolan.vlc.util.ACTIVITY_RESULT_PREFERENCES
class EmptyLoadingStateView : FrameLayout { class EmptyLoadingStateView : FrameLayout {
...@@ -101,7 +103,7 @@ class EmptyLoadingStateView : FrameLayout { ...@@ -101,7 +103,7 @@ class EmptyLoadingStateView : FrameLayout {
noMediaButton.setOnClickListener { noMediaButton.setOnClickListener {
val intent = Intent(context.applicationContext, SecondaryActivity::class.java) val intent = Intent(context.applicationContext, SecondaryActivity::class.java)
intent.putExtra("fragment", SecondaryActivity.STORAGE_BROWSER) intent.putExtra("fragment", SecondaryActivity.STORAGE_BROWSER)
context.startActivity(intent) (context as Activity).startActivityForResult(intent, ACTIVITY_RESULT_PREFERENCES)
noMediaClickListener?.invoke() noMediaClickListener?.invoke()
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment