Merge pull request #2035 from DevFactory/release/Utility_classes_should_not_have_public_constructors-fix-1

squid:S1118 - Utility classes should not have public constructors
This commit is contained in:
Martin Fietz 2016-06-23 10:33:47 +02:00 committed by GitHub
commit d327489c46
27 changed files with 47 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import de.danoeh.antennapod.core.util.flattr.FlattrStatus;
*/
public class DBTestUtils {
private DBTestUtils(){}
/**
* Use this method when tests don't involve chapters.
*/

View File

@ -8,6 +8,7 @@ import java.io.IOException;
* Utility methods for FeedGenerator
*/
public class GeneratorUtil {
private GeneratorUtil(){}
public static void addPaymentLink(XmlSerializer xml, String paymentLink, boolean withNamespace) throws IOException {
String ns = (withNamespace) ? "http://www.w3.org/2005/Atom" : null;

View File

@ -14,6 +14,8 @@ import java.util.ArrayList;
*/
public class OpmlImportHolder {
private OpmlImportHolder(){}
private static ArrayList<OpmlElement> readElements;
public static ArrayList<OpmlElement> getReadElements() {

View File

@ -8,6 +8,8 @@ import de.danoeh.antennapod.core.ClientConfig;
*/
public class ClientConfigurator {
private ClientConfigurator(){}
static {
ClientConfig.USER_AGENT = "AntennaPod/" + BuildConfig.VERSION_NAME;
ClientConfig.applicationCallbacks = new ApplicationCallbacksImpl();

View File

@ -16,6 +16,9 @@ import de.danoeh.antennapod.core.preferences.GpodnetPreferences;
* Creates a dialog that lets the user change the hostname for the gpodder.net service.
*/
public class GpodnetSetHostnameDialog {
private GpodnetSetHostnameDialog(){}
private static final String TAG = "GpodnetSetHostnameDialog";
public static AlertDialog createDialog(final Context context) {

View File

@ -17,6 +17,8 @@ import de.danoeh.antennapod.R;
public class RatingDialog {
private RatingDialog(){}
private static final String TAG = RatingDialog.class.getSimpleName();
private static final int AFTER_DAYS = 7;

View File

@ -30,6 +30,9 @@ import de.danoeh.antennapod.core.util.ShareUtils;
* Handles interactions with the FeedItemMenu.
*/
public class FeedMenuHandler {
private FeedMenuHandler(){ }
private static final String TAG = "FeedMenuHandler";
public static boolean onCreateOptionsMenu(MenuInflater inflater, Menu menu) {

View File

@ -13,6 +13,7 @@ import de.danoeh.antennapod.core.util.NetworkUtils;
* Apps using the core module of AntennaPod should register implementations of all interfaces here.
*/
public class ClientConfig {
private ClientConfig(){}
/**
* Should be used when setting User-Agent header for HTTP-requests.

View File

@ -25,6 +25,8 @@ import de.danoeh.antennapod.core.storage.DBWriter;
*/
public class UpdateManager {
private UpdateManager(){}
public static final String TAG = UpdateManager.class.getSimpleName();
private static final String PREF_NAME = "app_version";

View File

@ -24,6 +24,8 @@ import de.danoeh.antennapod.core.util.playback.Playable;
* Helper functions for Cast support.
*/
public class CastUtils {
private CastUtils(){}
private static final String TAG = "CastUtils";
public static final String KEY_MEDIA_ID = "de.danoeh.antennapod.core.cast.MediaId";

View File

@ -6,6 +6,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
* The settings that AntennaPod will use for various Glide options
*/
public class ApGlideSettings {
private ApGlideSettings(){}
public static final DiskCacheStrategy AP_DISK_CACHE_STRATEGY = DiskCacheStrategy.ALL;
}

View File

@ -23,6 +23,8 @@ import de.danoeh.antennapod.core.service.GpodnetSyncService;
*/
public class GpodnetPreferences {
private GpodnetPreferences(){}
private static final String TAG = "GpodnetPreferences";
private static final String PREF_NAME = "gpodder.net";

View File

@ -40,6 +40,7 @@ import de.danoeh.antennapod.core.util.Converter;
* when called.
*/
public class UserPreferences {
private UserPreferences(){}
public static final String IMPORT_DIR = "import/";

View File

@ -35,6 +35,9 @@ import de.danoeh.antennapod.core.storage.DBWriter;
* Provides access to a HttpClient singleton.
*/
public class AntennapodHttpClient {
private AntennapodHttpClient(){}
private static final String TAG = "AntennapodHttpClient";
public static final int CONNECTION_TIMEOUT = 30000;

View File

@ -17,6 +17,8 @@ import de.danoeh.antennapod.core.util.comparator.SearchResultValueComparator;
* Performs search on Feeds and FeedItems
*/
public class FeedSearcher {
private FeedSearcher(){}
private static final String TAG = "FeedSearcher";

View File

@ -16,6 +16,7 @@ import java.util.TimeZone;
* Parses several date formats.
*/
public class DateUtils {
private DateUtils(){}
private static final String TAG = "DateUtils";

View File

@ -5,6 +5,7 @@ import java.util.List;
import de.danoeh.antennapod.core.feed.FeedItem;
public class FeedItemUtil {
private FeedItemUtil(){}
public static int indexOfItemWithDownloadUrl(List<FeedItem> items, String downloadUrl) {
if(items == null) {

View File

@ -8,6 +8,7 @@ import android.content.pm.ResolveInfo;
import java.util.List;
public class IntentUtils {
private IntentUtils(){}
public static boolean isCallable(final Context context, final Intent intent) {
List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent,

View File

@ -5,6 +5,9 @@ import android.support.v4.util.ArrayMap;
import java.nio.charset.Charset;
public class LangUtils {
private LangUtils(){}
public static final Charset UTF_8 = Charset.forName("UTF-8");
private static ArrayMap<String, String> languages;

View File

@ -27,6 +27,7 @@ import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
public class NetworkUtils {
private NetworkUtils(){}
private static final String TAG = NetworkUtils.class.getSimpleName();

View File

@ -9,6 +9,7 @@ import java.util.concurrent.TimeUnit;
* Media file should be "rewinded" x seconds after user resumes the playback.
*/
public class RewindAfterPauseUtils {
private RewindAfterPauseUtils(){}
public static final long ELAPSED_TIME_FOR_SHORT_REWIND = TimeUnit.MINUTES.toMillis(1);
public static final long ELAPSED_TIME_FOR_MEDIUM_REWIND = TimeUnit.HOURS.toMillis(1);

View File

@ -14,6 +14,8 @@ import de.danoeh.antennapod.core.preferences.UserPreferences;
* Utility functions for handling storage errors
*/
public class StorageUtils {
private StorageUtils(){}
private static final String TAG = "StorageUtils";
public static boolean storageAvailable() {

View File

@ -6,6 +6,8 @@ import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.preferences.UserPreferences;
public class ThemeUtils {
private ThemeUtils(){}
private static final String TAG = "ThemeUtils";
public static int getSelectionBackgroundColor() {

View File

@ -11,6 +11,8 @@ import de.danoeh.antennapod.core.BuildConfig;
/** Ensures that only one instance of the FlattrService class exists at a time */
public class FlattrServiceCreator {
private FlattrServiceCreator(){}
public static final String TAG = "FlattrServiceCreator";
private static volatile FlattrService flattrService;

View File

@ -36,6 +36,8 @@ import de.danoeh.antennapod.core.storage.DBWriter;
*/
public class FlattrUtils {
private FlattrUtils(){}
private static final String TAG = "FlattrUtils";
private static final String HOST_NAME = "de.danoeh.antennapod";

View File

@ -6,6 +6,7 @@ import de.danoeh.antennapod.core.R;
/** Utility class for MediaPlayer errors. */
public class MediaPlayerError {
private MediaPlayerError(){}
/** Get a human-readable string for a specific error code. */
public static String getErrorString(Context context, int code) {

View File

@ -161,6 +161,8 @@ public interface Playable extends Parcelable,
* Provides utility methods for Playable objects.
*/
class PlayableUtils {
private PlayableUtils(){}
private static final String TAG = "PlayableUtils";
/**