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 package org.lindoor.customisation
import android.graphics.Bitmap
import org.lindoor.customisation.Customisation.deviceTypesConfig import org.lindoor.customisation.Customisation.deviceTypesConfig
import org.lindoor.entities.Device
import org.lindoor.ui.widgets.SpinnerItem import org.lindoor.ui.widgets.SpinnerItem
import java.util.* import java.util.*
import org.lindoor.linphonecore.extensions.getString import org.lindoor.linphonecore.extensions.getString
...@@ -9,6 +11,7 @@ import org.lindoor.linphonecore.extensions.getString ...@@ -9,6 +11,7 @@ import org.lindoor.linphonecore.extensions.getString
object DeviceTypes { object DeviceTypes {
var deviceTypes: ArrayList<SpinnerItem> = ArrayList() var deviceTypes: ArrayList<SpinnerItem> = ArrayList()
lateinit var defaultType: String lateinit var defaultType: String
var defaultTypeIconAsBitmap: Bitmap? = null
init { init {
deviceTypesConfig.let { config -> deviceTypesConfig.let { config ->
...@@ -22,6 +25,7 @@ object DeviceTypes { ...@@ -22,6 +25,7 @@ object DeviceTypes {
it it
) )
) )
defaultTypeIconAsBitmap = Device.typeIconAsBitmap(defaultType)
} }
} }
} }
......
...@@ -158,6 +158,7 @@ class NotificationsManager(private val context: Context) { ...@@ -158,6 +158,7 @@ class NotificationsManager(private val context: Context) {
) )
Glide.with(context.applicationContext).asBitmap().load(it).into(awt) Glide.with(context.applicationContext).asBitmap().load(it).into(awt)
notificationBuilder.setCustomBigContentView(remoteView) notificationBuilder.setCustomBigContentView(remoteView)
notificationBuilder.setCustomContentView(remoteView)
val notification = notificationBuilder.build() val notification = notificationBuilder.build()
if (!LindoorApplication.someActivityRunning && call.state == Call.State.IncomingEarlyMedia) if (!LindoorApplication.someActivityRunning && call.state == Call.State.IncomingEarlyMedia)
notify(getNotifiableForCall(call).notificationId, notification) notify(getNotifiableForCall(call).notificationId, notification)
...@@ -343,17 +344,18 @@ class NotificationsManager(private val context: Context) { ...@@ -343,17 +344,18 @@ class NotificationsManager(private val context: Context) {
Texts.get("notif_incoming_call_title") Texts.get("notif_incoming_call_title")
) )
device?.also { device -> val awt = AppWidgetTarget(
device.typeIconAsBitmap?.also { context.applicationContext,
val awt = AppWidgetTarget( R.id.device_type,
context.applicationContext, remoteView,
R.id.device_type, if (hasSnapShot) 1 else 2
remoteView, )
if (hasSnapShot) 1 else 2
) Glide.with(context.applicationContext).asBitmap().load(device?.let { device ->
Glide.with(context.applicationContext).asBitmap().load(it).into(awt) device.typeIconAsBitmap?.let {
it
} }
} } ?: DeviceTypes.defaultTypeIconAsBitmap).into(awt)
return remoteView return remoteView
...@@ -396,7 +398,7 @@ class NotificationsManager(private val context: Context) { ...@@ -396,7 +398,7 @@ class NotificationsManager(private val context: Context) {
.addAction(getCallDeclineAction(notifiable.notificationId)) .addAction(getCallDeclineAction(notifiable.notificationId))
.addAction(getCallAnswerAction(notifiable.notificationId)) .addAction(getCallAnswerAction(notifiable.notificationId))
.setCustomContentView(fillIncomingRemoteViewsForCall(call, false)) .setCustomContentView(fillIncomingRemoteViewsForCall(call, false))
.setCustomBigContentView(fillIncomingRemoteViewsForCall(call, true)) .setCustomBigContentView(fillIncomingRemoteViewsForCall(call, false))
val notification = notificationBuilder.build() 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