mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-06-05 21:49:22 +02:00
adding some initial coloring at the incoming and outgoing messages
This commit is contained in:
@@ -4,6 +4,9 @@ import android.view.Menu
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||||
|
import com.simplemobiletools.commons.extensions.adjustAlpha
|
||||||
|
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||||
|
import com.simplemobiletools.commons.extensions.getContrastColor
|
||||||
import com.simplemobiletools.commons.views.FastScroller
|
import com.simplemobiletools.commons.views.FastScroller
|
||||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||||
import com.simplemobiletools.smsmessenger.R
|
import com.simplemobiletools.smsmessenger.R
|
||||||
@@ -84,7 +87,13 @@ class ThreadAdapter(
|
|||||||
private fun setupView(view: View, message: Message) {
|
private fun setupView(view: View, message: Message) {
|
||||||
view.apply {
|
view.apply {
|
||||||
thread_message_body.text = message.body
|
thread_message_body.text = message.body
|
||||||
thread_message_body.setTextColor(textColor)
|
|
||||||
|
if (message.isReceivedMessage()) {
|
||||||
|
thread_message_body.setTextColor(textColor)
|
||||||
|
} else {
|
||||||
|
thread_message_holder.background.applyColorFilter(primaryColor.adjustAlpha(0.8f))
|
||||||
|
thread_message_body.setTextColor(primaryColor.getContrastColor())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
app/src/main/res/drawable/item_received_background.xml
Normal file
12
app/src/main/res/drawable/item_received_background.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<corners
|
||||||
|
android:bottomRightRadius="@dimen/normal_margin"
|
||||||
|
android:topLeftRadius="@dimen/normal_margin"
|
||||||
|
android:topRightRadius="@dimen/normal_margin" />
|
||||||
|
|
||||||
|
<solid android:color="@color/activated_item_foreground" />
|
||||||
|
|
||||||
|
</shape>
|
12
app/src/main/res/drawable/item_sent_background.xml
Normal file
12
app/src/main/res/drawable/item_sent_background.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="@dimen/normal_margin"
|
||||||
|
android:topLeftRadius="@dimen/normal_margin"
|
||||||
|
android:topRightRadius="@dimen/normal_margin" />
|
||||||
|
|
||||||
|
<solid android:color="@color/color_primary" />
|
||||||
|
|
||||||
|
</shape>
|
@@ -11,6 +11,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:overScrollMode="ifContentScrolls"
|
android:overScrollMode="ifContentScrolls"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
android:scrollbars="none"
|
android:scrollbars="none"
|
||||||
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"
|
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"
|
||||||
app:stackFromEnd="true" />
|
app:stackFromEnd="true" />
|
||||||
|
@@ -4,6 +4,9 @@
|
|||||||
android:id="@+id/thread_message_holder"
|
android:id="@+id/thread_message_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/medium_margin"
|
||||||
|
android:layout_marginBottom="@dimen/medium_margin"
|
||||||
|
android:background="@drawable/item_received_background"
|
||||||
android:padding="@dimen/activity_margin">
|
android:padding="@dimen/activity_margin">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@@ -4,6 +4,9 @@
|
|||||||
android:id="@+id/thread_message_holder"
|
android:id="@+id/thread_message_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/medium_margin"
|
||||||
|
android:layout_marginBottom="@dimen/medium_margin"
|
||||||
|
android:background="@drawable/item_sent_background"
|
||||||
android:padding="@dimen/activity_margin">
|
android:padding="@dimen/activity_margin">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
Reference in New Issue
Block a user