Merge branch 'develop' of https://framagit.org/tom79/fedilab-tube into develop

 Conflicts:
	app/build.gradle
This commit is contained in:
Thomas 2020-10-06 15:30:53 +02:00
commit 5ff06a29d2
90 changed files with 349 additions and 461 deletions

View File

@ -116,7 +116,7 @@ dependencies {
implementation "net.gotev:uploadservice-okhttp:3.5.2"
implementation "com.google.code.gson:gson:2.8.6"
implementation 'androidx.media:media:1.2.0'
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

View File

@ -199,7 +199,7 @@
</string-array>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_cache_description">Définir le cache pour les vidéos (défaut 100Mo)</string>
<string name="video_cache_value">Cache pour les vidéos: %d Mo</string>
<string name="set_video_mode_choice" translatable="false">set_video_mode_choice</string>
<string name="set_video_minimize_choice" translatable="false">set_video_minimize_choice</string>

View File

@ -15,4 +15,7 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="progress" parent="SpinKitView.Circle" />
<style name="progressBottom" parent="SpinKitView.ThreeBounce" />
</resources>

View File

@ -1,4 +1,4 @@
- Force le mode paysage lors du passage en mode plein écran
- Modifier la valeur du cache pour les vidéos
- Définir la résolution pour les vidéos
- Définir la résolution par défaut pour les vidéos
- Correction de bugs

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Home</string>
<string name="title_local">Local</string>
<string name="title_discover">Discover</string>
<string name="title_notifications">Notifications</string>
<string name="title_recently_added">Recently added</string>
@ -103,8 +104,13 @@
<string name="change_instance">Pick another instance</string>
<string name="my_history">History</string>
<string name="edit">Edit</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Captions</string>
<string name="pickup_captions">Pick captions</string>
<string name="none">None</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Startseite</string>
<string name="title_local">Local</string>
<string name="title_discover">Mehr erfahren</string>
<string name="title_notifications">Benachrichtigungen</string>
<string name="title_recently_added">Zuletzt hinzugefügt</string>
@ -103,8 +104,13 @@
<string name="change_instance">Wähle eine andere Instanz</string>
<string name="my_history">Verlauf</string>
<string name="edit">Bearbeiten</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Untertitel</string>
<string name="pickup_captions">Untertitel abholen</string>
<string name="none">Keine</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Αρχική</string>
<string name="title_local">Local</string>
<string name="title_discover">Ανακαλύψτε</string>
<string name="title_notifications">Ειδοποιήσεις</string>
<string name="title_recently_added">Προστέθηκαν πρόσφατα</string>
@ -103,8 +104,13 @@
<string name="change_instance">Επιλογή άλλης υπόστασης</string>
<string name="my_history">Ιστορικό</string>
<string name="edit">Επεξεργασία</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Υπότιτλοι</string>
<string name="pickup_captions">Επιλογή υποτίτλων</string>
<string name="none">Κανένας</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Inicio</string>
<string name="title_local">Local</string>
<string name="title_discover">Descubre</string>
<string name="title_notifications">Notificaciones</string>
<string name="title_recently_added">Añadido recientemente</string>
@ -103,8 +104,13 @@
<string name="change_instance">Selecciona otra instancia</string>
<string name="my_history">Historia</string>
<string name="edit">Editar</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Subtítulos</string>
<string name="pickup_captions">Pies de foto de la camioneta</string>
<string name="none">Ninguno</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Locale</string>
<string name="title_local">Local</string>
<string name="title_discover">Découvrir</string>
<string name="title_notifications">Notifications</string>
<string name="title_recently_added">Nouveautés</string>
@ -16,7 +17,7 @@
<string name="instance_choice">Choisissez une instance</string>
<string name="not_valide_instance">Cette instance ne semble pas être valide !</string>
<string name="no_videos">Aucune vidéo !</string>
<string name="no_notifications">No notifications!</string>
<string name="no_notifications">Aucune notification !</string>
<string name="favicon">Favicon</string>
<string name="open_with">Ouvrir avec</string>
<string name="action_playlist_edit">Modifier une liste de lecture</string>
@ -103,8 +104,13 @@
<string name="change_instance">Changer d\'instance</string>
<string name="my_history">Historique</string>
<string name="edit">Modifier</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Légendes</string>
<string name="pickup_captions">Options d\'envoi</string>
<string name="none">Aucune</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Inizio</string>
<string name="title_local">Local</string>
<string name="title_discover">Esplora</string>
<string name="title_notifications">Notifiche</string>
<string name="title_recently_added">Aggiunti di recente</string>
@ -103,8 +104,13 @@
<string name="change_instance">Prendi un\'altra istanza</string>
<string name="my_history">Cronologia</string>
<string name="edit">Modifica</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Didascalie</string>
<string name="pickup_captions">Scegliere le didascalie</string>
<string name="none">Nessuno</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">ホーム</string>
<string name="title_local">Local</string>
<string name="title_discover">発見</string>
<string name="title_notifications">通知</string>
<string name="title_recently_added">最近追加された項目</string>
@ -103,8 +104,13 @@
<string name="change_instance">Pick another instance</string>
<string name="my_history">履歴</string>
<string name="edit">編集</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">字幕</string>
<string name="pickup_captions">字幕を選択</string>
<string name="none">なし</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Home</string>
<string name="title_local">Local</string>
<string name="title_discover">Discover</string>
<string name="title_notifications">Notifications</string>
<string name="title_recently_added">Recently added</string>
@ -103,8 +104,13 @@
<string name="change_instance">Pick another instance</string>
<string name="my_history">History</string>
<string name="edit">Edit</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Captions</string>
<string name="pickup_captions">Pick captions</string>
<string name="none">None</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Home</string>
<string name="title_local">Local</string>
<string name="title_discover">Ontdek</string>
<string name="title_notifications">Meldingen</string>
<string name="title_recently_added">Onlangs toegevoegd</string>
@ -103,8 +104,13 @@
<string name="change_instance">Kies een andere instantie</string>
<string name="my_history">Geschiedenis</string>
<string name="edit">Bewerk</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Bijschriften</string>
<string name="pickup_captions">Pick captions</string>
<string name="none">Geen</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Strona główna</string>
<string name="title_local">Local</string>
<string name="title_discover">Odkryj</string>
<string name="title_notifications">Powiadomienia</string>
<string name="title_recently_added">Ostatnio dodany</string>
@ -103,8 +104,13 @@
<string name="change_instance">Wybierz inny przypadek</string>
<string name="my_history">Historia</string>
<string name="edit">Edycja</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Podpisy</string>
<string name="pickup_captions">Wybierz podpisy</string>
<string name="none">Brak</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Home</string>
<string name="title_local">Local</string>
<string name="title_discover">Discover</string>
<string name="title_notifications">Notifications</string>
<string name="title_recently_added">Recently added</string>
@ -103,8 +104,13 @@
<string name="change_instance">Pick another instance</string>
<string name="my_history">History</string>
<string name="edit">Edit</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Captions</string>
<string name="pickup_captions">Pick captions</string>
<string name="none">None</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Home</string>
<string name="title_local">Local</string>
<string name="title_discover">Discover</string>
<string name="title_notifications">Notifications</string>
<string name="title_recently_added">Recently added</string>
@ -103,8 +104,13 @@
<string name="change_instance">Pick another instance</string>
<string name="my_history">History</string>
<string name="edit">Edit</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Captions</string>
<string name="pickup_captions">Pick captions</string>
<string name="none">None</string>

View File

@ -1,15 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Главная страница</string>
<string name="title_home">Главная</string>
<string name="title_local">Локальные</string>
<string name="title_discover">Подборка</string>
<string name="title_notifications">Уведомления</string>
<string name="title_recently_added">Недавно добавленные</string>
<string name="title_recently_added">По добавлению</string>
<string name="title_trending">Популярные</string>
<string name="title_most_liked">Много лайков</string>
<string name="toast_error">Упс! Произошла ошибка!</string>
<string name="title_muted">Беззвучный</string>
<string name="title_channel">Каналы</string>
<string name="do_not_list">Не показывать</string>
<string name="do_not_list">Скрыто</string>
<string name="blur">Размыть</string>
<string name="display">Показать</string>
<string name="no_opinion">Не выбрано</string>
@ -22,7 +23,7 @@
<string name="action_playlist_edit">Редактировать плейлист</string>
<string name="close">Закрыть</string>
<string name="upload_video">Загрузить</string>
<string name="image_preview">Предпросмотр</string>
<string name="image_preview">Предпросмотр изображения</string>
<string name="file_to_upload">Выберите файл для загрузки</string>
<string name="channel">Канал</string>
<string name="videos">Видео</string>
@ -33,11 +34,11 @@
<string name="download">Скачать</string>
<string name="profile_picture">Изображение профиля</string>
<string name="update_video">Обновить видео</string>
<string name="date_seconds">%d с</string>
<string name="date_minutes">%d м</string>
<string name="date_hours">%d ч</string>
<string name="date_day">%d д</string>
<string name="number_view_video">%s просмотров</string>
<string name="date_seconds">%d сек.</string>
<string name="date_minutes">%d мин.</string>
<string name="date_hours">%d час.</string>
<string name="date_day">%d д.</string>
<string name="number_view_video">Просмотры: %s</string>
<string name="title_instance_login">Хост экземпляра</string>
<string name="uploading">Загрузка, пожалуйста, подождите…</string>
<string name="upload_video_success">Видео было загружено!</string>
@ -103,12 +104,17 @@
<string name="change_instance">Выберите другой экземпляр</string>
<string name="my_history">История</string>
<string name="edit">Редактировать</string>
<string name="video_settings">Настройки видео</string>
<string name="app_interface">Интерфейс</string>
<string name="set_cache_mode">Кэш</string>
<string name="set_video_cache_description">Определите кеш для видео (по умолчанию 100 Мб)</string>
<string name="set_video_quality_description">Определить качество видео по умолчанию</string>
<string name="set_quality_mode">Разрешение для видео</string>
<string name="video_cache_value">Видео кэш: %d Мб</string>
<string name="captions">Субтитры</string>
<string name="pickup_captions">Выбрать субтитры</string>
<string name="none">Ничто</string>
<string name="set_video_mode_description">Позволяет изменить режим воспроизведения видео (по умолчанию, потоковой или через браузер).</string>
<string name="set_video_mode_description">Позволяет изменить режим воспроизведения видео (по умолчанию потоковый или через браузер).</string>
<string name="delete_video">Удалить видео</string>
<string name="delete_video_confirmation">Вы уверены, что хотите удалить это видео?</string>
<string name="no_video_to_display">Нет видео для отображения!</string>
@ -120,8 +126,8 @@
<string name="peertube_video_import_success"><![CDATA[Ваше видео <b>%1$s</b> успешно импортировано]]></string>
<string name="peertube_video_import_error"><![CDATA[При импорте вашего видео <b>%1$s</b> произошла ошибка]]></string>
<string name="peertube_video_from_subscription"><![CDATA[<b>%1$s</b> опубликовал новое видео: <b>%2$s</b>]]></string>
<string name="peertube_video_blacklist"><![CDATA[Ваше видео <b>%1$s</b> занесено в черный список]]></string>
<string name="peertube_video_unblacklist"><![CDATA[Ваше видео <b>%1$s</b> удалено из черного списка]]></string>
<string name="peertube_video_blacklist"><![CDATA[Ваше видео <b>%1$s</b> занесено в чёрный список]]></string>
<string name="peertube_video_unblacklist"><![CDATA[Ваше видео <b>%1$s</b> удалено из чёрного списка]]></string>
<string name="peertube_video_abuse"><![CDATA[Новый отчёт о нарушении для видео: <b>%1$s</b>]]></string>
<string name="add_public_comment">Добавить публичный комментарий</string>
<string name="send_comment">Оставить комментарий</string>
@ -201,17 +207,17 @@
<string name="pickup_instance">Выбрать этот экземпляр</string>
<string name="sensitive_video"> Неприличные видео</string>
<string name="sensitive_content">Неприличный контент: %1$s</string>
<string name="followers_instance">%1$s подписчиков у экземпляра</string>
<string name="followers_instance">Подписчиков у экземпляра: %1$s</string>
<string name="help">Помощь</string>
<string name="pickup_categories">Выбрать категории</string>
<string name="pickup_languages">Выбрать языки</string>
<string name="notification_channel_name">Информация об обновлении</string>
<string name="notification_channel_name">Обновить данные</string>
<string name="add_account">Добавление аккаунта</string>
<string name="list_of_accounts">Список аккаунтов</string>
<string name="pause">Пауза</string>
<string name="play">Воспроизвести</string>
<string name="minimize">Свернуть</string>
<string name="fast_rewind">Быстрое перемотка</string>
<string name="fast_rewind">Быстрая перемотка</string>
<string name="fast_forward">Перемотка вперед</string>
<string name="set_video_minimize">Вид свёрнутого видео</string>
<string name="set_video_minimize_description">Уменьшить размер видео, когда приложение находится в фоновом режиме (Android N+)</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Home</string>
<string name="title_local">Local</string>
<string name="title_discover">Discover</string>
<string name="title_notifications">Notifications</string>
<string name="title_recently_added">Recently added</string>
@ -103,8 +104,13 @@
<string name="change_instance">Pick another instance</string>
<string name="my_history">History</string>
<string name="edit">Edit</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Captions</string>
<string name="pickup_captions">Pick captions</string>
<string name="none">None</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Home</string>
<string name="title_local">Local</string>
<string name="title_discover">Discover</string>
<string name="title_notifications">Notifications</string>
<string name="title_recently_added">Recently added</string>
@ -103,8 +104,13 @@
<string name="change_instance">Pick another instance</string>
<string name="my_history">History</string>
<string name="edit">Edit</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Captions</string>
<string name="pickup_captions">Pick captions</string>
<string name="none">None</string>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="title_home">Home</string>
<string name="title_local">Local</string>
<string name="title_discover">Discover</string>
<string name="title_notifications">Notifications</string>
<string name="title_recently_added">Recently added</string>
@ -103,8 +104,13 @@
<string name="change_instance">Pick another instance</string>
<string name="my_history">History</string>
<string name="edit">Edit</string>
<string name="video_settings">Video settings</string>
<string name="app_interface">Interface</string>
<string name="set_cache_mode">Cache</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>
<string name="captions">Captions</string>
<string name="pickup_captions">Pick captions</string>
<string name="none">None</string>

View File

@ -145,7 +145,7 @@
<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_cache_mode">Cache</string>
<string name="set_video_cache_description">Définir le cache pour les vidéos (défaut 100Mo)</string>
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
<string name="set_video_quality_description">Define a default quality for videos</string>
<string name="set_quality_mode">Resolution for videos</string>
<string name="video_cache_value">Video cache: %d Mb</string>

View File

@ -14,4 +14,8 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark_full</item>
<item name="colorAccent">@color/colorAccent_full</item>
</style>
<style name="progress" parent="SpinKitView.Circle" />
<style name="progressBottom" parent="SpinKitView.ThreeBounce" />
</resources>

View File

@ -215,7 +215,7 @@ public class AccountActivity extends AppCompatActivity {
AlertDialog.Builder builderSingle = new AlertDialog.Builder(AccountActivity.this);
builderSingle.setTitle(getString(R.string.list_of_accounts));
if( accounts != null) {
if (accounts != null) {
final OwnAccountsAdapter accountsListAdapter = new OwnAccountsAdapter(AccountActivity.this, accounts);
final Account[] accountArray = new Account[accounts.size()];
int i = 0;

View File

@ -354,7 +354,7 @@ public class AllPlaylistsActivity extends AppCompatActivity {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
idChannel = channelId[position];
if( position > 0 ) {
if (position > 0) {
selectedChannel = myChannels.get(position - 1);
}
}

View File

@ -98,12 +98,12 @@ public class MainActivity extends AppCompatActivity {
new Thread(() -> {
try {
Token token = new RetrofitPeertubeAPI(MainActivity.this).manageToken(oauthParams);
if( token == null) {
if (token == null) {
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, account));
return;
}
UserMe userMe = new RetrofitPeertubeAPI(MainActivity.this, instance, token.getAccess_token()).verifyCredentials();
if( userMe != null && userMe.getAccount() != null) {
if (userMe != null && userMe.getAccount() != null) {
new AccountDAO(MainActivity.this, db).updateAccount(userMe.getAccount());
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Helper.PREF_KEY_ID, account.getId());
@ -113,7 +113,7 @@ public class MainActivity extends AppCompatActivity {
Set<String> videoLanguageServerSet = new TreeSet<>(videoLanguageServer);
videoLanguageServerSet.addAll(videoLanguageServer);
Set<String> videoLanguageLocal = sharedpreferences.getStringSet(getString(R.string.set_video_language_choice), null);
if( videoLanguageServerSet.size() > 0 && videoLanguageLocal != null) {
if (videoLanguageServerSet.size() > 0 && videoLanguageLocal != null) {
videoLanguageServer.addAll(videoLanguageLocal);
}
editor.putStringSet(getString(R.string.set_video_language_choice), videoLanguageServerSet);

View File

@ -86,7 +86,9 @@ import com.google.android.exoplayer2.util.Util;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import app.fedilab.fedilabtube.client.APIResponse;
@ -154,7 +156,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
private List<Caption> captions;
private TextView no_action_text;
private String max_id;
private RecyclerView lv_comments;
private RecyclerView lv_comments;
private boolean flag_loading;
private List<Comment> comments;
@ -197,7 +199,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
if( Helper.isLoggedIn(PeertubeActivity.this)) {
if (Helper.isLoggedIn(PeertubeActivity.this)) {
Account account = new AccountDAO(PeertubeActivity.this, db).getAccountByToken(token);
Helper.loadGiF(PeertubeActivity.this, account.getAvatar() != null ? account.getAvatar().getPath() : null, my_pp);
}
@ -255,7 +257,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
getWindow().setAttributes(attrs);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
peertube_information_container.setVisibility(View.GONE);
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else {
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
@ -303,7 +305,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
if (firstVisibleItem + visibleItemCount == totalItemCount) {
if (!flag_loading) {
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
commentViewModel.getThread(videoId, max_id).observe(PeertubeActivity.this, apiresponse ->manageVIewComment(apiresponse));
commentViewModel.getThread(videoId, max_id).observe(PeertubeActivity.this, apiresponse -> manageVIewComment(apiresponse));
}
}
}
@ -363,11 +365,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
peertube_playlist.setVisibility(View.VISIBLE);
peertube_bookmark.setVisibility(View.GONE);
List<String> videoIds = new ArrayList<>();
videoIds.add(videoId);
if (Helper.isLoggedIn(PeertubeActivity.this)) {
playlistsViewModel.videoExists(videoIds).observe(PeertubeActivity.this, this::manageVIewVideosExist);
}
TimelineVM feedsViewModel = new ViewModelProvider(PeertubeActivity.this).get(TimelineVM.class);
feedsViewModel.getVideo(videoId).observe(PeertubeActivity.this, this::manageVIewVideo);
CaptionsVM captionsViewModel = new ViewModelProvider(PeertubeActivity.this).get(CaptionsVM.class);
@ -513,7 +510,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
peertube = apiResponse.getPeertubes().get(0);
add_comment_read.setOnClickListener(v -> {
if (isLoggedIn(PeertubeActivity.this)) {
add_comment_read.setVisibility(View.GONE);
@ -545,7 +541,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
peertube_playlist.setOnClickListener(v -> {
if (playlists != null && peertube.getId() != null) {
if (playlists != null && videoId != null) {
PopupMenu popup = new PopupMenu(PeertubeActivity.this, peertube_playlist);
for (Playlist playlist : playlists) {
@ -586,7 +582,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
playlistForVideo.remove(playlist.getId());
} else {
item1.setTitle("" + playlist.getDisplayName());
playlistsViewModel.manage(PlaylistsVM.action.ADD_VIDEOS, playlist, peertube.getId()).observe(PeertubeActivity.this, apiResponse3 -> manageVIewPlaylists(PlaylistsVM.action.ADD_VIDEOS, apiResponse3));
playlistsViewModel.manage(PlaylistsVM.action.ADD_VIDEOS, playlist, videoId).observe(PeertubeActivity.this, apiResponse3 -> manageVIewPlaylists(PlaylistsVM.action.ADD_VIDEOS, apiResponse3));
playlistForVideo.add(playlist.getId());
}
return false;
@ -846,7 +842,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
}
@Override
public void onDestroy() {
super.onDestroy();
@ -931,7 +926,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
final ArrayAdapter<String> 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) {
if (file.getResolutions().getLabel().compareTo("0p") != 0) {
arrayAdapter.add(file.getResolutions().getLabel());
}
}
@ -1026,10 +1021,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
fullScreenButton.setOnClickListener(v -> {
if (!fullScreenMode) {
openFullscreenDialog();
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else {
closeFullscreenDialog();
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Handler handler = new Handler();
handler.postDelayed(() -> setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR), 2000);
@ -1074,19 +1069,23 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
}
public void manageVIewPlaylists(PlaylistsVM.action actionType, APIResponse apiResponse) {
if (actionType == GET_PLAYLISTS && apiResponse != null) {
playlists = apiResponse.getPlaylists();
playlistsViewModel.videoExists(videoId).observe(PeertubeActivity.this, this::manageVIewVideosExist);
}
}
public void manageVIewVideosExist(APIResponse apiResponse) {
playlistForVideo = new ArrayList<>();
if( apiResponse.getError() == null && apiResponse.getVideoExistPlaylist() != null) {
List<PlaylistExist.VideoId> videoIds = apiResponse.getVideoExistPlaylist();
for(PlaylistExist.VideoId videoId: videoIds) {
playlistForVideo.add(videoId.getPlaylistId());
if (apiResponse.getError() == null && apiResponse.getVideoExistPlaylist() != null) {
Map<String, List<PlaylistExist>> videoIds = apiResponse.getVideoExistPlaylist();
Iterator<Map.Entry<String, List<PlaylistExist>>> it = videoIds.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, List<PlaylistExist>> pair = it.next();
List<PlaylistExist> playlistExistVideo = pair.getValue();
for (PlaylistExist playlistExist : playlistExistVideo) {
playlistForVideo.add(playlistExist.getPlaylistId());
}
it.remove();
}
}
}

View File

@ -671,7 +671,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
set_upload_submit.setEnabled(true);
}
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public void manageVIewPostActions(RetrofitPeertubeAPI.ActionType statusAction, APIResponse apiResponse) {
Intent intent = new Intent(PeertubeEditUploadActivity.this, MainActivity.class);
intent.putExtra(Helper.INTENT_ACTION, Helper.RELOAD_MYVIDEOS);

View File

@ -29,7 +29,7 @@ import app.fedilab.fedilabtube.client.data.VideoData;
import app.fedilab.fedilabtube.client.data.VideoPlaylistData.VideoPlaylist;
import app.fedilab.fedilabtube.client.entities.Error;
import app.fedilab.fedilabtube.client.entities.OverviewVideo;
import app.fedilab.fedilabtube.client.entities.PlaylistExist.VideoId;
import app.fedilab.fedilabtube.client.entities.PlaylistExist;
import app.fedilab.fedilabtube.client.entities.Rating;
@SuppressWarnings({"unused", "RedundantSuppression"})
@ -41,7 +41,7 @@ public class APIResponse {
private String actionReturn = null;
private Rating rating;
private OverviewVideo overviewVideo = null;
private List<VideoId> videoExistPlaylist = null;
private Map<String, List<PlaylistExist>> videoExistPlaylist = null;
private List<VideoData.Video> peertubes = null;
private List<CommentData.Comment> comments = null;
private List<Block> muted;
@ -240,11 +240,11 @@ public class APIResponse {
this.videoPlaylist = videoPlaylist;
}
public List<VideoId> getVideoExistPlaylist() {
public Map<String, List<PlaylistExist>> getVideoExistPlaylist() {
return videoExistPlaylist;
}
public void setVideoExistPlaylist(List<VideoId> videoExistPlaylist) {
public void setVideoExistPlaylist(Map<String, List<PlaylistExist>> videoExistPlaylist) {
this.videoExistPlaylist = videoExistPlaylist;
}
}

View File

@ -55,7 +55,7 @@ import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
@SuppressWarnings({"unused", "RedundantSuppression"})
public interface PeertubeService {
@GET("instances")
Call<InstanceData> getInstances(@QueryMap Map<String, String> params, @Query("nsfwPolicy[]") String nsfwPolicy, @Query("categoriesOr[]") List<Integer> categories, @Query("languagesOr[]") List<String> languages);
@ -238,7 +238,7 @@ public interface PeertubeService {
Call<VideoPlaylistData> getVideosPlayList(@Header("Authorization") String credentials, @Path("id") String id);
@GET("users/me/video-playlists/videos-exist")
Call<PlaylistExist> getVideoExistsInPlaylist(@Header("Authorization") String credentials, @Query("videoIds") List<String> videoIds);
Call<Map<String, List<PlaylistExist>>> getVideoExistsInPlaylist(@Header("Authorization") String credentials, @Query("videoIds") String videoIds);
@Multipart
@POST("video-playlists")
@ -264,7 +264,7 @@ public interface PeertubeService {
@FormUrlEncoded
@POST("video-playlists/{id}/videos")
Call<String> addVideoInPlaylist(@Header("Authorization") String credentials, @Path("id") String id, @Field("videoId") String videoId);
Call<VideoPlaylistData.PlaylistElement> addVideoInPlaylist(@Header("Authorization") String credentials, @Path("id") String id, @Field("videoId") String videoId);
@DELETE("video-playlists/{id}")

View File

@ -78,6 +78,7 @@ import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class RetrofitPeertubeAPI {
private String finalUrl;
@ -1080,14 +1081,14 @@ public class RetrofitPeertubeAPI {
* @param videoIds List<String> ids of videos
* @return APIResponse
*/
public APIResponse getVideosExist(List<String> videoIds) {
public APIResponse getVideosExist(String videoIds) {
PeertubeService peertubeService = init();
APIResponse apiResponse = new APIResponse();
try {
Call<PlaylistExist> videoExistsInPlaylist = peertubeService.getVideoExistsInPlaylist(getToken(), videoIds);
Response<PlaylistExist> response = videoExistsInPlaylist.execute();
Call<Map<String, List<PlaylistExist>>> videoExistsInPlaylist = peertubeService.getVideoExistsInPlaylist(getToken(), videoIds);
Response<Map<String, List<PlaylistExist>>> response = videoExistsInPlaylist.execute();
if (response.isSuccessful() && response.body() != null) {
apiResponse.setVideoExistPlaylist(response.body().getVideoId());
apiResponse.setVideoExistPlaylist(response.body());
} else {
setError(apiResponse, response.code(), response.errorBody());
}
@ -1131,7 +1132,7 @@ public class RetrofitPeertubeAPI {
} else {
setError(apiResponse, response.code(), response.errorBody());
}
} else if (type == PlaylistsVM.action.GET_LIST_VIDEOS) {
} else if (type == PlaylistsVM.action.GET_LIST_VIDEOS) {
Call<VideoPlaylistData> videosPlayList = peertubeService.getVideosPlayList(getToken(), playlistId);
Response<VideoPlaylistData> response = videosPlayList.execute();
if (response.isSuccessful() && response.body() != null) {
@ -1148,10 +1149,10 @@ public class RetrofitPeertubeAPI {
setError(apiResponse, response.code(), response.errorBody());
}
} else if (type == PlaylistsVM.action.ADD_VIDEOS) {
Call<String> stringCall = peertubeService.addVideoInPlaylist(getToken(), playlistId, videoId);
Response<String> response = stringCall.execute();
if (response.isSuccessful()) {
apiResponse.setActionReturn(response.body());
Call<VideoPlaylistData.PlaylistElement> stringCall = peertubeService.addVideoInPlaylist(getToken(), playlistId, videoId);
Response<VideoPlaylistData.PlaylistElement> response = stringCall.execute();
if (response.isSuccessful() && response.body() != null) {
apiResponse.setActionReturn(response.body().getVideoPlaylistElement().getId());
} else {
setError(apiResponse, response.code(), response.errorBody());
}

View File

@ -25,7 +25,7 @@ import java.util.List;
import app.fedilab.fedilabtube.client.entities.Avatar;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class AccountData {
@SerializedName("total")

View File

@ -19,6 +19,7 @@ import com.google.gson.annotations.SerializedName;
import java.util.Date;
import java.util.List;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class BlockData {
@SerializedName("total")

View File

@ -20,7 +20,7 @@ import java.util.List;
import app.fedilab.fedilabtube.client.entities.ItemStr;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class CaptionData {
@SerializedName("total")

View File

@ -27,7 +27,7 @@ import app.fedilab.fedilabtube.client.entities.Avatar;
import app.fedilab.fedilabtube.client.entities.ItemStr;
import app.fedilab.fedilabtube.client.entities.ViewsPerDay;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class ChannelData {
@SerializedName("total")

View File

@ -19,7 +19,7 @@ import com.google.gson.annotations.SerializedName;
import java.util.Date;
import java.util.List;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class CommentData {
@SerializedName("total")

View File

@ -7,7 +7,7 @@ import com.google.gson.annotations.SerializedName;
import java.util.Date;
import java.util.List;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class InstanceData {
@SerializedName("total")

View File

@ -23,7 +23,7 @@ import app.fedilab.fedilabtube.client.entities.VideoBlacklist;
*
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
* see <http://www.gnu.org/licenses>. */
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class NotificationData {
@SerializedName("total")

View File

@ -24,7 +24,7 @@ import java.util.List;
import app.fedilab.fedilabtube.client.entities.Item;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class PlaylistData {
@SerializedName("total")

View File

@ -34,7 +34,7 @@ import app.fedilab.fedilabtube.client.entities.StreamingPlaylists;
import app.fedilab.fedilabtube.helper.Helper;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class VideoData {
@SerializedName("total")

View File

@ -20,7 +20,7 @@ import com.google.gson.annotations.SerializedName;
import java.util.List;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class VideoPlaylistData {
@SerializedName("total")
@ -120,6 +120,19 @@ public class VideoPlaylistData {
}
}
public static class PlaylistElement {
@SerializedName("videoPlaylistElement")
private VideoPlaylistCreationItem videoPlaylistElement;
public VideoPlaylistCreationItem getVideoPlaylistElement() {
return videoPlaylistElement;
}
public void setVideoPlaylistElement(VideoPlaylistCreationItem videoPlaylistElement) {
this.videoPlaylistElement = videoPlaylistElement;
}
}
public static class VideoPlaylistCreationItem {
@SerializedName("id")
String id;

View File

@ -14,7 +14,7 @@ package app.fedilab.fedilabtube.client.entities;
*
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
* see <http://www.gnu.org/licenses>. */
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class AccountCreation {
private String username;

View File

@ -16,6 +16,7 @@ package app.fedilab.fedilabtube.client.entities;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class Actor {
@SerializedName("type")
private String type;

View File

@ -16,7 +16,7 @@ package app.fedilab.fedilabtube.client.entities;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class ActorFollow {
@SerializedName("id")

View File

@ -21,7 +21,7 @@ import java.util.Date;
*
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
* see <http://www.gnu.org/licenses>. */
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class Avatar implements Parcelable {

View File

@ -16,7 +16,7 @@ package app.fedilab.fedilabtube.client.entities;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class CaptionsParams {
@SerializedName("captionLanguage")

View File

@ -16,7 +16,7 @@ package app.fedilab.fedilabtube.client.entities;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class ChannelParams {
@SerializedName("displayName")

View File

@ -22,6 +22,7 @@ import android.widget.Toast;
import app.fedilab.fedilabtube.R;
import es.dmoral.toasty.Toasty;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class Error extends Throwable {
private String error = null;

View File

@ -3,7 +3,7 @@ package app.fedilab.fedilabtube.client.entities;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class File {
@SerializedName("fileDownloadUrl")

View File

@ -16,6 +16,7 @@ package app.fedilab.fedilabtube.client.entities;
import java.util.List;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class InstanceParams {
private boolean healthy = true;

View File

@ -19,6 +19,7 @@ import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class Item implements Parcelable {
public static final Parcelable.Creator<Item> CREATOR = new Parcelable.Creator<Item>() {

View File

@ -19,7 +19,7 @@ import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class ItemStr implements Parcelable {
public static final Creator<ItemStr> CREATOR = new Creator<ItemStr>() {

View File

@ -16,6 +16,7 @@ package app.fedilab.fedilabtube.client.entities;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class NotificationSettings {
@SerializedName("abuseAsModerator")

View File

@ -16,6 +16,7 @@ package app.fedilab.fedilabtube.client.entities;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class Oauth {
@SerializedName("client_id")

View File

@ -16,6 +16,7 @@ package app.fedilab.fedilabtube.client.entities;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class OauthParams {

View File

@ -21,7 +21,7 @@ import java.util.List;
import app.fedilab.fedilabtube.client.data.ChannelData.Channel;
import app.fedilab.fedilabtube.client.data.VideoData.Video;
@SuppressWarnings({"unused"})
@SuppressWarnings({"unused", "RedundantSuppression"})
public class OverviewVideo {
@SerializedName("categories")

View File

@ -16,7 +16,7 @@ package app.fedilab.fedilabtube.client.entities;
import java.util.Map;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class PeertubeInformation {
private Map<Integer, String> categories;

View File

@ -16,61 +16,48 @@ package app.fedilab.fedilabtube.client.entities;
import com.google.gson.annotations.SerializedName;
import java.util.List;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class PlaylistExist {
@SerializedName("videoId")
private List<VideoId> videoId;
@SerializedName("playlistElementId")
private String playlistElementId;
@SerializedName("playlistId")
private String playlistId;
@SerializedName("startTimestamp")
private long startTimestamp;
@SerializedName("stopTimestamp")
private long stopTimestamp;
public List<VideoId> getVideoId() {
return videoId;
public String getPlaylistElementId() {
return playlistElementId;
}
public void setVideoId(List<VideoId> videoId) {
this.videoId = videoId;
public void setPlaylistElementId(String playlistElementId) {
this.playlistElementId = playlistElementId;
}
public static class VideoId {
@SerializedName("playlistElementId")
private String playlistElementId;
@SerializedName("playlistId")
private String playlistId;
@SerializedName("startTimestamp")
private long startTimestamp;
@SerializedName("stopTimestamp")
private long stopTimestamp;
public String getPlaylistId() {
return playlistId;
}
public String getPlaylistElementId() {
return playlistElementId;
}
public void setPlaylistId(String playlistId) {
this.playlistId = playlistId;
}
public void setPlaylistElementId(String playlistElementId) {
this.playlistElementId = playlistElementId;
}
public long getStartTimestamp() {
return startTimestamp;
}
public String getPlaylistId() {
return playlistId;
}
public void setStartTimestamp(long startTimestamp) {
this.startTimestamp = startTimestamp;
}
public void setPlaylistId(String playlistId) {
this.playlistId = playlistId;
}
public long getStopTimestamp() {
return stopTimestamp;
}
public long getStartTimestamp() {
return startTimestamp;
}
public void setStartTimestamp(long startTimestamp) {
this.startTimestamp = startTimestamp;
}
public long getStopTimestamp() {
return stopTimestamp;
}
public void setStopTimestamp(long stopTimestamp) {
this.stopTimestamp = stopTimestamp;
}
public void setStopTimestamp(long stopTimestamp) {
this.stopTimestamp = stopTimestamp;
}
}

View File

@ -17,6 +17,7 @@ package app.fedilab.fedilabtube.client.entities;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class PlaylistParams {
@SerializedName("displayName")

View File

@ -16,7 +16,7 @@ package app.fedilab.fedilabtube.client.entities;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class Rating {
@SerializedName("videoId")

View File

@ -18,7 +18,7 @@ import java.util.List;
*
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
* see <http://www.gnu.org/licenses>. */
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class Report {
@SerializedName("reason")

View File

@ -18,7 +18,7 @@ import com.google.gson.annotations.SerializedName;
import java.util.List;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class StreamingPlaylists {
@SerializedName("id")

View File

@ -16,6 +16,7 @@ package app.fedilab.fedilabtube.client.entities;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class Token {
@SerializedName("access_token")

View File

@ -22,6 +22,7 @@ import java.util.List;
import app.fedilab.fedilabtube.client.data.AccountData.Account;
import app.fedilab.fedilabtube.client.data.ChannelData;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class UserMe {
@SerializedName("account")

View File

@ -18,6 +18,7 @@ import com.google.gson.annotations.SerializedName;
import app.fedilab.fedilabtube.client.data.VideoData;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class VideoAbuse {
@SerializedName("id")

View File

@ -18,6 +18,7 @@ import com.google.gson.annotations.SerializedName;
import app.fedilab.fedilabtube.client.data.VideoData;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class VideoBlacklist {
@SerializedName("id")

View File

@ -21,7 +21,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.Date;
import java.util.List;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class VideoParams {
@SerializedName("channelId")

View File

@ -18,6 +18,7 @@ import com.google.gson.annotations.SerializedName;
import java.util.Date;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class ViewsPerDay {
@SerializedName("date")

View File

@ -17,7 +17,7 @@ package app.fedilab.fedilabtube.client.entities;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public class WellKnownNodeinfo {
@SerializedName("reel")
private String reel;

View File

@ -124,7 +124,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
holder.bottom_container.setOnClickListener(v -> {
Intent intent = new Intent(context, PeertubeActivity.class);
Bundle b = new Bundle();
b.putString("video_id", video.getUuid());
b.putString("video_id", video.getId());
intent.putExtras(b);
context.startActivity(intent);
});
@ -140,7 +140,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
holder.peertube_video_image.setOnClickListener(v -> {
Intent intent = new Intent(context, PeertubeActivity.class);
Bundle b = new Bundle();
b.putString("video_id", video.getUuid());
b.putString("video_id", video.getId());
intent.putExtras(b);
context.startActivity(intent);
});

View File

@ -108,7 +108,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
Intent intent = new Intent(context, PeertubeActivity.class);
Bundle b = new Bundle();
b.putString("peertube_instance", finalAccountAction1.getHost());
b.putString("video_id", notification.getComment().getVideo().getUuid());
b.putString("video_id", notification.getComment().getVideo().getId());
intent.putExtras(b);
context.startActivity(intent);
});
@ -142,11 +142,11 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
Intent intent = new Intent(context, PeertubeActivity.class);
Bundle b = new Bundle();
b.putString("peertube_instance", Helper.getLiveInstance(context));
b.putString("video_id", notification.getVideo().getUuid());
b.putString("video_id", notification.getVideo().getId());
intent.putExtras(b);
context.startActivity(intent);
});
}else if (notification.getVideoAbuse() != null && notification.getVideoAbuse().getVideo() != null) {
} else if (notification.getVideoAbuse() != null && notification.getVideoAbuse().getVideo() != null) {
message = context.getString(R.string.peertube_video_abuse, notification.getVideoAbuse().getVideo().getName());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
holder.peertube_notif_message.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));

View File

@ -156,6 +156,7 @@ public class PlaylistAdapter extends BaseAdapter {
return convertView;
}
@SuppressWarnings({"unused", "RedundantSuppression"})
public void manageVIewPlaylists(PlaylistsVM.action actionType, APIResponse apiResponse) {
}

View File

@ -44,6 +44,13 @@ import es.dmoral.toasty.Toasty;
public class DisplayNotificationsFragment extends Fragment {
//Peertube notification type
public static int NEW_VIDEO_FROM_SUBSCRIPTION = 1;
public static int BLACKLIST_ON_MY_VIDEO = 4;
public static int UNBLACKLIST_ON_MY_VIDEO = 5;
public static int MY_VIDEO_PUBLISHED = 6;
public static int MY_VIDEO_IMPORT_SUCCESS = 7;
public static int MY_VIDEO_IMPORT_ERROR = 8;
private boolean flag_loading;
private Context context;
private PeertubeNotificationsListAdapter peertubeNotificationsListAdapter;
@ -56,16 +63,6 @@ public class DisplayNotificationsFragment extends Fragment {
private RecyclerView lv_notifications;
private View rootView;
//Peertube notification type
public static int NEW_VIDEO_FROM_SUBSCRIPTION = 1;
public static int NEW_REPORT = 3;
public static int BLACKLIST_ON_MY_VIDEO = 4;
public static int UNBLACKLIST_ON_MY_VIDEO = 5;
public static int MY_VIDEO_PUBLISHED = 6;
public static int MY_VIDEO_IMPORT_SUCCESS = 7;
public static int MY_VIDEO_IMPORT_ERROR = 8;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

View File

@ -17,7 +17,6 @@ package app.fedilab.fedilabtube.fragment;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
@ -61,12 +60,10 @@ import app.fedilab.fedilabtube.client.data.PlaylistData.Playlist;
import app.fedilab.fedilabtube.client.entities.Item;
import app.fedilab.fedilabtube.client.entities.PlaylistParams;
import app.fedilab.fedilabtube.drawer.PlaylistAdapter;
import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
import es.dmoral.toasty.Toasty;
import static android.content.Context.MODE_PRIVATE;
import static app.fedilab.fedilabtube.MainActivity.peertubeInformation;
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.MY_CHANNELS;
@ -132,8 +129,6 @@ public class DisplayPlaylistsFragment extends Fragment {
set_upload_channel = dialogView.findViewById(R.id.set_upload_channel);
set_upload_privacy = dialogView.findViewById(R.id.set_upload_privacy);
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
final String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
ChannelsVM viewModelC = new ViewModelProvider(this).get(ChannelsVM.class);
viewModelC.get(MY_CHANNELS, null).observe(DisplayPlaylistsFragment.this.requireActivity(), this::manageVIewChannels);

View File

@ -109,8 +109,8 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
SeekBarPreference set_video_cache_choice = findPreference(getString(R.string.set_video_cache_choice));
assert set_video_cache_choice != null;
final int progress = set_video_cache_choice.getValue();
set_video_cache_choice.setSummary(getActivity().getString(R.string.video_cache_value, progress*10));
editor.putInt(Helper.SET_VIDEO_CACHE, progress*10);
set_video_cache_choice.setSummary(getActivity().getString(R.string.video_cache_value, progress * 10));
editor.putInt(Helper.SET_VIDEO_CACHE, progress * 10);
}
if (key.compareTo(getString(R.string.set_video_minimize_choice)) == 0) {
SwitchPreference set_video_minimize_choice = findPreference(getString(R.string.set_video_minimize_choice));
@ -171,7 +171,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
SeekBarPreference set_video_cache_choice = findPreference(getString(R.string.set_video_cache_choice));
int video_cache = sharedpref.getInt(Helper.SET_VIDEO_CACHE, Helper.DEFAULT_VIDEO_CACHE_MB);
assert set_video_cache_choice != null;
set_video_cache_choice.setValue(video_cache/10);
set_video_cache_choice.setValue(video_cache / 10);
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));

View File

@ -1,68 +0,0 @@
package app.fedilab.fedilabtube.helper;
/* 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 <http://www.gnu.org/licenses>. */
import android.graphics.Canvas;
import android.graphics.Paint;
import android.text.Layout;
import android.text.style.LeadingMarginSpan;
import android.text.style.LineBackgroundSpan;
import org.jetbrains.annotations.NotNull;
/**
* Original work from @heath-borders: https://stackoverflow.com/a/29114976/3197259
*/
public class CustomQuoteSpan implements LeadingMarginSpan, LineBackgroundSpan {
private final int backgroundColor;
private final int stripeColor;
private final float stripeWidth;
private final float gap;
public CustomQuoteSpan(int backgroundColor, int stripeColor, float stripeWidth, float gap) {
this.backgroundColor = backgroundColor;
this.stripeColor = stripeColor;
this.stripeWidth = stripeWidth;
this.gap = gap;
}
@Override
public int getLeadingMargin(boolean first) {
return (int) (stripeWidth + gap);
}
@Override
public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, int top, int baseline, int bottom,
CharSequence text, int start, int end, boolean first, Layout layout) {
Paint.Style style = p.getStyle();
int paintColor = p.getColor();
p.setStyle(Paint.Style.FILL);
p.setColor(stripeColor);
c.drawRect(x, top, x + dir * stripeWidth, bottom, p);
p.setStyle(style);
p.setColor(paintColor);
}
@Override
public void drawBackground(@NotNull Canvas c, @NotNull Paint p, int left, int right, int top, int baseline, int bottom, @NotNull CharSequence text, int start, int end, int lnum) {
int paintColor = p.getColor();
p.setColor(backgroundColor);
c.drawRect(left, top, right, bottom, p);
p.setColor(paintColor);
}
}

View File

@ -1,41 +0,0 @@
package app.fedilab.fedilabtube.helper;
/* 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 <http://www.gnu.org/licenses>. */
import java.util.Arrays;
/**
* Work from https://stackoverflow.com/a/26420820
*/
public class FileNameCleaner {
private final static int[] illegalChars = {34, 60, 62, 124, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 58, 42, 63, 92, 47};
static {
Arrays.sort(illegalChars);
}
public static String cleanFileName(String badFileName) {
StringBuilder cleanName = new StringBuilder();
int len = badFileName.codePointCount(0, badFileName.length());
for (int i = 0; i < len; i++) {
int c = badFileName.codePointAt(i);
if (Arrays.binarySearch(illegalChars, c) < 0) {
cleanName.appendCodePoint(c);
}
}
return cleanName.toString();
}
}

View File

@ -45,7 +45,7 @@ public class FullScreenMediaController extends MediaController {
this.context = context;
}
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public FullScreenMediaController(Context context, Video peertube) {
super(context);
this.peertube = peertube;
@ -104,7 +104,7 @@ public class FullScreenMediaController extends MediaController {
});
}
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "RedundantSuppression"})
public void setResolutionVal(String resolutionVal) {
this.resolutionVal = resolutionVal;
if (resolution != null)

View File

@ -26,7 +26,6 @@ import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.DisplayMetrics;
import android.util.TypedValue;
@ -40,7 +39,6 @@ import android.widget.ImageView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.core.content.ContextCompat;
import com.bumptech.glide.Glide;
@ -49,12 +47,10 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.regex.Pattern;
import app.fedilab.fedilabtube.BuildConfig;
@ -82,51 +78,34 @@ public class Helper {
public static final int QUALITY_HIGH = 0;
public static final int QUALITY_MEDIUM = 1;
public static final int QUALITY_LOW = 2;
public static final int VIDEO_MODE_TORRENT = 3;
public static final int ADD_USER_INTENT = 5;
public static final int VIDEO_UPLOADED_INTENT = 6;
public static final String VIDEO_UPLOAD_ID = "VIDEO_UPLOAD_ID";
public static final String SET_SHARE_DETAILS = "set_share_details";
public static final int DEFAULT_VIDEO_CACHE_MB = 100;
@SuppressWarnings({"unused", "RedundantSuppression"})
public static final String TAG = "mastodon_etalab";
public static final String ID = "id";
public static final String CLIENT_ID = "client_id";
public static final String CLIENT_SECRET = "client_secret";
public static final String SCOPES = "scopes";
public static final String WEBSITE = "website";
public static final String WEBSITE_VALUE = "https://fedilab.app";
public static final String CLIENT_NAME_VALUE = "TubeLab";
public static final String OAUTH_SCOPES_PEERTUBE = "openid profile";
public static final String PREF_KEY_OAUTH_TOKEN = "oauth_token";
public static final String REDIRECT_URIS = "redirect_uris";
public static final Pattern hashtagPattern = Pattern.compile("(#[\\w_A-zÀ-ÿ]+)");
public static final Pattern redirectPattern = Pattern.compile("externalAuthToken=(\\w+)&username=([\\w.-]+)");
public static final String SET_VIDEO_CACHE = "set_video_cache";
//Proxy
public static final String SET_PROXY_ENABLED = "set_proxy_enabled";
public static final String SET_PROXY_TYPE = "set_proxy_type";
public static final String SET_PROXY_HOST = "set_proxy_host";
public static final String SET_PROXY_PORT = "set_proxy_port";
public static final String SET_PROXY_LOGIN = "set_proxy_login";
public static final String SET_PROXY_PASSWORD = "set_proxy_password";
public static final String INTENT_ACTION = "intent_action";
public static final String PREF_KEY_ID = "userID";
public static final String PREF_KEY_NAME = "my_user_name";
public static final String PREF_IS_MODERATOR = "is_moderator";
public static final String PREF_IS_ADMINISTRATOR = "is_administrator";
public static final String PREF_INSTANCE = "instance";
public static final String REDIRECT_CONTENT = "urn:ietf:wg:oauth:2.0:oob";
public static final int EXTERNAL_STORAGE_REQUEST_CODE = 84;
public static final String SET_VIDEOS_PER_PAGE = "set_videos_per_page";
public static final String VIDEO_ID = "video_id_update";
public static final String CLIENT_NAME = "client_name";
public static final String APP_PREFS = "app_prefs";
public static final int VIDEOS_PER_PAGE = 40;
public static final String SET_VIDEO_NSFW = "set_video_nsfw";
public static final String SET_EMBEDDED_BROWSER = "set_embedded_browser";
public static final String SET_CUSTOM_TABS = "set_custom_tabs";
public static final String INTENT_ADD_UPLOADED_MEDIA = "intent_add_uploaded_media";
public static final String RECEIVE_ACTION = "receive_action";
public static final String SET_UNFOLLOW_VALIDATION = "set_unfollow_validation";
@ -268,42 +247,6 @@ public class Helper {
}
}
public static String instanceWithProtocol(Context context) {
return "https://" + getLiveInstance(context);
}
/**
* Convert String date from Mastodon
*
* @param date String
* @return Date
*/
public static Date mstStringToDate(String date) throws ParseException {
if (date == null)
return null;
String STRING_DATE_FORMAT;
Locale local = Locale.getDefault();
if (!date.contains("+")) {
STRING_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
} else { //GNU date format
STRING_DATE_FORMAT = "EEE MMM dd HH:mm:ss ZZZZZ yyyy";
local = Locale.ENGLISH;
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(STRING_DATE_FORMAT, local);
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("gmt"));
simpleDateFormat.setLenient(true);
try {
return simpleDateFormat.parse(date);
} catch (Exception e) {
String newdate = date.split("\\+")[0].trim();
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", local);
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("gmt"));
simpleDateFormat.setLenient(true);
return simpleDateFormat.parse(newdate);
}
}
/**
* Convert a date in String -> format yyyy-MM-dd HH:mm:ss
*
@ -386,7 +329,7 @@ public class Helper {
SimpleDateFormat df = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.LONG, Locale.getDefault());
df.applyPattern(df.toPattern().replaceAll("[^\\p{Alpha}]*y+[^\\p{Alpha}]*", ""));
return df.format(dateToot);
}catch (Exception e) {
} catch (Exception e) {
return format;
}
} else if (days > 0)
@ -402,17 +345,6 @@ public class Helper {
}
}
/**
* Convert a date in String -> format yyyy-MM-dd HH:mm:ss
*
* @param date Date
* @return String
*/
public static String shortDateToString(Date date) {
SimpleDateFormat df = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault());
return df.format(date);
}
public static String withSuffix(long count) {
if (count < 1000) return "" + count;
@ -471,50 +403,6 @@ public class Helper {
}
}
/**
* Manage URLs to open (built-in or external app)
*
* @param context Context
* @param url String url to open
*/
public static void openBrowser(Context context, String url) {
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
boolean embedded_browser = sharedpreferences.getBoolean(Helper.SET_EMBEDDED_BROWSER, true);
if (embedded_browser) {
Intent intent = new Intent(context, WebviewActivity.class);
Bundle b = new Bundle();
String finalUrl = url;
if (!url.toLowerCase().startsWith("http://") && !url.toLowerCase().startsWith("https://"))
finalUrl = "http://" + url;
b.putString("url", finalUrl);
intent.putExtras(b);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} else {
boolean custom_tabs = sharedpreferences.getBoolean(Helper.SET_CUSTOM_TABS, true);
if (custom_tabs) {
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
builder.setToolbarColor(ContextCompat.getColor(context, getColorPrimary()));
try {
customTabsIntent.launchUrl(context, Uri.parse(url));
} catch (Exception ignored) {
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
}
} else {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse(url));
try {
context.startActivity(intent);
} catch (Exception e) {
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
}
}
}
}
@SuppressLint("SetJavaScriptEnabled")
public static CustomWebview initializeWebview(Activity activity, int webviewId, View rootView) {
@ -678,9 +566,6 @@ public class Helper {
return BuildConfig.full_instances ? R.color.colorAccent_full : R.color.colorAccent;
}
public static int getColorPrimary() {
return BuildConfig.full_instances ? R.color.colorPrimary_full : R.color.colorPrimary;
}
public static boolean isOwner(Context context, Account account) {
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
@ -699,18 +584,18 @@ public class Helper {
* @param files List<File>
* @return File
*/
public static File defaultFile(Context context, List<File> files){
public static File defaultFile(Context context, List<File> files) {
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int video_quality = sharedpreferences.getInt(Helper.SET_QUALITY_MODE, Helper.QUALITY_HIGH);
if( video_quality == QUALITY_HIGH) {
if (video_quality == QUALITY_HIGH) {
return files.get(0);
}else if( video_quality == QUALITY_LOW) {
return files.get(files.size() -1);
}else{
if( files.size() < 3) {
return files.get(files.size() -1);
}else{
int middle = files.size()/2 -1;
} else if (video_quality == QUALITY_LOW) {
return files.get(files.size() - 1);
} else {
if (files.size() < 3) {
return files.get(files.size() - 1);
} else {
int middle = files.size() / 2 - 1;
return files.get(middle);
}
}

View File

@ -300,7 +300,7 @@ public class AccountDAO {
account.setClient_secret(c.getString(c.getColumnIndex(Sqlite.COL_CLIENT_SECRET)));
account.setRefresh_token(c.getString(c.getColumnIndex(Sqlite.COL_REFRESH_TOKEN)));
//Close the cursor
c.close();
c.close();
//User is returned
return account;
@ -348,5 +348,4 @@ public class AccountDAO {
}
}

View File

@ -41,12 +41,6 @@ public class CaptionsVM extends AndroidViewModel {
return apiResponseMutableLiveData;
}
public LiveData<APIResponse> loadCaption(String url) {
apiResponseMutableLiveData = new MutableLiveData<>();
load(url);
return apiResponseMutableLiveData;
}
private void loadCaptions(String videoId) {
Context _mContext = getApplication().getApplicationContext();
new Thread(() -> {
@ -61,20 +55,4 @@ public class CaptionsVM extends AndroidViewModel {
}
}).start();
}
private void load(String url) {
Context _mContext = getApplication().getApplicationContext();
new Thread(() -> {
try {
RetrofitPeertubeAPI peertubeAPI = new RetrofitPeertubeAPI(_mContext);
APIResponse apiResponse = peertubeAPI.getCaptionContent(url);
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> apiResponseMutableLiveData.setValue(apiResponse);
mainHandler.post(myRunnable);
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
}

View File

@ -26,15 +26,12 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import app.fedilab.fedilabtube.client.APIResponse;
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
import app.fedilab.fedilabtube.client.data.AccountData.Account;
import app.fedilab.fedilabtube.client.data.PlaylistData.Playlist;
import app.fedilab.fedilabtube.client.entities.PlaylistParams;
import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.sqlite.AccountDAO;
import app.fedilab.fedilabtube.sqlite.Sqlite;
@ -53,13 +50,13 @@ public class PlaylistsVM extends AndroidViewModel {
return apiResponseMutableLiveData;
}
public LiveData<APIResponse> videoExists(List<String> videoIds) {
public LiveData<APIResponse> videoExists(String videoIds) {
apiResponseMutableLiveData = new MutableLiveData<>();
checkVideosExist(videoIds);
return apiResponseMutableLiveData;
}
private void checkVideosExist(List<String> videoIds) {
private void checkVideosExist(String videoIds) {
Context _mContext = getApplication().getApplicationContext();
new Thread(() -> {
APIResponse apiResponse = new RetrofitPeertubeAPI(_mContext).getVideosExist(videoIds);

View File

@ -62,10 +62,12 @@
android:gravity="center"
android:visibility="gone">
<ProgressBar
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>
<!-- Loader for next items -->
<RelativeLayout
@ -77,10 +79,12 @@
android:gravity="bottom|center_horizontal"
android:visibility="gone">
<ProgressBar
android:layout_width="match_parent"
android:layout_height="match_parent"
android:indeterminate="true" />
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/progressBottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>
</RelativeLayout>

View File

@ -118,10 +118,12 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/filters_container">
<ProgressBar
<com.github.ybq.android.spinkit.SpinKitView
style="@style/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>
<LinearLayout

View File

@ -55,6 +55,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
android:layout_marginBottom="?attr/actionBarSize"
app:navGraph="@navigation/mobile_navigation" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"

View File

@ -67,10 +67,11 @@
android:gravity="center"
android:visibility="gone">
<ProgressBar
<com.github.ybq.android.spinkit.SpinKitView
style="@style/SpinKitView.DoubleBounce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
android:layout_gravity="center" />
</RelativeLayout>
</RelativeLayout>

View File

@ -65,10 +65,12 @@
android:gravity="center"
android:visibility="gone">
<ProgressBar
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>
<!-- Loader for next status -->
<RelativeLayout
@ -80,10 +82,12 @@
android:gravity="bottom|center_horizontal"
android:visibility="gone">
<ProgressBar
android:layout_width="match_parent"
android:layout_height="match_parent"
android:indeterminate="true" />
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/progressBottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -71,10 +71,12 @@
android:gravity="center"
android:visibility="gone">
<ProgressBar
<com.github.ybq.android.spinkit.SpinKitView
style="@style/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>
<!-- Loader for next videos -->
<RelativeLayout
@ -87,10 +89,12 @@
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent">
<ProgressBar
android:layout_width="match_parent"
android:layout_height="match_parent"
android:indeterminate="true" />
<com.github.ybq.android.spinkit.SpinKitView
style="@style/progressBottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -51,10 +51,12 @@
android:gravity="center"
android:visibility="gone">
<ProgressBar
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>
<!-- Loader for next items -->
<RelativeLayout
@ -66,10 +68,12 @@
android:gravity="bottom|center_horizontal"
android:visibility="gone">
<ProgressBar
android:layout_width="match_parent"
android:layout_height="match_parent"
android:indeterminate="true" />
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/progressBottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton

View File

@ -57,10 +57,12 @@
android:gravity="center"
android:visibility="gone">
<ProgressBar
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>
<!-- Loader for next accounts -->
<RelativeLayout
@ -72,10 +74,12 @@
android:gravity="bottom|center_horizontal"
android:visibility="gone">
<ProgressBar
android:layout_width="match_parent"
android:layout_height="match_parent"
android:indeterminate="true" />
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/progressBottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>
</RelativeLayout>

View File

@ -100,10 +100,12 @@
android:gravity="center"
android:visibility="gone">
<ProgressBar
<com.github.ybq.android.spinkit.SpinKitView
style="@style/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>
<!-- Loader for next videos -->
<RelativeLayout
@ -116,10 +118,12 @@
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent">
<ProgressBar
android:layout_width="match_parent"
android:layout_height="match_parent"
android:indeterminate="true" />
<com.github.ybq.android.spinkit.SpinKitView
style="@style/progressBottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>