From dd2398efad85653ca7829b0bcbf32e3b978566c0 Mon Sep 17 00:00:00 2001 From: Faisal Hameed Date: Fri, 24 Jun 2016 05:37:44 +0500 Subject: [PATCH] Fixing pmd:RedundantFieldInitializer - Redundant Field Initializer. --- .../org/schabi/newpipe/ActionBarHandler.java | 12 +++++------ .../schabi/newpipe/ActivityCommunicator.java | 2 +- .../org/schabi/newpipe/ErrorActivity.java | 2 +- .../org/schabi/newpipe/SettingsActivity.java | 2 +- .../newpipe/VideoItemDetailFragment.java | 6 +++--- .../schabi/newpipe/VideoItemListActivity.java | 6 +++--- .../schabi/newpipe/VideoItemListFragment.java | 14 ++++++------- .../newpipe/extractor/AbstractVideoInfo.java | 2 +- .../newpipe/extractor/StreamPreviewInfo.java | 2 +- .../extractor/StreamPreviewInfoCollector.java | 2 +- .../youtube/YoutubeStreamExtractor.java | 2 +- .../newpipe/player/BackgroundPlayer.java | 4 ++-- .../newpipe/player/PlayVideoActivity.java | 8 ++++---- .../us/shandian/giga/get/DownloadMission.java | 20 +++++++++---------- .../giga/ui/adapter/MissionAdapter.java | 2 +- .../giga/ui/common/ProgressDrawable.java | 2 +- .../giga/ui/fragment/MissionsFragment.java | 2 +- 17 files changed, 45 insertions(+), 45 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java b/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java index cc8a62ce0..80c149885 100644 --- a/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java +++ b/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java @@ -44,17 +44,17 @@ class ActionBarHandler { private AppCompatActivity activity; private int selectedVideoStream = -1; - private SharedPreferences defaultPreferences = null; + private SharedPreferences defaultPreferences; private Menu menu; // Only callbacks are listed here, there are more actions which don't need a callback. // those are edited directly. Typically VideoItemDetailFragment will implement those callbacks. - private OnActionListener onShareListener = null; - private OnActionListener onOpenInBrowserListener = null; - private OnActionListener onDownloadListener = null; - private OnActionListener onPlayWithKodiListener = null; - private OnActionListener onPlayAudioListener = null; + private OnActionListener onShareListener; + private OnActionListener onOpenInBrowserListener; + private OnActionListener onDownloadListener; + private OnActionListener onPlayWithKodiListener; + private OnActionListener onPlayAudioListener; // Triggered when a stream related action is triggered. diff --git a/app/src/main/java/org/schabi/newpipe/ActivityCommunicator.java b/app/src/main/java/org/schabi/newpipe/ActivityCommunicator.java index 4ea6ca657..ea76b46f2 100644 --- a/app/src/main/java/org/schabi/newpipe/ActivityCommunicator.java +++ b/app/src/main/java/org/schabi/newpipe/ActivityCommunicator.java @@ -30,7 +30,7 @@ import java.util.List; * This can be considered as an ugly hack inside the Android universe. **/ public class ActivityCommunicator { - private static ActivityCommunicator activityCommunicator = null; + private static ActivityCommunicator activityCommunicator; public static ActivityCommunicator getCommunicator() { if(activityCommunicator == null) { diff --git a/app/src/main/java/org/schabi/newpipe/ErrorActivity.java b/app/src/main/java/org/schabi/newpipe/ErrorActivity.java index 95cede795..ec43730dd 100644 --- a/app/src/main/java/org/schabi/newpipe/ErrorActivity.java +++ b/app/src/main/java/org/schabi/newpipe/ErrorActivity.java @@ -93,7 +93,7 @@ public class ErrorActivity extends AppCompatActivity { private Class returnActivity; private String currentTimeStamp; private String globIpRange; - Thread globIpRangeThread = null; + Thread globIpRangeThread; // views private TextView errorView; diff --git a/app/src/main/java/org/schabi/newpipe/SettingsActivity.java b/app/src/main/java/org/schabi/newpipe/SettingsActivity.java index 316923c25..6436574de 100644 --- a/app/src/main/java/org/schabi/newpipe/SettingsActivity.java +++ b/app/src/main/java/org/schabi/newpipe/SettingsActivity.java @@ -48,7 +48,7 @@ import info.guardianproject.netcipher.proxy.OrbotHelper; public class SettingsActivity extends PreferenceActivity { private static final int REQUEST_INSTALL_ORBOT = 0x1234; - private AppCompatDelegate mDelegate = null; + private AppCompatDelegate mDelegate; @Override protected void onCreate(Bundle savedInstanceBundle) { diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java index 4c7ac440e..c9f277562 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java @@ -101,8 +101,8 @@ public class VideoItemDetailFragment extends Fragment { private int streamingServiceId = -1; - private boolean autoPlayEnabled = false; - private boolean showNextVideoItem = false; + private boolean autoPlayEnabled; + private boolean showNextVideoItem; private Bitmap videoThumbnail; private View thumbnailWindowLayout; @@ -120,7 +120,7 @@ public class VideoItemDetailFragment extends Fragment { void createOptionsMenu(); } - private OnInvokeCreateOptionsMenuListener onInvokeCreateOptionsMenuListener = null; + private OnInvokeCreateOptionsMenuListener onInvokeCreateOptionsMenuListener; private class VideoExtractorRunnable implements Runnable { private final Handler h = new Handler(); diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java b/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java index 273c5c971..d59013d34 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java @@ -62,13 +62,13 @@ public class VideoItemListActivity extends AppCompatActivity private static final int SEARCH_MODE = 0; private static final int PRESENT_VIDEOS_MODE = 1; - private int mode = SEARCH_MODE; + private int mode; private int currentStreamingServiceId = -1; private String searchQuery = ""; private VideoItemListFragment listFragment; - private VideoItemDetailFragment videoFragment = null; - private Menu menu = null; + private VideoItemDetailFragment videoFragment; + private Menu menu; private SuggestionListAdapter suggestionListAdapter; private SuggestionSearchRunnable suggestionSearchRunnable; diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java b/app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java index 7e279a00b..c8131a099 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java @@ -46,19 +46,19 @@ public class VideoItemListFragment extends ListFragment { private static final String TAG = VideoItemListFragment.class.toString(); - private StreamingService streamingService = null; + private StreamingService streamingService; private VideoListAdapter videoListAdapter; // activity modes private static final int SEARCH_MODE = 0; private static final int PRESENT_VIDEOS_MODE = 1; - private int mode = SEARCH_MODE; + private int mode; private String query = ""; - private int lastPage = 0; + private int lastPage; - private Thread searchThread = null; - private SearchRunnable searchRunnable = null; + private Thread searchThread; + private SearchRunnable searchRunnable; // used to track down if results posted by threads ar still valid private int currentRequestId = -1; private ListView list; @@ -256,7 +256,7 @@ public class VideoItemListFragment extends ListFragment { void onItemSelected(String id); } - private Callbacks mCallbacks = null; + private Callbacks mCallbacks; @Override public void onViewCreated(View view, Bundle savedInstanceState) { @@ -278,7 +278,7 @@ public class VideoItemListFragment extends ListFragment { getListView().setOnScrollListener(new AbsListView.OnScrollListener() { - long lastScrollDate = 0; + long lastScrollDate; @Override public void onScrollStateChanged(AbsListView view, int scrollState) { diff --git a/app/src/main/java/org/schabi/newpipe/extractor/AbstractVideoInfo.java b/app/src/main/java/org/schabi/newpipe/extractor/AbstractVideoInfo.java index 9ea107f22..f14fbf2f2 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/AbstractVideoInfo.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/AbstractVideoInfo.java @@ -37,7 +37,7 @@ public abstract class AbstractVideoInfo { public String title = ""; public String uploader = ""; public String thumbnail_url = ""; - public Bitmap thumbnail = null; + public Bitmap thumbnail; public String webpage_url = ""; public String upload_date = ""; public long view_count = -1; diff --git a/app/src/main/java/org/schabi/newpipe/extractor/StreamPreviewInfo.java b/app/src/main/java/org/schabi/newpipe/extractor/StreamPreviewInfo.java index 5b0ff7c57..b85fe96af 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/StreamPreviewInfo.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/StreamPreviewInfo.java @@ -22,5 +22,5 @@ package org.schabi.newpipe.extractor; /**Info object for previews of unopened videos, eg search results, related videos*/ public class StreamPreviewInfo extends AbstractVideoInfo { - public int duration = 0; + public int duration; } \ No newline at end of file diff --git a/app/src/main/java/org/schabi/newpipe/extractor/StreamPreviewInfoCollector.java b/app/src/main/java/org/schabi/newpipe/extractor/StreamPreviewInfoCollector.java index df7291f71..013bbbc1d 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/StreamPreviewInfoCollector.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/StreamPreviewInfoCollector.java @@ -28,7 +28,7 @@ import java.util.Vector; public class StreamPreviewInfoCollector { private List itemList = new Vector<>(); private List errors = new Vector<>(); - private StreamUrlIdHandler urlIdHandler = null; + private StreamUrlIdHandler urlIdHandler; private int serviceId = -1; public StreamPreviewInfoCollector(StreamUrlIdHandler handler, int serviceId) { diff --git a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java index 967a8e098..eebbc4eb3 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java @@ -110,7 +110,7 @@ public class YoutubeStreamExtractor extends StreamExtractor { public int id; public ItagType itagType; public int mediaFormatId; - public String resolutionString = null; + public String resolutionString; public int fps = -1; public int samplingRate = -1; public int bandWidth = -1; diff --git a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java index 792a35704..e283d5e05 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java @@ -67,7 +67,7 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare // Determines if the service is already running. // Prevents launching the service twice. - public static volatile boolean isRunning = false; + public static volatile boolean isRunning; public BackgroundPlayer() { super(); @@ -121,7 +121,7 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare private BackgroundPlayer owner; private NotificationManager noteMgr; private WifiManager.WifiLock wifiLock; - private Bitmap videoThumbnail = null; + private Bitmap videoThumbnail; private NotificationCompat.Builder noteBuilder; private Notification note; diff --git a/app/src/main/java/org/schabi/newpipe/player/PlayVideoActivity.java b/app/src/main/java/org/schabi/newpipe/player/PlayVideoActivity.java index c00381d32..f13e73b49 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PlayVideoActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/PlayVideoActivity.java @@ -66,14 +66,14 @@ public class PlayVideoActivity extends AppCompatActivity { private ActionBar actionBar; private VideoView videoView; - private int position = 0; + private int position; private MediaController mediaController; private ProgressBar progressBar; private View decorView; - private boolean uiIsHidden = false; - private static long lastUiShowTime = 0; + private boolean uiIsHidden; + private static long lastUiShowTime; private boolean isLandscape = true; - private boolean hasSoftKeys = false; + private boolean hasSoftKeys; private SharedPreferences prefs; private static final String PREF_IS_LANDSCAPE = "is_landscape"; diff --git a/app/src/main/java/us/shandian/giga/get/DownloadMission.java b/app/src/main/java/us/shandian/giga/get/DownloadMission.java index bbcee7e94..f35d6b2a5 100644 --- a/app/src/main/java/us/shandian/giga/get/DownloadMission.java +++ b/app/src/main/java/us/shandian/giga/get/DownloadMission.java @@ -34,23 +34,23 @@ public class DownloadMission public String name = ""; public String url = ""; public String location = ""; - public long blocks = 0; - public long length = 0; - public long done = 0; + public long blocks; + public long length; + public long done; public int threadCount = 3; - public int finishCount = 0; + public int finishCount; public ArrayList threadPositions = new ArrayList(); public HashMap blockState = new HashMap(); - public boolean running = false; - public boolean finished = false; - public boolean fallback = false; + public boolean running; + public boolean finished; + public boolean fallback; public int errCode = -1; - public long timestamp = 0; + public long timestamp; - public transient boolean recovered = false; + public transient boolean recovered; private transient ArrayList> mListeners = new ArrayList>(); - private transient boolean mWritingToFile = false; + private transient boolean mWritingToFile; public boolean isBlockPreserved(long block) { return blockState.containsKey(block) ? blockState.get(block) : false; diff --git a/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java b/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java index 99653e455..050b4edf4 100644 --- a/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java +++ b/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java @@ -292,7 +292,7 @@ public class MissionAdapter extends RecyclerView.Adapter