mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-06-05 21:09:11 +02:00
Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
3ed5248c2a | |||
32990932ad | |||
6d0a47903c | |||
05eaa196b4 | |||
2cd076bfb8 | |||
02cd267cae | |||
21394cb585 | |||
73cd48b94a | |||
ea2cf58e5f | |||
2f3e29b037 | |||
33d597c2c0 | |||
66afb3f4ee | |||
dad94d753d | |||
1727bebf58 | |||
37576c69ce | |||
b8f83a7227 | |||
3a14abaf2e | |||
0e03a55aef | |||
931fb30330 | |||
b893dc9c4f | |||
f6ddd99449 | |||
ddcbbfe670 | |||
0f7438fa54 | |||
fbbab1db68 | |||
15725dceb0 | |||
1bcbcec8b8 | |||
c3e475be6f | |||
150a81adc6 | |||
a984607ee8 | |||
2bf929986e | |||
860edec2e6 | |||
90cfcbb7ae | |||
c63048730f | |||
55bbafdbb5 | |||
0923a07e42 | |||
431c21e066 | |||
17c84f6c37 | |||
58f10d9372 |
@ -11,8 +11,8 @@ android {
|
|||||||
|
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 24
|
versionCode 25
|
||||||
versionName "1.6.0"
|
versionName "1.7.0"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
@ -130,7 +130,6 @@ dependencies {
|
|||||||
implementation "com.github.TorrentStream:TorrentStream-Android:2.7.0"
|
implementation "com.github.TorrentStream:TorrentStream-Android:2.7.0"
|
||||||
|
|
||||||
implementation "io.github.kobakei:ratethisapp:1.2.0"
|
implementation "io.github.kobakei:ratethisapp:1.2.0"
|
||||||
implementation 'com.github.HITGIF:TextFieldBoxes:1.4.5'
|
|
||||||
implementation 'com.github.vkay94:DoubleTapPlayerView:1.0.0'
|
implementation 'com.github.vkay94:DoubleTapPlayerView:1.0.0'
|
||||||
|
|
||||||
implementation "androidx.work:work-runtime:2.4.0"
|
implementation "androidx.work:work-runtime:2.4.0"
|
||||||
|
@ -18,9 +18,19 @@
|
|||||||
<string name="set_video_in_list">Vidéos dans une liste</string>
|
<string name="set_video_in_list">Vidéos dans une liste</string>
|
||||||
<string name="set_video_in_list_description">Change la mise en page pour afficher les vidéos dans une liste</string>
|
<string name="set_video_in_list_description">Change la mise en page pour afficher les vidéos dans une liste</string>
|
||||||
|
|
||||||
|
<string name="export_list">Exporter</string>
|
||||||
|
<string name="import_list">Importer</string>
|
||||||
|
|
||||||
|
<string name="delete_history">Supprimer l\'historique de vidéos</string>
|
||||||
|
<string name="delete_history_confirm">Êtes vous sur de vouloir supprimer toutes les vidéos de votre historique ?</string>
|
||||||
|
<string name="export_notification_title">Exportation réussie !</string>
|
||||||
|
<string name="export_notification_content">Cliquer ici pour envoyer l\'exportation par mèl.</string>
|
||||||
|
<string name="export_notification_subjet">Nouvelle liste de lecture</string>
|
||||||
|
<string name="export_notification_body">Ouvrez la pièce jointe avec l\'application TubeAcad</string>
|
||||||
|
|
||||||
<string name="show_more">Montrer plus</string>
|
<string name="show_more">Montrer plus</string>
|
||||||
<string name="show_less">Montrer moins</string>
|
<string name="show_less">Montrer moins</string>
|
||||||
|
<string name="no_instances">Aucune instance !</string>
|
||||||
<string name="set_play_screen_lock">Verrouillage d\'écran</string>
|
<string name="set_play_screen_lock">Verrouillage d\'écran</string>
|
||||||
<string name="set_play_screen_lock_description">Continuer à lire des vidéos lorsque l\'écran est verrouillé</string>
|
<string name="set_play_screen_lock_description">Continuer à lire des vidéos lorsque l\'écran est verrouillé</string>
|
||||||
|
|
||||||
@ -165,8 +175,12 @@
|
|||||||
<string name="app_logo">Logo de l’application</string>
|
<string name="app_logo">Logo de l’application</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Abonnements</string>
|
<string name="subscriptions">Abonnements</string>
|
||||||
|
<string name="delete_instance">Supprimer l\'instance</string>
|
||||||
|
<string name="delete_instance_confirm">Etes-vous sûr de vouloir supprimer cette instance ?</string>
|
||||||
|
|
||||||
<string name="delete_comment">Supprimer le commentaire</string>
|
<string name="delete_comment">Supprimer le commentaire</string>
|
||||||
<string name="delete_comment_confirm">Etes-vous sûr de vouloir supprimer ce commentaire ?</string>
|
<string name="delete_comment_confirm">Etes-vous sûr de vouloir supprimer ce commentaire ?</string>
|
||||||
|
|
||||||
<string name="set_video_mode">Mode pour les vidéos</string>
|
<string name="set_video_mode">Mode pour les vidéos</string>
|
||||||
<string name="filter">Filtrer</string>
|
<string name="filter">Filtrer</string>
|
||||||
<string name="sepia_search">Recherche sépia</string>
|
<string name="sepia_search">Recherche sépia</string>
|
||||||
@ -287,6 +301,7 @@
|
|||||||
<item>Faible</item>
|
<item>Faible</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string name="unfollow_confirm">Voulez-vous vous désabonner de ce compte ?</string>
|
<string name="unfollow_confirm">Voulez-vous vous désabonner de ce compte ?</string>
|
||||||
|
<string name="no_playlist">Aucune liste de lecture !</string>
|
||||||
<string name="title_video_peertube">Titre de la vidéo</string>
|
<string name="title_video_peertube">Titre de la vidéo</string>
|
||||||
<string name="join_peertube">Rejoignez Peertube</string>
|
<string name="join_peertube">Rejoignez Peertube</string>
|
||||||
<string name="agreement_check_peertube">J\'ai au moins 16 ans et je suis d\'accord avec les %1$s de cette instance</string>
|
<string name="agreement_check_peertube">J\'ai au moins 16 ans et je suis d\'accord avec les %1$s de cette instance</string>
|
||||||
|
6
app/src/acad/res/xml/file_paths.xml
Normal file
6
app/src/acad/res/xml/file_paths.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<paths>
|
||||||
|
<external-path
|
||||||
|
name="my_images"
|
||||||
|
path="/TubeAcad/" />
|
||||||
|
</paths>
|
37
app/src/fdroid_acad/AndroidManifest.xml
Normal file
37
app/src/fdroid_acad/AndroidManifest.xml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="app.fedilab.fedilabtube">
|
||||||
|
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".FedilabTube"
|
||||||
|
android:allowBackup="false"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme"
|
||||||
|
tools:replace="android:allowBackup">
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
tools:node="merge">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="content" />
|
||||||
|
<data android:scheme="file" />
|
||||||
|
<data android:mimeType="*/*" />
|
||||||
|
<data android:pathPattern=".*\\.tubelab" />
|
||||||
|
<data android:pathPattern=".*\\..*\\.tubelab" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\.tubelab" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\.tubelab" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.tubelab" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.tubelab" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
</manifest>
|
@ -1,25 +1,14 @@
|
|||||||
Added:
|
Added:
|
||||||
- Device notifications (refresh time can be set in settings or disabled)
|
- Display follow button for Sepia Search
|
||||||
- Double tap video left/right to seek - or + 10 seconds
|
- Reach owner from channels
|
||||||
- Display video in a list with small thumbnails (default: disabled)
|
- Surfing mode (store instances in db with quick switch)
|
||||||
- Automatically adapt full-screen in portrait or landscape
|
- Allow to delete history
|
||||||
- Incognito: Enable/disable reccords in history
|
|
||||||
- Video suggestions
|
|
||||||
- Enable/Disable playback when screen is off (default: disabled)
|
|
||||||
- Add support for Torrent URLs
|
|
||||||
- Toggle full video description when available
|
|
||||||
- Channel can be visited from playing video activity
|
|
||||||
- Play videos from URL search
|
|
||||||
- Allow to set behavior in settings for sensitive media
|
|
||||||
- Remember last play position
|
|
||||||
- Honor don't download videos when forbidden
|
|
||||||
- Share channel or account links when visiting profiles
|
|
||||||
|
|
||||||
Changed:
|
Changed:
|
||||||
- Video mode (Normal, webview, magnet and torrent)
|
- Quicker access to account settings
|
||||||
- Accept URLs for instances
|
- Improve landscape mode
|
||||||
|
|
||||||
Fix:
|
Fix:
|
||||||
- Enable to end playing with top back button
|
- Pull to refresh crashes
|
||||||
- Fix FP message with token
|
- Settings crashes
|
||||||
- Share the page on Peertube and not the video file.
|
- Fix an issue with unlisted playlists
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Videos in list</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="show_more">Show more</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_less">Show less</string>
|
||||||
<string name="set_play_screen_lock">Screen lock</string>
|
<string name="set_play_screen_lock">Screen lock</string>
|
||||||
@ -136,6 +137,8 @@
|
|||||||
<string name="app_logo">شعار التطبيق</string>
|
<string name="app_logo">شعار التطبيق</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">الاشتراكات</string>
|
<string name="subscriptions">الاشتراكات</string>
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
<string name="delete_comment">حذف التعليق</string>
|
<string name="delete_comment">حذف التعليق</string>
|
||||||
<string name="delete_comment_confirm">هل أنت متأكد من أنك تود حذف هذا التعليق؟</string>
|
<string name="delete_comment_confirm">هل أنت متأكد من أنك تود حذف هذا التعليق؟</string>
|
||||||
<string name="set_video_mode">أسلوب عرض الفيديوهات</string>
|
<string name="set_video_mode">أسلوب عرض الفيديوهات</string>
|
||||||
@ -220,7 +223,16 @@
|
|||||||
<string name="send_comment">ارسل تعليق</string>
|
<string name="send_comment">ارسل تعليق</string>
|
||||||
<string name="all">الكل</string>
|
<string name="all">الكل</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">قوائم التشغيل</string>
|
<string name="playlists">قوائم التشغيل</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">الاسم العلني</string>
|
<string name="display_name">الاسم العلني</string>
|
||||||
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
||||||
<string name="error_display_name">يجب عليك إدخال اسم علني!</string>
|
<string name="error_display_name">يجب عليك إدخال اسم علني!</string>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Videoliste</string>
|
<string name="set_video_in_list">Videoliste</string>
|
||||||
<string name="set_video_in_list_description">Layout für die Anzeige von Videos in einer Liste ändern</string>
|
<string name="set_video_in_list_description">Layout für die Anzeige von Videos in einer Liste ändern</string>
|
||||||
|
<string name="no_instances">Keine Instanzen !</string>
|
||||||
<string name="show_more">Mehr anzeigen</string>
|
<string name="show_more">Mehr anzeigen</string>
|
||||||
<string name="show_less">Weniger anzeigen</string>
|
<string name="show_less">Weniger anzeigen</string>
|
||||||
<string name="set_play_screen_lock">Bildschirmsperre</string>
|
<string name="set_play_screen_lock">Bildschirmsperre</string>
|
||||||
@ -25,7 +26,7 @@
|
|||||||
<string name="notif_video_imported">Videoimport abgeschlossen</string>
|
<string name="notif_video_imported">Videoimport abgeschlossen</string>
|
||||||
<string name="notif_new_followers">Du oder dein Kanal(e) haben einen neuen Follower</string>
|
<string name="notif_new_followers">Du oder dein Kanal(e) haben einen neuen Follower</string>
|
||||||
<string name="notif_video_mention">Jemand hat dich in einem Kommentar erwähnt</string>
|
<string name="notif_video_mention">Jemand hat dich in einem Kommentar erwähnt</string>
|
||||||
<string name="notif_abuse_received">Ein Missbrauchsbericht hat eine neue Nachricht erhalten</string>
|
<string name="notif_abuse_received">Es gibt eine neue Nachricht zu einem Missbrauchsbericht</string>
|
||||||
<string name="notif_abuse_accepted">Ein Missbrauchsbericht wurde von Moderatoren akzeptiert oder abgelehnt</string>
|
<string name="notif_abuse_accepted">Ein Missbrauchsbericht wurde von Moderatoren akzeptiert oder abgelehnt</string>
|
||||||
<plurals name="number_of_replies">
|
<plurals name="number_of_replies">
|
||||||
<item quantity="one">%d Antwort</item>
|
<item quantity="one">%d Antwort</item>
|
||||||
@ -40,7 +41,7 @@
|
|||||||
<string name="title_discover">Entdecken</string>
|
<string name="title_discover">Entdecken</string>
|
||||||
<string name="title_notifications">Benachrichtigungen</string>
|
<string name="title_notifications">Benachrichtigungen</string>
|
||||||
<string name="title_recently_added">Zuletzt hinzugefügt</string>
|
<string name="title_recently_added">Zuletzt hinzugefügt</string>
|
||||||
<string name="title_trending">Beliebt</string>
|
<string name="title_trending">Angesagt</string>
|
||||||
<string name="title_most_liked">Beliebteste</string>
|
<string name="title_most_liked">Beliebteste</string>
|
||||||
<string name="toast_error">Hoppla, es gab einen Fehler!</string>
|
<string name="toast_error">Hoppla, es gab einen Fehler!</string>
|
||||||
<string name="title_muted">Stummgeschaltet</string>
|
<string name="title_muted">Stummgeschaltet</string>
|
||||||
@ -132,6 +133,8 @@
|
|||||||
<string name="app_logo">Logo der Anwendung</string>
|
<string name="app_logo">Logo der Anwendung</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Abonnements</string>
|
<string name="subscriptions">Abonnements</string>
|
||||||
|
<string name="delete_instance">Eine Instanz entfernen</string>
|
||||||
|
<string name="delete_instance_confirm">Möchtest du diese Instanz wirklich entfernen?</string>
|
||||||
<string name="delete_comment">Kommentar löschen</string>
|
<string name="delete_comment">Kommentar löschen</string>
|
||||||
<string name="delete_comment_confirm">Möchtest du diesen Kommentar wirklich löschen?</string>
|
<string name="delete_comment_confirm">Möchtest du diesen Kommentar wirklich löschen?</string>
|
||||||
<string name="set_video_mode">Videomodus</string>
|
<string name="set_video_mode">Videomodus</string>
|
||||||
@ -178,19 +181,19 @@
|
|||||||
<string name="name">Name</string>
|
<string name="name">Name</string>
|
||||||
<string name="display_more">Mehr anzeigen</string>
|
<string name="display_more">Mehr anzeigen</string>
|
||||||
<string name="no_channels">Keine Kanäle!</string>
|
<string name="no_channels">Keine Kanäle!</string>
|
||||||
<string name="report_helper">Einige Erklärungen zu deinem Bericht…</string>
|
<string name="report_helper">Einige Erklärungen zu deiner Meldung…</string>
|
||||||
<string name="report_video">Video melden</string>
|
<string name="report_video">Video melden</string>
|
||||||
<string name="report">Bericht</string>
|
<string name="report">Melden</string>
|
||||||
<string name="change_instance">Wähle eine andere Instanz</string>
|
<string name="change_instance">Wähle eine andere Instanz</string>
|
||||||
<string name="my_history">Verlauf</string>
|
<string name="my_history">Verlauf</string>
|
||||||
<string name="edit">Bearbeiten</string>
|
<string name="edit">Bearbeiten</string>
|
||||||
<string name="video_settings">Video-Einstellungen</string>
|
<string name="video_settings">Video-Einstellungen</string>
|
||||||
<string name="app_interface">Benutzeroberfläche</string>
|
<string name="app_interface">Benutzeroberfläche</string>
|
||||||
<string name="set_cache_mode">Zwischenspeicher</string>
|
<string name="set_cache_mode">Zwischenspeicher</string>
|
||||||
<string name="set_video_cache_description">Lege die Größe des Zwischenspeichers für Videos fest (Standard 100Mb)</string>
|
<string name="set_video_cache_description">Lege die Größe des Zwischenspeichers für Videos fest (Standard 100MB)</string>
|
||||||
<string name="set_video_quality_description">Standardqualität für Videos festlegen</string>
|
<string name="set_video_quality_description">Standardqualität für Videos festlegen</string>
|
||||||
<string name="set_quality_mode">Auflösung für Videos</string>
|
<string name="set_quality_mode">Auflösung für Videos</string>
|
||||||
<string name="video_cache_value">Video-Zwischenspeicher: %d Mb</string>
|
<string name="video_cache_value">Video-Zwischenspeicher: %d MB</string>
|
||||||
<string name="captions">Untertitel</string>
|
<string name="captions">Untertitel</string>
|
||||||
<string name="pickup_captions">Untertitel abholen</string>
|
<string name="pickup_captions">Untertitel abholen</string>
|
||||||
<string name="none">Keine</string>
|
<string name="none">Keine</string>
|
||||||
@ -216,7 +219,16 @@
|
|||||||
<string name="send_comment">Kommentar absenden</string>
|
<string name="send_comment">Kommentar absenden</string>
|
||||||
<string name="all">Alle</string>
|
<string name="all">Alle</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">Wiedergabelisten</string>
|
<string name="playlists">Wiedergabelisten</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">Anzeigename</string>
|
<string name="display_name">Anzeigename</string>
|
||||||
<string name="action_playlist_add">Sie haben noch keine Wiedergabelisten. Klicken Sie auf das Symbol „➕”, um eine neue Wiedergabeliste hinzuzufügen.</string>
|
<string name="action_playlist_add">Sie haben noch keine Wiedergabelisten. Klicken Sie auf das Symbol „➕”, um eine neue Wiedergabeliste hinzuzufügen.</string>
|
||||||
<string name="error_display_name">Du musst einen Anzeigenamen angeben!</string>
|
<string name="error_display_name">Du musst einen Anzeigenamen angeben!</string>
|
||||||
@ -241,7 +253,7 @@
|
|||||||
Du kannst nun deinen Account verbinden, indem du <b>%1$s</b> in das erste Feld schreibst und auf <b>Verbinden</b>klickst.\n\n
|
Du kannst nun deinen Account verbinden, indem du <b>%1$s</b> in das erste Feld schreibst und auf <b>Verbinden</b>klickst.\n\n
|
||||||
<b>Wichtig</b>: Wenn deine Instanz eine Bestätigung benötigt, erhältst du eine E-Mail, sobald sie geprüft wurde!
|
<b>Wichtig</b>: Wenn deine Instanz eine Bestätigung benötigt, erhältst du eine E-Mail, sobald sie geprüft wurde!
|
||||||
</string>
|
</string>
|
||||||
<string name="account">Account</string>
|
<string name="account">Benutzerkonto</string>
|
||||||
<string name="report_account">Account melden</string>
|
<string name="report_account">Account melden</string>
|
||||||
<string-array name="settings_video_mode">
|
<string-array name="settings_video_mode">
|
||||||
<item>Normal</item>
|
<item>Normal</item>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Videos in list</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="show_more">Show more</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_less">Show less</string>
|
||||||
<string name="set_play_screen_lock">Screen lock</string>
|
<string name="set_play_screen_lock">Screen lock</string>
|
||||||
@ -132,6 +133,8 @@
|
|||||||
<string name="app_logo">Το λογότυπο της εφαρμογής</string>
|
<string name="app_logo">Το λογότυπο της εφαρμογής</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Συνδρομές</string>
|
<string name="subscriptions">Συνδρομές</string>
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
<string name="delete_comment">Διαγραφή ενός σχόλιου</string>
|
<string name="delete_comment">Διαγραφή ενός σχόλιου</string>
|
||||||
<string name="delete_comment_confirm">Θέλετε να διαγράψετε αυτό το σχόλιο, στα σίγουρα;</string>
|
<string name="delete_comment_confirm">Θέλετε να διαγράψετε αυτό το σχόλιο, στα σίγουρα;</string>
|
||||||
<string name="set_video_mode">Κατάσταση λειτουργίας για τα βίντεο</string>
|
<string name="set_video_mode">Κατάσταση λειτουργίας για τα βίντεο</string>
|
||||||
@ -216,7 +219,16 @@
|
|||||||
<string name="send_comment">Αποστολή σχόλιου</string>
|
<string name="send_comment">Αποστολή σχόλιου</string>
|
||||||
<string name="all">Όλα</string>
|
<string name="all">Όλα</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">Λίστες αναπαραγωγής</string>
|
<string name="playlists">Λίστες αναπαραγωγής</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">Εμφανιζόμενο όνομα</string>
|
<string name="display_name">Εμφανιζόμενο όνομα</string>
|
||||||
<string name="action_playlist_add">Δεν έχετε καμία λίστα αναπαραγωγής. Κάντε κλικ στο εικονίδιο « + », για να προσθέσετε μία καινούργια λίστα</string>
|
<string name="action_playlist_add">Δεν έχετε καμία λίστα αναπαραγωγής. Κάντε κλικ στο εικονίδιο « + », για να προσθέσετε μία καινούργια λίστα</string>
|
||||||
<string name="error_display_name">Πρέπει να εισάγεται ένα όνομα εμφάνισης!</string>
|
<string name="error_display_name">Πρέπει να εισάγεται ένα όνομα εμφάνισης!</string>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Videos in list</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="show_more">Show more</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_less">Show less</string>
|
||||||
<string name="set_play_screen_lock">Screen lock</string>
|
<string name="set_play_screen_lock">Screen lock</string>
|
||||||
@ -132,6 +133,8 @@
|
|||||||
<string name="app_logo">Logo de la aplicación</string>
|
<string name="app_logo">Logo de la aplicación</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Suscripciones</string>
|
<string name="subscriptions">Suscripciones</string>
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
<string name="delete_comment">Eliminar un comentario</string>
|
<string name="delete_comment">Eliminar un comentario</string>
|
||||||
<string name="delete_comment_confirm">¿Realmente deseas eliminar este comentario?</string>
|
<string name="delete_comment_confirm">¿Realmente deseas eliminar este comentario?</string>
|
||||||
<string name="set_video_mode">Aplicar el modo de video</string>
|
<string name="set_video_mode">Aplicar el modo de video</string>
|
||||||
@ -216,7 +219,16 @@
|
|||||||
<string name="send_comment">Enviar comentario</string>
|
<string name="send_comment">Enviar comentario</string>
|
||||||
<string name="all">Todo</string>
|
<string name="all">Todo</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">Listas de reproducción</string>
|
<string name="playlists">Listas de reproducción</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">Nombre para mostrar</string>
|
<string name="display_name">Nombre para mostrar</string>
|
||||||
<string name="action_playlist_add">No tienes ninguna lista de reproducción. Pulsa en el icono \"+\" para añadir una nueva lista</string>
|
<string name="action_playlist_add">No tienes ninguna lista de reproducción. Pulsa en el icono \"+\" para añadir una nueva lista</string>
|
||||||
<string name="error_display_name">¡Debe proporcionar un nombre para mostrar!</string>
|
<string name="error_display_name">¡Debe proporcionar un nombre para mostrar!</string>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Videos in list</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="show_more">Show more</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_less">Show less</string>
|
||||||
<string name="set_play_screen_lock">Screen lock</string>
|
<string name="set_play_screen_lock">Screen lock</string>
|
||||||
@ -132,6 +133,8 @@
|
|||||||
<string name="app_logo">Logo de l’application</string>
|
<string name="app_logo">Logo de l’application</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Abonnements</string>
|
<string name="subscriptions">Abonnements</string>
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
<string name="delete_comment">Supprimer le commentaire</string>
|
<string name="delete_comment">Supprimer le commentaire</string>
|
||||||
<string name="delete_comment_confirm">Etes-vous sûr de vouloir supprimer ce commentaire ?</string>
|
<string name="delete_comment_confirm">Etes-vous sûr de vouloir supprimer ce commentaire ?</string>
|
||||||
<string name="set_video_mode">Mode pour les vidéos</string>
|
<string name="set_video_mode">Mode pour les vidéos</string>
|
||||||
@ -216,7 +219,16 @@
|
|||||||
<string name="send_comment">Envoyer un commentaire</string>
|
<string name="send_comment">Envoyer un commentaire</string>
|
||||||
<string name="all">Tout</string>
|
<string name="all">Tout</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">Listes de lecture</string>
|
<string name="playlists">Listes de lecture</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">Nom d\'affichage</string>
|
<string name="display_name">Nom d\'affichage</string>
|
||||||
<string name="action_playlist_add">Vous n\'avez aucune liste de lecture. Cliquez sur l\'icône « + » pour en ajouter une</string>
|
<string name="action_playlist_add">Vous n\'avez aucune liste de lecture. Cliquez sur l\'icône « + » pour en ajouter une</string>
|
||||||
<string name="error_display_name">Vous devez fournir un nom d\'affichage !</string>
|
<string name="error_display_name">Vous devez fournir un nom d\'affichage !</string>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Videos in list</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="show_more">Show more</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_less">Show less</string>
|
||||||
<string name="set_play_screen_lock">Screen lock</string>
|
<string name="set_play_screen_lock">Screen lock</string>
|
||||||
@ -132,6 +133,8 @@
|
|||||||
<string name="app_logo">Logo dell\'applicazione</string>
|
<string name="app_logo">Logo dell\'applicazione</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Abbonamenti</string>
|
<string name="subscriptions">Abbonamenti</string>
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
<string name="delete_comment">Elimina il commento</string>
|
<string name="delete_comment">Elimina il commento</string>
|
||||||
<string name="delete_comment_confirm">Sei sicuro di voler eliminare questo commento?</string>
|
<string name="delete_comment_confirm">Sei sicuro di voler eliminare questo commento?</string>
|
||||||
<string name="set_video_mode">Modalità per i video</string>
|
<string name="set_video_mode">Modalità per i video</string>
|
||||||
@ -216,7 +219,16 @@
|
|||||||
<string name="send_comment">Invia commento</string>
|
<string name="send_comment">Invia commento</string>
|
||||||
<string name="all">Tutto</string>
|
<string name="all">Tutto</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">Playlist</string>
|
<string name="playlists">Playlist</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">Nome visualizzato</string>
|
<string name="display_name">Nome visualizzato</string>
|
||||||
<string name="action_playlist_add">Non hai nessuna playlist. Premi l\'icona \"+\" per aggiungere una nuova playlist</string>
|
<string name="action_playlist_add">Non hai nessuna playlist. Premi l\'icona \"+\" per aggiungere una nuova playlist</string>
|
||||||
<string name="error_display_name">È necessario fornire un nome da visualizzare!</string>
|
<string name="error_display_name">È necessario fornire un nome da visualizzare!</string>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Videos in list</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="show_more">Show more</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_less">Show less</string>
|
||||||
<string name="set_play_screen_lock">Screen lock</string>
|
<string name="set_play_screen_lock">Screen lock</string>
|
||||||
@ -131,6 +132,8 @@
|
|||||||
<string name="app_logo">アプリケーションのロゴ</string>
|
<string name="app_logo">アプリケーションのロゴ</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">サブスクリプション</string>
|
<string name="subscriptions">サブスクリプション</string>
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
<string name="delete_comment">コメントを削除</string>
|
<string name="delete_comment">コメントを削除</string>
|
||||||
<string name="delete_comment_confirm">このコメントを削除しますか?</string>
|
<string name="delete_comment_confirm">このコメントを削除しますか?</string>
|
||||||
<string name="set_video_mode">動画のモード</string>
|
<string name="set_video_mode">動画のモード</string>
|
||||||
@ -215,7 +218,16 @@
|
|||||||
<string name="send_comment">コメントを送信</string>
|
<string name="send_comment">コメントを送信</string>
|
||||||
<string name="all">すべて</string>
|
<string name="all">すべて</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">プレイリスト</string>
|
<string name="playlists">プレイリスト</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">表示名</string>
|
<string name="display_name">表示名</string>
|
||||||
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
||||||
<string name="error_display_name">表示名を入力する必要があります!</string>
|
<string name="error_display_name">表示名を入力する必要があります!</string>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Videos in list</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="show_more">Show more</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_less">Show less</string>
|
||||||
<string name="set_play_screen_lock">Screen lock</string>
|
<string name="set_play_screen_lock">Screen lock</string>
|
||||||
@ -131,6 +132,8 @@
|
|||||||
<string name="app_logo">응용프로그램 로고</string>
|
<string name="app_logo">응용프로그램 로고</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Subscriptions</string>
|
<string name="subscriptions">Subscriptions</string>
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
<string name="delete_comment">Delete a comment</string>
|
<string name="delete_comment">Delete a comment</string>
|
||||||
<string name="delete_comment_confirm">Are you sure to delete this comment?</string>
|
<string name="delete_comment_confirm">Are you sure to delete this comment?</string>
|
||||||
<string name="set_video_mode">Mode for videos</string>
|
<string name="set_video_mode">Mode for videos</string>
|
||||||
@ -215,7 +218,16 @@
|
|||||||
<string name="send_comment">댓글 보내기</string>
|
<string name="send_comment">댓글 보내기</string>
|
||||||
<string name="all">모두</string>
|
<string name="all">모두</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">재생목록</string>
|
<string name="playlists">재생목록</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">표시되는 이름</string>
|
<string name="display_name">표시되는 이름</string>
|
||||||
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
||||||
<string name="error_display_name">You must provide a display name!</string>
|
<string name="error_display_name">You must provide a display name!</string>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Video lijst</string>
|
<string name="set_video_in_list">Video lijst</string>
|
||||||
<string name="set_video_in_list_description">Wijzig de lay-out voor het weergeven van video\'s in een lijst</string>
|
<string name="set_video_in_list_description">Wijzig de lay-out voor het weergeven van video\'s in een lijst</string>
|
||||||
|
<string name="no_instances">Geen instanties !</string>
|
||||||
<string name="show_more">Meer weergeven</string>
|
<string name="show_more">Meer weergeven</string>
|
||||||
<string name="show_less">Minder weergeven</string>
|
<string name="show_less">Minder weergeven</string>
|
||||||
<string name="set_play_screen_lock">Schermvergrendeling</string>
|
<string name="set_play_screen_lock">Schermvergrendeling</string>
|
||||||
@ -90,7 +91,7 @@
|
|||||||
<string name="date_minutes">%d m</string>
|
<string name="date_minutes">%d m</string>
|
||||||
<string name="date_hours">%d h</string>
|
<string name="date_hours">%d h</string>
|
||||||
<string name="date_day">%d d</string>
|
<string name="date_day">%d d</string>
|
||||||
<string name="number_view_video">%s aanzichten</string>
|
<string name="number_view_video">%s weergaven</string>
|
||||||
<string name="title_instance_login">Instantie host</string>
|
<string name="title_instance_login">Instantie host</string>
|
||||||
<string name="uploading">Uploaden, wacht even…</string>
|
<string name="uploading">Uploaden, wacht even…</string>
|
||||||
<string name="upload_video_success">De video is geüpload!</string>
|
<string name="upload_video_success">De video is geüpload!</string>
|
||||||
@ -132,6 +133,8 @@
|
|||||||
<string name="app_logo">Logo van de applicatie</string>
|
<string name="app_logo">Logo van de applicatie</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Abonnementen</string>
|
<string name="subscriptions">Abonnementen</string>
|
||||||
|
<string name="delete_instance">Een instantie vewijderen</string>
|
||||||
|
<string name="delete_instance_confirm">Weet u zeker dat u deze instantie wilt verijderen?</string>
|
||||||
<string name="delete_comment">Een opmerking verwijderen</string>
|
<string name="delete_comment">Een opmerking verwijderen</string>
|
||||||
<string name="delete_comment_confirm">Weet u zeker dat u deze reactie wilt verwijderen?</string>
|
<string name="delete_comment_confirm">Weet u zeker dat u deze reactie wilt verwijderen?</string>
|
||||||
<string name="set_video_mode">Modus voor video\'s</string>
|
<string name="set_video_mode">Modus voor video\'s</string>
|
||||||
@ -155,7 +158,7 @@
|
|||||||
<string name="one_of_these_tags">Een van deze tags</string>
|
<string name="one_of_these_tags">Een van deze tags</string>
|
||||||
<string name="apply_filter">Filter toepassen</string>
|
<string name="apply_filter">Filter toepassen</string>
|
||||||
<string-array name="sort_by_array">
|
<string-array name="sort_by_array">
|
||||||
<item>Beste wedstrijd</item>
|
<item>Beste overeenkomst</item>
|
||||||
<item>Meest recente</item>
|
<item>Meest recente</item>
|
||||||
<item>Minst recent</item>
|
<item>Minst recent</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
@ -216,7 +219,16 @@
|
|||||||
<string name="send_comment">Reactie versturen</string>
|
<string name="send_comment">Reactie versturen</string>
|
||||||
<string name="all">Allemaal</string>
|
<string name="all">Allemaal</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Exporteren</string>
|
||||||
|
<string name="import_list">Importeren</string>
|
||||||
|
<string name="export_notification_title">Export succesvol!</string>
|
||||||
|
<string name="export_notification_content">Klik hier om de export per email te versturen</string>
|
||||||
|
<string name="export_notification_subjet">Nieuwe afspeellijst</string>
|
||||||
|
<string name="export_notification_body">Open het bijgevoegde bestand met TubeLab</string>
|
||||||
<string name="playlists">Afspeellijsten</string>
|
<string name="playlists">Afspeellijsten</string>
|
||||||
|
<string name="no_playlist">Geen afspeellijst</string>
|
||||||
<string name="display_name">Weergave naam</string>
|
<string name="display_name">Weergave naam</string>
|
||||||
<string name="action_playlist_add">Je hebt geen afspeellijsten. Tik op het \"+\"-pictogram om een nieuwe afspeellijst toe te voegen</string>
|
<string name="action_playlist_add">Je hebt geen afspeellijsten. Tik op het \"+\"-pictogram om een nieuwe afspeellijst toe te voegen</string>
|
||||||
<string name="error_display_name">U moet een displaynaam opgeven!</string>
|
<string name="error_display_name">U moet een displaynaam opgeven!</string>
|
||||||
|
@ -1,32 +1,33 @@
|
|||||||
<?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_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Filmy na liście</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Zmień układ wyświetlania filmów na liście</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="no_instances">Brak instancji!</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_more">Pokaż więcej</string>
|
||||||
<string name="set_play_screen_lock">Screen lock</string>
|
<string name="show_less">Pokaż mniej</string>
|
||||||
<string name="set_play_screen_lock_description">Keep playing videos when the screen is locked</string>
|
<string name="set_play_screen_lock">Blokada ekranu</string>
|
||||||
<string name="save">Save</string>
|
<string name="set_play_screen_lock_description">Odtwarzaj filmy kiedy ekran jest zablokowany</string>
|
||||||
<string name="enable_history">Enable history</string>
|
<string name="save">Zapisz</string>
|
||||||
<string name="change_profile_picture">Change profile picture</string>
|
<string name="enable_history">Włącz historię</string>
|
||||||
<string name="set_autoplay">Automatic playback</string>
|
<string name="change_profile_picture">Zmień zdjęcie profilowe</string>
|
||||||
<string name="set_autoplay_description">If enabled, videos will be played automatically</string>
|
<string name="set_autoplay">Automatyczne odtwarzanie</string>
|
||||||
<string name="set_fullscreen">Fullscreen</string>
|
<string name="set_autoplay_description">Jeśli włączone, filmy będą odtwarzane automatycznie</string>
|
||||||
<string name="set_fullscreen_description">Automatically open videos in fullscreen</string>
|
<string name="set_fullscreen">Pełny ekran</string>
|
||||||
<string name="set_autoplay_next_video">Automatically start playing the next video</string>
|
<string name="set_fullscreen_description">Automatycznie otwieraj filmy w trybie pełnoekranowym</string>
|
||||||
<string name="set_autoplay_next_video_description">When a video ends, follow up with the next suggested video.</string>
|
<string name="set_autoplay_next_video">Automatycznie rozpocznij odtwarzanie następnego filmu</string>
|
||||||
|
<string name="set_autoplay_next_video_description">Kiedy film się skończy, odtwórz następny sugerowany film.</string>
|
||||||
<string name="add_public_reply">Dodaj publiczną odpowiedź</string>
|
<string name="add_public_reply">Dodaj publiczną odpowiedź</string>
|
||||||
<string name="activity">Activity</string>
|
<string name="activity">Aktywność</string>
|
||||||
<string name="app">App</string>
|
<string name="app">Aplikacja</string>
|
||||||
<string name="notif_new_video">New video from your subscriptions</string>
|
<string name="notif_new_video">Nowy film z twoich subskrypcji</string>
|
||||||
<string name="notif_new_comment">New comment on your video</string>
|
<string name="notif_new_comment">Nowy komentarz do Twojego filmu</string>
|
||||||
<string name="notif_blocked">One of your video is blocked/unblocked</string>
|
<string name="notif_blocked">Jeden z Twoich filmów jest zablokowany/odblokowany</string>
|
||||||
<string name="notif_video_published">Video published (after transcoding/scheduled update)</string>
|
<string name="notif_video_published">Wideo opublikowane (po transkodowaniu/zaplanowanej aktualizacji)</string>
|
||||||
<string name="notif_video_imported">Video import finished</string>
|
<string name="notif_video_imported">Import wideo zakończony</string>
|
||||||
<string name="notif_new_followers">You or your channel(s) has a new follower</string>
|
<string name="notif_new_followers">Ty lub Twój kanał ma nowego obserwującego</string>
|
||||||
<string name="notif_video_mention">Someone mentioned you in video comments</string>
|
<string name="notif_video_mention">Ktoś wspomniał o tobie w komentarzach</string>
|
||||||
<string name="notif_abuse_received">An abuse report received a new message</string>
|
<string name="notif_abuse_received">Raport o nadużyciach otrzymał nową wiadomość</string>
|
||||||
<string name="notif_abuse_accepted">One of your abuse reports has been accepted or rejected by moderators</string>
|
<string name="notif_abuse_accepted">Jeden z Twoich raportów o nadużyciach został zaakceptowany lub odrzucony przez moderatorów</string>
|
||||||
<plurals name="number_of_replies">
|
<plurals name="number_of_replies">
|
||||||
<item quantity="one">%d odpowiedź</item>
|
<item quantity="one">%d odpowiedź</item>
|
||||||
<item quantity="few">%d odpowiedzi</item>
|
<item quantity="few">%d odpowiedzi</item>
|
||||||
@ -36,7 +37,7 @@
|
|||||||
<string name="reply">Odpowiedz</string>
|
<string name="reply">Odpowiedz</string>
|
||||||
<string name="set_theme">Motyw</string>
|
<string name="set_theme">Motyw</string>
|
||||||
<string name="set_theme_description">Zezwól na zmianę motywu aplikacji</string>
|
<string name="set_theme_description">Zezwól na zmianę motywu aplikacji</string>
|
||||||
<string name="federation_issue">The video cannot be federated!</string>
|
<string name="federation_issue">Film nie może być zfederowany!</string>
|
||||||
<string name="title_home">Początek</string>
|
<string name="title_home">Początek</string>
|
||||||
<string name="title_local">Lokalne</string>
|
<string name="title_local">Lokalne</string>
|
||||||
<string name="title_discover">Odkrywaj</string>
|
<string name="title_discover">Odkrywaj</string>
|
||||||
@ -62,24 +63,24 @@
|
|||||||
<string name="upload_video">Prześlij</string>
|
<string name="upload_video">Prześlij</string>
|
||||||
<string name="image_preview">Podgląd obrazu</string>
|
<string name="image_preview">Podgląd obrazu</string>
|
||||||
<string name="file_to_upload">Wybierz plik do przesłania</string>
|
<string name="file_to_upload">Wybierz plik do przesłania</string>
|
||||||
<string name="new_video">New video</string>
|
<string name="new_video">Nowy film</string>
|
||||||
<string name="new_blacklist">New blacklist info</string>
|
<string name="new_blacklist">Nowe informacje o czarnej liście</string>
|
||||||
<string name="new_my_video_published">Your video is published</string>
|
<string name="new_my_video_published">Twój film został opublikowany</string>
|
||||||
<string name="new_my_video_error">Error when publishing your video</string>
|
<string name="new_my_video_error">Błąd podczas publikowania filmu</string>
|
||||||
<string name="new_comment">New comment</string>
|
<string name="new_comment">Nowy komentarz</string>
|
||||||
<string name="new_follow">New follow</string>
|
<string name="new_follow">Nowy obserwujący</string>
|
||||||
<string name="channel">Kanał</string>
|
<string name="channel">Kanał</string>
|
||||||
<string name="videos">Filmy</string>
|
<string name="videos">Filmy</string>
|
||||||
<string name="channels">Kanały</string>
|
<string name="channels">Kanały</string>
|
||||||
<string name="refresh_every">Fetch every:</string>
|
<string name="refresh_every">Sprawdzaj co:</string>
|
||||||
<string-array name="refresh_time">
|
<string-array name="refresh_time">
|
||||||
<item>Never</item>
|
<item>Nigdy</item>
|
||||||
<item>15 minutes</item>
|
<item>15 minut</item>
|
||||||
<item>30 minutes</item>
|
<item>30 minut</item>
|
||||||
<item>1 hour</item>
|
<item>1 godzina</item>
|
||||||
<item>2 hours</item>
|
<item>2 godziny</item>
|
||||||
<item>6 hours</item>
|
<item>6 godzin</item>
|
||||||
<item>12 hours</item>
|
<item>12 godzin</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string name="yes">Tak</string>
|
<string name="yes">Tak</string>
|
||||||
<string name="no">Nie</string>
|
<string name="no">Nie</string>
|
||||||
@ -100,7 +101,7 @@
|
|||||||
<string name="video_uploaded_action">Dotknij tutaj, aby edytować dane filmu.</string>
|
<string name="video_uploaded_action">Dotknij tutaj, aby edytować dane filmu.</string>
|
||||||
<string name="toot_select_image_error">Podczas wyboru nośnika wystąpił błąd!</string>
|
<string name="toot_select_image_error">Podczas wyboru nośnika wystąpił błąd!</string>
|
||||||
<string name="download_file">Pobierz %1$s</string>
|
<string name="download_file">Pobierz %1$s</string>
|
||||||
<string name="account_updated">The account has been updated!</string>
|
<string name="account_updated">Konto zostało zaktualizowane!</string>
|
||||||
<string name="action_privacy">Prywatność</string>
|
<string name="action_privacy">Prywatność</string>
|
||||||
<string name="action_logout">Wyloguj</string>
|
<string name="action_logout">Wyloguj</string>
|
||||||
<string name="login">Zaloguj</string>
|
<string name="login">Zaloguj</string>
|
||||||
@ -134,6 +135,8 @@
|
|||||||
<string name="app_logo">Logo aplikacji</string>
|
<string name="app_logo">Logo aplikacji</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Abonamenty</string>
|
<string name="subscriptions">Abonamenty</string>
|
||||||
|
<string name="delete_instance">Usuń instancję</string>
|
||||||
|
<string name="delete_instance_confirm">Czy na pewno chcesz usunąć tę instancję?</string>
|
||||||
<string name="delete_comment">Usuń komentarz</string>
|
<string name="delete_comment">Usuń komentarz</string>
|
||||||
<string name="delete_comment_confirm">Czy na pewno usuniesz ten komentarz?</string>
|
<string name="delete_comment_confirm">Czy na pewno usuniesz ten komentarz?</string>
|
||||||
<string name="set_video_mode">Tryb dla filmów wideo</string>
|
<string name="set_video_mode">Tryb dla filmów wideo</string>
|
||||||
@ -148,7 +151,7 @@
|
|||||||
<string name="last_365_days">Ostatnie 365 dni</string>
|
<string name="last_365_days">Ostatnie 365 dni</string>
|
||||||
<string name="sepia_element_duration">Czas trwania</string>
|
<string name="sepia_element_duration">Czas trwania</string>
|
||||||
<string name="duration_short"><![CDATA[Krótkie (<4 min)]]></string>
|
<string name="duration_short"><![CDATA[Krótkie (<4 min)]]></string>
|
||||||
<string name="duration_medium"><![CDATA[Medium (4–10 min)]]></string>
|
<string name="duration_medium"><![CDATA[Średnia (4–10 min)]]></string>
|
||||||
<string name="duration_long"><![CDATA[Długie (> 10 min)]]></string>
|
<string name="duration_long"><![CDATA[Długie (> 10 min)]]></string>
|
||||||
<string name="display_all_categories">Wyświetl wszystkie kategorie</string>
|
<string name="display_all_categories">Wyświetl wszystkie kategorie</string>
|
||||||
<string name="display_all_licenses">Wyświetl wszystkie licencje</string>
|
<string name="display_all_licenses">Wyświetl wszystkie licencje</string>
|
||||||
@ -163,7 +166,7 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
<string name="sort_by">Sortuj według</string>
|
<string name="sort_by">Sortuj według</string>
|
||||||
<string name="sepia_search_hint">Słowo kluczowe, kanał, film itp.</string>
|
<string name="sepia_search_hint">Słowo kluczowe, kanał, film itp.</string>
|
||||||
<string name="sepia_indication">Sepia Search displays videos and channels that match your search but is not the publisher, nor the owner. If you notice any problems with a video, report it to the administrators on the PeerTube website where the video is published.</string>
|
<string name="sepia_indication">Sepia Search wyświetla filmy i kanały pasujące do Twojego wyszukiwania, ale nie jest wydawcą ani właścicielem. Jeśli zauważysz jakiekolwiek problemy z filmem, zgłoś je administratorom na stronie PeerTube, na której film jest publikowany.</string>
|
||||||
<string name="my_videos">Moje filmy</string>
|
<string name="my_videos">Moje filmy</string>
|
||||||
<string name="title">Tytuł</string>
|
<string name="title">Tytuł</string>
|
||||||
<string name="license">Licencja</string>
|
<string name="license">Licencja</string>
|
||||||
@ -212,13 +215,22 @@
|
|||||||
<string name="peertube_video_from_subscription"><![CDATA[<b>%1$s</b> publikuje nowy film: <b>%2$s</b>]]></string>
|
<string name="peertube_video_from_subscription"><![CDATA[<b>%1$s</b> publikuje nowy film: <b>%2$s</b>]]></string>
|
||||||
<string name="peertube_video_blacklist"><![CDATA[Twój film <b>%1$s</b> został umieszczony na czarnej liście]]></string>
|
<string name="peertube_video_blacklist"><![CDATA[Twój film <b>%1$s</b> został umieszczony na czarnej liście]]></string>
|
||||||
<string name="peertube_video_unblacklist"><![CDATA[Twój film <b>%1$s</b> został usunięty z czarnej listy]]></string>
|
<string name="peertube_video_unblacklist"><![CDATA[Twój film <b>%1$s</b> został usunięty z czarnej listy]]></string>
|
||||||
<string name="peertube_video_report_success"><![CDATA[Your abuse report <b>%1$s</b> has been accepted]]></string>
|
<string name="peertube_video_report_success"><![CDATA[Twój raport o nadużyciach <b>%1$s</b> został zaakceptowany]]></string>
|
||||||
<string name="peertube_video_abuse"><![CDATA[Nowe zgłoszenie nadużycia dla filmu: <b>%1$s</b>]]></string>
|
<string name="peertube_video_abuse"><![CDATA[Nowe zgłoszenie nadużycia dla filmu: <b>%1$s</b>]]></string>
|
||||||
<string name="add_public_comment">Dodaj publiczny komentarz</string>
|
<string name="add_public_comment">Dodaj publiczny komentarz</string>
|
||||||
<string name="send_comment">Prześlij komentarz</string>
|
<string name="send_comment">Prześlij komentarz</string>
|
||||||
<string name="all">Wszystkie</string>
|
<string name="all">Wszystkie</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Eksportuj</string>
|
||||||
|
<string name="import_list">Importuj</string>
|
||||||
|
<string name="export_notification_title">Eksport zakończony sukcesem!</string>
|
||||||
|
<string name="export_notification_content">Dotknij tutaj, aby wysłać eksport przez e-mail</string>
|
||||||
|
<string name="export_notification_subjet">Nowa playlista</string>
|
||||||
|
<string name="export_notification_body">Otwórz załączony plik przez TubeLab</string>
|
||||||
<string name="playlists">Listy odtwarzania</string>
|
<string name="playlists">Listy odtwarzania</string>
|
||||||
|
<string name="no_playlist">Brak playlist</string>
|
||||||
<string name="display_name">Wyświetlana nazwa</string>
|
<string name="display_name">Wyświetlana nazwa</string>
|
||||||
<string name="action_playlist_add">Nie masz żadnej playlisty. Stuknij ikonę \"+\", aby dodać nową listę odtwarzania</string>
|
<string name="action_playlist_add">Nie masz żadnej playlisty. Stuknij ikonę \"+\", aby dodać nową listę odtwarzania</string>
|
||||||
<string name="error_display_name">Musisz podać nazwę wyświetlacza!</string>
|
<string name="error_display_name">Musisz podać nazwę wyświetlacza!</string>
|
||||||
@ -248,7 +260,7 @@
|
|||||||
<string-array name="settings_video_mode">
|
<string-array name="settings_video_mode">
|
||||||
<item>Normalny</item>
|
<item>Normalny</item>
|
||||||
<item>Webview</item>
|
<item>Webview</item>
|
||||||
<item>Magnet</item>
|
<item>Magnes</item>
|
||||||
<item>Torrent</item>
|
<item>Torrent</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="settings_theme">
|
<string-array name="settings_theme">
|
||||||
@ -305,7 +317,7 @@
|
|||||||
<string name="pickup_categories">Kategorie wyboru</string>
|
<string name="pickup_categories">Kategorie wyboru</string>
|
||||||
<string name="pickup_languages">Wybieranie języków</string>
|
<string name="pickup_languages">Wybieranie języków</string>
|
||||||
<string name="notification_channel_name">Aktualizacja informacji</string>
|
<string name="notification_channel_name">Aktualizacja informacji</string>
|
||||||
<string name="fetch_notification_channel_name">Fetch notifications</string>
|
<string name="fetch_notification_channel_name">Sprawdź powiadomienia</string>
|
||||||
<string name="add_account">Dodaj konto</string>
|
<string name="add_account">Dodaj konto</string>
|
||||||
<string name="list_of_accounts">Lista rachunków</string>
|
<string name="list_of_accounts">Lista rachunków</string>
|
||||||
<string name="pause">Przerwa</string>
|
<string name="pause">Przerwa</string>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Videos in list</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="show_more">Show more</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_less">Show less</string>
|
||||||
<string name="set_play_screen_lock">Screen lock</string>
|
<string name="set_play_screen_lock">Screen lock</string>
|
||||||
@ -132,6 +133,8 @@
|
|||||||
<string name="app_logo">Logótipo do aplicativo</string>
|
<string name="app_logo">Logótipo do aplicativo</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Inscrições</string>
|
<string name="subscriptions">Inscrições</string>
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
<string name="delete_comment">Excluir comentário</string>
|
<string name="delete_comment">Excluir comentário</string>
|
||||||
<string name="delete_comment_confirm">Tem certeza de que deseja excluir este comentário?</string>
|
<string name="delete_comment_confirm">Tem certeza de que deseja excluir este comentário?</string>
|
||||||
<string name="set_video_mode">Modo para vídeos</string>
|
<string name="set_video_mode">Modo para vídeos</string>
|
||||||
@ -216,7 +219,16 @@
|
|||||||
<string name="send_comment">Enviar comentário</string>
|
<string name="send_comment">Enviar comentário</string>
|
||||||
<string name="all">Tudo</string>
|
<string name="all">Tudo</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">Listas de reprodução</string>
|
<string name="playlists">Listas de reprodução</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">Nome de exibição</string>
|
<string name="display_name">Nome de exibição</string>
|
||||||
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
||||||
<string name="error_display_name">Você deve inserir um nome de exibição!</string>
|
<string name="error_display_name">Você deve inserir um nome de exibição!</string>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Videos in list</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="show_more">Show more</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_less">Show less</string>
|
||||||
<string name="set_play_screen_lock">Screen lock</string>
|
<string name="set_play_screen_lock">Screen lock</string>
|
||||||
@ -133,6 +134,8 @@
|
|||||||
<string name="app_logo">Logo of the application</string>
|
<string name="app_logo">Logo of the application</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Subscriptions</string>
|
<string name="subscriptions">Subscriptions</string>
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
<string name="delete_comment">Delete a comment</string>
|
<string name="delete_comment">Delete a comment</string>
|
||||||
<string name="delete_comment_confirm">Are you sure to delete this comment?</string>
|
<string name="delete_comment_confirm">Are you sure to delete this comment?</string>
|
||||||
<string name="set_video_mode">Mode for videos</string>
|
<string name="set_video_mode">Mode for videos</string>
|
||||||
@ -217,7 +220,16 @@
|
|||||||
<string name="send_comment">Send comment</string>
|
<string name="send_comment">Send comment</string>
|
||||||
<string name="all">All</string>
|
<string name="all">All</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">Playlists</string>
|
<string name="playlists">Playlists</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">Display name</string>
|
<string name="display_name">Display name</string>
|
||||||
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
||||||
<string name="error_display_name">You must provide a display name!</string>
|
<string name="error_display_name">You must provide a display name!</string>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Видео в списке</string>
|
<string name="set_video_in_list">Видео в списке</string>
|
||||||
<string name="set_video_in_list_description">Изменить расположение для отображения видео в списке</string>
|
<string name="set_video_in_list_description">Изменить расположение для отображения видео в списке</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Показать еще</string>
|
<string name="show_more">Показать еще</string>
|
||||||
<string name="show_less">Показать меньше</string>
|
<string name="show_less">Показать меньше</string>
|
||||||
<string name="set_play_screen_lock">Блокировка экрана</string>
|
<string name="set_play_screen_lock">Блокировка экрана</string>
|
||||||
@ -134,6 +135,8 @@
|
|||||||
<string name="app_logo">Логотип приложения</string>
|
<string name="app_logo">Логотип приложения</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Подписки</string>
|
<string name="subscriptions">Подписки</string>
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
<string name="delete_comment">Удалить комментарий</string>
|
<string name="delete_comment">Удалить комментарий</string>
|
||||||
<string name="delete_comment_confirm">Вы уверены, что хотите удалить этот комментарий?</string>
|
<string name="delete_comment_confirm">Вы уверены, что хотите удалить этот комментарий?</string>
|
||||||
<string name="set_video_mode">Режим для видео</string>
|
<string name="set_video_mode">Режим для видео</string>
|
||||||
@ -218,7 +221,16 @@
|
|||||||
<string name="send_comment">Оставить комментарий</string>
|
<string name="send_comment">Оставить комментарий</string>
|
||||||
<string name="all">Все</string>
|
<string name="all">Все</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">Плейлисты</string>
|
<string name="playlists">Плейлисты</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">Отображаемое имя</string>
|
<string name="display_name">Отображаемое имя</string>
|
||||||
<string name="action_playlist_add">У вас нет плейлистов. Нажмите на \"+\", чтобы добавить новый</string>
|
<string name="action_playlist_add">У вас нет плейлистов. Нажмите на \"+\", чтобы добавить новый</string>
|
||||||
<string name="error_display_name">Вы должны указать отображаемое имя!</string>
|
<string name="error_display_name">Вы должны указать отображаемое имя!</string>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Videos in list</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="show_more">Show more</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_less">Show less</string>
|
||||||
<string name="set_play_screen_lock">Screen lock</string>
|
<string name="set_play_screen_lock">Screen lock</string>
|
||||||
@ -132,6 +133,8 @@
|
|||||||
<string name="app_logo">Applikationens logo</string>
|
<string name="app_logo">Applikationens logo</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Prenumerationer</string>
|
<string name="subscriptions">Prenumerationer</string>
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
<string name="delete_comment">Ta bort kommentar</string>
|
<string name="delete_comment">Ta bort kommentar</string>
|
||||||
<string name="delete_comment_confirm">Är du säker på att ta bort denna kommentar?</string>
|
<string name="delete_comment_confirm">Är du säker på att ta bort denna kommentar?</string>
|
||||||
<string name="set_video_mode">Lägen för video</string>
|
<string name="set_video_mode">Lägen för video</string>
|
||||||
@ -216,7 +219,16 @@
|
|||||||
<string name="send_comment">Skicka kommentar</string>
|
<string name="send_comment">Skicka kommentar</string>
|
||||||
<string name="all">Allt</string>
|
<string name="all">Allt</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">Spellistor</string>
|
<string name="playlists">Spellistor</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">Visningsnamn</string>
|
<string name="display_name">Visningsnamn</string>
|
||||||
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
||||||
<string name="error_display_name">Du måste ange ett visningsnamn!</string>
|
<string name="error_display_name">Du måste ange ett visningsnamn!</string>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Videos in list</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="show_more">Show more</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_less">Show less</string>
|
||||||
<string name="set_play_screen_lock">Screen lock</string>
|
<string name="set_play_screen_lock">Screen lock</string>
|
||||||
@ -131,6 +132,8 @@
|
|||||||
<string name="app_logo">应用程序的标志</string>
|
<string name="app_logo">应用程序的标志</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">订阅列表</string>
|
<string name="subscriptions">订阅列表</string>
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
<string name="delete_comment">删除评论</string>
|
<string name="delete_comment">删除评论</string>
|
||||||
<string name="delete_comment_confirm">您确定要删除此评论吗?</string>
|
<string name="delete_comment_confirm">您确定要删除此评论吗?</string>
|
||||||
<string name="set_video_mode">视频播放模式</string>
|
<string name="set_video_mode">视频播放模式</string>
|
||||||
@ -215,7 +218,16 @@
|
|||||||
<string name="send_comment">发送评论</string>
|
<string name="send_comment">发送评论</string>
|
||||||
<string name="all">全部</string>
|
<string name="all">全部</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">播放列表</string>
|
<string name="playlists">播放列表</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">显示昵称</string>
|
<string name="display_name">显示昵称</string>
|
||||||
<string name="action_playlist_add">您没有任何播放列表,点击 + 号添加一个新的播放列表</string>
|
<string name="action_playlist_add">您没有任何播放列表,点击 + 号添加一个新的播放列表</string>
|
||||||
<string name="error_display_name">您必须指定一个昵称!</string>
|
<string name="error_display_name">您必须指定一个昵称!</string>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="set_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Videos in list</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="show_more">Show more</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_less">Show less</string>
|
||||||
<string name="set_play_screen_lock">Screen lock</string>
|
<string name="set_play_screen_lock">Screen lock</string>
|
||||||
@ -131,6 +132,8 @@
|
|||||||
<string name="app_logo">應用程式圖示</string>
|
<string name="app_logo">應用程式圖示</string>
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">訂閱</string>
|
<string name="subscriptions">訂閱</string>
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
<string name="delete_comment">刪除留言</string>
|
<string name="delete_comment">刪除留言</string>
|
||||||
<string name="delete_comment_confirm">您想要刪除此留言嗎?</string>
|
<string name="delete_comment_confirm">您想要刪除此留言嗎?</string>
|
||||||
<string name="set_video_mode">影片模式</string>
|
<string name="set_video_mode">影片模式</string>
|
||||||
@ -215,7 +218,16 @@
|
|||||||
<string name="send_comment">傳送留言</string>
|
<string name="send_comment">傳送留言</string>
|
||||||
<string name="all">全部</string>
|
<string name="all">全部</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
<string name="playlists">播放清單</string>
|
<string name="playlists">播放清單</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">顯示名稱</string>
|
<string name="display_name">顯示名稱</string>
|
||||||
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
||||||
<string name="error_display_name">您必須提供顯示名稱!</string>
|
<string name="error_display_name">您必須提供顯示名稱!</string>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<string name="set_video_sensitive_choice" translatable="false">set_video_sensitive_choice</string>
|
<string name="set_video_sensitive_choice" translatable="false">set_video_sensitive_choice</string>
|
||||||
<string name="set_video_in_list">Videos in list</string>
|
<string name="set_video_in_list">Videos in list</string>
|
||||||
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
<string name="set_video_in_list_description">Change the layout for displaying videos in a list</string>
|
||||||
|
<string name="no_instances">No instances !</string>
|
||||||
<string name="show_more">Show more</string>
|
<string name="show_more">Show more</string>
|
||||||
<string name="show_less">Show less</string>
|
<string name="show_less">Show less</string>
|
||||||
|
|
||||||
@ -180,6 +180,9 @@
|
|||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
<string name="subscriptions">Subscriptions</string>
|
<string name="subscriptions">Subscriptions</string>
|
||||||
|
|
||||||
|
<string name="delete_instance">Delete an instance</string>
|
||||||
|
<string name="delete_instance_confirm">Are you sure to delete this instance?</string>
|
||||||
|
|
||||||
<string name="delete_comment">Delete a comment</string>
|
<string name="delete_comment">Delete a comment</string>
|
||||||
<string name="delete_comment_confirm">Are you sure to delete this comment?</string>
|
<string name="delete_comment_confirm">Are you sure to delete this comment?</string>
|
||||||
<string name="set_video_mode">Mode for videos</string>
|
<string name="set_video_mode">Mode for videos</string>
|
||||||
@ -280,7 +283,19 @@
|
|||||||
<string name="all">All</string>
|
<string name="all">All</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
|
||||||
|
|
||||||
|
<string name="delete_history">Delete videos history</string>
|
||||||
|
<string name="delete_history_confirm">Are you sure you want to delete all your videos history?</string>
|
||||||
|
|
||||||
|
<string name="export_list">Export</string>
|
||||||
|
<string name="import_list">Import</string>
|
||||||
|
<string name="export_notification_title">Successful export!</string>
|
||||||
|
<string name="export_notification_content">Tap here to send the export by email</string>
|
||||||
|
<string name="export_notification_subjet">New Playlist</string>
|
||||||
|
<string name="export_notification_body">Open the attached file with TubeLab</string>
|
||||||
|
|
||||||
<string name="playlists">Playlists</string>
|
<string name="playlists">Playlists</string>
|
||||||
|
<string name="no_playlist">No playlists</string>
|
||||||
<string name="display_name">Display name</string>
|
<string name="display_name">Display name</string>
|
||||||
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
<string name="action_playlist_add">You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist</string>
|
||||||
<string name="error_display_name">You must provide a display name!</string>
|
<string name="error_display_name">You must provide a display name!</string>
|
||||||
|
7
app/src/full/res/xml/file_paths.xml
Normal file
7
app/src/full/res/xml/file_paths.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<external-path
|
||||||
|
name="my_images"
|
||||||
|
path="/TubeLab/" />
|
||||||
|
|
||||||
|
</paths>
|
37
app/src/google_acad/AndroidManifest.xml
Normal file
37
app/src/google_acad/AndroidManifest.xml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="app.fedilab.fedilabtube">
|
||||||
|
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".FedilabTube"
|
||||||
|
android:allowBackup="false"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme"
|
||||||
|
tools:replace="android:allowBackup">
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
tools:node="merge">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="content" />
|
||||||
|
<data android:scheme="file" />
|
||||||
|
<data android:mimeType="*/*" />
|
||||||
|
<data android:pathPattern=".*\\.tubelab" />
|
||||||
|
<data android:pathPattern=".*\\..*\\.tubelab" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\.tubelab" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\.tubelab" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.tubelab" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.tubelab" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
</manifest>
|
@ -83,7 +83,11 @@
|
|||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".AllLocalPlaylistsActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".InstancePickerActivity"
|
android:name=".InstancePickerActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
@ -95,6 +99,11 @@
|
|||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".LocalPlaylistsActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".VideosTimelineActivity"
|
android:name=".VideosTimelineActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
@ -105,6 +114,11 @@
|
|||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/sepia_search"
|
android:label="@string/sepia_search"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".ManageInstancesActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/instances_picker"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".WebviewActivity"
|
android:name=".WebviewActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
@ -156,6 +170,17 @@
|
|||||||
android:authorities="${applicationId}.workmanager-init"
|
android:authorities="${applicationId}.workmanager-init"
|
||||||
tools:node="remove"
|
tools:node="remove"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
android:authorities="${applicationId}.fileProvider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/file_paths" />
|
||||||
|
</provider>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -37,19 +37,18 @@ import androidx.fragment.app.FragmentStatePagerAdapter;
|
|||||||
import androidx.viewpager.widget.PagerAdapter;
|
import androidx.viewpager.widget.PagerAdapter;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
||||||
import app.fedilab.fedilabtube.drawer.OwnAccountsAdapter;
|
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayNotificationsFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayNotificationsFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.SwitchAccountHelper;
|
||||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
|
||||||
@ -99,6 +98,8 @@ public class AccountActivity extends AppCompatActivity {
|
|||||||
displayname.setText(account.getDisplayName());
|
displayname.setText(account.getDisplayName());
|
||||||
|
|
||||||
instanceView.setText(account.getHost());
|
instanceView.setText(account.getHost());
|
||||||
|
FloatingActionButton edit_profile = findViewById(R.id.edit_profile);
|
||||||
|
edit_profile.setOnClickListener(v -> startActivity(new Intent(AccountActivity.this, MyAccountActivity.class)));
|
||||||
|
|
||||||
Button logout_button = findViewById(R.id.logout_button);
|
Button logout_button = findViewById(R.id.logout_button);
|
||||||
logout_button.setOnClickListener(v -> {
|
logout_button.setOnClickListener(v -> {
|
||||||
@ -210,42 +211,7 @@ public class AccountActivity extends AppCompatActivity {
|
|||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_add_account) {
|
} else if (item.getItemId() == R.id.action_add_account) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SwitchAccountHelper.switchDialog(AccountActivity.this, true);
|
||||||
List<Account> accounts = new AccountDAO(AccountActivity.this, db).getAllAccount();
|
|
||||||
|
|
||||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(AccountActivity.this);
|
|
||||||
builderSingle.setTitle(getString(R.string.list_of_accounts));
|
|
||||||
if (accounts != null) {
|
|
||||||
final OwnAccountsAdapter accountsListAdapter = new OwnAccountsAdapter(AccountActivity.this, accounts);
|
|
||||||
final Account[] accountArray = new Account[accounts.size()];
|
|
||||||
int i = 0;
|
|
||||||
for (Account account : accounts) {
|
|
||||||
accountArray[i] = account;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
builderSingle.setAdapter(accountsListAdapter, (dialog, which) -> {
|
|
||||||
final Account account = accountArray[which];
|
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
|
||||||
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, account.getToken());
|
|
||||||
editor.putString(Helper.PREF_INSTANCE, account.getHost());
|
|
||||||
editor.putString(Helper.PREF_KEY_ID, account.getId());
|
|
||||||
editor.putString(Helper.PREF_KEY_NAME, account.getUsername());
|
|
||||||
editor.apply();
|
|
||||||
dialog.dismiss();
|
|
||||||
Intent intent = new Intent(AccountActivity.this, MainActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
finish();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
builderSingle.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
|
||||||
builderSingle.setPositiveButton(R.string.add_account, (dialog, which) -> {
|
|
||||||
Intent intent = new Intent(AccountActivity.this, LoginActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
finish();
|
|
||||||
});
|
|
||||||
|
|
||||||
builderSingle.show();
|
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,120 @@
|
|||||||
|
package app.fedilab.fedilabtube;
|
||||||
|
/* 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.os.Bundle;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.client.data.PlaylistData.Playlist;
|
||||||
|
import app.fedilab.fedilabtube.client.data.VideoPlaylistData;
|
||||||
|
import app.fedilab.fedilabtube.drawer.PlaylistAdapter;
|
||||||
|
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
||||||
|
|
||||||
|
|
||||||
|
public class AllLocalPlaylistsActivity extends AppCompatActivity implements PlaylistAdapter.AllPlaylistRemoved {
|
||||||
|
|
||||||
|
|
||||||
|
PlaylistAdapter playlistAdapter;
|
||||||
|
private RelativeLayout mainLoader;
|
||||||
|
private RelativeLayout textviewNoAction;
|
||||||
|
private List<Playlist> playlists;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
setContentView(R.layout.activity_all_playlist);
|
||||||
|
|
||||||
|
if (getSupportActionBar() != null)
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
setTitle(R.string.playlists);
|
||||||
|
|
||||||
|
|
||||||
|
textviewNoAction = findViewById(R.id.no_action);
|
||||||
|
mainLoader = findViewById(R.id.loader);
|
||||||
|
RelativeLayout nextElementLoader = findViewById(R.id.loading_next_items);
|
||||||
|
mainLoader.setVisibility(View.VISIBLE);
|
||||||
|
nextElementLoader.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
PlaylistsVM viewModel = new ViewModelProvider(AllLocalPlaylistsActivity.this).get(PlaylistsVM.class);
|
||||||
|
viewModel.localePlaylist().observe(AllLocalPlaylistsActivity.this, this::manageVIewPlaylists);
|
||||||
|
|
||||||
|
FloatingActionButton add_new = findViewById(R.id.add_new);
|
||||||
|
add_new.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
TextView no_action_text = findViewById(R.id.no_action_text);
|
||||||
|
no_action_text.setText(R.string.no_playlist);
|
||||||
|
playlists = new ArrayList<>();
|
||||||
|
RecyclerView lv_playlist = findViewById(R.id.lv_playlist);
|
||||||
|
playlistAdapter = new PlaylistAdapter(playlists, true);
|
||||||
|
playlistAdapter.allPlaylistRemoved = this;
|
||||||
|
lv_playlist.setAdapter(playlistAdapter);
|
||||||
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(AllLocalPlaylistsActivity.this);
|
||||||
|
lv_playlist.setLayoutManager(mLayoutManager);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == android.R.id.home) {
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void manageVIewPlaylists(List<VideoPlaylistData.VideoPlaylistExport> videoPlaylistExports) {
|
||||||
|
mainLoader.setVisibility(View.GONE);
|
||||||
|
if (videoPlaylistExports == null) {
|
||||||
|
textviewNoAction.setVisibility(View.VISIBLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (videoPlaylistExports.size() > 0) {
|
||||||
|
for (VideoPlaylistData.VideoPlaylistExport videoPlaylistExport : videoPlaylistExports) {
|
||||||
|
playlists.add(videoPlaylistExport.getPlaylist());
|
||||||
|
}
|
||||||
|
playlistAdapter.notifyDataSetChanged();
|
||||||
|
textviewNoAction.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
textviewNoAction.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAllPlaylistRemoved() {
|
||||||
|
textviewNoAction.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -29,7 +29,6 @@ import android.widget.ArrayAdapter;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -37,6 +36,8 @@ import android.widget.Toast;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ import es.dmoral.toasty.Toasty;
|
|||||||
import static app.fedilab.fedilabtube.MainActivity.peertubeInformation;
|
import static app.fedilab.fedilabtube.MainActivity.peertubeInformation;
|
||||||
|
|
||||||
|
|
||||||
public class AllPlaylistsActivity extends AppCompatActivity {
|
public class AllPlaylistsActivity extends AppCompatActivity implements PlaylistAdapter.AllPlaylistRemoved {
|
||||||
|
|
||||||
|
|
||||||
PlaylistAdapter playlistAdapter;
|
PlaylistAdapter playlistAdapter;
|
||||||
@ -109,10 +110,12 @@ public class AllPlaylistsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
playlists = new ArrayList<>();
|
playlists = new ArrayList<>();
|
||||||
ListView lv_playlist = findViewById(R.id.lv_playlist);
|
RecyclerView lv_playlist = findViewById(R.id.lv_playlist);
|
||||||
playlistAdapter = new PlaylistAdapter(AllPlaylistsActivity.this, playlists, textviewNoAction);
|
playlistAdapter = new PlaylistAdapter(playlists, false);
|
||||||
|
playlistAdapter.allPlaylistRemoved = this;
|
||||||
lv_playlist.setAdapter(playlistAdapter);
|
lv_playlist.setAdapter(playlistAdapter);
|
||||||
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(AllPlaylistsActivity.this);
|
||||||
|
lv_playlist.setLayoutManager(mLayoutManager);
|
||||||
add_new.setOnClickListener(view -> manageAlert(null));
|
add_new.setOnClickListener(view -> manageAlert(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,4 +381,9 @@ public class AllPlaylistsActivity extends AppCompatActivity {
|
|||||||
set_upload_channel.setSelection(position);
|
set_upload_channel.setSelection(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAllPlaylistRemoved() {
|
||||||
|
textviewNoAction.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public class FedilabTube extends MultiDexApplication {
|
|||||||
.setMinimumLoggingLevel(android.util.Log.INFO)
|
.setMinimumLoggingLevel(android.util.Log.INFO)
|
||||||
.build();
|
.build();
|
||||||
WorkManager.initialize(FedilabTube.this, myConfig);
|
WorkManager.initialize(FedilabTube.this, myConfig);
|
||||||
if( interval >= 15 ) {
|
if (interval >= 15) {
|
||||||
WorkHelper.fetchNotifications(this, interval);
|
WorkHelper.fetchNotifications(this, interval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,79 @@
|
|||||||
|
package app.fedilab.fedilabtube;
|
||||||
|
/* 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.os.Bundle;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.client.data.PlaylistData;
|
||||||
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
public class LocalPlaylistsActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
if (getSupportActionBar() != null)
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
|
||||||
|
setContentView(R.layout.activity_playlists);
|
||||||
|
|
||||||
|
|
||||||
|
PlaylistData.Playlist playlist;
|
||||||
|
Bundle b = getIntent().getExtras();
|
||||||
|
if (b != null) {
|
||||||
|
playlist = b.getParcelable("playlist");
|
||||||
|
if (playlist == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toasty.error(LocalPlaylistsActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setTitle(playlist.getDisplayName());
|
||||||
|
if (savedInstanceState == null) {
|
||||||
|
DisplayVideosFragment displayVideosFragment = new DisplayVideosFragment();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable(Helper.TIMELINE_TYPE, TimelineVM.TimelineType.VIDEOS_IN_LOCAL_PLAYLIST);
|
||||||
|
bundle.putSerializable("playlistId", playlist.getUuid());
|
||||||
|
displayVideosFragment.setArguments(bundle);
|
||||||
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
|
ft.add(R.id.nav_host_fragment, displayVideosFragment).commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == android.R.id.home) {
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -101,7 +101,6 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!BuildConfig.full_instances) {
|
if (!BuildConfig.full_instances) {
|
||||||
binding.loginUid.setOnFocusChangeListener((v, hasFocus) -> {
|
binding.loginUid.setOnFocusChangeListener((v, hasFocus) -> {
|
||||||
if (!hasFocus) {
|
if (!hasFocus) {
|
||||||
@ -142,7 +141,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
instance = host = binding.loginInstance.getText().toString().trim().toLowerCase();
|
instance = host = binding.loginInstance.getText().toString().trim().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( instance.startsWith("http")) {
|
if (instance.startsWith("http")) {
|
||||||
try {
|
try {
|
||||||
URL url = new URL(instance);
|
URL url = new URL(instance);
|
||||||
instance = url.getHost();
|
instance = url.getHost();
|
||||||
@ -151,7 +150,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Patterns.WEB_URL.matcher("https://"+instance).matches()) {
|
if (!Patterns.WEB_URL.matcher("https://" + instance).matches()) {
|
||||||
Toasty.error(LoginActivity.this, getString(R.string.not_valide_instance)).show();
|
Toasty.error(LoginActivity.this, getString(R.string.not_valide_instance)).show();
|
||||||
binding.loginButton.setEnabled(true);
|
binding.loginButton.setEnabled(true);
|
||||||
return;
|
return;
|
||||||
@ -216,7 +215,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
oauthParams.setGrant_type("password");
|
oauthParams.setGrant_type("password");
|
||||||
oauthParams.setScope("user");
|
oauthParams.setScope("user");
|
||||||
oauthParams.setUsername(binding.loginUid.getText().toString().trim());
|
oauthParams.setUsername(binding.loginUid.getText().toString().trim());
|
||||||
if( binding.loginPasswd.getText() != null) {
|
if (binding.loginPasswd.getText() != null) {
|
||||||
oauthParams.setPassword(binding.loginPasswd.getText().toString());
|
oauthParams.setPassword(binding.loginPasswd.getText().toString());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -26,8 +26,11 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
@ -36,7 +39,6 @@ import androidx.appcompat.widget.SearchView;
|
|||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
|
||||||
|
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
import com.kobakei.ratethisapp.RateThisApp;
|
import com.kobakei.ratethisapp.RateThisApp;
|
||||||
@ -52,7 +54,7 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
||||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||||
import app.fedilab.fedilabtube.client.entities.Error;
|
import app.fedilab.fedilabtube.client.entities.Error;
|
||||||
import app.fedilab.fedilabtube.client.entities.OauthParams;
|
import app.fedilab.fedilabtube.client.entities.OauthParams;
|
||||||
import app.fedilab.fedilabtube.client.entities.PeertubeInformation;
|
import app.fedilab.fedilabtube.client.entities.PeertubeInformation;
|
||||||
@ -63,13 +65,17 @@ import app.fedilab.fedilabtube.client.entities.WellKnownNodeinfo;
|
|||||||
import app.fedilab.fedilabtube.fragment.DisplayOverviewFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayOverviewFragment;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.PlaylistExportHelper;
|
||||||
|
import app.fedilab.fedilabtube.helper.SwitchAccountHelper;
|
||||||
import app.fedilab.fedilabtube.services.RetrieveInfoService;
|
import app.fedilab.fedilabtube.services.RetrieveInfoService;
|
||||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
import app.fedilab.fedilabtube.viewmodel.SearchVM;
|
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.NORMAL;
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.SURFING;
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.academies;
|
import static app.fedilab.fedilabtube.helper.Helper.academies;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
@ -77,33 +83,34 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
public static PeertubeInformation peertubeInformation;
|
public static PeertubeInformation peertubeInformation;
|
||||||
|
|
||||||
public static int PICK_INSTANCE = 5641;
|
public static int PICK_INSTANCE = 5641;
|
||||||
|
public static int PICK_INSTANCE_SURF = 5642;
|
||||||
|
public static UserMe userMe;
|
||||||
|
public static TypeOfConnection typeOfConnection;
|
||||||
final FragmentManager fm = getSupportFragmentManager();
|
final FragmentManager fm = getSupportFragmentManager();
|
||||||
Fragment active;
|
Fragment active;
|
||||||
private DisplayVideosFragment recentFragment, locaFragment, trendingFragment, subscriptionFragment, mostLikedFragment;
|
private DisplayVideosFragment recentFragment, locaFragment, trendingFragment, subscriptionFragment, mostLikedFragment;
|
||||||
private DisplayOverviewFragment overviewFragment;
|
private DisplayOverviewFragment overviewFragment;
|
||||||
public static UserMe userMe;
|
|
||||||
|
|
||||||
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||||
= item -> {
|
= item -> {
|
||||||
DisplayVideosFragment displayVideosFragment = null;
|
DisplayVideosFragment displayVideosFragment = null;
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
if (itemId == R.id.navigation_subscription) {
|
if (itemId == R.id.navigation_subscription) {
|
||||||
displayVideosFragment = subscriptionFragment;
|
displayVideosFragment = subscriptionFragment;
|
||||||
setTitle(R.string.subscriptions);
|
setTitleCustom(R.string.subscriptions);
|
||||||
} else if (itemId == R.id.navigation_trending) {
|
} else if (itemId == R.id.navigation_trending) {
|
||||||
setTitle(R.string.title_trending);
|
setTitleCustom(R.string.title_trending);
|
||||||
displayVideosFragment = trendingFragment;
|
displayVideosFragment = trendingFragment;
|
||||||
} else if (itemId == R.id.navigation_most_liked) {
|
} else if (itemId == R.id.navigation_most_liked) {
|
||||||
setTitle(R.string.title_most_liked);
|
setTitleCustom(R.string.title_most_liked);
|
||||||
displayVideosFragment = mostLikedFragment;
|
displayVideosFragment = mostLikedFragment;
|
||||||
} else if (itemId == R.id.navigation_recently_added) {
|
} else if (itemId == R.id.navigation_recently_added) {
|
||||||
setTitle(R.string.title_recently_added);
|
setTitleCustom(R.string.title_recently_added);
|
||||||
displayVideosFragment = recentFragment;
|
displayVideosFragment = recentFragment;
|
||||||
} else if (itemId == R.id.navigation_local) {
|
} else if (itemId == R.id.navigation_local) {
|
||||||
setTitle(R.string.title_local);
|
setTitleCustom(R.string.title_local);
|
||||||
displayVideosFragment = locaFragment;
|
displayVideosFragment = locaFragment;
|
||||||
} else if (itemId == R.id.navigation_discover) {
|
} else if (itemId == R.id.navigation_discover) {
|
||||||
setTitle(R.string.title_discover);
|
setTitleCustom(R.string.title_discover);
|
||||||
fm.beginTransaction().hide(active).show(overviewFragment).commit();
|
fm.beginTransaction().hide(active).show(overviewFragment).commit();
|
||||||
active = overviewFragment;
|
active = overviewFragment;
|
||||||
return true;
|
return true;
|
||||||
@ -117,6 +124,71 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@SuppressLint("ApplySharedPref")
|
||||||
|
public static void showRadioButtonDialogFullInstances(Activity activity, boolean storeInDb) {
|
||||||
|
final SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
AlertDialog.Builder alt_bld = new AlertDialog.Builder(activity);
|
||||||
|
alt_bld.setTitle(R.string.instance_choice);
|
||||||
|
String instance = Helper.getLiveInstance(activity);
|
||||||
|
final EditText input = new EditText(activity);
|
||||||
|
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT);
|
||||||
|
input.setLayoutParams(lp);
|
||||||
|
alt_bld.setView(input);
|
||||||
|
input.setText(instance);
|
||||||
|
alt_bld.setPositiveButton(R.string.validate,
|
||||||
|
(dialog, which) -> new Thread(() -> {
|
||||||
|
try {
|
||||||
|
String newInstance = input.getText().toString().trim();
|
||||||
|
WellKnownNodeinfo.NodeInfo instanceNodeInfo = new RetrofitPeertubeAPI(activity, newInstance, null).getNodeInfo();
|
||||||
|
if (instanceNodeInfo.getSoftware() != null && instanceNodeInfo.getSoftware().getName().trim().toLowerCase().compareTo("peertube") == 0) {
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putString(Helper.PREF_INSTANCE, newInstance);
|
||||||
|
editor.commit();
|
||||||
|
if (storeInDb) {
|
||||||
|
newInstance = newInstance.trim().toLowerCase();
|
||||||
|
InstanceData.AboutInstance aboutInstance = new RetrofitPeertubeAPI(activity, newInstance, null).getAboutInstance();
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(activity.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
new StoredInstanceDAO(activity, db).insertInstance(aboutInstance, newInstance);
|
||||||
|
activity.runOnUiThread(() -> {
|
||||||
|
dialog.dismiss();
|
||||||
|
Helper.logoutNoRemoval(activity);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
activity.runOnUiThread(() -> {
|
||||||
|
dialog.dismiss();
|
||||||
|
Intent intent = new Intent(activity, MainActivity.class);
|
||||||
|
activity.startActivity(intent);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
activity.runOnUiThread(() -> Toasty.error(activity, activity.getString(R.string.not_valide_instance), Toast.LENGTH_LONG).show());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}).start());
|
||||||
|
alt_bld.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
|
alt_bld.setNeutralButton(R.string.help, (dialog, which) -> {
|
||||||
|
Intent intent = new Intent(activity, InstancePickerActivity.class);
|
||||||
|
if (storeInDb) {
|
||||||
|
activity.startActivityForResult(intent, PICK_INSTANCE_SURF);
|
||||||
|
} else {
|
||||||
|
activity.startActivityForResult(intent, PICK_INSTANCE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog alert = alt_bld.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTitleCustom(int titleRId) {
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
TextView mTitle = toolbar.findViewById(R.id.toolbar_title);
|
||||||
|
mTitle.setText(getString(titleRId));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -125,10 +197,17 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
typeOfConnection = TypeOfConnection.UNKNOWN;
|
||||||
|
|
||||||
BottomNavigationView navView = findViewById(R.id.nav_view);
|
BottomNavigationView navView = findViewById(R.id.nav_view);
|
||||||
|
|
||||||
navView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
navView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||||
|
|
||||||
|
if (getSupportActionBar() != null) {
|
||||||
|
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||||
|
}
|
||||||
|
checkIfConnectedUsers();
|
||||||
|
|
||||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag("5");
|
Fragment fragment = getSupportFragmentManager().findFragmentByTag("5");
|
||||||
if (fragment != null)
|
if (fragment != null)
|
||||||
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
||||||
@ -192,9 +271,10 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setTitle(R.string.title_discover);
|
setTitleCustom(R.string.title_discover);
|
||||||
|
|
||||||
if (Helper.isLoggedIn(MainActivity.this)) {
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
|
|
||||||
navView.inflateMenu(R.menu.bottom_nav_menu_connected);
|
navView.inflateMenu(R.menu.bottom_nav_menu_connected);
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
@ -204,7 +284,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
String instanceShar = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instanceShar = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
String userIdShar = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userIdShar = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
Account account = new AccountDAO(MainActivity.this, db).getAccountByToken(tokenStr);
|
Account account = new AccountDAO(MainActivity.this, db).getAccountByToken(tokenStr);
|
||||||
if( account == null) {
|
if (account == null) {
|
||||||
account = new AccountDAO(MainActivity.this, db).getAccountByIdInstance(userIdShar, instanceShar);
|
account = new AccountDAO(MainActivity.this, db).getAccountByIdInstance(userIdShar, instanceShar);
|
||||||
}
|
}
|
||||||
if (account != null) {
|
if (account != null) {
|
||||||
@ -220,7 +300,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
if (token == null && Helper.instanceOnline(instance)) {
|
if (token == null && Helper.instanceOnline(instance)) {
|
||||||
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, finalAccount));
|
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, finalAccount));
|
||||||
return;
|
return;
|
||||||
}else if(token == null) {
|
} else if (token == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
@ -261,7 +341,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, finalAccount));
|
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, finalAccount));
|
||||||
error.printStackTrace();
|
error.printStackTrace();
|
||||||
}
|
}
|
||||||
}}).start();
|
}
|
||||||
|
}).start();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
navView.inflateMenu(R.menu.bottom_nav_menu);
|
navView.inflateMenu(R.menu.bottom_nav_menu);
|
||||||
@ -279,7 +360,9 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
RateThisApp.onCreate(this);
|
RateThisApp.onCreate(this);
|
||||||
RateThisApp.showRateDialogIfNeeded(this);
|
RateThisApp.showRateDialogIfNeeded(this);
|
||||||
}
|
}
|
||||||
|
if (!BuildConfig.full_instances) {
|
||||||
|
PlaylistExportHelper.manageIntentUrl(MainActivity.this, getIntent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startInForeground() {
|
private void startInForeground() {
|
||||||
@ -327,7 +410,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
MenuItem instanceItem = menu.findItem(R.id.action_change_instance);
|
|
||||||
MenuItem uploadItem = menu.findItem(R.id.action_upload);
|
MenuItem uploadItem = menu.findItem(R.id.action_upload);
|
||||||
MenuItem myVideosItem = menu.findItem(R.id.action_myvideos);
|
MenuItem myVideosItem = menu.findItem(R.id.action_myvideos);
|
||||||
MenuItem playslistItem = menu.findItem(R.id.action_playlist);
|
MenuItem playslistItem = menu.findItem(R.id.action_playlist);
|
||||||
@ -336,6 +419,36 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
MenuItem settingsItem = menu.findItem(R.id.action_settings);
|
MenuItem settingsItem = menu.findItem(R.id.action_settings);
|
||||||
MenuItem sepiaSearchItem = menu.findItem(R.id.action_sepia_search);
|
MenuItem sepiaSearchItem = menu.findItem(R.id.action_sepia_search);
|
||||||
MenuItem incognitoItem = menu.findItem(R.id.action_incognito);
|
MenuItem incognitoItem = menu.findItem(R.id.action_incognito);
|
||||||
|
MenuItem instanceItem = menu.findItem(R.id.action_change_instance);
|
||||||
|
MenuItem accountItem = menu.findItem(R.id.action_account);
|
||||||
|
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
ImageView instances = toolbar.findViewById(R.id.instances);
|
||||||
|
if (BuildConfig.full_instances && ((Helper.isLoggedIn(MainActivity.this) && typeOfConnection == NORMAL) || typeOfConnection == SURFING)) {
|
||||||
|
instances.setVisibility(View.VISIBLE);
|
||||||
|
instances.setOnClickListener(null);
|
||||||
|
instances.setOnClickListener(v -> {
|
||||||
|
Intent intent = new Intent(MainActivity.this, ManageInstancesActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
instances.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
switch (typeOfConnection) {
|
||||||
|
case UNKNOWN:
|
||||||
|
instanceItem.setVisible(false);
|
||||||
|
accountItem.setVisible(false);
|
||||||
|
uploadItem.setVisible(false);
|
||||||
|
myVideosItem.setVisible(false);
|
||||||
|
playslistItem.setVisible(false);
|
||||||
|
historyItem.setVisible(false);
|
||||||
|
settingsItem.setVisible(false);
|
||||||
|
mostLikedItem.setVisible(false);
|
||||||
|
incognitoItem.setVisible(false);
|
||||||
|
break;
|
||||||
|
case NORMAL:
|
||||||
|
accountItem.setVisible(true);
|
||||||
if (Helper.isLoggedIn(MainActivity.this)) {
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
instanceItem.setVisible(false);
|
instanceItem.setVisible(false);
|
||||||
uploadItem.setVisible(true);
|
uploadItem.setVisible(true);
|
||||||
@ -352,24 +465,58 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
instanceItem.setVisible(true);
|
instanceItem.setVisible(true);
|
||||||
uploadItem.setVisible(false);
|
uploadItem.setVisible(false);
|
||||||
myVideosItem.setVisible(false);
|
myVideosItem.setVisible(false);
|
||||||
playslistItem.setVisible(false);
|
playslistItem.setVisible(!BuildConfig.full_instances);
|
||||||
historyItem.setVisible(false);
|
historyItem.setVisible(false);
|
||||||
settingsItem.setVisible(true);
|
settingsItem.setVisible(true);
|
||||||
mostLikedItem.setVisible(false);
|
mostLikedItem.setVisible(false);
|
||||||
incognitoItem.setVisible(false);
|
incognitoItem.setVisible(false);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case SURFING:
|
||||||
|
instanceItem.setVisible(false);
|
||||||
|
accountItem.setVisible(true);
|
||||||
|
uploadItem.setVisible(false);
|
||||||
|
myVideosItem.setVisible(false);
|
||||||
|
playslistItem.setVisible(false);
|
||||||
|
historyItem.setVisible(false);
|
||||||
|
settingsItem.setVisible(false);
|
||||||
|
mostLikedItem.setVisible(false);
|
||||||
|
incognitoItem.setVisible(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!BuildConfig.full_instances) {
|
if (!BuildConfig.full_instances) {
|
||||||
sepiaSearchItem.setVisible(false);
|
sepiaSearchItem.setVisible(false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkIfConnectedUsers() {
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
typeOfConnection = NORMAL;
|
||||||
|
if (!Helper.isLoggedIn(MainActivity.this)) {
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
List<Account> accounts = new AccountDAO(MainActivity.this, db).getAllAccount();
|
||||||
|
if (accounts != null && accounts.size() > 0) {
|
||||||
|
//The user is not authenticated and there accounts in db. That means the user is surfing some other instances
|
||||||
|
typeOfConnection = TypeOfConnection.SURFING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
runOnUiThread(this::invalidateOptionsMenu);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == R.id.action_change_instance) {
|
if (item.getItemId() == R.id.action_change_instance) {
|
||||||
if (BuildConfig.full_instances) {
|
if (BuildConfig.full_instances) {
|
||||||
showRadioButtonDialogFullInstances();
|
showRadioButtonDialogFullInstances(MainActivity.this, false);
|
||||||
} else {
|
} else {
|
||||||
showRadioButtonDialog();
|
showRadioButtonDialog();
|
||||||
}
|
}
|
||||||
@ -379,12 +526,16 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else if (item.getItemId() == R.id.action_account) {
|
} else if (item.getItemId() == R.id.action_account) {
|
||||||
Intent intent;
|
Intent intent;
|
||||||
|
if (typeOfConnection == SURFING) {
|
||||||
|
SwitchAccountHelper.switchDialog(MainActivity.this, false);
|
||||||
|
} else {
|
||||||
if (Helper.isLoggedIn(MainActivity.this)) {
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
intent = new Intent(MainActivity.this, AccountActivity.class);
|
intent = new Intent(MainActivity.this, AccountActivity.class);
|
||||||
} else {
|
} else {
|
||||||
intent = new Intent(MainActivity.this, LoginActivity.class);
|
intent = new Intent(MainActivity.this, LoginActivity.class);
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_upload) {
|
} else if (item.getItemId() == R.id.action_upload) {
|
||||||
Intent intent = new Intent(MainActivity.this, PeertubeUploadActivity.class);
|
Intent intent = new Intent(MainActivity.this, PeertubeUploadActivity.class);
|
||||||
@ -412,7 +563,12 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_playlist) {
|
} else if (item.getItemId() == R.id.action_playlist) {
|
||||||
Intent intent = new Intent(MainActivity.this, AllPlaylistsActivity.class);
|
Intent intent;
|
||||||
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
|
intent = new Intent(MainActivity.this, AllPlaylistsActivity.class);
|
||||||
|
} else {
|
||||||
|
intent = new Intent(MainActivity.this, AllLocalPlaylistsActivity.class);
|
||||||
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_sepia_search) {
|
} else if (item.getItemId() == R.id.action_sepia_search) {
|
||||||
@ -463,9 +619,12 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
if (extras.getInt(Helper.INTENT_ACTION) == Helper.ADD_USER_INTENT) {
|
if (extras.getInt(Helper.INTENT_ACTION) == Helper.ADD_USER_INTENT) {
|
||||||
recreate();
|
recreate();
|
||||||
}
|
}
|
||||||
|
} else if (!BuildConfig.full_instances) {
|
||||||
|
PlaylistExportHelper.manageIntentUrl(MainActivity.this, intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("ApplySharedPref")
|
@SuppressLint("ApplySharedPref")
|
||||||
private void showRadioButtonDialog() {
|
private void showRadioButtonDialog() {
|
||||||
|
|
||||||
@ -493,50 +652,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
alert.show();
|
alert.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("ApplySharedPref")
|
|
||||||
private void showRadioButtonDialogFullInstances() {
|
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
|
||||||
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
|
|
||||||
alt_bld.setTitle(R.string.instance_choice);
|
|
||||||
String instance = Helper.getLiveInstance(MainActivity.this);
|
|
||||||
final EditText input = new EditText(MainActivity.this);
|
|
||||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT);
|
|
||||||
input.setLayoutParams(lp);
|
|
||||||
alt_bld.setView(input);
|
|
||||||
input.setText(instance);
|
|
||||||
alt_bld.setPositiveButton(R.string.validate,
|
|
||||||
(dialog, which) -> new Thread(() -> {
|
|
||||||
try {
|
|
||||||
String newInstance = input.getText().toString().trim();
|
|
||||||
WellKnownNodeinfo.NodeInfo instanceNodeInfo = new RetrofitPeertubeAPI(MainActivity.this, newInstance, null).getNodeInfo();
|
|
||||||
if (instanceNodeInfo.getSoftware() != null && instanceNodeInfo.getSoftware().getName().trim().toLowerCase().compareTo("peertube") == 0) {
|
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
|
||||||
editor.putString(Helper.PREF_INSTANCE, newInstance);
|
|
||||||
editor.commit();
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
dialog.dismiss();
|
|
||||||
recreate();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
runOnUiThread(() -> Toasty.error(MainActivity.this, getString(R.string.not_valide_instance), Toast.LENGTH_LONG).show());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}).start());
|
|
||||||
alt_bld.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
|
||||||
alt_bld.setNeutralButton(R.string.help, (dialog, which) -> {
|
|
||||||
Intent intent = new Intent(MainActivity.this, InstancePickerActivity.class);
|
|
||||||
startActivityForResult(intent, PICK_INSTANCE);
|
|
||||||
});
|
|
||||||
AlertDialog alert = alt_bld.create();
|
|
||||||
alert.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("ApplySharedPref")
|
@SuppressLint("ApplySharedPref")
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
@ -547,8 +662,15 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.PREF_INSTANCE, String.valueOf(data.getData()));
|
editor.putString(Helper.PREF_INSTANCE, String.valueOf(data.getData()));
|
||||||
editor.commit();
|
editor.commit();
|
||||||
recreate();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public enum TypeOfConnection {
|
||||||
|
UNKNOWN,
|
||||||
|
NORMAL,
|
||||||
|
SURFING
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,130 @@
|
|||||||
|
package app.fedilab.fedilabtube;
|
||||||
|
/* 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.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
|
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||||
|
import app.fedilab.fedilabtube.databinding.ActivityManageInstancesBinding;
|
||||||
|
import app.fedilab.fedilabtube.drawer.AboutInstanceAdapter;
|
||||||
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
||||||
|
import app.fedilab.fedilabtube.viewmodel.InfoInstanceVM;
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.PICK_INSTANCE_SURF;
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.showRadioButtonDialogFullInstances;
|
||||||
|
|
||||||
|
|
||||||
|
public class ManageInstancesActivity extends AppCompatActivity implements AboutInstanceAdapter.AllInstancesRemoved {
|
||||||
|
|
||||||
|
private ActivityManageInstancesBinding binding;
|
||||||
|
private List<InstanceData.AboutInstance> aboutInstances;
|
||||||
|
private AboutInstanceAdapter aboutInstanceAdapter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
binding = ActivityManageInstancesBinding.inflate(getLayoutInflater());
|
||||||
|
View view = binding.getRoot();
|
||||||
|
setContentView(view);
|
||||||
|
if (getSupportActionBar() != null) {
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||||
|
}
|
||||||
|
binding.loader.setVisibility(View.VISIBLE);
|
||||||
|
binding.noAction.setVisibility(View.GONE);
|
||||||
|
binding.lvInstances.setVisibility(View.GONE);
|
||||||
|
binding.actionButton.setOnClickListener(v -> showRadioButtonDialogFullInstances(ManageInstancesActivity.this, true));
|
||||||
|
aboutInstances = new ArrayList<>();
|
||||||
|
aboutInstanceAdapter = new AboutInstanceAdapter(this.aboutInstances);
|
||||||
|
aboutInstanceAdapter.allInstancesRemoved = this;
|
||||||
|
binding.lvInstances.setAdapter(aboutInstanceAdapter);
|
||||||
|
LinearLayoutManager layoutManager
|
||||||
|
= new LinearLayoutManager(ManageInstancesActivity.this);
|
||||||
|
binding.lvInstances.setLayoutManager(layoutManager);
|
||||||
|
InfoInstanceVM viewModelInfoInstance = new ViewModelProvider(ManageInstancesActivity.this).get(InfoInstanceVM.class);
|
||||||
|
viewModelInfoInstance.getInstances().observe(ManageInstancesActivity.this, this::manageVIewInfoInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void manageVIewInfoInstance(List<InstanceData.AboutInstance> aboutInstances) {
|
||||||
|
binding.loader.setVisibility(View.GONE);
|
||||||
|
if (aboutInstances == null || aboutInstances.size() == 0) {
|
||||||
|
binding.noAction.setVisibility(View.VISIBLE);
|
||||||
|
binding.lvInstances.setVisibility(View.GONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
binding.noAction.setVisibility(View.GONE);
|
||||||
|
binding.lvInstances.setVisibility(View.VISIBLE);
|
||||||
|
this.aboutInstances.addAll(aboutInstances);
|
||||||
|
aboutInstanceAdapter.notifyItemRangeInserted(0, aboutInstances.size());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
super.onBackPressed();
|
||||||
|
overridePendingTransition(R.anim.slide_out_up, R.anim.slide_in_up_down);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == android.R.id.home) {
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.slide_out_up, R.anim.slide_in_up_down);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("ApplySharedPref")
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (requestCode == PICK_INSTANCE_SURF && resultCode == Activity.RESULT_OK) {
|
||||||
|
if (data != null && data.getData() != null) {
|
||||||
|
new Thread(() -> {
|
||||||
|
String newInstance = data.getData().toString().trim().toLowerCase();
|
||||||
|
InstanceData.AboutInstance aboutInstance = new RetrofitPeertubeAPI(ManageInstancesActivity.this, newInstance, null).getAboutInstance();
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
new StoredInstanceDAO(ManageInstancesActivity.this, db).insertInstance(aboutInstance, newInstance);
|
||||||
|
runOnUiThread(() -> new Handler().post(() -> Helper.logoutNoRemoval(ManageInstancesActivity.this)));
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAllInstancesRemoved() {
|
||||||
|
binding.noAction.setVisibility(View.VISIBLE);
|
||||||
|
binding.lvInstances.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,7 @@ package app.fedilab.fedilabtube;
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -59,8 +60,8 @@ import static app.fedilab.fedilabtube.worker.WorkHelper.NOTIFICATION_WORKER;
|
|||||||
|
|
||||||
public class MyAccountActivity extends AppCompatActivity {
|
public class MyAccountActivity extends AppCompatActivity {
|
||||||
|
|
||||||
ActivityMyAccountSettingsBinding binding;
|
|
||||||
private static final int PICK_IMAGE = 466;
|
private static final int PICK_IMAGE = 466;
|
||||||
|
ActivityMyAccountSettingsBinding binding;
|
||||||
private Uri inputData;
|
private Uri inputData;
|
||||||
private String fileName;
|
private String fileName;
|
||||||
private NotificationSettings notificationSettings;
|
private NotificationSettings notificationSettings;
|
||||||
@ -74,11 +75,11 @@ public class MyAccountActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if (getSupportActionBar() != null)
|
if (getSupportActionBar() != null)
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
if( MainActivity.userMe == null) {
|
if (MainActivity.userMe == null) {
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setTitle(String.format("@%s",MainActivity.userMe.getUsername()));
|
setTitle(String.format("@%s", MainActivity.userMe.getUsername()));
|
||||||
binding.displayname.setText(MainActivity.userMe.getAccount().getDisplayName());
|
binding.displayname.setText(MainActivity.userMe.getAccount().getDisplayName());
|
||||||
binding.description.setText(MainActivity.userMe.getAccount().getDescription());
|
binding.description.setText(MainActivity.userMe.getAccount().getDescription());
|
||||||
|
|
||||||
@ -93,7 +94,7 @@ public class MyAccountActivity extends AppCompatActivity {
|
|||||||
initializeValues(notificationSettings.getNewCommentOnMyVideo(), binding.notifNewCommentApp, binding.notifNewCommentMail);
|
initializeValues(notificationSettings.getNewCommentOnMyVideo(), binding.notifNewCommentApp, binding.notifNewCommentMail);
|
||||||
initializeValues(notificationSettings.getNewVideoFromSubscription(), binding.notifNewVideoApp, binding.notifNewVideoMail);
|
initializeValues(notificationSettings.getNewVideoFromSubscription(), binding.notifNewVideoApp, binding.notifNewVideoMail);
|
||||||
|
|
||||||
Helper.loadGiF(MyAccountActivity.this, MainActivity.userMe.getAccount().getAvatar()!=null?MainActivity.userMe.getAccount().getAvatar().getPath():null, binding.profilePicture);
|
Helper.loadGiF(MyAccountActivity.this, MainActivity.userMe.getAccount().getAvatar() != null ? MainActivity.userMe.getAccount().getAvatar().getPath() : null, binding.profilePicture);
|
||||||
|
|
||||||
String[] refresh_array = getResources().getStringArray(R.array.refresh_time);
|
String[] refresh_array = getResources().getStringArray(R.array.refresh_time);
|
||||||
ArrayAdapter<String> refreshArray = new ArrayAdapter<>(MyAccountActivity.this,
|
ArrayAdapter<String> refreshArray = new ArrayAdapter<>(MyAccountActivity.this,
|
||||||
@ -132,7 +133,7 @@ public class MyAccountActivity extends AppCompatActivity {
|
|||||||
editor.putInt(Helper.NOTIFICATION_INTERVAL, time);
|
editor.putInt(Helper.NOTIFICATION_INTERVAL, time);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
WorkManager.getInstance(getApplicationContext()).cancelAllWorkByTag(NOTIFICATION_WORKER);
|
WorkManager.getInstance(getApplicationContext()).cancelAllWorkByTag(NOTIFICATION_WORKER);
|
||||||
if( time > 0 ) {
|
if (time > 0) {
|
||||||
WorkHelper.fetchNotifications(getApplication(), time);
|
WorkHelper.fetchNotifications(getApplication(), time);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -169,7 +170,7 @@ public class MyAccountActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
binding.refreshTime.setSelection(position, false);
|
binding.refreshTime.setSelection(position, false);
|
||||||
|
|
||||||
binding.selectFile.setOnClickListener(v->{
|
binding.selectFile.setOnClickListener(v -> {
|
||||||
if (ContextCompat.checkSelfPermission(MyAccountActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
if (ContextCompat.checkSelfPermission(MyAccountActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
||||||
PackageManager.PERMISSION_GRANTED) {
|
PackageManager.PERMISSION_GRANTED) {
|
||||||
ActivityCompat.requestPermissions(MyAccountActivity.this,
|
ActivityCompat.requestPermissions(MyAccountActivity.this,
|
||||||
@ -204,13 +205,13 @@ public class MyAccountActivity extends AppCompatActivity {
|
|||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
UserSettings userSettings = new UserSettings();
|
UserSettings userSettings = new UserSettings();
|
||||||
userSettings.setNotificationSettings(notificationSettings);
|
userSettings.setNotificationSettings(notificationSettings);
|
||||||
if( binding.displayname.getText() != null) {
|
if (binding.displayname.getText() != null) {
|
||||||
userSettings.setDisplayName(binding.displayname.getText().toString().trim());
|
userSettings.setDisplayName(binding.displayname.getText().toString().trim());
|
||||||
}
|
}
|
||||||
if( binding.description.getText() != null) {
|
if (binding.description.getText() != null) {
|
||||||
userSettings.setDescription(binding.description.getText().toString().trim());
|
userSettings.setDescription(binding.description.getText().toString().trim());
|
||||||
}
|
}
|
||||||
if( inputData != null ) {
|
if (inputData != null) {
|
||||||
userSettings.setAvatarfile(inputData);
|
userSettings.setAvatarfile(inputData);
|
||||||
userSettings.setFileName(fileName);
|
userSettings.setFileName(fileName);
|
||||||
}
|
}
|
||||||
@ -219,7 +220,7 @@ public class MyAccountActivity extends AppCompatActivity {
|
|||||||
UserMe.AvatarResponse avatarResponse = api.updateUser(userSettings);
|
UserMe.AvatarResponse avatarResponse = api.updateUser(userSettings);
|
||||||
MainActivity.userMe.getAccount().setDisplayName(binding.displayname.getText().toString().trim());
|
MainActivity.userMe.getAccount().setDisplayName(binding.displayname.getText().toString().trim());
|
||||||
MainActivity.userMe.getAccount().setDescription(binding.description.getText().toString().trim());
|
MainActivity.userMe.getAccount().setDescription(binding.description.getText().toString().trim());
|
||||||
if( avatarResponse != null && avatarResponse.getAvatar() != null ) {
|
if (avatarResponse != null && avatarResponse.getAvatar() != null) {
|
||||||
MainActivity.userMe.getAccount().setAvatar(avatarResponse.getAvatar());
|
MainActivity.userMe.getAccount().setAvatar(avatarResponse.getAvatar());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,29 +330,29 @@ public class MyAccountActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getNewAppCheckedValue(boolean checked, SwitchCompat email){
|
private int getNewAppCheckedValue(boolean checked, SwitchCompat email) {
|
||||||
int newValue;
|
int newValue;
|
||||||
if( checked && email.isChecked()) {
|
if (checked && email.isChecked()) {
|
||||||
newValue = 3;
|
newValue = 3;
|
||||||
}else if( !checked && email.isChecked()) {
|
} else if (!checked && email.isChecked()) {
|
||||||
newValue = 2;
|
newValue = 2;
|
||||||
} else if( checked && !email.isChecked()) {
|
} else if (checked && !email.isChecked()) {
|
||||||
newValue = 1;
|
newValue = 1;
|
||||||
}else {
|
} else {
|
||||||
newValue = 0;
|
newValue = 0;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getNewMailCheckedValue(boolean checked, SwitchCompat app){
|
private int getNewMailCheckedValue(boolean checked, SwitchCompat app) {
|
||||||
int newValue;
|
int newValue;
|
||||||
if( checked && app.isChecked()) {
|
if (checked && app.isChecked()) {
|
||||||
newValue = 3;
|
newValue = 3;
|
||||||
}else if( !checked && app.isChecked()) {
|
} else if (!checked && app.isChecked()) {
|
||||||
newValue = 1;
|
newValue = 1;
|
||||||
} else if( checked && !app.isChecked()) {
|
} else if (checked && !app.isChecked()) {
|
||||||
newValue = 2;
|
newValue = 2;
|
||||||
}else {
|
} else {
|
||||||
newValue = 0;
|
newValue = 0;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
|
@ -38,6 +38,7 @@ import android.os.Looper;
|
|||||||
import android.support.v4.media.session.MediaSessionCompat;
|
import android.support.v4.media.session.MediaSessionCompat;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -60,6 +61,7 @@ import androidx.annotation.RequiresApi;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.graphics.drawable.DrawableCompat;
|
import androidx.core.graphics.drawable.DrawableCompat;
|
||||||
@ -151,6 +153,7 @@ import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_
|
|||||||
public class PeertubeActivity extends AppCompatActivity implements CommentListAdapter.AllCommentRemoved, Player.EventListener, VideoListener, TorrentListener {
|
public class PeertubeActivity extends AppCompatActivity implements CommentListAdapter.AllCommentRemoved, Player.EventListener, VideoListener, TorrentListener {
|
||||||
|
|
||||||
public static String video_id;
|
public static String video_id;
|
||||||
|
public static List<String> playedVideos = new ArrayList<>();
|
||||||
private String peertubeInstance, videoUuid;
|
private String peertubeInstance, videoUuid;
|
||||||
private FullScreenMediaController.fullscreen fullscreen;
|
private FullScreenMediaController.fullscreen fullscreen;
|
||||||
private ImageView fullScreenIcon;
|
private ImageView fullScreenIcon;
|
||||||
@ -174,16 +177,26 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
private List<Comment> commentsThread;
|
private List<Comment> commentsThread;
|
||||||
private BroadcastReceiver mPowerKeyReceiver = null;
|
private BroadcastReceiver mPowerKeyReceiver = null;
|
||||||
private boolean isPlayInMinimized;
|
private boolean isPlayInMinimized;
|
||||||
public static List<String> playedVideos = new ArrayList<>();
|
|
||||||
private VideoData.Video nextVideo;
|
private VideoData.Video nextVideo;
|
||||||
private TorrentStream torrentStream;
|
private TorrentStream torrentStream;
|
||||||
private String show_more_content;
|
private String show_more_content;
|
||||||
|
private videoOrientation videoOrientationType;
|
||||||
|
private int initialOrientation;
|
||||||
|
|
||||||
|
public static void hideKeyboard(Activity activity) {
|
||||||
|
if (activity != null && activity.getWindow() != null) {
|
||||||
|
activity.getWindow().getDecorView();
|
||||||
|
InputMethodManager imm = (InputMethodManager) activity.getSystemService(INPUT_METHOD_SERVICE);
|
||||||
|
assert imm != null;
|
||||||
|
imm.hideSoftInputFromWindow(activity.getWindow().getDecorView().getWindowToken(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
|
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
|
||||||
if(width < height){
|
if (width < height) {
|
||||||
videoOrientationType = videoOrientation.PORTRAIT;
|
videoOrientationType = videoOrientation.PORTRAIT;
|
||||||
}else{
|
} else {
|
||||||
videoOrientationType = videoOrientation.LANDSCAPE;
|
videoOrientationType = videoOrientation.LANDSCAPE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,22 +225,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStreamStopped() {}
|
public void onStreamStopped() {
|
||||||
|
|
||||||
enum videoOrientation {
|
|
||||||
LANDSCAPE,
|
|
||||||
PORTRAIT
|
|
||||||
}
|
|
||||||
|
|
||||||
private videoOrientation videoOrientationType;
|
|
||||||
|
|
||||||
public static void hideKeyboard(Activity activity) {
|
|
||||||
if (activity != null && activity.getWindow() != null) {
|
|
||||||
activity.getWindow().getDecorView();
|
|
||||||
InputMethodManager imm = (InputMethodManager) activity.getSystemService(INPUT_METHOD_SERVICE);
|
|
||||||
assert imm != null;
|
|
||||||
imm.hideSoftInputFromWindow(activity.getWindow().getDecorView().getWindowToken(), 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -246,7 +244,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
if (Helper.isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
if (Helper.isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
||||||
Account account = new AccountDAO(PeertubeActivity.this, db).getAccountByToken(token);
|
Account account = new AccountDAO(PeertubeActivity.this, db).getAccountByToken(token);
|
||||||
Helper.loadGiF(PeertubeActivity.this, account.getAvatar() != null ? account.getAvatar().getPath() : null, binding.myPp);
|
Helper.loadGiF(PeertubeActivity.this, account.getAvatar() != null ? account.getAvatar().getPath() : null, binding.myPp);
|
||||||
Helper.loadGiF(PeertubeActivity.this, account.getAvatar() != null ? account.getAvatar().getPath() : null, binding.myPpReply);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TorrentOptions torrentOptions = new TorrentOptions.Builder()
|
TorrentOptions torrentOptions = new TorrentOptions.Builder()
|
||||||
@ -257,7 +254,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
|
|
||||||
torrentStream = TorrentStream.init(torrentOptions);
|
torrentStream = TorrentStream.init(torrentOptions);
|
||||||
torrentStream.addListener(PeertubeActivity.this);
|
torrentStream.addListener(PeertubeActivity.this);
|
||||||
|
initialOrientation = getResources().getConfiguration().orientation;
|
||||||
if (Helper.isTablet(PeertubeActivity.this)) {
|
if (Helper.isTablet(PeertubeActivity.this)) {
|
||||||
|
|
||||||
LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(
|
||||||
@ -266,6 +263,15 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
2.0f
|
2.0f
|
||||||
);
|
);
|
||||||
binding.videoContainer.setLayoutParams(param);
|
binding.videoContainer.setLayoutParams(param);
|
||||||
|
} else {
|
||||||
|
if (initialOrientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
|
LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(
|
||||||
|
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
0,
|
||||||
|
3.0f
|
||||||
|
);
|
||||||
|
binding.videoContainer.setLayoutParams(param);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
isPlayInMinimized = false;
|
isPlayInMinimized = false;
|
||||||
if (getSupportActionBar() != null)
|
if (getSupportActionBar() != null)
|
||||||
@ -286,19 +292,18 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
|
|
||||||
manageIntentUrl(intent);
|
manageIntentUrl(intent);
|
||||||
|
|
||||||
binding.peertubeDescriptionMore.setOnClickListener(v->{
|
binding.peertubeDescriptionMore.setOnClickListener(v -> {
|
||||||
if( show_more_content != null && peertube != null) {
|
if (show_more_content != null && peertube != null) {
|
||||||
if( binding.peertubeDescriptionMore.getText().toString().compareTo(getString(R.string.show_more)) == 0) {
|
if (binding.peertubeDescriptionMore.getText().toString().compareTo(getString(R.string.show_more)) == 0) {
|
||||||
binding.peertubeDescriptionMore.setText(getString(R.string.show_less));
|
binding.peertubeDescriptionMore.setText(getString(R.string.show_less));
|
||||||
binding.peertubeDescription.setText(show_more_content);
|
binding.peertubeDescription.setText(show_more_content);
|
||||||
}else{
|
} else {
|
||||||
binding.peertubeDescriptionMore.setText(getString(R.string.show_more));
|
binding.peertubeDescriptionMore.setText(getString(R.string.show_more));
|
||||||
binding.peertubeDescription.setText(peertube.getDescription());
|
binding.peertubeDescription.setText(peertube.getDescription());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!Helper.isLoggedIn(PeertubeActivity.this) || sepiaSearch) {
|
if (!Helper.isLoggedIn(PeertubeActivity.this) || sepiaSearch) {
|
||||||
binding.writeCommentContainerReply.setVisibility(View.GONE);
|
|
||||||
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);
|
||||||
@ -328,7 +333,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.peertubeInformationContainer.setVisibility(View.GONE);
|
binding.peertubeInformationContainer.setVisibility(View.GONE);
|
||||||
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
}else {
|
} else {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -372,18 +377,19 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
public void onAnimationEnd() {
|
public void onAnimationEnd() {
|
||||||
binding.mediaVideo.setVisibility(View.GONE);
|
binding.mediaVideo.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}) .playerView(binding.doubleTapPlayerView).seekSeconds(10);
|
}).playerView(binding.doubleTapPlayerView).seekSeconds(10);
|
||||||
binding.doubleTapPlayerView.setPlayer(player);
|
binding.doubleTapPlayerView.setPlayer(player);
|
||||||
binding.doubleTapPlayerView.controller(binding.mediaVideo);
|
binding.doubleTapPlayerView.controller(binding.mediaVideo);
|
||||||
if( player != null)
|
if (player != null)
|
||||||
binding.mediaVideo.player(player);
|
binding.mediaVideo.player(player);
|
||||||
}
|
}
|
||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
comments = new ArrayList<>();
|
comments = new ArrayList<>();
|
||||||
|
|
||||||
binding.closeReply.setOnClickListener(v -> closeCommentThread());
|
binding.closeReply.setOnClickListener(v -> closeCommentThread());
|
||||||
|
binding.closePost.setOnClickListener(v -> closePostComment());
|
||||||
|
|
||||||
commentListAdapter = new CommentListAdapter(comments, isMyVideo || Helper.isVideoOwner(PeertubeActivity.this, peertube));
|
commentListAdapter = new CommentListAdapter(comments, isMyVideo || Helper.isVideoOwner(PeertubeActivity.this, peertube), false);
|
||||||
commentListAdapter.allCommentRemoved = PeertubeActivity.this;
|
commentListAdapter.allCommentRemoved = PeertubeActivity.this;
|
||||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
||||||
binding.peertubeComments.setLayoutManager(mLayoutManager);
|
binding.peertubeComments.setLayoutManager(mLayoutManager);
|
||||||
@ -411,25 +417,25 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
playVideo();
|
playVideo();
|
||||||
}
|
}
|
||||||
registBroadcastReceiver();
|
registBroadcastReceiver();
|
||||||
if( autoFullscreen && autoPlay) {
|
if (autoFullscreen && autoPlay) {
|
||||||
openFullscreenDialog();
|
openFullscreenDialog();
|
||||||
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
}else {
|
} else {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
binding.postCommentButton.setOnClickListener(v -> openPostComment(null, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void manageVIewVideos(APIResponse apiResponse) {
|
private void manageVIewVideos(APIResponse apiResponse) {
|
||||||
if (apiResponse == null || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
if (apiResponse == null || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
||||||
playVideo();
|
playVideo();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
peertube = apiResponse.getPeertubes().get(0);
|
peertube = apiResponse.getPeertubes().get(0);
|
||||||
if( peertube.getUserHistory() != null) {
|
if (peertube.getUserHistory() != null) {
|
||||||
player.seekTo(peertube.getUserHistory().getCurrentTime()*1000);
|
player.seekTo(peertube.getUserHistory().getCurrentTime() * 1000);
|
||||||
}
|
}
|
||||||
sepiaSearch = false;
|
sepiaSearch = false;
|
||||||
playVideo();
|
playVideo();
|
||||||
@ -458,8 +464,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void manageVIewCommentReply(Comment comment, APIResponse apiResponse) {
|
||||||
public void manageVIewCommentReply(APIResponse apiResponse) {
|
|
||||||
if (apiResponse == null || apiResponse.getError() != null || apiResponse.getCommentThreadData() == null) {
|
if (apiResponse == null || apiResponse.getError() != null || apiResponse.getCommentThreadData() == null) {
|
||||||
if (apiResponse == null || apiResponse.getError() == null)
|
if (apiResponse == null || apiResponse.getError() == null)
|
||||||
Toasty.error(PeertubeActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
Toasty.error(PeertubeActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||||
@ -469,7 +474,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
List<CommentData.CommentThreadData> commentThreadDataList = apiResponse.getCommentThreadData().getChildren();
|
List<CommentData.CommentThreadData> commentThreadDataList = apiResponse.getCommentThreadData().getChildren();
|
||||||
commentsThread = generateCommentReply(commentThreadDataList, new ArrayList<>());
|
commentsThread = generateCommentReply(commentThreadDataList, new ArrayList<>());
|
||||||
commentReplyListAdapter = new CommentListAdapter(commentsThread, Helper.isVideoOwner(PeertubeActivity.this, peertube));
|
comment.setInReplyToCommentId(null);
|
||||||
|
comment.setTotalReplies(0);
|
||||||
|
commentsThread.add(0, comment);
|
||||||
|
commentReplyListAdapter = new CommentListAdapter(commentsThread, Helper.isVideoOwner(PeertubeActivity.this, peertube), true);
|
||||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
||||||
binding.peertubeReply.setLayoutManager(mLayoutManager);
|
binding.peertubeReply.setLayoutManager(mLayoutManager);
|
||||||
binding.peertubeReply.setNestedScrollingEnabled(false);
|
binding.peertubeReply.setNestedScrollingEnabled(false);
|
||||||
@ -500,7 +508,7 @@ 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) {
|
if (comments != null && comments.size() > 0) {
|
||||||
int number = comments.size();
|
int number = comments.size();
|
||||||
comments.clear();
|
comments.clear();
|
||||||
commentListAdapter.notifyItemRangeRemoved(0, number);
|
commentListAdapter.notifyItemRangeRemoved(0, number);
|
||||||
@ -511,14 +519,14 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void manageIntentUrl(Intent intent) {
|
private void manageIntentUrl(Intent intent) {
|
||||||
if(intent.getData() != null) { //Comes from a link
|
if (intent.getData() != null) { //Comes from a link
|
||||||
String url = intent.getData().toString();
|
String url = intent.getData().toString();
|
||||||
Pattern link = Pattern.compile("(https?://[\\da-z.-]+\\.[a-z.]{2,10})/videos/watch/(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})$");
|
Pattern link = Pattern.compile("(https?://[\\da-z.-]+\\.[a-z.]{2,10})/videos/watch/(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})$");
|
||||||
Matcher matcherLink = link.matcher(url);
|
Matcher matcherLink = link.matcher(url);
|
||||||
if (matcherLink.find()) {
|
if (matcherLink.find()) {
|
||||||
String instance = matcherLink.group(1);
|
String instance = matcherLink.group(1);
|
||||||
String uuid = matcherLink.group(2);
|
String uuid = matcherLink.group(2);
|
||||||
if(instance != null && uuid != null) {
|
if (instance != null && uuid != null) {
|
||||||
peertubeInstance = instance.replace("https://", "").replace("http://", "");
|
peertubeInstance = instance.replace("https://", "").replace("http://", "");
|
||||||
sepiaSearch = true; // Sepia search flag is used because, at this time we don't know if the video is federated.
|
sepiaSearch = true; // Sepia search flag is used because, at this time we don't know if the video is federated.
|
||||||
videoUuid = uuid;
|
videoUuid = uuid;
|
||||||
@ -527,11 +535,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
peertube.setEmbedUrl(url);
|
peertube.setEmbedUrl(url);
|
||||||
SearchVM viewModelSearch = new ViewModelProvider(PeertubeActivity.this).get(SearchVM.class);
|
SearchVM viewModelSearch = new ViewModelProvider(PeertubeActivity.this).get(SearchVM.class);
|
||||||
viewModelSearch.getVideos("0", peertube.getEmbedUrl()).observe(PeertubeActivity.this, this::manageVIewVideos);
|
viewModelSearch.getVideos("0", peertube.getEmbedUrl()).observe(PeertubeActivity.this, this::manageVIewVideos);
|
||||||
}else {
|
} else {
|
||||||
Helper.forwardToAnotherApp(PeertubeActivity.this, intent);
|
Helper.forwardToAnotherApp(PeertubeActivity.this, intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
Helper.forwardToAnotherApp(PeertubeActivity.this, intent);
|
Helper.forwardToAnotherApp(PeertubeActivity.this, intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
@ -550,14 +558,14 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
show_more_content = null;
|
show_more_content = null;
|
||||||
binding.peertubeDescriptionMore.setVisibility(View.GONE);
|
binding.peertubeDescriptionMore.setVisibility(View.GONE);
|
||||||
if( autoFullscreen && autoPlay) {
|
if (autoFullscreen && autoPlay) {
|
||||||
fullscreen = FullScreenMediaController.fullscreen.ON;
|
fullscreen = FullScreenMediaController.fullscreen.ON;
|
||||||
setFullscreen(FullScreenMediaController.fullscreen.ON);
|
setFullscreen(FullScreenMediaController.fullscreen.ON);
|
||||||
fullScreenMode = true;
|
fullScreenMode = true;
|
||||||
openFullscreenDialog();
|
openFullscreenDialog();
|
||||||
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
}else {
|
} else {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -577,12 +585,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
VideoData.Description description = api.getVideoDescription(videoUuid);
|
VideoData.Description description = api.getVideoDescription(videoUuid);
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
Runnable myRunnable = () -> {
|
Runnable myRunnable = () -> {
|
||||||
if( description == null) {
|
if (description == null) {
|
||||||
binding.peertubeDescriptionMore.setVisibility(View.GONE);
|
binding.peertubeDescriptionMore.setVisibility(View.GONE);
|
||||||
show_more_content = null;
|
show_more_content = null;
|
||||||
}else{
|
} else {
|
||||||
if( !PeertubeActivity.this.isFinishing()) {
|
if (!PeertubeActivity.this.isFinishing()) {
|
||||||
if (peertube != null && peertube.getDescription() != null && description.getDescription().compareTo(peertube.getDescription()) > 0) {
|
if (peertube != null && peertube.getDescription() != null && description.getDescription() != null && description.getDescription().compareTo(peertube.getDescription()) > 0) {
|
||||||
binding.peertubeDescriptionMore.setVisibility(View.VISIBLE);
|
binding.peertubeDescriptionMore.setVisibility(View.VISIBLE);
|
||||||
show_more_content = description.getDescription();
|
show_more_content = description.getDescription();
|
||||||
} else {
|
} else {
|
||||||
@ -614,7 +622,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == android.R.id.home) {
|
if (item.getItemId() == android.R.id.home) {
|
||||||
@ -672,7 +679,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
this.fullscreen = fullscreen;
|
this.fullscreen = fullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void manageCaptions(APIResponse apiResponse) {
|
public void manageCaptions(APIResponse apiResponse) {
|
||||||
if (apiResponse == null || (apiResponse.getError() != null) || apiResponse.getCaptions() == null || apiResponse.getCaptions().size() == 0) {
|
if (apiResponse == null || (apiResponse.getError() != null) || apiResponse.getCaptions() == null || apiResponse.getCaptions().size() == 0) {
|
||||||
return;
|
return;
|
||||||
@ -680,14 +686,13 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
captions = apiResponse.getCaptions();
|
captions = apiResponse.getCaptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void manageNextVideos(APIResponse apiResponse) {
|
public void manageNextVideos(APIResponse apiResponse) {
|
||||||
if (apiResponse == null || apiResponse.getError() != null || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
if (apiResponse == null || apiResponse.getError() != null || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<VideoData.Video> suggestedVideos = apiResponse.getPeertubes();
|
List<VideoData.Video> suggestedVideos = apiResponse.getPeertubes();
|
||||||
for(VideoData.Video video: suggestedVideos) {
|
for (VideoData.Video video : suggestedVideos) {
|
||||||
if(!playedVideos.contains(video.getId())){
|
if (!playedVideos.contains(video.getId())) {
|
||||||
TimelineVM feedsViewModel = new ViewModelProvider(PeertubeActivity.this).get(TimelineVM.class);
|
TimelineVM feedsViewModel = new ViewModelProvider(PeertubeActivity.this).get(TimelineVM.class);
|
||||||
feedsViewModel.getVideo(null, suggestedVideos.get(0).getUuid(), false).observe(PeertubeActivity.this, this::nextVideoDetails);
|
feedsViewModel.getVideo(null, suggestedVideos.get(0).getUuid(), false).observe(PeertubeActivity.this, this::nextVideoDetails);
|
||||||
return;
|
return;
|
||||||
@ -701,7 +706,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < (apiResponse.getPeertubes().size()-1) && playedVideos.contains(apiResponse.getPeertubes().get(i).getId())) {
|
while (i < (apiResponse.getPeertubes().size() - 1) && playedVideos.contains(apiResponse.getPeertubes().get(i).getId())) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
nextVideo = apiResponse.getPeertubes().get(i);
|
nextVideo = apiResponse.getPeertubes().get(i);
|
||||||
@ -709,7 +714,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
player.addMediaItem(mediaItem);
|
player.addMediaItem(mediaItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
public void manageVIewVideo(APIResponse apiResponse) {
|
public void manageVIewVideo(APIResponse apiResponse) {
|
||||||
if (apiResponse == null || (apiResponse.getError() != null) || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
if (apiResponse == null || (apiResponse.getError() != null) || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
||||||
@ -723,12 +727,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
long position = -1;
|
long position = -1;
|
||||||
if( peertube.getUserHistory() != null) {
|
if (peertube.getUserHistory() != null) {
|
||||||
position = peertube.getUserHistory().getCurrentTime() * 1000;
|
position = peertube.getUserHistory().getCurrentTime() * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
peertube = apiResponse.getPeertubes().get(0);
|
peertube = apiResponse.getPeertubes().get(0);
|
||||||
if( peertube.getTags() != null && peertube.getTags().size() > 0) {
|
if (peertube.getTags() != null && peertube.getTags().size() > 0) {
|
||||||
SearchVM searchViewModel = new ViewModelProvider(PeertubeActivity.this).get(SearchVM.class);
|
SearchVM searchViewModel = new ViewModelProvider(PeertubeActivity.this).get(SearchVM.class);
|
||||||
searchViewModel.searchNextVideos(peertube.getTags()).observe(PeertubeActivity.this, this::manageNextVideos);
|
searchViewModel.searchNextVideos(peertube.getTags()).observe(PeertubeActivity.this, this::manageNextVideos);
|
||||||
}
|
}
|
||||||
@ -742,24 +746,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
|
|
||||||
if (!Helper.isLoggedIn(PeertubeActivity.this) || sepiaSearch) {
|
if (!Helper.isLoggedIn(PeertubeActivity.this) || sepiaSearch) {
|
||||||
binding.writeCommentContainer.setVisibility(View.GONE);
|
binding.writeCommentContainer.setVisibility(View.GONE);
|
||||||
binding.writeCommentContainerReply.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
binding.send.setOnClickListener(v -> {
|
|
||||||
if (isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
|
||||||
String comment = binding.addCommentWrite.getText().toString();
|
|
||||||
if (comment.trim().length() > 0) {
|
|
||||||
PostActionsVM viewModelComment = new ViewModelProvider(PeertubeActivity.this).get(PostActionsVM.class);
|
|
||||||
viewModelComment.comment(ADD_COMMENT, peertube.getId(), null, comment).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(ADD_COMMENT, 0, apiResponse1));
|
|
||||||
binding.addCommentWrite.setText("");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (sepiaSearch) {
|
|
||||||
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
|
||||||
} else {
|
|
||||||
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
binding.peertubePlaylist.setOnClickListener(v -> {
|
binding.peertubePlaylist.setOnClickListener(v -> {
|
||||||
PlaylistsVM viewModelOwnerPlaylist = new ViewModelProvider(PeertubeActivity.this).get(PlaylistsVM.class);
|
PlaylistsVM viewModelOwnerPlaylist = new ViewModelProvider(PeertubeActivity.this).get(PlaylistsVM.class);
|
||||||
@ -767,16 +754,20 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (peertube.isCommentsEnabled()) {
|
if (peertube.isCommentsEnabled()) {
|
||||||
|
if (Helper.isLoggedIn(PeertubeActivity.this)) {
|
||||||
|
binding.postCommentButton.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
binding.postCommentButton.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
|
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
|
||||||
commentViewModel.getThread(sepiaSearch ? peertubeInstance : null, videoUuid, max_id).observe(PeertubeActivity.this, this::manageVIewComment);
|
commentViewModel.getThread(sepiaSearch ? peertubeInstance : null, videoUuid, max_id).observe(PeertubeActivity.this, this::manageVIewComment);
|
||||||
if (Helper.isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
if (Helper.isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
||||||
binding.writeCommentContainerReply.setVisibility(View.VISIBLE);
|
|
||||||
binding.writeCommentContainer.setVisibility(View.VISIBLE);
|
binding.writeCommentContainer.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
binding.peertubeComments.setVisibility(View.VISIBLE);
|
binding.peertubeComments.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
|
binding.postCommentButton.setVisibility(View.GONE);
|
||||||
binding.peertubeComments.setVisibility(View.GONE);
|
binding.peertubeComments.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));
|
||||||
binding.noAction.setVisibility(View.VISIBLE);
|
binding.noAction.setVisibility(View.VISIBLE);
|
||||||
@ -792,8 +783,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.peertubeDislikeCount.setText(Helper.withSuffix(peertube.getDislikes()));
|
binding.peertubeDislikeCount.setText(Helper.withSuffix(peertube.getDislikes()));
|
||||||
binding.peertubeLikeCount.setText(Helper.withSuffix(peertube.getLikes()));
|
binding.peertubeLikeCount.setText(Helper.withSuffix(peertube.getLikes()));
|
||||||
binding.peertubeViewCount.setText(Helper.withSuffix(peertube.getViews()));
|
binding.peertubeViewCount.setText(Helper.withSuffix(peertube.getViews()));
|
||||||
loadGiF(PeertubeActivity.this,peertube.getChannel().getAvatar()!=null?peertube.getChannel().getAvatar().getPath():null, binding.ppChannel);
|
loadGiF(PeertubeActivity.this, peertube.getChannel().getAvatar() != null ? peertube.getChannel().getAvatar().getPath() : null, binding.ppChannel);
|
||||||
binding.ppChannel.setOnClickListener(v->{
|
binding.ppChannel.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent(PeertubeActivity.this, ShowChannelActivity.class);
|
Intent intent = new Intent(PeertubeActivity.this, ShowChannelActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
b.putParcelable("channel", peertube.getChannel());
|
b.putParcelable("channel", peertube.getChannel());
|
||||||
@ -872,8 +863,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.loader.setVisibility(View.GONE);
|
binding.loader.setVisibility(View.GONE);
|
||||||
startStream(
|
startStream(
|
||||||
apiResponse.getPeertubes().get(0).getFileUrl(null, PeertubeActivity.this),
|
apiResponse.getPeertubes().get(0).getFileUrl(null, PeertubeActivity.this),
|
||||||
apiResponse.getPeertubes().get(0).getStreamingPlaylists().size()>0?apiResponse.getPeertubes().get(0).getStreamingPlaylists().get(0).getPlaylistUrl():null,
|
apiResponse.getPeertubes().get(0).getStreamingPlaylists().size() > 0 ? apiResponse.getPeertubes().get(0).getStreamingPlaylists().get(0).getPlaylistUrl() : null,
|
||||||
autoPlay,position, null, null);
|
autoPlay, position, null, null);
|
||||||
player.prepare();
|
player.prepare();
|
||||||
player.setPlayWhenReady(autoPlay);
|
player.setPlayWhenReady(autoPlay);
|
||||||
}
|
}
|
||||||
@ -1020,11 +1011,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
private void startStream(String videoURL, String streamingPlaylistsURLS, boolean autoPlay, long position, Uri subtitles, String lang) {
|
private void startStream(String videoURL, String streamingPlaylistsURLS, boolean autoPlay, long position, Uri subtitles, String lang) {
|
||||||
|
|
||||||
if (videoURL != null) {
|
if (videoURL != null) {
|
||||||
if( videoURL.endsWith(".torrent")) {
|
if (videoURL.endsWith(".torrent")) {
|
||||||
|
|
||||||
torrentStream.startStream(videoURL);
|
torrentStream.startStream(videoURL);
|
||||||
return;
|
return;
|
||||||
}else {
|
} else {
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
int video_cache = sharedpreferences.getInt(Helper.SET_VIDEO_CACHE, Helper.DEFAULT_VIDEO_CACHE_MB);
|
int video_cache = sharedpreferences.getInt(Helper.SET_VIDEO_CACHE, Helper.DEFAULT_VIDEO_CACHE_MB);
|
||||||
ProgressiveMediaSource videoSource;
|
ProgressiveMediaSource videoSource;
|
||||||
@ -1053,7 +1044,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
MergingMediaSource mergedSource =
|
MergingMediaSource mergedSource =
|
||||||
new MergingMediaSource(videoSource, subtitleSource);
|
new MergingMediaSource(videoSource, subtitleSource);
|
||||||
player.setMediaSource(mergedSource);
|
player.setMediaSource(mergedSource);
|
||||||
}else {
|
} else {
|
||||||
player.setMediaSource(videoSource);
|
player.setMediaSource(videoSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1064,7 +1055,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
player.setMediaSource(hlsMediaSource);
|
player.setMediaSource(hlsMediaSource);
|
||||||
}
|
}
|
||||||
player.prepare();
|
player.prepare();
|
||||||
if( position > 0) {
|
if (position > 0) {
|
||||||
player.seekTo(0, position);
|
player.seekTo(0, position);
|
||||||
}
|
}
|
||||||
player.setPlayWhenReady(autoPlay);
|
player.setPlayWhenReady(autoPlay);
|
||||||
@ -1073,21 +1064,37 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(@NotNull Configuration newConfig) {
|
public void onConfigurationChanged(@NotNull Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
|
|
||||||
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
if (mode != Helper.VIDEO_MODE_WEBVIEW) {
|
if (mode != Helper.VIDEO_MODE_WEBVIEW) {
|
||||||
openFullscreenDialog();
|
openFullscreenDialog();
|
||||||
}
|
}
|
||||||
setFullscreen(FullScreenMediaController.fullscreen.ON);
|
setFullscreen(FullScreenMediaController.fullscreen.ON);
|
||||||
|
if (initialOrientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
|
LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(
|
||||||
|
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
0,
|
||||||
|
3.0f
|
||||||
|
);
|
||||||
|
binding.videoContainer.setLayoutParams(param);
|
||||||
|
}
|
||||||
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
if (mode != Helper.VIDEO_MODE_WEBVIEW) {
|
if (mode != Helper.VIDEO_MODE_WEBVIEW) {
|
||||||
closeFullscreenDialog();
|
closeFullscreenDialog();
|
||||||
}
|
}
|
||||||
setFullscreen(FullScreenMediaController.fullscreen.OFF);
|
setFullscreen(FullScreenMediaController.fullscreen.OFF);
|
||||||
|
if (initialOrientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
|
LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(
|
||||||
|
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
0,
|
||||||
|
1.0f
|
||||||
|
);
|
||||||
|
binding.videoContainer.setLayoutParams(param);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
change();
|
change();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@ -1095,7 +1102,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.release();
|
player.release();
|
||||||
}
|
}
|
||||||
if( torrentStream != null && torrentStream.isStreaming()) {
|
if (torrentStream != null && torrentStream.isStreaming()) {
|
||||||
torrentStream.stopStream();
|
torrentStream.stopStream();
|
||||||
}
|
}
|
||||||
unregisterReceiver();
|
unregisterReceiver();
|
||||||
@ -1122,12 +1129,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
if( player != null) {
|
if (player != null) {
|
||||||
updateHistory(player.getCurrentPosition()/1000);
|
updateHistory(player.getCurrentPosition() / 1000);
|
||||||
}
|
}
|
||||||
if (player != null && (!isPlayInMinimized || !playInMinimized)) {
|
if (player != null && (!isPlayInMinimized || !playInMinimized)) {
|
||||||
player.setPlayWhenReady(false);
|
player.setPlayWhenReady(false);
|
||||||
}else if (playInMinimized) {
|
} else if (playInMinimized) {
|
||||||
enterVideoMode();
|
enterVideoMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1143,7 +1150,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
String strAction = intent.getAction();
|
String strAction = intent.getAction();
|
||||||
if (strAction.equals(Intent.ACTION_SCREEN_OFF)) {
|
if (strAction.equals(Intent.ACTION_SCREEN_OFF)) {
|
||||||
if (player != null && isPlayInMinimized) {
|
if (player != null && isPlayInMinimized) {
|
||||||
if( !sharedpreferences.getBoolean(getString(R.string.set_play_screen_lock_choice), false)) {
|
if (!sharedpreferences.getBoolean(getString(R.string.set_play_screen_lock_choice), false)) {
|
||||||
player.setPlayWhenReady(false);
|
player.setPlayWhenReady(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1168,7 +1175,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||||
@Override
|
@Override
|
||||||
public void onUserLeaveHint() {
|
public void onUserLeaveHint() {
|
||||||
@ -1190,10 +1196,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (binding.replyThread.getVisibility() == View.VISIBLE) {
|
if (binding.postComment.getVisibility() == View.VISIBLE) {
|
||||||
|
closePostComment();
|
||||||
|
} else if (binding.replyThread.getVisibility() == View.VISIBLE) {
|
||||||
closeCommentThread();
|
closeCommentThread();
|
||||||
} else {
|
} else {
|
||||||
if (playInMinimized && player != null) {
|
if (playInMinimized && player != null) {
|
||||||
@ -1204,7 +1211,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) {
|
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) {
|
||||||
if (isInPictureInPictureMode) {
|
if (isInPictureInPictureMode) {
|
||||||
@ -1218,7 +1224,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void displayResolution() {
|
public void displayResolution() {
|
||||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(PeertubeActivity.this);
|
AlertDialog.Builder builderSingle = new AlertDialog.Builder(PeertubeActivity.this);
|
||||||
builderSingle.setTitle(R.string.pickup_resolution);
|
builderSingle.setTitle(R.string.pickup_resolution);
|
||||||
@ -1248,7 +1253,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.loader.setVisibility(View.GONE);
|
binding.loader.setVisibility(View.GONE);
|
||||||
startStream(
|
startStream(
|
||||||
peertube.getFileUrl(res, PeertubeActivity.this),
|
peertube.getFileUrl(res, PeertubeActivity.this),
|
||||||
peertube.getStreamingPlaylists().size()>0?peertube.getStreamingPlaylists().get(0).getPlaylistUrl():null,
|
peertube.getStreamingPlaylists().size() > 0 ? peertube.getStreamingPlaylists().get(0).getPlaylistUrl() : null,
|
||||||
true, position, null, null);
|
true, position, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1256,19 +1261,22 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
builderSingle.show();
|
builderSingle.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initFullscreenDialog() {
|
private void initFullscreenDialog() {
|
||||||
|
|
||||||
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) {
|
if (player != null && player.isPlaying() && fullScreenMode) {
|
||||||
player.setPlayWhenReady(false);
|
player.setPlayWhenReady(false);
|
||||||
}
|
}
|
||||||
if( fullScreenMode) {
|
if (fullScreenMode) {
|
||||||
closeFullscreenDialog();
|
closeFullscreenDialog();
|
||||||
|
if (!Helper.isTablet(PeertubeActivity.this) && initialOrientation != Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
Handler handler = new Handler();
|
Handler handler = new Handler();
|
||||||
handler.postDelayed(() -> setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR), 2000);
|
handler.postDelayed(() -> setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR), 2000);
|
||||||
|
} else {
|
||||||
|
binding.peertubeInformationContainer.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
@ -1285,24 +1293,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
fullScreenDialog.show();
|
fullScreenDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openCommentThread(Comment comment, int position) {
|
public void openCommentThread(Comment comment) {
|
||||||
|
|
||||||
|
|
||||||
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
|
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
|
||||||
binding.peertubeReply.setVisibility(View.GONE);
|
binding.peertubeReply.setVisibility(View.GONE);
|
||||||
commentViewModel.getRepliesComment(videoUuid, comment.getId()).observe(PeertubeActivity.this, this::manageVIewCommentReply);
|
commentViewModel.getRepliesComment(videoUuid, comment.getId()).observe(PeertubeActivity.this, apiResponse -> manageVIewCommentReply(comment, apiResponse));
|
||||||
|
|
||||||
Account account = comment.getAccount();
|
|
||||||
Helper.loadGiF(PeertubeActivity.this, account.getAvatar() != null ? account.getAvatar().getPath() : null, binding.commentAccountProfile);
|
|
||||||
binding.commentAccountDisplayname.setText(account.getDisplayName());
|
|
||||||
binding.commentAccountUsername.setText(account.getAcct());
|
|
||||||
Spanned commentSpan;
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
|
||||||
commentSpan = Html.fromHtml(comment.getText(), Html.FROM_HTML_MODE_COMPACT);
|
|
||||||
else
|
|
||||||
commentSpan = Html.fromHtml(comment.getText());
|
|
||||||
binding.commentContent.setText(commentSpan);
|
|
||||||
binding.commentDate.setText(Helper.dateDiff(PeertubeActivity.this, comment.getCreatedAt()));
|
|
||||||
binding.replyThread.setVisibility(View.VISIBLE);
|
binding.replyThread.setVisibility(View.VISIBLE);
|
||||||
TranslateAnimation animate = new TranslateAnimation(
|
TranslateAnimation animate = new TranslateAnimation(
|
||||||
binding.peertubeInformationContainer.getWidth(),
|
binding.peertubeInformationContainer.getWidth(),
|
||||||
@ -1313,29 +1309,36 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(Animation animation) {
|
public void onAnimationStart(Animation animation) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animation animation) {
|
public void onAnimationEnd(Animation animation) {
|
||||||
binding.peertubeInformationContainer.setVisibility(View.GONE);
|
binding.peertubeInformationContainer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationRepeat(Animation animation) {
|
public void onAnimationRepeat(Animation animation) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
animate.setDuration(500);
|
animate.setDuration(500);
|
||||||
binding.addCommentWriteReply.setText(String.format("@%s ", comment.getAccount().getAcct()));
|
|
||||||
binding.addCommentWriteReply.setSelection(binding.addCommentWriteReply.getText().length());
|
|
||||||
binding.replyThread.startAnimation(animate);
|
binding.replyThread.startAnimation(animate);
|
||||||
binding.sendReply.setOnClickListener(null);
|
}
|
||||||
binding.sendReply.setOnClickListener(v -> {
|
|
||||||
|
private void sendComment(Comment comment, int position) {
|
||||||
if (isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
if (isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
||||||
String commentView = binding.addCommentWriteReply.getText().toString();
|
if (comment == null) {
|
||||||
|
String commentStr = binding.addCommentWrite.getText() != null ? binding.addCommentWrite.getText().toString() : "";
|
||||||
|
if (commentStr.trim().length() > 0) {
|
||||||
|
PostActionsVM viewModelComment = new ViewModelProvider(PeertubeActivity.this).get(PostActionsVM.class);
|
||||||
|
viewModelComment.comment(ADD_COMMENT, peertube.getId(), null, commentStr).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(ADD_COMMENT, 0, apiResponse1));
|
||||||
|
binding.addCommentWrite.setText("");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String commentView = binding.addCommentWrite.getText() != null ? binding.addCommentWrite.getText().toString() : "";
|
||||||
if (commentView.trim().length() > 0) {
|
if (commentView.trim().length() > 0) {
|
||||||
PostActionsVM viewModelComment = new ViewModelProvider(PeertubeActivity.this).get(PostActionsVM.class);
|
PostActionsVM viewModelComment = new ViewModelProvider(PeertubeActivity.this).get(PostActionsVM.class);
|
||||||
viewModelComment.comment(REPLY, peertube.getId(), comment.getId(), commentView).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(REPLY, position, apiResponse1));
|
viewModelComment.comment(REPLY, peertube.getId(), comment.getId(), commentView).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(REPLY, position, apiResponse1));
|
||||||
binding.addCommentWriteReply.setText("");
|
binding.addCommentWrite.setText("");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
closePostComment();
|
||||||
} else {
|
} else {
|
||||||
if (sepiaSearch) {
|
if (sepiaSearch) {
|
||||||
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
||||||
@ -1343,11 +1346,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeCommentThread() {
|
private void closeCommentThread() {
|
||||||
binding.peertubeInformationContainer.setVisibility(View.VISIBLE);
|
binding.peertubeInformationContainer.setVisibility(View.VISIBLE);
|
||||||
|
hideKeyboard(this);
|
||||||
TranslateAnimation animate = new TranslateAnimation(
|
TranslateAnimation animate = new TranslateAnimation(
|
||||||
0,
|
0,
|
||||||
binding.replyThread.getWidth(),
|
binding.replyThread.getWidth(),
|
||||||
@ -1371,6 +1374,92 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.replyThread.startAnimation(animate);
|
binding.replyThread.startAnimation(animate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void openPostComment(Comment comment, int position) {
|
||||||
|
if (comment != null) {
|
||||||
|
binding.replyContent.setVisibility(View.VISIBLE);
|
||||||
|
Account account = comment.getAccount();
|
||||||
|
Helper.loadGiF(PeertubeActivity.this, account.getAvatar() != null ? account.getAvatar().getPath() : null, binding.commentAccountProfile);
|
||||||
|
binding.commentAccountDisplayname.setText(account.getDisplayName());
|
||||||
|
binding.commentAccountUsername.setText(account.getAcct());
|
||||||
|
Spanned commentSpan;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
|
commentSpan = Html.fromHtml(comment.getText(), Html.FROM_HTML_MODE_COMPACT);
|
||||||
|
else
|
||||||
|
commentSpan = Html.fromHtml(comment.getText());
|
||||||
|
binding.commentContent.setText(commentSpan);
|
||||||
|
binding.commentDate.setText(Helper.dateDiff(PeertubeActivity.this, comment.getCreatedAt()));
|
||||||
|
} else {
|
||||||
|
binding.replyContent.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
binding.postComment.setVisibility(View.VISIBLE);
|
||||||
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||||
|
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
int height = displayMetrics.heightPixels;
|
||||||
|
TranslateAnimation animateComment = new TranslateAnimation(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
height,
|
||||||
|
0);
|
||||||
|
animateComment.setAnimationListener(new Animation.AnimationListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animation animation) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animation animation) {
|
||||||
|
binding.peertubeInformationContainer.setVisibility(View.GONE);
|
||||||
|
InputMethodManager inputMethodManager =
|
||||||
|
(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
inputMethodManager.toggleSoftInputFromWindow(
|
||||||
|
binding.addCommentWrite.getApplicationWindowToken(),
|
||||||
|
InputMethodManager.SHOW_FORCED, 0);
|
||||||
|
binding.addCommentWrite.requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationRepeat(Animation animation) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
animateComment.setDuration(500);
|
||||||
|
binding.postComment.startAnimation(animateComment);
|
||||||
|
if (comment != null) {
|
||||||
|
binding.addCommentWrite.setText(String.format("@%s ", comment.getAccount().getAcct()));
|
||||||
|
binding.addCommentWrite.setSelection(binding.addCommentWrite.getText() != null ? binding.addCommentWrite.getText().length() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.send.setOnClickListener(null);
|
||||||
|
binding.send.setOnClickListener(v -> sendComment(comment, position));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closePostComment() {
|
||||||
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||||
|
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
int height = displayMetrics.heightPixels;
|
||||||
|
binding.peertubeInformationContainer.setVisibility(View.VISIBLE);
|
||||||
|
hideKeyboard(this);
|
||||||
|
TranslateAnimation animateComment = new TranslateAnimation(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
height);
|
||||||
|
animateComment.setAnimationListener(new Animation.AnimationListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animation animation) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animation animation) {
|
||||||
|
binding.postComment.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationRepeat(Animation animation) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
animateComment.setDuration(500);
|
||||||
|
binding.postComment.startAnimation(animateComment);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"unused", "RedundantSuppression"})
|
@SuppressWarnings({"unused", "RedundantSuppression"})
|
||||||
public void manageVIewPostActions(RetrofitPeertubeAPI.ActionType statusAction, int position, APIResponse apiResponse) {
|
public void manageVIewPostActions(RetrofitPeertubeAPI.ActionType statusAction, int position, APIResponse apiResponse) {
|
||||||
|
|
||||||
@ -1410,7 +1499,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
openFullscreenDialog();
|
openFullscreenDialog();
|
||||||
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
}else {
|
} else {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1422,12 +1511,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
ImageButton playButton = controlView.findViewById(R.id.exo_play);
|
ImageButton playButton = controlView.findViewById(R.id.exo_play);
|
||||||
playButton.setOnClickListener(v->{
|
playButton.setOnClickListener(v -> {
|
||||||
if(autoFullscreen && !fullScreenMode) {
|
if (autoFullscreen && !fullScreenMode) {
|
||||||
openFullscreenDialog();
|
openFullscreenDialog();
|
||||||
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
}else {
|
} else {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1542,7 +1631,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addElement(String playlistId, String videoId, APIResponse apiResponse) {
|
public void addElement(String playlistId, String videoId, APIResponse apiResponse) {
|
||||||
if (apiResponse != null && apiResponse.getActionReturn() != null) {
|
if (apiResponse != null && apiResponse.getActionReturn() != null) {
|
||||||
|
|
||||||
@ -1558,12 +1646,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void updateHistory(long position) {
|
private void updateHistory(long position) {
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
boolean storeInHistory = sharedpreferences.getBoolean(getString(R.string.set_store_in_history), true);
|
boolean storeInHistory = sharedpreferences.getBoolean(getString(R.string.set_store_in_history), true);
|
||||||
if( Helper.isLoggedIn(PeertubeActivity.this) && peertube != null && storeInHistory) {
|
if (Helper.isLoggedIn(PeertubeActivity.this) && peertube != null && storeInHistory) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
RetrofitPeertubeAPI api = new RetrofitPeertubeAPI(PeertubeActivity.this);
|
RetrofitPeertubeAPI api = new RetrofitPeertubeAPI(PeertubeActivity.this);
|
||||||
@ -1580,13 +1666,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.noActionText.setVisibility(View.VISIBLE);
|
binding.noActionText.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void playNextVideo() {
|
private void playNextVideo() {
|
||||||
if( nextVideo != null) {
|
if (nextVideo != null) {
|
||||||
Intent intent = new Intent(PeertubeActivity.this, PeertubeActivity.class);
|
Intent intent = new Intent(PeertubeActivity.this, PeertubeActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
b.putParcelable("video",nextVideo);
|
b.putParcelable("video", nextVideo);
|
||||||
b.putString("video_id", nextVideo.getId());
|
b.putString("video_id", nextVideo.getId());
|
||||||
b.putString("video_uuid", nextVideo.getUuid());
|
b.putString("video_uuid", nextVideo.getUuid());
|
||||||
playedVideos.add(nextVideo.getId());
|
playedVideos.add(nextVideo.getId());
|
||||||
@ -1596,22 +1680,24 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMediaItemTransition(MediaItem mediaItem, int reason) {
|
public void onMediaItemTransition(MediaItem mediaItem, int reason) {
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
boolean autoplayNextVideo = sharedpreferences.getBoolean(getString(R.string.set_autoplay_next_video_choice), true);
|
boolean autoplayNextVideo = sharedpreferences.getBoolean(getString(R.string.set_autoplay_next_video_choice), true);
|
||||||
if (reason == MEDIA_ITEM_TRANSITION_REASON_AUTO && autoplayNextVideo){
|
if (reason == MEDIA_ITEM_TRANSITION_REASON_AUTO && autoplayNextVideo) {
|
||||||
player.removeMediaItems(0, player.getMediaItemCount());
|
player.removeMediaItems(0, player.getMediaItemCount());
|
||||||
playNextVideo();
|
playNextVideo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerError(ExoPlaybackException error) {
|
public void onPlayerError(ExoPlaybackException error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum videoOrientation {
|
||||||
|
LANDSCAPE,
|
||||||
|
PORTRAIT
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,6 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
|||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (BuildConfig.full_instances) {
|
if (BuildConfig.full_instances) {
|
||||||
binding.loginInstanceContainer.setVisibility(View.VISIBLE);
|
binding.loginInstanceContainer.setVisibility(View.VISIBLE);
|
||||||
binding.titleLoginInstance.setVisibility(View.VISIBLE);
|
binding.titleLoginInstance.setVisibility(View.VISIBLE);
|
||||||
@ -114,17 +113,17 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
|||||||
setTextAgreement();
|
setTextAgreement();
|
||||||
binding.signup.setOnClickListener(view -> {
|
binding.signup.setOnClickListener(view -> {
|
||||||
binding.errorMessage.setVisibility(View.GONE);
|
binding.errorMessage.setVisibility(View.GONE);
|
||||||
if ( binding.username.getText() == null || binding.email.getText() == null || binding.password.getText() == null || binding.passwordConfirm.getText() == null || binding.username.getText().toString().trim().length() == 0 || binding.email.getText().toString().trim().length() == 0 ||
|
if (binding.username.getText() == null || binding.email.getText() == null || binding.password.getText() == null || binding.passwordConfirm.getText() == null || binding.username.getText().toString().trim().length() == 0 || binding.email.getText().toString().trim().length() == 0 ||
|
||||||
binding.password.getText().toString().trim().length() == 0 || binding.passwordConfirm.getText().toString().trim().length() == 0 || ! binding.agreement.isChecked()) {
|
binding.password.getText().toString().trim().length() == 0 || binding.passwordConfirm.getText().toString().trim().length() == 0 || !binding.agreement.isChecked()) {
|
||||||
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.all_field_filled)).show();
|
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.all_field_filled)).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! binding.password.getText().toString().trim().equals( binding.passwordConfirm.getText().toString().trim())) {
|
if (!binding.password.getText().toString().trim().equals(binding.passwordConfirm.getText().toString().trim())) {
|
||||||
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.password_error)).show();
|
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.password_error)).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!android.util.Patterns.EMAIL_ADDRESS.matcher( binding.email.getText().toString().trim()).matches()) {
|
if (!android.util.Patterns.EMAIL_ADDRESS.matcher(binding.email.getText().toString().trim()).matches()) {
|
||||||
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.email_error)).show();
|
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.email_error)).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -136,18 +135,18 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( binding.password.getText().toString().trim().length() < 8) {
|
if (binding.password.getText().toString().trim().length() < 8) {
|
||||||
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.password_too_short)).show();
|
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.password_too_short)).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( binding.username.getText().toString().matches("[a-z0-9_]")) {
|
if (binding.username.getText().toString().matches("[a-z0-9_]")) {
|
||||||
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.username_error)).show();
|
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.username_error)).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
binding.signup.setEnabled(false);
|
binding.signup.setEnabled(false);
|
||||||
|
|
||||||
if (BuildConfig.full_instances) {
|
if (BuildConfig.full_instances) {
|
||||||
if ( binding.loginInstance.getText() != null) {
|
if (binding.loginInstance.getText() != null) {
|
||||||
instance = binding.loginInstance.getText().toString();
|
instance = binding.loginInstance.getText().toString();
|
||||||
} else {
|
} else {
|
||||||
instance = "";
|
instance = "";
|
||||||
@ -166,10 +165,10 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AccountCreation accountCreation = new AccountCreation();
|
AccountCreation accountCreation = new AccountCreation();
|
||||||
accountCreation.setEmail( binding.email.getText().toString().trim());
|
accountCreation.setEmail(binding.email.getText().toString().trim());
|
||||||
accountCreation.setPassword( binding.password.getText().toString().trim());
|
accountCreation.setPassword(binding.password.getText().toString().trim());
|
||||||
accountCreation.setPasswordConfirm( binding.passwordConfirm.getText().toString().trim());
|
accountCreation.setPasswordConfirm(binding.passwordConfirm.getText().toString().trim());
|
||||||
accountCreation.setUsername( binding.username.getText().toString().trim());
|
accountCreation.setUsername(binding.username.getText().toString().trim());
|
||||||
accountCreation.setInstance(instance);
|
accountCreation.setInstance(instance);
|
||||||
|
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
@ -259,7 +258,7 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
|||||||
agreement_text.setMovementMethod(null);
|
agreement_text.setMovementMethod(null);
|
||||||
agreement_text.setText(null);
|
agreement_text.setText(null);
|
||||||
if (BuildConfig.full_instances) {
|
if (BuildConfig.full_instances) {
|
||||||
if ( binding.loginInstance.getText() != null) {
|
if (binding.loginInstance.getText() != null) {
|
||||||
content_agreement = getString(R.string.agreement_check_peertube,
|
content_agreement = getString(R.string.agreement_check_peertube,
|
||||||
"<a href='https://" + binding.loginInstance.getText().toString() + "/about/instance#terms-section' >" + tos + "</a>"
|
"<a href='https://" + binding.loginInstance.getText().toString() + "/about/instance#terms-section' >" + tos + "</a>"
|
||||||
);
|
);
|
||||||
|
@ -66,8 +66,8 @@ import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.MY_CHA
|
|||||||
public class PeertubeUploadActivity extends AppCompatActivity {
|
public class PeertubeUploadActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
private final int PICK_IVDEO = 52378;
|
|
||||||
public static final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 724;
|
public static final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 724;
|
||||||
|
private final int PICK_IVDEO = 52378;
|
||||||
private Button set_upload_file, set_upload_submit;
|
private Button set_upload_file, set_upload_submit;
|
||||||
private Spinner set_upload_privacy, set_upload_channel;
|
private Spinner set_upload_privacy, set_upload_channel;
|
||||||
private TextView set_upload_file_name;
|
private TextView set_upload_file_name;
|
||||||
|
@ -14,6 +14,7 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -24,12 +25,14 @@ import androidx.fragment.app.FragmentTransaction;
|
|||||||
import app.fedilab.fedilabtube.client.data.PlaylistData;
|
import app.fedilab.fedilabtube.client.data.PlaylistData;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.PlaylistExportHelper;
|
||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
public class PlaylistsActivity extends AppCompatActivity {
|
public class PlaylistsActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private final int PICK_IMPORT = 5556;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -58,7 +61,7 @@ public class PlaylistsActivity extends AppCompatActivity {
|
|||||||
DisplayVideosFragment displayVideosFragment = new DisplayVideosFragment();
|
DisplayVideosFragment displayVideosFragment = new DisplayVideosFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable(Helper.TIMELINE_TYPE, TimelineVM.TimelineType.VIDEOS_IN_PLAYLIST);
|
bundle.putSerializable(Helper.TIMELINE_TYPE, TimelineVM.TimelineType.VIDEOS_IN_PLAYLIST);
|
||||||
bundle.putSerializable("playlistId", playlist.getId());
|
bundle.putSerializable("playlistId", playlist.getUuid());
|
||||||
displayVideosFragment.setArguments(bundle);
|
displayVideosFragment.setArguments(bundle);
|
||||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
ft.add(R.id.nav_host_fragment, displayVideosFragment).commit();
|
ft.add(R.id.nav_host_fragment, displayVideosFragment).commit();
|
||||||
@ -66,6 +69,22 @@ public class PlaylistsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode,
|
||||||
|
Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (requestCode == PICK_IMPORT && resultCode == RESULT_OK) {
|
||||||
|
if (data == null || data.getData() == null) {
|
||||||
|
Toasty.error(PlaylistsActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlaylistExportHelper.manageIntentUrl(PlaylistsActivity.this, data);
|
||||||
|
|
||||||
|
} else if (requestCode == PICK_IMPORT) {
|
||||||
|
Toasty.error(PlaylistsActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
@ -105,6 +105,7 @@ public class ShowAccountActivity extends AppCompatActivity {
|
|||||||
if (!Helper.isLoggedIn(ShowAccountActivity.this)) {
|
if (!Helper.isLoggedIn(ShowAccountActivity.this)) {
|
||||||
menu.findItem(R.id.action_mute).setVisible(false);
|
menu.findItem(R.id.action_mute).setVisible(false);
|
||||||
}
|
}
|
||||||
|
menu.findItem(R.id.action_display_account).setVisible(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +135,7 @@ public class ShowAccountActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
AlertDialog alertDialog = dialogBuilder.create();
|
AlertDialog alertDialog = dialogBuilder.create();
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
}else if( item.getItemId() == R.id.action_share && account != null) {
|
} else if (item.getItemId() == R.id.action_share && account != null) {
|
||||||
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||||
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.shared_via));
|
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.shared_via));
|
||||||
String extra_text = account.getUrl();
|
String extra_text = account.getUrl();
|
||||||
|
@ -17,6 +17,7 @@ package app.fedilab.fedilabtube;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
@ -54,10 +55,14 @@ import java.util.Map;
|
|||||||
|
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
|
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||||
import app.fedilab.fedilabtube.client.data.ChannelData.Channel;
|
import app.fedilab.fedilabtube.client.data.ChannelData.Channel;
|
||||||
|
import app.fedilab.fedilabtube.drawer.OwnAccountsAdapter;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
||||||
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
||||||
import app.fedilab.fedilabtube.viewmodel.RelationshipVM;
|
import app.fedilab.fedilabtube.viewmodel.RelationshipVM;
|
||||||
@ -65,6 +70,7 @@ import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
|||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.SURFING;
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.FOLLOW;
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.FOLLOW;
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
|
||||||
@ -122,6 +128,57 @@ public class ShowChannelActivity extends AppCompatActivity {
|
|||||||
ChannelsVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(ChannelsVM.class);
|
ChannelsVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(ChannelsVM.class);
|
||||||
viewModel.get(sepiaSearch ? peertubeInstance : null, CHANNEL, channelAcct == null ? channel.getAcct() : channelAcct).observe(ShowChannelActivity.this, this::manageViewAccounts);
|
viewModel.get(sepiaSearch ? peertubeInstance : null, CHANNEL, channelAcct == null ? channel.getAcct() : channelAcct).observe(ShowChannelActivity.this, this::manageViewAccounts);
|
||||||
manageChannel();
|
manageChannel();
|
||||||
|
|
||||||
|
if (MainActivity.typeOfConnection == MainActivity.TypeOfConnection.SURFING) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
int[][] states = new int[][]{
|
||||||
|
new int[]{android.R.attr.state_enabled}, // enabled
|
||||||
|
new int[]{-android.R.attr.state_enabled}, // disabled
|
||||||
|
new int[]{-android.R.attr.state_checked}, // unchecked
|
||||||
|
new int[]{android.R.attr.state_pressed} // pressed
|
||||||
|
};
|
||||||
|
|
||||||
|
int[] colors = new int[]{
|
||||||
|
ContextCompat.getColor(ShowChannelActivity.this, Helper.getColorAccent()),
|
||||||
|
ContextCompat.getColor(ShowChannelActivity.this, Helper.getColorAccent()),
|
||||||
|
ContextCompat.getColor(ShowChannelActivity.this, Helper.getColorAccent()),
|
||||||
|
ContextCompat.getColor(ShowChannelActivity.this, Helper.getColorAccent())
|
||||||
|
};
|
||||||
|
account_follow.setBackgroundTintList(new ColorStateList(states, colors));
|
||||||
|
}
|
||||||
|
account_follow.setText(getString(R.string.action_follow));
|
||||||
|
account_follow.setEnabled(true);
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
List<AccountData.Account> accounts = new AccountDAO(ShowChannelActivity.this, db).getAllAccount();
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
account_follow.setVisibility(View.VISIBLE);
|
||||||
|
account_follow.setOnClickListener(v -> {
|
||||||
|
AlertDialog.Builder builderSingle = new AlertDialog.Builder(ShowChannelActivity.this);
|
||||||
|
builderSingle.setTitle(getString(R.string.list_of_accounts));
|
||||||
|
if (accounts != null) {
|
||||||
|
final OwnAccountsAdapter accountsListAdapter = new OwnAccountsAdapter(ShowChannelActivity.this, accounts);
|
||||||
|
builderSingle.setAdapter(accountsListAdapter, (dialog, which) -> {
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
RetrofitPeertubeAPI peertubeAPI = new RetrofitPeertubeAPI(ShowChannelActivity.this, accounts.get(which).getHost(), accounts.get(which).getToken());
|
||||||
|
peertubeAPI.post(FOLLOW, channel.getAcct(), null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
builderSingle.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
|
builderSingle.show();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -159,7 +216,7 @@ public class ShowChannelActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
androidx.appcompat.app.AlertDialog alertDialog = dialogBuilder.create();
|
androidx.appcompat.app.AlertDialog alertDialog = dialogBuilder.create();
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
} else if( item.getItemId() == R.id.action_share && channel != null) {
|
} else if (item.getItemId() == R.id.action_share && channel != null) {
|
||||||
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||||
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.shared_via));
|
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.shared_via));
|
||||||
String extra_text = channel.getUrl();
|
String extra_text = channel.getUrl();
|
||||||
@ -170,6 +227,13 @@ public class ShowChannelActivity extends AppCompatActivity {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toasty.error(ShowChannelActivity.this, getString(R.string.toast_error), Toasty.LENGTH_LONG).show();
|
Toasty.error(ShowChannelActivity.this, getString(R.string.toast_error), Toasty.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
} else if (item.getItemId() == R.id.action_display_account) {
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
Intent intent = new Intent(ShowChannelActivity.this, ShowAccountActivity.class);
|
||||||
|
b.putParcelable("account", channel.getOwnerAccount());
|
||||||
|
b.putString("accountAcct", channel.getOwnerAccount().getAcct());
|
||||||
|
intent.putExtras(b);
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
@ -178,7 +242,7 @@ public class ShowChannelActivity extends AppCompatActivity {
|
|||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
|
||||||
String accountIdRelation = channel.getAcct();
|
String accountIdRelation = channel.getAcct();
|
||||||
if (isLoggedIn(ShowChannelActivity.this) && !sepiaSearch) {
|
if (isLoggedIn(ShowChannelActivity.this)) {
|
||||||
RelationshipVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(RelationshipVM.class);
|
RelationshipVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(RelationshipVM.class);
|
||||||
List<String> uids = new ArrayList<>();
|
List<String> uids = new ArrayList<>();
|
||||||
uids.add(accountIdRelation);
|
uids.add(accountIdRelation);
|
||||||
@ -305,7 +369,7 @@ public class ShowChannelActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
//Manages the visibility of the button
|
//Manages the visibility of the button
|
||||||
private void manageButtonVisibility() {
|
private void manageButtonVisibility() {
|
||||||
if (relationship == null)
|
if (relationship == null || MainActivity.typeOfConnection == SURFING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
@ -14,26 +14,45 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
|
import app.fedilab.fedilabtube.databinding.ActivitySearchResultBinding;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.HISTORY;
|
||||||
|
|
||||||
|
|
||||||
public class VideosTimelineActivity extends AppCompatActivity {
|
public class VideosTimelineActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private TimelineVM.TimelineType type;
|
private TimelineVM.TimelineType type;
|
||||||
|
private DisplayVideosFragment displayVideosFragment;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.activity_search_result);
|
ActivitySearchResultBinding binding = ActivitySearchResultBinding.inflate(getLayoutInflater());
|
||||||
|
View mainView = binding.getRoot();
|
||||||
|
setContentView(mainView);
|
||||||
|
|
||||||
if (getSupportActionBar() != null)
|
if (getSupportActionBar() != null)
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
@ -41,23 +60,75 @@ public class VideosTimelineActivity extends AppCompatActivity {
|
|||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
if (b != null)
|
if (b != null)
|
||||||
type = (TimelineVM.TimelineType) b.get("type");
|
type = (TimelineVM.TimelineType) b.get("type");
|
||||||
|
displayVideosFragment = null;
|
||||||
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
|
if (savedInstanceState == null) {
|
||||||
|
displayVideosFragment = new DisplayVideosFragment();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable(Helper.TIMELINE_TYPE, type);
|
||||||
|
displayVideosFragment.setArguments(bundle);
|
||||||
|
ft.add(R.id.container, displayVideosFragment).addToBackStack(null).commit();
|
||||||
|
}
|
||||||
|
|
||||||
if (type == TimelineVM.TimelineType.MY_VIDEOS) {
|
if (type == TimelineVM.TimelineType.MY_VIDEOS) {
|
||||||
setTitle(R.string.my_videos);
|
setTitle(R.string.my_videos);
|
||||||
} else if (type == TimelineVM.TimelineType.HISTORY) {
|
} else if (type == HISTORY) {
|
||||||
setTitle(R.string.my_history);
|
setTitle(R.string.my_history);
|
||||||
|
//TODO: uncomment when available
|
||||||
|
// binding.historyFilter.setVisibility(View.VISIBLE);
|
||||||
|
binding.historyFilterAll.setOnClickListener(v -> historyFilter(null));
|
||||||
|
binding.historyFilterToday.setOnClickListener(v -> {
|
||||||
|
Calendar cal = GregorianCalendar.getInstance();
|
||||||
|
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
cal.set(Calendar.MINUTE, 0);
|
||||||
|
cal.set(Calendar.SECOND, 0);
|
||||||
|
cal.set(Calendar.MILLISECOND, 0);
|
||||||
|
cal.getTime();
|
||||||
|
historyFilter(cal.getTime());
|
||||||
|
});
|
||||||
|
binding.historyFilterLast7Days.setOnClickListener(v -> {
|
||||||
|
Calendar cal = GregorianCalendar.getInstance();
|
||||||
|
cal.setTime(new Date());
|
||||||
|
cal.add(Calendar.DAY_OF_YEAR, -7);
|
||||||
|
cal.getTime();
|
||||||
|
historyFilter(cal.getTime());
|
||||||
|
});
|
||||||
|
|
||||||
} else if (type == TimelineVM.TimelineType.MOST_LIKED) {
|
} else if (type == TimelineVM.TimelineType.MOST_LIKED) {
|
||||||
setTitle(R.string.title_most_liked);
|
setTitle(R.string.title_most_liked);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
|
||||||
DisplayVideosFragment displayVideosFragment = new DisplayVideosFragment();
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
bundle.putSerializable(Helper.TIMELINE_TYPE, type);
|
|
||||||
displayVideosFragment.setArguments(bundle);
|
|
||||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
|
||||||
ft.add(R.id.container, displayVideosFragment).commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void historyFilter(Date date) {
|
||||||
|
String startDate = null;
|
||||||
|
if (date != null) {
|
||||||
|
SimpleDateFormat fmtOut = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH);
|
||||||
|
startDate = fmtOut.format(date);
|
||||||
|
}
|
||||||
|
if (displayVideosFragment != null) {
|
||||||
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
|
displayVideosFragment = new DisplayVideosFragment();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable(Helper.TIMELINE_TYPE, HISTORY);
|
||||||
|
bundle.putSerializable("startDate", startDate);
|
||||||
|
displayVideosFragment.setArguments(bundle);
|
||||||
|
ft.replace(R.id.container, displayVideosFragment);
|
||||||
|
ft.addToBackStack(null);
|
||||||
|
ft.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
||||||
|
if (type == HISTORY) {
|
||||||
|
getMenuInflater().inflate(R.menu.main_history, menu);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return super.onCreateOptionsMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -66,8 +137,34 @@ public class VideosTimelineActivity extends AppCompatActivity {
|
|||||||
if (item.getItemId() == android.R.id.home) {
|
if (item.getItemId() == android.R.id.home) {
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
|
} else if (item.getItemId() == R.id.action_delete) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(VideosTimelineActivity.this);
|
||||||
|
builder.setTitle(R.string.delete_history);
|
||||||
|
builder.setMessage(R.string.delete_history_confirm);
|
||||||
|
builder.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
|
.setPositiveButton(R.string.delete, (dialog, which) -> {
|
||||||
|
TimelineVM viewModelFeeds = new ViewModelProvider(VideosTimelineActivity.this).get(TimelineVM.class);
|
||||||
|
viewModelFeeds.deleterHistory().observe(VideosTimelineActivity.this, this::manageVIewVideos);
|
||||||
|
|
||||||
|
dialog.dismiss();
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
||||||
|
.show();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void manageVIewVideos(APIResponse apiResponse) {
|
||||||
|
if (type == HISTORY) {
|
||||||
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
|
displayVideosFragment = new DisplayVideosFragment();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable(Helper.TIMELINE_TYPE, HISTORY);
|
||||||
|
displayVideosFragment.setArguments(bundle);
|
||||||
|
ft.replace(R.id.container, displayVideosFragment);
|
||||||
|
ft.addToBackStack(null);
|
||||||
|
ft.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,10 @@ public interface PeertubeService {
|
|||||||
@GET(".well-known/nodeinfo")
|
@GET(".well-known/nodeinfo")
|
||||||
Call<WellKnownNodeinfo> getWellKnownNodeinfo();
|
Call<WellKnownNodeinfo> getWellKnownNodeinfo();
|
||||||
|
|
||||||
|
//Instance info
|
||||||
|
@GET("config/about")
|
||||||
|
Call<InstanceData.InstanceInfo> configAbout();
|
||||||
|
|
||||||
@GET("{nodeInfoPath}")
|
@GET("{nodeInfoPath}")
|
||||||
Call<WellKnownNodeinfo.NodeInfo> getNodeinfo(@Path(value = "nodeInfoPath", encoded = true) String nodeInfoPath);
|
Call<WellKnownNodeinfo.NodeInfo> getNodeinfo(@Path(value = "nodeInfoPath", encoded = true) String nodeInfoPath);
|
||||||
|
|
||||||
@ -171,7 +175,17 @@ public interface PeertubeService {
|
|||||||
|
|
||||||
//History
|
//History
|
||||||
@GET("users/me/history/videos")
|
@GET("users/me/history/videos")
|
||||||
Call<VideoData> getHistory(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count);
|
Call<VideoData> getHistory(
|
||||||
|
@Header("Authorization") String credentials,
|
||||||
|
@Query("start") String maxId,
|
||||||
|
@Query("count") String count,
|
||||||
|
@Query("startDate") String startDate,
|
||||||
|
@Query("endDate") String endDate
|
||||||
|
);
|
||||||
|
|
||||||
|
@POST("users/me/history/videos/remove")
|
||||||
|
Call<String> deleteHistory(
|
||||||
|
@Header("Authorization") String credentials);
|
||||||
|
|
||||||
//Search
|
//Search
|
||||||
@GET("search/videos")
|
@GET("search/videos")
|
||||||
|
@ -166,9 +166,9 @@ public class RetrofitPeertubeAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getToken() {
|
private String getToken() {
|
||||||
if( token != null) {
|
if (token != null) {
|
||||||
return "Bearer " + token;
|
return "Bearer " + token;
|
||||||
}else{
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -347,6 +347,51 @@ public class RetrofitPeertubeAPI {
|
|||||||
return apiResponse;
|
return apiResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public APIResponse deleteHistory() {
|
||||||
|
APIResponse apiResponse = new APIResponse();
|
||||||
|
PeertubeService peertubeService = init();
|
||||||
|
Call<String> stringCall = peertubeService.deleteHistory(getToken());
|
||||||
|
if (stringCall != null) {
|
||||||
|
try {
|
||||||
|
Response<String> response = stringCall.execute();
|
||||||
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
|
apiResponse.setActionReturn(response.body());
|
||||||
|
} else {
|
||||||
|
setError(apiResponse, response.code(), response.errorBody());
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
Error error = new Error();
|
||||||
|
error.setError(_context.getString(R.string.toast_error));
|
||||||
|
apiResponse.setError(error);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return apiResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public APIResponse getHistory(String max_id, String startDate, String endDate) {
|
||||||
|
APIResponse apiResponse = new APIResponse();
|
||||||
|
PeertubeService peertubeService = init();
|
||||||
|
Call<VideoData> videoCall = peertubeService.getHistory(getToken(), max_id, count, startDate, endDate);
|
||||||
|
if (videoCall != null) {
|
||||||
|
try {
|
||||||
|
Response<VideoData> response = videoCall.execute();
|
||||||
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
|
apiResponse.setPeertubes(response.body().data);
|
||||||
|
} else {
|
||||||
|
setError(apiResponse, response.code(), response.errorBody());
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
Error error = new Error();
|
||||||
|
error.setError(_context.getString(R.string.toast_error));
|
||||||
|
apiResponse.setError(error);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return apiResponse;
|
||||||
|
}
|
||||||
|
|
||||||
public APIResponse getTL(TimelineVM.TimelineType timelineType, String max_id, String forAccount) {
|
public APIResponse getTL(TimelineVM.TimelineType timelineType, String max_id, String forAccount) {
|
||||||
APIResponse apiResponse = new APIResponse();
|
APIResponse apiResponse = new APIResponse();
|
||||||
PeertubeService peertubeService = init();
|
PeertubeService peertubeService = init();
|
||||||
@ -376,7 +421,7 @@ public class RetrofitPeertubeAPI {
|
|||||||
videoCall = peertubeService.getTrendingVideos(getToken(), 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, null, null);
|
||||||
break;
|
break;
|
||||||
case RECENT:
|
case RECENT:
|
||||||
videoCall = peertubeService.getRecentlyAddedVideos(getToken(), max_id, count, filter);
|
videoCall = peertubeService.getRecentlyAddedVideos(getToken(), max_id, count, filter);
|
||||||
@ -525,10 +570,10 @@ public class RetrofitPeertubeAPI {
|
|||||||
}
|
}
|
||||||
byte[] imageBytes = byteBuffer.toByteArray();
|
byte[] imageBytes = byteBuffer.toByteArray();
|
||||||
String mime = MimeTypeMap.getFileExtensionFromUrl(userSettings.getAvatarfile().toString());
|
String mime = MimeTypeMap.getFileExtensionFromUrl(userSettings.getAvatarfile().toString());
|
||||||
if( mime == null || mime.trim().length() == 0) {
|
if (mime == null || mime.trim().length() == 0) {
|
||||||
mime = "png";
|
mime = "png";
|
||||||
}
|
}
|
||||||
RequestBody requestFile = RequestBody.create(MediaType.parse("image/"+mime), imageBytes);
|
RequestBody requestFile = RequestBody.create(MediaType.parse("image/" + mime), imageBytes);
|
||||||
MultipartBody.Part bodyThumbnail = MultipartBody.Part.createFormData("avatarfile", userSettings.getFileName(), requestFile);
|
MultipartBody.Part bodyThumbnail = MultipartBody.Part.createFormData("avatarfile", userSettings.getFileName(), requestFile);
|
||||||
Call<UserMe.AvatarResponse> updateProfilePicture = peertubeService.updateProfilePicture(getToken(), bodyThumbnail);
|
Call<UserMe.AvatarResponse> updateProfilePicture = peertubeService.updateProfilePicture(getToken(), bodyThumbnail);
|
||||||
Response<UserMe.AvatarResponse> responseAvatar = updateProfilePicture.execute();
|
Response<UserMe.AvatarResponse> responseAvatar = updateProfilePicture.execute();
|
||||||
@ -597,6 +642,26 @@ public class RetrofitPeertubeAPI {
|
|||||||
return apiResponse;
|
return apiResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* About the instance
|
||||||
|
*
|
||||||
|
* @return AboutInstance
|
||||||
|
*/
|
||||||
|
public InstanceData.AboutInstance getAboutInstance() {
|
||||||
|
|
||||||
|
PeertubeService peertubeService = init();
|
||||||
|
Call<InstanceData.InstanceInfo> about = peertubeService.configAbout();
|
||||||
|
try {
|
||||||
|
Response<InstanceData.InstanceInfo> response = about.execute();
|
||||||
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
|
return response.body().getInstance();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns informations about Peertube such privacies, licenses, etc.
|
* Returns informations about Peertube such privacies, licenses, etc.
|
||||||
*
|
*
|
||||||
@ -781,7 +846,7 @@ public class RetrofitPeertubeAPI {
|
|||||||
*/
|
*/
|
||||||
public APIResponse searchNextVideos(List<String> tags) {
|
public APIResponse searchNextVideos(List<String> tags) {
|
||||||
PeertubeService peertubeService = init();
|
PeertubeService peertubeService = init();
|
||||||
Call<VideoData> searchVideosCall = peertubeService.searchNextVideo(getToken(), tags, "0" , "20");
|
Call<VideoData> searchVideosCall = peertubeService.searchNextVideo(getToken(), tags, "0", "20");
|
||||||
APIResponse apiResponse = new APIResponse();
|
APIResponse apiResponse = new APIResponse();
|
||||||
try {
|
try {
|
||||||
Response<VideoData> response = searchVideosCall.execute();
|
Response<VideoData> response = searchVideosCall.execute();
|
||||||
@ -1039,7 +1104,6 @@ public class RetrofitPeertubeAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get video description
|
* Get video description
|
||||||
*
|
*
|
||||||
@ -1054,7 +1118,8 @@ public class RetrofitPeertubeAPI {
|
|||||||
if (response.isSuccessful() && response.body() != null) {
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
return response.body();
|
return response.body();
|
||||||
}
|
}
|
||||||
} catch (IOException ignored) {}
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package app.fedilab.fedilabtube.client.data;
|
package app.fedilab.fedilabtube.client.data;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -239,5 +242,106 @@ public class InstanceData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class InstanceInfo {
|
||||||
|
@SerializedName("instance")
|
||||||
|
private AboutInstance instance;
|
||||||
|
|
||||||
|
public AboutInstance getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInstance(AboutInstance instance) {
|
||||||
|
this.instance = instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AboutInstance implements Parcelable, Serializable {
|
||||||
|
|
||||||
|
public static final Creator<AboutInstance> CREATOR = new Creator<AboutInstance>() {
|
||||||
|
@Override
|
||||||
|
public AboutInstance createFromParcel(Parcel in) {
|
||||||
|
return new AboutInstance(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AboutInstance[] newArray(int size) {
|
||||||
|
return new AboutInstance[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name;
|
||||||
|
@SerializedName("shortDescription")
|
||||||
|
private String shortDescription;
|
||||||
|
@SerializedName("description")
|
||||||
|
private String description;
|
||||||
|
@SerializedName("terms")
|
||||||
|
private String terms;
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
public AboutInstance() {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AboutInstance(Parcel in) {
|
||||||
|
name = in.readString();
|
||||||
|
shortDescription = in.readString();
|
||||||
|
description = in.readString();
|
||||||
|
terms = in.readString();
|
||||||
|
host = in.readString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShortDescription() {
|
||||||
|
return shortDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShortDescription(String shortDescription) {
|
||||||
|
this.shortDescription = shortDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTerms() {
|
||||||
|
return terms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerms(String terms) {
|
||||||
|
this.terms = terms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHost() {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHost(String host) {
|
||||||
|
this.host = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel parcel, int i) {
|
||||||
|
parcel.writeString(name);
|
||||||
|
parcel.writeString(shortDescription);
|
||||||
|
parcel.writeString(description);
|
||||||
|
parcel.writeString(terms);
|
||||||
|
parcel.writeString(host);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ public class VideoData {
|
|||||||
return file.getMagnetUri();
|
return file.getMagnetUri();
|
||||||
} else if (mode == Helper.VIDEO_MODE_TORRENT) {
|
} else if (mode == Helper.VIDEO_MODE_TORRENT) {
|
||||||
return file.getTorrentUrl();
|
return file.getTorrentUrl();
|
||||||
}else {
|
} else {
|
||||||
return file.getFileUrl();
|
return file.getFileUrl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -698,7 +698,7 @@ public class VideoData {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class UserHistory implements Parcelable{
|
public static class UserHistory implements Parcelable {
|
||||||
|
|
||||||
public static final Creator<UserHistory> CREATOR = new Creator<UserHistory>() {
|
public static final Creator<UserHistory> CREATOR = new Creator<UserHistory>() {
|
||||||
@Override
|
@Override
|
||||||
@ -743,7 +743,7 @@ public class VideoData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Description{
|
public static class Description {
|
||||||
@SerializedName("description")
|
@SerializedName("description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@ -755,4 +755,78 @@ public class VideoData {
|
|||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class VideoExport implements Parcelable {
|
||||||
|
public static final Creator<VideoExport> CREATOR = new Creator<VideoExport>() {
|
||||||
|
@Override
|
||||||
|
public VideoExport createFromParcel(Parcel in) {
|
||||||
|
return new VideoExport(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VideoExport[] newArray(int size) {
|
||||||
|
return new VideoExport[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private int id;
|
||||||
|
private String uuid;
|
||||||
|
private Video videoData;
|
||||||
|
private int playlistDBid;
|
||||||
|
|
||||||
|
public VideoExport() {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VideoExport(Parcel in) {
|
||||||
|
id = in.readInt();
|
||||||
|
uuid = in.readString();
|
||||||
|
videoData = in.readParcelable(Video.class.getClassLoader());
|
||||||
|
playlistDBid = in.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Video getVideoData() {
|
||||||
|
return videoData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideoData(Video videoData) {
|
||||||
|
this.videoData = videoData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPlaylistDBid() {
|
||||||
|
return playlistDBid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlaylistDBid(int playlistDBid) {
|
||||||
|
this.playlistDBid = playlistDBid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel parcel, int i) {
|
||||||
|
parcel.writeInt(id);
|
||||||
|
parcel.writeString(uuid);
|
||||||
|
parcel.writeParcelable(videoData, i);
|
||||||
|
parcel.writeInt(playlistDBid);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,15 @@ package app.fedilab.fedilabtube.client.data;
|
|||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings({"unused", "RedundantSuppression"})
|
@SuppressWarnings({"unused", "RedundantSuppression"})
|
||||||
public class VideoPlaylistData {
|
public class VideoPlaylistData {
|
||||||
|
|
||||||
@ -155,4 +159,90 @@ public class VideoPlaylistData {
|
|||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class VideoPlaylistExport implements Parcelable {
|
||||||
|
|
||||||
|
public static final Creator<VideoPlaylistExport> CREATOR = new Creator<VideoPlaylistExport>() {
|
||||||
|
@Override
|
||||||
|
public VideoPlaylistExport createFromParcel(Parcel in) {
|
||||||
|
return new VideoPlaylistExport(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VideoPlaylistExport[] newArray(int size) {
|
||||||
|
return new VideoPlaylistExport[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private long playlistDBkey;
|
||||||
|
private String acct;
|
||||||
|
private String uuid;
|
||||||
|
private PlaylistData.Playlist playlist;
|
||||||
|
private List<VideoPlaylistData.VideoPlaylist> videos;
|
||||||
|
|
||||||
|
|
||||||
|
public VideoPlaylistExport() {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VideoPlaylistExport(Parcel in) {
|
||||||
|
playlistDBkey = in.readLong();
|
||||||
|
acct = in.readString();
|
||||||
|
uuid = in.readString();
|
||||||
|
playlist = in.readParcelable(PlaylistData.Playlist.class.getClassLoader());
|
||||||
|
in.readList(this.videos, VideoPlaylistData.VideoPlaylist.class.getClassLoader());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAcct() {
|
||||||
|
return acct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAcct(String acct) {
|
||||||
|
this.acct = acct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlaylistData.Playlist getPlaylist() {
|
||||||
|
return playlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlaylist(PlaylistData.Playlist playlist) {
|
||||||
|
this.playlist = playlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getPlaylistDBkey() {
|
||||||
|
return playlistDBkey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlaylistDBkey(long playlistDBkey) {
|
||||||
|
this.playlistDBkey = playlistDBkey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<VideoPlaylistData.VideoPlaylist> getVideos() {
|
||||||
|
return videos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideos(List<VideoPlaylistData.VideoPlaylist> videos) {
|
||||||
|
this.videos = videos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel parcel, int i) {
|
||||||
|
parcel.writeLong(playlistDBkey);
|
||||||
|
parcel.writeString(acct);
|
||||||
|
parcel.writeString(uuid);
|
||||||
|
parcel.writeParcelable(playlist, i);
|
||||||
|
parcel.writeList(videos);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,17 @@ import com.google.gson.annotations.SerializedName;
|
|||||||
@SuppressWarnings({"unused", "RedundantSuppression"})
|
@SuppressWarnings({"unused", "RedundantSuppression"})
|
||||||
public class File implements Parcelable {
|
public class File implements Parcelable {
|
||||||
|
|
||||||
|
public static final Parcelable.Creator<File> CREATOR = new Parcelable.Creator<File>() {
|
||||||
|
@Override
|
||||||
|
public File createFromParcel(Parcel source) {
|
||||||
|
return new File(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File[] newArray(int size) {
|
||||||
|
return new File[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
@SerializedName("fileDownloadUrl")
|
@SerializedName("fileDownloadUrl")
|
||||||
private String fileDownloadUrl;
|
private String fileDownloadUrl;
|
||||||
@SerializedName("fileUrl")
|
@SerializedName("fileUrl")
|
||||||
@ -28,6 +39,21 @@ public class File implements Parcelable {
|
|||||||
@SerializedName("torrentUrl")
|
@SerializedName("torrentUrl")
|
||||||
private String torrentUrl;
|
private String torrentUrl;
|
||||||
|
|
||||||
|
public File() {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected File(Parcel in) {
|
||||||
|
this.fileDownloadUrl = in.readString();
|
||||||
|
this.fileUrl = in.readString();
|
||||||
|
this.fps = in.readInt();
|
||||||
|
this.magnetUri = in.readString();
|
||||||
|
this.metadataUrl = in.readString();
|
||||||
|
this.resolutions = in.readParcelable(Item.class.getClassLoader());
|
||||||
|
this.size = in.readLong();
|
||||||
|
this.torrentDownloadUrl = in.readString();
|
||||||
|
this.torrentUrl = in.readString();
|
||||||
|
}
|
||||||
|
|
||||||
public String getFileDownloadUrl() {
|
public String getFileDownloadUrl() {
|
||||||
return fileDownloadUrl;
|
return fileDownloadUrl;
|
||||||
}
|
}
|
||||||
@ -100,7 +126,6 @@ public class File implements Parcelable {
|
|||||||
this.torrentUrl = torrentUrl;
|
this.torrentUrl = torrentUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
return 0;
|
return 0;
|
||||||
@ -118,31 +143,4 @@ public class File implements Parcelable {
|
|||||||
dest.writeString(this.torrentDownloadUrl);
|
dest.writeString(this.torrentDownloadUrl);
|
||||||
dest.writeString(this.torrentUrl);
|
dest.writeString(this.torrentUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public File() {
|
|
||||||
}
|
|
||||||
|
|
||||||
protected File(Parcel in) {
|
|
||||||
this.fileDownloadUrl = in.readString();
|
|
||||||
this.fileUrl = in.readString();
|
|
||||||
this.fps = in.readInt();
|
|
||||||
this.magnetUri = in.readString();
|
|
||||||
this.metadataUrl = in.readString();
|
|
||||||
this.resolutions = in.readParcelable(Item.class.getClassLoader());
|
|
||||||
this.size = in.readLong();
|
|
||||||
this.torrentDownloadUrl = in.readString();
|
|
||||||
this.torrentUrl = in.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<File> CREATOR = new Parcelable.Creator<File>() {
|
|
||||||
@Override
|
|
||||||
public File createFromParcel(Parcel source) {
|
|
||||||
return new File(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public File[] newArray(int size) {
|
|
||||||
return new File[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,27 @@ package app.fedilab.fedilabtube.client.entities;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings({"unused", "RedundantSuppression"})
|
@SuppressWarnings({"unused", "RedundantSuppression"})
|
||||||
public class StreamingPlaylists {
|
public class StreamingPlaylists implements Parcelable {
|
||||||
|
|
||||||
|
public static final Creator<StreamingPlaylists> CREATOR = new Creator<StreamingPlaylists>() {
|
||||||
|
@Override
|
||||||
|
public StreamingPlaylists createFromParcel(Parcel in) {
|
||||||
|
return new StreamingPlaylists(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StreamingPlaylists[] newArray(int size) {
|
||||||
|
return new StreamingPlaylists[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
@SerializedName("id")
|
@SerializedName("id")
|
||||||
private String id;
|
private String id;
|
||||||
@SerializedName("type")
|
@SerializedName("type")
|
||||||
@ -34,6 +48,15 @@ public class StreamingPlaylists {
|
|||||||
@SerializedName("redundancies")
|
@SerializedName("redundancies")
|
||||||
private List<Redundancies> redundancies;
|
private List<Redundancies> redundancies;
|
||||||
|
|
||||||
|
protected StreamingPlaylists(Parcel in) {
|
||||||
|
id = in.readString();
|
||||||
|
type = in.readInt();
|
||||||
|
playlistUrl = in.readString();
|
||||||
|
segmentsSha256Url = in.readString();
|
||||||
|
files = in.createTypedArrayList(File.CREATOR);
|
||||||
|
redundancies = in.createTypedArrayList(Redundancies.CREATOR);
|
||||||
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -82,10 +105,41 @@ public class StreamingPlaylists {
|
|||||||
this.redundancies = redundancies;
|
this.redundancies = redundancies;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Redundancies {
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel parcel, int i) {
|
||||||
|
parcel.writeString(id);
|
||||||
|
parcel.writeInt(type);
|
||||||
|
parcel.writeString(playlistUrl);
|
||||||
|
parcel.writeString(segmentsSha256Url);
|
||||||
|
parcel.writeTypedList(files);
|
||||||
|
parcel.writeTypedList(redundancies);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class Redundancies implements Parcelable {
|
||||||
|
public static final Creator<Redundancies> CREATOR = new Creator<Redundancies>() {
|
||||||
|
@Override
|
||||||
|
public Redundancies createFromParcel(Parcel in) {
|
||||||
|
return new Redundancies(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Redundancies[] newArray(int size) {
|
||||||
|
return new Redundancies[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
@SerializedName("baseUrl")
|
@SerializedName("baseUrl")
|
||||||
private String baseUrl;
|
private String baseUrl;
|
||||||
|
|
||||||
|
protected Redundancies(Parcel in) {
|
||||||
|
baseUrl = in.readString();
|
||||||
|
}
|
||||||
|
|
||||||
public String getBaseUrl() {
|
public String getBaseUrl() {
|
||||||
return baseUrl;
|
return baseUrl;
|
||||||
}
|
}
|
||||||
@ -93,5 +147,15 @@ public class StreamingPlaylists {
|
|||||||
public void setBaseUrl(String baseUrl) {
|
public void setBaseUrl(String baseUrl) {
|
||||||
this.baseUrl = baseUrl;
|
this.baseUrl = baseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel parcel, int i) {
|
||||||
|
parcel.writeString(baseUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,26 +37,14 @@ public class UserSettings {
|
|||||||
return videosHistoryEnabled;
|
return videosHistoryEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVideosHistoryEnabled(Boolean videosHistoryEnabled) {
|
|
||||||
this.videosHistoryEnabled = videosHistoryEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean isAutoPlayVideo() {
|
public Boolean isAutoPlayVideo() {
|
||||||
return autoPlayVideo;
|
return autoPlayVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutoPlayVideo(Boolean autoPlayVideo) {
|
|
||||||
this.autoPlayVideo = autoPlayVideo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean isWebTorrentEnabled() {
|
public Boolean isWebTorrentEnabled() {
|
||||||
return webTorrentEnabled;
|
return webTorrentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWebTorrentEnabled(Boolean webTorrentEnabled) {
|
|
||||||
this.webTorrentEnabled = webTorrentEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getVideoLanguages() {
|
public List<String> getVideoLanguages() {
|
||||||
return videoLanguages;
|
return videoLanguages;
|
||||||
}
|
}
|
||||||
@ -93,32 +81,44 @@ public class UserSettings {
|
|||||||
return videosHistoryEnabled;
|
return videosHistoryEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setVideosHistoryEnabled(Boolean videosHistoryEnabled) {
|
||||||
|
this.videosHistoryEnabled = videosHistoryEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getAutoPlayVideo() {
|
public Boolean getAutoPlayVideo() {
|
||||||
return autoPlayVideo;
|
return autoPlayVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAutoPlayVideo(Boolean autoPlayVideo) {
|
||||||
|
this.autoPlayVideo = autoPlayVideo;
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getWebTorrentEnabled() {
|
public Boolean getWebTorrentEnabled() {
|
||||||
return webTorrentEnabled;
|
return webTorrentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setWebTorrentEnabled(Boolean webTorrentEnabled) {
|
||||||
|
this.webTorrentEnabled = webTorrentEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean isAutoPlayNextVideo() {
|
public Boolean isAutoPlayNextVideo() {
|
||||||
return autoPlayNextVideo;
|
return autoPlayNextVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getAutoPlayNextVideo() {
|
||||||
|
return autoPlayNextVideo;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAutoPlayNextVideo(Boolean autoPlayNextVideo) {
|
public void setAutoPlayNextVideo(Boolean autoPlayNextVideo) {
|
||||||
this.autoPlayNextVideo = autoPlayNextVideo;
|
this.autoPlayNextVideo = autoPlayNextVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getAutoPlayNextVideo() {
|
|
||||||
return autoPlayNextVideo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFileName() {
|
public String getFileName() {
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFileName(String fileName) {
|
public void setFileName(String fileName) {
|
||||||
if( fileName == null) {
|
if (fileName == null) {
|
||||||
this.fileName = "avatar.png";
|
this.fileName = "avatar.png";
|
||||||
} else {
|
} else {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
|
@ -14,18 +14,38 @@ package app.fedilab.fedilabtube.client.entities;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@SuppressWarnings({"unused", "RedundantSuppression"})
|
@SuppressWarnings({"unused", "RedundantSuppression"})
|
||||||
public class ViewsPerDay {
|
public class ViewsPerDay implements Parcelable {
|
||||||
|
|
||||||
|
public static final Creator<ViewsPerDay> CREATOR = new Creator<ViewsPerDay>() {
|
||||||
|
@Override
|
||||||
|
public ViewsPerDay createFromParcel(Parcel in) {
|
||||||
|
return new ViewsPerDay(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ViewsPerDay[] newArray(int size) {
|
||||||
|
return new ViewsPerDay[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
@SerializedName("date")
|
@SerializedName("date")
|
||||||
private Date date;
|
private Date date;
|
||||||
@SerializedName("views")
|
@SerializedName("views")
|
||||||
private int views;
|
private int views;
|
||||||
|
|
||||||
|
protected ViewsPerDay(Parcel in) {
|
||||||
|
long tmpDate = in.readLong();
|
||||||
|
this.date = tmpDate == -1 ? null : new Date(tmpDate);
|
||||||
|
views = in.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
public Date getDate() {
|
public Date getDate() {
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
@ -41,4 +61,15 @@ public class ViewsPerDay {
|
|||||||
public void setViews(int views) {
|
public void setViews(int views) {
|
||||||
this.views = views;
|
this.views = views;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel parcel, int i) {
|
||||||
|
parcel.writeLong(this.date != null ? this.date.getTime() : -1);
|
||||||
|
parcel.writeInt(views);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,160 @@
|
|||||||
|
package app.fedilab.fedilabtube.drawer;
|
||||||
|
/* Copyright 2020 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
|
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||||
|
import app.fedilab.fedilabtube.databinding.DrawerAboutInstanceBinding;
|
||||||
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
||||||
|
|
||||||
|
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
||||||
|
|
||||||
|
|
||||||
|
public class AboutInstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
|
||||||
|
private final List<InstanceData.AboutInstance> aboutInstances;
|
||||||
|
public AllInstancesRemoved allInstancesRemoved;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
public AboutInstanceAdapter(List<InstanceData.AboutInstance> aboutInstances) {
|
||||||
|
this.aboutInstances = aboutInstances;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return aboutInstances.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
context = parent.getContext();
|
||||||
|
DrawerAboutInstanceBinding itemBinding = DrawerAboutInstanceBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new ViewHolder(itemBinding);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ApplySharedPref")
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) {
|
||||||
|
|
||||||
|
context = viewHolder.itemView.getContext();
|
||||||
|
|
||||||
|
final ViewHolder holder = (ViewHolder) viewHolder;
|
||||||
|
|
||||||
|
final InstanceData.AboutInstance aboutInstance = aboutInstances.get(i);
|
||||||
|
|
||||||
|
holder.binding.aboutInstanceHost.setText(aboutInstance.getHost());
|
||||||
|
|
||||||
|
SpannableString spannableString;
|
||||||
|
if (aboutInstance.getShortDescription() != null) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
|
spannableString = new SpannableString(Html.fromHtml(aboutInstance.getShortDescription(), FROM_HTML_MODE_LEGACY));
|
||||||
|
else
|
||||||
|
spannableString = new SpannableString(Html.fromHtml(aboutInstance.getShortDescription()));
|
||||||
|
holder.binding.aboutInstanceDescription.setText(spannableString, TextView.BufferType.SPANNABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.binding.aboutInstanceName.setText(aboutInstance.getName());
|
||||||
|
holder.binding.instanceContainer.setOnClickListener(v -> {
|
||||||
|
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putString(Helper.PREF_INSTANCE, aboutInstance.getHost());
|
||||||
|
editor.commit();
|
||||||
|
Helper.logoutNoRemoval((Activity) context);
|
||||||
|
});
|
||||||
|
holder.binding.instanceMore.setOnClickListener(v -> {
|
||||||
|
PopupMenu popup = new PopupMenu(context, holder.binding.instanceMore);
|
||||||
|
popup.getMenuInflater()
|
||||||
|
.inflate(R.menu.instance_menu, popup.getMenu());
|
||||||
|
popup.setOnMenuItemClickListener(item -> {
|
||||||
|
int itemId = item.getItemId();
|
||||||
|
if (itemId == R.id.action_delete) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
|
builder.setTitle(R.string.delete_instance);
|
||||||
|
builder.setMessage(R.string.delete_instance_confirm);
|
||||||
|
builder.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
|
.setPositiveButton(R.string.delete, (dialog, which) -> {
|
||||||
|
new Thread(() -> {
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
new StoredInstanceDAO(context, db).removeInstance(aboutInstance.getHost());
|
||||||
|
aboutInstances.remove(aboutInstance);
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = () -> {
|
||||||
|
notifyItemRemoved(i);
|
||||||
|
if (aboutInstances.size() == 0) {
|
||||||
|
allInstancesRemoved.onAllInstancesRemoved();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
dialog.dismiss();
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
popup.show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AllInstancesRemoved {
|
||||||
|
void onAllInstancesRemoved();
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
DrawerAboutInstanceBinding binding;
|
||||||
|
|
||||||
|
ViewHolder(DrawerAboutInstanceBinding itemView) {
|
||||||
|
super(itemView.getRoot());
|
||||||
|
binding = itemView;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -130,7 +130,7 @@ public class AccountsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
|||||||
}
|
}
|
||||||
position++;
|
position++;
|
||||||
}
|
}
|
||||||
if (accounts.size() == 0) {
|
if (accounts.size() == 0 && allAccountsRemoved != null) {
|
||||||
allAccountsRemoved.onAllAccountsRemoved();
|
allAccountsRemoved.onAllAccountsRemoved();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
@ -41,7 +42,6 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.lifecycle.LifecycleOwner;
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
@ -59,15 +59,14 @@ import app.fedilab.fedilabtube.client.APIResponse;
|
|||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.CommentData.Comment;
|
import app.fedilab.fedilabtube.client.data.CommentData.Comment;
|
||||||
import app.fedilab.fedilabtube.client.entities.Report;
|
import app.fedilab.fedilabtube.client.entities.Report;
|
||||||
|
import app.fedilab.fedilabtube.helper.CommentDecorationHelper;
|
||||||
import app.fedilab.fedilabtube.helper.EmojiHelper;
|
import app.fedilab.fedilabtube.helper.EmojiHelper;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
import studio.carbonylgroup.textfieldboxes.ExtendedEditText;
|
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPLY;
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPLY;
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
|
||||||
|
|
||||||
|
|
||||||
public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
@ -75,14 +74,16 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
|
|
||||||
private final List<Comment> comments;
|
private final List<Comment> comments;
|
||||||
private final CommentListAdapter commentListAdapter;
|
private final CommentListAdapter commentListAdapter;
|
||||||
|
private final boolean isThread;
|
||||||
public AllCommentRemoved allCommentRemoved;
|
public AllCommentRemoved allCommentRemoved;
|
||||||
boolean isVideoOwner;
|
boolean isVideoOwner;
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
public CommentListAdapter(List<Comment> comments, boolean isVideoOwner) {
|
public CommentListAdapter(List<Comment> comments, boolean isVideoOwner, boolean isThread) {
|
||||||
this.comments = comments;
|
this.comments = comments;
|
||||||
commentListAdapter = this;
|
commentListAdapter = this;
|
||||||
this.isVideoOwner = isVideoOwner;
|
this.isVideoOwner = isVideoOwner;
|
||||||
|
this.isThread = isThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -120,6 +121,19 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
return;
|
return;
|
||||||
holder.main_container.setTag(i);
|
holder.main_container.setTag(i);
|
||||||
|
|
||||||
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
);
|
||||||
|
if (comment.isReply()) {
|
||||||
|
int ident = CommentDecorationHelper.getIndentation(comment.getInReplyToCommentId(), comments);
|
||||||
|
holder.decoration.setVisibility(View.VISIBLE);
|
||||||
|
params.setMargins((int) Helper.convertDpToPixel(ident * 15, context), 0, 0, 0);
|
||||||
|
} else {
|
||||||
|
holder.decoration.setVisibility(View.GONE);
|
||||||
|
params.setMargins(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
holder.main_container.setLayoutParams(params);
|
||||||
holder.more_actions.setOnClickListener(view -> {
|
holder.more_actions.setOnClickListener(view -> {
|
||||||
PopupMenu popup = new PopupMenu(context, holder.more_actions);
|
PopupMenu popup = new PopupMenu(context, holder.more_actions);
|
||||||
popup.getMenuInflater()
|
popup.getMenuInflater()
|
||||||
@ -224,9 +238,10 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
|
|
||||||
holder.comment_account_displayname.setText(comment.getAccount().getDisplayName());
|
holder.comment_account_displayname.setText(comment.getAccount().getDisplayName());
|
||||||
|
|
||||||
if (context instanceof PeertubeActivity && !comment.isReply()) {
|
|
||||||
holder.main_container.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment, i));
|
if (context instanceof PeertubeActivity && !isThread) {
|
||||||
holder.comment_content.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment, i));
|
holder.main_container.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment));
|
||||||
|
holder.comment_content.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment));
|
||||||
}
|
}
|
||||||
if (comment.getTotalReplies() > 0) {
|
if (comment.getTotalReplies() > 0) {
|
||||||
holder.number_of_replies.setVisibility(View.VISIBLE);
|
holder.number_of_replies.setVisibility(View.VISIBLE);
|
||||||
@ -269,33 +284,13 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
} else {
|
} else {
|
||||||
holder.replyButton.setVisibility(View.GONE);
|
holder.replyButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
if (comment.isReply() && comment.isReplyViewOpen()) {
|
if (i == 0 && isThread) {
|
||||||
holder.write_comment_container_reply.setVisibility(View.VISIBLE);
|
holder.post_reply_button.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
holder.write_comment_container_reply.setVisibility(View.GONE);
|
holder.post_reply_button.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
if (holder.add_comment_write_reply.getText() == null || holder.add_comment_write_reply.getText().toString().trim().length() == 0) {
|
holder.post_reply_button.setOnClickListener(v -> ((PeertubeActivity) context).openPostComment(comment, i));
|
||||||
holder.add_comment_write_reply.setText(String.format("@%s ", comment.getAccount().getAcct()));
|
holder.replyButton.setOnClickListener(v -> ((PeertubeActivity) context).openPostComment(comment, i));
|
||||||
holder.add_comment_write_reply.setSelection(holder.add_comment_write_reply.getText().length());
|
|
||||||
}
|
|
||||||
holder.replyButton.setOnClickListener(v -> {
|
|
||||||
comment.setReplyViewOpen(!comment.isReplyViewOpen());
|
|
||||||
notifyItemChanged(i);
|
|
||||||
});
|
|
||||||
|
|
||||||
holder.send_reply.setOnClickListener(null);
|
|
||||||
holder.send_reply.setOnClickListener(v -> {
|
|
||||||
if (isLoggedIn(context)) {
|
|
||||||
String commentView = holder.add_comment_write_reply.getText().toString();
|
|
||||||
if (commentView.trim().length() > 0) {
|
|
||||||
PostActionsVM viewModelComment = new ViewModelProvider((ViewModelStoreOwner) context).get(PostActionsVM.class);
|
|
||||||
viewModelComment.comment(REPLY, comment.getVideoId(), comment.getId(), commentView).observe((LifecycleOwner) context, apiResponse1 -> manageVIewPostActions(REPLY, (int) holder.main_container.getTag(), apiResponse1));
|
|
||||||
holder.add_comment_write_reply.setText("");
|
|
||||||
comment.setReplyViewOpen(false);
|
|
||||||
notifyItemChanged(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void manageVIewPostActions(RetrofitPeertubeAPI.ActionType statusAction, int i, APIResponse apiResponse) {
|
public void manageVIewPostActions(RetrofitPeertubeAPI.ActionType statusAction, int i, APIResponse apiResponse) {
|
||||||
@ -361,13 +356,12 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
TextView comment_content;
|
TextView comment_content;
|
||||||
TextView comment_account_username;
|
TextView comment_account_username;
|
||||||
TextView comment_account_displayname;
|
TextView comment_account_displayname;
|
||||||
ImageView comment_account_profile, send_reply;
|
ImageView comment_account_profile;
|
||||||
TextView comment_date, replyButton;
|
TextView comment_date, replyButton;
|
||||||
LinearLayout main_container;
|
LinearLayout main_container;
|
||||||
TextView more_actions, number_of_replies;
|
TextView more_actions, number_of_replies;
|
||||||
ExtendedEditText add_comment_write_reply;
|
Button post_reply_button;
|
||||||
ConstraintLayout write_comment_container_reply;
|
View decoration;
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
ViewHolder(View itemView) {
|
ViewHolder(View itemView) {
|
||||||
@ -380,10 +374,9 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
main_container = itemView.findViewById(R.id.main_container);
|
main_container = itemView.findViewById(R.id.main_container);
|
||||||
more_actions = itemView.findViewById(R.id.more_actions);
|
more_actions = itemView.findViewById(R.id.more_actions);
|
||||||
number_of_replies = itemView.findViewById(R.id.number_of_replies);
|
number_of_replies = itemView.findViewById(R.id.number_of_replies);
|
||||||
add_comment_write_reply = itemView.findViewById(R.id.add_comment_write_reply);
|
|
||||||
send_reply = itemView.findViewById(R.id.send_reply);
|
|
||||||
replyButton = itemView.findViewById(R.id.replyButton);
|
replyButton = itemView.findViewById(R.id.replyButton);
|
||||||
write_comment_container_reply = itemView.findViewById(R.id.write_comment_container_reply);
|
decoration = itemView.findViewById(R.id.decoration);
|
||||||
|
post_reply_button = itemView.findViewById(R.id.post_reply_button);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,11 +129,11 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
holder.peertube_views.setText(context.getString(R.string.number_view_video, Helper.withSuffix(video.getViews())));
|
holder.peertube_views.setText(context.getString(R.string.number_view_video, Helper.withSuffix(video.getViews())));
|
||||||
|
|
||||||
boolean blur = sharedpreferences.getString(context.getString(R.string.set_video_sensitive_choice), Helper.BLUR).compareTo("blur") == 0 && video.isNsfw();
|
boolean blur = sharedpreferences.getString(context.getString(R.string.set_video_sensitive_choice), Helper.BLUR).compareTo("blur") == 0 && video.isNsfw();
|
||||||
if(videoInList) {
|
if (videoInList) {
|
||||||
Helper.loadGiF(context, instance, video.getThumbnailPath(), holder.peertube_video_image_small, blur);
|
Helper.loadGiF(context, instance, video.getThumbnailPath(), holder.peertube_video_image_small, blur);
|
||||||
holder.peertube_video_image_small.setVisibility(View.VISIBLE);
|
holder.peertube_video_image_small.setVisibility(View.VISIBLE);
|
||||||
holder.preview_container.setVisibility(View.GONE);
|
holder.preview_container.setVisibility(View.GONE);
|
||||||
}else{
|
} else {
|
||||||
Helper.loadGiF(context, instance, video.getThumbnailPath(), holder.peertube_video_image, blur);
|
Helper.loadGiF(context, instance, video.getThumbnailPath(), holder.peertube_video_image, blur);
|
||||||
holder.peertube_video_image_small.setVisibility(View.GONE);
|
holder.peertube_video_image_small.setVisibility(View.GONE);
|
||||||
holder.preview_container.setVisibility(View.VISIBLE);
|
holder.preview_container.setVisibility(View.VISIBLE);
|
||||||
|
@ -14,98 +14,114 @@ package app.fedilab.fedilabtube.drawer;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.core.content.FileProvider;
|
||||||
import androidx.lifecycle.LifecycleOwner;
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.lifecycle.ViewModelStoreOwner;
|
import androidx.lifecycle.ViewModelStoreOwner;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.request.FutureTarget;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.AllPlaylistsActivity;
|
import app.fedilab.fedilabtube.AllPlaylistsActivity;
|
||||||
|
import app.fedilab.fedilabtube.BuildConfig;
|
||||||
|
import app.fedilab.fedilabtube.LocalPlaylistsActivity;
|
||||||
|
import app.fedilab.fedilabtube.MainActivity;
|
||||||
import app.fedilab.fedilabtube.PlaylistsActivity;
|
import app.fedilab.fedilabtube.PlaylistsActivity;
|
||||||
import app.fedilab.fedilabtube.R;
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.PlaylistData.Playlist;
|
import app.fedilab.fedilabtube.client.data.PlaylistData.Playlist;
|
||||||
|
import app.fedilab.fedilabtube.client.data.VideoPlaylistData;
|
||||||
|
import app.fedilab.fedilabtube.databinding.DrawerPlaylistBinding;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.helper.NotificationHelper;
|
||||||
|
import app.fedilab.fedilabtube.helper.PlaylistExportHelper;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.ManagePlaylistsDAO;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
||||||
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.viewmodel.PlaylistsVM.action.GET_LIST_VIDEOS;
|
||||||
|
|
||||||
|
|
||||||
public class PlaylistAdapter extends BaseAdapter {
|
public class PlaylistAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
private final List<Playlist> playlists;
|
private final List<Playlist> playlists;
|
||||||
private final LayoutInflater layoutInflater;
|
private final boolean locale;
|
||||||
private final Context context;
|
public AllPlaylistRemoved allPlaylistRemoved;
|
||||||
private final RelativeLayout textviewNoAction;
|
private Context context;
|
||||||
|
|
||||||
public PlaylistAdapter(Context context, List<Playlist> lists, RelativeLayout textviewNoAction) {
|
public PlaylistAdapter(List<Playlist> lists, boolean locale) {
|
||||||
this.playlists = lists;
|
this.playlists = lists;
|
||||||
layoutInflater = LayoutInflater.from(context);
|
this.locale = locale;
|
||||||
this.context = context;
|
|
||||||
this.textviewNoAction = textviewNoAction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public int getCount() {
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
return playlists.size();
|
context = parent.getContext();
|
||||||
|
DrawerPlaylistBinding itemBinding = DrawerPlaylistBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new ViewHolder(itemBinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint({"SetJavaScriptEnabled", "ClickableViewAccessibility"})
|
||||||
@Override
|
@Override
|
||||||
public Object getItem(int position) {
|
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int position) {
|
||||||
return playlists.get(position);
|
context = viewHolder.itemView.getContext();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getItemId(int position) {
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
|
||||||
|
|
||||||
|
final ViewHolder holder = (ViewHolder) viewHolder;
|
||||||
final Playlist playlist = playlists.get(position);
|
final Playlist playlist = playlists.get(position);
|
||||||
final ViewHolder holder;
|
String imgUrl;
|
||||||
if (convertView == null) {
|
|
||||||
convertView = layoutInflater.inflate(R.layout.drawer_playlist, parent, false);
|
if (locale) {
|
||||||
holder = new ViewHolder();
|
imgUrl = "https://" + playlist.getOwnerAccount().getHost() + playlist.getThumbnailPath();
|
||||||
holder.preview_title = convertView.findViewById(R.id.preview_title);
|
|
||||||
holder.preview_visibility = convertView.findViewById(R.id.preview_visibility);
|
|
||||||
holder.preview_description = convertView.findViewById(R.id.preview_description);
|
|
||||||
holder.playlist_container = convertView.findViewById(R.id.playlist_container);
|
|
||||||
holder.preview_playlist = convertView.findViewById(R.id.preview_playlist);
|
|
||||||
holder.playlist_more = convertView.findViewById(R.id.playlist_more);
|
|
||||||
convertView.setTag(holder);
|
|
||||||
} else {
|
} else {
|
||||||
holder = (ViewHolder) convertView.getTag();
|
imgUrl = playlist.getThumbnailPath();
|
||||||
}
|
}
|
||||||
|
Helper.loadGiF(context, imgUrl, holder.binding.previewPlaylist);
|
||||||
|
|
||||||
Helper.loadGiF(context, playlist.getThumbnailPath(), holder.preview_playlist);
|
holder.binding.previewTitle.setText(playlist.getDisplayName());
|
||||||
|
|
||||||
holder.preview_title.setText(playlist.getDisplayName());
|
|
||||||
if (playlist.getDescription() != null && playlist.getDescription().trim().compareTo("null") != 0 && playlist.getDescription().length() > 0) {
|
if (playlist.getDescription() != null && playlist.getDescription().trim().compareTo("null") != 0 && playlist.getDescription().length() > 0) {
|
||||||
holder.preview_description.setText(playlist.getDescription());
|
holder.binding.previewDescription.setText(playlist.getDescription());
|
||||||
holder.preview_description.setVisibility(View.VISIBLE);
|
holder.binding.previewDescription.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
holder.preview_description.setVisibility(View.GONE);
|
holder.binding.previewDescription.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
holder.preview_visibility.setText(playlist.getPrivacy().getLabel());
|
holder.binding.previewVisibility.setText(playlist.getPrivacy().getLabel());
|
||||||
|
|
||||||
holder.playlist_container.setOnClickListener(v -> {
|
holder.binding.playlistContainer.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent(context, PlaylistsActivity.class);
|
Intent intent = new Intent(context, locale ? LocalPlaylistsActivity.class : PlaylistsActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
b.putParcelable("playlist", playlist);
|
b.putParcelable("playlist", playlist);
|
||||||
intent.putExtras(b);
|
intent.putExtras(b);
|
||||||
@ -113,15 +129,22 @@ public class PlaylistAdapter extends BaseAdapter {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (playlist.getDisplayName().compareTo("Watch later") == 0) {
|
if (playlist.getDisplayName().compareTo("Watch later") == 0) {
|
||||||
holder.playlist_more.setVisibility(View.GONE);
|
holder.binding.playlistMore.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
holder.playlist_more.setVisibility(View.VISIBLE);
|
holder.binding.playlistMore.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.playlist_more.setOnClickListener(v -> {
|
holder.binding.playlistMore.setOnClickListener(v -> {
|
||||||
PopupMenu popup = new PopupMenu(context, holder.playlist_more);
|
PopupMenu popup = new PopupMenu(context, holder.binding.playlistMore);
|
||||||
popup.getMenuInflater()
|
popup.getMenuInflater()
|
||||||
.inflate(R.menu.playlist_menu, popup.getMenu());
|
.inflate(R.menu.playlist_menu, popup.getMenu());
|
||||||
|
if (!BuildConfig.full_instances) {
|
||||||
|
popup.getMenu().findItem(R.id.action_export).setVisible(true);
|
||||||
|
}
|
||||||
|
if (locale) {
|
||||||
|
popup.getMenu().findItem(R.id.action_export).setVisible(false);
|
||||||
|
popup.getMenu().findItem(R.id.action_edit).setVisible(false);
|
||||||
|
}
|
||||||
popup.setOnMenuItemClickListener(item -> {
|
popup.setOnMenuItemClickListener(item -> {
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
if (itemId == R.id.action_delete) {
|
if (itemId == R.id.action_delete) {
|
||||||
@ -132,11 +155,18 @@ public class PlaylistAdapter extends BaseAdapter {
|
|||||||
.setPositiveButton(R.string.yes, (dialog, which) -> {
|
.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||||
playlists.remove(playlist);
|
playlists.remove(playlist);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
|
if (!locale) {
|
||||||
PlaylistsVM viewModel = new ViewModelProvider((ViewModelStoreOwner) context).get(PlaylistsVM.class);
|
PlaylistsVM viewModel = new ViewModelProvider((ViewModelStoreOwner) context).get(PlaylistsVM.class);
|
||||||
viewModel.manage(PlaylistsVM.action.DELETE_PLAYLIST, playlist, null).observe((LifecycleOwner) context, apiResponse -> manageVIewPlaylists(PlaylistsVM.action.DELETE_PLAYLIST, apiResponse));
|
viewModel.manage(PlaylistsVM.action.DELETE_PLAYLIST, playlist, null).observe((LifecycleOwner) context, apiResponse -> manageVIewPlaylists(PlaylistsVM.action.DELETE_PLAYLIST, apiResponse));
|
||||||
|
} else {
|
||||||
if (playlists.size() == 0 && textviewNoAction != null && textviewNoAction.getVisibility() == View.GONE)
|
new Thread(() -> {
|
||||||
textviewNoAction.setVisibility(View.VISIBLE);
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
new ManagePlaylistsDAO(context, db).removePlaylist(playlist.getUuid());
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
if (playlists.size() == 0) {
|
||||||
|
allPlaylistRemoved.onAllPlaylistRemoved();
|
||||||
|
}
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
||||||
@ -145,26 +175,116 @@ public class PlaylistAdapter extends BaseAdapter {
|
|||||||
if (context instanceof AllPlaylistsActivity) {
|
if (context instanceof AllPlaylistsActivity) {
|
||||||
((AllPlaylistsActivity) context).manageAlert(playlist);
|
((AllPlaylistsActivity) context).manageAlert(playlist);
|
||||||
}
|
}
|
||||||
|
} else if (itemId == R.id.action_export) {
|
||||||
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
|
if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions((Activity) context, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, Helper.EXTERNAL_STORAGE_REQUEST_CODE);
|
||||||
|
} else {
|
||||||
|
doExport(playlist);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
doExport(playlist);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
popup.show();
|
popup.show();
|
||||||
|
|
||||||
});
|
});
|
||||||
return convertView;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return playlists.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doExport(Playlist playlist) {
|
||||||
|
new Thread(() -> {
|
||||||
|
File file = null;
|
||||||
|
RetrofitPeertubeAPI retrofitPeertubeAPI = new RetrofitPeertubeAPI(context);
|
||||||
|
APIResponse apiResponse = retrofitPeertubeAPI.playlistAction(GET_LIST_VIDEOS, playlist.getId(), null, null, null);
|
||||||
|
if (apiResponse != null) {
|
||||||
|
List<VideoPlaylistData.VideoPlaylist> videos = apiResponse.getVideoPlaylist();
|
||||||
|
VideoPlaylistData.VideoPlaylistExport videoPlaylistExport = new VideoPlaylistData.VideoPlaylistExport();
|
||||||
|
videoPlaylistExport.setPlaylist(playlist);
|
||||||
|
videoPlaylistExport.setUuid(playlist.getUuid());
|
||||||
|
videoPlaylistExport.setAcct(MainActivity.userMe.getAccount().getAcct());
|
||||||
|
videoPlaylistExport.setVideos(videos);
|
||||||
|
|
||||||
|
String data = PlaylistExportHelper.playlistToStringStorage(videoPlaylistExport);
|
||||||
|
|
||||||
|
|
||||||
|
File root = new File(Environment.getExternalStorageDirectory(), context.getString(R.string.app_name));
|
||||||
|
if (!root.exists()) {
|
||||||
|
//noinspection ResultOfMethodCallIgnored
|
||||||
|
root.mkdirs();
|
||||||
|
}
|
||||||
|
file = new File(root, "playlist_" + playlist.getUuid() + ".tubelab");
|
||||||
|
FileWriter writer;
|
||||||
|
try {
|
||||||
|
writer = new FileWriter(file);
|
||||||
|
writer.append(data);
|
||||||
|
writer.flush();
|
||||||
|
writer.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = () -> Toasty.error(context, context.getString(R.string.toast_error), Toasty.LENGTH_LONG).show();
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
String urlAvatar = playlist.getThumbnailPath() != null ? Helper.getLiveInstance(context) + playlist.getThumbnailPath() : null;
|
||||||
|
FutureTarget<Bitmap> futureBitmapChannel = Glide.with(context.getApplicationContext())
|
||||||
|
.asBitmap()
|
||||||
|
.load(urlAvatar != null ? urlAvatar : R.drawable.missing_peertube).submit();
|
||||||
|
Bitmap icon = null;
|
||||||
|
try {
|
||||||
|
icon = futureBitmapChannel.get();
|
||||||
|
} catch (ExecutionException | InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (file != null) {
|
||||||
|
Intent mailIntent = new Intent(Intent.ACTION_SEND);
|
||||||
|
mailIntent.setType("message/rfc822");
|
||||||
|
Uri contentUri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".fileProvider", file);
|
||||||
|
mailIntent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.export_notification_subjet));
|
||||||
|
mailIntent.putExtra(Intent.EXTRA_TEXT, context.getString(R.string.export_notification_body));
|
||||||
|
mailIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
|
||||||
|
NotificationHelper.notify_user(context.getApplicationContext(),
|
||||||
|
playlist.getOwnerAccount(), mailIntent, icon,
|
||||||
|
context.getString(R.string.export_notification_title),
|
||||||
|
context.getString(R.string.export_notification_content));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings({"unused", "RedundantSuppression"})
|
@SuppressWarnings({"unused", "RedundantSuppression"})
|
||||||
public void manageVIewPlaylists(PlaylistsVM.action actionType, APIResponse apiResponse) {
|
public void manageVIewPlaylists(PlaylistsVM.action actionType, APIResponse apiResponse) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ViewHolder {
|
public interface AllPlaylistRemoved {
|
||||||
LinearLayout playlist_container;
|
void onAllPlaylistRemoved();
|
||||||
ImageView preview_playlist;
|
|
||||||
TextView preview_title, preview_visibility, preview_description;
|
|
||||||
ImageButton playlist_more;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
DrawerPlaylistBinding binding;
|
||||||
|
|
||||||
|
ViewHolder(DrawerPlaylistBinding itemView) {
|
||||||
|
super(itemView.getRoot());
|
||||||
|
binding = itemView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -54,7 +54,6 @@ public class DisplayAccountsFragment extends Fragment implements AccountsListAda
|
|||||||
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
|
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
|
||||||
private boolean firstLoad;
|
private boolean firstLoad;
|
||||||
private SwipeRefreshLayout swipeRefreshLayout;
|
private SwipeRefreshLayout swipeRefreshLayout;
|
||||||
private boolean swiped;
|
|
||||||
private RecyclerView lv_accounts;
|
private RecyclerView lv_accounts;
|
||||||
private View rootView;
|
private View rootView;
|
||||||
private RetrofitPeertubeAPI.DataType accountFetch;
|
private RetrofitPeertubeAPI.DataType accountFetch;
|
||||||
@ -75,7 +74,6 @@ public class DisplayAccountsFragment extends Fragment implements AccountsListAda
|
|||||||
max_id = null;
|
max_id = null;
|
||||||
firstLoad = true;
|
firstLoad = true;
|
||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
swiped = false;
|
|
||||||
|
|
||||||
swipeRefreshLayout = rootView.findViewById(R.id.swipeContainer);
|
swipeRefreshLayout = rootView.findViewById(R.id.swipeContainer);
|
||||||
|
|
||||||
@ -167,7 +165,6 @@ public class DisplayAccountsFragment extends Fragment implements AccountsListAda
|
|||||||
if (apiResponse.getError() != null) {
|
if (apiResponse.getError() != null) {
|
||||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
swiped = false;
|
|
||||||
flag_loading = false;
|
flag_loading = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -181,20 +178,21 @@ public class DisplayAccountsFragment extends Fragment implements AccountsListAda
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!swiped && firstLoad && (accounts == null || accounts.size() == 0))
|
if (firstLoad && (accounts == null || accounts.size() == 0))
|
||||||
textviewNoAction.setVisibility(View.VISIBLE);
|
textviewNoAction.setVisibility(View.VISIBLE);
|
||||||
else
|
else
|
||||||
textviewNoAction.setVisibility(View.GONE);
|
textviewNoAction.setVisibility(View.GONE);
|
||||||
|
|
||||||
max_id = apiResponse.getMax_id();
|
max_id = apiResponse.getMax_id();
|
||||||
if (swiped) {
|
|
||||||
accountsListAdapter = new AccountsListAdapter(accountFetch, this.accounts);
|
|
||||||
lv_accounts.setAdapter(accountsListAdapter);
|
|
||||||
swiped = false;
|
|
||||||
}
|
|
||||||
if (accounts != null && accounts.size() > 0) {
|
if (accounts != null && accounts.size() > 0) {
|
||||||
|
int previousPosition = this.accounts.size();
|
||||||
int currentPosition = this.accounts.size();
|
int currentPosition = this.accounts.size();
|
||||||
this.accounts.addAll(accounts);
|
this.accounts.addAll(accounts);
|
||||||
|
if (previousPosition == 0) {
|
||||||
|
accountsListAdapter = new AccountsListAdapter(accountFetch, this.accounts);
|
||||||
|
accountsListAdapter.allAccountsRemoved = this;
|
||||||
|
lv_accounts.setAdapter(accountsListAdapter);
|
||||||
|
} else
|
||||||
accountsListAdapter.notifyItemRangeChanged(currentPosition, accounts.size());
|
accountsListAdapter.notifyItemRangeChanged(currentPosition, accounts.size());
|
||||||
}
|
}
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
@ -206,7 +204,6 @@ public class DisplayAccountsFragment extends Fragment implements AccountsListAda
|
|||||||
accounts = new ArrayList<>();
|
accounts = new ArrayList<>();
|
||||||
firstLoad = true;
|
firstLoad = true;
|
||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
swiped = true;
|
|
||||||
swipeRefreshLayout.setRefreshing(true);
|
swipeRefreshLayout.setRefreshing(true);
|
||||||
AccountsVM viewModel = new ViewModelProvider(this).get(AccountsVM.class);
|
AccountsVM viewModel = new ViewModelProvider(this).get(AccountsVM.class);
|
||||||
viewModel.getAccounts(RetrofitPeertubeAPI.DataType.MUTED, null).observe(DisplayAccountsFragment.this.requireActivity(), this::manageViewAccounts);
|
viewModel.getAccounts(RetrofitPeertubeAPI.DataType.MUTED, null).observe(DisplayAccountsFragment.this.requireActivity(), this::manageViewAccounts);
|
||||||
|
@ -63,7 +63,6 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
|
|||||||
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
|
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
|
||||||
private SwipeRefreshLayout swipeRefreshLayout;
|
private SwipeRefreshLayout swipeRefreshLayout;
|
||||||
private String name;
|
private String name;
|
||||||
private boolean swiped;
|
|
||||||
private RecyclerView lv_channels;
|
private RecyclerView lv_channels;
|
||||||
private View rootView;
|
private View rootView;
|
||||||
private FloatingActionButton action_button;
|
private FloatingActionButton action_button;
|
||||||
@ -83,7 +82,6 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
|
|||||||
myChannels = bundle.getBoolean("myChannels", true);
|
myChannels = bundle.getBoolean("myChannels", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
swiped = false;
|
|
||||||
|
|
||||||
swipeRefreshLayout = rootView.findViewById(R.id.swipeContainer);
|
swipeRefreshLayout = rootView.findViewById(R.id.swipeContainer);
|
||||||
|
|
||||||
@ -165,34 +163,32 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
|
|||||||
if (apiResponse.getError() != null) {
|
if (apiResponse.getError() != null) {
|
||||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
swiped = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<ChannelData.Channel> channels = apiResponse.getChannels();
|
List<ChannelData.Channel> channels = apiResponse.getChannels();
|
||||||
if (!swiped && (channels == null || channels.size() == 0))
|
if ((channels == null || channels.size() == 0))
|
||||||
textviewNoAction.setVisibility(View.VISIBLE);
|
textviewNoAction.setVisibility(View.VISIBLE);
|
||||||
else
|
else
|
||||||
textviewNoAction.setVisibility(View.GONE);
|
textviewNoAction.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (swiped) {
|
if (channels != null && channels.size() > 0) {
|
||||||
|
int currentPosition = this.channels.size();
|
||||||
|
this.channels.addAll(channels);
|
||||||
|
if (currentPosition == 0) {
|
||||||
channelListAdapter = new ChannelListAdapter(this.channels, myChannels);
|
channelListAdapter = new ChannelListAdapter(this.channels, myChannels);
|
||||||
channelListAdapter.allChannelRemoved = DisplayChannelsFragment.this;
|
channelListAdapter.allChannelRemoved = DisplayChannelsFragment.this;
|
||||||
channelListAdapter.editAlertDialog = DisplayChannelsFragment.this;
|
channelListAdapter.editAlertDialog = DisplayChannelsFragment.this;
|
||||||
lv_channels.setAdapter(channelListAdapter);
|
lv_channels.setAdapter(channelListAdapter);
|
||||||
swiped = false;
|
} else {
|
||||||
}
|
|
||||||
if (channels != null && channels.size() > 0) {
|
|
||||||
int currentPosition = this.channels.size();
|
|
||||||
this.channels.addAll(channels);
|
|
||||||
channelListAdapter.notifyItemRangeChanged(currentPosition, channels.size());
|
channelListAdapter.notifyItemRangeChanged(currentPosition, channels.size());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pullToRefresh() {
|
public void pullToRefresh() {
|
||||||
channels = new ArrayList<>();
|
channels = new ArrayList<>();
|
||||||
|
|
||||||
swiped = true;
|
|
||||||
swipeRefreshLayout.setRefreshing(true);
|
swipeRefreshLayout.setRefreshing(true);
|
||||||
ChannelsVM viewModel = new ViewModelProvider(this).get(ChannelsVM.class);
|
ChannelsVM viewModel = new ViewModelProvider(this).get(ChannelsVM.class);
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
|
@ -72,9 +72,9 @@ public class DisplayNotificationsFragment extends Fragment {
|
|||||||
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
|
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
|
||||||
private boolean firstLoad;
|
private boolean firstLoad;
|
||||||
private SwipeRefreshLayout swipeRefreshLayout;
|
private SwipeRefreshLayout swipeRefreshLayout;
|
||||||
private boolean swiped;
|
|
||||||
private RecyclerView lv_notifications;
|
private RecyclerView lv_notifications;
|
||||||
private View rootView;
|
private View rootView;
|
||||||
|
private NotificationsVM viewModel;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
@ -86,10 +86,10 @@ public class DisplayNotificationsFragment extends Fragment {
|
|||||||
max_id = "0";
|
max_id = "0";
|
||||||
firstLoad = true;
|
firstLoad = true;
|
||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
swiped = false;
|
|
||||||
|
|
||||||
swipeRefreshLayout = rootView.findViewById(R.id.swipeContainer);
|
swipeRefreshLayout = rootView.findViewById(R.id.swipeContainer);
|
||||||
|
|
||||||
|
viewModel = new ViewModelProvider(this).get(NotificationsVM.class);
|
||||||
|
|
||||||
lv_notifications = rootView.findViewById(R.id.lv_elements);
|
lv_notifications = rootView.findViewById(R.id.lv_elements);
|
||||||
lv_notifications.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
|
lv_notifications.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
|
||||||
@ -115,7 +115,6 @@ public class DisplayNotificationsFragment extends Fragment {
|
|||||||
if (firstVisibleItem + visibleItemCount == totalItemCount) {
|
if (firstVisibleItem + visibleItemCount == totalItemCount) {
|
||||||
if (!flag_loading) {
|
if (!flag_loading) {
|
||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
NotificationsVM viewModel = new ViewModelProvider(DisplayNotificationsFragment.this).get(NotificationsVM.class);
|
|
||||||
viewModel.getNotifications(null, max_id).observe(DisplayNotificationsFragment.this.requireActivity(), apiResponse -> manageVIewNotifications(apiResponse));
|
viewModel.getNotifications(null, max_id).observe(DisplayNotificationsFragment.this.requireActivity(), apiResponse -> manageVIewNotifications(apiResponse));
|
||||||
nextElementLoader.setVisibility(View.VISIBLE);
|
nextElementLoader.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
@ -127,8 +126,7 @@ public class DisplayNotificationsFragment extends Fragment {
|
|||||||
});
|
});
|
||||||
swipeRefreshLayout.setOnRefreshListener(this::pullToRefresh);
|
swipeRefreshLayout.setOnRefreshListener(this::pullToRefresh);
|
||||||
|
|
||||||
NotificationsVM viewModel = new ViewModelProvider(this).get(NotificationsVM.class);
|
viewModel.getNotifications(null, "0").observe(DisplayNotificationsFragment.this.requireActivity(), this::manageVIewNotifications);
|
||||||
viewModel.getNotifications(null, null).observe(DisplayNotificationsFragment.this.requireActivity(), this::manageVIewNotifications);
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,9 +136,22 @@ public class DisplayNotificationsFragment extends Fragment {
|
|||||||
rootView = null;
|
rootView = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
if (swipeRefreshLayout != null) {
|
||||||
|
swipeRefreshLayout.setEnabled(false);
|
||||||
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
|
swipeRefreshLayout.clearAnimation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
swipeRefreshLayout.setEnabled(true);
|
||||||
if (getActivity() != null && getActivity() != null) {
|
if (getActivity() != null && getActivity() != null) {
|
||||||
View action_button = getActivity().findViewById(R.id.action_button);
|
View action_button = getActivity().findViewById(R.id.action_button);
|
||||||
if (action_button != null) {
|
if (action_button != null) {
|
||||||
@ -172,15 +183,15 @@ public class DisplayNotificationsFragment extends Fragment {
|
|||||||
|
|
||||||
|
|
||||||
public void pullToRefresh() {
|
public void pullToRefresh() {
|
||||||
max_id = "0";
|
int size = notifications.size();
|
||||||
|
notifications.clear();
|
||||||
notifications = new ArrayList<>();
|
notifications = new ArrayList<>();
|
||||||
|
max_id = "0";
|
||||||
|
peertubeNotificationsListAdapter.notifyItemRangeRemoved(0, size);
|
||||||
firstLoad = true;
|
firstLoad = true;
|
||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
swiped = true;
|
|
||||||
swipeRefreshLayout.setRefreshing(true);
|
swipeRefreshLayout.setRefreshing(true);
|
||||||
NotificationsVM viewModel = new ViewModelProvider(this).get(NotificationsVM.class);
|
viewModel.getNotifications(null, "0").observe(DisplayNotificationsFragment.this.requireActivity(), this::manageVIewNotifications);
|
||||||
viewModel.getNotifications(null, null).observe(DisplayNotificationsFragment.this.requireActivity(), this::manageVIewNotifications);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void manageVIewNotifications(APIResponse apiResponse) {
|
private void manageVIewNotifications(APIResponse apiResponse) {
|
||||||
@ -190,27 +201,24 @@ public class DisplayNotificationsFragment extends Fragment {
|
|||||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||||
flag_loading = false;
|
flag_loading = false;
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
swiped = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int previousPosition = notifications.size();
|
int previousPosition = notifications.size();
|
||||||
max_id = String.valueOf(Integer.parseInt(max_id) + 20);
|
max_id = String.valueOf(Integer.parseInt(max_id) + 20);
|
||||||
List<Notification> notifications = apiResponse.getPeertubeNotifications();
|
List<Notification> notifications = apiResponse.getPeertubeNotifications();
|
||||||
if (!swiped && firstLoad && (notifications == null || notifications.size() == 0))
|
if (firstLoad && (notifications == null || notifications.size() == 0))
|
||||||
textviewNoAction.setVisibility(View.VISIBLE);
|
textviewNoAction.setVisibility(View.VISIBLE);
|
||||||
else
|
else
|
||||||
textviewNoAction.setVisibility(View.GONE);
|
textviewNoAction.setVisibility(View.GONE);
|
||||||
if (swiped) {
|
|
||||||
if (previousPosition > 0) {
|
|
||||||
this.notifications.subList(0, previousPosition).clear();
|
|
||||||
peertubeNotificationsListAdapter.notifyItemRangeRemoved(0, previousPosition);
|
|
||||||
}
|
|
||||||
swiped = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (notifications != null && notifications.size() > 0) {
|
if (notifications != null && notifications.size() > 0) {
|
||||||
this.notifications.addAll(notifications);
|
this.notifications.addAll(notifications);
|
||||||
|
if (previousPosition == 0) {
|
||||||
|
peertubeNotificationsListAdapter = new PeertubeNotificationsListAdapter(this.notifications);
|
||||||
|
lv_notifications.setAdapter(peertubeNotificationsListAdapter);
|
||||||
|
} else
|
||||||
peertubeNotificationsListAdapter.notifyItemRangeInserted(previousPosition, notifications.size());
|
peertubeNotificationsListAdapter.notifyItemRangeInserted(previousPosition, notifications.size());
|
||||||
} else {
|
} else {
|
||||||
if (firstLoad)
|
if (firstLoad)
|
||||||
|
@ -39,6 +39,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
|
||||||
@ -93,14 +94,14 @@ public class DisplayPlaylistsFragment extends Fragment {
|
|||||||
playlists = new ArrayList<>();
|
playlists = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
ListView lv_playlist = rootView.findViewById(R.id.lv_playlist);
|
RecyclerView lv_playlist = rootView.findViewById(R.id.lv_playlist);
|
||||||
textviewNoAction = rootView.findViewById(R.id.no_action);
|
textviewNoAction = rootView.findViewById(R.id.no_action);
|
||||||
mainLoader = rootView.findViewById(R.id.loader);
|
mainLoader = rootView.findViewById(R.id.loader);
|
||||||
RelativeLayout nextElementLoader = rootView.findViewById(R.id.loading_next_items);
|
RelativeLayout nextElementLoader = rootView.findViewById(R.id.loading_next_items);
|
||||||
mainLoader.setVisibility(View.VISIBLE);
|
mainLoader.setVisibility(View.VISIBLE);
|
||||||
nextElementLoader.setVisibility(View.GONE);
|
nextElementLoader.setVisibility(View.GONE);
|
||||||
playlists = new ArrayList<>();
|
playlists = new ArrayList<>();
|
||||||
playlistAdapter = new PlaylistAdapter(context, playlists, textviewNoAction);
|
playlistAdapter = new PlaylistAdapter(playlists, false);
|
||||||
lv_playlist.setAdapter(playlistAdapter);
|
lv_playlist.setAdapter(playlistAdapter);
|
||||||
PlaylistsVM viewModel = new ViewModelProvider(this).get(PlaylistsVM.class);
|
PlaylistsVM viewModel = new ViewModelProvider(this).get(PlaylistsVM.class);
|
||||||
viewModel.manage(PlaylistsVM.action.GET_PLAYLISTS, null, null).observe(DisplayPlaylistsFragment.this.requireActivity(), apiResponse -> manageVIewPlaylists(PlaylistsVM.action.GET_PLAYLISTS, apiResponse));
|
viewModel.manage(PlaylistsVM.action.GET_PLAYLISTS, null, null).observe(DisplayPlaylistsFragment.this.requireActivity(), apiResponse -> manageVIewPlaylists(PlaylistsVM.action.GET_PLAYLISTS, apiResponse));
|
||||||
|
@ -65,6 +65,8 @@ import app.fedilab.fedilabtube.viewmodel.SearchVM;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.VIDEOS_IN_LOCAL_PLAYLIST;
|
||||||
|
|
||||||
|
|
||||||
public class DisplayVideosFragment extends Fragment implements AccountsHorizontalListAdapter.EventListener, PeertubeAdapter.RelationShipListener, PeertubeAdapter.PlaylistListener {
|
public class DisplayVideosFragment extends Fragment implements AccountsHorizontalListAdapter.EventListener, PeertubeAdapter.RelationShipListener, PeertubeAdapter.PlaylistListener {
|
||||||
|
|
||||||
@ -99,6 +101,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
private String playlistId;
|
private String playlistId;
|
||||||
private String remoteInstance;
|
private String remoteInstance;
|
||||||
private boolean sepiaSearch;
|
private boolean sepiaSearch;
|
||||||
|
private String startDate, endDate;
|
||||||
|
|
||||||
public DisplayVideosFragment() {
|
public DisplayVideosFragment() {
|
||||||
}
|
}
|
||||||
@ -112,6 +115,8 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
peertubes = new ArrayList<>();
|
peertubes = new ArrayList<>();
|
||||||
channels = new ArrayList<>();
|
channels = new ArrayList<>();
|
||||||
context = getContext();
|
context = getContext();
|
||||||
|
startDate = null;
|
||||||
|
endDate = null;
|
||||||
Bundle bundle = this.getArguments();
|
Bundle bundle = this.getArguments();
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
search_peertube = bundle.getString("search_peertube", null);
|
search_peertube = bundle.getString("search_peertube", null);
|
||||||
@ -120,6 +125,8 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
sepiaSearch = bundle.getBoolean("sepia_search", false);
|
sepiaSearch = bundle.getBoolean("sepia_search", false);
|
||||||
type = (TimelineVM.TimelineType) bundle.get(Helper.TIMELINE_TYPE);
|
type = (TimelineVM.TimelineType) bundle.get(Helper.TIMELINE_TYPE);
|
||||||
playlistId = bundle.getString("playlistId", null);
|
playlistId = bundle.getString("playlistId", null);
|
||||||
|
startDate = bundle.getString("startDate", null);
|
||||||
|
endDate = bundle.getString("endDate", null);
|
||||||
}
|
}
|
||||||
max_id = "0";
|
max_id = "0";
|
||||||
forAccount = type == TimelineVM.TimelineType.ACCOUNT_VIDEOS ? channelId : null;
|
forAccount = type == TimelineVM.TimelineType.ACCOUNT_VIDEOS ? channelId : null;
|
||||||
@ -182,6 +189,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (type != VIDEOS_IN_LOCAL_PLAYLIST) {
|
||||||
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
if (type == TimelineVM.TimelineType.SUBSCRIBTIONS) {
|
if (type == TimelineVM.TimelineType.SUBSCRIBTIONS) {
|
||||||
@ -233,6 +241,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
if (type == TimelineVM.TimelineType.SUBSCRIBTIONS) {
|
if (type == TimelineVM.TimelineType.SUBSCRIBTIONS) {
|
||||||
AccountsVM viewModel = new ViewModelProvider(this).get(AccountsVM.class);
|
AccountsVM viewModel = new ViewModelProvider(this).get(AccountsVM.class);
|
||||||
viewModel.getAccounts(RetrofitPeertubeAPI.DataType.SUBSCRIBER, max_id).observe(DisplayVideosFragment.this.requireActivity(), this::manageViewAccounts);
|
viewModel.getAccounts(RetrofitPeertubeAPI.DataType.SUBSCRIBER, max_id).observe(DisplayVideosFragment.this.requireActivity(), this::manageViewAccounts);
|
||||||
@ -245,6 +254,12 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
swipeRefreshLayout.setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
@ -434,12 +449,6 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
rootView = null;
|
rootView = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
swipeRefreshLayout.setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void scrollToTop() {
|
public void scrollToTop() {
|
||||||
if (mLayoutManager != null) {
|
if (mLayoutManager != null) {
|
||||||
@ -501,6 +510,10 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
viewModelFeeds.getVideosInChannel(sepiaSearch ? remoteInstance : null, channelId, max_id).observe(this.requireActivity(), this::manageVIewVideos);
|
viewModelFeeds.getVideosInChannel(sepiaSearch ? remoteInstance : null, channelId, max_id).observe(this.requireActivity(), this::manageVIewVideos);
|
||||||
} else if (type == TimelineVM.TimelineType.VIDEOS_IN_PLAYLIST) {
|
} else if (type == TimelineVM.TimelineType.VIDEOS_IN_PLAYLIST) {
|
||||||
viewModelFeeds.loadVideosInPlaylist(playlistId, max_id).observe(this.requireActivity(), this::manageVIewVideos);
|
viewModelFeeds.loadVideosInPlaylist(playlistId, max_id).observe(this.requireActivity(), this::manageVIewVideos);
|
||||||
|
} else if (type == VIDEOS_IN_LOCAL_PLAYLIST) {
|
||||||
|
viewModelFeeds.loadVideosInLocalPlaylist(playlistId).observe(this.requireActivity(), this::manageVIewVideos);
|
||||||
|
} else if (type == TimelineVM.TimelineType.HISTORY) {
|
||||||
|
viewModelFeeds.getVideoHistory(max_id, startDate, endDate).observe(this.requireActivity(), this::manageVIewVideos);
|
||||||
} else {
|
} else {
|
||||||
viewModelFeeds.getVideos(type, max_id, forAccount).observe(this.requireActivity(), this::manageVIewVideos);
|
viewModelFeeds.getVideos(type, max_id, forAccount).observe(this.requireActivity(), this::manageVIewVideos);
|
||||||
}
|
}
|
||||||
|
@ -21,21 +21,6 @@ import androidx.preference.PreferenceScreen;
|
|||||||
import androidx.preference.SeekBarPreference;
|
import androidx.preference.SeekBarPreference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.SwitchPreference;
|
||||||
|
|
||||||
/* 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 com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.request.target.CustomTarget;
|
import com.bumptech.glide.request.target.CustomTarget;
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
@ -60,6 +45,21 @@ import es.dmoral.toasty.Toasty;
|
|||||||
import static app.fedilab.fedilabtube.MainActivity.peertubeInformation;
|
import static app.fedilab.fedilabtube.MainActivity.peertubeInformation;
|
||||||
import static app.fedilab.fedilabtube.MainActivity.userMe;
|
import static app.fedilab.fedilabtube.MainActivity.userMe;
|
||||||
|
|
||||||
|
/* 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>. */
|
||||||
|
|
||||||
public class SettingsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public class SettingsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -135,7 +135,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||||||
if (set_video_sensitive_choice != null) {
|
if (set_video_sensitive_choice != null) {
|
||||||
editor.putString(getString(R.string.set_video_sensitive_choice), set_video_sensitive_choice.getValue());
|
editor.putString(getString(R.string.set_video_sensitive_choice), set_video_sensitive_choice.getValue());
|
||||||
editor.apply();
|
editor.apply();
|
||||||
if(Helper.isLoggedIn(getActivity())) {
|
if (Helper.isLoggedIn(getActivity())) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
UserSettings userSettings = new UserSettings();
|
UserSettings userSettings = new UserSettings();
|
||||||
userSettings.setNsfwPolicy(set_video_sensitive_choice.getValue());
|
userSettings.setNsfwPolicy(set_video_sensitive_choice.getValue());
|
||||||
@ -182,7 +182,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||||||
SwitchPreference set_autoplay_choice = findPreference(getString(R.string.set_autoplay_choice));
|
SwitchPreference set_autoplay_choice = findPreference(getString(R.string.set_autoplay_choice));
|
||||||
assert set_autoplay_choice != null;
|
assert set_autoplay_choice != null;
|
||||||
editor.putBoolean(getString(R.string.set_autoplay_choice), set_autoplay_choice.isChecked());
|
editor.putBoolean(getString(R.string.set_autoplay_choice), set_autoplay_choice.isChecked());
|
||||||
if(Helper.isLoggedIn(getActivity())) {
|
if (Helper.isLoggedIn(getActivity())) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
UserSettings userSettings = new UserSettings();
|
UserSettings userSettings = new UserSettings();
|
||||||
userSettings.setAutoPlayVideo(set_autoplay_choice.isChecked());
|
userSettings.setAutoPlayVideo(set_autoplay_choice.isChecked());
|
||||||
@ -204,7 +204,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||||||
SwitchPreference set_autoplay_next_video_choice = findPreference(getString(R.string.set_autoplay_next_video_choice));
|
SwitchPreference set_autoplay_next_video_choice = findPreference(getString(R.string.set_autoplay_next_video_choice));
|
||||||
assert set_autoplay_next_video_choice != null;
|
assert set_autoplay_next_video_choice != null;
|
||||||
editor.putBoolean(getString(R.string.set_autoplay_next_video_choice), set_autoplay_next_video_choice.isChecked());
|
editor.putBoolean(getString(R.string.set_autoplay_next_video_choice), set_autoplay_next_video_choice.isChecked());
|
||||||
if(Helper.isLoggedIn(getActivity())) {
|
if (Helper.isLoggedIn(getActivity())) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
UserSettings userSettings = new UserSettings();
|
UserSettings userSettings = new UserSettings();
|
||||||
userSettings.setAutoPlayNextVideo(set_autoplay_next_video_choice.isChecked());
|
userSettings.setAutoPlayNextVideo(set_autoplay_next_video_choice.isChecked());
|
||||||
@ -233,7 +233,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||||||
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;
|
||||||
editor.putStringSet(getString(R.string.set_video_language_choice), set_video_language_choice.getValues());
|
editor.putStringSet(getString(R.string.set_video_language_choice), set_video_language_choice.getValues());
|
||||||
if(Helper.isLoggedIn(getActivity())) {
|
if (Helper.isLoggedIn(getActivity())) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
UserSettings userSettings = new UserSettings();
|
UserSettings userSettings = new UserSettings();
|
||||||
Set<String> language_choiceValues = set_video_language_choice.getValues();
|
Set<String> language_choiceValues = set_video_language_choice.getValues();
|
||||||
@ -266,7 +266,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||||||
|
|
||||||
Preference my_account = findPreference("my_account");
|
Preference my_account = findPreference("my_account");
|
||||||
assert my_account != null;
|
assert my_account != null;
|
||||||
if(!Helper.isLoggedIn(getActivity()) || userMe == null) {
|
if (!Helper.isLoggedIn(getActivity()) || userMe == null) {
|
||||||
my_account.setVisible(false);
|
my_account.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
my_account.setTitle(userMe.getUsername());
|
my_account.setTitle(userMe.getUsername());
|
||||||
@ -274,14 +274,19 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||||||
Resources resources = getResources();
|
Resources resources = getResources();
|
||||||
Drawable defaultAvatar = ResourcesCompat.getDrawable(resources, R.drawable.missing_peertube, null);
|
Drawable defaultAvatar = ResourcesCompat.getDrawable(resources, R.drawable.missing_peertube, null);
|
||||||
my_account.setIcon(defaultAvatar);
|
my_account.setIcon(defaultAvatar);
|
||||||
|
String avatarUrl = null;
|
||||||
|
if (userMe.getAccount().getAvatar() != null) {
|
||||||
|
avatarUrl = "https://" + Helper.getLiveInstance(context) + userMe.getAccount().getAvatar().getPath();
|
||||||
|
}
|
||||||
Glide.with(getActivity())
|
Glide.with(getActivity())
|
||||||
.asDrawable()
|
.asDrawable()
|
||||||
.load("https://" + Helper.getLiveInstance(context) + userMe.getAccount().getAvatar().getPath())
|
.load(avatarUrl != null ? avatarUrl : R.drawable.missing_peertube)
|
||||||
.into(new CustomTarget<Drawable>() {
|
.into(new CustomTarget<Drawable>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||||
my_account.setIcon(resource);
|
my_account.setIcon(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||||
|
|
||||||
@ -307,7 +312,6 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//****** Video mode *******
|
//****** Video mode *******
|
||||||
ListPreference set_video_mode_choice = findPreference(getString(R.string.set_video_mode_choice));
|
ListPreference set_video_mode_choice = findPreference(getString(R.string.set_video_mode_choice));
|
||||||
List<String> array = Arrays.asList(getResources().getStringArray(R.array.settings_video_mode));
|
List<String> array = Arrays.asList(getResources().getStringArray(R.array.settings_video_mode));
|
||||||
@ -349,7 +353,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||||||
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);
|
||||||
if ( Build.VERSION.SDK_INT < Build.VERSION_CODES.O
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O
|
||||||
|| !getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) {
|
|| !getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) {
|
||||||
set_video_minimize_choice.setVisible(false);
|
set_video_minimize_choice.setVisible(false);
|
||||||
}
|
}
|
||||||
@ -422,8 +426,8 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||||||
entryValuesSensitive[1] = Helper.BLUR.toLowerCase();
|
entryValuesSensitive[1] = Helper.BLUR.toLowerCase();
|
||||||
entryValuesSensitive[2] = Helper.DISPLAY.toLowerCase();
|
entryValuesSensitive[2] = Helper.DISPLAY.toLowerCase();
|
||||||
int currentSensitivePosition = 0;
|
int currentSensitivePosition = 0;
|
||||||
for(CharSequence val : entryValuesSensitive) {
|
for (CharSequence val : entryValuesSensitive) {
|
||||||
if(val.equals(currentSensitive)) {
|
if (val.equals(currentSensitive)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
currentSensitivePosition++;
|
currentSensitivePosition++;
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
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.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.client.data.CommentData;
|
||||||
|
|
||||||
|
public class CommentDecorationHelper {
|
||||||
|
|
||||||
|
public static int getIndentation(String replyToCommentId, List<CommentData.Comment> comments) {
|
||||||
|
return numberOfIndentation(0, replyToCommentId, comments);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int numberOfIndentation(int currentIdentation, String replyToCommentId, List<CommentData.Comment> comments) {
|
||||||
|
|
||||||
|
String targetedComment = null;
|
||||||
|
for (CommentData.Comment comment : comments) {
|
||||||
|
if (replyToCommentId.compareTo(comment.getId()) == 0) {
|
||||||
|
targetedComment = comment.getInReplyToCommentId();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (targetedComment != null) {
|
||||||
|
currentIdentation++;
|
||||||
|
return numberOfIndentation(currentIdentation, targetedComment, comments);
|
||||||
|
} else {
|
||||||
|
return Math.min(currentIdentation, 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -121,6 +121,7 @@ public class Helper {
|
|||||||
public static final String PREF_KEY_ID = "userID";
|
public static final String PREF_KEY_ID = "userID";
|
||||||
public static final String PREF_KEY_NAME = "my_user_name";
|
public static final String PREF_KEY_NAME = "my_user_name";
|
||||||
public static final String PREF_INSTANCE = "instance";
|
public static final String PREF_INSTANCE = "instance";
|
||||||
|
public static final String PREF_INSTANCE_SURF = "instance_surf";
|
||||||
public static final int EXTERNAL_STORAGE_REQUEST_CODE = 84;
|
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 SET_VIDEOS_PER_PAGE = "set_videos_per_page";
|
||||||
public static final String VIDEO_ID = "video_id_update";
|
public static final String VIDEO_ID = "video_id_update";
|
||||||
@ -478,9 +479,9 @@ public class Helper {
|
|||||||
RequestBuilder<Drawable> requestBuilder = Glide.with(imageView.getContext())
|
RequestBuilder<Drawable> requestBuilder = Glide.with(imageView.getContext())
|
||||||
.load(url)
|
.load(url)
|
||||||
.thumbnail(0.1f);
|
.thumbnail(0.1f);
|
||||||
if( blur ) {
|
if (blur) {
|
||||||
requestBuilder.apply(new RequestOptions().transform(new BlurTransformation(50, 3), new CenterCrop(), new RoundedCorners(10)));
|
requestBuilder.apply(new RequestOptions().transform(new BlurTransformation(50, 3), new CenterCrop(), new RoundedCorners(10)));
|
||||||
}else {
|
} else {
|
||||||
requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(round)));
|
requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(round)));
|
||||||
}
|
}
|
||||||
requestBuilder.into(imageView);
|
requestBuilder.into(imageView);
|
||||||
@ -626,6 +627,26 @@ public class Helper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log out without removing user in db
|
||||||
|
*
|
||||||
|
* @param activity Activity
|
||||||
|
*/
|
||||||
|
public static void logoutNoRemoval(Activity activity) {
|
||||||
|
SharedPreferences sharedpreferences = activity.getSharedPreferences(APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putString(PREF_KEY_OAUTH_TOKEN, null);
|
||||||
|
editor.putString(CLIENT_ID, null);
|
||||||
|
editor.putString(CLIENT_SECRET, null);
|
||||||
|
editor.putString(PREF_KEY_ID, null);
|
||||||
|
editor.putString(ID, null);
|
||||||
|
editor.apply();
|
||||||
|
Intent loginActivity = new Intent(activity, MainActivity.class);
|
||||||
|
activity.startActivity(loginActivity);
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static int getAttColor(Context context, int attColor) {
|
public static int getAttColor(Context context, int attColor) {
|
||||||
TypedValue typedValue = new TypedValue();
|
TypedValue typedValue = new TypedValue();
|
||||||
context.getTheme().resolveAttribute(attColor, typedValue, true);
|
context.getTheme().resolveAttribute(attColor, typedValue, true);
|
||||||
@ -684,7 +705,7 @@ public class Helper {
|
|||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
String userName = sharedpreferences.getString(Helper.PREF_KEY_NAME, "");
|
String userName = sharedpreferences.getString(Helper.PREF_KEY_NAME, "");
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, "");
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, "");
|
||||||
if( video == null) {
|
if (video == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Account account = video.getAccount();
|
Account account = video.getAccount();
|
||||||
@ -726,6 +747,7 @@ public class Helper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Forward the intent (open an URL) to another app
|
* Forward the intent (open an URL) to another app
|
||||||
|
*
|
||||||
* @param activity Activity
|
* @param activity Activity
|
||||||
* @param i Intent
|
* @param i Intent
|
||||||
*/
|
*/
|
||||||
|
@ -14,6 +14,7 @@ package app.fedilab.fedilabtube.helper;
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
|
@ -0,0 +1,117 @@
|
|||||||
|
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.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.provider.OpenableColumns;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.AllLocalPlaylistsActivity;
|
||||||
|
import app.fedilab.fedilabtube.client.data.VideoPlaylistData;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.ManagePlaylistsDAO;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
|
||||||
|
public class PlaylistExportHelper {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unserialized VideoPlaylistExport
|
||||||
|
*
|
||||||
|
* @param serializedVideoPlaylistExport String serialized VideoPlaylistExport
|
||||||
|
* @return VideoPlaylistExport
|
||||||
|
*/
|
||||||
|
public static VideoPlaylistData.VideoPlaylistExport restorePlaylistFromString(String serializedVideoPlaylistExport) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
try {
|
||||||
|
return gson.fromJson(serializedVideoPlaylistExport, VideoPlaylistData.VideoPlaylistExport.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialized VideoPlaylistExport class
|
||||||
|
*
|
||||||
|
* @param videoPlaylistExport Playlist to serialize
|
||||||
|
* @return String serialized VideoPlaylistData.VideoPlaylistExport
|
||||||
|
*/
|
||||||
|
public static String playlistToStringStorage(VideoPlaylistData.VideoPlaylistExport videoPlaylistExport) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
try {
|
||||||
|
return gson.toJson(videoPlaylistExport);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage intent for opening a tubelab file allowing to import a whole playlist and store it in db
|
||||||
|
*
|
||||||
|
* @param activity Activity
|
||||||
|
* @param intent Intent
|
||||||
|
*/
|
||||||
|
public static void manageIntentUrl(Activity activity, Intent intent) {
|
||||||
|
if (intent.getData() != null) {
|
||||||
|
String url = intent.getData().toString();
|
||||||
|
|
||||||
|
String filename = url;
|
||||||
|
|
||||||
|
if (url.startsWith("content://")) {
|
||||||
|
Cursor cursor = null;
|
||||||
|
try {
|
||||||
|
cursor = activity.getContentResolver().query(intent.getData(), null, null, null, null);
|
||||||
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
|
filename = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
assert cursor != null;
|
||||||
|
cursor.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String text = null;
|
||||||
|
if (filename.endsWith(".tubelab")) {
|
||||||
|
try {
|
||||||
|
InputStream inputStream = activity.getContentResolver().openInputStream(intent.getData());
|
||||||
|
Scanner s = new Scanner(inputStream).useDelimiter("\\A");
|
||||||
|
text = s.hasNext() ? s.next() : "";
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (text != null && text.length() > 20) {
|
||||||
|
String finalText = text;
|
||||||
|
new Thread(() -> {
|
||||||
|
VideoPlaylistData.VideoPlaylistExport videoPlaylistExport = PlaylistExportHelper.restorePlaylistFromString(finalText);
|
||||||
|
if (videoPlaylistExport != null) {
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(activity.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
new ManagePlaylistsDAO(activity, db).insertPlaylist(videoPlaylistExport);
|
||||||
|
}
|
||||||
|
activity.runOnUiThread(() -> {
|
||||||
|
Intent intentPlaylist = new Intent(activity, AllLocalPlaylistsActivity.class);
|
||||||
|
activity.startActivity(intentPlaylist);
|
||||||
|
});
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
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.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.LoginActivity;
|
||||||
|
import app.fedilab.fedilabtube.MainActivity;
|
||||||
|
import app.fedilab.fedilabtube.R;
|
||||||
|
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||||
|
import app.fedilab.fedilabtube.drawer.OwnAccountsAdapter;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
|
||||||
|
import static android.content.Context.MODE_PRIVATE;
|
||||||
|
|
||||||
|
public class SwitchAccountHelper {
|
||||||
|
|
||||||
|
|
||||||
|
public static void switchDialog(Activity activity, boolean withAddAccount) {
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(activity.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
List<AccountData.Account> accounts = new AccountDAO(activity, db).getAllAccount();
|
||||||
|
|
||||||
|
AlertDialog.Builder builderSingle = new AlertDialog.Builder(activity);
|
||||||
|
builderSingle.setTitle(activity.getString(R.string.list_of_accounts));
|
||||||
|
if (accounts != null) {
|
||||||
|
final OwnAccountsAdapter accountsListAdapter = new OwnAccountsAdapter(activity, accounts);
|
||||||
|
final AccountData.Account[] accountArray = new AccountData.Account[accounts.size()];
|
||||||
|
int i = 0;
|
||||||
|
for (AccountData.Account account : accounts) {
|
||||||
|
accountArray[i] = account;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
builderSingle.setAdapter(accountsListAdapter, (dialog, which) -> {
|
||||||
|
final AccountData.Account account = accountArray[which];
|
||||||
|
SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, account.getToken());
|
||||||
|
editor.putString(Helper.PREF_INSTANCE, account.getHost());
|
||||||
|
editor.putString(Helper.PREF_KEY_ID, account.getId());
|
||||||
|
editor.putString(Helper.PREF_KEY_NAME, account.getUsername());
|
||||||
|
editor.apply();
|
||||||
|
dialog.dismiss();
|
||||||
|
Intent intent = new Intent(activity, MainActivity.class);
|
||||||
|
activity.startActivity(intent);
|
||||||
|
activity.finish();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
builderSingle.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
|
if (withAddAccount) {
|
||||||
|
builderSingle.setPositiveButton(R.string.add_account, (dialog, which) -> {
|
||||||
|
Intent intent = new Intent(activity, LoginActivity.class);
|
||||||
|
activity.startActivity(intent);
|
||||||
|
activity.finish();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
builderSingle.show();
|
||||||
|
}
|
||||||
|
}
|
@ -127,7 +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) {
|
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<>());
|
||||||
|
@ -266,6 +266,7 @@ public class AccountDAO {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the current user is already stored in data base
|
* Test if the current user is already stored in data base
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,377 @@
|
|||||||
|
package app.fedilab.fedilabtube.sqlite;
|
||||||
|
/* 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.content.ContentValues;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.client.data.PlaylistData;
|
||||||
|
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||||
|
import app.fedilab.fedilabtube.client.data.VideoPlaylistData;
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("UnusedReturnValue")
|
||||||
|
public class ManagePlaylistsDAO {
|
||||||
|
|
||||||
|
private final SQLiteDatabase db;
|
||||||
|
public Context context;
|
||||||
|
|
||||||
|
|
||||||
|
public ManagePlaylistsDAO(Context context, SQLiteDatabase db) {
|
||||||
|
//Creation of the DB with tables
|
||||||
|
this.context = context;
|
||||||
|
this.db = db;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unserialized Video
|
||||||
|
*
|
||||||
|
* @param serializedVideo String serialized Video
|
||||||
|
* @return Video
|
||||||
|
*/
|
||||||
|
public static VideoData.Video restoreVideoFromString(String serializedVideo) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
try {
|
||||||
|
return gson.fromJson(serializedVideo, VideoData.Video.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialized Video class
|
||||||
|
*
|
||||||
|
* @param video Video to serialize
|
||||||
|
* @return String serialized video
|
||||||
|
*/
|
||||||
|
public static String videoToStringStorage(VideoData.Video video) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
try {
|
||||||
|
return gson.toJson(video);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unserialized Playlist
|
||||||
|
*
|
||||||
|
* @param serializedPlaylist String serialized Playlist
|
||||||
|
* @return Playlist
|
||||||
|
*/
|
||||||
|
public static PlaylistData.Playlist restorePlaylistFromString(String serializedPlaylist) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
try {
|
||||||
|
return gson.fromJson(serializedPlaylist, PlaylistData.Playlist.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialized Playlist class
|
||||||
|
*
|
||||||
|
* @param playlist Playlist to serialize
|
||||||
|
* @return String serialized playlist
|
||||||
|
*/
|
||||||
|
public static String playlistToStringStorage(PlaylistData.Playlist playlist) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
try {
|
||||||
|
return gson.toJson(playlist);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert playlist info in database
|
||||||
|
*
|
||||||
|
* @param videoPlaylistExport VideoPlaylistExport
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean insertPlaylist(VideoPlaylistData.VideoPlaylistExport videoPlaylistExport) {
|
||||||
|
|
||||||
|
if (videoPlaylistExport.getPlaylist() == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
values.put(Sqlite.COL_ACCT, videoPlaylistExport.getAcct());
|
||||||
|
values.put(Sqlite.COL_UUID, videoPlaylistExport.getUuid());
|
||||||
|
values.put(Sqlite.COL_PLAYLIST, playlistToStringStorage(videoPlaylistExport.getPlaylist()));
|
||||||
|
//Inserts playlist
|
||||||
|
try {
|
||||||
|
long id = checkExists(videoPlaylistExport.getPlaylist().getUuid());
|
||||||
|
if (id != -1) {
|
||||||
|
videoPlaylistExport.setPlaylistDBkey(id);
|
||||||
|
removeAllVideosInPlaylist(id);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
long playlist_id = db.insertOrThrow(Sqlite.TABLE_LOCAL_PLAYLISTS, null, values);
|
||||||
|
videoPlaylistExport.setPlaylistDBkey(playlist_id);
|
||||||
|
}
|
||||||
|
for (VideoPlaylistData.VideoPlaylist videoPlaylist : videoPlaylistExport.getVideos()) {
|
||||||
|
//Insert videos
|
||||||
|
insertVideos(videoPlaylist.getVideo(), videoPlaylistExport);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert videos for playlists in database
|
||||||
|
*
|
||||||
|
* @param video Video to insert
|
||||||
|
* @param playlist VideoPlaylistExport targeted
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
private boolean insertVideos(VideoData.Video video, VideoPlaylistData.VideoPlaylistExport playlist) {
|
||||||
|
|
||||||
|
if (video == null || playlist == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
values.put(Sqlite.COL_UUID, video.getUuid());
|
||||||
|
values.put(Sqlite.COL_PLAYLIST_ID, playlist.getPlaylistDBkey());
|
||||||
|
values.put(Sqlite.COL_VIDEO_DATA, videoToStringStorage(video));
|
||||||
|
//Inserts playlist
|
||||||
|
try {
|
||||||
|
db.insertOrThrow(Sqlite.TABLE_VIDEOS, null, values);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if playlist exists
|
||||||
|
*
|
||||||
|
* @param uuid String
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
private long checkExists(String uuid) {
|
||||||
|
try {
|
||||||
|
Cursor c = db.query(Sqlite.TABLE_LOCAL_PLAYLISTS, null, Sqlite.COL_UUID + " = \"" + uuid + "\"", null, null, null, null, "1");
|
||||||
|
VideoPlaylistData.VideoPlaylistExport videoPlaylistExport = cursorToSingleVideoPlaylistExport(c);
|
||||||
|
c.close();
|
||||||
|
return videoPlaylistExport != null ? videoPlaylistExport.getPlaylistDBkey() : -1;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if playlist exists
|
||||||
|
*
|
||||||
|
* @param videoUuid String
|
||||||
|
* @param playlistUuid String
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
private boolean checkVideoExists(String videoUuid, String playlistUuid) {
|
||||||
|
try {
|
||||||
|
String check_query = "SELECT * FROM " + Sqlite.TABLE_LOCAL_PLAYLISTS + " p INNER JOIN "
|
||||||
|
+ Sqlite.TABLE_VIDEOS + " v ON p.id = v." + Sqlite.COL_PLAYLIST_ID
|
||||||
|
+ " WHERE p." + Sqlite.COL_UUID + "=? AND v." + Sqlite.COL_UUID + "=? LIMIT 1";
|
||||||
|
Cursor c = db.rawQuery(check_query, new String[]{playlistUuid, videoUuid});
|
||||||
|
int count = c.getCount();
|
||||||
|
c.close();
|
||||||
|
return count > 0;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all videos in playlist
|
||||||
|
*
|
||||||
|
* @param playlistDBid long db id
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public int removeAllVideosInPlaylist(long playlistDBid) {
|
||||||
|
return db.delete(Sqlite.TABLE_VIDEOS, Sqlite.COL_PLAYLIST_ID + " = '" + playlistDBid + "'", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a playlist with its uuid
|
||||||
|
*
|
||||||
|
* @param uuid String uuid of the Playlist
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public int removePlaylist(String uuid) {
|
||||||
|
VideoPlaylistData.VideoPlaylistExport videoPlaylistExport = getSinglePlaylists(uuid);
|
||||||
|
db.delete(Sqlite.TABLE_VIDEOS, Sqlite.COL_PLAYLIST_ID + " = '" + videoPlaylistExport.getPlaylistDBkey() + "'", null);
|
||||||
|
return db.delete(Sqlite.TABLE_LOCAL_PLAYLISTS, Sqlite.COL_ID + " = '" + videoPlaylistExport.getPlaylistDBkey() + "'", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a playlist from it's uid in db
|
||||||
|
*
|
||||||
|
* @return VideoPlaylistExport
|
||||||
|
*/
|
||||||
|
public VideoPlaylistData.VideoPlaylistExport getSinglePlaylists(String uuid) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Cursor c = db.query(Sqlite.TABLE_LOCAL_PLAYLISTS, null, Sqlite.COL_UUID + "='" + uuid + "'", null, null, null, Sqlite.COL_ID + " DESC", null);
|
||||||
|
return cursorToSingleVideoPlaylistExport(c);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all playlists in db
|
||||||
|
*
|
||||||
|
* @return List<VideoPlaylistData.VideoPlaylistExport>
|
||||||
|
*/
|
||||||
|
public List<VideoPlaylistData.VideoPlaylistExport> getAllPlaylists() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Cursor c = db.query(Sqlite.TABLE_LOCAL_PLAYLISTS, null, null, null, null, null, Sqlite.COL_ID + " DESC", null);
|
||||||
|
return cursorToVideoPlaylistExport(c);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all videos in a playlist
|
||||||
|
*
|
||||||
|
* @return List<VideoData.VideoExport>
|
||||||
|
*/
|
||||||
|
public List<VideoData.VideoExport> getAllVideosInPlaylist(VideoPlaylistData.VideoPlaylistExport videoPlaylistExport) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Cursor c = db.query(Sqlite.TABLE_VIDEOS, null, Sqlite.COL_PLAYLIST_ID + "='" + videoPlaylistExport.getPlaylistDBkey() + "'", null, null, null, Sqlite.COL_ID + " DESC", null);
|
||||||
|
return cursorToVideoExport(c);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all videos in a playlist
|
||||||
|
*
|
||||||
|
* @return List<VideoData.VideoExport>
|
||||||
|
*/
|
||||||
|
public List<VideoData.VideoExport> getAllVideosInPlaylist(String uuid) {
|
||||||
|
try {
|
||||||
|
VideoPlaylistData.VideoPlaylistExport videoPlaylistExport = getSinglePlaylists(uuid);
|
||||||
|
Cursor c = db.query(Sqlite.TABLE_VIDEOS, null, Sqlite.COL_PLAYLIST_ID + "='" + videoPlaylistExport.getPlaylistDBkey() + "'", null, null, null, Sqlite.COL_ID + " DESC", null);
|
||||||
|
return cursorToVideoExport(c);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Method to hydrate VideoPlaylistExport from database
|
||||||
|
* @param c Cursor
|
||||||
|
* @return VideoPlaylistData.VideoPlaylistExport
|
||||||
|
*/
|
||||||
|
private VideoPlaylistData.VideoPlaylistExport cursorToSingleVideoPlaylistExport(Cursor c) {
|
||||||
|
//No element found
|
||||||
|
if (c.getCount() == 0) {
|
||||||
|
c.close();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
c.moveToFirst();
|
||||||
|
VideoPlaylistData.VideoPlaylistExport videoPlaylistExport = new VideoPlaylistData.VideoPlaylistExport();
|
||||||
|
videoPlaylistExport.setAcct(c.getString(c.getColumnIndex(Sqlite.COL_ACCT)));
|
||||||
|
videoPlaylistExport.setUuid(c.getString(c.getColumnIndex(Sqlite.COL_UUID)));
|
||||||
|
videoPlaylistExport.setPlaylistDBkey(c.getInt(c.getColumnIndex(Sqlite.COL_ID)));
|
||||||
|
videoPlaylistExport.setPlaylist(restorePlaylistFromString(c.getString(c.getColumnIndex(Sqlite.COL_PLAYLIST))));
|
||||||
|
//Close the cursor
|
||||||
|
c.close();
|
||||||
|
return videoPlaylistExport;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Method to hydrate VideoPlaylistExport from database
|
||||||
|
* @param c Cursor
|
||||||
|
* @return List<VideoPlaylistData.VideoPlaylistExport>
|
||||||
|
*/
|
||||||
|
private List<VideoPlaylistData.VideoPlaylistExport> cursorToVideoPlaylistExport(Cursor c) {
|
||||||
|
//No element found
|
||||||
|
if (c.getCount() == 0) {
|
||||||
|
c.close();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<VideoPlaylistData.VideoPlaylistExport> videoPlaylistExports = new ArrayList<>();
|
||||||
|
while (c.moveToNext()) {
|
||||||
|
VideoPlaylistData.VideoPlaylistExport videoPlaylistExport = new VideoPlaylistData.VideoPlaylistExport();
|
||||||
|
videoPlaylistExport.setAcct(c.getString(c.getColumnIndex(Sqlite.COL_ACCT)));
|
||||||
|
videoPlaylistExport.setUuid(c.getString(c.getColumnIndex(Sqlite.COL_UUID)));
|
||||||
|
videoPlaylistExport.setPlaylistDBkey(c.getInt(c.getColumnIndex(Sqlite.COL_ID)));
|
||||||
|
videoPlaylistExport.setPlaylist(restorePlaylistFromString(c.getString(c.getColumnIndex(Sqlite.COL_PLAYLIST))));
|
||||||
|
videoPlaylistExports.add(videoPlaylistExport);
|
||||||
|
}
|
||||||
|
//Close the cursor
|
||||||
|
c.close();
|
||||||
|
return videoPlaylistExports;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Method to hydrate Video from database
|
||||||
|
* @param c Cursor
|
||||||
|
* @return List<VideoData.Video>
|
||||||
|
*/
|
||||||
|
private List<VideoData.VideoExport> cursorToVideoExport(Cursor c) {
|
||||||
|
//No element found
|
||||||
|
if (c.getCount() == 0) {
|
||||||
|
c.close();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<VideoData.VideoExport> videoExports = new ArrayList<>();
|
||||||
|
while (c.moveToNext()) {
|
||||||
|
VideoData.VideoExport videoExport = new VideoData.VideoExport();
|
||||||
|
videoExport.setPlaylistDBid(c.getInt(c.getColumnIndex(Sqlite.COL_PLAYLIST_ID)));
|
||||||
|
videoExport.setUuid(c.getString(c.getColumnIndex(Sqlite.COL_UUID)));
|
||||||
|
videoExport.setId(c.getInt(c.getColumnIndex(Sqlite.COL_ID)));
|
||||||
|
videoExport.setVideoData(restoreVideoFromString(c.getString(c.getColumnIndex(Sqlite.COL_VIDEO_DATA))));
|
||||||
|
videoExports.add(videoExport);
|
||||||
|
}
|
||||||
|
//Close the cursor
|
||||||
|
c.close();
|
||||||
|
return videoExports;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -21,7 +21,7 @@ import android.database.sqlite.SQLiteOpenHelper;
|
|||||||
|
|
||||||
public class Sqlite extends SQLiteOpenHelper {
|
public class Sqlite extends SQLiteOpenHelper {
|
||||||
|
|
||||||
public static final int DB_VERSION = 1;
|
public static final int DB_VERSION = 3;
|
||||||
public static final String DB_NAME = "mastodon_etalab_db";
|
public static final String DB_NAME = "mastodon_etalab_db";
|
||||||
/***
|
/***
|
||||||
* List of tables to manage users and data
|
* List of tables to manage users and data
|
||||||
@ -59,6 +59,14 @@ public class Sqlite extends SQLiteOpenHelper {
|
|||||||
static final String COL_UUID = "UUID";
|
static final String COL_UUID = "UUID";
|
||||||
static final String COL_CACHE = "CACHE";
|
static final String COL_CACHE = "CACHE";
|
||||||
static final String COL_DATE = "DATE";
|
static final String COL_DATE = "DATE";
|
||||||
|
static final String COL_USER_INSTANCE = "USER_INSTANCE";
|
||||||
|
static final String TABLE_BOOKMARKED_INSTANCES = "BOOKMARKED_INSTANCES";
|
||||||
|
static final String COL_ABOUT = "ABOUT";
|
||||||
|
static final String TABLE_LOCAL_PLAYLISTS = "LOCAL_PLAYLISTS";
|
||||||
|
static final String COL_PLAYLIST = "PLAYLIST";
|
||||||
|
static final String TABLE_VIDEOS = "VIDEOS";
|
||||||
|
static final String COL_VIDEO_DATA = "VIDEO_DATA";
|
||||||
|
static final String COL_PLAYLIST_ID = "PLAYLIST_ID";
|
||||||
private static final String CREATE_TABLE_USER_ACCOUNT = "CREATE TABLE " + TABLE_USER_ACCOUNT + " ("
|
private static final String CREATE_TABLE_USER_ACCOUNT = "CREATE TABLE " + TABLE_USER_ACCOUNT + " ("
|
||||||
+ COL_USER_ID + " TEXT, " + COL_USERNAME + " TEXT NOT NULL, " + COL_ACCT + " TEXT NOT NULL, "
|
+ COL_USER_ID + " TEXT, " + COL_USERNAME + " TEXT NOT NULL, " + COL_ACCT + " TEXT NOT NULL, "
|
||||||
+ COL_DISPLAYED_NAME + " TEXT NOT NULL, " + COL_LOCKED + " INTEGER NOT NULL, "
|
+ COL_DISPLAYED_NAME + " TEXT NOT NULL, " + COL_LOCKED + " INTEGER NOT NULL, "
|
||||||
@ -82,7 +90,26 @@ public class Sqlite extends SQLiteOpenHelper {
|
|||||||
+ COL_INSTANCE + " TEXT NOT NULL, "
|
+ COL_INSTANCE + " TEXT NOT NULL, "
|
||||||
+ COL_CACHE + " TEXT NOT NULL, "
|
+ COL_CACHE + " TEXT NOT NULL, "
|
||||||
+ COL_DATE + " TEXT NOT NULL)";
|
+ COL_DATE + " TEXT NOT NULL)";
|
||||||
|
private final String CREATE_TABLE_STORED_INSTANCES = "CREATE TABLE "
|
||||||
|
+ TABLE_BOOKMARKED_INSTANCES + "("
|
||||||
|
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||||
|
+ COL_INSTANCE + " TEXT NOT NULL, "
|
||||||
|
+ COL_USER_ID + " TEXT NOT NULL, "
|
||||||
|
+ COL_ABOUT + " TEXT NOT NULL, "
|
||||||
|
+ COL_USER_INSTANCE + " TEXT NOT NULL)";
|
||||||
|
private final String CREATE_TABLE_LOCAL_PLAYLISTS = "CREATE TABLE "
|
||||||
|
+ TABLE_LOCAL_PLAYLISTS + "("
|
||||||
|
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||||
|
+ COL_ACCT + " TEXT NOT NULL, "
|
||||||
|
+ COL_UUID + " TEXT NOT NULL, "
|
||||||
|
+ COL_PLAYLIST + " TEXT NOT NULL)";
|
||||||
|
private final String CREATE_TABLE_VIDEOS = "CREATE TABLE "
|
||||||
|
+ TABLE_VIDEOS + "("
|
||||||
|
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||||
|
+ COL_UUID + " TEXT NOT NULL, "
|
||||||
|
+ COL_VIDEO_DATA + " TEXT NOT NULL, "
|
||||||
|
+ COL_PLAYLIST_ID + " INTEGER, "
|
||||||
|
+ " FOREIGN KEY (" + COL_PLAYLIST_ID + ") REFERENCES " + COL_PLAYLIST + "(" + COL_ID + "));";
|
||||||
|
|
||||||
public Sqlite(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
|
public Sqlite(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
|
||||||
super(context, name, factory, version);
|
super(context, name, factory, version);
|
||||||
@ -101,17 +128,31 @@ public class Sqlite extends SQLiteOpenHelper {
|
|||||||
public void onCreate(SQLiteDatabase db) {
|
public void onCreate(SQLiteDatabase db) {
|
||||||
db.execSQL(CREATE_TABLE_USER_ACCOUNT);
|
db.execSQL(CREATE_TABLE_USER_ACCOUNT);
|
||||||
db.execSQL(CREATE_TABLE_PEERTUBE_FAVOURITES);
|
db.execSQL(CREATE_TABLE_PEERTUBE_FAVOURITES);
|
||||||
|
db.execSQL(CREATE_TABLE_STORED_INSTANCES);
|
||||||
|
db.execSQL(CREATE_TABLE_LOCAL_PLAYLISTS);
|
||||||
|
db.execSQL(CREATE_TABLE_VIDEOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
|
switch (oldVersion) {
|
||||||
|
case 3:
|
||||||
|
db.execSQL("DROP TABLE IF EXISTS " + TABLE_VIDEOS);
|
||||||
|
db.execSQL("DROP TABLE IF EXISTS " + TABLE_LOCAL_PLAYLISTS);
|
||||||
|
case 2:
|
||||||
|
db.execSQL("DROP TABLE IF EXISTS " + TABLE_BOOKMARKED_INSTANCES);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
switch (oldVersion) {
|
switch (oldVersion) {
|
||||||
case 1:
|
case 1:
|
||||||
|
db.execSQL(CREATE_TABLE_STORED_INSTANCES);
|
||||||
|
case 2:
|
||||||
|
db.execSQL(CREATE_TABLE_LOCAL_PLAYLISTS);
|
||||||
|
db.execSQL(CREATE_TABLE_VIDEOS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,216 @@
|
|||||||
|
package app.fedilab.fedilabtube.sqlite;
|
||||||
|
/* 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.content.ContentValues;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||||
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("UnusedReturnValue")
|
||||||
|
public class StoredInstanceDAO {
|
||||||
|
|
||||||
|
private final SQLiteDatabase db;
|
||||||
|
public Context context;
|
||||||
|
|
||||||
|
|
||||||
|
public StoredInstanceDAO(Context context, SQLiteDatabase db) {
|
||||||
|
//Creation of the DB with tables
|
||||||
|
this.context = context;
|
||||||
|
this.db = db;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unserialized AboutInstance
|
||||||
|
*
|
||||||
|
* @param serializedAboutInstance String serialized AboutInstance
|
||||||
|
* @return AboutInstance
|
||||||
|
*/
|
||||||
|
public static InstanceData.AboutInstance restoreAboutInstanceFromString(String serializedAboutInstance) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
try {
|
||||||
|
return gson.fromJson(serializedAboutInstance, InstanceData.AboutInstance.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialized AboutInstance class
|
||||||
|
*
|
||||||
|
* @param aboutInstance AboutInstance to serialize
|
||||||
|
* @return String serialized AboutInstance
|
||||||
|
*/
|
||||||
|
public static String aboutInstanceToStringStorage(InstanceData.AboutInstance aboutInstance) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
try {
|
||||||
|
return gson.toJson(aboutInstance);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert instance info in database
|
||||||
|
*
|
||||||
|
* @param aboutInstance AboutInstance
|
||||||
|
* @param targetedInstance String
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean insertInstance(InstanceData.AboutInstance aboutInstance, String targetedInstance) {
|
||||||
|
|
||||||
|
if (checkExists(targetedInstance)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
|
String instance = Helper.getLiveInstance(context);
|
||||||
|
|
||||||
|
values.put(Sqlite.COL_USER_ID, userId != null ? userId : "_ALL_");
|
||||||
|
values.put(Sqlite.COL_USER_INSTANCE, instance != null ? instance : "_ALL_");
|
||||||
|
values.put(Sqlite.COL_ABOUT, aboutInstanceToStringStorage(aboutInstance));
|
||||||
|
values.put(Sqlite.COL_INSTANCE, targetedInstance);
|
||||||
|
//Inserts instance
|
||||||
|
try {
|
||||||
|
db.insertOrThrow(Sqlite.TABLE_BOOKMARKED_INSTANCES, null, values);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if instance exists
|
||||||
|
*
|
||||||
|
* @param targetedInstance String
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
private boolean checkExists(String targetedInstance) {
|
||||||
|
try {
|
||||||
|
Cursor c = db.query(Sqlite.TABLE_BOOKMARKED_INSTANCES, null, Sqlite.COL_INSTANCE + " = \"" + targetedInstance + "\"", null, null, null, null, "1");
|
||||||
|
return cursorToInstance(c) != null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert instance info in database
|
||||||
|
*
|
||||||
|
* @param aboutInstance AboutInstance
|
||||||
|
* @param targetedInstance String
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"unused", "RedundantSuppression"})
|
||||||
|
public int updateInstance(InstanceData.AboutInstance aboutInstance, String targetedInstance) {
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
values.put(Sqlite.COL_ABOUT, aboutInstanceToStringStorage(aboutInstance));
|
||||||
|
try {
|
||||||
|
return db.update(Sqlite.TABLE_BOOKMARKED_INSTANCES,
|
||||||
|
values, Sqlite.COL_INSTANCE + " = ?",
|
||||||
|
new String[]{targetedInstance});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int removeInstance(String instance) {
|
||||||
|
return db.delete(Sqlite.TABLE_BOOKMARKED_INSTANCES, Sqlite.COL_INSTANCE + " = '" + instance + "'", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all Instance in db
|
||||||
|
*
|
||||||
|
* @return List<AboutInstance>
|
||||||
|
*/
|
||||||
|
public List<InstanceData.AboutInstance> getAllInstances() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Cursor c = db.query(Sqlite.TABLE_BOOKMARKED_INSTANCES, null, null, null, null, null, Sqlite.COL_INSTANCE + " ASC", null);
|
||||||
|
return cursorToListInstances(c);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Method to hydrate an AboutInstance from database
|
||||||
|
* @param c Cursor
|
||||||
|
* @return AboutInstance
|
||||||
|
*/
|
||||||
|
private InstanceData.AboutInstance cursorToInstance(Cursor c) {
|
||||||
|
//No element found
|
||||||
|
if (c.getCount() == 0) {
|
||||||
|
c.close();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
//Take the first element
|
||||||
|
c.moveToFirst();
|
||||||
|
//New user
|
||||||
|
String aboutInstanceStr = c.getString(c.getColumnIndex(Sqlite.COL_ABOUT));
|
||||||
|
InstanceData.AboutInstance aboutInstance = restoreAboutInstanceFromString(aboutInstanceStr);
|
||||||
|
//Close the cursor
|
||||||
|
c.close();
|
||||||
|
return aboutInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Method to hydrate an AboutInstance from database
|
||||||
|
* @param c Cursor
|
||||||
|
* @return List<AboutInstance>
|
||||||
|
*/
|
||||||
|
private List<InstanceData.AboutInstance> cursorToListInstances(Cursor c) {
|
||||||
|
//No element found
|
||||||
|
if (c.getCount() == 0) {
|
||||||
|
c.close();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<InstanceData.AboutInstance> aboutInstances = new ArrayList<>();
|
||||||
|
while (c.moveToNext()) {
|
||||||
|
String aboutInstanceStr = c.getString(c.getColumnIndex(Sqlite.COL_ABOUT));
|
||||||
|
String instance = c.getString(c.getColumnIndex(Sqlite.COL_INSTANCE));
|
||||||
|
InstanceData.AboutInstance aboutInstance = restoreAboutInstanceFromString(aboutInstanceStr);
|
||||||
|
aboutInstance.setHost(instance);
|
||||||
|
aboutInstances.add(aboutInstance);
|
||||||
|
}
|
||||||
|
//Close the cursor
|
||||||
|
c.close();
|
||||||
|
return aboutInstances;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package app.fedilab.fedilabtube.viewmodel;
|
||||||
|
/* 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.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.lifecycle.AndroidViewModel;
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
||||||
|
|
||||||
|
|
||||||
|
public class InfoInstanceVM extends AndroidViewModel {
|
||||||
|
private MutableLiveData<List<InstanceData.AboutInstance>> aboutInstanceMutableLiveData;
|
||||||
|
|
||||||
|
public InfoInstanceVM(@NonNull Application application) {
|
||||||
|
super(application);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<InstanceData.AboutInstance>> getInstances() {
|
||||||
|
aboutInstanceMutableLiveData = new MutableLiveData<>();
|
||||||
|
loadInstances();
|
||||||
|
return aboutInstanceMutableLiveData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void loadInstances() {
|
||||||
|
Context _mContext = getApplication().getApplicationContext();
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(_mContext.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
List<InstanceData.AboutInstance> instances = new StoredInstanceDAO(_mContext, db).getAllInstances();
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = () -> aboutInstanceMutableLiveData.setValue(instances);
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -33,13 +33,16 @@ import app.fedilab.fedilabtube.client.APIResponse;
|
|||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
||||||
import app.fedilab.fedilabtube.client.data.PlaylistData.Playlist;
|
import app.fedilab.fedilabtube.client.data.PlaylistData.Playlist;
|
||||||
|
import app.fedilab.fedilabtube.client.data.VideoPlaylistData;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.ManagePlaylistsDAO;
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
|
||||||
|
|
||||||
public class PlaylistsVM extends AndroidViewModel {
|
public class PlaylistsVM extends AndroidViewModel {
|
||||||
private MutableLiveData<APIResponse> apiResponseMutableLiveData;
|
private MutableLiveData<APIResponse> apiResponseMutableLiveData;
|
||||||
|
private MutableLiveData<List<VideoPlaylistData.VideoPlaylistExport>> videoPlaylistExportMutableLiveData;
|
||||||
|
|
||||||
public PlaylistsVM(@NonNull Application application) {
|
public PlaylistsVM(@NonNull Application application) {
|
||||||
super(application);
|
super(application);
|
||||||
@ -51,6 +54,13 @@ public class PlaylistsVM extends AndroidViewModel {
|
|||||||
return apiResponseMutableLiveData;
|
return apiResponseMutableLiveData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LiveData<List<VideoPlaylistData.VideoPlaylistExport>> localePlaylist() {
|
||||||
|
videoPlaylistExportMutableLiveData = new MutableLiveData<>();
|
||||||
|
loadLocalePlaylist();
|
||||||
|
return videoPlaylistExportMutableLiveData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public LiveData<APIResponse> videoExists(List<String> videoIds) {
|
public LiveData<APIResponse> videoExists(List<String> videoIds) {
|
||||||
apiResponseMutableLiveData = new MutableLiveData<>();
|
apiResponseMutableLiveData = new MutableLiveData<>();
|
||||||
checkVideosExist(videoIds);
|
checkVideosExist(videoIds);
|
||||||
@ -67,6 +77,22 @@ public class PlaylistsVM extends AndroidViewModel {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void loadLocalePlaylist() {
|
||||||
|
Context _mContext = getApplication().getApplicationContext();
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(_mContext.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
List<VideoPlaylistData.VideoPlaylistExport> videoPlaylistExports = new ManagePlaylistsDAO(_mContext, db).getAllPlaylists();
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = () -> videoPlaylistExportMutableLiveData.setValue(videoPlaylistExports);
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
private void managePlaylists(action apiAction, Playlist playlist, String videoId) {
|
private void managePlaylists(action apiAction, Playlist playlist, String videoId) {
|
||||||
Context _mContext = getApplication().getApplicationContext();
|
Context _mContext = getApplication().getApplicationContext();
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
|
@ -16,6 +16,7 @@ package app.fedilab.fedilabtube.viewmodel;
|
|||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
|
||||||
@ -24,9 +25,15 @@ import androidx.lifecycle.AndroidViewModel;
|
|||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
|
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.ManagePlaylistsDAO;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.viewmodel.PlaylistsVM.action.GET_LIST_VIDEOS;
|
import static app.fedilab.fedilabtube.viewmodel.PlaylistsVM.action.GET_LIST_VIDEOS;
|
||||||
|
|
||||||
@ -51,6 +58,18 @@ public class TimelineVM extends AndroidViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public LiveData<APIResponse> getVideoHistory(String max_id, String startDate, String endDate) {
|
||||||
|
apiResponseMutableLiveData = new MutableLiveData<>();
|
||||||
|
loadHistory(max_id, startDate, endDate);
|
||||||
|
return apiResponseMutableLiveData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<APIResponse> deleterHistory() {
|
||||||
|
apiResponseMutableLiveData = new MutableLiveData<>();
|
||||||
|
deleteHistory();
|
||||||
|
return apiResponseMutableLiveData;
|
||||||
|
}
|
||||||
|
|
||||||
public LiveData<APIResponse> getVideo(String instance, String videoId, boolean isMyVideo) {
|
public LiveData<APIResponse> getVideo(String instance, String videoId, boolean isMyVideo) {
|
||||||
apiResponseMutableLiveData = new MutableLiveData<>();
|
apiResponseMutableLiveData = new MutableLiveData<>();
|
||||||
getSingle(instance, videoId, isMyVideo);
|
getSingle(instance, videoId, isMyVideo);
|
||||||
@ -63,6 +82,12 @@ public class TimelineVM extends AndroidViewModel {
|
|||||||
return apiResponseMutableLiveData;
|
return apiResponseMutableLiveData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LiveData<APIResponse> loadVideosInLocalPlaylist(String playlistUuid) {
|
||||||
|
apiResponseMutableLiveData = new MutableLiveData<>();
|
||||||
|
loadVideosInLocalPlayList(playlistUuid);
|
||||||
|
return apiResponseMutableLiveData;
|
||||||
|
}
|
||||||
|
|
||||||
public LiveData<APIResponse> getMyVideo(String instance, String videoId) {
|
public LiveData<APIResponse> getMyVideo(String instance, String videoId) {
|
||||||
apiResponseMutableLiveData = new MutableLiveData<>();
|
apiResponseMutableLiveData = new MutableLiveData<>();
|
||||||
getSingle(instance, videoId, true);
|
getSingle(instance, videoId, true);
|
||||||
@ -138,6 +163,27 @@ public class TimelineVM extends AndroidViewModel {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadVideosInLocalPlayList(String playlistUuid) {
|
||||||
|
Context _mContext = getApplication().getApplicationContext();
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(_mContext.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
List<VideoData.VideoExport> videoExports = new ManagePlaylistsDAO(_mContext, db).getAllVideosInPlaylist(playlistUuid);
|
||||||
|
APIResponse apiResponse = new APIResponse();
|
||||||
|
List<VideoData.Video> videos = new ArrayList<>();
|
||||||
|
for (VideoData.VideoExport videoExport : videoExports) {
|
||||||
|
videos.add(videoExport.getVideoData());
|
||||||
|
}
|
||||||
|
apiResponse.setPeertubes(videos);
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = () -> apiResponseMutableLiveData.setValue(apiResponse);
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
private void loadVideos(TimelineType timeline, String max_id, String forAccount) {
|
private void loadVideos(TimelineType timeline, String max_id, String forAccount) {
|
||||||
Context _mContext = getApplication().getApplicationContext();
|
Context _mContext = getApplication().getApplicationContext();
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
@ -156,6 +202,38 @@ public class TimelineVM extends AndroidViewModel {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadHistory(String max_id, String startDate, String endDate) {
|
||||||
|
|
||||||
|
Context _mContext = getApplication().getApplicationContext();
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
RetrofitPeertubeAPI retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
||||||
|
APIResponse apiResponse = retrofitPeertubeAPI.getHistory(max_id, startDate, endDate);
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = () -> apiResponseMutableLiveData.setValue(apiResponse);
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteHistory() {
|
||||||
|
|
||||||
|
Context _mContext = getApplication().getApplicationContext();
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
RetrofitPeertubeAPI retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
||||||
|
APIResponse apiResponse = retrofitPeertubeAPI.deleteHistory();
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = () -> apiResponseMutableLiveData.setValue(apiResponse);
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void loadOverviewVideos(String page) {
|
private void loadOverviewVideos(String page) {
|
||||||
Context _mContext = getApplication().getApplicationContext();
|
Context _mContext = getApplication().getApplicationContext();
|
||||||
@ -184,6 +262,7 @@ public class TimelineVM extends AndroidViewModel {
|
|||||||
HISTORY,
|
HISTORY,
|
||||||
RECENT,
|
RECENT,
|
||||||
VIDEOS_IN_PLAYLIST,
|
VIDEOS_IN_PLAYLIST,
|
||||||
|
VIDEOS_IN_LOCAL_PLAYLIST,
|
||||||
SEPIA_SEARCH
|
SEPIA_SEARCH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,17 +37,15 @@ import app.fedilab.fedilabtube.R;
|
|||||||
|
|
||||||
public class MastalabWebChromeClient extends WebChromeClient implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener {
|
public class MastalabWebChromeClient extends WebChromeClient implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener {
|
||||||
|
|
||||||
private FrameLayout videoViewContainer;
|
|
||||||
private CustomViewCallback videoViewCallback;
|
|
||||||
|
|
||||||
private ToggledFullscreenCallback toggledFullscreenCallback;
|
|
||||||
|
|
||||||
private final CustomWebview webView;
|
private final CustomWebview webView;
|
||||||
private final View activityNonVideoView;
|
private final View activityNonVideoView;
|
||||||
private final ViewGroup activityVideoView;
|
private final ViewGroup activityVideoView;
|
||||||
private final ProgressBar pbar;
|
private final ProgressBar pbar;
|
||||||
private boolean isVideoFullscreen;
|
|
||||||
private final Activity activity;
|
private final Activity activity;
|
||||||
|
private FrameLayout videoViewContainer;
|
||||||
|
private CustomViewCallback videoViewCallback;
|
||||||
|
private ToggledFullscreenCallback toggledFullscreenCallback;
|
||||||
|
private boolean isVideoFullscreen;
|
||||||
|
|
||||||
|
|
||||||
public MastalabWebChromeClient(Activity activity, CustomWebview webView, FrameLayout activityNonVideoView, ViewGroup activityVideoView) {
|
public MastalabWebChromeClient(Activity activity, CustomWebview webView, FrameLayout activityNonVideoView, ViewGroup activityVideoView) {
|
||||||
@ -113,7 +111,6 @@ public class MastalabWebChromeClient extends WebChromeClient implements MediaPla
|
|||||||
public void onShowCustomView(View view, CustomViewCallback callback) {
|
public void onShowCustomView(View view, CustomViewCallback callback) {
|
||||||
if (view instanceof FrameLayout) {
|
if (view instanceof FrameLayout) {
|
||||||
if (((AppCompatActivity) activity).getSupportActionBar() != null)
|
if (((AppCompatActivity) activity).getSupportActionBar() != null)
|
||||||
//noinspection ConstantConditions
|
|
||||||
((AppCompatActivity) activity).getSupportActionBar().hide();
|
((AppCompatActivity) activity).getSupportActionBar().hide();
|
||||||
// A video wants to be shown
|
// A video wants to be shown
|
||||||
FrameLayout frameLayout = (FrameLayout) view;
|
FrameLayout frameLayout = (FrameLayout) view;
|
||||||
@ -178,7 +175,6 @@ public class MastalabWebChromeClient extends WebChromeClient implements MediaPla
|
|||||||
@Override
|
@Override
|
||||||
public void onHideCustomView() {
|
public void onHideCustomView() {
|
||||||
if (((AppCompatActivity) activity).getSupportActionBar() != null)
|
if (((AppCompatActivity) activity).getSupportActionBar() != null)
|
||||||
//noinspection ConstantConditions
|
|
||||||
((AppCompatActivity) activity).getSupportActionBar().show();
|
((AppCompatActivity) activity).getSupportActionBar().show();
|
||||||
// This method should be manually called on video end in all cases because it's not always called automatically.
|
// This method should be manually called on video end in all cases because it's not always called automatically.
|
||||||
// This method must be manually called on back key press (from this class' onBackPressed() method).
|
// This method must be manually called on back key press (from this class' onBackPressed() method).
|
||||||
|
@ -61,9 +61,9 @@ import static android.content.Context.NOTIFICATION_SERVICE;
|
|||||||
|
|
||||||
public class NotificationsWorker extends Worker {
|
public class NotificationsWorker extends Worker {
|
||||||
|
|
||||||
private final NotificationManager notificationManager;
|
|
||||||
public static String FETCH_NOTIFICATION_CHANNEL_ID = "fetch_notification_peertube";
|
public static String FETCH_NOTIFICATION_CHANNEL_ID = "fetch_notification_peertube";
|
||||||
public static int pendingNotificationID = 1;
|
public static int pendingNotificationID = 1;
|
||||||
|
private final NotificationManager notificationManager;
|
||||||
|
|
||||||
public NotificationsWorker(
|
public NotificationsWorker(
|
||||||
@NonNull Context context,
|
@NonNull Context context,
|
||||||
@ -80,7 +80,7 @@ public class NotificationsWorker extends Worker {
|
|||||||
Context applicationContext = getApplicationContext();
|
Context applicationContext = getApplicationContext();
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<AccountData.Account> accounts = new AccountDAO(applicationContext, db).getAllAccount();
|
List<AccountData.Account> accounts = new AccountDAO(applicationContext, db).getAllAccount();
|
||||||
if( accounts == null || accounts.size() == 0) {
|
if (accounts == null || accounts.size() == 0) {
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
setForegroundAsync(createForegroundInfo());
|
setForegroundAsync(createForegroundInfo());
|
||||||
@ -95,28 +95,28 @@ public class NotificationsWorker extends Worker {
|
|||||||
List<AccountData.Account> accounts = new AccountDAO(getApplicationContext(), db).getAllAccount();
|
List<AccountData.Account> accounts = new AccountDAO(getApplicationContext(), db).getAllAccount();
|
||||||
SharedPreferences sharedpreferences = getApplicationContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getApplicationContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
for(AccountData.Account account: accounts) {
|
for (AccountData.Account account : accounts) {
|
||||||
RetrofitPeertubeAPI retrofitPeertubeAPI = new RetrofitPeertubeAPI(getApplicationContext(), account.getHost(), account.getToken());
|
RetrofitPeertubeAPI retrofitPeertubeAPI = new RetrofitPeertubeAPI(getApplicationContext(), account.getHost(), account.getToken());
|
||||||
APIResponse apiResponse = retrofitPeertubeAPI.getNotifications();
|
APIResponse apiResponse = retrofitPeertubeAPI.getNotifications();
|
||||||
if( apiResponse == null) {
|
if (apiResponse == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
UserMe userMe = retrofitPeertubeAPI.verifyCredentials();
|
UserMe userMe = retrofitPeertubeAPI.verifyCredentials();
|
||||||
if( userMe != null) {
|
if (userMe != null) {
|
||||||
List<NotificationData.Notification> notifications = apiResponse.getPeertubeNotifications();
|
List<NotificationData.Notification> notifications = apiResponse.getPeertubeNotifications();
|
||||||
NotificationSettings notificationSettings = userMe.getNotificationSettings();
|
NotificationSettings notificationSettings = userMe.getNotificationSettings();
|
||||||
if( apiResponse.getPeertubeNotifications() != null && apiResponse.getPeertubeNotifications().size() > 0 ) {
|
if (apiResponse.getPeertubeNotifications() != null && apiResponse.getPeertubeNotifications().size() > 0) {
|
||||||
String last_read = sharedpreferences.getString(Helper.LAST_NOTIFICATION_READ + account.getId() + account.getHost(), null);
|
String last_read = sharedpreferences.getString(Helper.LAST_NOTIFICATION_READ + account.getId() + account.getHost(), null);
|
||||||
editor.putString(Helper.LAST_NOTIFICATION_READ + account.getId() + account.getHost(), apiResponse.getPeertubeNotifications().get(0).getId());
|
editor.putString(Helper.LAST_NOTIFICATION_READ + account.getId() + account.getHost(), apiResponse.getPeertubeNotifications().get(0).getId());
|
||||||
editor.apply();
|
editor.apply();
|
||||||
if( last_read != null) {
|
if (last_read != null) {
|
||||||
for(NotificationData.Notification notification: notifications) {
|
for (NotificationData.Notification notification : notifications) {
|
||||||
String title = "";
|
String title = "";
|
||||||
String message = "";
|
String message = "";
|
||||||
FutureTarget<Bitmap> futureBitmap = Glide.with(getApplicationContext())
|
FutureTarget<Bitmap> futureBitmap = Glide.with(getApplicationContext())
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load("https://"+account.getHost()+account.getAvatar()).submit();
|
.load("https://" + account.getHost() + account.getAvatar()).submit();
|
||||||
Bitmap icon;
|
Bitmap icon;
|
||||||
try {
|
try {
|
||||||
icon = futureBitmap.get();
|
icon = futureBitmap.get();
|
||||||
@ -126,14 +126,14 @@ public class NotificationsWorker extends Worker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = null;
|
Intent intent = null;
|
||||||
if(notification.getId().compareTo(last_read) > 0) {
|
if (notification.getId().compareTo(last_read) > 0) {
|
||||||
switch (notification.getType()) {
|
switch (notification.getType()) {
|
||||||
case DisplayNotificationsFragment.NEW_VIDEO_FROM_SUBSCRIPTION:
|
case DisplayNotificationsFragment.NEW_VIDEO_FROM_SUBSCRIPTION:
|
||||||
if(notificationSettings.getNewVideoFromSubscription() == 1 || notificationSettings.getNewVideoFromSubscription() == 3) {
|
if (notificationSettings.getNewVideoFromSubscription() == 1 || notificationSettings.getNewVideoFromSubscription() == 3) {
|
||||||
if( notification.getVideo().getChannel().getAvatar() != null ) {
|
if (notification.getVideo().getChannel().getAvatar() != null) {
|
||||||
FutureTarget<Bitmap> futureBitmapChannel = Glide.with(getApplicationContext())
|
FutureTarget<Bitmap> futureBitmapChannel = Glide.with(getApplicationContext())
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load("https://"+account.getHost()+notification.getVideo().getChannel().getAvatar().getPath()).submit();
|
.load("https://" + account.getHost() + notification.getVideo().getChannel().getAvatar().getPath()).submit();
|
||||||
try {
|
try {
|
||||||
icon = futureBitmapChannel.get();
|
icon = futureBitmapChannel.get();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -141,7 +141,7 @@ public class NotificationsWorker extends Worker {
|
|||||||
R.drawable.missing_peertube);
|
R.drawable.missing_peertube);
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
icon = BitmapFactory.decodeResource(getApplicationContext().getResources(),
|
icon = BitmapFactory.decodeResource(getApplicationContext().getResources(),
|
||||||
R.drawable.missing_peertube);
|
R.drawable.missing_peertube);
|
||||||
}
|
}
|
||||||
@ -158,11 +158,11 @@ public class NotificationsWorker extends Worker {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DisplayNotificationsFragment.NEW_COMMENT_ON_MY_VIDEO:
|
case DisplayNotificationsFragment.NEW_COMMENT_ON_MY_VIDEO:
|
||||||
if(notificationSettings.getNewCommentOnMyVideo() == 1 || notificationSettings.getNewCommentOnMyVideo() == 3) {
|
if (notificationSettings.getNewCommentOnMyVideo() == 1 || notificationSettings.getNewCommentOnMyVideo() == 3) {
|
||||||
if( notification.getComment().getAccount().getAvatar() != null ) {
|
if (notification.getComment().getAccount().getAvatar() != null) {
|
||||||
FutureTarget<Bitmap> futureBitmapChannel = Glide.with(getApplicationContext())
|
FutureTarget<Bitmap> futureBitmapChannel = Glide.with(getApplicationContext())
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load("https://"+account.getHost()+ notification.getComment().getAccount().getAvatar().getPath()).submit();
|
.load("https://" + account.getHost() + notification.getComment().getAccount().getAvatar().getPath()).submit();
|
||||||
try {
|
try {
|
||||||
icon = futureBitmapChannel.get();
|
icon = futureBitmapChannel.get();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -170,7 +170,7 @@ public class NotificationsWorker extends Worker {
|
|||||||
R.drawable.missing_peertube);
|
R.drawable.missing_peertube);
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
icon = BitmapFactory.decodeResource(getApplicationContext().getResources(),
|
icon = BitmapFactory.decodeResource(getApplicationContext().getResources(),
|
||||||
R.drawable.missing_peertube);
|
R.drawable.missing_peertube);
|
||||||
}
|
}
|
||||||
@ -191,31 +191,31 @@ public class NotificationsWorker extends Worker {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case DisplayNotificationsFragment.BLACKLIST_ON_MY_VIDEO:
|
case DisplayNotificationsFragment.BLACKLIST_ON_MY_VIDEO:
|
||||||
if(notificationSettings.getBlacklistOnMyVideo() == 1 || notificationSettings.getBlacklistOnMyVideo() == 3) {
|
if (notificationSettings.getBlacklistOnMyVideo() == 1 || notificationSettings.getBlacklistOnMyVideo() == 3) {
|
||||||
title = getApplicationContext().getString(R.string.new_blacklist);
|
title = getApplicationContext().getString(R.string.new_blacklist);
|
||||||
message = getApplicationContext().getString(R.string.peertube_video_blacklist, notification.getVideo().getName());
|
message = getApplicationContext().getString(R.string.peertube_video_blacklist, notification.getVideo().getName());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DisplayNotificationsFragment.UNBLACKLIST_ON_MY_VIDEO:
|
case DisplayNotificationsFragment.UNBLACKLIST_ON_MY_VIDEO:
|
||||||
if(notificationSettings.getBlacklistOnMyVideo() == 1 || notificationSettings.getBlacklistOnMyVideo() == 3) {
|
if (notificationSettings.getBlacklistOnMyVideo() == 1 || notificationSettings.getBlacklistOnMyVideo() == 3) {
|
||||||
title = getApplicationContext().getString(R.string.new_blacklist);
|
title = getApplicationContext().getString(R.string.new_blacklist);
|
||||||
message = getApplicationContext().getString(R.string.peertube_video_unblacklist, notification.getVideo().getName());
|
message = getApplicationContext().getString(R.string.peertube_video_unblacklist, notification.getVideo().getName());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DisplayNotificationsFragment.MY_VIDEO_PUBLISHED:
|
case DisplayNotificationsFragment.MY_VIDEO_PUBLISHED:
|
||||||
if(notificationSettings.getMyVideoPublished() == 1 || notificationSettings.getMyVideoPublished() == 3) {
|
if (notificationSettings.getMyVideoPublished() == 1 || notificationSettings.getMyVideoPublished() == 3) {
|
||||||
title = getApplicationContext().getString(R.string.new_my_video_published);
|
title = getApplicationContext().getString(R.string.new_my_video_published);
|
||||||
message = getApplicationContext().getString(R.string.peertube_video_published, notification.getVideo().getName());
|
message = getApplicationContext().getString(R.string.peertube_video_published, notification.getVideo().getName());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DisplayNotificationsFragment.MY_VIDEO_IMPORT_SUCCESS:
|
case DisplayNotificationsFragment.MY_VIDEO_IMPORT_SUCCESS:
|
||||||
if(notificationSettings.getMyVideoPublished() == 1 || notificationSettings.getMyVideoPublished() == 3) {
|
if (notificationSettings.getMyVideoPublished() == 1 || notificationSettings.getMyVideoPublished() == 3) {
|
||||||
message = getApplicationContext().getString(R.string.peertube_video_import_success, notification.getVideo().getName());
|
message = getApplicationContext().getString(R.string.peertube_video_import_success, notification.getVideo().getName());
|
||||||
title = getApplicationContext().getString(R.string.new_my_video_error);
|
title = getApplicationContext().getString(R.string.new_my_video_error);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DisplayNotificationsFragment.MY_VIDEO_IMPORT_ERROR:
|
case DisplayNotificationsFragment.MY_VIDEO_IMPORT_ERROR:
|
||||||
if(notificationSettings.getMyVideoPublished() == 1 || notificationSettings.getMyVideoPublished() == 3) {
|
if (notificationSettings.getMyVideoPublished() == 1 || notificationSettings.getMyVideoPublished() == 3) {
|
||||||
message = getApplicationContext().getString(R.string.peertube_video_import_error, notification.getVideo().getName());
|
message = getApplicationContext().getString(R.string.peertube_video_import_error, notification.getVideo().getName());
|
||||||
title = getApplicationContext().getString(R.string.new_my_video_error);
|
title = getApplicationContext().getString(R.string.new_my_video_error);
|
||||||
}
|
}
|
||||||
@ -224,14 +224,14 @@ public class NotificationsWorker extends Worker {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case DisplayNotificationsFragment.NEW_FOLLOW:
|
case DisplayNotificationsFragment.NEW_FOLLOW:
|
||||||
if(notificationSettings.getNewFollow() == 1 || notificationSettings.getNewFollow() == 3) {
|
if (notificationSettings.getNewFollow() == 1 || notificationSettings.getNewFollow() == 3) {
|
||||||
if( notification.getVideo().getChannel().getAvatar() != null ) {
|
if (notification.getVideo().getChannel().getAvatar() != null) {
|
||||||
FutureTarget<Bitmap> futureBitmapChannel = Glide.with(getApplicationContext())
|
FutureTarget<Bitmap> futureBitmapChannel = Glide.with(getApplicationContext())
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load("https://"+account.getHost()+notification.getVideo().getChannel().getAvatar().getPath()).submit();
|
.load("https://" + account.getHost() + notification.getVideo().getChannel().getAvatar().getPath()).submit();
|
||||||
icon = futureBitmapChannel.get();
|
icon = futureBitmapChannel.get();
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
icon = BitmapFactory.decodeResource(getApplicationContext().getResources(),
|
icon = BitmapFactory.decodeResource(getApplicationContext().getResources(),
|
||||||
R.drawable.missing_peertube);
|
R.drawable.missing_peertube);
|
||||||
}
|
}
|
||||||
@ -274,14 +274,14 @@ public class NotificationsWorker extends Worker {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( message != null && icon != null && title != null) {
|
if (message != null && icon != null && title != null) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
message = Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY).toString();
|
message = Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY).toString();
|
||||||
else
|
else
|
||||||
message = Html.fromHtml(message).toString();
|
message = Html.fromHtml(message).toString();
|
||||||
NotificationHelper.notify_user(getApplicationContext(), account, intent, icon, title, message);
|
NotificationHelper.notify_user(getApplicationContext(), account, intent, icon, title, message);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,9 @@ package app.fedilab.fedilabtube.worker;
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
|
||||||
import androidx.work.BackoffPolicy;
|
import androidx.work.BackoffPolicy;
|
||||||
import androidx.work.Constraints;
|
import androidx.work.Constraints;
|
||||||
import androidx.work.ExistingPeriodicWorkPolicy;
|
import androidx.work.ExistingPeriodicWorkPolicy;
|
||||||
|
4
app/src/main/res/anim/slide_in_up.xml
Normal file
4
app/src/main/res/anim/slide_in_up.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<translate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:fromYDelta="100%p" android:toYDelta="0%p"
|
||||||
|
android:duration="@android:integer/config_longAnimTime"/>
|
4
app/src/main/res/anim/slide_in_up_down.xml
Normal file
4
app/src/main/res/anim/slide_in_up_down.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<translate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:fromYDelta="0%p" android:toYDelta="100%p"
|
||||||
|
android:duration="@android:integer/config_longAnimTime"/>
|
4
app/src/main/res/anim/slide_out_up.xml
Normal file
4
app/src/main/res/anim/slide_out_up.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<translate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:fromYDelta="0%p"
|
||||||
|
android:duration="@android:integer/config_longAnimTime"/>
|
7
app/src/main/res/drawable/background_rounded_item.xml
Normal file
7
app/src/main/res/drawable/background_rounded_item.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="?attr/colorAccent" />
|
||||||
|
<corners android:radius="20dp" />
|
||||||
|
</shape>
|
10
app/src/main/res/drawable/ic_baseline_close_24.xml
Normal file
10
app/src/main/res/drawable/ic_baseline_close_24.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z" />
|
||||||
|
</vector>
|
10
app/src/main/res/drawable/ic_baseline_import_export_24.xml
Normal file
10
app/src/main/res/drawable/ic_baseline_import_export_24.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M9,3L5,6.99h3L8,14h2L10,6.99h3L9,3zM16,17.01L16,10h-2v7.01h-3L15,21l4,-3.99h-3z" />
|
||||||
|
</vector>
|
@ -1,10 +1,10 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:tint="?attr/colorControlNormal"
|
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
<path
|
<path
|
||||||
android:fillColor="@android:color/white"
|
android:fillColor="@android:color/white"
|
||||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM11,19.93c-3.95,-0.49 -7,-3.85 -7,-7.93 0,-0.62 0.08,-1.21 0.21,-1.79L9,15v1c0,1.1 0.9,2 2,2v1.93zM17.9,17.39c-0.26,-0.81 -1,-1.39 -1.9,-1.39h-1v-3c0,-0.55 -0.45,-1 -1,-1L8,12v-2h2c0.55,0 1,-0.45 1,-1L11,7h2c1.1,0 2,-0.9 2,-2v-0.41c2.93,1.19 5,4.06 5,7.41 0,2.08 -0.8,3.97 -2.1,5.39z" />
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM11,19.93c-3.95,-0.49 -7,-3.85 -7,-7.93 0,-0.62 0.08,-1.21 0.21,-1.79L9,15v1c0,1.1 0.9,2 2,2v1.93zM17.9,17.39c-0.26,-0.81 -1,-1.39 -1.9,-1.39h-1v-3c0,-0.55 -0.45,-1 -1,-1L8,12v-2h2c0.55,0 1,-0.45 1,-1L11,7h2c1.1,0 2,-0.9 2,-2v-0.41c2.93,1.19 5,4.06 5,7.41 0,2.08 -0.8,3.97 -2.1,5.39z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
@ -61,13 +61,28 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/profile_picture"
|
android:id="@+id/profile_picture"
|
||||||
android:layout_width="60dp"
|
android:layout_width="80dp"
|
||||||
android:layout_height="60dp"
|
android:layout_height="80dp"
|
||||||
android:contentDescription="@string/profile_picture"
|
android:contentDescription="@string/profile_picture"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
android:id="@+id/edit_profile"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="50dp"
|
||||||
|
android:layout_marginTop="50dp"
|
||||||
|
android:contentDescription="@string/edit_profile"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/ic_baseline_edit_24"
|
||||||
|
android:tint="@color/white"
|
||||||
|
app:fabSize="mini"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/displayname"
|
android:id="@+id/displayname"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
android:paddingLeft="@dimen/fab_margin"
|
android:paddingLeft="@dimen/fab_margin"
|
||||||
android:paddingRight="@dimen/fab_margin">
|
android:paddingRight="@dimen/fab_margin">
|
||||||
|
|
||||||
<ListView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/lv_playlist"
|
android:id="@+id/lv_playlist"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -60,51 +60,47 @@
|
|||||||
android:paddingStart="50dp"
|
android:paddingStart="50dp"
|
||||||
android:paddingEnd="50dp">
|
android:paddingEnd="50dp">
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/login_instance_container"
|
android:id="@+id/login_instance_container"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
app:labelText="@string/title_instance_login"
|
|
||||||
app:secondaryColor="?attr/colorAccent"
|
|
||||||
app:primaryColor="?attr/colorAccent">
|
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/login_instance"
|
android:id="@+id/login_instance"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="2dp"
|
android:paddingTop="2dp"
|
||||||
|
android:hint="@string/title_instance_login"
|
||||||
android:inputType="textWebEmailAddress"
|
android:inputType="textWebEmailAddress"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:importantForAutofill="no" />
|
android:importantForAutofill="no" />
|
||||||
|
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/login_uid_container"
|
android:id="@+id/login_uid_container"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/login_instance_container"
|
app:layout_constraintTop_toBottomOf="@id/login_instance_container">
|
||||||
app:labelText="@string/email_address"
|
|
||||||
app:secondaryColor="?attr/colorAccent"
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
app:primaryColor="?attr/colorAccent"
|
|
||||||
>
|
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
|
||||||
android:id="@+id/login_uid"
|
android:id="@+id/login_uid"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="textEmailAddress"
|
android:inputType="textEmailAddress"
|
||||||
|
android:hint="@string/email_address"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:importantForAutofill="no" />
|
android:importantForAutofill="no" />
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/login_passwd_container"
|
android:id="@+id/login_passwd_container"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -112,19 +108,17 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/login_uid_container"
|
app:layout_constraintTop_toBottomOf="@id/login_uid_container"
|
||||||
app:passwordToggleEnabled="true"
|
app:passwordToggleEnabled="true">
|
||||||
app:labelText="@string/password"
|
|
||||||
app:secondaryColor="?attr/colorAccent"
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
app:primaryColor="?attr/colorAccent"
|
|
||||||
>
|
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
|
||||||
android:id="@+id/login_passwd"
|
android:id="@+id/login_passwd"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/password"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:importantForAutofill="no" />
|
android:importantForAutofill="no" />
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/login_button"
|
android:id="@+id/login_button"
|
||||||
|
@ -43,7 +43,23 @@
|
|||||||
app:popupTheme="@style/popupTheme"
|
app:popupTheme="@style/popupTheme"
|
||||||
app:layout_scrollFlags="scroll|enterAlways"
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
/>
|
>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/instances"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_baseline_public_24"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:contentDescription="@string/instance_choice"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
app:tint="?attr/colorAccent" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/toolbar_title"
|
||||||
|
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"/>
|
||||||
|
</androidx.appcompat.widget.Toolbar>
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
|
||||||
|
77
app/src/main/res/layout/activity_manage_instances.xml
Normal file
77
app/src/main/res/layout/activity_manage_instances.xml
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
<!-
|
||||||
|
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>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/main_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="@dimen/fab_margin"
|
||||||
|
android:scrollbars="none"
|
||||||
|
tools:context=".ManageInstancesActivity">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/lv_instances"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
/>
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/no_action"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/no_action_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="@string/no_instances"
|
||||||
|
android:textSize="25sp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
<!-- Main Loader -->
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/loader"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<com.github.ybq.android.spinkit.SpinKitView
|
||||||
|
style="@style/progress"
|
||||||
|
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
|
||||||
|
android:id="@+id/action_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_margin="@dimen/fab_margin_button"
|
||||||
|
android:src="@drawable/ic_baseline_add_24"
|
||||||
|
android:contentDescription="@string/instances_picker"
|
||||||
|
android:tint="@android:color/white"
|
||||||
|
/>
|
||||||
|
</RelativeLayout>
|
@ -29,53 +29,51 @@
|
|||||||
app:layout_constraintStart_toEndOf="@+id/profile_picture"
|
app:layout_constraintStart_toEndOf="@+id/profile_picture"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/profile_picture" />
|
app:layout_constraintBottom_toBottomOf="@id/profile_picture" />
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/displayname_container"
|
android:id="@+id/displayname_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
app:secondaryColor="?attr/colorAccent"
|
|
||||||
app:primaryColor="?attr/colorAccent"
|
|
||||||
app:labelText="@string/display_name"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/profile_picture">
|
app:layout_constraintTop_toBottomOf="@+id/profile_picture">
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/displayname"
|
android:id="@+id/displayname"
|
||||||
|
android:hint="@string/display_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:importantForAutofill="no" />
|
android:importantForAutofill="no" />
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/description_container"
|
android:id="@+id/description_container"
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginTop="30dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
app:secondaryColor="?attr/colorAccent"
|
|
||||||
app:primaryColor="?attr/colorAccent"
|
|
||||||
app:labelText="@string/description"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/displayname_container">
|
app:layout_constraintTop_toBottomOf="@+id/displayname_container">
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/description"
|
android:id="@+id/description"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="textMultiLine"
|
android:inputType="textMultiLine"
|
||||||
|
android:hint="@string/description"
|
||||||
android:gravity="top"
|
android:gravity="top"
|
||||||
android:lines="4"
|
android:lines="4"
|
||||||
android:minLines="4"
|
android:minLines="4"
|
||||||
android:maxLines="6"
|
android:maxLines="6"
|
||||||
android:singleLine="false"
|
android:singleLine="false"
|
||||||
android:importantForAutofill="no" />
|
android:importantForAutofill="no" />
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
|
@ -87,6 +87,7 @@
|
|||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:id="@+id/bottom_video"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="2"
|
android:layout_weight="2"
|
||||||
android:layout_marginStart="@dimen/video_comment_margin"
|
android:layout_marginStart="@dimen/video_comment_margin"
|
||||||
@ -244,80 +245,13 @@
|
|||||||
android:textColor="?attr/colorAccent"
|
android:textColor="?attr/colorAccent"
|
||||||
android:layout_marginTop="2dp" />
|
android:layout_marginTop="2dp" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<Button
|
||||||
android:id="@+id/write_comment_container"
|
android:layout_gravity="center"
|
||||||
android:layout_margin="10dp"
|
style="@style/Widget.AppCompat.Button.Borderless.Colored"
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/post_comment_button"
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<View
|
|
||||||
android:id="@+id/separator_top"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/write_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1px"
|
|
||||||
android:background="@android:color/darker_gray"/>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/separator_top"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/separator_bottom"
|
|
||||||
android:id="@+id/write_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/my_pp"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:layout_marginEnd="5dp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:contentDescription="@string/profile_picture" />
|
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
|
||||||
android:id="@+id/text_field_boxes"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/my_pp"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/send"
|
|
||||||
app:labelText="@string/add_public_comment"
|
|
||||||
app:secondaryColor="?attr/colorAccent"
|
|
||||||
app:primaryColor="?attr/colorAccent"
|
|
||||||
>
|
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
|
||||||
android:id="@+id/add_comment_write"
|
|
||||||
app:alwaysShowHint="false"
|
|
||||||
app:useDenseSpacing="false"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
/>
|
android:text="@string/add_public_comment"/>
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
|
||||||
<ImageView
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
android:id="@+id/send"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:contentDescription="@string/send_comment"
|
|
||||||
android:src="@drawable/ic_baseline_send_24" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/separator_bottom"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/write_container"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1px"
|
|
||||||
android:background="@android:color/darker_gray"/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/peertube_comments"
|
android:id="@+id/peertube_comments"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -363,14 +297,57 @@
|
|||||||
android:divider="?android:dividerHorizontal"
|
android:divider="?android:dividerHorizontal"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:showDividers="end">
|
android:showDividers="end">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_gravity="end|center_vertical"
|
android:layout_gravity="end|center_vertical"
|
||||||
android:id="@+id/close_reply"
|
android:id="@+id/close_reply"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:contentDescription="@string/close"
|
android:contentDescription="@string/close"
|
||||||
android:src="@drawable/ic_close_black_48dp"/>
|
android:src="@drawable/ic_baseline_close_24" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
android:id="@+id/peertube_reply"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:background="?android:colorBackground"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
android:id="@+id/post_comment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
android:id="@+id/post_main_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:divider="?android:dividerHorizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:showDividers="end">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:layout_gravity="end|center_vertical"
|
||||||
|
android:id="@+id/close_post"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:contentDescription="@string/close"
|
||||||
|
android:src="@drawable/ic_baseline_close_24" />
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/reply_content"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<ImageView
|
<ImageView
|
||||||
@ -429,69 +406,67 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/comment_account_profile" />
|
app:layout_constraintTop_toBottomOf="@+id/comment_account_profile" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/write_comment_container_reply"
|
android:id="@+id/write_comment_container"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<View
|
<View
|
||||||
android:id="@+id/separator_top_reply"
|
android:id="@+id/separator_top"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/write_container_reply"
|
app:layout_constraintBottom_toTopOf="@+id/write_container"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1px"
|
android:layout_height="1px"
|
||||||
android:background="@android:color/darker_gray"/>
|
android:background="@android:color/darker_gray"/>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
app:layout_constraintTop_toBottomOf="@+id/separator_top_reply"
|
app:layout_constraintTop_toBottomOf="@+id/separator_top"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/separator_bottom_reply"
|
app:layout_constraintBottom_toTopOf="@+id/separator_bottom"
|
||||||
android:id="@+id/write_container_reply"
|
android:id="@+id/write_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/my_pp_reply"
|
android:id="@+id/my_pp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:contentDescription="@string/profile_picture" />
|
android:contentDescription="@string/profile_picture" />
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/text_field_boxes_reply"
|
android:id="@+id/text_field_boxes"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/my_pp_reply"
|
app:layout_constraintStart_toEndOf="@+id/my_pp"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/send_reply"
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
app:labelText="@string/add_public_reply"
|
|
||||||
app:secondaryColor="?attr/colorAccent"
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
app:primaryColor="?attr/colorAccent"
|
android:id="@+id/add_comment_write"
|
||||||
>
|
android:gravity="top"
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
android:inputType="textMultiLine"
|
||||||
android:id="@+id/add_comment_write_reply"
|
android:hint="@string/add_public_reply"
|
||||||
app:alwaysShowHint="false"
|
android:minLines="4"
|
||||||
app:useDenseSpacing="false"
|
android:maxLines="8"
|
||||||
android:textSize="14sp"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="match_parent" />
|
||||||
android:layout_height="wrap_content"
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
/>
|
<Button
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
app:layout_constraintTop_toBottomOf="@+id/text_field_boxes"
|
||||||
<ImageView
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:id="@+id/send_reply"
|
style="@style/Widget.AppCompat.Button.Borderless.Colored"
|
||||||
|
android:id="@+id/send"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:contentDescription="@string/send_comment"
|
android:text="@string/send_comment"/>
|
||||||
android:src="@drawable/ic_baseline_send_24"
|
|
||||||
/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/separator_bottom_reply"
|
android:id="@+id/separator_bottom"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/write_container_reply"
|
app:layout_constraintTop_toBottomOf="@+id/write_container"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@ -499,12 +474,6 @@
|
|||||||
android:layout_height="1px"
|
android:layout_height="1px"
|
||||||
android:background="@android:color/darker_gray"/>
|
android:background="@android:color/darker_gray"/>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
android:id="@+id/peertube_reply"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
@ -69,25 +69,23 @@
|
|||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/login_instance_container"
|
android:id="@+id/login_instance_container"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:secondaryColor="?attr/colorAccent"
|
|
||||||
app:primaryColor="?attr/colorAccent"
|
|
||||||
app:labelText="@string/title_instance_login"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent">
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/login_instance"
|
android:id="@+id/login_instance"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="textWebEditText"
|
android:inputType="textWebEditText"
|
||||||
|
android:hint="@string/title_instance_login"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:importantForAutofill="no" />
|
android:importantForAutofill="no" />
|
||||||
|
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/instance_help"
|
android:id="@+id/instance_help"
|
||||||
@ -100,42 +98,37 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:secondaryColor="?attr/colorAccent"
|
|
||||||
app:primaryColor="?attr/colorAccent"
|
|
||||||
app:labelText="@string/username"
|
|
||||||
app:errorEnabled="true">
|
app:errorEnabled="true">
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/username"
|
android:id="@+id/username"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/username"
|
||||||
android:maxLength="50"
|
android:maxLength="50"
|
||||||
android:importantForAutofill="no"
|
android:importantForAutofill="no"
|
||||||
android:inputType="text" />
|
android:inputType="text" />
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:secondaryColor="?attr/colorAccent"
|
|
||||||
app:primaryColor="?attr/colorAccent"
|
|
||||||
app:labelText="@string/email"
|
|
||||||
app:errorEnabled="true">
|
app:errorEnabled="true">
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/email"
|
android:id="@+id/email"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/email"
|
||||||
android:importantForAutofill="no"
|
android:importantForAutofill="no"
|
||||||
android:inputType="textEmailAddress" />
|
android:inputType="textEmailAddress" />
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
@ -145,22 +138,19 @@
|
|||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:secondaryColor="?attr/colorAccent"
|
|
||||||
app:primaryColor="?attr/colorAccent"
|
|
||||||
app:labelText="@string/password"
|
|
||||||
app:errorEnabled="true">
|
app:errorEnabled="true">
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/password"
|
android:id="@+id/password"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:hint="@string/password"
|
android:hint="@string/password"
|
||||||
android:importantForAutofill="no" />
|
android:importantForAutofill="no" />
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -170,21 +160,19 @@
|
|||||||
android:text="@string/password_indicator"
|
android:text="@string/password_indicator"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:secondaryColor="?attr/colorAccent"
|
|
||||||
app:primaryColor="?attr/colorAccent"
|
|
||||||
app:labelText="@string/password_confirm"
|
|
||||||
app:errorEnabled="true">
|
app:errorEnabled="true">
|
||||||
|
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/password_confirm"
|
android:id="@+id/password_confirm"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/password_confirm"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:importantForAutofill="no" />
|
android:importantForAutofill="no" />
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
|
@ -14,7 +14,72 @@
|
|||||||
You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
see <http://www.gnu.org/licenses>.
|
see <http://www.gnu.org/licenses>.
|
||||||
-->
|
-->
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<HorizontalScrollView
|
||||||
|
android:id="@+id/history_filter"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/history_filter_all"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/background_rounded_item"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp"
|
||||||
|
android:text="@string/all"
|
||||||
|
android:textColor="?attr/colorAccent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/history_filter_today"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:background="@drawable/background_rounded_item"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp"
|
||||||
|
android:text="@string/today"
|
||||||
|
android:textColor="?attr/colorAccent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/history_filter_last_7_days"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:background="@drawable/background_rounded_item"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp"
|
||||||
|
android:text="@string/last_7_days"
|
||||||
|
android:textColor="?attr/colorAccent" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</HorizontalScrollView>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
android:id="@+id/container"
|
android:id="@+id/container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/history_filter">
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
78
app/src/main/res/layout/drawer_about_instance.xml
Normal file
78
app/src/main/res/layout/drawer_about_instance.xml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
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>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/instance_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:divider="?android:dividerHorizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:showDividers="end">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginBottom="5dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/about_instance_host"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/instance_more"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:id="@+id/about_instance_name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/instance_more"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/about_instance_host" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/about_instance_description"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/instance_more"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/about_instance_name" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/instance_more"
|
||||||
|
style="@style/Widget.AppCompat.Button.Borderless"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:contentDescription="@string/display_more"
|
||||||
|
android:src="@drawable/ic_baseline_more_vert_24"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</LinearLayout>
|
@ -28,14 +28,23 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
<View
|
||||||
|
android:id="@+id/decoration"
|
||||||
|
android:layout_width="2dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="?attr/colorAccent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/comment_account_profile"
|
android:id="@+id/comment_account_profile"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
android:contentDescription="@string/profile_picture"
|
android:contentDescription="@string/profile_picture"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="@id/decoration"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -51,13 +60,14 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/comment_account_username"
|
android:id="@+id/comment_account_username"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:layout_marginStart="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/more_actions"
|
||||||
app:layout_constraintStart_toEndOf="@+id/comment_account_profile"
|
app:layout_constraintStart_toEndOf="@+id/comment_account_profile"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/comment_account_displayname" />
|
app:layout_constraintTop_toBottomOf="@+id/comment_account_displayname" />
|
||||||
|
|
||||||
@ -71,7 +81,7 @@
|
|||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toStartOf="@id/more_actions"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -91,14 +101,14 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:textIsSelectable="true"
|
android:textIsSelectable="true"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toStartOf="@id/more_actions"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="@id/comment_account_profile"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/comment_account_profile" />
|
app:layout_constraintTop_toBottomOf="@+id/comment_account_profile" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/number_of_replies"
|
android:id="@+id/number_of_replies"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/comment_content"
|
app:layout_constraintTop_toBottomOf="@+id/comment_content"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="@id/decoration"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="?attr/colorAccent"/>
|
android:textColor="?attr/colorAccent"/>
|
||||||
@ -106,7 +116,7 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
app:layout_constraintTop_toBottomOf="@+id/comment_content"
|
app:layout_constraintTop_toBottomOf="@+id/comment_content"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="@id/comment_account_profile"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:id="@+id/replyButton"
|
android:id="@+id/replyButton"
|
||||||
@ -115,73 +125,18 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<Button
|
||||||
app:layout_constraintTop_toBottomOf="@+id/replyButton"
|
style="@style/Widget.AppCompat.Button.Borderless.Colored"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:id="@+id/post_reply_button"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
android:layout_width="match_parent"
|
||||||
android:id="@+id/write_comment_container_reply"
|
android:gravity="center"
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<View
|
|
||||||
android:id="@+id/separator_top_reply"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/write_container_reply"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1px"
|
|
||||||
android:background="@android:color/darker_gray"/>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/separator_top_reply"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/separator_bottom_reply"
|
|
||||||
android:id="@+id/write_container_reply"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
|
||||||
android:id="@+id/text_field_boxes_reply"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:text="@string/add_public_reply"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:textColor="?attr/colorAccent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/send_reply"
|
|
||||||
app:labelText="@string/add_public_reply"
|
|
||||||
app:secondaryColor="?attr/colorAccent"
|
|
||||||
app:primaryColor="?attr/colorAccent"
|
|
||||||
>
|
|
||||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
|
||||||
android:id="@+id/add_comment_write_reply"
|
|
||||||
app:alwaysShowHint="false"
|
|
||||||
app:useDenseSpacing="false"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
/>
|
|
||||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
|
||||||
<ImageView
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:id="@+id/send_reply"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:contentDescription="@string/send_comment"
|
|
||||||
android:src="@drawable/ic_baseline_send_24"
|
|
||||||
/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/separator_bottom_reply"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/write_container_reply"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintTop_toBottomOf="@+id/comment_content" />
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1px"
|
|
||||||
android:background="@android:color/darker_gray"/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
android:paddingLeft="@dimen/fab_margin"
|
android:paddingLeft="@dimen/fab_margin"
|
||||||
android:paddingRight="@dimen/fab_margin">
|
android:paddingRight="@dimen/fab_margin">
|
||||||
<!-- Listview list -->
|
<!-- Listview list -->
|
||||||
<ListView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/lv_playlist"
|
android:id="@+id/lv_playlist"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
9
app/src/main/res/menu/instance_menu.xml
Normal file
9
app/src/main/res/menu/instance_menu.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_delete"
|
||||||
|
android:icon="@drawable/ic_baseline_delete_24"
|
||||||
|
android:title="@string/delete"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
</menu>
|
@ -11,6 +11,11 @@
|
|||||||
android:icon="@drawable/ic_baseline_report_24"
|
android:icon="@drawable/ic_baseline_report_24"
|
||||||
android:title="@string/report"
|
android:title="@string/report"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_display_account"
|
||||||
|
android:icon="@drawable/ic_outline_account_circle_24"
|
||||||
|
android:title="@string/account"
|
||||||
|
app:showAsAction="never" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_share"
|
android:id="@+id/action_share"
|
||||||
android:icon="@drawable/ic_baseline_share_24"
|
android:icon="@drawable/ic_baseline_share_24"
|
||||||
|
9
app/src/main/res/menu/main_history.xml
Normal file
9
app/src/main/res/menu/main_history.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_delete"
|
||||||
|
android:icon="@drawable/ic_baseline_delete_24"
|
||||||
|
android:title="@string/delete"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
</menu>
|
@ -9,11 +9,11 @@
|
|||||||
android:title="@string/search"
|
android:title="@string/search"
|
||||||
app:actionViewClass="androidx.appcompat.widget.SearchView"
|
app:actionViewClass="androidx.appcompat.widget.SearchView"
|
||||||
app:showAsAction="always|collapseActionView" />
|
app:showAsAction="always|collapseActionView" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_change_instance"
|
android:id="@+id/action_change_instance"
|
||||||
android:icon="@drawable/ic_baseline_track_changes_24"
|
android:icon="@drawable/ic_baseline_track_changes_24"
|
||||||
android:title="@string/change_instance"
|
android:title="@string/change_instance"
|
||||||
|
android:visible="false"
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="ifRoom" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_playlist"
|
android:id="@+id/action_playlist"
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user