Merge pull request #5852 from ByteHamster/cleanup-widget
Clean up duplicate widget updates
This commit is contained in:
commit
1b2102d753
|
@ -3,14 +3,12 @@ package de.danoeh.antennapod.core.receiver;
|
|||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProvider;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
import de.danoeh.antennapod.core.widget.WidgetUpdaterWorker;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import de.danoeh.antennapod.core.widget.WidgetUpdaterWorker;
|
||||
|
||||
public class PlayerWidget extends AppWidgetProvider {
|
||||
private static final String TAG = "PlayerWidget";
|
||||
public static final String PREFS_NAME = "PlayerWidgetPrefs";
|
||||
|
@ -21,13 +19,6 @@ public class PlayerWidget extends AppWidgetProvider {
|
|||
public static final String KEY_WIDGET_REWIND = "widget_rewind";
|
||||
public static final int DEFAULT_COLOR = 0x00262C31;
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.d(TAG, "onReceive");
|
||||
super.onReceive(context, intent);
|
||||
WidgetUpdaterWorker.enqueueWork(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnabled(Context context) {
|
||||
super.onEnabled(context);
|
||||
|
|
|
@ -2,14 +2,12 @@ package de.danoeh.antennapod.core.widget;
|
|||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.work.ExistingWorkPolicy;
|
||||
import androidx.work.OneTimeWorkRequest;
|
||||
import androidx.work.WorkManager;
|
||||
import androidx.work.WorkRequest;
|
||||
import androidx.work.Worker;
|
||||
import androidx.work.WorkerParameters;
|
||||
|
||||
import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils;
|
||||
import de.danoeh.antennapod.core.util.playback.PlayableUtils;
|
||||
import de.danoeh.antennapod.model.playback.Playable;
|
||||
|
@ -25,8 +23,8 @@ public class WidgetUpdaterWorker extends Worker {
|
|||
}
|
||||
|
||||
public static void enqueueWork(final Context context) {
|
||||
final WorkRequest workRequest = new OneTimeWorkRequest.Builder(WidgetUpdaterWorker.class).build();
|
||||
WorkManager.getInstance(context).enqueue(workRequest);
|
||||
final OneTimeWorkRequest workRequest = new OneTimeWorkRequest.Builder(WidgetUpdaterWorker.class).build();
|
||||
WorkManager.getInstance(context).enqueueUniqueWork(TAG, ExistingWorkPolicy.REPLACE, workRequest);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
Loading…
Reference in New Issue