diff --git a/clients/android/NewsBlur/build.gradle b/clients/android/NewsBlur/build.gradle index d20d884d5..5efaf13e4 100644 --- a/clients/android/NewsBlur/build.gradle +++ b/clients/android/NewsBlur/build.gradle @@ -27,7 +27,7 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' dependencies { - implementation 'androidx.fragment:fragment-ktx:1.4.0' + implementation 'androidx.fragment:fragment-ktx:1.4.1' implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' implementation 'com.squareup.okhttp3:okhttp:4.9.2' @@ -40,7 +40,7 @@ dependencies { implementation "androidx.browser:browser:1.4.0" implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0" implementation 'androidx.lifecycle:lifecycle-process:2.4.0' - implementation 'androidx.core:core-splashscreen:1.0.0-alpha02' + implementation 'androidx.core:core-splashscreen:1.0.0-beta01' } android { diff --git a/clients/android/NewsBlur/src/com/newsblur/activity/InitActivity.kt b/clients/android/NewsBlur/src/com/newsblur/activity/InitActivity.kt index d5b6ace22..21ecf2b15 100644 --- a/clients/android/NewsBlur/src/com/newsblur/activity/InitActivity.kt +++ b/clients/android/NewsBlur/src/com/newsblur/activity/InitActivity.kt @@ -18,7 +18,7 @@ class InitActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) installSplashScreen().also { - it.setKeepVisibleCondition { + it.setKeepOnScreenCondition() { // keep showing the splash screen until FeedUtils.offerInitContext(...) // finishes and UI ready to display FeedUtils.dbHelper != null || FeedUtils.thumbnailLoader != null diff --git a/clients/android/NewsBlur/src/com/newsblur/activity/Reading.kt b/clients/android/NewsBlur/src/com/newsblur/activity/Reading.kt index 940e5707e..8210e0660 100644 --- a/clients/android/NewsBlur/src/com/newsblur/activity/Reading.kt +++ b/clients/android/NewsBlur/src/com/newsblur/activity/Reading.kt @@ -59,6 +59,14 @@ abstract class Reading : NbActivity(), OnPageChangeListener, OnSeekBarChangeList private var overlayRangeBotPx = 0f private var lastVScrollPos = 0 + // enabling multi window mode from recent apps on the device + // creates a different activity lifecycle compared to a device rotation + // resulting in onPause being called when the app is actually on the screen. + // calling onPause sets stopLoading as true and content wouldn't be loaded. + // track the multi window mode config change and skip stopLoading in first onPause call. + // refactor stopLoading mechanism as a cancellation signal tied to the view lifecycle. + private var isMultiWindowModeHack = false + private val pageHistory = mutableListOf() private lateinit var volumeKeyNavigation: VolumeKeyNavigation @@ -143,8 +151,17 @@ abstract class Reading : NbActivity(), OnPageChangeListener, OnSeekBarChangeList } override fun onPause() { - stopLoading = true super.onPause() + if (isMultiWindowModeHack) { + isMultiWindowModeHack = false + } else { + stopLoading = true + } + } + + override fun onMultiWindowModeChanged(isInMultiWindowMode: Boolean, newConfig: Configuration?) { + super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig) + isMultiWindowModeHack = isInMultiWindowMode } private fun setupViews() {