Dan Ballard pushed to branch firefox-android-115.2.1-13.0-1 at The Tor Project / Applications / firefox-android
Commits:
- 
dd67f17c
by Dan Ballard at 2023-11-16T12:47:14-08:00
3 changed files:
- fenix/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt
- fenix/app/src/main/java/org/mozilla/fenix/theme/ThemeManager.kt
- fenix/app/src/main/res/layout/fragment_home.xml
Changes:
| ... | ... | @@ -121,6 +121,8 @@ import org.mozilla.fenix.utils.Settings.Companion.TOP_SITES_PROVIDER_MAX_THRESHO | 
| 121 | 121 |  import org.mozilla.fenix.utils.allowUndo
 | 
| 122 | 122 |  import org.mozilla.fenix.wallpapers.Wallpaper
 | 
| 123 | 123 |  import java.lang.ref.WeakReference
 | 
| 124 | +import java.text.NumberFormat
 | |
| 125 | +import java.util.Locale
 | |
| 124 | 126 |  import kotlin.math.min
 | 
| 125 | 127 | |
| 126 | 128 |  @Suppress("TooManyFunctions", "LargeClass")
 | 
| ... | ... | @@ -478,6 +480,7 @@ class HomeFragment : Fragment() { | 
| 478 | 480 | |
| 479 | 481 |      fun controlYECDisplay() {
 | 
| 480 | 482 |          val yec23show = ((activity as? HomeActivity)?.themeManager?.isYECActive ?: false) && ! this.hideYEC
 | 
| 483 | +        val yec23matchingShow = ((activity as? HomeActivity)?.themeManager?.isYECPhase2Active ?: false) && ! this.hideYEC
 | |
| 481 | 484 | |
| 482 | 485 |          // hude onion pattern during EOY event
 | 
| 483 | 486 |          binding.onionPatternImage.apply {
 | 
| ... | ... | @@ -506,7 +509,15 @@ class HomeFragment : Fragment() { | 
| 506 | 509 |              }
 | 
| 507 | 510 |          }
 | 
| 508 | 511 | |
| 509 | - | |
| 512 | +        // Hide EOY matching announcement before its time
 | |
| 513 | +        binding.yecMatchingText.apply {
 | |
| 514 | +            visibility = if (yec23matchingShow) {
 | |
| 515 | +                View.VISIBLE
 | |
| 516 | +            } else {
 | |
| 517 | +                View.GONE
 | |
| 518 | +            }
 | |
| 519 | +        }
 | |
| 520 | +        binding.yecMatchingText.text = binding.yecMatchingText.text.replace(Regex("%s"), NumberFormat.getNumberInstance(Locale.getDefault()).format(75000))
 | |
| 510 | 521 | |
| 511 | 522 |          // Hide the EOY image before EOY event
 | 
| 512 | 523 |          binding.yecIllustration.apply {
 | 
| ... | ... | @@ -29,6 +29,8 @@ abstract class ThemeManager { | 
| 29 | 29 |      // 1696118400000 // 2022 10 04 - testing
 | 
| 30 | 30 |      // 1697414400000 // 2023 10 16
 | 
| 31 | 31 |      private val yec2023LaunchDate = Date(1697414400000)
 | 
| 32 | +    // 1700614800000 // 2023 11 22
 | |
| 33 | +    private val yec2023Phase2 = Date(1700614800000)
 | |
| 32 | 34 |      // 1704067200000 // 2024 01 01
 | 
| 33 | 35 |      private val yec2023EndDate = Date(1704067200000)
 | 
| 34 | 36 | |
| ... | ... | @@ -36,6 +38,7 @@ abstract class ThemeManager { | 
| 36 | 38 |      abstract var currentTheme: BrowsingMode
 | 
| 37 | 39 | |
| 38 | 40 |      val isYECActive get() = Date().after(yec2023LaunchDate) && Date().before(yec2023EndDate)
 | 
| 41 | +    val isYECPhase2Active get() = Date().after(yec2023Phase2) && Date().before(yec2023EndDate)
 | |
| 39 | 42 | |
| 40 | 43 |      /**
 | 
| 41 | 44 |       * Returns the style resource corresponding to the [currentTheme].
 | 
| ... | ... | @@ -168,6 +168,21 @@ | 
| 168 | 168 | |
| 169 | 169 |              </androidx.constraintlayout.widget.ConstraintLayout>
 | 
| 170 | 170 | |
| 171 | +            <TextView
 | |
| 172 | +                android:id="@+id/yec_matching_text"
 | |
| 173 | +                android:layout_width="wrap_content"
 | |
| 174 | +                android:layout_height="wrap_content"
 | |
| 175 | +                android:clickable="false"
 | |
| 176 | +                android:focusable="false"
 | |
| 177 | +                android:importantForAccessibility="no"
 | |
| 178 | +                android:layout_marginTop="15dp"
 | |
| 179 | +                android:text="@string/yec_2023_matched_donation"
 | |
| 180 | +                android:textColor="#FFBD4F"
 | |
| 181 | +                android:textSize="16sp"
 | |
| 182 | +                android:lineSpacingExtra="5dp"
 | |
| 183 | +                android:fontFamily="Roboto-Medium"
 | |
| 184 | +                app:layout_scrollFlags="scroll" />
 | |
| 185 | + | |
| 171 | 186 |              <TextView
 | 
| 172 | 187 |                  android:id="@+id/yec_intro_text"
 | 
| 173 | 188 |                  android:layout_width="wrap_content"
 |