linphone-android/app/src/main/res/layout/tabs_fragment.xml
Sylvain Berfini ffbc209c69 Improved code
2021-04-17 10:05:01 +02:00

152 lines
No EOL
6.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<import type="android.view.View"/>
<variable
name="historyClickListener"
type="android.view.View.OnClickListener"/>
<variable
name="contactsClickListener"
type="android.view.View.OnClickListener"/>
<variable
name="dialerClickListener"
type="android.view.View.OnClickListener"/>
<variable
name="chatClickListener"
type="android.view.View.OnClickListener"/>
<variable
name="viewModel"
type="org.linphone.activities.main.viewmodels.TabsViewModel" />
</data>
<androidx.constraintlayout.motion.widget.MotionLayout
android:id="@+id/motion_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/main_activity_tabs_fragment_size"
app:layoutDescription="@xml/motion_main_activity_tabs_selector">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
layout_constraintGuide_percent="@{viewModel.leftAnchor, default=0.25}" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineMiddle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
layout_constraintGuide_percent="@{viewModel.middleAnchor, default=0.5}" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
layout_constraintGuide_percent="@{viewModel.rightAnchor, default=0.75}" />
<ImageView
android:id="@+id/history"
android:onClick="@{historyClickListener}"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:padding="15dp"
android:contentDescription="@string/content_description_menu_history"
android:src="@drawable/footer_history"
android:background="@drawable/footer_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="@id/guidelineLeft" />
<TextView
android:id="@+id/history_unread_count"
style="@style/unread_count_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="25dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:translationY="@{viewModel.historyMissedCountTranslateY}"
android:background="@{viewModel.missedCallsCount == 0 ? @drawable/hidden_unread_message_count_bg : @drawable/unread_message_count_bg}"
android:text="@{viewModel.missedCallsCount == 0 ? `` : String.valueOf(viewModel.missedCallsCount)}"
app:layout_constraintRight_toLeftOf="@id/guidelineLeft"
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:id="@+id/contacts"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/footer_button"
android:onClick="@{contactsClickListener}"
app:layout_constraintStart_toStartOf="@id/guidelineLeft"
app:layout_constraintEnd_toEndOf="@id/guidelineMiddle">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:padding="15dp"
android:contentDescription="@string/content_description_menu_contacts"
android:src="@drawable/footer_contacts" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/dialer"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/footer_button"
android:onClick="@{dialerClickListener}"
app:layout_constraintStart_toStartOf="@id/guidelineMiddle"
app:layout_constraintEnd_toEndOf="@id/guidelineRight">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:padding="15dp"
android:contentDescription="@string/content_description_menu_dialer"
android:src="@drawable/footer_dialer" />
</RelativeLayout>
<ImageView
android:id="@+id/chat"
android:onClick="@{chatClickListener}"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:contentDescription="@string/content_description_menu_chat"
android:padding="15dp"
android:src="@drawable/footer_chat"
android:background="@drawable/footer_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/guidelineRight" />
<TextView
android:id="@+id/chat_unread_count"
style="@style/unread_count_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="25dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:translationY="@{viewModel.chatUnreadCountTranslateY}"
android:background="@{viewModel.unreadMessagesCount == 0 ? @drawable/hidden_unread_message_count_bg : @drawable/unread_message_count_bg}"
android:text="@{viewModel.unreadMessagesCount == 0 ? `` : String.valueOf(viewModel.unreadMessagesCount)}"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<View
android:id="@+id/selector"
android:layout_width="0dp"
android:layout_height="@dimen/tabs_fragment_selector_size"
android:background="?attr/accentColor" />
</androidx.constraintlayout.motion.widget.MotionLayout>
</layout>