Improved main screens' top bar

This commit is contained in:
Sylvain Berfini 2024-07-18 14:21:02 +02:00
parent 4c9bdec61e
commit 22795a5284
14 changed files with 85 additions and 130 deletions

View file

@ -171,7 +171,7 @@ class ContactsListFragment : AbstractMainFragment() {
}
binding.setFilterClickListener {
showFilterPopupMenu(binding.filter)
showFilterPopupMenu(binding.topBar.extraAction)
}
sharedViewModel.showContactEvent.observe(

View file

@ -33,7 +33,7 @@ import com.google.android.material.textfield.TextInputLayout
import org.linphone.R
import org.linphone.core.tools.Log
import org.linphone.databinding.BottomNavBarBinding
import org.linphone.databinding.TopBarBinding
import org.linphone.databinding.MainActivityTopBarBinding
import org.linphone.ui.main.MainActivity
import org.linphone.ui.main.chat.fragment.ConversationsListFragmentDirections
import org.linphone.ui.main.contacts.fragment.ContactsListFragmentDirections
@ -144,7 +144,7 @@ abstract class AbstractMainFragment : GenericMainFragment() {
fun initViews(
slidingPane: SlidingPaneLayout,
topBar: TopBarBinding,
topBar: MainActivityTopBarBinding,
navBar: BottomNavBarBinding,
@IdRes fragmentId: Int
) {

View file

@ -299,7 +299,7 @@ class HistoryListFragment : AbstractMainFragment() {
// Elevation is for showing a shadow around the popup
popupWindow.elevation = 20f
popupWindow.showAsDropDown(binding.menu, 0, 0, Gravity.BOTTOM)
popupWindow.showAsDropDown(binding.topBar.extraAction, 0, 0, Gravity.BOTTOM)
}
private fun showDeleteConfirmationDialog() {

View file

@ -1,9 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="96dp"
android:height="96dp"
android:width="24dp"
android:height="24dp"
android:viewportWidth="256"
android:viewportHeight="256">
<path
android:pathData="M230.6,49.53A15.81,15.81 0,0 0,216 40L40,40A16,16 0,0 0,28.19 66.76l0.08,0.09L96,139.17L96,216a16,16 0,0 0,24.87 13.32l32,-21.34A16,16 0,0 0,160 194.66L160,139.17l67.74,-72.32 0.08,-0.09A15.8,15.8 0,0 0,230.6 49.53ZM40,56h0ZM148.34,128.28A15.92,15.92 0,0 0,144 139.17v55.49L112,216L112,139.17a15.92,15.92 0,0 0,-4.32 -10.94L40,56L216,56Z"
android:pathData="M230.6,49.53A15.81,15.81 0,0 0,216 40L40,40A16,16 0,0 0,28.19 66.76l0.08,0.09L96,139.17L96,216a16,16 0,0 0,24.87 13.32l32,-21.34A16,16 0,0 0,160 194.66L160,139.17l67.74,-72.32 0.08,-0.09A15.8,15.8 0,0 0,230.6 49.53ZM40,56h0ZM146.18,130.58A8,8 0,0 0,144 136v58.66L112,216L112,136a8,8 0,0 0,-2.16 -5.47L40,56L216,56Z"
android:fillColor="#4e6074"/>
</vector>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:bottomLeftRadius="10dp" android:bottomRightRadius="10dp" />
<solid android:color="?attr/color_main1_500" />
</shape>

View file

@ -27,8 +27,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/color_main1_500">
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Group
android:layout_width="wrap_content"
@ -48,11 +47,10 @@
<include
android:id="@+id/top_bar"
layout="@layout/top_bar"
layout="@layout/main_activity_top_bar"
bind:viewModel="@{viewModel}"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:layout_marginEnd="9dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/bottom_nav_bar"
app:layout_constraintEnd_toEndOf="parent"/>

View file

@ -27,8 +27,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/color_main1_500">
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Group
android:layout_width="wrap_content"
@ -48,28 +47,17 @@
<include
android:id="@+id/top_bar"
layout="@layout/top_bar"
layout="@layout/main_activity_top_bar"
bind:viewModel="@{viewModel}"
bind:enableExtraAction="@{true}"
bind:extraActionIcon="@{@drawable/funnel}"
bind:extraActionClickListener="@{filterClickListener}"
bind:extraActionContentDescription="@{@string/content_description_contacts_list_filters}"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:layout_marginEnd="9dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/bottom_nav_bar"
app:layout_constraintEnd_toStartOf="@id/filter"/>
<ImageView
android:onClick="@{filterClickListener}"
android:id="@+id/filter"
android:layout_width="@dimen/icon_size"
android:layout_height="0dp"
android:layout_marginEnd="9dp"
android:src="@drawable/funnel"
android:contentDescription="@string/content_description_contacts_list_filters"
android:visibility="@{viewModel.searchBarVisible ? View.GONE : View.VISIBLE}"
app:tint="?attr/color_on_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/top_bar"
app:layout_constraintBottom_toBottomOf="@id/top_bar" />
app:layout_constraintEnd_toEndOf="parent"/>
<LinearLayout
android:id="@+id/lists"

View file

@ -33,8 +33,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/color_main1_500">
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Group
android:layout_width="wrap_content"
@ -54,28 +53,17 @@
<include
android:id="@+id/top_bar"
layout="@layout/top_bar"
layout="@layout/main_activity_top_bar"
bind:viewModel="@{viewModel}"
bind:enableExtraAction="@{true}"
bind:extraActionIcon="@{@drawable/dots_three_vertical}"
bind:extraActionClickListener="@{menuClickListener}"
bind:extraActionContentDescription="@{@string/content_description_show_popup_menu}"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:layout_marginEnd="9dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/bottom_nav_bar"
app:layout_constraintEnd_toStartOf="@id/menu"/>
<ImageView
android:onClick="@{menuClickListener}"
android:id="@+id/menu"
android:layout_width="@dimen/icon_size"
android:layout_height="0dp"
android:layout_marginEnd="9dp"
android:src="@drawable/dots_three_vertical"
android:contentDescription="@string/content_description_show_popup_menu"
android:visibility="@{viewModel.searchBarVisible ? View.GONE : View.VISIBLE}"
app:tint="?attr/color_on_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/top_bar"
app:layout_constraintBottom_toBottomOf="@id/top_bar" />
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView
android:id="@+id/background"

View file

@ -30,8 +30,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/color_main1_500">
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Group
android:layout_width="wrap_content"
@ -51,28 +50,17 @@
<include
android:id="@+id/top_bar"
layout="@layout/top_bar"
layout="@layout/main_activity_top_bar"
bind:viewModel="@{viewModel}"
bind:enableExtraAction="@{true}"
bind:extraActionIcon="@{@drawable/calendar}"
bind:extraActionClickListener="@{todayClickListener}"
bind:extraActionContentDescription="@{@string/content_description_meeting_today}"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:layout_marginEnd="9dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/bottom_nav_bar"
app:layout_constraintEnd_toStartOf="@id/today"/>
<ImageView
android:onClick="@{todayClickListener}"
android:id="@+id/today"
android:layout_width="@dimen/icon_size"
android:layout_height="0dp"
android:layout_marginEnd="9dp"
android:src="@drawable/calendar"
android:contentDescription="@string/content_description_meeting_today"
android:visibility="@{viewModel.searchBarVisible ? View.GONE : View.VISIBLE}"
app:tint="?attr/color_on_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/top_bar"
app:layout_constraintBottom_toBottomOf="@id/top_bar" />
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView
android:id="@+id/background"

View file

@ -27,8 +27,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/color_main1_500">
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Group
android:layout_width="wrap_content"
@ -38,11 +37,10 @@
<include
android:id="@+id/top_bar"
layout="@layout/top_bar"
layout="@layout/main_activity_top_bar"
bind:viewModel="@{viewModel}"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:layout_marginEnd="9dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

View file

@ -27,8 +27,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/color_main1_500">
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Group
android:layout_width="wrap_content"
@ -38,28 +37,17 @@
<include
android:id="@+id/top_bar"
layout="@layout/top_bar"
layout="@layout/main_activity_top_bar"
bind:viewModel="@{viewModel}"
bind:enableExtraAction="@{true}"
bind:extraActionIcon="@{@drawable/funnel}"
bind:extraActionClickListener="@{filterClickListener}"
bind:extraActionContentDescription="@{@string/content_description_contacts_list_filters}"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:layout_marginEnd="9dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/filter"/>
<ImageView
android:onClick="@{filterClickListener}"
android:id="@+id/filter"
android:layout_width="@dimen/icon_size"
android:layout_height="0dp"
android:layout_marginEnd="9dp"
android:src="@drawable/funnel"
android:contentDescription="@string/content_description_contacts_list_filters"
android:visibility="@{viewModel.searchBarVisible ? View.GONE : View.VISIBLE}"
app:tint="?attr/color_on_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/top_bar"
app:layout_constraintBottom_toBottomOf="@id/top_bar" />
app:layout_constraintEnd_toEndOf="parent"/>
<LinearLayout
android:id="@+id/lists"

View file

@ -33,8 +33,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/color_main1_500">
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Group
android:layout_width="wrap_content"
@ -44,28 +43,17 @@
<include
android:id="@+id/top_bar"
layout="@layout/top_bar"
layout="@layout/main_activity_top_bar"
bind:viewModel="@{viewModel}"
bind:enableExtraAction="@{true}"
bind:extraActionIcon="@{@drawable/dots_three_vertical}"
bind:extraActionClickListener="@{menuClickListener}"
bind:extraActionContentDescription="@{@string/content_description_show_popup_menu}"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:layout_marginEnd="9dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/menu"/>
<ImageView
android:onClick="@{menuClickListener}"
android:id="@+id/menu"
android:layout_width="@dimen/icon_size"
android:layout_height="0dp"
android:layout_marginEnd="9dp"
android:src="@drawable/dots_three_vertical"
android:contentDescription="@string/content_description_show_popup_menu"
android:visibility="@{viewModel.searchBarVisible ? View.GONE : View.VISIBLE}"
app:tint="?attr/color_on_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/top_bar"
app:layout_constraintBottom_toBottomOf="@id/top_bar" />
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView
android:id="@+id/background"

View file

@ -5,6 +5,18 @@
<data>
<import type="android.view.View" />
<variable
name="enableExtraAction"
type="Boolean" />
<variable
name="extraActionClickListener"
type="View.OnClickListener" />
<variable
name="extraActionIcon"
type="android.graphics.drawable.Drawable" />
<variable
name="extraActionContentDescription"
type="String" />
<variable
name="viewModel"
type="org.linphone.ui.main.viewmodel.AbstractMainViewModel" />
@ -13,7 +25,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="@dimen/top_bar_height"
android:background="?attr/color_main1_500">
android:background="@drawable/shape_squircle_main1_500">
<androidx.constraintlayout.widget.Group
android:layout_width="wrap_content"
@ -70,6 +82,20 @@
android:src="@drawable/magnifying_glass"
android:contentDescription="@string/content_description_open_filter"
app:layout_constraintBottom_toBottomOf="@id/title"
app:layout_constraintEnd_toStartOf="@id/extra_action"
app:layout_constraintTop_toTopOf="@id/title"
app:tint="?attr/color_on_main" />
<ImageView
android:id="@+id/extra_action"
android:onClick="@{extraActionClickListener}"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:padding="15dp"
android:src="@{extraActionIcon, default=@drawable/dots_three_vertical}"
android:contentDescription="@{extraActionContentDescription}"
android:visibility="@{enableExtraAction ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintBottom_toBottomOf="@id/title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/title"
app:tint="?attr/color_on_main" />

View file

@ -30,8 +30,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/color_main1_500">
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Group
android:layout_width="wrap_content"
@ -41,28 +40,17 @@
<include
android:id="@+id/top_bar"
layout="@layout/top_bar"
layout="@layout/main_activity_top_bar"
bind:viewModel="@{viewModel}"
bind:enableExtraAction="@{true}"
bind:extraActionIcon="@{@drawable/calendar}"
bind:extraActionClickListener="@{todayClickListener}"
bind:extraActionContentDescription="@{@string/content_description_meeting_today}"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:layout_marginEnd="9dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/today"/>
<ImageView
android:onClick="@{todayClickListener}"
android:id="@+id/today"
android:layout_width="@dimen/icon_size"
android:layout_height="0dp"
android:layout_marginEnd="9dp"
android:src="@drawable/calendar"
android:contentDescription="@string/content_description_meeting_today"
android:visibility="@{viewModel.searchBarVisible ? View.GONE : View.VISIBLE}"
app:tint="?attr/color_on_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/top_bar"
app:layout_constraintBottom_toBottomOf="@id/top_bar" />
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView
android:id="@+id/background"