From 13346ab75026defb470442db9233cbe01fb85a21 Mon Sep 17 00:00:00 2001 From: Faisal Hameed Date: Fri, 24 Jun 2016 15:19:15 +0500 Subject: [PATCH] Fixing squid:S1319 - Declarations should use Java collection interfaces such as "List" rather than specific implementation. --- .../extractor/youtube/YoutubeSearchEngineTest.java | 4 ++-- .../java/org/schabi/newpipe/SuggestionListAdapter.java | 3 ++- .../java/org/schabi/newpipe/VideoItemListActivity.java | 8 ++++---- .../java/org/schabi/newpipe/extractor/SearchEngine.java | 4 +--- .../extractor/services/youtube/YoutubeSearchEngine.java | 5 +++-- .../main/java/us/shandian/giga/get/DownloadMission.java | 6 ++++-- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/src/androidTest/java/org/schabi/newpipe/extractor/youtube/YoutubeSearchEngineTest.java b/app/src/androidTest/java/org/schabi/newpipe/extractor/youtube/YoutubeSearchEngineTest.java index c7253d238..23c412080 100644 --- a/app/src/androidTest/java/org/schabi/newpipe/extractor/youtube/YoutubeSearchEngineTest.java +++ b/app/src/androidTest/java/org/schabi/newpipe/extractor/youtube/YoutubeSearchEngineTest.java @@ -11,7 +11,7 @@ import org.schabi.newpipe.Downloader; import java.io.PrintWriter; import java.io.StringWriter; -import java.util.ArrayList; +import java.util.List; /** * Created by Christian Schabesberger on 29.12.15. @@ -35,7 +35,7 @@ import java.util.ArrayList; public class YoutubeSearchEngineTest extends AndroidTestCase { private SearchResult result; - private ArrayList suggestionReply; + private List suggestionReply; @Override public void setUp() throws Exception{ diff --git a/app/src/main/java/org/schabi/newpipe/SuggestionListAdapter.java b/app/src/main/java/org/schabi/newpipe/SuggestionListAdapter.java index 646d5ed18..10ba5efb0 100644 --- a/app/src/main/java/org/schabi/newpipe/SuggestionListAdapter.java +++ b/app/src/main/java/org/schabi/newpipe/SuggestionListAdapter.java @@ -10,6 +10,7 @@ import android.view.ViewGroup; import android.widget.TextView; import java.util.ArrayList; +import java.util.List; /** * Created by Madiyar on 23.02.2016. @@ -59,7 +60,7 @@ public class SuggestionListAdapter extends CursorAdapter { } - public void updateAdapter(ArrayList suggestions) { + public void updateAdapter(List suggestions) { MatrixCursor cursor = new MatrixCursor(columns); int i = 0; for (String s : suggestions) { diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java b/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java index d59013d34..6efb529a9 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java @@ -25,7 +25,7 @@ import org.schabi.newpipe.extractor.ServiceList; import org.schabi.newpipe.extractor.StreamingService; import java.io.IOException; -import java.util.ArrayList; +import java.util.List; import java.util.Vector; /** @@ -143,9 +143,9 @@ public class VideoItemListActivity extends AppCompatActivity private class SuggestionResultRunnable implements Runnable{ - private ArrayListsuggestions; + private List suggestions; - private SuggestionResultRunnable(ArrayList suggestions) { + private SuggestionResultRunnable(List suggestions) { this.suggestions = suggestions; } @@ -175,7 +175,7 @@ public class VideoItemListActivity extends AppCompatActivity String searchLanguageKey = context.getString(R.string.search_language_key); String searchLanguage = sp.getString(searchLanguageKey, getString(R.string.default_language_value)); - ArrayListsuggestions = engine.suggestionList(query,searchLanguage,new Downloader()); + List suggestions = engine.suggestionList(query,searchLanguage,new Downloader()); h.post(new SuggestionResultRunnable(suggestions)); } catch (ExtractionException e) { ErrorActivity.reportError(h, VideoItemListActivity.this, e, null, findViewById(R.id.videoitem_list), diff --git a/app/src/main/java/org/schabi/newpipe/extractor/SearchEngine.java b/app/src/main/java/org/schabi/newpipe/extractor/SearchEngine.java index 80532157e..a9c01fc22 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/SearchEngine.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/SearchEngine.java @@ -1,9 +1,7 @@ package org.schabi.newpipe.extractor; import java.io.IOException; -import java.util.ArrayList; import java.util.List; -import java.util.Vector; /** * Created by Christian Schabesberger on 10.08.15. @@ -43,7 +41,7 @@ public abstract class SearchEngine { return collector; } - public abstract ArrayList suggestionList( + public abstract List suggestionList( String query,String contentCountry, Downloader dl) throws ExtractionException, IOException; diff --git a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java index 89f5df58a..f73a46640 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java @@ -22,6 +22,7 @@ import java.net.URLEncoder; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; +import java.util.List; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -130,10 +131,10 @@ public class YoutubeSearchEngine extends SearchEngine { } @Override - public ArrayList suggestionList(String query, String contentCountry, Downloader dl) + public List suggestionList(String query, String contentCountry, Downloader dl) throws IOException, ParsingException { - ArrayList suggestions = new ArrayList<>(); + List suggestions = new ArrayList<>(); /* Cant use Uri.Bilder since it's android code. // Android code is baned from the extractor side. 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 38688fc4c..1cdef125f 100644 --- a/app/src/main/java/us/shandian/giga/get/DownloadMission.java +++ b/app/src/main/java/us/shandian/giga/get/DownloadMission.java @@ -12,6 +12,8 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Iterator; import java.util.HashMap; +import java.util.List; +import java.util.Map; import us.shandian.giga.util.Utility; import static org.schabi.newpipe.BuildConfig.DEBUG; @@ -39,8 +41,8 @@ public class DownloadMission public long done; public int threadCount = 3; public int finishCount; - public ArrayList threadPositions = new ArrayList(); - public HashMap blockState = new HashMap(); + public List threadPositions = new ArrayList(); + public Map blockState = new HashMap(); public boolean running; public boolean finished; public boolean fallback;