diff options
Diffstat (limited to 'src/de/danoeh/antennapod/adapter/ActionButtonUtils.java')
-rw-r--r-- | src/de/danoeh/antennapod/adapter/ActionButtonUtils.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/de/danoeh/antennapod/adapter/ActionButtonUtils.java b/src/de/danoeh/antennapod/adapter/ActionButtonUtils.java index 17c61a86c..4308f4f2c 100644 --- a/src/de/danoeh/antennapod/adapter/ActionButtonUtils.java +++ b/src/de/danoeh/antennapod/adapter/ActionButtonUtils.java @@ -4,6 +4,9 @@ import android.content.Context; import android.content.res.TypedArray; import android.view.View; import android.widget.ImageButton; + +import org.apache.commons.lang3.Validate; + import de.danoeh.antennapod.R; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.feed.FeedMedia; @@ -20,7 +23,8 @@ public class ActionButtonUtils { private final Context context; public ActionButtonUtils(Context context) { - if (context == null) throw new IllegalArgumentException("context = null"); + Validate.notNull(context); + this.context = context; drawables = context.obtainStyledAttributes(new int[]{ R.attr.av_play, R.attr.navigation_cancel, R.attr.av_download, R.attr.navigation_chapters}); @@ -32,7 +36,8 @@ public class ActionButtonUtils { * action button so that it matches the state of the FeedItem. */ public void configureActionButton(ImageButton butSecondary, FeedItem item) { - if (butSecondary == null || item == null) throw new IllegalArgumentException("butSecondary or item was null"); + Validate.isTrue(butSecondary != null && item != null, "butSecondary or item was null"); + final FeedMedia media = item.getMedia(); if (media != null) { final boolean isDownloadingMedia = DownloadRequester.getInstance().isDownloadingFile(media); |