diff options
author | ByteHamster <info@bytehamster.com> | 2018-05-05 14:04:12 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2018-05-05 14:04:12 +0200 |
commit | 7107819a6aa61c6f171e43fe582133302d5f260b (patch) | |
tree | e93278e731e5eebf326ccdc9993398242ab7d726 /app/src/main/java/de/danoeh/antennapod/receiver | |
parent | 0b54d97a0a9a2caeb51c85a68749df9afe0dbdb3 (diff) | |
download | AntennaPod-7107819a6aa61c6f171e43fe582133302d5f260b.zip |
Moved widget from app to core
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/receiver')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/receiver/PlayerWidget.java | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/receiver/PlayerWidget.java b/app/src/main/java/de/danoeh/antennapod/receiver/PlayerWidget.java deleted file mode 100644 index c50160934..000000000 --- a/app/src/main/java/de/danoeh/antennapod/receiver/PlayerWidget.java +++ /dev/null @@ -1,58 +0,0 @@ -package de.danoeh.antennapod.receiver; - -import android.appwidget.AppWidgetManager; -import android.appwidget.AppWidgetProvider; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.text.TextUtils; -import android.util.Log; - -import java.util.Arrays; - -import de.danoeh.antennapod.core.service.playback.PlaybackService; -import de.danoeh.antennapod.service.PlayerWidgetJobService; - -public class PlayerWidget extends AppWidgetProvider { - private static final String TAG = "PlayerWidget"; - private static final String PREFS_NAME = "PlayerWidgetPrefs"; - private static final String KEY_ENABLED = "WidgetEnabled"; - - @Override - public void onReceive(Context context, Intent intent) { - Log.d(TAG, "onReceive"); - super.onReceive(context, intent); - PlayerWidgetJobService.updateWidget(context); - } - - @Override - public void onEnabled(Context context) { - super.onEnabled(context); - Log.d(TAG, "Widget enabled"); - setEnabled(context, true); - PlayerWidgetJobService.updateWidget(context); - } - - @Override - public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { - Log.d(TAG, "onUpdate() called with: " + "context = [" + context + "], appWidgetManager = [" + appWidgetManager + "], appWidgetIds = [" + Arrays.toString(appWidgetIds) + "]"); - PlayerWidgetJobService.updateWidget(context); - } - - @Override - public void onDisabled(Context context) { - super.onDisabled(context); - Log.d(TAG, "Widget disabled"); - setEnabled(context, false); - } - - public static boolean isEnabled(Context context) { - SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); - return prefs.getBoolean(KEY_ENABLED, false); - } - - private void setEnabled(Context context, boolean enabled) { - SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); - prefs.edit().putBoolean(KEY_ENABLED, enabled).apply(); - } -} |