mirror of
				https://framagit.org/tom79/fedilab-tube
				synced 2025-06-05 21:09:11 +02:00 
			
		
		
		
	Some fixes
This commit is contained in:
		| @@ -11,8 +11,8 @@ android { | |||||||
|  |  | ||||||
|         minSdkVersion 21 |         minSdkVersion 21 | ||||||
|         targetSdkVersion 30 |         targetSdkVersion 30 | ||||||
|         versionCode 25 |         versionCode 26 | ||||||
|         versionName "1.7.0" |         versionName "1.8.0-beta-1" | ||||||
|         multiDexEnabled true |         multiDexEnabled true | ||||||
|         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -1259,23 +1259,137 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd | |||||||
|                 0, |                 0, | ||||||
|                 height, |                 height, | ||||||
|                 0); |                 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); |         animate.setDuration(500); | ||||||
|         binding.videoParams.startAnimation(animate); |         binding.videoParams.startAnimation(animate); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public void onItemClicked(MenuItemVideo.actionType action) { | ||||||
|  |         binding.videoParamsSubmenu.setVisibility(View.VISIBLE); | ||||||
|  |         List<MenuItemView> 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), currentCaption.compareTo("null") == 0)); | ||||||
|  |                 int i = 0; | ||||||
|  |                 for (Caption caption : captions) { | ||||||
|  |                     items.add(new MenuItemView(i, caption.getLanguage().getId(), caption.getLanguage().getLabel(), currentCaption.compareTo(caption.getLanguage().getId()) == 0)); | ||||||
|  |                 } | ||||||
|  |                 break; | ||||||
|  |         } | ||||||
|  |         MenuItemAdapter menuItemAdapter = new MenuItemAdapter(action, items); | ||||||
|  |         binding.subMenuRecycler.setAdapter(menuItemAdapter); | ||||||
|  |         menuItemAdapter.itemAction = this; | ||||||
|  |         binding.subMenuRecycler.setLayoutManager(new LinearLayoutManager(PeertubeActivity.this)); | ||||||
|  |  | ||||||
|  |         DisplayMetrics displayMetrics = new DisplayMetrics(); | ||||||
|  |         getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); | ||||||
|  |         int height = displayMetrics.heightPixels; | ||||||
|  |         TranslateAnimation animate = new TranslateAnimation( | ||||||
|  |                 0, | ||||||
|  |                 0, | ||||||
|  |                 height, | ||||||
|  |                 0); | ||||||
|  |         animate.setDuration(500); | ||||||
|  |         binding.videoParamsSubmenu.startAnimation(animate); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @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()); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |                 currentCaption = item.getStrId(); | ||||||
|  |                 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(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     public void closeMainMenuOptions() { |     public void closeMainMenuOptions() { | ||||||
|         DisplayMetrics displayMetrics = new DisplayMetrics(); |         DisplayMetrics displayMetrics = new DisplayMetrics(); | ||||||
|         getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); |         getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); | ||||||
| @@ -1304,32 +1418,6 @@ 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() { |     public void closeSubMenuMenuOptions() { | ||||||
|         DisplayMetrics displayMetrics = new DisplayMetrics(); |         DisplayMetrics displayMetrics = new DisplayMetrics(); | ||||||
| @@ -1692,7 +1780,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd | |||||||
|                 if (binding.videoParamsSubmenu.getVisibility() == View.VISIBLE) { |                 if (binding.videoParamsSubmenu.getVisibility() == View.VISIBLE) { | ||||||
|                     closeSubMenuMenuOptions(); |                     closeSubMenuMenuOptions(); | ||||||
|                 } |                 } | ||||||
|                 return true; |  | ||||||
|             } |             } | ||||||
|             Rect viewRectParamsSub = new Rect(); |             Rect viewRectParamsSub = new Rect(); | ||||||
|             binding.videoParamsSubmenu.getGlobalVisibleRect(viewRectParamsSub); |             binding.videoParamsSubmenu.getGlobalVisibleRect(viewRectParamsSub); | ||||||
| @@ -1701,7 +1788,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd | |||||||
|                 if (binding.videoParams.getVisibility() == View.VISIBLE) { |                 if (binding.videoParams.getVisibility() == View.VISIBLE) { | ||||||
|                     closeMainMenuOptions(); |                     closeMainMenuOptions(); | ||||||
|                 } |                 } | ||||||
|                 return true; |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return super.dispatchTouchEvent(event); |         return super.dispatchTouchEvent(event); | ||||||
| @@ -1758,122 +1844,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd | |||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public void onItemClicked(MenuItemVideo.actionType action) { |  | ||||||
|  |  | ||||||
|         List<MenuItemView> 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), currentCaption.compareTo("null") == 0)); |  | ||||||
|                 int i = 0; |  | ||||||
|                 for (Caption caption : captions) { |  | ||||||
|                     items.add(new MenuItemView(i, caption.getLanguage().getId(), caption.getLanguage().getLabel(), currentCaption.compareTo(caption.getLanguage().getId()) == 0)); |  | ||||||
|                 } |  | ||||||
|                 break; |  | ||||||
|         } |  | ||||||
|         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()); |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
|                 currentCaption = item.getStrId(); |  | ||||||
|                 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(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     enum videoOrientation { |     enum videoOrientation { | ||||||
|   | |||||||
| @@ -15,15 +15,12 @@ package app.fedilab.fedilabtube.drawer; | |||||||
|  * see <http://www.gnu.org/licenses>. */ |  * see <http://www.gnu.org/licenses>. */ | ||||||
|  |  | ||||||
|  |  | ||||||
| import android.content.Context; |  | ||||||
| import android.view.LayoutInflater; | import android.view.LayoutInflater; | ||||||
| import android.view.ViewGroup; | import android.view.ViewGroup; | ||||||
|  |  | ||||||
| import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||||
| import androidx.recyclerview.widget.RecyclerView; | import androidx.recyclerview.widget.RecyclerView; | ||||||
|  |  | ||||||
| import com.bumptech.glide.Glide; |  | ||||||
|  |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
| import app.fedilab.fedilabtube.client.MenuItemVideo; | import app.fedilab.fedilabtube.client.MenuItemVideo; | ||||||
| @@ -35,7 +32,6 @@ public class MenuAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |||||||
|  |  | ||||||
|     private final List<MenuItemVideo> menuItemVideos; |     private final List<MenuItemVideo> menuItemVideos; | ||||||
|     public ItemClicked itemClicked; |     public ItemClicked itemClicked; | ||||||
|     private Context context; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     public MenuAdapter(List<MenuItemVideo> menuItemVideos) { |     public MenuAdapter(List<MenuItemVideo> menuItemVideos) { | ||||||
| @@ -56,7 +52,6 @@ public class MenuAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |||||||
|     @NonNull |     @NonNull | ||||||
|     @Override |     @Override | ||||||
|     public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |     public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||||||
|         context = parent.getContext(); |  | ||||||
|         DrawerMenuBinding itemBinding = DrawerMenuBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false); |         DrawerMenuBinding itemBinding = DrawerMenuBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false); | ||||||
|         return new ViewHolder(itemBinding); |         return new ViewHolder(itemBinding); | ||||||
|     } |     } | ||||||
| @@ -64,17 +59,13 @@ public class MenuAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |||||||
|     @Override |     @Override | ||||||
|     public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) { |     public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) { | ||||||
|  |  | ||||||
|         context = viewHolder.itemView.getContext(); |  | ||||||
|  |  | ||||||
|         final ViewHolder holder = (ViewHolder) viewHolder; |         final ViewHolder holder = (ViewHolder) viewHolder; | ||||||
|  |  | ||||||
|         final MenuItemVideo menuItemVideo = menuItemVideos.get(i); |         final MenuItemVideo menuItemVideo = menuItemVideos.get(i); | ||||||
|  |  | ||||||
|         holder.binding.menuIcon.setImageResource(menuItemVideo.getIcon()); |         holder.binding.menuIcon.setImageResource(menuItemVideo.getIcon()); | ||||||
|         holder.binding.title.setText(menuItemVideo.getTitle()); |         holder.binding.title.setText(menuItemVideo.getTitle()); | ||||||
|         holder.binding.itemMenuContainer.setOnClickListener(v -> { |         holder.binding.itemMenuContainer.setOnClickListener(v -> itemClicked.onItemClicked(menuItemVideo.getAction())); | ||||||
|             itemClicked.onItemClicked(menuItemVideo.getAction()); |  | ||||||
|         }); |  | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -131,7 +131,7 @@ public class TimelineVM extends AndroidViewModel { | |||||||
|                     retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, instance, null); |                     retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, instance, null); | ||||||
|                 } |                 } | ||||||
|                 APIResponse apiResponse = retrofitPeertubeAPI.getVideos(videoId, myVideo); |                 APIResponse apiResponse = retrofitPeertubeAPI.getVideos(videoId, myVideo); | ||||||
|                 if (Helper.isLoggedIn(_mContext) && !myVideo && instance == null) { |                 if (Helper.isLoggedIn(_mContext) && instance == null) { | ||||||
|                     if (apiResponse.getPeertubes() != null && apiResponse.getPeertubes().size() > 0 && apiResponse.getPeertubes().get(0) != null) { |                     if (apiResponse.getPeertubes() != null && apiResponse.getPeertubes().size() > 0 && apiResponse.getPeertubes().get(0) != null) { | ||||||
|                         APIResponse response = new RetrofitPeertubeAPI(_mContext).getRating(videoId); |                         APIResponse response = new RetrofitPeertubeAPI(_mContext).getRating(videoId); | ||||||
|                         if (response != null) |                         if (response != null) | ||||||
|   | |||||||
| @@ -5,6 +5,8 @@ | |||||||
|     android:id="@+id/item_menu_container" |     android:id="@+id/item_menu_container" | ||||||
|     android:layout_width="match_parent" |     android:layout_width="match_parent" | ||||||
|     android:layout_marginTop="10dp" |     android:layout_marginTop="10dp" | ||||||
|  |     android:clickable="true" | ||||||
|  |     android:focusable="true" | ||||||
|     android:layout_height="wrap_content"> |     android:layout_height="wrap_content"> | ||||||
|  |  | ||||||
|     <ImageView |     <ImageView | ||||||
|   | |||||||
| @@ -1,10 +1,13 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" |     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||||
|  |     xmlns:tools="http://schemas.android.com/tools" | ||||||
|     android:id="@+id/item_menu_container" |     android:id="@+id/item_menu_container" | ||||||
|     android:layout_width="match_parent" |     android:layout_width="match_parent" | ||||||
|     android:layout_height="wrap_content" |     android:layout_height="wrap_content" | ||||||
|     android:layout_marginTop="10dp"> |     android:layout_marginTop="10dp" | ||||||
|  |     android:clickable="true" | ||||||
|  |     android:focusable="true"> | ||||||
|  |  | ||||||
|     <RadioButton |     <RadioButton | ||||||
|         android:id="@+id/radio" |         android:id="@+id/radio" | ||||||
| @@ -15,6 +18,7 @@ | |||||||
|         app:layout_constraintTop_toTopOf="parent" /> |         app:layout_constraintTop_toTopOf="parent" /> | ||||||
|  |  | ||||||
|     <TextView |     <TextView | ||||||
|  |         android:labelFor="@+id/radio" | ||||||
|         android:id="@+id/title" |         android:id="@+id/title" | ||||||
|         android:layout_width="0dp" |         android:layout_width="0dp" | ||||||
|         android:layout_height="wrap_content" |         android:layout_height="wrap_content" | ||||||
| @@ -23,5 +27,6 @@ | |||||||
|         app:layout_constraintBottom_toBottomOf="parent" |         app:layout_constraintBottom_toBottomOf="parent" | ||||||
|         app:layout_constraintEnd_toEndOf="parent" |         app:layout_constraintEnd_toEndOf="parent" | ||||||
|         app:layout_constraintStart_toEndOf="@+id/radio" |         app:layout_constraintStart_toEndOf="@+id/radio" | ||||||
|         app:layout_constraintTop_toTopOf="parent" /> |         app:layout_constraintTop_toTopOf="parent" | ||||||
|  |         tools:ignore="LabelFor" /> | ||||||
| </androidx.constraintlayout.widget.ConstraintLayout> | </androidx.constraintlayout.widget.ConstraintLayout> | ||||||
		Reference in New Issue
	
	Block a user