mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Updated events layout & send message icon
This commit is contained in:
parent
bfc2a8ae34
commit
99445cc8d6
10 changed files with 68 additions and 55 deletions
|
|
@ -1024,7 +1024,7 @@ class NotificationsManager @MainThread constructor(private val context: Context)
|
|||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE
|
||||
)
|
||||
return NotificationCompat.Action.Builder(
|
||||
R.drawable.paper_plane_tilt,
|
||||
R.drawable.paper_plane_right,
|
||||
context.getString(R.string.notification_reply_to_message),
|
||||
replyPendingIntent
|
||||
)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import org.linphone.R
|
||||
import org.linphone.databinding.ChatBubbleIncomingBinding
|
||||
import org.linphone.databinding.ChatBubbleOutgoingBinding
|
||||
import org.linphone.databinding.ChatEventBinding
|
||||
import org.linphone.databinding.ChatConversationEventBinding
|
||||
import org.linphone.ui.main.chat.model.EventLogModel
|
||||
import org.linphone.ui.main.chat.model.EventModel
|
||||
import org.linphone.ui.main.chat.model.MessageModel
|
||||
|
|
@ -135,9 +135,9 @@ class ConversationEventAdapter : ListAdapter<EventLogModel, RecyclerView.ViewHol
|
|||
}
|
||||
|
||||
private fun createEvent(parent: ViewGroup): EventViewHolder {
|
||||
val binding: ChatEventBinding = DataBindingUtil.inflate(
|
||||
val binding: ChatConversationEventBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
R.layout.chat_event,
|
||||
R.layout.chat_conversation_event,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
|
|
@ -180,7 +180,7 @@ class ConversationEventAdapter : ListAdapter<EventLogModel, RecyclerView.ViewHol
|
|||
}
|
||||
}
|
||||
inner class EventViewHolder(
|
||||
val binding: ChatEventBinding
|
||||
val binding: ChatConversationEventBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(event: EventModel) {
|
||||
with(binding) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@
|
|||
*/
|
||||
package org.linphone.ui.main.chat.model
|
||||
|
||||
import android.graphics.drawable.Drawable
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import java.util.Locale
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.R
|
||||
|
|
@ -29,6 +31,8 @@ import org.linphone.utils.AppUtils
|
|||
class EventModel @WorkerThread constructor(private val eventLog: EventLog) {
|
||||
val text: String
|
||||
|
||||
val icon: Drawable?
|
||||
|
||||
init {
|
||||
text = when (eventLog.type) {
|
||||
EventLog.Type.ConferenceCreated -> AppUtils.getString(
|
||||
|
|
@ -81,6 +85,25 @@ class EventModel @WorkerThread constructor(private val eventLog: EventLog) {
|
|||
eventLog.type.name
|
||||
}
|
||||
}
|
||||
|
||||
icon = ResourcesCompat.getDrawable(
|
||||
coreContext.context.resources,
|
||||
when (eventLog.type) {
|
||||
EventLog.Type.ConferenceEphemeralMessageEnabled,
|
||||
EventLog.Type.ConferenceEphemeralMessageDisabled,
|
||||
EventLog.Type.ConferenceEphemeralMessageLifetimeChanged -> {
|
||||
R.drawable.clock_countdown
|
||||
}
|
||||
EventLog.Type.ConferenceTerminated -> {
|
||||
R.drawable.x
|
||||
}
|
||||
EventLog.Type.ConferenceSubjectChanged -> {
|
||||
R.drawable.pencil_simple
|
||||
}
|
||||
else -> R.drawable.user_circle
|
||||
},
|
||||
coreContext.context.theme
|
||||
)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
|
|
|||
9
app/src/main/res/drawable/paper_plane_right.xml
Normal file
9
app/src/main/res/drawable/paper_plane_right.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="88dp"
|
||||
android:height="88dp"
|
||||
android:viewportWidth="256"
|
||||
android:viewportHeight="256">
|
||||
<path
|
||||
android:pathData="M223.87,114l-168,-95.89A16,16 0,0 0,32.93 37.32l31,90.47a0.42,0.42 0,0 0,0 0.1,0.3 0.3,0 0,0 0,0.1l-31,90.67A16,16 0,0 0,48 240a16.14,16.14 0,0 0,7.92 -2.1l167.91,-96.05a16,16 0,0 0,0.05 -27.89ZM48,224l0,-0.09L78.14,136H136a8,8 0,0 0,0 -16H78.22L48.06,32.12 48,32l168,95.83Z"
|
||||
android:fillColor="#4e6074"/>
|
||||
</vector>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="256"
|
||||
android:viewportHeight="256">
|
||||
<path
|
||||
android:pathData="M227.32,28.68a16,16 0,0 0,-15.66 -4.08l-0.15,0L19.57,82.84a16,16 0,0 0,-2.42 29.84l85.62,40.55 40.55,85.62A15.86,15.86 0,0 0,157.74 248q0.69,0 1.38,-0.06a15.88,15.88 0,0 0,14 -11.51l58.2,-191.94c0,-0.05 0,-0.1 0,-0.15A16,16 0,0 0,227.32 28.68ZM157.83,231.85l-0.05,0.14L118.42,148.9l47.24,-47.25a8,8 0,0 0,-11.31 -11.31L107.1,137.58 24,98.22l0.14,0L216,40Z"
|
||||
android:fillColor="#4e6074"/>
|
||||
</vector>
|
||||
|
|
@ -206,7 +206,7 @@
|
|||
android:text="@string/menu_resend_chat_message"
|
||||
android:background="@drawable/menu_item_background"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:drawableStart="@drawable/paper_plane_tilt"
|
||||
android:drawableStart="@drawable/paper_plane_right"
|
||||
android:visibility="@{model.isInError && model.isOutgoing ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintBottom_toTopOf="@id/reply"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
28
app/src/main/res/layout/chat_conversation_event.xml
Normal file
28
app/src/main/res/layout/chat_conversation_event.xml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="model"
|
||||
type="org.linphone.ui.main.chat.model.EventModel" />
|
||||
</data>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_300"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@{model.text, default=`You have left the group`}"
|
||||
android:textColor="@color/gray_400"
|
||||
android:textSize="12sp"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:textAlignment="center"
|
||||
android:drawableStart="@{model.icon, default=@drawable/clock_countdown}"
|
||||
android:drawablePadding="4dp"
|
||||
android:drawableTint="@color/gray_400"/>
|
||||
|
||||
</layout>
|
||||
|
|
@ -124,7 +124,7 @@
|
|||
android:layout_marginEnd="4dp"
|
||||
android:onClick="@{() -> viewModel.sendMessage()}"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/paper_plane_tilt"
|
||||
android:src="@drawable/paper_plane_right"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@
|
|||
android:visibility="@{viewModel.textToSend.length() > 0 || viewModel.attachments.size() > 0 ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:onClick="@{() -> viewModel.sendMessage()}"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/paper_plane_tilt"
|
||||
android:src="@drawable/paper_plane_right"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message_area_background"
|
||||
app:layout_constraintEnd_toEndOf="@id/message_area_background"
|
||||
app:layout_constraintTop_toTopOf="@id/message_area_background"
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="model"
|
||||
type="org.linphone.ui.main.chat.model.EventModel" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/shape_line_main2_200"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- Ugly hack to prevent last character to be missing half of it, don't know why yet -->
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_300"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
android:paddingLeft="25dp"
|
||||
android:paddingRight="25dp"
|
||||
android:text="@{model.text + ` `, default=`You have left the group`}"
|
||||
android:textColor="@color/gray_main2_500"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="italic" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</layout>
|
||||
Loading…
Add table
Reference in a new issue