mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Use AppCompatTextView + only one bottom nav bar layout
This commit is contained in:
parent
5dfd04ad70
commit
3bceafef80
15 changed files with 67 additions and 136 deletions
|
|
@ -24,7 +24,7 @@ import android.view.View
|
|||
import android.view.Window
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
|
|
@ -81,10 +81,17 @@ fun ImageView.setSourceImageResource(resource: Int) {
|
|||
}
|
||||
|
||||
@BindingAdapter("android:textStyle")
|
||||
fun TextView.setTypeface(typeface: Int) {
|
||||
fun AppCompatTextView.setTypeface(typeface: Int) {
|
||||
this.setTypeface(null, typeface)
|
||||
}
|
||||
|
||||
@BindingAdapter("android:drawableTint")
|
||||
fun AppCompatTextView.setDrawableTint(color: Int) {
|
||||
for (drawable in compoundDrawablesRelative) {
|
||||
drawable?.setTint(color)
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("coilContact")
|
||||
fun loadContactPictureWithCoil(imageView: ImageView, contact: ContactData?) {
|
||||
if (contact == null) {
|
||||
|
|
|
|||
|
|
@ -5,9 +5,25 @@
|
|||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<import type="android.graphics.Typeface" />
|
||||
<variable
|
||||
name="onContactsClicked"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="onConversationsClicked"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="contactsSelected"
|
||||
type="Boolean" />
|
||||
<variable
|
||||
name="callsSelected"
|
||||
type="Boolean" />
|
||||
<variable
|
||||
name="conversationsSelected"
|
||||
type="Boolean" />
|
||||
<variable
|
||||
name="meetingsSelected"
|
||||
type="Boolean" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
@ -16,7 +32,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{onContactsClicked}"
|
||||
android:id="@+id/contacts"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -28,14 +45,14 @@
|
|||
android:textSize="11sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/gray_9"
|
||||
android:drawableTint="@color/primary_color"
|
||||
android:textStyle="bold"
|
||||
android:drawableTint="@{contactsSelected ? @color/primary_color : @color/gray_9, default=@color/gray_9}"
|
||||
android:textStyle="@{contactsSelected ? Typeface.BOLD : Typeface.NORMAL}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/calls"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/calls"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -48,13 +65,14 @@
|
|||
android:textSize="11sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/gray_9"
|
||||
android:drawableTint="@color/gray_9"
|
||||
android:drawableTint="@{callsSelected ? @color/primary_color : @color/gray_9, default=@color/gray_9}"
|
||||
android:textStyle="@{callsSelected ? Typeface.BOLD : Typeface.NORMAL}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/conversations"
|
||||
app:layout_constraintStart_toEndOf="@id/contacts"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{onConversationsClicked}"
|
||||
android:id="@+id/conversations"
|
||||
android:layout_width="0dp"
|
||||
|
|
@ -68,13 +86,14 @@
|
|||
android:textSize="11sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/gray_9"
|
||||
android:drawableTint="@color/gray_9"
|
||||
android:drawableTint="@{conversationsSelected ? @color/primary_color : @color/gray_9, default=@color/gray_9}"
|
||||
android:textStyle="@{conversationsSelected ? Typeface.BOLD : Typeface.NORMAL}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/meetings"
|
||||
app:layout_constraintStart_toEndOf="@id/calls"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/meetings"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -87,7 +106,8 @@
|
|||
android:textSize="11sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/gray_9"
|
||||
android:drawableTint="@color/gray_9"
|
||||
android:drawableTint="@{meetingsSelected ? @color/primary_color : @color/gray_9, default=@color/gray_9}"
|
||||
android:textStyle="@{meetingsSelected ? Typeface.BOLD : Typeface.NORMAL}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/conversations"
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="onContactsClicked"
|
||||
type="View.OnClickListener" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:transitionName="bottom_nav_bar"
|
||||
android:id="@+id/bottom_nav_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:onClick="@{onContactsClicked}"
|
||||
android:id="@+id/contacts"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:drawableTop="@drawable/contacts"
|
||||
android:drawablePadding="10dp"
|
||||
android:text="Contacts"
|
||||
android:textSize="11sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/gray_9"
|
||||
android:drawableTint="@color/gray_9"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/calls"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/calls"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="18dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:drawableTop="@drawable/calls"
|
||||
android:drawablePadding="10dp"
|
||||
android:text="Calls"
|
||||
android:textSize="11sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/gray_9"
|
||||
android:drawableTint="@color/gray_9"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/conversations"
|
||||
app:layout_constraintStart_toEndOf="@id/contacts"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/conversations"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="18dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:drawableTop="@drawable/conversations"
|
||||
android:drawablePadding="10dp"
|
||||
android:text="Conversations"
|
||||
android:textSize="11sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/gray_9"
|
||||
android:drawableTint="@color/primary_color"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/meetings"
|
||||
app:layout_constraintStart_toEndOf="@id/calls"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/meetings"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="18dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:drawableTop="@drawable/meetings"
|
||||
android:drawablePadding="10dp"
|
||||
android:text="Meetings"
|
||||
android:textSize="11sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/gray_9"
|
||||
android:drawableTint="@color/gray_9"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/conversations"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/avatar"/>
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/timestamp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/timestamp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
app:layout_constraintTop_toTopOf="@id/event_text"
|
||||
app:layout_constraintBottom_toBottomOf="@id/event_text"/>
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/event_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
app:layout_constraintEnd_toStartOf="@id/date_time"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/subtitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
app:layout_constraintEnd_toStartOf="@id/end_subtitle_barrier"
|
||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/date_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
app:layout_constraintTop_toTopOf="@id/subtitle"
|
||||
app:layout_constraintBottom_toBottomOf="@id/subtitle"/>
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/unread"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:background="@color/separator">
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/mark_as_read"
|
||||
android:onClick="@{markAsReadClickListener}"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/mute"
|
||||
android:onClick="@{muteClickListener}"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/unmute"
|
||||
android:onClick="@{unMuteClickListener}"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/call"
|
||||
android:onClick="@{callClickListener}"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/delete"
|
||||
android:onClick="@{deleteClickListener}"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -115,7 +115,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/leave"
|
||||
android:onClick="@{deleteClickListener}"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -80,9 +80,10 @@
|
|||
|
||||
<include
|
||||
bind:onConversationsClicked="@{onConversationsClicked}"
|
||||
bind:contactsSelected="@{true}"
|
||||
android:visibility="@{viewModel.bottomNavBarVisible ? View.VISIBLE : View.GONE}"
|
||||
android:id="@+id/bottom_nav_bar"
|
||||
layout="@layout/bottom_nav_bar_contacts"
|
||||
layout="@layout/bottom_nav_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
app:layout_constraintTop_toTopOf="@id/back"
|
||||
app:layout_constraintBottom_toBottomOf="@id/back"/>
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
app:layout_constraintEnd_toStartOf="@id/phone_call"
|
||||
app:layout_constraintTop_toTopOf="@id/avatar" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/presence"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
app:constraint_referenced_ids="composing_text, bottom_background"
|
||||
app:barrierDirection="top" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/composing_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -144,7 +144,7 @@
|
|||
app:layout_constraintTop_toTopOf="@id/message"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/emoji_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
|
|
|
|||
|
|
@ -76,8 +76,9 @@
|
|||
|
||||
<include
|
||||
bind:onContactsClicked="@{onContactsClicked}"
|
||||
bind:conversationsSelected="@{true}"
|
||||
android:id="@+id/bottom_nav_bar"
|
||||
layout="@layout/bottom_nav_bar_conversations"
|
||||
layout="@layout/bottom_nav_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
app:layout_constraintTop_toTopOf="@id/title"
|
||||
app:tint="@color/white" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="35dp"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/cancel"
|
||||
android:onClick="@{cancelClickListener}"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
app:layout_constraintTop_toTopOf="@id/title"
|
||||
app:layout_constraintBottom_toBottomOf="@id/subtitle"/>
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/create_group"
|
||||
android:onClick="@{() -> viewModel.createGroup()}"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
app:layout_constraintTop_toTopOf="@id/title"
|
||||
app:layout_constraintBottom_toBottomOf="@id/subtitle"/>
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/search_bar"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> viewModel.enableGroupSelection()}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/title" />
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="35dp"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue