Skip to content

Commit 4380655

Browse files
committed
lol
1 parent 764e68b commit 4380655

File tree

1 file changed

+10
-8
lines changed
  • app/src/main/java/org/akanework/gramophone/ui

1 file changed

+10
-8
lines changed

app/src/main/java/org/akanework/gramophone/ui/Widget.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.appwidget.AppWidgetProvider
66
import android.content.ComponentName
77
import android.content.Context
88
import android.content.Intent
9+
import android.os.Build
910
import android.os.Bundle
1011
import android.os.Handler
1112
import android.os.Looper
@@ -44,14 +45,15 @@ class LyricWidgetProvider : AppWidgetProvider() {
4445
val views =
4546
RemoteViews(context.packageName, R.layout.lyric_widget).apply {
4647
setPendingIntentTemplate(R.id.list_view, seekPi)
47-
setRemoteAdapter( // TODO deprecated
48-
R.id.list_view,
49-
Intent(context, LyricWidgetService::class.java).apply<Intent> {
50-
this.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
51-
// Intents are compared using filterEquals() which ignores extras, so encode extras
52-
// in data to enforce comparison noticing the difference between different Intents.
53-
this.data = toUri(Intent.URI_INTENT_SCHEME).toUri()
54-
})
48+
if (Build.VERSION.SDK_INT < 36) // hack fix crashing issue due to AOSP bug
49+
setRemoteAdapter( // TODO deprecated
50+
R.id.list_view,
51+
Intent(context, LyricWidgetService::class.java).apply<Intent> {
52+
this.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
53+
// Intents are compared using filterEquals() which ignores extras, so encode extras
54+
// in data to enforce comparison noticing the difference between different Intents.
55+
this.data = toUri(Intent.URI_INTENT_SCHEME).toUri()
56+
})
5557
setEmptyView(R.id.list_view, R.id.empty_view)
5658
}
5759
// setting null first fixes outdated data related bugs but causes flicker. hence we

0 commit comments

Comments
 (0)