mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-22 21:58:53 +01:00
Improved layout for message status
This commit is contained in:
@@ -52,12 +52,12 @@ class MessagesAdapter @Inject constructor(
|
|||||||
VIEWTYPE_ME -> {
|
VIEWTYPE_ME -> {
|
||||||
view = layoutInflater.inflate(R.layout.message_list_item_out, parent, false)
|
view = layoutInflater.inflate(R.layout.message_list_item_out, parent, false)
|
||||||
disposables += colors.bubble
|
disposables += colors.bubble
|
||||||
.subscribe { color -> view.body.setBackgroundTint(color) }
|
.subscribe { color -> view.messageBackground.setBackgroundTint(color) }
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
view = layoutInflater.inflate(R.layout.message_list_item_in, parent, false)
|
view = layoutInflater.inflate(R.layout.message_list_item_in, parent, false)
|
||||||
disposables += colors.theme
|
disposables += colors.theme
|
||||||
.subscribe { color -> view.body.setBackgroundTint(color) }
|
.subscribe { color -> view.messageBackground.setBackgroundTint(color) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,22 +114,22 @@ class MessagesAdapter @Inject constructor(
|
|||||||
when {
|
when {
|
||||||
!canGroupWithPrevious && canGroupWithNext -> {
|
!canGroupWithPrevious && canGroupWithNext -> {
|
||||||
view.setPadding(bottom = 2.dpToPx(context))
|
view.setPadding(bottom = 2.dpToPx(context))
|
||||||
view.body.setBackgroundResource(if (sent) R.drawable.message_out_first else R.drawable.message_in_first)
|
view.messageBackground.setBackgroundResource(if (sent) R.drawable.message_out_first else R.drawable.message_in_first)
|
||||||
view.avatar?.visibility = View.INVISIBLE
|
view.avatar?.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
canGroupWithPrevious && canGroupWithNext -> {
|
canGroupWithPrevious && canGroupWithNext -> {
|
||||||
view.setPadding(bottom = 2.dpToPx(context))
|
view.setPadding(bottom = 2.dpToPx(context))
|
||||||
view.body.setBackgroundResource(if (sent) R.drawable.message_out_middle else R.drawable.message_in_middle)
|
view.messageBackground.setBackgroundResource(if (sent) R.drawable.message_out_middle else R.drawable.message_in_middle)
|
||||||
view.avatar?.visibility = View.INVISIBLE
|
view.avatar?.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
canGroupWithPrevious && !canGroupWithNext -> {
|
canGroupWithPrevious && !canGroupWithNext -> {
|
||||||
view.setPadding(bottom = 16.dpToPx(context))
|
view.setPadding(bottom = 16.dpToPx(context))
|
||||||
view.body.setBackgroundResource(if (sent) R.drawable.message_out_last else R.drawable.message_in_last)
|
view.messageBackground.setBackgroundResource(if (sent) R.drawable.message_out_last else R.drawable.message_in_last)
|
||||||
view.avatar?.visibility = View.VISIBLE
|
view.avatar?.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
view.setPadding(bottom = 16.dpToPx(context))
|
view.setPadding(bottom = 16.dpToPx(context))
|
||||||
view.body.setBackgroundResource(R.drawable.message_only)
|
view.messageBackground.setBackgroundResource(R.drawable.message_only)
|
||||||
view.avatar?.visibility = View.VISIBLE
|
view.avatar?.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
android:id="@+id/photo"
|
android:id="@+id/photo"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
tools:src="@tools:sample/avatars"
|
||||||
android:scaleType="centerCrop" />
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
</merge>
|
</merge>
|
||||||
@@ -34,34 +34,32 @@
|
|||||||
android:layout_marginEnd="12dp" />
|
android:layout_marginEnd="12dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:id="@+id/messageBackground"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:background="@drawable/message_only"
|
||||||
android:orientation="vertical">
|
android:minHeight="36dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:paddingEnd="12dp"
|
||||||
|
android:paddingStart="12dp"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
tools:backgroundTint="@color/tools_theme">
|
||||||
|
|
||||||
<com.moez.QKSMS.presentation.common.widget.TightTextView
|
<com.moez.QKSMS.presentation.common.widget.TightTextView
|
||||||
android:id="@+id/body"
|
android:id="@+id/body"
|
||||||
style="@style/TextPrimary"
|
style="@style/TextPrimary"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="start"
|
|
||||||
android:autoLink="all"
|
android:autoLink="all"
|
||||||
android:background="@drawable/message_only"
|
|
||||||
android:gravity="start|center_vertical"
|
android:gravity="start|center_vertical"
|
||||||
android:minHeight="36dp"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:paddingEnd="12dp"
|
|
||||||
android:paddingStart="12dp"
|
|
||||||
android:paddingTop="8dp"
|
|
||||||
app:textColor="primaryOnTheme"
|
app:textColor="primaryOnTheme"
|
||||||
tools:backgroundTint="@color/tools_theme"
|
|
||||||
tools:text="@tools:sample/lorem/random" />
|
tools:text="@tools:sample/lorem/random" />
|
||||||
|
|
||||||
<com.moez.QKSMS.presentation.common.widget.QkTextView
|
<TextView
|
||||||
android:id="@+id/status"
|
android:id="@+id/status"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp" />
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -27,40 +27,37 @@
|
|||||||
android:paddingStart="60dp">
|
android:paddingStart="60dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:id="@+id/messageBackground"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:background="@drawable/message_only"
|
||||||
android:orientation="vertical">
|
android:gravity="start"
|
||||||
|
android:minHeight="36dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:paddingEnd="12dp"
|
||||||
|
android:paddingStart="12dp"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
tools:backgroundTint="@color/white">
|
||||||
|
|
||||||
<com.moez.QKSMS.presentation.common.widget.TightTextView
|
<com.moez.QKSMS.presentation.common.widget.TightTextView
|
||||||
android:id="@+id/body"
|
android:id="@+id/body"
|
||||||
style="@style/TextPrimary"
|
style="@style/TextPrimary"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end"
|
|
||||||
android:autoLink="all"
|
android:autoLink="all"
|
||||||
android:background="@drawable/message_only"
|
|
||||||
android:gravity="start|center_vertical"
|
android:gravity="start|center_vertical"
|
||||||
android:minHeight="36dp"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:paddingEnd="12dp"
|
|
||||||
android:paddingStart="12dp"
|
|
||||||
android:paddingTop="8dp"
|
|
||||||
tools:backgroundTint="@color/white"
|
|
||||||
tools:text="Hey! How's it going?" />
|
tools:text="Hey! How's it going?" />
|
||||||
|
|
||||||
|
<com.moez.QKSMS.presentation.common.widget.QkTextView
|
||||||
|
android:id="@+id/status"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:textColor="tertiary"
|
||||||
|
tools:text="Sending..." />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<com.moez.QKSMS.presentation.common.widget.QkTextView
|
|
||||||
android:id="@+id/status"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="right"
|
|
||||||
android:layout_marginRight="12dp"
|
|
||||||
android:paddingTop="4dp"
|
|
||||||
app:textColor="tertiary"
|
|
||||||
tools:text="Sending..." />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<style name="AppThemeLight" parent="Theme.AppCompat.Light.NoActionBar">
|
<style name="AppThemeLight" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="android:windowBackground">@color/white</item>
|
<item name="android:windowBackground">@color/backgroundLight</item>
|
||||||
<item name="colorPrimary">@color/white</item>
|
<item name="colorPrimary">@color/white</item>
|
||||||
<item name="colorPrimaryDark">@color/statusBarLight</item>
|
<item name="colorPrimaryDark">@color/statusBarLight</item>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user