From cdfc07c5600961a2668cf07b4576000183371ff6 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 15 Jul 2020 12:10:43 +0200 Subject: [PATCH] Fixed layout issues, mostly for tablets --- .../utils/RecyclerViewHeaderDecoration.kt | 4 +- .../java/org/linphone/utils/TimestampUtils.kt | 2 +- .../layout-land/contact_master_fragment.xml | 1 + .../history_detail_fragment.xml | 191 ++++++++++++++++ .../chat_room_master_fragment.xml | 139 ++++++++++++ .../contact_master_fragment.xml | 210 ++++++++++++++++++ .../history_detail_fragment.xml | 191 ++++++++++++++++ .../history_master_fragment.xml | 174 +++++++++++++++ 8 files changed, 910 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/layout-sw533dp-land/history_detail_fragment.xml create mode 100644 app/src/main/res/layout-sw533dp/chat_room_master_fragment.xml create mode 100644 app/src/main/res/layout-sw533dp/contact_master_fragment.xml create mode 100644 app/src/main/res/layout-sw533dp/history_detail_fragment.xml create mode 100644 app/src/main/res/layout-sw533dp/history_master_fragment.xml diff --git a/app/src/main/java/org/linphone/utils/RecyclerViewHeaderDecoration.kt b/app/src/main/java/org/linphone/utils/RecyclerViewHeaderDecoration.kt index d2963ff7e..7e2b3b47a 100644 --- a/app/src/main/java/org/linphone/utils/RecyclerViewHeaderDecoration.kt +++ b/app/src/main/java/org/linphone/utils/RecyclerViewHeaderDecoration.kt @@ -26,6 +26,7 @@ import android.util.SparseArray import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView +import org.linphone.R class RecyclerViewHeaderDecoration(private val adapter: HeaderAdapter) : RecyclerView.ItemDecoration() { private val headers: SparseArray = SparseArray() @@ -54,7 +55,8 @@ class RecyclerViewHeaderDecoration(private val adapter: HeaderAdapter) : Recycle } val displayMetrics = parent.context.resources.displayMetrics - val widthSpec = View.MeasureSpec.makeMeasureSpec(displayMetrics.widthPixels, View.MeasureSpec.EXACTLY) + val width = if (view.resources.getBoolean(R.bool.isTablet)) displayMetrics.widthPixels / 2 else displayMetrics.widthPixels + val widthSpec = View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY) val heightSpec = View.MeasureSpec.makeMeasureSpec(displayMetrics.heightPixels, View.MeasureSpec.EXACTLY) val childWidth = ViewGroup.getChildMeasureSpec(widthSpec, parent.paddingLeft + parent.paddingRight, view.layoutParams.width) val childHeight = ViewGroup.getChildMeasureSpec(heightSpec, parent.paddingTop + parent.paddingBottom, view.layoutParams.height) diff --git a/app/src/main/java/org/linphone/utils/TimestampUtils.kt b/app/src/main/java/org/linphone/utils/TimestampUtils.kt index 38b9b252d..4fc6c43db 100644 --- a/app/src/main/java/org/linphone/utils/TimestampUtils.kt +++ b/app/src/main/java/org/linphone/utils/TimestampUtils.kt @@ -79,7 +79,7 @@ class TimestampUtils { if (isSameYear(timestamp, timestampInSecs)) { // Remove the year part of the format dateFormat.applyPattern( - dateFormat.toPattern().replace("/?y+/?|\\s?y+\\s?".toRegex(), if (shortDate) "" else " ") + dateFormat.toPattern().replace("/?y+/?|,?\\s?y+\\s?".toRegex(), if (shortDate) "" else " ") ) } diff --git a/app/src/main/res/layout-land/contact_master_fragment.xml b/app/src/main/res/layout-land/contact_master_fragment.xml index bcddbf525..32f428e7e 100644 --- a/app/src/main/res/layout-land/contact_master_fragment.xml +++ b/app/src/main/res/layout-land/contact_master_fragment.xml @@ -145,6 +145,7 @@ android:layout_width="match_parent" android:layout_height="1dp" android:layout_below="@id/searchBar" + android:layout_toRightOf="@id/tabs_fragment" android:background="?attr/dividerColor" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout-sw533dp/chat_room_master_fragment.xml b/app/src/main/res/layout-sw533dp/chat_room_master_fragment.xml new file mode 100644 index 000000000..f69d1f5a1 --- /dev/null +++ b/app/src/main/res/layout-sw533dp/chat_room_master_fragment.xml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout-sw533dp/contact_master_fragment.xml b/app/src/main/res/layout-sw533dp/contact_master_fragment.xml new file mode 100644 index 000000000..e1491eaa2 --- /dev/null +++ b/app/src/main/res/layout-sw533dp/contact_master_fragment.xml @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout-sw533dp/history_detail_fragment.xml b/app/src/main/res/layout-sw533dp/history_detail_fragment.xml new file mode 100644 index 000000000..74d769d33 --- /dev/null +++ b/app/src/main/res/layout-sw533dp/history_detail_fragment.xml @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout-sw533dp/history_master_fragment.xml b/app/src/main/res/layout-sw533dp/history_master_fragment.xml new file mode 100644 index 000000000..a9b725a56 --- /dev/null +++ b/app/src/main/res/layout-sw533dp/history_master_fragment.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +