Skip to content

Commit 9fe85e3

Browse files
Merge pull request #1693 from Infomaniak/update-ai-loader
Update AI loader to be more visible
2 parents 45af186 + 3371cb8 commit 9fe85e3

File tree

10 files changed

+92
-36
lines changed

10 files changed

+92
-36
lines changed

app/src/main/java/com/infomaniak/mail/ui/newMessage/AiPropositionFragment.kt

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Infomaniak Mail - Android
3-
* Copyright (C) 2023 Infomaniak Network SA
3+
* Copyright (C) 2023-2024 Infomaniak Network SA
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -325,9 +325,15 @@ class AiPropositionFragment : Fragment() {
325325
}
326326
}
327327

328+
private fun setGenerationLoaderVisible(isVisible: Boolean) = with(binding) {
329+
generationLoaderText.isVisible = isVisible
330+
generationLoaderProgressBar.isVisible = isVisible
331+
generationLoaderGradient.isVisible = isVisible
332+
}
333+
328334
private fun displayLoadingVisibility() = with(binding) {
329335
loadingPlaceholder.isVisible = true
330-
generationLoader.isVisible = true
336+
setGenerationLoaderVisible(true)
331337

332338
propositionTextView.isGone = true
333339
buttonLayout.isInvisible = true
@@ -340,7 +346,7 @@ class AiPropositionFragment : Fragment() {
340346

341347
private fun displayPropositionVisibility() = with(binding) {
342348
loadingPlaceholder.isGone = true
343-
generationLoader.isGone = true
349+
setGenerationLoaderVisible(false)
344350

345351
propositionTextView.isVisible = true
346352
buttonLayout.isVisible = true
@@ -374,7 +380,7 @@ class AiPropositionFragment : Fragment() {
374380
retryButton.isGone = true
375381
}
376382

377-
generationLoader.isGone = true
383+
setGenerationLoaderVisible(false)
378384

379385
errorBlock.isVisible = true
380386

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?><!--
2+
~ Infomaniak Mail - Android
3+
~ Copyright (C) 2024 Infomaniak Network SA
4+
~
5+
~ This program is free software: you can redistribute it and/or modify
6+
~ it under the terms of the GNU General Public License as published by
7+
~ the Free Software Foundation, either version 3 of the License, or
8+
~ (at your option) any later version.
9+
~
10+
~ This program is distributed in the hope that it will be useful,
11+
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
~ GNU General Public License for more details.
14+
~
15+
~ You should have received a copy of the GNU General Public License
16+
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
-->
18+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
19+
android:shape="rectangle">
20+
<gradient
21+
android:angle="90"
22+
android:centerColor="@color/partiallyTransparentBackgroundColor"
23+
android:centerX="0.82"
24+
android:endColor="@android:color/transparent"
25+
android:startColor="@color/backgroundColor" />
26+
</shape>

app/src/main/res/layout/fragment_ai_proposition.xml

+47-27
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?><!--
22
~ Infomaniak Mail - Android
3-
~ Copyright (C) 2023 Infomaniak Network SA
3+
~ Copyright (C) 2023-2024 Infomaniak Network SA
44
~
55
~ This program is free software: you can redistribute it and/or modify
66
~ it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
1515
~ You should have received a copy of the GNU General Public License
1616
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
-->
18-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
18+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
1919
xmlns:app="http://schemas.android.com/apk/res-auto"
2020
xmlns:tools="http://schemas.android.com/tools"
2121
android:layout_width="match_parent"
@@ -27,6 +27,9 @@
2727
android:id="@+id/toolbar"
2828
android:layout_width="match_parent"
2929
android:layout_height="wrap_content"
30+
app:layout_constraintEnd_toEndOf="parent"
31+
app:layout_constraintStart_toStartOf="parent"
32+
app:layout_constraintTop_toTopOf="parent"
3033
app:navigationIcon="@drawable/ic_close_big"
3134
app:navigationIconTint="@color/iconColor"
3235
app:titleCentered="true"
@@ -37,7 +40,10 @@
3740
android:id="@+id/nestedScrollView"
3841
android:layout_width="match_parent"
3942
android:layout_height="0dp"
40-
android:layout_weight="1">
43+
app:layout_constraintBottom_toTopOf="@id/aiPropositionBottomBar"
44+
app:layout_constraintEnd_toEndOf="parent"
45+
app:layout_constraintStart_toStartOf="parent"
46+
app:layout_constraintTop_toBottomOf="@id/toolbar">
4147

4248
<LinearLayout
4349
android:layout_width="match_parent"
@@ -86,13 +92,41 @@
8692

8793
</androidx.core.widget.NestedScrollView>
8894

95+
<ImageView
96+
android:id="@+id/generationLoaderGradient"
97+
android:layout_width="match_parent"
98+
android:layout_height="136dp"
99+
android:importantForAccessibility="no"
100+
android:src="@drawable/ai_proposition_loader_gradient"
101+
app:layout_constraintBottom_toTopOf="@id/aiPropositionBottomBar"
102+
app:layout_constraintEnd_toEndOf="parent"
103+
app:layout_constraintStart_toStartOf="parent"
104+
app:layout_constraintTop_toBottomOf="@id/toolbar"
105+
app:layout_constraintVertical_bias="1"
106+
tools:visibility="gone" />
107+
108+
<ProgressBar
109+
android:id="@+id/generationLoaderProgressBar"
110+
android:layout_width="48dp"
111+
android:layout_height="48dp"
112+
android:layout_gravity="center_vertical"
113+
android:layout_marginBottom="@dimen/marginStandard"
114+
android:indeterminate="true"
115+
app:layout_constraintBottom_toTopOf="@id/aiPropositionBottomBar"
116+
app:layout_constraintEnd_toEndOf="parent"
117+
app:layout_constraintStart_toStartOf="parent"
118+
tools:visibility="gone" />
119+
89120
<com.google.android.material.card.MaterialCardView
90121
android:id="@+id/aiPropositionBottomBar"
91122
style="@style/CardViewMail"
92123
android:layout_width="match_parent"
93124
android:layout_height="wrap_content"
94125
android:layout_gravity="bottom"
95-
app:cardElevation="@dimen/newMessageBottomBarElevation">
126+
app:cardElevation="@dimen/newMessageBottomBarElevation"
127+
app:layout_constraintBottom_toBottomOf="parent"
128+
app:layout_constraintEnd_toEndOf="parent"
129+
app:layout_constraintStart_toStartOf="parent">
96130

97131
<LinearLayout
98132
android:layout_width="match_parent"
@@ -145,29 +179,15 @@
145179

146180
</LinearLayout>
147181

148-
<LinearLayout
149-
android:id="@+id/generationLoader"
150-
android:layout_width="wrap_content"
182+
<TextView
183+
android:id="@+id/generationLoaderText"
184+
style="@style/BodyMedium.Tertiary"
185+
android:layout_width="match_parent"
151186
android:layout_height="wrap_content"
152-
android:layout_gravity="center_vertical|end"
153-
android:orientation="horizontal"
154-
tools:visibility="gone">
155-
156-
<TextView
157-
style="@style/BodyMedium.Tertiary"
158-
android:layout_width="wrap_content"
159-
android:layout_height="wrap_content"
160-
android:layout_gravity="center_vertical"
161-
android:layout_marginEnd="@dimen/marginStandardMedium"
162-
android:text="@string/aiPromptGenerationLoader" />
163-
164-
<ProgressBar
165-
android:layout_width="@dimen/marginStandardMedium"
166-
android:layout_height="@dimen/marginStandardMedium"
167-
android:layout_gravity="center_vertical"
168-
android:indeterminate="true" />
169-
170-
</LinearLayout>
187+
android:layout_gravity="center_vertical"
188+
android:gravity="end|center_vertical"
189+
android:text="@string/aiPromptGenerationLoader"
190+
tools:visibility="gone" />
171191

172192
<com.google.android.material.button.MaterialButton
173193
android:id="@+id/retryButton"
@@ -181,4 +201,4 @@
181201
</FrameLayout>
182202
</LinearLayout>
183203
</com.google.android.material.card.MaterialCardView>
184-
</LinearLayout>
204+
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/values-de/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<string name="aiPromptExample3">eine Dankesmail für eine Einladung zu einer Veranstaltung</string>
7575
<string name="aiPromptExample4">eine Einladungsmail zu einer Firmenveranstaltung</string>
7676
<string name="aiPromptExample5">eine E-Mail mit der Bitte um einen Termin mit einem wichtigen Kunden</string>
77-
<string name="aiPromptGenerationLoader">Der Assistent schreibt</string>
77+
<string name="aiPromptGenerationLoader">Der Assistent schreibt</string>
7878
<string name="aiPromptPlaceholder">Sagen Sie dem Schreibassistenten, was Sie schreiben wollen. Zum Beispiel: \"%s\".</string>
7979
<string name="aiPromptTag">Beta</string>
8080
<string name="aiPromptTitle">Schreibassistent</string>

app/src/main/res/values-es/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<string name="aiPromptExample3">un correo electrónico de agradecimiento por una invitación a un acto</string>
7575
<string name="aiPromptExample4">una invitación a un acto de empresa</string>
7676
<string name="aiPromptExample5">un correo electrónico solicitando una reunión con un cliente importante</string>
77-
<string name="aiPromptGenerationLoader">El asistente está escribiendo</string>
77+
<string name="aiPromptGenerationLoader">El asistente está escribiendo</string>
7878
<string name="aiPromptPlaceholder">Dígale al asistente de redacción lo que quiere escribir. Por ejemplo, \"%s\".</string>
7979
<string name="aiPromptTag">Beta</string>
8080
<string name="aiPromptTitle">Asistente de redacción</string>

app/src/main/res/values-fr/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<string name="aiPromptExample3">un e-mail de remerciement pour une invitation à un évènement</string>
7575
<string name="aiPromptExample4">un e-mail d’invitation à un évènement d’entreprise</string>
7676
<string name="aiPromptExample5">un e-mail de demande de rendez-vous avec un client important</string>
77-
<string name="aiPromptGenerationLoader">L’assistant est en train d’écrire</string>
77+
<string name="aiPromptGenerationLoader">L’assistant est en train d’écrire</string>
7878
<string name="aiPromptPlaceholder">Dites à l’assistant à la rédaction ce que vous souhaitez écrire. Par exemple \"%s\".</string>
7979
<string name="aiPromptTag">Beta</string>
8080
<string name="aiPromptTitle">Assistant à la rédaction</string>

app/src/main/res/values-it/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<string name="aiPromptExample3">un’e-mail di ringraziamento per un invito a un evento</string>
7575
<string name="aiPromptExample4">un invito a un evento aziendale</string>
7676
<string name="aiPromptExample5">un’e-mail di richiesta di incontro con un cliente importante</string>
77-
<string name="aiPromptGenerationLoader">L’assistente sta scrivendo</string>
77+
<string name="aiPromptGenerationLoader">L’assistente sta scrivendo</string>
7878
<string name="aiPromptPlaceholder">Comunica all’assistente di scrittura cosa vuoi scrivere. Ad esempio, \"%s\".</string>
7979
<string name="aiPromptTag">Beta</string>
8080
<string name="aiPromptTitle">Assistente di scrittura</string>

app/src/main/res/values-night/colors.xml

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<!-- Backgrounds -->
3939
<color name="searchBarBackgroundColor">@color/orca</color>
4040
<color name="backgroundColor">@color/background_color_dark</color>
41+
<color name="partiallyTransparentBackgroundColor">@color/partially_transparent_background_color_dark</color>
4142
<color name="backgroundColorSecondary">@color/bat</color>
4243
<color name="backgroundColorTertiary">@color/orca</color>
4344
<color name="backgroundHeaderColor">#212121</color>

app/src/main/res/values/colors.xml

+3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
<color name="blue_mail_on_primary_dark">#061C35</color>
5252

5353
<color name="background_color_light">@color/white</color>
54+
<color name="partially_transparent_background_color_light">#40FFFFFF</color>
5455
<color name="background_color_dark">#101010</color>
56+
<color name="partially_transparent_background_color_dark">#40101010</color>
5557

5658
<color name="yellow_light">#FFC10A</color>
5759
<color name="yellow_dark">#FFDF9E</color>
@@ -97,6 +99,7 @@
9799
<!-- Backgrounds -->
98100
<color name="searchBarBackgroundColor">@color/polar_bear</color>
99101
<color name="backgroundColor">@color/background_color_light</color>
102+
<color name="partiallyTransparentBackgroundColor">@color/partially_transparent_background_color_light</color>
100103
<color name="backgroundColorSecondary">@color/white</color>
101104
<color name="backgroundColorTertiary">@color/white</color>
102105
<color name="backgroundHeaderColor">@color/header_color_light</color>

app/src/main/res/values/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<string name="aiPromptExample3">a thank-you email for an invitation to an event</string>
8181
<string name="aiPromptExample4">an invitation to a company event</string>
8282
<string name="aiPromptExample5">an email requesting an appointment with an important customer</string>
83-
<string name="aiPromptGenerationLoader">The AI writing assistant is composing</string>
83+
<string name="aiPromptGenerationLoader">The AI writing assistant is composing</string>
8484
<string name="aiPromptPlaceholder">Tell the AI writing assistant what you want to write. For example, \"%s\".</string>
8585
<string name="aiPromptTag">Beta</string>
8686
<string name="aiPromptTitle">The AI writing assistant</string>

0 commit comments

Comments
 (0)