Some fixes

This commit is contained in:
Thomas 2020-11-18 19:04:54 +01:00
parent 84e3264726
commit 15f6835a0c
2 changed files with 15 additions and 4 deletions

View File

@ -1360,11 +1360,18 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
break; break;
case CAPTION: case CAPTION:
Uri uri = null; Uri uri = null;
if (item.getId() != -1) { Caption captionToUse = null;
for (Caption caption : captions) {
if (caption.getLanguage().getId().compareTo(item.getStrId()) == 0) {
captionToUse = caption;
break;
}
}
if (captionToUse != null) {
if (!sepiaSearch) { if (!sepiaSearch) {
uri = Uri.parse("https://" + getLiveInstance(PeertubeActivity.this) + captions.get(item.getId()).getCaptionPath()); uri = Uri.parse("https://" + getLiveInstance(PeertubeActivity.this) + captionToUse.getCaptionPath());
} else { } else {
uri = Uri.parse("https://" + peertubeInstance + captions.get(item.getId()).getCaptionPath()); uri = Uri.parse("https://" + peertubeInstance + captionToUse.getCaptionPath());
} }
} }
currentCaption = item.getStrId(); currentCaption = item.getStrId();

View File

@ -26,6 +26,7 @@ import java.util.List;
import app.fedilab.fedilabtube.client.MenuItemVideo; import app.fedilab.fedilabtube.client.MenuItemVideo;
import app.fedilab.fedilabtube.client.entities.MenuItemView; import app.fedilab.fedilabtube.client.entities.MenuItemView;
import app.fedilab.fedilabtube.databinding.DrawerMenuItemBinding; import app.fedilab.fedilabtube.databinding.DrawerMenuItemBinding;
import app.fedilab.fedilabtube.helper.Helper;
public class MenuItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class MenuItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
@ -67,7 +68,10 @@ public class MenuItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
holder.binding.title.setText(item.getLabel()); holder.binding.title.setText(item.getLabel());
holder.binding.radio.setChecked(item.isSelected()); holder.binding.radio.setChecked(item.isSelected());
holder.binding.itemMenuContainer.setOnClickListener(v -> itemAction.which(actionType, item)); holder.binding.itemMenuContainer.setOnClickListener(v -> {
itemAction.which(actionType, item);
});
} }