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/>. * 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 class VideoInfo {
public String id = ""; public String id = "";
public String title = ""; public String title = "";

View file

@ -24,6 +24,7 @@ import android.os.Parcelable;
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>. * 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 class VideoInfoItem implements Parcelable {
public String id = ""; public String id = "";
public String title = ""; public String title = "";

View file

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

View file

@ -16,6 +16,7 @@ import android.widget.Toast;
import java.net.URL; import java.net.URL;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Vector; 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; mode = PRESENT_VIDEOS_MODE;
setListShown(true); setListShown(true);
getListView().smoothScrollToPosition(0); getListView().smoothScrollToPosition(0);
// inefficient like hell i know (welcome to the world of java) updateList(videoList);
//todo: make this more efficient
updateList(new Vector<>(Arrays.asList(videoList)));
} }
public void search(String query) { 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 { try {
videoListAdapter.addVideoList(list); videoListAdapter.addVideoList(list);
terminateThreads(); terminateThreads();

View file

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

View file

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