Skip to content

Commit

Permalink
refactor: move widget receiver to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash-Garg committed Oct 7, 2022
1 parent f6f4f66 commit adae02e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/src/main/res/xml/torrent_widget_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
android:resizeMode="horizontal|vertical"
android:targetCellWidth="4"
android:targetCellHeight="2"
android:updatePeriodMillis="1000"
android:widgetCategory="home_screen" />
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import androidx.glance.GlanceModifier
import androidx.glance.action.ActionParameters
import androidx.glance.action.clickable
import androidx.glance.appwidget.GlanceAppWidget
import androidx.glance.appwidget.GlanceAppWidgetReceiver
import androidx.glance.appwidget.action.ActionCallback
import androidx.glance.appwidget.action.actionRunCallback
import androidx.glance.background
Expand Down Expand Up @@ -48,11 +47,6 @@ class TorrentListWidget : GlanceAppWidget() {
}
}

class TorrentListWidgetReceiver : GlanceAppWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget
get() = TorrentListWidget()
}

class TitleClickAction : ActionCallback {
override suspend fun onAction(
context: Context,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package dev.yashgarg.qbit.ui.compose.widgets

import android.content.Context
import android.content.Intent
import android.util.Log
import androidx.glance.appwidget.GlanceAppWidget
import androidx.glance.appwidget.GlanceAppWidgetReceiver

class TorrentListWidgetReceiver : GlanceAppWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget
get() = TorrentListWidget()

override fun onReceive(context: Context, intent: Intent) {
super.onReceive(context, intent)
Log.i(this::class.simpleName, "onReceive() -> $intent | ${intent.data} ")
}
}

0 comments on commit adae02e

Please sign in to comment.