Revert "For #22851: Add logo animation for wallpapers."

This reverts commit d089f007
This commit is contained in:
Arturo Mejia 2022-01-13 16:48:22 -05:00 committed by mergify[bot]
parent d089f00793
commit d1ace92e64
4 changed files with 0 additions and 73 deletions

View File

@ -17,7 +17,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.View.AccessibilityDelegate
import android.view.ViewGroup
import android.view.ViewTreeObserver
import android.view.accessibility.AccessibilityEvent
import android.widget.Button
import android.widget.LinearLayout
@ -822,26 +821,6 @@ class HomeFragment : Fragment() {
// triggered to cause an automatic update on warm start (no tab selection occurs). So we
// update it manually here.
requireComponents.useCases.sessionUseCases.updateLastAccess()
if (shouldEnableWallpaper()) {
_binding?.sessionControlRecyclerView?.viewTreeObserver?.addOnGlobalLayoutListener(
homeLayoutListenerForLogoAnimation
)
}
}
// To try to find a good time to show the logo animation, we are waiting until all
// the sub-recyclerviews (recentBookmarks, collections, recentTabs,recentVisits
// and pocketStories) on the home screen have been layout.
private val homeLayoutListenerForLogoAnimation = object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
_binding?.let { safeBindings ->
requireComponents.wallpaperManager.animateLogoIfNeeded(safeBindings.wordmark)
safeBindings.sessionControlRecyclerView.viewTreeObserver.removeOnGlobalLayoutListener(
this
)
}
}
}
override fun onPause() {

View File

@ -431,16 +431,6 @@ class Settings(private val appContext: Context) : PreferencesHolder {
featureFlag = FeatureFlags.inactiveTabs
)
/**
* Indicates if the Firefox logo on the home screen should be animated,
* to show users that they can change the wallpaper by tapping on the Firefox logo.
*/
var shouldAnimateFirefoxLogo by featureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_show_logo_animation),
default = FeatureFlags.showWallpapers,
featureFlag = FeatureFlags.showWallpapers
)
/**
* Indicates if the user has enabled the search term tab groups feature.
*/

View File

@ -4,11 +4,7 @@
package org.mozilla.fenix.wallpapers
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.view.View
import androidx.appcompat.app.AppCompatDelegate
import mozilla.components.support.base.log.logger.Logger
@ -100,41 +96,4 @@ class WallpaperManager(private val settings: Settings) {
Wallpaper.valueOf(currentWallpaper)
}
}
/**
* Animates the Firefox logo, if it hasn't been animated before, otherwise nothing will happen.
* After animating the first time, the [Settings.shouldAnimateFirefoxLogo] setting
* will be updated.
*/
@Suppress("MagicNumber")
fun animateLogoIfNeeded(logo: View) {
if (!settings.shouldAnimateFirefoxLogo) {
return
}
Handler(Looper.getMainLooper()).postDelayed(
{
val animator1 = ObjectAnimator.ofFloat(logo, "rotation", 0f, 10f)
val animator2 = ObjectAnimator.ofFloat(logo, "rotation", 10f, 0f)
val animator4 = ObjectAnimator.ofFloat(logo, "rotation", 10f, 0f)
val animator3 = ObjectAnimator.ofFloat(logo, "rotation", 0f, 10f)
animator1.duration = 200
animator2.duration = 200
animator3.duration = 200
animator4.duration = 200
val set = AnimatorSet()
set.play(animator1).before(animator2).after(animator3).before(animator4)
set.start()
settings.shouldAnimateFirefoxLogo = false
},
ANIMATION_DELAY_MS
)
}
companion object {
private const val ANIMATION_DELAY_MS = 1500L
}
}

View File

@ -189,7 +189,6 @@
<!-- Wallpaper Settings -->
<string name="pref_key_current_wallpaper" translatable="false">pref_key_current_wallpaper</string>
<string name="pref_key_show_logo_animation" translatable="false">pref_key_show_logo_animation</string>
<string name="pref_key_encryption_key_generated" translatable="false">pref_key_encryption_key_generated</string>