Commit 82c3c946 authored by Geoffrey Métais's avatar Geoffrey Métais

TV: Fix Medialibrary not scanned at startup

parent 5c1aa5dd
......@@ -85,7 +85,7 @@ public class StartActivity extends FragmentActivity {
/* Check if it's the first run */
final boolean firstRun = savedVersionNumber == -1;
final boolean upgrade = firstRun || savedVersionNumber != currentVersionNumber;
if (upgrade && !firstRun) settings.edit().putInt(Constants.PREF_FIRST_RUN, currentVersionNumber).apply();
if (upgrade) settings.edit().putInt(Constants.PREF_FIRST_RUN, currentVersionNumber).apply();
final boolean tv = showTvUi();
// Route search query
if (Intent.ACTION_SEARCH.equals(action) || "com.google.android.gms.actions.SEARCH_ACTION".equals(action)) {
......@@ -115,7 +115,7 @@ public class StartActivity extends FragmentActivity {
}
private void startApplication(final boolean tv, final boolean firstRun, final boolean upgrade, final int target) {
final boolean onboarding = firstRun && !tv && !Settings.INSTANCE.getInstance(StartActivity.this).getBoolean(OnboardingActivityKt.ONBOARDING_DONE_KEY, false);
final boolean onboarding = !tv && !Settings.INSTANCE.getInstance(StartActivity.this).getBoolean(OnboardingActivityKt.ONBOARDING_DONE_KEY, false);
// Start Medialibrary from background to workaround Dispatchers.Main causing ANR
// cf https://github.com/Kotlin/kotlinx.coroutines/issues/878
if (!onboarding) {
......
......@@ -13,7 +13,6 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.viewpager.widget.ViewPager
import kotlinx.coroutines.*
import org.videolan.vlc.BuildConfig
import org.videolan.vlc.MediaParsingService
import org.videolan.vlc.R
import org.videolan.vlc.gui.MainActivity
......@@ -132,7 +131,6 @@ class OnboardingActivity : AppCompatActivity(), ViewPager.OnPageChangeListener,
.putBoolean(ONBOARDING_DONE_KEY, true)
.putInt(KEY_MEDIALIBRARY_SCAN, if (viewModel.scanStorages) ML_SCAN_ON else ML_SCAN_OFF)
.putInt("fragment_id", if (viewModel.scanStorages) R.id.nav_video else R.id.nav_directories)
.putInt(PREF_FIRST_RUN, BuildConfig.VERSION_CODE)
.putString("app_theme", viewModel.theme.toString())
.apply()
if (!viewModel.scanStorages) MediaParsingService.preselectedStorages.clear()
......
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