Commit 6638d632 authored by Christophe Deschamps's avatar Christophe Deschamps
Browse files

AUto display snapshot if available


Former-commit-id: 4b1146bc84e529f6e078381dec72ae9aa12b1061
parent f4279fb2
package org.lindoor.customisation
import android.graphics.Bitmap
import org.lindoor.customisation.Customisation.deviceTypesConfig
import org.lindoor.entities.Device
import org.lindoor.ui.widgets.SpinnerItem
import java.util.*
import org.lindoor.linphonecore.extensions.getString
......@@ -9,6 +11,7 @@ import org.lindoor.linphonecore.extensions.getString
object DeviceTypes {
var deviceTypes: ArrayList<SpinnerItem> = ArrayList()
lateinit var defaultType: String
var defaultTypeIconAsBitmap: Bitmap? = null
init {
deviceTypesConfig.let { config ->
......@@ -22,6 +25,7 @@ object DeviceTypes {
it
)
)
defaultTypeIconAsBitmap = Device.typeIconAsBitmap(defaultType)
}
}
}
......
......@@ -158,6 +158,7 @@ class NotificationsManager(private val context: Context) {
)
Glide.with(context.applicationContext).asBitmap().load(it).into(awt)
notificationBuilder.setCustomBigContentView(remoteView)
notificationBuilder.setCustomContentView(remoteView)
val notification = notificationBuilder.build()
if (!LindoorApplication.someActivityRunning && call.state == Call.State.IncomingEarlyMedia)
notify(getNotifiableForCall(call).notificationId, notification)
......@@ -343,17 +344,18 @@ class NotificationsManager(private val context: Context) {
Texts.get("notif_incoming_call_title")
)
device?.also { device ->
device.typeIconAsBitmap?.also {
val awt = AppWidgetTarget(
context.applicationContext,
R.id.device_type,
remoteView,
if (hasSnapShot) 1 else 2
)
Glide.with(context.applicationContext).asBitmap().load(it).into(awt)
val awt = AppWidgetTarget(
context.applicationContext,
R.id.device_type,
remoteView,
if (hasSnapShot) 1 else 2
)
Glide.with(context.applicationContext).asBitmap().load(device?.let { device ->
device.typeIconAsBitmap?.let {
it
}
}
} ?: DeviceTypes.defaultTypeIconAsBitmap).into(awt)
return remoteView
......@@ -396,7 +398,7 @@ class NotificationsManager(private val context: Context) {
.addAction(getCallDeclineAction(notifiable.notificationId))
.addAction(getCallAnswerAction(notifiable.notificationId))
.setCustomContentView(fillIncomingRemoteViewsForCall(call, false))
.setCustomBigContentView(fillIncomingRemoteViewsForCall(call, true))
.setCustomBigContentView(fillIncomingRemoteViewsForCall(call, false))
val notification = notificationBuilder.build()
......
Subproject commit d9d1724a3162bf38ce3febdb30a27730dd9555f4
Subproject commit 193c3bfe4a941ba6345caae418f89a84c44cd424
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment