Merge pull request #57 from michaelsam94/master

change the color of suggested contact name based on font color of app…
This commit is contained in:
Tibor Kaputa 2020-07-27 22:13:08 +02:00 committed by GitHub
commit f511f35df0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 0 deletions

View file

@ -29,6 +29,7 @@ import com.simplemobiletools.smsmessenger.interfaces.ConversationsDao
import com.simplemobiletools.smsmessenger.models.*
import com.simplemobiletools.smsmessenger.receivers.DirectReplyReceiver
import com.simplemobiletools.smsmessenger.receivers.MarkAsReadReceiver
import me.leolin.shortcutbadger.ShortcutBadger
import java.util.*
import kotlin.collections.ArrayList
@ -451,6 +452,23 @@ fun Context.getNameAndPhotoFromPhoneNumber(number: String): NamePhoto? {
return NamePhoto(number, null)
}
fun Context.updateUnreadCountBadge(conversations : ArrayList<Conversation>){
var count = 0
conversations.forEach {
if(!it.read) {
count++
}
}
if(count == 0) {
ShortcutBadger.removeCount(this)
} else {
ShortcutBadger.applyCount(this,count)
}
}
fun Context.insertNewSMS(address: String, subject: String, body: String, date: Long, read: Int, threadId: Long, type: Int, subscriptionId: Int): Int {
val uri = Sms.CONTENT_URI
val contentValues = ContentValues().apply {