Commit 19ec8acc authored by Dan Ballard's avatar Dan Ballard
Browse files

fixup! Bug 42074: YEC 2023 Android

bug 42074: add yec phase 2
parent 80933135
Loading
Loading
Loading
Loading
+12 −1
Changes for fenix/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt: 12 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -121,6 +121,8 @@ import org.mozilla.fenix.utils.Settings.Companion.TOP_SITES_PROVIDER_MAX_THRESHO
import org.mozilla.fenix.utils.allowUndo
import org.mozilla.fenix.wallpapers.Wallpaper
import java.lang.ref.WeakReference
import java.text.NumberFormat
import java.util.Locale
import kotlin.math.min

@Suppress("TooManyFunctions", "LargeClass")
@@ -478,6 +480,7 @@ class HomeFragment : Fragment() {

    fun controlYECDisplay() {
        val yec23show = ((activity as? HomeActivity)?.themeManager?.isYECActive ?: false) && ! this.hideYEC
        val yec23matchingShow = ((activity as? HomeActivity)?.themeManager?.isYECPhase2Active ?: false) && ! this.hideYEC

        // hude onion pattern during EOY event
        binding.onionPatternImage.apply {
@@ -506,7 +509,15 @@ class HomeFragment : Fragment() {
            }
        }


        // Hide EOY matching announcement before its time
        binding.yecMatchingText.apply {
            visibility = if (yec23matchingShow) {
                View.VISIBLE
            } else {
                View.GONE
            }
        }
        binding.yecMatchingText.text = binding.yecMatchingText.text.replace(Regex("%s"), NumberFormat.getNumberInstance(Locale.getDefault()).format(75000))

        // Hide the EOY image before EOY event
        binding.yecIllustration.apply {
+3 −0
Changes for fenix/app/src/main/java/org/mozilla/fenix/theme/ThemeManager.kt: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ abstract class ThemeManager {
    // 1696118400000 // 2022 10 04 - testing
    // 1697414400000 // 2023 10 16
    private val yec2023LaunchDate = Date(1697414400000)
    // 1700614800000 // 2023 11 22
    private val yec2023Phase2 = Date(1700614800000)
    // 1704067200000 // 2024 01 01
    private val yec2023EndDate = Date(1704067200000)

@@ -36,6 +38,7 @@ abstract class ThemeManager {
    abstract var currentTheme: BrowsingMode

    val isYECActive get() = Date().after(yec2023LaunchDate) && Date().before(yec2023EndDate)
    val isYECPhase2Active get() = Date().after(yec2023Phase2) && Date().before(yec2023EndDate)

    /**
     * Returns the style resource corresponding to the [currentTheme].
+15 −0
Changes for fenix/app/src/main/res/layout/fragment_home.xml: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -170,6 +170,21 @@

            </androidx.constraintlayout.widget.ConstraintLayout>

            <TextView
                android:id="@+id/yec_matching_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:clickable="false"
                android:focusable="false"
                android:importantForAccessibility="no"
                android:layout_marginTop="15dp"
                android:text="@string/yec_2023_matched_donation"
                android:textColor="#FFBD4F"
                android:textSize="16sp"
                android:lineSpacingExtra="5dp"
                android:fontFamily="Roboto-Medium"
                app:layout_scrollFlags="scroll" />

            <TextView
                android:id="@+id/yec_intro_text"
                android:layout_width="wrap_content"