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 fixup! Bug 42074: YEC 2023 Android
bug 42074: add yec phase 2
- - - - -
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:
===================================== fenix/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt ===================================== @@ -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 {
===================================== fenix/app/src/main/java/org/mozilla/fenix/theme/ThemeManager.kt ===================================== @@ -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].
===================================== fenix/app/src/main/res/layout/fragment_home.xml ===================================== @@ -168,6 +168,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"
View it on GitLab: https://gitlab.torproject.org/tpo/applications/firefox-android/-/commit/dd67...
tor-commits@lists.torproject.org