Commit 9bc57028 authored by clairehurst's avatar clairehurst 🌱
Browse files

TB 44031 [android]: 2025 YEC preview

parent 4340c10b
Loading
Loading
Loading
Loading
Loading
+0 −0

Empty file added.

+97 −0
Original line number Diff line number Diff line
package org.mozilla.fenix.tor

import android.annotation.SuppressLint
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import androidx.compose.ui.tooling.preview.Preview

@SuppressLint("UnrememberedMutableState")
@FlexibleWindowPreviewPortraitLandscapeEnglishArabicGerman
@Composable
/**
 * Relevant documentation https://developer.android.com/develop/ui/compose/tooling/previews#preview-viewmodel
 */
private fun TorHomePagePreview(
    @PreviewParameter(BooleanBooleanPreviewParameterProvider::class) booleanMatrix: Pair<Boolean, Boolean>,
) {
    val toolbarAtTop = booleanMatrix.second
    Box(
        contentAlignment = if (toolbarAtTop) Alignment.Companion.TopStart else Alignment.Companion.BottomStart,
        modifier = Modifier.Companion.fillMaxSize(),
    ) {
        TorHomePage(
            shouldInitiallyShowPromo = mutableStateOf(booleanMatrix.first),
            toolBarAtTop = toolbarAtTop,
        )
    }
}

private class BooleanBooleanPreviewParameterProvider :
    PreviewParameterProvider<Pair<Boolean, Boolean>> {
    override val values: Sequence<Pair<Boolean, Boolean>>
        get() = sequenceOf(
            Pair(true, true),
            Pair(true, false),
            Pair(false, true),
            Pair(false, false),
        )
}

/**
 * A wrapper annotation for creating a preview that renders a preview for each value of portrait and landscape for english, arabic, and german.
 */
@Preview(
    name = "mobile portrait",
    group = "english",
    widthDp = 360,
    heightDp = 780,
    locale = "en",
    device = "id:pixel_5",
)
@Preview(
    name = "mobile landscape",
    group = "english",
    widthDp = 780,
    heightDp = 360,
    locale = "en",
    device = "spec:parent=pixel_5,orientation=landscape",
)
@Preview(
    name = "mobile portrait",
    group = "arabic",
    widthDp = 360,
    heightDp = 780,
    locale = "ar",
    device = "id:pixel_5",
)
@Preview(
    name = "mobile landscape",
    group = "arabic",
    widthDp = 780,
    heightDp = 360,
    locale = "ar",
    device = "spec:parent=pixel_5,orientation=landscape",
)
@Preview(
    name = "mobile portrait",
    group = "german",
    widthDp = 360,
    heightDp = 780,
    locale = "de",
    device = "id:pixel_5",
)
@Preview(
    name = "mobile landscape",
    group = "german",
    widthDp = 780,
    heightDp = 360,
    locale = "de",
    device = "spec:parent=pixel_5,orientation=landscape",
)
annotation class FlexibleWindowPreviewPortraitLandscapeEnglishArabicGerman
+8 −2
Original line number Diff line number Diff line
@@ -1506,5 +1506,11 @@

    <!-- Translations feature-->


    <!--   Not meant for production. Uncomment for the compose preview in [TorHomePage] -->
    <!--  <string name="donate_now_yec">تبرع الآن</string>-->
    <!--  <string name="free_the_internet_yec">حرروا الإنترنت</string>-->
    <!--  <string name="body1_yec">دعم الأدوات التي تكسر قيود الرقابة والمراقبة. %s</string>-->
    <!--  <string name="body1_link_yec">تبرع لمشروع Tor اليوم.</string>-->
    <!--  <string name="body2_yec">حتى 31 ديسمبر، سيتم مضاعفة تبرعك،  بحد أقصى 250,000 دولار!</string>-->
    <!--  <string name="no_donation_required_yec">سيكون متصفح Tor لنظام Android مجانيا دائما للاستخدام - لا يلزم التبرع لاستخدام هذا التطبيق.</string>-->
</resources>
+14 −5
Original line number Diff line number Diff line
@@ -2784,4 +2784,13 @@
    <string name="exit_fullscreen_with_gesture">Um den Vollbildmodus zu beenden, ziehen Sie von oben und verwenden Sie die Zurück-Geste</string>
    <!-- Message shown to explain how to exit fullscreen mode when using back button navigation -->
    <string name="exit_fullscreen_with_back_button">Um den Vollbildmodus zu beenden, ziehen Sie von oben und drücken Sie auf „Zurück“</string>

    <!-- Not meant for production. Uncomment for the compose preview in [TorHomePage] -->
    <!--  <string name="donate_now_yec">Jetzt spenden</string>-->
    <!--  <string name="free_the_internet_yec">Befreit das Internet</string>-->
    <!--  <string name="body1_yec">Unterstützen Sie Tools, die die Ketten der Zensur und Überwachung sprengen. %s</string>-->
    <!--  <string name="body1_link_yec">Spenden Sie noch heute für das Tor-Projekt.</string>-->
    <!--  <string name="body2_yec">Bis zum 31. Dezember wird Ihre Spende bis zu einer Höhe von 250.000 Dollar verdoppelt!</string>-->
    <!--  <string name="no_donation_required_yec">Der Tor-Browser für Android wird immer kostenlos sein – es ist keine Spende erforderlich, um diese App zu nutzen.</string>-->

</resources>