Merge pull request #321 from DevFactory/release/collection-interfaces-should-be-used-fix-1

Code quality fix - Declarations should use Java collection interfaces such as "List" rather than specific implementation.
This commit is contained in:
Christian Schabesberger 2016-07-25 00:46:33 +02:00 committed by GitHub
commit d3d4e8c721
6 changed files with 16 additions and 14 deletions

View file

@ -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<String> suggestions) {
public void updateAdapter(List<String> suggestions) {
MatrixCursor cursor = new MatrixCursor(columns);
int i = 0;
for (String s : suggestions) {

View file

@ -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 ArrayList<String>suggestions;
private List<String> suggestions;
private SuggestionResultRunnable(ArrayList<String> suggestions) {
private SuggestionResultRunnable(List<String> 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));
ArrayList<String>suggestions = engine.suggestionList(query,searchLanguage,new Downloader());
List<String> 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),

View file

@ -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<String> suggestionList(
public abstract List<String> suggestionList(
String query,String contentCountry, Downloader dl)
throws ExtractionException, IOException;

View file

@ -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<String> suggestionList(String query, String contentCountry, Downloader dl)
public List<String> suggestionList(String query, String contentCountry, Downloader dl)
throws IOException, ParsingException {
ArrayList<String> suggestions = new ArrayList<>();
List<String> suggestions = new ArrayList<>();
/* Cant use Uri.Bilder since it's android code.
// Android code is baned from the extractor side.