diff --git a/app/src/acad/res/values/strings.xml b/app/src/acad/res/values/strings.xml
index 4d22804..4f85e2c 100644
--- a/app/src/acad/res/values/strings.xml
+++ b/app/src/acad/res/values/strings.xml
@@ -201,6 +201,9 @@
Tous ces labels
Un de ces labels
Appliquer le filtre
+
+ Vitesse du lecteur
+ Normal
- Meilleurs résultats
- Les plus récentes
diff --git a/app/src/full/res/values/colors.xml b/app/src/full/res/values/colors.xml
index 2547404..0cf97a5 100644
--- a/app/src/full/res/values/colors.xml
+++ b/app/src/full/res/values/colors.xml
@@ -7,6 +7,6 @@
#FAFAFA
#2b90d9
#F44336
-
+ #DD000000
#F44336
\ No newline at end of file
diff --git a/app/src/full/res/values/strings.xml b/app/src/full/res/values/strings.xml
index 5ffe68b..7cd6645 100644
--- a/app/src/full/res/values/strings.xml
+++ b/app/src/full/res/values/strings.xml
@@ -282,8 +282,8 @@
Send comment
All
-
-
+ Playback speed
+ Normal
Delete videos history
Are you sure you want to delete all your videos history?
diff --git a/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java b/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java
index 72eaa2c..394cc24 100644
--- a/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java
+++ b/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java
@@ -45,7 +45,6 @@ import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.view.inputmethod.InputMethodManager;
-import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
@@ -76,6 +75,7 @@ import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaItem;
+import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector;
@@ -115,12 +115,13 @@ import app.fedilab.fedilabtube.client.data.CommentData.Comment;
import app.fedilab.fedilabtube.client.data.PlaylistData;
import app.fedilab.fedilabtube.client.data.VideoData;
import app.fedilab.fedilabtube.client.entities.File;
-import app.fedilab.fedilabtube.client.entities.ItemStr;
+import app.fedilab.fedilabtube.client.entities.MenuItemView;
import app.fedilab.fedilabtube.client.entities.PlaylistExist;
import app.fedilab.fedilabtube.client.entities.Report;
import app.fedilab.fedilabtube.databinding.ActivityPeertubeBinding;
import app.fedilab.fedilabtube.drawer.CommentListAdapter;
import app.fedilab.fedilabtube.drawer.MenuAdapter;
+import app.fedilab.fedilabtube.drawer.MenuItemAdapter;
import app.fedilab.fedilabtube.helper.CacheDataSourceFactory;
import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.sqlite.AccountDAO;
@@ -148,7 +149,7 @@ import static app.fedilab.fedilabtube.helper.Helper.loadGiF;
import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_AUTO;
-public class PeertubeActivity extends AppCompatActivity implements CommentListAdapter.AllCommentRemoved, Player.EventListener, VideoListener, TorrentListener, MenuAdapter.ItemClicked {
+public class PeertubeActivity extends AppCompatActivity implements CommentListAdapter.AllCommentRemoved, Player.EventListener, VideoListener, TorrentListener, MenuAdapter.ItemClicked, MenuItemAdapter.ItemAction {
public static String video_id;
public static List playedVideos = new ArrayList<>();
@@ -178,7 +179,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
private String show_more_content;
private videoOrientation videoOrientationType;
private int initialOrientation;
-
+ private String currentResolution;
public static void hideKeyboard(Activity activity) {
if (activity != null && activity.getWindow() != null) {
@@ -342,7 +343,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
if (mode != Helper.VIDEO_MODE_WEBVIEW) {
binding.doubleTapPlayerView.setControllerShowTimeoutMs(1000);
binding.doubleTapPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT);
- // initFullscreenDialog();
initControllerButtons();
binding.doubleTapPlayerView
@@ -406,15 +406,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
}
binding.postCommentButton.setOnClickListener(v -> openPostComment(null, 0));
- List menuItemVideos = new ArrayList<>();
- MenuItemVideo resolutionItem = new MenuItemVideo();
- resolutionItem.setIcon(R.drawable.ic_baseline_settings_24);
- resolutionItem.setTitle(getString(R.string.pickup_resolution));
- resolutionItem.setAction(MenuItemVideo.actionType.RESOLUTION);
-
- MenuAdapter menuAdapter = new MenuAdapter(menuItemVideos);
- binding.mainOptionsVideo.setAdapter(menuAdapter);
-
}
private void manageVIewVideos(APIResponse apiResponse) {
@@ -545,6 +536,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
player.setPlayWhenReady(autoPlay);
captions = null;
}
+ currentResolution = null;
show_more_content = null;
binding.peertubeDescriptionMore.setVisibility(View.GONE);
if (autoFullscreen && autoPlay) {
@@ -831,9 +823,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
popup.getMenuInflater()
.inflate(R.menu.main_video, popup.getMenu());
- if (captions == null) {
- popup.getMenu().findItem(R.id.action_captions).setEnabled(false);
- }
if (!isMyVideo) {
popup.getMenu().findItem(R.id.action_edit).setVisible(false);
}
@@ -887,63 +876,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
b.putString("video_id", peertube.getUuid());
intent.putExtras(b);
startActivity(intent);
- } else if (itemId == R.id.action_captions) {
- AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PeertubeActivity.this);
- if (captions == null) {
- return true;
- }
-
- String[] itemsKeyLanguage = new String[captions.size() + 1];
- String[] itemsLabelLanguage = new String[captions.size() + 1];
- itemsLabelLanguage[0] = getString(R.string.none);
- itemsKeyLanguage[0] = "null";
- int i = 1;
- if (captions.size() > 0) {
- for (Caption caption : captions) {
- ItemStr lang = caption.getLanguage();
- itemsLabelLanguage[i] = lang.getLabel();
- itemsKeyLanguage[i] = lang.getId();
- i++;
- }
- }
- dialogBuilder.setSingleChoiceItems(itemsLabelLanguage, i, (dialog, which) -> {
-
- Uri uri = null;
- if (which > 0) {
- if (!sepiaSearch) {
- uri = Uri.parse("https://" + getLiveInstance(PeertubeActivity.this) + captions.get(which - 1).getCaptionPath());
- } else {
- uri = Uri.parse("https://" + peertubeInstance + captions.get(which - 1).getCaptionPath());
- }
- }
- long newPosition = player.getCurrentPosition();
-
- if (player != null)
- player.release();
-
- TrackSelector trackSelector = new DefaultTrackSelector(PeertubeActivity.this, new AdaptiveTrackSelection.Factory());
- player = new SimpleExoPlayer.Builder(PeertubeActivity.this).setTrackSelector(trackSelector).build();
- binding.mediaVideo.player(player);
- binding.doubleTapPlayerView.setPlayer(player);
- startStream(
- apiResponse.getPeertubes().get(0).getFileUrl(null, PeertubeActivity.this),
- null,
- true,
- newPosition,
- uri,
- itemsKeyLanguage[which]
- );
- dialog.dismiss();
- });
-
- dialogBuilder.setOnDismissListener(dialogInterface -> {
-
- });
- dialogBuilder.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
-
- AlertDialog alertDialog = dialogBuilder.create();
- alertDialog.setTitle(getString(R.string.pickup_captions));
- alertDialog.show();
} else if (itemId == R.id.action_report) {
AlertDialog alertDialog;
AlertDialog.Builder dialogBuilder;
@@ -1143,7 +1075,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
@Override
public void onBackPressed() {
- if (binding.mainOptionsVideo.getVisibility() == View.VISIBLE) {
+
+ if (binding.videoParamsSubmenu.getVisibility() == View.VISIBLE) {
+ closeSubMenuMenuOptions();
+ return;
+ }
+ if (binding.videoParams.getVisibility() == View.VISIBLE) {
closeMainMenuOptions();
return;
}
@@ -1175,42 +1112,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
}
}
- public void displayResolution() {
- AlertDialog.Builder builderSingle = new AlertDialog.Builder(PeertubeActivity.this);
- builderSingle.setTitle(R.string.pickup_resolution);
- final ArrayAdapter arrayAdapter = new ArrayAdapter<>(PeertubeActivity.this, android.R.layout.select_dialog_item);
- for (File file : peertube.getFiles()) {
- if (file.getResolutions() != null) {
- if (file.getResolutions().getLabel().compareTo("0p") != 0) {
- arrayAdapter.add(file.getResolutions().getLabel());
- }
- }
- }
- builderSingle.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
- builderSingle.setAdapter(arrayAdapter, (dialog, which) -> {
- String res = Objects.requireNonNull(arrayAdapter.getItem(which)).substring(0, Objects.requireNonNull(arrayAdapter.getItem(which)).length() - 1);
-
- binding.loader.setVisibility(View.VISIBLE);
- long position = player.getCurrentPosition();
- PlayerControlView controlView = binding.doubleTapPlayerView.findViewById(R.id.exo_controller);
- TextView resolution = controlView.findViewById(R.id.resolution);
- resolution.setText(String.format("%sp", res));
- if (mode == Helper.VIDEO_MODE_NORMAL) {
- if (player != null)
- player.release();
- player = new SimpleExoPlayer.Builder(PeertubeActivity.this).build();
- binding.mediaVideo.player(player);
- binding.doubleTapPlayerView.setPlayer(player);
- binding.loader.setVisibility(View.GONE);
- startStream(
- peertube.getFileUrl(res, PeertubeActivity.this),
- peertube.getStreamingPlaylists().size() > 0 ? peertube.getStreamingPlaylists().get(0).getPlaylistUrl() : null,
- true, position, null, null);
- }
-
- });
- builderSingle.show();
- }
private void toogleFullscreen(boolean fullscreen) {
@@ -1282,12 +1183,39 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels;
+ List menuItemVideos = new ArrayList<>();
+ if (peertube.getFiles() != null && peertube.getFiles().size() > 0) {
+ MenuItemVideo resolutionItem = new MenuItemVideo();
+ resolutionItem.setIcon(R.drawable.ic_baseline_high_quality_24);
+ resolutionItem.setTitle(getString(R.string.pickup_resolution));
+ resolutionItem.setAction(MenuItemVideo.actionType.RESOLUTION);
+ menuItemVideos.add(resolutionItem);
+
+ }
+ MenuItemVideo speedItem = new MenuItemVideo();
+ speedItem.setIcon(R.drawable.ic_baseline_speed_24);
+ speedItem.setTitle(getString(R.string.playback_speed));
+ speedItem.setAction(MenuItemVideo.actionType.SPEED);
+ menuItemVideos.add(speedItem);
+
+ if (captions != null) {
+ MenuItemVideo captionItem = new MenuItemVideo();
+ captionItem.setIcon(R.drawable.ic_baseline_subtitles_24);
+ captionItem.setTitle(getString(R.string.captions));
+ captionItem.setAction(MenuItemVideo.actionType.CAPTION);
+ menuItemVideos.add(captionItem);
+ }
+
+ MenuAdapter menuAdapter = new MenuAdapter(menuItemVideos);
+ binding.mainOptionsVideo.setAdapter(menuAdapter);
+ menuAdapter.itemClicked = this;
+ binding.mainOptionsVideo.setLayoutManager(new LinearLayoutManager(PeertubeActivity.this));
TranslateAnimation animate = new TranslateAnimation(
0,
0,
height,
- height - binding.videoParams.getHeight());
+ 0);
animate.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
@@ -1312,7 +1240,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
TranslateAnimation animate = new TranslateAnimation(
0,
0,
- height - binding.videoParams.getHeight(),
+ 0,
height);
animate.setAnimationListener(new Animation.AnimationListener() {
@Override
@@ -1333,6 +1261,61 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
}
+ public void openSubMenuMenuOptions() {
+ binding.videoParamsSubmenu.setVisibility(View.VISIBLE);
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
+ int height = displayMetrics.heightPixels;
+ TranslateAnimation animate = new TranslateAnimation(
+ 0,
+ 0,
+ height,
+ 0);
+ animate.setAnimationListener(new Animation.AnimationListener() {
+ @Override
+ public void onAnimationStart(Animation animation) {
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+ }
+ });
+ animate.setDuration(500);
+ binding.videoParamsSubmenu.startAnimation(animate);
+ }
+
+ public void closeSubMenuMenuOptions() {
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
+ int height = displayMetrics.heightPixels;
+ TranslateAnimation animate = new TranslateAnimation(
+ 0,
+ 0,
+ 0,
+ height);
+ animate.setAnimationListener(new Animation.AnimationListener() {
+ @Override
+ public void onAnimationStart(Animation animation) {
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ binding.videoParamsSubmenu.setVisibility(View.GONE);
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+ }
+ });
+ animate.setDuration(500);
+ binding.videoParamsSubmenu.startAnimation(animate);
+ }
+
+
private void sendComment(Comment comment, int position) {
if (isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
if (comment == null) {
@@ -1533,9 +1516,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
private void initResolution() {
PlayerControlView controlView = binding.doubleTapPlayerView.findViewById(R.id.exo_controller);
TextView resolution = controlView.findViewById(R.id.resolution);
+ currentResolution = Helper.defaultFile(PeertubeActivity.this, peertube.getFiles()).getResolutions().getLabel();
if (peertube.getFiles() != null && peertube.getFiles().size() > 0) {
- resolution.setText(String.format("%s", Helper.defaultFile(PeertubeActivity.this, peertube.getFiles()).getResolutions().getLabel()));
- resolution.setOnClickListener(v -> displayResolution());
+ resolution.setText(String.format("%s", currentResolution));
} else {
resolution.setVisibility(View.GONE);
}
@@ -1702,6 +1685,119 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
@Override
public void onItemClicked(MenuItemVideo.actionType action) {
+ List items = new ArrayList<>();
+ switch (action) {
+ case RESOLUTION:
+ binding.subMenuTitle.setText(R.string.pickup_resolution);
+ int position = 0;
+ for (File file : peertube.getFiles()) {
+ if (file.getResolutions() != null) {
+ if (file.getResolutions().getLabel().compareTo("0p") != 0) {
+ MenuItemView item = new MenuItemView();
+ item.setId(position);
+ item.setLabel(file.getResolutions().getLabel());
+ if (file.getResolutions().getLabel().compareTo(currentResolution) == 0) {
+ item.setSelected(true);
+ }
+ items.add(item);
+ position++;
+ }
+ }
+ }
+ break;
+ case SPEED:
+ binding.subMenuTitle.setText(R.string.playback_speed);
+ items = new ArrayList<>();
+ items.add(new MenuItemView(25, "0.25x", player.getPlaybackParameters().speed == 0.25));
+ items.add(new MenuItemView(50, "0.5x", player.getPlaybackParameters().speed == 0.5));
+ items.add(new MenuItemView(75, "0.75x", player.getPlaybackParameters().speed == 0.75));
+ items.add(new MenuItemView(100, getString(R.string.normal), player.getPlaybackParameters().speed == 1));
+ items.add(new MenuItemView(125, "1.25x", player.getPlaybackParameters().speed == 1.25));
+ items.add(new MenuItemView(150, "1.5x", player.getPlaybackParameters().speed == 1.5));
+ items.add(new MenuItemView(175, "1.75x", player.getPlaybackParameters().speed == 1.75));
+ items.add(new MenuItemView(200, "2x", player.getPlaybackParameters().speed == 2.0));
+ break;
+ case CAPTION:
+ binding.subMenuTitle.setText(R.string.pickup_captions);
+ items = new ArrayList<>();
+ items.add(new MenuItemView(-1, "null", getString(R.string.none)));
+ int i = 0;
+ for (Caption caption : captions) {
+ items.add(new MenuItemView(i, caption.getLanguage().getId(), caption.getLanguage().getLabel()));
+ }
+ break;
+ }
+ if (items != null) {
+ MenuItemAdapter menuItemAdapter = new MenuItemAdapter(action, items);
+ menuItemAdapter.itemAction = this;
+ binding.subMenuRecycler.setAdapter(menuItemAdapter);
+ binding.subMenuRecycler.setLayoutManager(new LinearLayoutManager(PeertubeActivity.this));
+ openSubMenuMenuOptions();
+ }
+ }
+
+ @Override
+ public void which(MenuItemVideo.actionType action, MenuItemView item) {
+ closeMainMenuOptions();
+ switch (action) {
+ case RESOLUTION:
+ String res = item.getLabel();
+ binding.loader.setVisibility(View.VISIBLE);
+ long position = player.getCurrentPosition();
+ PlayerControlView controlView = binding.doubleTapPlayerView.findViewById(R.id.exo_controller);
+ TextView resolution = controlView.findViewById(R.id.resolution);
+ currentResolution = res;
+ resolution.setText(String.format("%s", res));
+ if (mode == Helper.VIDEO_MODE_NORMAL) {
+ if (player != null)
+ player.release();
+ player = new SimpleExoPlayer.Builder(PeertubeActivity.this).build();
+ binding.mediaVideo.player(player);
+ binding.doubleTapPlayerView.setPlayer(player);
+ binding.loader.setVisibility(View.GONE);
+ startStream(
+ peertube.getFileUrl(res, PeertubeActivity.this),
+ peertube.getStreamingPlaylists().size() > 0 ? peertube.getStreamingPlaylists().get(0).getPlaylistUrl() : null,
+ true, position, null, null);
+ }
+ break;
+ case SPEED:
+ int speed = item.getId();
+ float ratio = (float) speed / 100;
+ PlaybackParameters param = new PlaybackParameters(ratio);
+ if (player != null) {
+ player.setPlaybackParameters(param);
+ }
+ break;
+ case CAPTION:
+ Uri uri = null;
+ if (item.getId() != -1) {
+ if (!sepiaSearch) {
+ uri = Uri.parse("https://" + getLiveInstance(PeertubeActivity.this) + captions.get(item.getId()).getCaptionPath());
+ } else {
+ uri = Uri.parse("https://" + peertubeInstance + captions.get(item.getId()).getCaptionPath());
+ }
+ }
+ long newPosition = player.getCurrentPosition();
+
+ if (player != null)
+ player.release();
+
+ TrackSelector trackSelector = new DefaultTrackSelector(PeertubeActivity.this, new AdaptiveTrackSelection.Factory());
+ player = new SimpleExoPlayer.Builder(PeertubeActivity.this).setTrackSelector(trackSelector).build();
+ binding.mediaVideo.player(player);
+ binding.doubleTapPlayerView.setPlayer(player);
+ startStream(
+ peertube.getFileUrl(null, PeertubeActivity.this),
+ null,
+ true,
+ newPosition,
+ uri,
+ item.getStrId()
+ );
+ break;
+ }
+ closeSubMenuMenuOptions();
}
diff --git a/app/src/main/java/app/fedilab/fedilabtube/client/MenuItemVideo.java b/app/src/main/java/app/fedilab/fedilabtube/client/MenuItemVideo.java
index 51f023a..590ec1d 100644
--- a/app/src/main/java/app/fedilab/fedilabtube/client/MenuItemVideo.java
+++ b/app/src/main/java/app/fedilab/fedilabtube/client/MenuItemVideo.java
@@ -45,6 +45,8 @@ public class MenuItemVideo {
}
public enum actionType {
- RESOLUTION
+ RESOLUTION,
+ SPEED,
+ CAPTION
}
}
diff --git a/app/src/main/java/app/fedilab/fedilabtube/client/entities/MenuItemView.java b/app/src/main/java/app/fedilab/fedilabtube/client/entities/MenuItemView.java
new file mode 100644
index 0000000..b3277eb
--- /dev/null
+++ b/app/src/main/java/app/fedilab/fedilabtube/client/entities/MenuItemView.java
@@ -0,0 +1,92 @@
+package app.fedilab.fedilabtube.client.entities;
+/* Copyright 2020 Thomas Schneider
+ *
+ * This file is a part of TubeLab
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with TubeLab; if not,
+ * see . */
+
+
+@SuppressWarnings({"unused", "RedundantSuppression"})
+public class MenuItemView {
+
+ private int id;
+ private String strId;
+ private String label;
+ private boolean selected;
+
+ public MenuItemView() {
+ }
+
+ public MenuItemView(int id, String label) {
+ this.id = id;
+ this.label = label;
+ selected = false;
+ }
+
+ public MenuItemView(int id, String label, boolean selected) {
+ this.id = id;
+ this.label = label;
+ this.selected = selected;
+ }
+
+ public MenuItemView(String strId, String label, boolean selected) {
+ this.strId = strId;
+ this.label = label;
+ this.selected = selected;
+ }
+
+ public MenuItemView(String strId, String label) {
+ this.strId = strId;
+ this.label = label;
+ this.selected = false;
+ }
+
+ public MenuItemView(int id, String strId, String label) {
+ this.id = id;
+ this.strId = strId;
+ this.label = label;
+ this.selected = false;
+ }
+
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public boolean isSelected() {
+ return selected;
+ }
+
+ public void setSelected(boolean selected) {
+ this.selected = selected;
+ }
+
+ public String getStrId() {
+ return strId;
+ }
+
+ public void setStrId(String strId) {
+ this.strId = strId;
+ }
+}
diff --git a/app/src/main/java/app/fedilab/fedilabtube/drawer/MenuItemAdapter.java b/app/src/main/java/app/fedilab/fedilabtube/drawer/MenuItemAdapter.java
new file mode 100644
index 0000000..c32c2ac
--- /dev/null
+++ b/app/src/main/java/app/fedilab/fedilabtube/drawer/MenuItemAdapter.java
@@ -0,0 +1,89 @@
+package app.fedilab.fedilabtube.drawer;
+/* Copyright 2020 Thomas Schneider
+ *
+ * This file is a part of TubeLab
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with TubeLab; if not,
+ * see . */
+
+
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import java.util.List;
+
+import app.fedilab.fedilabtube.client.MenuItemVideo;
+import app.fedilab.fedilabtube.client.entities.MenuItemView;
+import app.fedilab.fedilabtube.databinding.DrawerMenuItemBinding;
+
+
+public class MenuItemAdapter extends RecyclerView.Adapter {
+
+ private final List items;
+ public ItemAction itemAction;
+ MenuItemVideo.actionType actionType;
+
+ public MenuItemAdapter(MenuItemVideo.actionType actionType, List items) {
+ this.items = items;
+ this.actionType = actionType;
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public int getItemCount() {
+ return items.size();
+ }
+
+
+ @NonNull
+ @Override
+ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ DrawerMenuItemBinding itemBinding = DrawerMenuItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
+ return new ViewHolder(itemBinding);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) {
+
+
+ final ViewHolder holder = (ViewHolder) viewHolder;
+
+ final MenuItemView item = items.get(i);
+
+ holder.binding.title.setText(item.getLabel());
+ holder.binding.radio.setChecked(item.isSelected());
+ holder.binding.itemMenuContainer.setOnClickListener(v -> itemAction.which(actionType, item));
+
+ }
+
+ public interface ItemAction {
+ void which(MenuItemVideo.actionType actionType, MenuItemView item);
+ }
+
+ static class ViewHolder extends RecyclerView.ViewHolder {
+
+ DrawerMenuItemBinding binding;
+
+ ViewHolder(DrawerMenuItemBinding itemView) {
+ super(itemView.getRoot());
+ binding = itemView;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_baseline_speed_24.xml b/app/src/main/res/drawable/ic_baseline_speed_24.xml
new file mode 100644
index 0000000..c3537c2
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_speed_24.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/layout/activity_peertube.xml b/app/src/main/res/layout/activity_peertube.xml
index 7b3031d..4b9f641 100644
--- a/app/src/main/res/layout/activity_peertube.xml
+++ b/app/src/main/res/layout/activity_peertube.xml
@@ -25,6 +25,10 @@
-
-
+
-
+ android:layout_height="wrap_content">
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/drawer_menu.xml b/app/src/main/res/layout/drawer_menu.xml
index 2e28f36..ea75f79 100644
--- a/app/src/main/res/layout/drawer_menu.xml
+++ b/app/src/main/res/layout/drawer_menu.xml
@@ -4,12 +4,13 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_menu_container"
android:layout_width="match_parent"
+ android:layout_marginTop="10dp"
android:layout_height="wrap_content">
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/main_video.xml b/app/src/main/res/menu/main_video.xml
index 0655e02..479e7d3 100644
--- a/app/src/main/res/menu/main_video.xml
+++ b/app/src/main/res/menu/main_video.xml
@@ -11,11 +11,6 @@
android:icon="@drawable/ic_baseline_cloud_download_24"
android:title="@string/download"
app:showAsAction="ifRoom" />
-
-
-
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 3ae510b..97324ce 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,5 +1,5 @@
-
+