Skip to content

Commit

Permalink
Apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyDL-Infomaniak committed Jun 7, 2024
1 parent 8dee4e6 commit a98575d
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class LockedMailboxBottomSheetDialog : InformationBottomSheetDialog() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) = with(binding) {
super.onViewCreated(view, savedInstanceState)

title.text = getString(R.string.blockedMailboxTitle, navigationArgs.lockedMailboxName)
description.text = resources.getQuantityText(R.plurals.lockedMailboxDescription, 1)
title.text = getString(R.string.lockedMailboxBottomSheetTitle, navigationArgs.lockedMailboxName)
description.text = getString(R.string.lockedMailboxBottomSheetDescription)
infoIllustration.setBackgroundResource(R.drawable.ic_invalid_mailbox)

actionButton.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class AiEngineChoiceFragment : Fragment() {
super.onViewCreated(view, savedInstanceState)
setSystemBarsColors(statusBarColor = R.color.backgroundColor)

choiceBinding.informationBlock.setDescription(R.string.aiEngineWarning)

binding.toolbar.setNavigationOnClickListener { findNavController().popBackStack() }

sharedUtils.manageAiEngineSettings(this, choiceBinding.radioGroup, "promptAiEngine") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class AiPropositionFragment : Fragment() {
}

private fun displayError(status: PropositionStatus) {
binding.errorBlock.setTitle(status.errorRes!!)
binding.errorBlock.setDescription(status.errorRes!!)
setUiVisibilityState(UiState.ERROR)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ class NoValidMailboxesFragment : Fragment(), MailboxListFragment {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) = with(binding) {
super.onViewCreated(view, savedInstanceState)

noValidMailboxesBlock.description = resources.getQuantityString(R.plurals.lockedMailboxDescription, 2)
noValidMailboxesBlock.setTitle(R.string.lockedMailboxScreenTitle)
noValidMailboxesBlock.setDescription(R.string.lockedMailboxScreenDescription)
noValidMailboxesBlock.setButton(R.string.readFAQ)

setupAdapters()
setupListeners()
Expand All @@ -81,7 +83,7 @@ class NoValidMailboxesFragment : Fragment(), MailboxListFragment {
}

private fun setupListeners() = with(binding) {
noValidMailboxesBlock.setOnInformationClicked {
noValidMailboxesBlock.setOnActionClicked {
trackNoValidMailboxesEvent("readFAQ")
context?.let { WebViewActivity.startActivity(it, Uri.parse(BuildConfig.FAQ_URL).toString()) }
}
Expand Down
39 changes: 10 additions & 29 deletions app/src/main/java/com/infomaniak/mail/views/InformationBlockView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,14 @@ class InformationBlockView @JvmOverloads constructor(

private val binding by lazy { ViewInformationBlockBinding.inflate(LayoutInflater.from(context), this, true) }

private var onInformationClicked: (() -> Unit)? = null
private var onActionClicked: (() -> Unit)? = null
private var onCloseClicked: (() -> Unit)? = null

var title: CharSequence?
get() = binding.informationTitle.text
set(value) {
binding.informationTitle.text = value
}
var title: CharSequence? by binding.informationTitle::text

var description: CharSequence?
get() = binding.informationDescription.text
set(value) {
binding.informationDescription.text = value
}
var description: CharSequence? by binding.informationDescription::text

var button: CharSequence?
get() = binding.informationButton.text
set(value) {
binding.informationButton.text = value
}
var button: CharSequence? by binding.informationButton::text

var icon: Drawable?
get() = binding.icon.compoundDrawablesRelative[0]
Expand All @@ -65,18 +53,8 @@ class InformationBlockView @JvmOverloads constructor(

init {
attrs?.getAttributes(context, R.styleable.InformationBlockView) {
binding.informationTitle.apply {
isVisible = getBoolean(R.styleable.InformationBlockView_showTitle, true)
text = getString(R.styleable.InformationBlockView_title)
}
binding.informationDescription.apply {
isVisible = getBoolean(R.styleable.InformationBlockView_showDescription, false)
text = getString(R.styleable.InformationBlockView_description)
}
binding.informationButton.apply {
isVisible = getBoolean(R.styleable.InformationBlockView_showButton, false)
text = getString(R.styleable.InformationBlockView_button)
setOnClickListener { onInformationClicked?.invoke() }
setOnClickListener { onActionClicked?.invoke() }
}
icon = getDrawable(R.styleable.InformationBlockView_icon)
binding.closeButton.apply {
Expand All @@ -86,8 +64,8 @@ class InformationBlockView @JvmOverloads constructor(
}
}

fun setOnInformationClicked(listener: () -> Unit) {
onInformationClicked = listener
fun setOnActionClicked(listener: () -> Unit) {
onActionClicked = listener
}

fun setOnCloseListener(listener: () -> Unit) {
Expand All @@ -96,13 +74,16 @@ class InformationBlockView @JvmOverloads constructor(

fun setTitle(@StringRes textRes: Int) {
title = context.getText(textRes)
binding.informationTitle.isVisible = true
}

fun setDescription(@StringRes descriptionRes: Int) {
description = context.getText(descriptionRes)
binding.informationDescription.isVisible = true
}

fun setButton(@StringRes buttonRes: Int) {
button = context.getText(buttonRes)
binding.informationButton.isVisible = true
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_ai_proposition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
android:visibility="gone"
app:icon="@drawable/ic_warning"
app:showCloseIcon="true"
tools:title="@string/aiErrorTooManyRequests"
tools:description="@string/aiErrorTooManyRequests"
tools:visibility="visible" />

<FrameLayout
Expand Down
11 changes: 5 additions & 6 deletions app/src/main/res/layout/fragment_no_valid_mailboxes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,9 @@
app:layout_constraintTop_toBottomOf="@id/logo"
app:icon="@drawable/ic_warning"
app:showCloseIcon="false"
app:title="@string/lockedMailboxTitleIB"
app:showTitle="true"
tools:description="@string/lockedMailboxTitleIB"
app:showDescription="true"
app:button="@string/readFAQ"
app:showButton="true" />
tools:title="@string/lockedMailboxScreenTitle"
tools:description="@string/lockedMailboxScreenDescription"
tools:button="@string/readFAQ" />

<TextView
android:id="@+id/invalidPasswordTitle"
Expand Down Expand Up @@ -126,6 +123,7 @@
android:visibility="gone"
app:constraint_referenced_ids="lockedMailboxTitle,lockedMailboxesRecyclerView"
tools:visibility="visible" />

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

Expand All @@ -151,4 +149,5 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
3 changes: 2 additions & 1 deletion app/src/main/res/layout/layout_ai_engine_choice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@
</com.infomaniak.mail.ui.main.settings.SettingRadioGroupView>

<com.infomaniak.mail.views.InformationBlockView
android:id="@+id/informationBlock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/marginStandardMedium"
app:icon="@drawable/ic_external_information"
app:title="@string/aiEngineWarning" />
tools:description="@string/aiEngineWarning" />
</merge>
8 changes: 7 additions & 1 deletion app/src/main/res/layout/view_information_block.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,27 @@
android:id="@+id/informationTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
style="@style/BodyMedium"
tools:visibility="visible"
tools:text="@string/aiErrorTooManyRequests" />

<TextView
android:id="@+id/informationDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Body.Secondary"
android:visibility="gone"
style="@style/Body"
tools:visibility="visible"
tools:text="@string/aiErrorTooManyRequests" />

<com.google.android.material.button.MaterialButton
android:id="@+id/informationButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
style="@style/TextButtonSecondary"
tools:visibility="visible"
tools:text="@string/buttonLogInDifferentAccount" />

</LinearLayout>
Expand Down
10 changes: 4 additions & 6 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
</plurals>
<string name="attendeesListTitle">Liste der Teilnehmer (%d)</string>
<string name="bccTitle">Bcc:</string>
<string name="blockedMailboxTitle">Mailbox %s ist blockiert</string>
<plurals name="blockedPasswordTitle">
<item quantity="one">Passwort blockiert</item>
<item quantity="other">Blockierte Passwörter</item>
Expand Down Expand Up @@ -294,15 +293,14 @@
<string name="googlePlayServicesAreRequired">Google Play Services sind erforderlich</string>
<string name="inboxFolder">Posteingang</string>
<string name="loadingText">Laden…</string>
<plurals name="lockedMailboxDescription">
<item quantity="one">Der Zugriff auf Ihre E-Mail-Adresse ist derzeit gesperrt.\nFür weitere Informationen, FAQ lesen.</item>
<item quantity="other">Für weitere Informationen:</item>
</plurals>
<string name="lockedMailboxBottomSheetDescription">Der Zugriff auf Ihre E-Mail-Adresse ist derzeit gesperrt.\nFür weitere Informationen, FAQ lesen.</string>
<string name="lockedMailboxBottomSheetTitle">Mailbox %s ist blockiert</string>
<string name="lockedMailboxScreenDescription">Für weitere Informationen:</string>
<string name="lockedMailboxScreenTitle">Einige Ihrer Mailboxen sind blockiert</string>
<plurals name="lockedMailboxTitle">
<item quantity="one">Blockierte E-Mail-Adresse</item>
<item quantity="other">Gesperrte Mailadressen</item>
</plurals>
<string name="lockedMailboxTitleIB">Einige Ihrer Mailboxen sind blockiert</string>
<string name="manageSignatures">Meine Signaturen verwalten</string>
<string name="menuDrawerAdvancedActions">Erweiterte Aktionen</string>
<string name="menuDrawerMailboxStorage">%1$s / %2$s verwendet</string>
Expand Down
10 changes: 4 additions & 6 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
</plurals>
<string name="attendeesListTitle">Lista de asistentes (%d)</string>
<string name="bccTitle">CCO:</string>
<string name="blockedMailboxTitle">La dirección de correo electrónico %s está bloqueada</string>
<plurals name="blockedPasswordTitle">
<item quantity="one">Contraseña bloqueada</item>
<item quantity="other">Contraseñas bloqueadas</item>
Expand Down Expand Up @@ -294,15 +293,14 @@
<string name="googlePlayServicesAreRequired">Se requieren los servicios de Google Play</string>
<string name="inboxFolder">Bandeja de entrada</string>
<string name="loadingText">Cargando…</string>
<plurals name="lockedMailboxDescription">
<item quantity="one">El acceso a su dirección de correo electrónico está bloqueado.\nPara más información, lea las preguntas frecuentes.</item>
<item quantity="other">Para más información:</item>
</plurals>
<string name="lockedMailboxBottomSheetDescription">El acceso a su dirección de correo electrónico está bloqueado.\nPara más información, lea las preguntas frecuentes.</string>
<string name="lockedMailboxBottomSheetTitle">La dirección de correo electrónico %s está bloqueada</string>
<string name="lockedMailboxScreenDescription">Para más información:</string>
<string name="lockedMailboxScreenTitle">Algunos de sus buzones están bloqueados</string>
<plurals name="lockedMailboxTitle">
<item quantity="one">Dirección de correo electrónico bloqueada</item>
<item quantity="other">Buzones de correo bloqueados</item>
</plurals>
<string name="lockedMailboxTitleIB">Algunos de sus buzones están bloqueados</string>
<string name="manageSignatures">Gestionar mis firmas</string>
<string name="menuDrawerAdvancedActions">Acciones avanzadas</string>
<string name="menuDrawerMailboxStorage">%1$s / %2$s usado</string>
Expand Down
11 changes: 4 additions & 7 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
</plurals>
<string name="attendeesListTitle">Liste des participants (%d)</string>
<string name="bccTitle">Cci :</string>
<string name="blockedMailboxTitle">L’adresse %s est bloquée</string>
<plurals name="blockedPasswordTitle">
<item quantity="one">Mot de passe bloqué</item>
<item quantity="other">Mots de passe bloqués</item>
Expand Down Expand Up @@ -298,17 +297,15 @@
<string name="googlePlayServicesAreRequired">Les Google Play Services sont requis</string>
<string name="inboxFolder">Boîte de réception</string>
<string name="loadingText">Chargement…</string>
<plurals name="lockedMailboxDescription">
<item quantity="one">L’accès à votre adresse mail est actuellement bloqué.\nPour plus d’informations, consultez les FAQ.</item>
<item quantity="other">Pour plus d’informations :</item>
<item quantity="many">L’accès à votre adresse mail est actuellement bloqué. Nous vous invitons à contacter votre administrateur.</item>
</plurals>
<string name="lockedMailboxBottomSheetDescription">L’accès à votre adresse mail est actuellement bloqué.\nPour plus d’informations, consultez les FAQ.</string>
<string name="lockedMailboxBottomSheetTitle">L’adresse %s est bloquée</string>
<string name="lockedMailboxScreenDescription">Pour plus d’informations :</string>
<string name="lockedMailboxScreenTitle">Certaines de vos adresses mail sont bloquées</string>
<plurals name="lockedMailboxTitle">
<item quantity="one">Adresse mail bloquée</item>
<item quantity="other">Adresses mail bloquées</item>
<item quantity="many">Adresses mail bloquées</item>
</plurals>
<string name="lockedMailboxTitleIB">Certaines de vos adresses mail sont bloquées</string>
<string name="manageSignatures">Gérer mes signatures</string>
<string name="menuDrawerAdvancedActions">Actions avancées</string>
<string name="menuDrawerMailboxStorage">%1$s / %2$s utilisés</string>
Expand Down
10 changes: 4 additions & 6 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
</plurals>
<string name="attendeesListTitle">Elenco dei partecipanti (%d)</string>
<string name="bccTitle">Bcc:</string>
<string name="blockedMailboxTitle">L’indirizzo e-mail %s è bloccato</string>
<plurals name="blockedPasswordTitle">
<item quantity="one">Password bloccata</item>
<item quantity="other">Password bloccate</item>
Expand Down Expand Up @@ -294,15 +293,14 @@
<string name="googlePlayServicesAreRequired">I servizi Google Play sono necessari</string>
<string name="inboxFolder">Posta in arrivo</string>
<string name="loadingText">Caricamento…</string>
<plurals name="lockedMailboxDescription">
<item quantity="one">L’accesso al tuo indirizzo e-mail è attualmente bloccato.\nPer ulteriori informazioni, leggi le FAQ.</item>
<item quantity="other">Per ulteriori informazioni:</item>
</plurals>
<string name="lockedMailboxBottomSheetDescription">L’accesso al tuo indirizzo e-mail è attualmente bloccato.\nPer ulteriori informazioni, leggi le FAQ.</string>
<string name="lockedMailboxBottomSheetTitle">L’indirizzo e-mail %s è bloccato</string>
<string name="lockedMailboxScreenDescription">Per ulteriori informazioni:</string>
<string name="lockedMailboxScreenTitle">Alcuni indirizzi e-mail bloccati</string>
<plurals name="lockedMailboxTitle">
<item quantity="one">Indirizzo e-mail bloccato</item>
<item quantity="other">Indirizzi e-mail bloccati</item>
</plurals>
<string name="lockedMailboxTitleIB">Alcuni indirizzi e-mail bloccati</string>
<string name="manageSignatures">Gestisci le mie firme</string>
<string name="menuDrawerAdvancedActions">Azioni avanzate</string>
<string name="menuDrawerMailboxStorage">%1$s / %2$s usato</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,8 @@

<declare-styleable name="InformationBlockView">
<attr name="title" />
<attr name="showTitle" format="boolean" />
<attr name="description" />
<attr name="showDescription" format="boolean" />
<attr name="button" format="string" />
<attr name="showButton" format="boolean" />
<attr name="icon" />
<attr name="showCloseIcon" format="boolean" />
</declare-styleable>
Expand Down
10 changes: 4 additions & 6 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@
</plurals>
<string name="attendeesListTitle">List of attendees (%d)</string>
<string name="bccTitle">Bcc:</string>
<string name="blockedMailboxTitle">Mailbox %s is blocked</string>
<plurals name="blockedPasswordTitle">
<item quantity="one">Blocked password</item>
<item quantity="other">Blocked passwords</item>
Expand Down Expand Up @@ -300,15 +299,14 @@
<string name="googlePlayServicesAreRequired">Google Play Services are required</string>
<string name="inboxFolder">Inbox</string>
<string name="loadingText">Loading…</string>
<plurals name="lockedMailboxDescription">
<item quantity="one">Access to your mailbox is currently blocked.\nFor further information, please read FAQ.</item>
<item quantity="other">For further information:</item>
</plurals>
<string name="lockedMailboxBottomSheetDescription">Access to your mailbox is currently blocked.\nFor further information, please read FAQ.</string>
<string name="lockedMailboxBottomSheetTitle">Mailbox %s is blocked</string>
<string name="lockedMailboxScreenDescription">For further information:</string>
<string name="lockedMailboxScreenTitle">Some of your mailboxes are blocked</string>
<plurals name="lockedMailboxTitle">
<item quantity="one">Blocked mailbox</item>
<item quantity="other">Blocked mailboxes</item>
</plurals>
<string name="lockedMailboxTitleIB">Some of your mailboxes are blocked</string>
<string name="manageSignatures">Manage my signatures</string>
<string name="menuDrawerAdvancedActions">Advanced actions</string>
<string name="menuDrawerMailboxStorage">%1$s / %2$s used</string>
Expand Down

0 comments on commit a98575d

Please sign in to comment.