Merge "Remove the Smartspace update's media filter." into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9d5138623d
@@ -29,7 +29,6 @@ class SmartspaceMediaDataProvider @Inject constructor() : BcSmartspaceDataPlugin
|
|||||||
|
|
||||||
private val smartspaceMediaTargetListeners: MutableList<SmartspaceTargetListener> =
|
private val smartspaceMediaTargetListeners: MutableList<SmartspaceTargetListener> =
|
||||||
mutableListOf()
|
mutableListOf()
|
||||||
private var smartspaceMediaTargets: List<SmartspaceTarget> = listOf()
|
|
||||||
|
|
||||||
override fun registerListener(smartspaceTargetListener: SmartspaceTargetListener) {
|
override fun registerListener(smartspaceTargetListener: SmartspaceTargetListener) {
|
||||||
smartspaceMediaTargetListeners.add(smartspaceTargetListener)
|
smartspaceMediaTargetListeners.add(smartspaceTargetListener)
|
||||||
@@ -41,22 +40,7 @@ class SmartspaceMediaDataProvider @Inject constructor() : BcSmartspaceDataPlugin
|
|||||||
|
|
||||||
/** Updates Smartspace data and propagates it to any listeners. */
|
/** Updates Smartspace data and propagates it to any listeners. */
|
||||||
override fun onTargetsAvailable(targets: List<SmartspaceTarget>) {
|
override fun onTargetsAvailable(targets: List<SmartspaceTarget>) {
|
||||||
// Filter out non-media targets.
|
Log.d(TAG, "Forwarding Smartspace updates $targets")
|
||||||
val mediaTargets = mutableListOf<SmartspaceTarget>()
|
smartspaceMediaTargetListeners.forEach { it.onSmartspaceTargetsUpdated(targets) }
|
||||||
for (target in targets) {
|
|
||||||
val smartspaceTarget = target
|
|
||||||
if (smartspaceTarget.featureType == SmartspaceTarget.FEATURE_MEDIA) {
|
|
||||||
mediaTargets.add(smartspaceTarget)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mediaTargets.isEmpty()) {
|
|
||||||
Log.d(TAG, "Forwarding Smartspace media updates $mediaTargets")
|
|
||||||
}
|
|
||||||
|
|
||||||
smartspaceMediaTargets = mediaTargets
|
|
||||||
smartspaceMediaTargetListeners.forEach {
|
|
||||||
it.onSmartspaceTargetsUpdated(smartspaceMediaTargets)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user