diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2016-10-12 17:51:14 +0200 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2016-10-12 21:31:34 +0200 |
commit | fdc7d41824cef94578469572c0f79c5e06444737 (patch) | |
tree | 0b684be68593fa4d0773ca879230e952d34b2827 /core/src | |
parent | 21799ab22c6c72b263337678a9d5de68957e12b9 (diff) | |
download | AntennaPod-fdc7d41824cef94578469572c0f79c5e06444737.zip |
Replace toast with snackbar and optional undo action
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/event/MessageEvent.java | 23 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java | 3 |
2 files changed, 12 insertions, 14 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/event/MessageEvent.java b/core/src/main/java/de/danoeh/antennapod/core/event/MessageEvent.java index f35bfd14c..9fc488fbc 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/event/MessageEvent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/event/MessageEvent.java @@ -1,24 +1,21 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package de.danoeh.antennapod.core.event; +import android.support.annotation.Nullable; + public class MessageEvent { public final String message; + @Nullable + public final Runnable action; + public MessageEvent(String message) { + this(message, null); + } + + public MessageEvent(String message, Runnable action) { this.message = message; + this.action = action; } } diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index b967be6aa..33aec0ee0 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -854,7 +854,8 @@ public class PlaybackService extends MediaBrowserServiceCompat { Log.d(TAG, "Setting sleep timer to " + Long.toString(waitingTime) + " milliseconds"); taskManager.setSleepTimer(waitingTime, shakeToReset, vibrate); sendNotificationBroadcast(NOTIFICATION_TYPE_SLEEPTIMER_UPDATE, 0); - EventBus.getDefault().post(new MessageEvent(getString(R.string.sleep_timer_enabled_label))); + EventBus.getDefault().post(new MessageEvent(getString(R.string.sleep_timer_enabled_label), + () -> disableSleepTimer())); } public void disableSleepTimer() { |