@@ -6,6 +6,7 @@ import android.appwidget.AppWidgetProvider
66import android.content.ComponentName
77import android.content.Context
88import android.content.Intent
9+ import android.os.Build
910import android.os.Bundle
1011import android.os.Handler
1112import 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