Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-11-13 12:27:21 +01:00
commit 2322ba833a
6 changed files with 13 additions and 11 deletions

View File

@ -26,7 +26,7 @@ import java.util.Vector;
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
/**Info object for opened videos, ie the video ready to play.*/
public class VideoInfo {
public String id = "";
public String title = "";

View File

@ -24,6 +24,7 @@ import android.os.Parcelable;
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
/**Info object for previews of unopened videos, eg search results, related videos*/
public class VideoInfoItem implements Parcelable {
public String id = "";
public String title = "";

View File

@ -16,6 +16,7 @@ import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImageView;
import java.util.ArrayList;
import java.util.Arrays;
/**
@ -114,13 +115,13 @@ public class VideoItemListActivity extends AppCompatActivity
Bundle arguments = getIntent().getExtras();
if(arguments != null) {
Parcelable[] p = arguments.getParcelableArray(VIDEO_INFO_ITEMS);
//Parcelable[] p = arguments.getParcelableArray(VIDEO_INFO_ITEMS);
ArrayList<VideoInfoItem> p = arguments.getParcelableArrayList(VIDEO_INFO_ITEMS);
if(p != null) {
mode = PRESENT_VIDEOS_MODE;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//todo: make this more efficient
listFragment.present(Arrays.copyOf(p, p.length, VideoInfoItem[].class));
listFragment.present(p);
}
}

View File

@ -16,6 +16,7 @@ import android.widget.Toast;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;
@ -167,14 +168,12 @@ public class VideoItemListFragment extends ListFragment {
}
}
public void present(VideoInfoItem[] videoList) {
public void present(List<VideoInfoItem> videoList) {
mode = PRESENT_VIDEOS_MODE;
setListShown(true);
getListView().smoothScrollToPosition(0);
// inefficient like hell i know (welcome to the world of java)
//todo: make this more efficient
updateList(new Vector<>(Arrays.asList(videoList)));
updateList(videoList);
}
public void search(String query) {
@ -221,7 +220,7 @@ public class VideoItemListFragment extends ListFragment {
}
}
private void updateList(Vector<VideoInfoItem> list) {
private void updateList(List<VideoInfoItem> list) {
try {
videoListAdapter.addVideoList(list);
terminateThreads();

View File

@ -9,6 +9,7 @@ import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import java.util.List;
import java.util.Vector;
/**
@ -48,7 +49,7 @@ public class VideoListAdapter extends BaseAdapter {
this.context = context;
}
public void addVideoList(Vector<VideoInfoItem> videos) {
public void addVideoList(List<VideoInfoItem> videos) {
videoList.addAll(videos);
for(int i = 0; i < videos.size(); i++) {
downloadedThumbnailList.add(false);

View File

@ -4,7 +4,7 @@
<string name="title_videoitem_detail">NewPipe</string>
<string name="nothingFound">Ничего не найдено</string>
<string name="viewSufix">просмотров</string>
<string name="uploadDatePrefix">"Опубликовано: "</string>
<string name="uploadDatePrefix">Опубликовано: </string>
<string name="noPlayerFound">Ни одного потокового проигрывателя не было найдено. Установить?</string>
<string name="installStreamPlayer">Установить</string>
<string name="cancel">Отмена</string>