moving the group colored icon creator in Commons

This commit is contained in:
tibbi 2020-04-15 19:48:54 +02:00
parent 3a515486ea
commit a91c8d7334
3 changed files with 3 additions and 24 deletions

View File

@ -56,7 +56,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.25.18' implementation 'com.simplemobiletools:commons:5.25.19'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'org.greenrobot:eventbus:3.2.0' implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.klinkerapps:android-smsmms:5.2.6' implementation 'com.klinkerapps:android-smsmms:5.2.6'

View File

@ -1,7 +1,6 @@
package com.simplemobiletools.smsmessenger.adapters package com.simplemobiletools.smsmessenger.adapters
import android.graphics.Typeface import android.graphics.Typeface
import android.graphics.drawable.LayerDrawable
import android.view.Menu import android.view.Menu
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -9,10 +8,9 @@ import android.widget.TextView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.extensions.applyColorFilter
import com.simplemobiletools.commons.extensions.formatDateOrTime import com.simplemobiletools.commons.extensions.formatDateOrTime
import com.simplemobiletools.commons.extensions.getColoredGroupIcon
import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.helpers.letterBackgroundColors
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
@ -143,10 +141,7 @@ class ConversationsAdapter(
// at group conversations we use an icon as the placeholder, not any letter // at group conversations we use an icon as the placeholder, not any letter
val placeholder = if (conversation.isGroupConversation) { val placeholder = if (conversation.isGroupConversation) {
val icon = activity.resources.getDrawable(R.drawable.group_conversation_icon) activity.getColoredGroupIcon(conversation.title)
val bgColor = letterBackgroundColors[Math.abs(conversation.title.hashCode()) % letterBackgroundColors.size].toInt()
(icon as LayerDrawable).findDrawableByLayerId(R.id.attendee_circular_background).applyColorFilter(bgColor)
icon
} else { } else {
null null
} }

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/attendee_circular_background">
<shape android:shape="oval">
<solid android:color="@color/color_primary" />
</shape>
</item>
<item
android:bottom="@dimen/medium_margin"
android:drawable="@drawable/ic_people_vector"
android:left="@dimen/medium_margin"
android:right="@dimen/medium_margin"
android:top="@dimen/medium_margin" />
</layer-list>