Skip to content

Instantly share code, notes, and snippets.

@Mugurell
Created September 5, 2022 07:48
Show Gist options
  • Save Mugurell/357b7d7950a3fd49c924cff84db55376 to your computer and use it in GitHub Desktop.
Save Mugurell/357b7d7950a3fd49c924cff84db55376 to your computer and use it in GitHub Desktop.
Index: app/src/main/java/org/mozilla/fenix/home/WallpapersObserver.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/java/org/mozilla/fenix/home/WallpapersObserver.kt b/app/src/main/java/org/mozilla/fenix/home/WallpapersObserver.kt
--- a/app/src/main/java/org/mozilla/fenix/home/WallpapersObserver.kt (revision 30a8a25d8100271f63e38eba4ec26f99101f517a)
+++ b/app/src/main/java/org/mozilla/fenix/home/WallpapersObserver.kt (date 1662360155911)
@@ -87,11 +87,12 @@
*/
@WorkerThread
private suspend fun loadWallpaper(wallpaper: Wallpaper) {
+ println("Mugurel: WallpaperObserver: loadWallpaper entered: ${wallpaper.name}")
currentWallpaperImage = when (wallpaper) {
Wallpaper.Default -> null
else -> wallpapersUseCases.loadBitmap(wallpaper)
}
-
+ println("Mugurel: WallpaperObserver: loadWallpaper finished: ${wallpaper.name}")
firstWallpaperIsLoaded.complete(Unit)
}
@@ -100,7 +101,9 @@
* the current configuration - portrait or landscape.
*/
internal suspend fun applyCurrentWallpaper() {
+ println("Mugurel: WallpaperObserver: applyCurrentWallpaper entered")
withContext(Dispatchers.Main.immediate) {
+ println("Mugurel: WallpaperObserver: applyCurrentWallpaper switched to Main")
with(currentWallpaperImage) {
when (this) {
null -> wallpaperImageView.isVisible = false
@@ -111,6 +114,7 @@
}
}
}
+ println("Mugurel: WallpaperObserver: applyCurrentWallpaper finished")
}
@VisibleForTesting
@@ -131,6 +135,7 @@
// case in which details like "collection" may be different.
// Avoids setting the same wallpaper twice.
if (currentValue.name != lastObservedValue?.name) {
+ println("Mugurel: WallpaperObserver: new wallpaper observed: ${currentValue.name}")
lastObservedValue = currentValue
wallpapersScope.launch {
Index: app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt
--- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt (revision 30a8a25d8100271f63e38eba4ec26f99101f517a)
+++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt (date 1662363896027)
@@ -208,9 +208,13 @@
// DO NOT ADD ANYTHING ABOVE THIS getProfilerTime CALL!
val profilerStartTime = requireComponents.core.engine.profiler?.getProfilerTime()
+ println("Mugurel: onCreateView entered")
+
_binding = FragmentHomeBinding.inflate(inflater, container, false)
val activity = activity as HomeActivity
val components = requireComponents
+ println("Mugurel: onCreateView binding inflated")
+
if (shouldEnableWallpaper()) {
wallpapersObserver = WallpapersObserver(
@@ -408,6 +412,8 @@
requireComponents.core.engine.profiler?.addMarker(
MarkersFragmentLifecycleCallbacks.MARKER_NAME, profilerStartTime, "HomeFragment.onCreateView",
)
+ println("Mugurel: onCreateView finished")
+
return binding.root
}
@@ -710,6 +716,8 @@
}
override fun onStart() {
+ println("Mugurel: onStart entered")
+
super.onStart()
subscribeToTabCollections()
@@ -763,12 +771,17 @@
}
if (shouldEnableWallpaper() && !wallpaperWasInitiallySet) {
+ // Wait on showing the screen until the wallpaper is applied
runBlockingIncrement {
+ println("Mugurel: onStart: waiting for first wallpaper to be loaded")
wallpapersObserver?.firstWallpaperIsLoaded?.await()
+ println("Mugurel: onStart: waiting for first wallpaper over. Bitmap was loaded")
wallpapersObserver?.applyCurrentWallpaper()
wallpaperWasInitiallySet = true
}
}
+
+ println("Mugurel: onStart finished")
}
private fun dispatchModeChanges(mode: Mode) {
@@ -975,3 +988,18 @@
internal const val TOAST_ELEVATION = 80f
}
}
+
+10:39:22.012: Mugurel: onCreateView entered
+10:39:22.103: Mugurel: onCreateView binding inflated
+10:39:22.149: Mugurel: onCreateView finished
+10:39:22.166: Mugurel: AppAction.WallpaperAction.UpdateCurrentWallpaper: amethyst
+10:39:22.167: Mugurel: WallpaperObserver: new wallpaper observed: amethyst
+10:39:22.168: Mugurel: WallpaperObserver: loadWallpaper entered: amethyst
+10:39:22.182: Mugurel: onStart entered
+10:39:22.188: Mugurel: onStart: waiting for first wallpaper to be loaded
+10:39:22.214: Mugurel: WallpaperObserver: loadWallpaper finished: amethyst
+10:39:22.214: Mugurel: onStart: waiting for first wallpaper over. Bitmap was loaded
+10:39:22.214: Mugurel: WallpaperObserver: applyCurrentWallpaper entered
+10:39:22.215: Mugurel: WallpaperObserver: applyCurrentWallpaper switched to Main
+10:39:22.216: Mugurel: WallpaperObserver: applyCurrentWallpaper finished
+10:39:22.216: Mugurel: onStart finished
Index: app/src/main/java/org/mozilla/fenix/components/appstate/AppStoreReducer.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/java/org/mozilla/fenix/components/appstate/AppStoreReducer.kt b/app/src/main/java/org/mozilla/fenix/components/appstate/AppStoreReducer.kt
--- a/app/src/main/java/org/mozilla/fenix/components/appstate/AppStoreReducer.kt (revision 30a8a25d8100271f63e38eba4ec26f99101f517a)
+++ b/app/src/main/java/org/mozilla/fenix/components/appstate/AppStoreReducer.kt (date 1662361033634)
@@ -204,7 +204,9 @@
is AppAction.WallpaperAction.UpdateCurrentWallpaper ->
state.copy(
wallpaperState = state.wallpaperState.copy(currentWallpaper = action.wallpaper)
- )
+ ).also {
+ println("Mugurel: AppAction.WallpaperAction.UpdateCurrentWallpaper: ${action.wallpaper.name}")
+ }
is AppAction.WallpaperAction.UpdateAvailableWallpapers ->
state.copy(
wallpaperState = state.wallpaperState.copy(availableWallpapers = action.wallpapers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment