1
0
mirror of https://framagit.org/tom79/fedilab-tube synced 2025-06-05 21:09:11 +02:00

8 Commits
1.5.1 ... 1.5.2

30 changed files with 243 additions and 44 deletions

View File

@ -11,8 +11,8 @@ android {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 30
versionCode 20 versionCode 21
versionName "1.5.1" versionName "1.5.2"
multiDexEnabled true multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@ -6,7 +6,16 @@
<string name="set_video_language_choice" translatable="false">set_video_language_choice</string> <string name="set_video_language_choice" translatable="false">set_video_language_choice</string>
<string name="set_video_quality_choice" translatable="false">set_video_quality_choice</string> <string name="set_video_quality_choice" translatable="false">set_video_quality_choice</string>
<string name="set_video_cache_choice" translatable="false">set_video_cache_choice</string> <string name="set_video_cache_choice" translatable="false">set_video_cache_choice</string>
<string name="set_autoplay_choice" translatable="false">set_autoplay_choice</string>
<string name="set_theme_choice" translatable="false">set_theme_choice</string> <string name="set_theme_choice" translatable="false">set_theme_choice</string>
<string name="set_fullscreen_choice" translatable="false">set_fullscreen_choice</string>
<string name="set_autoplay">Lecture automatique</string>
<string name="set_autoplay_description">Si activé, les vidéos seront lues automatiquement</string>
<string name="set_fullscreen">Plein écran</string>
<string name="set_fullscreen_description">Ouvre automatiquement les vidéos en plein écran</string>
<string name="delete_account_comment">Supprimer tous les commentaires</string> <string name="delete_account_comment">Supprimer tous les commentaires</string>
<string name="delete_account_comment_confirm">Etes-vous sûr de vouloir supprimer tous les commentaires de ce compte pour vos vidéos ?</string> <string name="delete_account_comment_confirm">Etes-vous sûr de vouloir supprimer tous les commentaires de ce compte pour vos vidéos ?</string>

View File

@ -1,3 +1,5 @@
- Theme: Clair, Sombre et automatique - Nouvelles options :
- Supprimer tous les commentaires d'un compte sur vos vidéos - Mode plein écran automatique
- Mettre en sourdine un compte depuis les commentaires. - Désactiver la lecture automatique des vidéos
- Quelques corrections de bugs

View File

@ -1 +1,8 @@
- Fix some issues Added:
- Enable/disable auto playback
- Enter in fullscreen automatically (default disabled)
- Back press pauses the video in fullscreen
Fixes:
- Public timelines don't honor muted accounts
- Comments are not removed when switching to a video without comments

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Add a public reply</string> <string name="add_public_reply">Add a public reply</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="zero">%d ردود</item> <item quantity="zero">%d ردود</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Öffentliche Antwort hinzufügen</string> <string name="add_public_reply">Öffentliche Antwort hinzufügen</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="one">%d Antwort</item> <item quantity="one">%d Antwort</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Προσθήκη δημόσιας απάντησης</string> <string name="add_public_reply">Προσθήκη δημόσιας απάντησης</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="one">%d απάντηση</item> <item quantity="one">%d απάντηση</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Añade una respuesta pública</string> <string name="add_public_reply">Añade una respuesta pública</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="one">%d respuesta</item> <item quantity="one">%d respuesta</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Ajouter une réponse publique</string> <string name="add_public_reply">Ajouter une réponse publique</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="one">%d réponse</item> <item quantity="one">%d réponse</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Aggiungere una risposta pubblica</string> <string name="add_public_reply">Aggiungere una risposta pubblica</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="one">%d risposta</item> <item quantity="one">%d risposta</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Add a public reply</string> <string name="add_public_reply">Add a public reply</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="other">%d が返信</item> <item quantity="other">%d が返信</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Add a public reply</string> <string name="add_public_reply">Add a public reply</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="other">답글 %d개</item> <item quantity="other">답글 %d개</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Voeg een openbaar antwoord toe</string> <string name="add_public_reply">Voeg een openbaar antwoord toe</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="one">%d antwoord</item> <item quantity="one">%d antwoord</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Dodaj publiczną odpowiedź</string> <string name="add_public_reply">Dodaj publiczną odpowiedź</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="one">%d odpowiedź</item> <item quantity="one">%d odpowiedź</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Add a public reply</string> <string name="add_public_reply">Add a public reply</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="one">%d resposta</item> <item quantity="one">%d resposta</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Add a public reply</string> <string name="add_public_reply">Add a public reply</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="one">%d răspuns</item> <item quantity="one">%d răspuns</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Добавить публичный ответ</string> <string name="add_public_reply">Добавить публичный ответ</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="one">%d ответ</item> <item quantity="one">%d ответ</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Add a public reply</string> <string name="add_public_reply">Add a public reply</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="one">%d svar</item> <item quantity="one">%d svar</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">添加公开回复</string> <string name="add_public_reply">添加公开回复</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="other">%d 条回复</item> <item quantity="other">%d 条回复</item>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Add a public reply</string> <string name="add_public_reply">Add a public reply</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="other">%d 條回覆</item> <item quantity="other">%d 條回覆</item>

View File

@ -5,10 +5,20 @@
<string name="set_video_language_choice" translatable="false">set_video_language_choice</string> <string name="set_video_language_choice" translatable="false">set_video_language_choice</string>
<string name="set_video_quality_choice" translatable="false">set_video_quality_choice</string> <string name="set_video_quality_choice" translatable="false">set_video_quality_choice</string>
<string name="set_video_cache_choice" translatable="false">set_video_cache_choice</string> <string name="set_video_cache_choice" translatable="false">set_video_cache_choice</string>
<string name="set_autoplay_choice" translatable="false">set_autoplay_choice</string>
<string name="set_theme_choice" translatable="false">set_theme_choice</string> <string name="set_theme_choice" translatable="false">set_theme_choice</string>
<string name="set_fullscreen_choice" translatable="false">set_fullscreen_choice</string>
<string name="set_autoplay">Automatic playback</string>
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
<string name="set_fullscreen">Fullscreen</string>
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
<string name="add_public_reply">Add a public reply</string> <string name="add_public_reply">Add a public reply</string>
<plurals name="number_of_replies"> <plurals name="number_of_replies">
<item quantity="one">%d reply</item> <item quantity="one">%d reply</item>
<item quantity="other">%d replies</item> <item quantity="other">%d replies</item>

View File

@ -41,6 +41,7 @@ import com.kobakei.ratethisapp.RateThisApp;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
@ -246,6 +247,13 @@ public class MainActivity extends AppCompatActivity {
} else { } else {
navView.inflateMenu(R.menu.bottom_nav_menu); navView.inflateMenu(R.menu.bottom_nav_menu);
} }
peertubeInformation = new PeertubeInformation();
peertubeInformation.setCategories(new LinkedHashMap<>());
peertubeInformation.setLanguages(new LinkedHashMap<>());
peertubeInformation.setLicences(new LinkedHashMap<>());
peertubeInformation.setPrivacies(new LinkedHashMap<>());
peertubeInformation.setPlaylistPrivacies(new LinkedHashMap<>());
peertubeInformation.setTranslations(new LinkedHashMap<>());
startInForeground(); startInForeground();
if (BuildConfig.google_restriction && BuildConfig.full_instances) { if (BuildConfig.google_restriction && BuildConfig.full_instances) {

View File

@ -18,6 +18,7 @@ import android.Manifest;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.app.PictureInPictureParams;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -47,6 +48,7 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
@ -145,7 +147,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
private VideoData.Video peertube; private VideoData.Video peertube;
private int mode; private int mode;
private Map<String, List<PlaylistExist>> playlists; private Map<String, List<PlaylistExist>> playlists;
private boolean playInMinimized; private boolean playInMinimized, autoPlay, autoFullscreen;
private boolean onStopCalled; private boolean onStopCalled;
private List<Caption> captions; private List<Caption> captions;
private String max_id; private String max_id;
@ -220,8 +222,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
binding.writeCommentContainer.setVisibility(View.GONE); binding.writeCommentContainer.setVisibility(View.GONE);
} }
playInMinimized = sharedpreferences.getBoolean(getString(R.string.set_video_minimize_choice), true); playInMinimized = sharedpreferences.getBoolean(getString(R.string.set_video_minimize_choice), true);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N autoPlay = sharedpreferences.getBoolean(getString(R.string.set_autoplay_choice), true);
&& !getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) { autoFullscreen = sharedpreferences.getBoolean(getString(R.string.set_fullscreen_choice), false);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O
|| !getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) {
playInMinimized = false; playInMinimized = false;
} }
@ -304,6 +308,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
playVideo(); playVideo();
} }
registBroadcastReceiver(); registBroadcastReceiver();
if( autoFullscreen && autoPlay) {
openFullscreenDialog();
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
} }
@ -382,23 +390,35 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
if (b != null) { if (b != null) {
peertubeInstance = b.getString("peertube_instance", Helper.getLiveInstance(PeertubeActivity.this)); peertubeInstance = b.getString("peertube_instance", Helper.getLiveInstance(PeertubeActivity.this));
videoUuid = b.getString("video_uuid", null); videoUuid = b.getString("video_uuid", null);
if( comments != null && comments.size() > 0) {
int number = comments.size();
comments.clear();
commentListAdapter.notifyItemRangeRemoved(0, number);
}
playVideo(); playVideo();
} }
} }
private void playVideo() { private void playVideo() {
if (player != null) { if (player != null) {
player.setPlayWhenReady(false);
player.release(); player.release();
player = ExoPlayerFactory.newSimpleInstance(PeertubeActivity.this); player = ExoPlayerFactory.newSimpleInstance(PeertubeActivity.this);
binding.mediaVideo.setPlayer(player); binding.mediaVideo.setPlayer(player);
binding.loader.setVisibility(View.GONE); binding.loader.setVisibility(View.GONE);
player.setPlayWhenReady(true); player.setPlayWhenReady(autoPlay);
captions = null; captions = null;
} }
if( autoFullscreen && autoPlay) {
fullscreen = FullScreenMediaController.fullscreen.ON;
setFullscreen(FullScreenMediaController.fullscreen.ON);
fullScreenMode = true;
openFullscreenDialog();
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else {
fullscreen = FullScreenMediaController.fullscreen.OFF; fullscreen = FullScreenMediaController.fullscreen.OFF;
setFullscreen(FullScreenMediaController.fullscreen.OFF); setFullscreen(FullScreenMediaController.fullscreen.OFF);
fullScreenMode = false; fullScreenMode = false;
}
binding.peertubePlaylist.setVisibility(View.VISIBLE); binding.peertubePlaylist.setVisibility(View.VISIBLE);
binding.peertubeBookmark.setVisibility(View.GONE); binding.peertubeBookmark.setVisibility(View.GONE);
@ -547,8 +567,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
binding.writeCommentContainerReply.setVisibility(View.VISIBLE); binding.writeCommentContainerReply.setVisibility(View.VISIBLE);
binding.writeCommentContainer.setVisibility(View.VISIBLE); binding.writeCommentContainer.setVisibility(View.VISIBLE);
} }
binding.peertubeComments.setVisibility(View.VISIBLE);
} else { } else {
binding.peertubeComments.setVisibility(View.GONE);
binding.writeCommentContainerReply.setVisibility(View.GONE); binding.writeCommentContainerReply.setVisibility(View.GONE);
binding.writeCommentContainer.setVisibility(View.GONE); binding.writeCommentContainer.setVisibility(View.GONE);
binding.noActionText.setText(getString(R.string.comment_no_allowed_peertube)); binding.noActionText.setText(getString(R.string.comment_no_allowed_peertube));
@ -648,7 +669,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
.createMediaSource(Uri.parse(apiResponse.getPeertubes().get(0).getStreamingPlaylists().get(0).getPlaylistUrl())); .createMediaSource(Uri.parse(apiResponse.getPeertubes().get(0).getStreamingPlaylists().get(0).getPlaylistUrl()));
player.prepare(hlsMediaSource); player.prepare(hlsMediaSource);
} }
player.setPlayWhenReady(true); player.setPlayWhenReady(autoPlay);
} }
@ -846,7 +867,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
super.onDestroy(); super.onDestroy();
binding = null; binding = null;
if (player != null) { if (player != null) {
player.setPlayWhenReady(false);
player.release(); player.release();
} }
unregisterReceiver(); unregisterReceiver();
@ -905,7 +925,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
} }
private void enterVideoMode() { private void enterVideoMode() {
if (playInMinimized && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && player != null) { if (playInMinimized && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && player != null) {
isPlayInMinimized = true; isPlayInMinimized = true;
MediaSessionCompat mediaSession = new MediaSessionCompat(this, getPackageName()); MediaSessionCompat mediaSession = new MediaSessionCompat(this, getPackageName());
MediaSessionConnector mediaSessionConnector = new MediaSessionConnector(mediaSession); MediaSessionConnector mediaSessionConnector = new MediaSessionConnector(mediaSession);
@ -914,7 +934,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
controlView.hide(); controlView.hide();
binding.mediaVideo.setControllerAutoShow(false); binding.mediaVideo.setControllerAutoShow(false);
mediaSession.setActive(true); mediaSession.setActive(true);
enterPictureInPictureMode(); PictureInPictureParams params = new PictureInPictureParams.Builder().build();
enterPictureInPictureMode(params);
} }
} }
@ -957,7 +978,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
super.onResume(); super.onResume();
onStopCalled = false; onStopCalled = false;
if (player != null && !player.isPlaying()) { if (player != null && !player.isPlaying()) {
player.setPlayWhenReady(true); player.setPlayWhenReady(autoPlay);
} }
} }
@ -1017,8 +1038,15 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
fullScreenDialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen) { fullScreenDialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen) {
public void onBackPressed() { public void onBackPressed() {
if( player != null && player.isPlaying() && fullScreenMode) {
player.setPlayWhenReady(false);
return;
}
if( fullScreenMode) { if( fullScreenMode) {
closeFullscreenDialog(); closeFullscreenDialog();
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Handler handler = new Handler();
handler.postDelayed(() -> setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR), 2000);
} }
super.onBackPressed(); super.onBackPressed();
} }
@ -1167,6 +1195,14 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
} }
}); });
ImageButton playButton = controlView.findViewById(R.id.exo_play);
playButton.setOnClickListener(v->{
if(autoFullscreen && !fullScreenMode) {
openFullscreenDialog();
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
player.setPlayWhenReady(true);
});
} }
private void initResolution() { private void initResolution() {
@ -1210,7 +1246,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
} }
public void manageVIewPlaylists(APIResponse apiResponse) { public void manageVIewPlaylists(APIResponse apiResponse) {
if (apiResponse.getError() != null) { if (apiResponse == null || apiResponse.getError() != null || playlists == null || peertube == null) {
return; return;
} }
if (apiResponse.getPlaylists() != null && apiResponse.getPlaylists().size() > 0) { if (apiResponse.getPlaylists() != null && apiResponse.getPlaylists().size() > 0) {

View File

@ -121,23 +121,23 @@ public interface PeertubeService {
//Overview videos //Overview videos
@GET("overviews/videos") @GET("overviews/videos")
Call<OverviewVideo> getOverviewVideos(@Query("page") String page, @Query("languageOneOf") List<String> languageOneOf); Call<OverviewVideo> getOverviewVideos(@Header("Authorization") String credentials, @Query("page") String page, @Query("languageOneOf") List<String> languageOneOf);
//Most liked videos //Most liked videos
@GET("videos?sort=-likes") @GET("videos?sort=-likes")
Call<VideoData> getMostLikedVideos(@Query("start") String maxId, @Query("count") String count, @Query("languageOneOf") List<String> languageOneOf); Call<VideoData> getMostLikedVideos(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count, @Query("languageOneOf") List<String> languageOneOf);
//Most liked videos //Trending videos
@GET("videos?sort=-trending") @GET("videos?sort=-trending")
Call<VideoData> getTrendingVideos(@Query("start") String maxId, @Query("count") String count, @Query("languageOneOf") List<String> languageOneOf); Call<VideoData> getTrendingVideos(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count, @Query("languageOneOf") List<String> languageOneOf);
//Recently added videos //Recently added videos
@GET("videos?sort=-publishedAt") @GET("videos?sort=-publishedAt")
Call<VideoData> getRecentlyAddedVideos(@Query("start") String maxId, @Query("count") String count, @Query("languageOneOf") List<String> languageOneOf); Call<VideoData> getRecentlyAddedVideos(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count, @Query("languageOneOf") List<String> languageOneOf);
//Local videos //Local videos
@GET("videos?sort=-publishedAt&filter=local") @GET("videos?sort=-publishedAt&filter=local")
Call<VideoData> getLocalVideos(@Query("start") String maxId, @Query("count") String count, @Query("languageOneOf") List<String> languageOneOf); Call<VideoData> getLocalVideos(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count, @Query("languageOneOf") List<String> languageOneOf);
//History //History
@GET("users/me/history/videos") @GET("users/me/history/videos")
@ -145,7 +145,7 @@ public interface PeertubeService {
//Search //Search
@GET("search/videos") @GET("search/videos")
Call<VideoData> searchVideos(@Query("search") String search, @Query("start") String maxId, @Query("count") String count); Call<VideoData> searchVideos(@Header("Authorization") String credentials, @Query("search") String search, @Query("start") String maxId, @Query("count") String count);
//Get notifications //Get notifications
@GET("users/me/notifications") @GET("users/me/notifications")

View File

@ -161,7 +161,11 @@ public class RetrofitPeertubeAPI {
} }
private String getToken() { private String getToken() {
if( token != null) {
return "Bearer " + token; return "Bearer " + token;
}else{
return null;
}
} }
private PeertubeService init() { private PeertubeService init() {
@ -331,19 +335,19 @@ public class RetrofitPeertubeAPI {
} }
break; break;
case MOST_LIKED: case MOST_LIKED:
videoCall = peertubeService.getMostLikedVideos(max_id, count, filter); videoCall = peertubeService.getMostLikedVideos(getToken(), max_id, count, filter);
break; break;
case LOCAL: case LOCAL:
videoCall = peertubeService.getLocalVideos(max_id, count, filter); videoCall = peertubeService.getLocalVideos(getToken(), max_id, count, filter);
break; break;
case TRENDING: case TRENDING:
videoCall = peertubeService.getTrendingVideos(max_id, count, filter); videoCall = peertubeService.getTrendingVideos(getToken(), max_id, count, filter);
break; break;
case HISTORY: case HISTORY:
videoCall = peertubeService.getHistory(getToken(), max_id, count); videoCall = peertubeService.getHistory(getToken(), max_id, count);
break; break;
case RECENT: case RECENT:
videoCall = peertubeService.getRecentlyAddedVideos(max_id, count, filter); videoCall = peertubeService.getRecentlyAddedVideos(getToken(), max_id, count, filter);
break; break;
} }
if (videoCall != null) { if (videoCall != null) {
@ -374,7 +378,7 @@ public class RetrofitPeertubeAPI {
APIResponse apiResponse = new APIResponse(); APIResponse apiResponse = new APIResponse();
PeertubeService peertubeService = init(); PeertubeService peertubeService = init();
ArrayList<String> filter = selection != null ? new ArrayList<>(selection) : null; ArrayList<String> filter = selection != null ? new ArrayList<>(selection) : null;
Call<OverviewVideo> overviewVideoCall = peertubeService.getOverviewVideos(page, filter); Call<OverviewVideo> overviewVideoCall = peertubeService.getOverviewVideos(getToken(), page, filter);
try { try {
Response<OverviewVideo> response = overviewVideoCall.execute(); Response<OverviewVideo> response = overviewVideoCall.execute();
if (response.isSuccessful() && response.body() != null) { if (response.isSuccessful() && response.body() != null) {
@ -647,7 +651,7 @@ public class RetrofitPeertubeAPI {
*/ */
public APIResponse searchPeertube(String query, String max_id) { public APIResponse searchPeertube(String query, String max_id) {
PeertubeService peertubeService = init(); PeertubeService peertubeService = init();
Call<VideoData> searchVideosCall = peertubeService.searchVideos(query, max_id, count); Call<VideoData> searchVideosCall = peertubeService.searchVideos(getToken(), query, max_id, count);
APIResponse apiResponse = new APIResponse(); APIResponse apiResponse = new APIResponse();
try { try {
Response<VideoData> response = searchVideosCall.execute(); Response<VideoData> response = searchVideosCall.execute();

View File

@ -137,6 +137,16 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
assert set_video_minimize_choice != null; assert set_video_minimize_choice != null;
editor.putBoolean(getString(R.string.set_video_minimize_choice), set_video_minimize_choice.isChecked()); editor.putBoolean(getString(R.string.set_video_minimize_choice), set_video_minimize_choice.isChecked());
} }
if (key.compareTo(getString(R.string.set_autoplay_choice)) == 0) {
SwitchPreference set_autoplay_choice = findPreference(getString(R.string.set_autoplay_choice));
assert set_autoplay_choice != null;
editor.putBoolean(getString(R.string.set_autoplay_choice), set_autoplay_choice.isChecked());
}
if (key.compareTo(getString(R.string.set_fullscreen_choice)) == 0) {
SwitchPreference set_fullscreen_choice = findPreference(getString(R.string.set_fullscreen_choice));
assert set_fullscreen_choice != null;
editor.putBoolean(getString(R.string.set_fullscreen_choice), set_fullscreen_choice.isChecked());
}
if (key.compareTo(getString(R.string.set_video_language_choice)) == 0) { if (key.compareTo(getString(R.string.set_video_language_choice)) == 0) {
MultiSelectListPreference set_video_language_choice = findPreference(getString(R.string.set_video_language_choice)); MultiSelectListPreference set_video_language_choice = findPreference(getString(R.string.set_video_language_choice));
assert set_video_language_choice != null; assert set_video_language_choice != null;
@ -208,12 +218,27 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
assert set_video_cache_choice != null; assert set_video_cache_choice != null;
set_video_cache_choice.setValue(video_cache / 10); set_video_cache_choice.setValue(video_cache / 10);
//****** Minimized videos *******
boolean minimized = sharedpref.getBoolean(getString(R.string.set_video_minimize_choice), true); boolean minimized = sharedpref.getBoolean(getString(R.string.set_video_minimize_choice), true);
SwitchPreference set_video_minimize_choice = findPreference(getString(R.string.set_video_minimize_choice)); SwitchPreference set_video_minimize_choice = findPreference(getString(R.string.set_video_minimize_choice));
assert set_video_minimize_choice != null; assert set_video_minimize_choice != null;
set_video_minimize_choice.setChecked(minimized); set_video_minimize_choice.setChecked(minimized);
//****** Autoplay videos *******
boolean autoplay = sharedpref.getBoolean(getString(R.string.set_autoplay_choice), true);
SwitchPreference set_autoplay_choice = findPreference(getString(R.string.set_autoplay_choice));
assert set_autoplay_choice != null;
set_autoplay_choice.setChecked(autoplay);
//****** Fullscreen videos *******
boolean fullscreen = sharedpref.getBoolean(getString(R.string.set_fullscreen_choice), false);
SwitchPreference set_fullscreen_choice = findPreference(getString(R.string.set_fullscreen_choice));
assert set_fullscreen_choice != null;
set_fullscreen_choice.setChecked(fullscreen);
//****** Language filter *********
LinkedHashMap<String, String> languages = new LinkedHashMap<>(peertubeInformation.getLanguages()); LinkedHashMap<String, String> languages = new LinkedHashMap<>(peertubeInformation.getLanguages());
List<CharSequence> entriesLanguages = new ArrayList<>(); List<CharSequence> entriesLanguages = new ArrayList<>();
List<CharSequence> valuesLanguages = new ArrayList<>(); List<CharSequence> valuesLanguages = new ArrayList<>();

View File

@ -127,6 +127,7 @@ public class RetrieveInfoService extends Service implements NetworkStateReceiver
@Override @Override
public void run() { public void run() {
EmojiHelper.fillMapEmoji(getApplicationContext()); EmojiHelper.fillMapEmoji(getApplicationContext());
if( peertubeInformation == null || peertubeInformation.getCategories().size() == 0) {
peertubeInformation = new PeertubeInformation(); peertubeInformation = new PeertubeInformation();
peertubeInformation.setCategories(new LinkedHashMap<>()); peertubeInformation.setCategories(new LinkedHashMap<>());
peertubeInformation.setLanguages(new LinkedHashMap<>()); peertubeInformation.setLanguages(new LinkedHashMap<>());
@ -135,6 +136,7 @@ public class RetrieveInfoService extends Service implements NetworkStateReceiver
peertubeInformation.setPlaylistPrivacies(new LinkedHashMap<>()); peertubeInformation.setPlaylistPrivacies(new LinkedHashMap<>());
peertubeInformation.setTranslations(new LinkedHashMap<>()); peertubeInformation.setTranslations(new LinkedHashMap<>());
peertubeInformation = new RetrofitPeertubeAPI(RetrieveInfoService.this).getPeertubeInformation(); peertubeInformation = new RetrofitPeertubeAPI(RetrieveInfoService.this).getPeertubeInformation();
}
stopForeground(true); stopForeground(true);
} }
}; };

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M21,11l0,-8l-8,0l3.29,3.29l-10,10l-3.29,-3.29l0,8l8,0l-3.29,-3.29l10,-10z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M8,5v14l11,-7z"/>
</vector>

View File

@ -21,6 +21,18 @@
android:summary="@string/set_video_quality_description" android:summary="@string/set_video_quality_description"
android:title="@string/set_quality_mode" /> android:title="@string/set_quality_mode" />
<androidx.preference.SwitchPreference
android:icon="@drawable/ic_baseline_play_arrow_24"
android:key="@string/set_autoplay_choice"
android:summary="@string/set_autoplay_description"
android:title="@string/set_autoplay" />
<androidx.preference.SwitchPreference
android:icon="@drawable/ic_baseline_open_in_full_24"
android:key="@string/set_fullscreen_choice"
android:summary="@string/set_fullscreen_description"
android:title="@string/set_fullscreen" />
<androidx.preference.SeekBarPreference <androidx.preference.SeekBarPreference
android:icon="@drawable/ic_baseline_storage_24" android:icon="@drawable/ic_baseline_storage_24"
android:defaultValue="10" android:defaultValue="10"