mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-06-05 21:49:22 +02:00
moving some contact display related things into Commons
This commit is contained in:
@ -56,8 +56,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.27.10'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
|
||||
implementation 'com.simplemobiletools:commons:5.27.11'
|
||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||
implementation 'com.klinkerapps:android-smsmms:5.2.6'
|
||||
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'
|
||||
|
@ -5,12 +5,12 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.Filter
|
||||
import android.widget.TextView
|
||||
import com.simplemobiletools.commons.extensions.normalizeString
|
||||
import com.simplemobiletools.commons.models.SimpleContact
|
||||
import com.simplemobiletools.smsmessenger.R
|
||||
import com.simplemobiletools.smsmessenger.activities.SimpleActivity
|
||||
import com.simplemobiletools.smsmessenger.extensions.loadImage
|
||||
import kotlinx.android.synthetic.main.item_contact.view.*
|
||||
|
||||
class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: ArrayList<SimpleContact>) :
|
||||
ArrayAdapter<SimpleContact>(activity, 0, contacts) {
|
||||
@ -25,10 +25,10 @@ class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: Ar
|
||||
|
||||
listItem!!.apply {
|
||||
tag = contact.name.isNotEmpty()
|
||||
item_autocomplete_name.text = contact.name
|
||||
item_autocomplete_number.text = contact.phoneNumber
|
||||
findViewById<TextView>(R.id.item_contact_name).text = contact.name
|
||||
findViewById<TextView>(R.id.item_contact_number).text = contact.phoneNumber
|
||||
|
||||
context.loadImage(contact.photoUri, item_autocomplete_image, contact.name)
|
||||
context.loadImage(contact.photoUri, findViewById(R.id.item_contact_image), contact.name)
|
||||
}
|
||||
|
||||
return listItem
|
||||
|
@ -3,6 +3,8 @@ package com.simplemobiletools.smsmessenger.adapters
|
||||
import android.view.Menu
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||
import com.simplemobiletools.commons.models.SimpleContact
|
||||
@ -11,7 +13,6 @@ import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
import com.simplemobiletools.smsmessenger.R
|
||||
import com.simplemobiletools.smsmessenger.activities.SimpleActivity
|
||||
import com.simplemobiletools.smsmessenger.extensions.loadImage
|
||||
import kotlinx.android.synthetic.main.item_contact_with_number.view.*
|
||||
import java.util.*
|
||||
|
||||
class ContactsAdapter(
|
||||
@ -53,19 +54,19 @@ class ContactsAdapter(
|
||||
override fun onViewRecycled(holder: ViewHolder) {
|
||||
super.onViewRecycled(holder)
|
||||
if (!activity.isDestroyed && !activity.isFinishing) {
|
||||
Glide.with(activity).clear(holder.itemView.contact_tmb)
|
||||
Glide.with(activity).clear(holder.itemView.findViewById<ImageView>(R.id.item_contact_tmb))
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupView(view: View, contact: SimpleContact) {
|
||||
view.apply {
|
||||
contact_name.text = contact.name
|
||||
contact_name.setTextColor(textColor)
|
||||
findViewById<TextView>(R.id.item_contact_name).text = contact.name
|
||||
findViewById<TextView>(R.id.item_contact_name).setTextColor(textColor)
|
||||
|
||||
contact_number.text = contact.phoneNumber
|
||||
contact_number.setTextColor(textColor)
|
||||
findViewById<TextView>(R.id.item_contact_number).text = contact.phoneNumber
|
||||
findViewById<TextView>(R.id.item_contact_number).setTextColor(textColor)
|
||||
|
||||
context.loadImage(contact.photoUri, contact_tmb, contact.name)
|
||||
context.loadImage(contact.photoUri, findViewById(R.id.item_contact_tmb), contact.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import com.simplemobiletools.commons.models.SimpleContact
|
||||
|
||||
data class Message(
|
||||
val id: Int, val body: String, val type: Int, val participants: ArrayList<SimpleContact>, val date: Int, val read: Boolean, val thread: Int,
|
||||
val isMMS: Boolean, val attachment: MessageAttachment?, val senderName: String, val senderPhotoUri: String
|
||||
) : ThreadItem() {
|
||||
val isMMS: Boolean, val attachment: MessageAttachment?, val senderName: String, val senderPhotoUri: String) : ThreadItem() {
|
||||
fun isReceivedMessage() = type == Telephony.Sms.MESSAGE_TYPE_INBOX
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/item_autocomplete_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/small_margin"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingEnd="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/item_autocomplete_image"
|
||||
android:layout_width="@dimen/avatar_size"
|
||||
android:layout_height="@dimen/avatar_size"
|
||||
android:layout_margin="@dimen/tiny_margin"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_autocomplete_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:paddingEnd="@dimen/medium_margin"
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
app:layout_constraintBottom_toTopOf="@+id/item_autocomplete_number"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/item_autocomplete_image"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:text="Simple Mobile" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_autocomplete_number"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/item_autocomplete_name"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:alpha="0.8"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:paddingEnd="@dimen/medium_margin"
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/item_autocomplete_image"
|
||||
app:layout_constraintTop_toBottomOf="@+id/item_autocomplete_name"
|
||||
tools:text="123456" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/contact_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingEnd="@dimen/activity_margin"
|
||||
android:paddingBottom="@dimen/medium_margin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/contact_tmb"
|
||||
android:layout_width="@dimen/normal_icon_size"
|
||||
android:layout_height="@dimen/normal_icon_size"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="@dimen/small_margin"
|
||||
android:layout_marginEnd="@dimen/small_margin"
|
||||
android:padding="@dimen/small_margin"
|
||||
android:src="@drawable/ic_person_vector" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contact_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toEndOf="@+id/contact_tmb"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textSize="@dimen/big_text_size"
|
||||
tools:text="John Doe" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contact_number"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/contact_name"
|
||||
android:layout_alignStart="@+id/contact_name"
|
||||
android:layout_toEndOf="@+id/contact_tmb"
|
||||
android:alpha="0.6"
|
||||
android:maxLines="1"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="0123 456 789" />
|
||||
|
||||
</RelativeLayout>
|
@ -22,8 +22,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/thread_message_sender_photo"
|
||||
android:layout_width="@dimen/avatar_size"
|
||||
android:layout_height="@dimen/avatar_size"
|
||||
android:layout_width="@dimen/list_avatar_size"
|
||||
android:layout_height="@dimen/list_avatar_size"
|
||||
android:layout_alignBottom="@+id/thread_message_body"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginEnd="@dimen/medium_margin"
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="notification_large_icon_size">72dp</dimen>
|
||||
<dimen name="avatar_size">40dp</dimen>
|
||||
<dimen name="bigger_avatar_size">64dp</dimen>
|
||||
<dimen name="play_outline_size">36dp</dimen>
|
||||
<dimen name="attachment_preview_size">60dp</dimen>
|
||||
|
Reference in New Issue
Block a user