Fixed some layouts + added animations to unread counters in tabs

This commit is contained in:
Sylvain Berfini 2020-10-22 13:51:50 +02:00
parent d3c0b51f9c
commit 40c809ee45
9 changed files with 266 additions and 31 deletions

View file

@ -91,7 +91,7 @@ LinphoneSdkBuildDir=/home/<username>/linphone-sdk/build/
- If you encounter the `couldn't find "libc++_shared.so"` crash when the app starts, simply clean the project in Android Studio (under Build menu) and build again.
Also check you have built the SDK for the right CPU architecture using the `-DLINPHONESDK_ANDROID_ARCHS=armv7,arm64,x86,x86_64` cmake parameter.
- If during the build you have `DataBinderMapperImpl.java error: cannot find symbol` or `Could not find accessor org.linphone.activities.main.chat.viewmodels.ChatRoomsListViewModel.chatRooms` with `Could not find accessor org.linphone.activities.main.settings.viewmodels.NetworkSettingsViewModel.sipPort`, try building again. It is merely a build failure from Android Studio that happens sometimes.
- If during the build you have `DataBinderMapperImpl.java error: cannot find symbol`, `Could not find accessor org.linphone.activities.main.chat.viewmodels.ChatRoomsListViewModel.chatRooms` or `Could not find accessor org.linphone.activities.main.settings.viewmodels.NetworkSettingsViewModel.sipPort`, try building again. It is merely a build failure from Android Studio that happens sometimes.
- Push notification might not work when app has been started by Android Studio consecutively to an install. Remove the app from the recent activity view and start it again using the launcher icon to resolve this.

View file

@ -50,15 +50,17 @@
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.75" />
<RelativeLayout
<androidx.constraintlayout.motion.widget.MotionLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/footer_button"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/guidelineTop"
app:layoutDescription="@xml/motion_main_activity_tabs_history_unread_count_land"
android:onClick="@{historyClickListener}">
<ImageView
android:id="@+id/history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
@ -67,18 +69,16 @@
android:src="@drawable/footer_history" />
<TextView
android:id="@+id/history_unread_count"
style="@style/unread_count_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="15dp"
android:layout_marginRight="5dp"
android:background="@drawable/unread_message_count_bg"
android:gravity="center"
android:text="@{String.valueOf(viewModel.missedCallsCount)}"
android:visibility="@{viewModel.missedCallsCount == 0 ? View.GONE : View.VISIBLE}" />
</RelativeLayout>
</androidx.constraintlayout.motion.widget.MotionLayout>
<RelativeLayout
android:layout_width="match_parent"
@ -116,15 +116,17 @@
</RelativeLayout>
<RelativeLayout
<androidx.constraintlayout.motion.widget.MotionLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/footer_button"
app:layout_constraintTop_toTopOf="@id/guidelineBottom"
app:layout_constraintBottom_toBottomOf="parent"
app:layoutDescription="@xml/motion_main_activity_tabs_chat_unread_count_land"
android:onClick="@{chatClickListener}">
<ImageView
android:id="@+id/chat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
@ -133,25 +135,23 @@
android:src="@drawable/footer_chat" />
<TextView
android:id="@+id/chat_unread_count"
style="@style/unread_count_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="15dp"
android:layout_marginRight="5dp"
android:background="@drawable/unread_message_count_bg"
android:gravity="center"
android:text="@{String.valueOf(viewModel.unreadMessagesCount)}"
android:visibility="@{viewModel.unreadMessagesCount == 0 ? View.GONE : View.VISIBLE}" />
</RelativeLayout>
</androidx.constraintlayout.motion.widget.MotionLayout>
<androidx.constraintlayout.motion.widget.MotionLayout
android:id="@+id/selectorMotion"
android:layout_width="5dp"
android:layout_height="match_parent"
app:layoutDescription="@xml/motion_main_activity_tabs_selector_land"
app:layout_constraintRight_toRightOf="parent">
app:layout_constraintLeft_toLeftOf="parent">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gTop"

View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<import type="android.view.View"/>
@ -21,7 +23,6 @@
</data>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="60dp">
@ -47,15 +48,17 @@
android:orientation="vertical"
app:layout_constraintGuide_percent="0.75" />
<RelativeLayout
<androidx.constraintlayout.motion.widget.MotionLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:onClick="@{historyClickListener}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="@id/guidelineLeft"
app:layoutDescription="@xml/motion_main_activity_tabs_history_unread_count"
android:background="@drawable/footer_button">
<ImageView
android:id="@+id/history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
@ -64,16 +67,17 @@
android:src="@drawable/footer_history" />
<TextView
android:id="@+id/history_unread_count"
style="@style/unread_count_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:layout_marginTop="5dp"
android:background="@drawable/unread_message_count_bg"
android:gravity="center"
android:text="@{String.valueOf(viewModel.missedCallsCount)}"
android:visibility="@{viewModel.missedCallsCount == 0 ? View.GONE : View.VISIBLE}" />
</RelativeLayout>
</androidx.constraintlayout.motion.widget.MotionLayout>
<RelativeLayout
android:layout_width="0dp"
@ -111,33 +115,36 @@
</RelativeLayout>
<RelativeLayout
<androidx.constraintlayout.motion.widget.MotionLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/footer_button"
android:onClick="@{chatClickListener}"
app:layout_constraintStart_toStartOf="@id/guidelineRight"
app:layoutDescription="@xml/motion_main_activity_tabs_chat_unread_count"
app:layout_constraintEnd_toEndOf="parent"
android:background="@drawable/footer_button">
app:layout_constraintStart_toStartOf="@id/guidelineRight">
<ImageView
android:id="@+id/chat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:padding="15dp"
android:contentDescription="@string/content_description_menu_chat"
android:padding="15dp"
android:src="@drawable/footer_chat" />
<TextView
android:id="@+id/chat_unread_count"
style="@style/unread_count_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:layout_marginTop="5dp"
android:background="@drawable/unread_message_count_bg"
android:gravity="center"
android:text="@{String.valueOf(viewModel.unreadMessagesCount)}"
android:visibility="@{viewModel.unreadMessagesCount == 0 ? View.GONE : View.VISIBLE}" />
</RelativeLayout>
</androidx.constraintlayout.motion.widget.MotionLayout>
<androidx.constraintlayout.motion.widget.MotionLayout
android:id="@+id/selectorMotion"

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:duration="250"
motion:autoTransition="animateToEnd"
motion:constraintSetStart="@+id/bottom"
motion:constraintSetEnd="@+id/top" />
<Transition
motion:duration="250"
motion:autoTransition="animateToEnd"
motion:constraintSetStart="@+id/top"
motion:constraintSetEnd="@+id/bottom" />
<ConstraintSet android:id="@+id/bottom">
<Constraint
android:id="@id/chat_unread_count"
android:layout_marginRight="25dp"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<CustomAttribute
motion:attributeName="translationY"
motion:customDimension="0dp"/>
<PropertySet
motion:visibilityMode="ignore" />
</Constraint>
</ConstraintSet>
<ConstraintSet android:id="@+id/top">
<Constraint
android:id="@id/chat_unread_count"
android:layout_marginRight="25dp"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<CustomAttribute
motion:attributeName="translationY"
motion:customDimension="5dp"/>
<PropertySet
motion:visibilityMode="ignore" />
</Constraint>
</ConstraintSet>
</MotionScene>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:duration="250"
motion:autoTransition="animateToEnd"
motion:constraintSetStart="@+id/bottom"
motion:constraintSetEnd="@+id/top" />
<Transition
motion:duration="250"
motion:autoTransition="animateToEnd"
motion:constraintSetStart="@+id/top"
motion:constraintSetEnd="@+id/bottom" />
<ConstraintSet android:id="@+id/bottom">
<Constraint
android:id="@id/chat_unread_count"
android:layout_marginRight="5dp"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<CustomAttribute
motion:attributeName="translationY"
motion:customDimension="0dp"/>
<PropertySet
motion:visibilityMode="ignore" />
</Constraint>
</ConstraintSet>
<ConstraintSet android:id="@+id/top">
<Constraint
android:id="@id/chat_unread_count"
android:layout_marginRight="5dp"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<CustomAttribute
motion:attributeName="translationY"
motion:customDimension="5dp"/>
<PropertySet
motion:visibilityMode="ignore" />
</Constraint>
</ConstraintSet>
</MotionScene>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:duration="250"
motion:autoTransition="animateToEnd"
motion:constraintSetStart="@+id/bottom"
motion:constraintSetEnd="@+id/top" />
<Transition
motion:duration="250"
motion:autoTransition="animateToEnd"
motion:constraintSetStart="@+id/top"
motion:constraintSetEnd="@+id/bottom" />
<ConstraintSet android:id="@+id/bottom">
<Constraint
android:id="@id/history_unread_count"
android:layout_marginRight="25dp"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<CustomAttribute
motion:attributeName="translationY"
motion:customDimension="0dp"/>
<PropertySet
motion:visibilityMode="ignore" />
</Constraint>
</ConstraintSet>
<ConstraintSet android:id="@+id/top">
<Constraint
android:id="@id/history_unread_count"
android:layout_marginRight="25dp"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<CustomAttribute
motion:attributeName="translationY"
motion:customDimension="5dp"/>
<PropertySet
motion:visibilityMode="ignore" />
</Constraint>
</ConstraintSet>
</MotionScene>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:duration="250"
motion:autoTransition="animateToEnd"
motion:constraintSetStart="@+id/bottom"
motion:constraintSetEnd="@+id/top" />
<Transition
motion:duration="250"
motion:autoTransition="animateToEnd"
motion:constraintSetStart="@+id/top"
motion:constraintSetEnd="@+id/bottom" />
<ConstraintSet android:id="@+id/bottom">
<Constraint
android:id="@id/history_unread_count"
android:layout_marginRight="5dp"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<CustomAttribute
motion:attributeName="translationY"
motion:customDimension="0dp"/>
<PropertySet
motion:visibilityMode="ignore" />
</Constraint>
</ConstraintSet>
<ConstraintSet android:id="@+id/top">
<Constraint
android:id="@id/history_unread_count"
android:layout_marginRight="5dp"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<CustomAttribute
motion:attributeName="translationY"
motion:customDimension="5dp"/>
<PropertySet
motion:visibilityMode="ignore" />
</Constraint>
</ConstraintSet>
</MotionScene>

View file

@ -31,7 +31,6 @@
android:id="@id/selector"
android:layout_height="wrap_content"
motion:layout_constraintWidth_percent=".25"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintLeft_toLeftOf="parent" />
</ConstraintSet>
@ -42,7 +41,6 @@
android:id="@id/selector"
android:layout_height="wrap_content"
motion:layout_constraintWidth_percent=".25"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintLeft_toLeftOf="@id/gLeft" />
</ConstraintSet>
@ -53,7 +51,6 @@
android:id="@id/selector"
android:layout_height="wrap_content"
motion:layout_constraintWidth_percent=".25"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintLeft_toLeftOf="@id/gMiddle" />
</ConstraintSet>
@ -64,7 +61,6 @@
android:id="@id/selector"
android:layout_height="wrap_content"
motion:layout_constraintWidth_percent=".25"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintRight_toRightOf="parent" />
</ConstraintSet>

View file

@ -31,7 +31,6 @@
android:id="@id/selector"
android:layout_width="wrap_content"
motion:layout_constraintHeight_percent=".25"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
</ConstraintSet>
@ -42,7 +41,6 @@
android:id="@id/selector"
android:layout_width="wrap_content"
motion:layout_constraintHeight_percent=".25"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintTop_toTopOf="@id/gTop" />
</ConstraintSet>
@ -53,7 +51,6 @@
android:id="@id/selector"
android:layout_width="wrap_content"
motion:layout_constraintHeight_percent=".25"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintTop_toTopOf="@id/gMiddle" />
</ConstraintSet>
@ -64,7 +61,6 @@
android:id="@id/selector"
android:layout_width="wrap_content"
motion:layout_constraintHeight_percent=".25"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintBottom_toBottomOf="parent" />
</ConstraintSet>