[Android] TV: Fix Medialibrary not scanned at startup

Geoffrey Métais git at videolan.org
Thu Apr 11 12:20:57 CEST 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Apr 11 12:20:09 2019 +0200| [82c3c9461db335f1d40d6cbd725611f9d3294c34] | committer: Geoffrey Métais

TV: Fix Medialibrary not scanned at startup

> https://code.videolan.org/videolan/vlc-android/commit/82c3c9461db335f1d40d6cbd725611f9d3294c34
---

 vlc-android/src/org/videolan/vlc/StartActivity.java                   | 4 ++--
 vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingActivity.kt | 2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/StartActivity.java b/vlc-android/src/org/videolan/vlc/StartActivity.java
index d476a4e04..1d326eb72 100644
--- a/vlc-android/src/org/videolan/vlc/StartActivity.java
+++ b/vlc-android/src/org/videolan/vlc/StartActivity.java
@@ -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) {
diff --git a/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingActivity.kt b/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingActivity.kt
index d9a5988f3..5440dceed 100644
--- a/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingActivity.kt
@@ -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()



More information about the Android mailing list