diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2014-07-06 13:48:38 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2014-07-06 13:48:38 +0200 |
commit | fb1fcb06005e925f6c1ebabeb1f31007bc86a48c (patch) | |
tree | cce2db2e3d59b35ed138fe7c22448cf657ee75c5 /src/de/danoeh/antennapod/fragment | |
parent | 60214f6306bfed6b870b8cc5c8ce0b08d4590cdd (diff) | |
download | AntennaPod-fb1fcb06005e925f6c1ebabeb1f31007bc86a48c.zip |
Increased use of library methods
Diffstat (limited to 'src/de/danoeh/antennapod/fragment')
3 files changed, 14 insertions, 6 deletions
diff --git a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java index bd5d73c36..666a867a4 100644 --- a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java +++ b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java @@ -17,6 +17,9 @@ import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; + +import org.apache.commons.lang3.Validate; + import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.FeedInfoActivity; @@ -97,7 +100,7 @@ public class ItemlistFragment extends ListFragment { setHasOptionsMenu(true); Bundle args = getArguments(); - if (args == null) throw new IllegalArgumentException("args invalid"); + Validate.notNull(args); feedID = args.getLong(ARGUMENT_FEED_ID); } diff --git a/src/de/danoeh/antennapod/fragment/gpodnet/SearchListFragment.java b/src/de/danoeh/antennapod/fragment/gpodnet/SearchListFragment.java index 79d0c5d6f..080436aa6 100644 --- a/src/de/danoeh/antennapod/fragment/gpodnet/SearchListFragment.java +++ b/src/de/danoeh/antennapod/fragment/gpodnet/SearchListFragment.java @@ -4,6 +4,9 @@ import android.os.Bundle; import android.support.v7.widget.SearchView; import android.view.Menu; import android.view.MenuInflater; + +import org.apache.commons.lang3.Validate; + import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.fragment.SearchFragment; @@ -68,9 +71,8 @@ public class SearchListFragment extends PodcastListFragment { } public void changeQuery(String query) { - if (query == null) { - throw new NullPointerException(); - } + Validate.notNull(query); + this.query = query; loadData(); } diff --git a/src/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java b/src/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java index f016290bf..204dda992 100644 --- a/src/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java +++ b/src/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java @@ -1,6 +1,9 @@ package de.danoeh.antennapod.fragment.gpodnet; import android.os.Bundle; + +import org.apache.commons.lang3.Validate; + import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.gpoddernet.GpodnetService; import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; @@ -21,7 +24,7 @@ public class TagFragment extends PodcastListFragment { private GpodnetTag tag; public static TagFragment newInstance(String tagName) { - if (tagName == null) throw new IllegalArgumentException("tagName = null"); + Validate.notNull(tagName); TagFragment fragment = new TagFragment(); Bundle args = new Bundle(); args.putString("tag", tagName); @@ -34,7 +37,7 @@ public class TagFragment extends PodcastListFragment { super.onCreate(savedInstanceState); Bundle args = getArguments(); - if (args == null || args.getString("tag") == null) throw new IllegalArgumentException("args invalid"); + Validate.isTrue(args != null && args.getString("tag") != null, "args invalid"); tag = new GpodnetTag(args.getString("tag")); ((MainActivity) getActivity()).getMainActivtyActionBar().setTitle(tag.getName()); |