some changes with resolution

This commit is contained in:
Thomas 2023-03-17 17:28:20 +01:00
parent 979739cc21
commit f082611b02
4 changed files with 24 additions and 8 deletions

View file

@ -611,7 +611,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
}
captions = null;
}
currentResolution = null;
currentResolution = getString(R.string.auto);
show_more_content = null;
currentCaption = "null";
binding.peertubeDescriptionMore.setVisibility(View.GONE);
@ -1767,8 +1767,18 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
case RESOLUTION:
binding.subMenuTitle.setText(R.string.pickup_resolution);
int position = 0;
for (File file : peertube.getFiles()) {
if (file.getResolutions() != null) {
for (File file : peertube.getAllFile(PeertubeActivity.this)) {
if (file.getResolutions() == null) {
MenuItemView item = new MenuItemView();
item.setId(0);
item.setLabel(file.getResolutions().getLabel());
if (file.getResolutions().getLabel().compareTo(currentResolution) == 0) {
item.setSelected(true);
}
items.add(item);
position++;
} else if (file.getResolutions() != null) {
if (file.getResolutions().getLabel().compareTo("0p") != 0) {
MenuItemView item = new MenuItemView();
item.setId(position);

View file

@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import app.fedilab.android.R;
import app.fedilab.android.peertube.client.entities.File;
import app.fedilab.android.peertube.client.entities.Item;
import app.fedilab.android.peertube.client.entities.ItemStr;
@ -150,13 +151,13 @@ public class VideoData implements Serializable {
} else if (streamingPlaylists != null) {
List<File> files = new ArrayList<>();
for (StreamingPlaylists streamingPlaylists : streamingPlaylists) {
File file = new File();
file.setResolutions(new Item(0, context.getString(R.string.auto)));
file.setFileUrl(streamingPlaylists.getPlaylistUrl());
file.setFileDownloadUrl(streamingPlaylists.getPlaylistUrl());
files.add(file);
if (streamingPlaylists.getFiles().size() > 0) {
files.addAll(streamingPlaylists.getFiles());
} else {
File file = new File();
file.setFileUrl(streamingPlaylists.getPlaylistUrl());
file.setFileDownloadUrl(streamingPlaylists.getPlaylistUrl());
files.add(file);
}
}
return files;

View file

@ -30,6 +30,10 @@ public class Item implements Serializable {
public Item() {
}
public Item(int id, String label) {
this.id = id;
this.label = label;
}
public int getId() {
return id;

View file

@ -2,4 +2,5 @@
<resources>
<string name="auto">Auto</string>
</resources>