Skip to content

Commit 5e0d681

Browse files
committed
Redo the tooolbar layout
1 parent b9983fa commit 5e0d681

File tree

7 files changed

+119
-76
lines changed

7 files changed

+119
-76
lines changed

app/src/main/java/com/infomaniak/mail/ui/main/folder/ThreadListMultiSelection.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class ThreadListMultiSelection {
141141
private fun displaySelectionToolbar(isMultiSelectOn: Boolean) = with(threadListFragment.binding) {
142142
val autoTransition = AutoTransition()
143143
autoTransition.duration = TOOLBAR_FADE_DURATION
144-
TransitionManager.beginDelayedTransition(toolbarLayout, autoTransition)
144+
TransitionManager.beginDelayedTransition(formatOptionsLayout, autoTransition)
145145

146146
toolbar.isGone = isMultiSelectOn
147147
toolbarSelection.isVisible = isMultiSelectOn

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

+16-5
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ class NewMessageEditorManager @Inject constructor() : NewMessageManager() {
6565
EditorAction.LINK -> fragment.notYetImplemented()
6666
EditorAction.CLOCK -> fragment.notYetImplemented()
6767
EditorAction.AI -> aiManager.openAiPrompt()
68+
EditorAction.BOLD -> {}
69+
EditorAction.ITALIC -> {}
70+
EditorAction.UNDERLINE -> {}
71+
EditorAction.STRIKE_THROUGH -> {}
72+
EditorAction.UNORDERED_LIST -> {}
6873
}
6974
}
7075
}
@@ -82,6 +87,12 @@ class NewMessageEditorManager @Inject constructor() : NewMessageManager() {
8287
linkEditor(editorLink, EditorAction.LINK)
8388
linkEditor(editorClock, EditorAction.CLOCK)
8489
linkEditor(editorAi, EditorAction.AI)
90+
91+
linkEditor(buttonBold, EditorAction.BOLD)
92+
linkEditor(buttonItalic, EditorAction.ITALIC)
93+
linkEditor(buttonUnderline, EditorAction.UNDERLINE)
94+
linkEditor(buttonStrikeThrough, EditorAction.STRIKE_THROUGH)
95+
linkEditor(buttonList, EditorAction.UNORDERED_LIST)
8596
}
8697

8798
fun setupEditorFormatActionsToggle() = with(binding) {
@@ -115,10 +126,10 @@ class NewMessageEditorManager @Inject constructor() : NewMessageManager() {
115126
LINK("addLink"),
116127
CLOCK(MatomoMail.ACTION_POSTPONE_NAME),
117128
AI("aiWriter"),
118-
// BOLD("bold"),
119-
// ITALIC("italic"),
120-
// UNDERLINE("underline"),
121-
// STRIKE_THROUGH("strikeThrough"),
122-
// UNORDERED_LIST("unorderedList"),
129+
BOLD("bold"),
130+
ITALIC("italic"),
131+
UNDERLINE("underline"),
132+
STRIKE_THROUGH("strikeThrough"),
133+
UNORDERED_LIST("unorderedList"),
123134
}
124135
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?><!--
2+
~ Copyright (C) 2024 Infomaniak Network SA
3+
~ Infomaniak Mail - Android
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+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
19+
<item android:alpha="0.25" android:color="@color/backgroundDisabledPrimaryButton" android:state_activated="true" android:state_enabled="false" />
20+
<item android:color="@color/color_primary_translucent_ripple" android:state_activated="true" />
21+
<item android:color="@android:color/transparent" />
22+
</selector>

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

+68-67
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@
505505
android:id="@+id/editorToolbar"
506506
style="@style/CardViewMail"
507507
android:layout_width="match_parent"
508-
android:layout_height="wrap_content"
508+
android:layout_height="@dimen/newMessageToolbarHeight"
509509
android:backgroundTint="@color/newMessageBackgroundColor"
510510
app:cardElevation="@dimen/newMessageBottomBarElevation"
511511
app:layout_constraintBottom_toBottomOf="parent"
@@ -524,23 +524,21 @@
524524
<com.google.android.material.button.MaterialButton
525525
android:id="@+id/editorTextOptions"
526526
style="@style/EditorIconButton"
527-
android:layout_width="0dp"
527+
android:layout_width="@dimen/newMessageToolbarItemWidth"
528528
android:layout_height="match_parent"
529529
android:contentDescription="@string/buttonTextOptionsOpen"
530-
android:visibility="gone"
531530
app:icon="@drawable/ic_editor_text_options"
532531
app:layout_constraintBottom_toBottomOf="parent"
533532
app:layout_constraintEnd_toStartOf="@id/editorAttachment"
534533
app:layout_constraintHorizontal_bias="0"
535534
app:layout_constraintHorizontal_chainStyle="packed"
536535
app:layout_constraintStart_toStartOf="parent"
537-
app:layout_constraintTop_toTopOf="parent"
538-
tools:visibility="visible" />
536+
app:layout_constraintTop_toTopOf="parent" />
539537

540538
<com.google.android.material.button.MaterialButton
541539
android:id="@+id/editorAttachment"
542540
style="@style/EditorIconButton"
543-
android:layout_width="0dp"
541+
android:layout_width="@dimen/newMessageToolbarItemWidth"
544542
android:layout_height="match_parent"
545543
android:contentDescription="@string/buttonAttachment"
546544
app:icon="@drawable/ic_attachment"
@@ -552,122 +550,124 @@
552550
<com.google.android.material.button.MaterialButton
553551
android:id="@+id/editorCamera"
554552
style="@style/EditorIconButton"
555-
android:layout_width="0dp"
553+
android:layout_width="@dimen/newMessageToolbarItemWidth"
556554
android:layout_height="match_parent"
557555
android:contentDescription="@string/buttonCamera"
558556
android:visibility="gone"
559557
app:icon="@drawable/ic_editor_camera"
560558
app:layout_constraintBottom_toBottomOf="parent"
561559
app:layout_constraintEnd_toStartOf="@+id/editorLink"
562560
app:layout_constraintStart_toEndOf="@+id/editorAttachment"
563-
app:layout_constraintTop_toTopOf="parent"
564-
tools:visibility="visible" />
561+
app:layout_constraintTop_toTopOf="parent" />
565562

566563
<com.google.android.material.button.MaterialButton
567564
android:id="@+id/editorLink"
568565
style="@style/EditorIconButton"
569-
android:layout_width="0dp"
566+
android:layout_width="@dimen/newMessageToolbarItemWidth"
570567
android:layout_height="match_parent"
571568
android:contentDescription="@string/buttonHyperlink"
572-
android:visibility="gone"
573569
app:icon="@drawable/ic_editor_link"
574570
app:layout_constraintBottom_toBottomOf="parent"
575571
app:layout_constraintEnd_toStartOf="@+id/editorClock"
576572
app:layout_constraintStart_toEndOf="@+id/editorCamera"
577-
app:layout_constraintTop_toTopOf="parent"
578-
tools:visibility="visible" />
573+
app:layout_constraintTop_toTopOf="parent" />
579574

580575
<com.google.android.material.button.MaterialButton
581576
android:id="@+id/editorClock"
582577
style="@style/EditorIconButton"
583-
android:layout_width="0dp"
578+
android:layout_width="@dimen/newMessageToolbarItemWidth"
584579
android:layout_height="match_parent"
585580
android:contentDescription="@string/buttonSchedule"
586581
android:visibility="gone"
587582
app:icon="@drawable/ic_editor_clock"
588583
app:layout_constraintBottom_toBottomOf="parent"
589584
app:layout_constraintEnd_toStartOf="@id/editorAi"
590585
app:layout_constraintStart_toEndOf="@+id/editorLink"
591-
app:layout_constraintTop_toTopOf="parent"
592-
tools:visibility="visible" />
586+
app:layout_constraintTop_toTopOf="parent" />
593587

594588
<com.google.android.material.button.MaterialButton
595589
android:id="@+id/editorAi"
596590
style="@style/EditorIconButton"
597-
android:layout_width="0dp"
591+
android:layout_width="@dimen/newMessageToolbarItemWidth"
598592
android:layout_height="match_parent"
599593
android:contentDescription="@string/buttonSchedule"
600594
android:theme="@style/AiCursorAndPrimaryColorTheme"
601595
android:visibility="gone"
602596
app:icon="@drawable/ic_ai_magic_wand"
603597
app:iconTint="@color/aiColor"
604598
app:layout_constraintBottom_toBottomOf="parent"
605-
app:layout_constraintEnd_toStartOf="@id/editorBold"
599+
app:layout_constraintEnd_toStartOf="@id/formatOptionsLayout"
606600
app:layout_constraintStart_toEndOf="@+id/editorClock"
607601
app:layout_constraintTop_toTopOf="parent"
608602
tools:visibility="visible" />
609603

610-
<com.infomaniak.mail.ui.newMessage.ToggleableTextFormatterItemView
611-
android:id="@+id/editorBold"
604+
<HorizontalScrollView
605+
android:id="@+id/formatOptionsLayout"
612606
android:layout_width="0dp"
613607
android:layout_height="match_parent"
614-
android:contentDescription="@string/buttonBold"
615-
app:icon="@drawable/ic_editor_bold"
616608
app:layout_constraintBottom_toBottomOf="parent"
617-
app:layout_constraintEnd_toStartOf="@+id/editorItalic"
618-
app:layout_constraintStart_toEndOf="@+id/editorAi"
619-
app:layout_constraintTop_toTopOf="parent" />
609+
app:layout_constraintEnd_toStartOf="@id/formatOptionsDivider"
610+
app:layout_constraintStart_toEndOf="@id/editorTextOptions"
611+
app:layout_constraintTop_toTopOf="parent">
620612

621-
<com.infomaniak.mail.ui.newMessage.ToggleableTextFormatterItemView
622-
android:id="@+id/editorItalic"
623-
android:layout_width="0dp"
624-
android:layout_height="match_parent"
625-
android:contentDescription="@string/buttonItalic"
626-
app:icon="@drawable/ic_editor_italic"
627-
app:layout_constraintBottom_toBottomOf="parent"
628-
app:layout_constraintEnd_toStartOf="@+id/editorUnderline"
629-
app:layout_constraintStart_toEndOf="@+id/editorBold"
630-
app:layout_constraintTop_toTopOf="parent" />
613+
<LinearLayout
614+
android:layout_width="wrap_content"
615+
android:layout_height="match_parent"
616+
android:orientation="horizontal">
631617

632-
<com.infomaniak.mail.ui.newMessage.ToggleableTextFormatterItemView
633-
android:id="@+id/editorUnderline"
634-
android:layout_width="0dp"
635-
android:layout_height="match_parent"
636-
android:contentDescription="@string/buttonUnderline"
637-
app:icon="@drawable/ic_editor_underline"
638-
app:layout_constraintBottom_toBottomOf="parent"
639-
app:layout_constraintEnd_toStartOf="@+id/editorStrikeThrough"
640-
app:layout_constraintStart_toEndOf="@+id/editorItalic"
641-
app:layout_constraintTop_toTopOf="parent" />
618+
<com.google.android.material.button.MaterialButton
619+
android:id="@+id/buttonList"
620+
style="@style/EditorFormatButton"
621+
android:layout_width="wrap_content"
622+
android:layout_height="wrap_content"
623+
app:icon="@drawable/ic_editor_list" />
642624

643-
<com.infomaniak.mail.ui.newMessage.ToggleableTextFormatterItemView
644-
android:id="@+id/editorStrikeThrough"
645-
android:layout_width="0dp"
646-
android:layout_height="match_parent"
647-
android:contentDescription="@string/buttonStrikeThrough"
648-
app:icon="@drawable/ic_editor_strikethrough"
649-
app:layout_constraintBottom_toBottomOf="parent"
650-
app:layout_constraintEnd_toStartOf="@+id/editorList"
651-
app:layout_constraintStart_toEndOf="@+id/editorUnderline"
652-
app:layout_constraintTop_toTopOf="parent" />
625+
<com.google.android.material.button.MaterialButton
626+
android:id="@+id/buttonBold"
627+
style="@style/EditorFormatButton"
628+
android:layout_width="wrap_content"
629+
android:layout_height="wrap_content"
630+
app:icon="@drawable/ic_editor_bold" />
653631

654-
<com.google.android.material.button.MaterialButton
655-
android:id="@+id/editorList"
656-
style="@style/EditorIconButton"
657-
android:layout_width="0dp"
658-
android:layout_height="match_parent"
659-
android:contentDescription="@string/buttonBulletPoint"
660-
android:minWidth="0dp"
661-
app:icon="@drawable/ic_editor_list"
632+
<com.google.android.material.button.MaterialButton
633+
android:id="@+id/buttonItalic"
634+
style="@style/EditorFormatButton"
635+
android:layout_width="wrap_content"
636+
android:layout_height="wrap_content"
637+
app:icon="@drawable/ic_editor_italic" />
638+
639+
<com.google.android.material.button.MaterialButton
640+
android:id="@+id/buttonUnderline"
641+
style="@style/EditorFormatButton"
642+
android:layout_width="wrap_content"
643+
android:layout_height="wrap_content"
644+
app:icon="@drawable/ic_editor_underline" />
645+
646+
<com.google.android.material.button.MaterialButton
647+
android:id="@+id/buttonStrikeThrough"
648+
style="@style/EditorFormatButton"
649+
android:layout_width="wrap_content"
650+
android:layout_height="wrap_content"
651+
app:icon="@drawable/ic_editor_strikethrough" />
652+
653+
</LinearLayout>
654+
</HorizontalScrollView>
655+
656+
<com.google.android.material.divider.MaterialDivider
657+
android:id="@+id/formatOptionsDivider"
658+
android:layout_width="1dp"
659+
android:layout_height="0dp"
660+
android:layout_marginVertical="@dimen/marginStandardSmall"
662661
app:layout_constraintBottom_toBottomOf="parent"
663662
app:layout_constraintEnd_toStartOf="@id/sendButton"
664-
app:layout_constraintStart_toEndOf="@+id/editorStrikeThrough"
663+
app:layout_constraintStart_toEndOf="@id/formatOptionsLayout"
665664
app:layout_constraintTop_toTopOf="parent" />
666665

667666
<com.google.android.material.button.MaterialButton
668667
android:id="@+id/sendButton"
669668
style="@style/IconButton"
670669
android:layout_width="80dp"
670+
android:layout_height="match_parent"
671671
android:layout_gravity="end"
672672
android:contentDescription="@string/send"
673673
app:icon="@drawable/ic_send"
@@ -680,17 +680,18 @@
680680
android:layout_width="wrap_content"
681681
android:layout_height="wrap_content"
682682
android:visibility="gone"
683-
app:constraint_referenced_ids="editorBold,editorItalic,editorUnderline,editorStrikeThrough,editorList" />
683+
app:constraint_referenced_ids="formatOptionsLayout,formatOptionsDivider"
684+
tools:visibility="visible" />
684685

685686
<androidx.constraintlayout.widget.Group
686687
android:id="@+id/editorActions"
687688
android:layout_width="wrap_content"
688689
android:layout_height="wrap_content"
689-
app:constraint_referenced_ids="editorAttachment" />
690+
app:constraint_referenced_ids="editorAttachment,editorAi,editorLink"
691+
tools:visibility="gone" />
690692

691693
</androidx.constraintlayout.widget.ConstraintLayout>
692694
</com.google.android.material.card.MaterialCardView>
693-
694695
</androidx.constraintlayout.widget.ConstraintLayout>
695696

696697
<ImageView

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
android:layout_height="wrap_content">
4242

4343
<FrameLayout
44-
android:id="@+id/toolbarLayout"
44+
android:id="@+id/formatOptionsLayout"
4545
android:layout_width="match_parent"
4646
android:layout_height="wrap_content"
4747
app:layout_constraintEnd_toEndOf="parent"
@@ -135,7 +135,7 @@
135135
app:layout_constraintBottom_toBottomOf="parent"
136136
app:layout_constraintEnd_toStartOf="@id/unreadCountChip"
137137
app:layout_constraintStart_toStartOf="parent"
138-
app:layout_constraintTop_toBottomOf="@id/toolbarLayout">
138+
app:layout_constraintTop_toBottomOf="@id/formatOptionsLayout">
139139

140140
<TextView
141141
android:id="@+id/noNetwork"

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

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
<dimen name="textButtonPrimaryMediumHeight">40dp</dimen>
4646
<dimen name="mediumButtonHorizontalMargin">20dp</dimen>
4747
<dimen name="threadHorizontalMargin">@dimen/marginStandardMedium</dimen>
48+
<dimen name="newMessageToolbarItemWidth">64dp</dimen>
49+
<dimen name="newMessageToolbarHeight">48dp</dimen>
4850

4951
<!-- Menu Drawer -->
5052
<dimen name="decoratedItemViewHeight">48dp</dimen>

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,17 @@
236236
<item name="android:textSize">10sp</item>
237237
<item name="cornerRadius">0dp</item>
238238
<item name="iconSize">24dp</item>
239-
<item name="layout_constraintWidth_max">64dp</item>
239+
<item name="android:minHeight">48dp</item>
240240
<item name="rippleColor">?android:attr/colorControlHighlight</item>
241241
</style>
242242

243+
244+
<style name="EditorFormatButton" parent="Widget.Material3.Button.IconButton">
245+
<item name="android:minWidth">48dp</item>
246+
<item name="backgroundTint">@color/editor_button_background</item>
247+
<item name="iconTint">@color/iconColor</item>
248+
</style>
249+
243250
<style name="QuickBottomActionBarButton" parent="Widget.Material3.Button.TextButton">
244251
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
245252
<item name="android:fontFamily">@font/suisseintl_medium</item>

0 commit comments

Comments
 (0)