Merge pull request #1335 from Bnyro/master

code structure
This commit is contained in:
Bnyro 2022-09-20 20:00:59 +02:00 committed by GitHub
commit 8e8d982013
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
118 changed files with 386 additions and 370 deletions

View File

@ -24,7 +24,7 @@
-keep class com.github.libretube.obj.** { *; } -keep class com.github.libretube.obj.** { *; }
# prevents android from removing it # prevents android from removing it
-keep class com.github.libretube.update.** { *; } -keep class com.github.libretube.obj.**.** { *; }
# prevents obfuscation in debug logs # prevents obfuscation in debug logs
-dontobfuscate -dontobfuscate

View File

@ -22,27 +22,27 @@
tools:targetApi="n"> tools:targetApi="n">
<activity <activity
android:name=".activities.NoInternetActivity" android:name=".ui.activities.NoInternetActivity"
android:label="@string/noInternet" /> android:label="@string/noInternet" />
<activity <activity
android:name=".activities.SettingsActivity" android:name=".ui.activities.SettingsActivity"
android:label="@string/settings" /> android:label="@string/settings" />
<activity <activity
android:name=".activities.AboutActivity" android:name=".ui.activities.AboutActivity"
android:label="@string/settings" /> android:label="@string/settings" />
<activity <activity
android:name=".activities.CommunityActivity" android:name=".ui.activities.CommunityActivity"
android:label="@string/settings" /> android:label="@string/settings" />
<activity <activity
android:name=".activities.OfflinePlayerActivity" android:name=".ui.activities.OfflinePlayerActivity"
android:label="@string/player" /> android:label="@string/player" />
<activity <activity
android:name=".activities.MainActivity" android:name=".ui.activities.MainActivity"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:exported="true" android:exported="true"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
@ -66,7 +66,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_gradient_round" android:roundIcon="@mipmap/ic_gradient_round"
android:supportsPictureInPicture="true" android:supportsPictureInPicture="true"
android:targetActivity=".activities.MainActivity" android:targetActivity=".ui.activities.MainActivity"
android:windowSoftInputMode="adjustPan"> android:windowSoftInputMode="adjustPan">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -84,7 +84,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_fire_round" android:roundIcon="@mipmap/ic_fire_round"
android:supportsPictureInPicture="true" android:supportsPictureInPicture="true"
android:targetActivity=".activities.MainActivity" android:targetActivity=".ui.activities.MainActivity"
android:windowSoftInputMode="adjustPan"> android:windowSoftInputMode="adjustPan">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -102,7 +102,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_flame_round" android:roundIcon="@mipmap/ic_flame_round"
android:supportsPictureInPicture="true" android:supportsPictureInPicture="true"
android:targetActivity=".activities.MainActivity" android:targetActivity=".ui.activities.MainActivity"
android:windowSoftInputMode="adjustPan"> android:windowSoftInputMode="adjustPan">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -120,7 +120,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_shaped_round" android:roundIcon="@mipmap/ic_shaped_round"
android:supportsPictureInPicture="true" android:supportsPictureInPicture="true"
android:targetActivity=".activities.MainActivity" android:targetActivity=".ui.activities.MainActivity"
android:windowSoftInputMode="adjustPan"> android:windowSoftInputMode="adjustPan">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -138,7 +138,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_torch_round" android:roundIcon="@mipmap/ic_torch_round"
android:supportsPictureInPicture="true" android:supportsPictureInPicture="true"
android:targetActivity=".activities.MainActivity" android:targetActivity=".ui.activities.MainActivity"
android:windowSoftInputMode="adjustPan"> android:windowSoftInputMode="adjustPan">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -156,7 +156,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_legacy_round" android:roundIcon="@mipmap/ic_legacy_round"
android:supportsPictureInPicture="true" android:supportsPictureInPicture="true"
android:targetActivity=".activities.MainActivity" android:targetActivity=".ui.activities.MainActivity"
android:windowSoftInputMode="adjustPan"> android:windowSoftInputMode="adjustPan">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -174,7 +174,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_bird_round" android:roundIcon="@mipmap/ic_bird_round"
android:supportsPictureInPicture="true" android:supportsPictureInPicture="true"
android:targetActivity=".activities.MainActivity" android:targetActivity=".ui.activities.MainActivity"
android:windowSoftInputMode="adjustPan"> android:windowSoftInputMode="adjustPan">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -183,7 +183,7 @@
</activity-alias> </activity-alias>
<activity <activity
android:name=".activities.RouterActivity" android:name=".ui.activities.RouterActivity"
android:exported="true" android:exported="true"
android:launchMode="singleInstance"> android:launchMode="singleInstance">
<intent-filter> <intent-filter>

View File

@ -1,15 +1,15 @@
package com.github.libretube.api package com.github.libretube.api
import com.github.libretube.api.obj.Instances
import com.github.libretube.constants.GITHUB_API_URL import com.github.libretube.constants.GITHUB_API_URL
import com.github.libretube.constants.PIPED_INSTANCES_URL import com.github.libretube.constants.PIPED_INSTANCES_URL
import com.github.libretube.obj.Instances import com.github.libretube.obj.update.UpdateInfo
import com.github.libretube.update.UpdateInfo
import retrofit2.http.GET import retrofit2.http.GET
interface ExternalApi { interface ExternalApi {
// only for fetching servers list // only for fetching servers list
@GET(PIPED_INSTANCES_URL) @GET(PIPED_INSTANCES_URL)
suspend fun getInstances(): List<Instances> suspend fun getInstances(): List<com.github.libretube.api.obj.Instances>
// fetch latest version info // fetch latest version info
@GET(GITHUB_API_URL) @GET(GITHUB_API_URL)

View File

@ -1,21 +1,21 @@
package com.github.libretube.api package com.github.libretube.api
import com.github.libretube.obj.Channel import com.github.libretube.api.obj.Channel
import com.github.libretube.obj.CommentsPage import com.github.libretube.api.obj.CommentsPage
import com.github.libretube.obj.DeleteUserRequest import com.github.libretube.api.obj.DeleteUserRequest
import com.github.libretube.obj.Login import com.github.libretube.api.obj.Login
import com.github.libretube.obj.Message import com.github.libretube.api.obj.Message
import com.github.libretube.obj.Playlist import com.github.libretube.api.obj.Playlist
import com.github.libretube.obj.PlaylistId import com.github.libretube.api.obj.PlaylistId
import com.github.libretube.obj.Playlists import com.github.libretube.api.obj.Playlists
import com.github.libretube.obj.SearchResult import com.github.libretube.api.obj.SearchResult
import com.github.libretube.obj.Segments import com.github.libretube.api.obj.Segments
import com.github.libretube.obj.StreamItem import com.github.libretube.api.obj.StreamItem
import com.github.libretube.obj.Streams import com.github.libretube.api.obj.Streams
import com.github.libretube.obj.Subscribe import com.github.libretube.api.obj.Subscribe
import com.github.libretube.obj.Subscribed import com.github.libretube.api.obj.Subscribed
import com.github.libretube.obj.Subscription import com.github.libretube.api.obj.Subscription
import com.github.libretube.obj.Token import com.github.libretube.api.obj.Token
import retrofit2.http.Body import retrofit2.http.Body
import retrofit2.http.GET import retrofit2.http.GET
import retrofit2.http.Header import retrofit2.http.Header
@ -25,148 +25,148 @@ import retrofit2.http.Query
interface PipedApi { interface PipedApi {
@GET("trending") @GET("trending")
suspend fun getTrending(@Query("region") region: String): List<StreamItem> suspend fun getTrending(@Query("region") region: String): List<com.github.libretube.api.obj.StreamItem>
@GET("streams/{videoId}") @GET("streams/{videoId}")
suspend fun getStreams(@Path("videoId") videoId: String): Streams suspend fun getStreams(@Path("videoId") videoId: String): com.github.libretube.api.obj.Streams
@GET("comments/{videoId}") @GET("comments/{videoId}")
suspend fun getComments(@Path("videoId") videoId: String): CommentsPage suspend fun getComments(@Path("videoId") videoId: String): com.github.libretube.api.obj.CommentsPage
@GET("sponsors/{videoId}") @GET("sponsors/{videoId}")
suspend fun getSegments( suspend fun getSegments(
@Path("videoId") videoId: String, @Path("videoId") videoId: String,
@Query("category") category: String @Query("category") category: String
): Segments ): com.github.libretube.api.obj.Segments
@GET("nextpage/comments/{videoId}") @GET("nextpage/comments/{videoId}")
suspend fun getCommentsNextPage( suspend fun getCommentsNextPage(
@Path("videoId") videoId: String, @Path("videoId") videoId: String,
@Query("nextpage") nextPage: String @Query("nextpage") nextPage: String
): CommentsPage ): com.github.libretube.api.obj.CommentsPage
@GET("search") @GET("search")
suspend fun getSearchResults( suspend fun getSearchResults(
@Query("q") searchQuery: String, @Query("q") searchQuery: String,
@Query("filter") filter: String @Query("filter") filter: String
): SearchResult ): com.github.libretube.api.obj.SearchResult
@GET("nextpage/search") @GET("nextpage/search")
suspend fun getSearchResultsNextPage( suspend fun getSearchResultsNextPage(
@Query("q") searchQuery: String, @Query("q") searchQuery: String,
@Query("filter") filter: String, @Query("filter") filter: String,
@Query("nextpage") nextPage: String @Query("nextpage") nextPage: String
): SearchResult ): com.github.libretube.api.obj.SearchResult
@GET("suggestions") @GET("suggestions")
suspend fun getSuggestions(@Query("query") query: String): List<String> suspend fun getSuggestions(@Query("query") query: String): List<String>
@GET("channel/{channelId}") @GET("channel/{channelId}")
suspend fun getChannel(@Path("channelId") channelId: String): Channel suspend fun getChannel(@Path("channelId") channelId: String): com.github.libretube.api.obj.Channel
@GET("user/{name}") @GET("user/{name}")
suspend fun getChannelByName(@Path("name") channelName: String): Channel suspend fun getChannelByName(@Path("name") channelName: String): com.github.libretube.api.obj.Channel
@GET("nextpage/channel/{channelId}") @GET("nextpage/channel/{channelId}")
suspend fun getChannelNextPage( suspend fun getChannelNextPage(
@Path("channelId") channelId: String, @Path("channelId") channelId: String,
@Query("nextpage") nextPage: String @Query("nextpage") nextPage: String
): Channel ): com.github.libretube.api.obj.Channel
@GET("playlists/{playlistId}") @GET("playlists/{playlistId}")
suspend fun getPlaylist(@Path("playlistId") playlistId: String): Playlist suspend fun getPlaylist(@Path("playlistId") playlistId: String): com.github.libretube.api.obj.Playlist
@GET("nextpage/playlists/{playlistId}") @GET("nextpage/playlists/{playlistId}")
suspend fun getPlaylistNextPage( suspend fun getPlaylistNextPage(
@Path("playlistId") playlistId: String, @Path("playlistId") playlistId: String,
@Query("nextpage") nextPage: String @Query("nextpage") nextPage: String
): Playlist ): com.github.libretube.api.obj.Playlist
@POST("login") @POST("login")
suspend fun login(@Body login: Login): Token suspend fun login(@Body login: com.github.libretube.api.obj.Login): com.github.libretube.api.obj.Token
@POST("register") @POST("register")
suspend fun register(@Body login: Login): Token suspend fun register(@Body login: com.github.libretube.api.obj.Login): com.github.libretube.api.obj.Token
@POST("user/delete") @POST("user/delete")
suspend fun deleteAccount( suspend fun deleteAccount(
@Header("Authorization") token: String, @Header("Authorization") token: String,
@Body password: DeleteUserRequest @Body password: com.github.libretube.api.obj.DeleteUserRequest
) )
@GET("feed") @GET("feed")
suspend fun getFeed(@Query("authToken") token: String?): List<StreamItem> suspend fun getFeed(@Query("authToken") token: String?): List<com.github.libretube.api.obj.StreamItem>
@GET("feed/unauthenticated") @GET("feed/unauthenticated")
suspend fun getUnauthenticatedFeed(@Query("channels") channels: String): List<StreamItem> suspend fun getUnauthenticatedFeed(@Query("channels") channels: String): List<com.github.libretube.api.obj.StreamItem>
@GET("subscribed") @GET("subscribed")
suspend fun isSubscribed( suspend fun isSubscribed(
@Query("channelId") channelId: String, @Query("channelId") channelId: String,
@Header("Authorization") token: String @Header("Authorization") token: String
): Subscribed ): com.github.libretube.api.obj.Subscribed
@GET("subscriptions") @GET("subscriptions")
suspend fun subscriptions(@Header("Authorization") token: String): List<Subscription> suspend fun subscriptions(@Header("Authorization") token: String): List<com.github.libretube.api.obj.Subscription>
@GET("subscriptions/unauthenticated") @GET("subscriptions/unauthenticated")
suspend fun unauthenticatedSubscriptions(@Query("channels") channels: String): List<Subscription> suspend fun unauthenticatedSubscriptions(@Query("channels") channels: String): List<com.github.libretube.api.obj.Subscription>
@POST("subscribe") @POST("subscribe")
suspend fun subscribe( suspend fun subscribe(
@Header("Authorization") token: String, @Header("Authorization") token: String,
@Body subscribe: Subscribe @Body subscribe: com.github.libretube.api.obj.Subscribe
): Message ): com.github.libretube.api.obj.Message
@POST("unsubscribe") @POST("unsubscribe")
suspend fun unsubscribe( suspend fun unsubscribe(
@Header("Authorization") token: String, @Header("Authorization") token: String,
@Body subscribe: Subscribe @Body subscribe: com.github.libretube.api.obj.Subscribe
): Message ): com.github.libretube.api.obj.Message
@POST("import") @POST("import")
suspend fun importSubscriptions( suspend fun importSubscriptions(
@Query("override") override: Boolean, @Query("override") override: Boolean,
@Header("Authorization") token: String, @Header("Authorization") token: String,
@Body channels: List<String> @Body channels: List<String>
): Message ): com.github.libretube.api.obj.Message
@POST("import/playlist") @POST("import/playlist")
suspend fun importPlaylist( suspend fun importPlaylist(
@Header("Authorization") token: String, @Header("Authorization") token: String,
@Body playlistId: PlaylistId @Body playlistId: com.github.libretube.api.obj.PlaylistId
): Message ): com.github.libretube.api.obj.Message
@GET("user/playlists") @GET("user/playlists")
suspend fun playlists(@Header("Authorization") token: String): List<Playlists> suspend fun playlists(@Header("Authorization") token: String): List<com.github.libretube.api.obj.Playlists>
@POST("user/playlists/rename") @POST("user/playlists/rename")
suspend fun renamePlaylist( suspend fun renamePlaylist(
@Header("Authorization") token: String, @Header("Authorization") token: String,
@Body playlistId: PlaylistId @Body playlistId: com.github.libretube.api.obj.PlaylistId
) )
@POST("user/playlists/delete") @POST("user/playlists/delete")
suspend fun deletePlaylist( suspend fun deletePlaylist(
@Header("Authorization") token: String, @Header("Authorization") token: String,
@Body playlistId: PlaylistId @Body playlistId: com.github.libretube.api.obj.PlaylistId
): Message ): com.github.libretube.api.obj.Message
@POST("user/playlists/create") @POST("user/playlists/create")
suspend fun createPlaylist( suspend fun createPlaylist(
@Header("Authorization") token: String, @Header("Authorization") token: String,
@Body name: Playlists @Body name: com.github.libretube.api.obj.Playlists
): PlaylistId ): com.github.libretube.api.obj.PlaylistId
@POST("user/playlists/add") @POST("user/playlists/add")
suspend fun addToPlaylist( suspend fun addToPlaylist(
@Header("Authorization") token: String, @Header("Authorization") token: String,
@Body playlistId: PlaylistId @Body playlistId: com.github.libretube.api.obj.PlaylistId
): Message ): com.github.libretube.api.obj.Message
@POST("user/playlists/remove") @POST("user/playlists/remove")
suspend fun removeFromPlaylist( suspend fun removeFromPlaylist(
@Header("Authorization") token: String, @Header("Authorization") token: String,
@Body playlistId: PlaylistId @Body playlistId: com.github.libretube.api.obj.PlaylistId
): Message ): com.github.libretube.api.obj.Message
} }

View File

@ -1,11 +1,11 @@
package com.github.libretube.api package com.github.libretube.api
import android.util.Log import android.util.Log
import com.github.libretube.api.obj.Subscribe
import com.github.libretube.db.DatabaseHolder.Companion.Database import com.github.libretube.db.DatabaseHolder.Companion.Database
import com.github.libretube.db.obj.LocalSubscription import com.github.libretube.db.obj.LocalSubscription
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.await import com.github.libretube.extensions.await
import com.github.libretube.obj.Subscribe
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -19,7 +19,7 @@ object SubscriptionHelper {
try { try {
RetrofitInstance.authApi.subscribe( RetrofitInstance.authApi.subscribe(
PreferenceHelper.getToken(), PreferenceHelper.getToken(),
Subscribe(channelId) com.github.libretube.api.obj.Subscribe(channelId)
) )
} catch (e: Exception) { } catch (e: Exception) {
Log.e(TAG(), e.toString()) Log.e(TAG(), e.toString())
@ -40,7 +40,7 @@ object SubscriptionHelper {
try { try {
RetrofitInstance.authApi.unsubscribe( RetrofitInstance.authApi.unsubscribe(
PreferenceHelper.getToken(), PreferenceHelper.getToken(),
Subscribe(channelId) com.github.libretube.api.obj.Subscribe(channelId)
) )
} catch (e: Exception) { } catch (e: Exception) {
Log.e(TAG(), e.toString()) Log.e(TAG(), e.toString())

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@ -12,5 +12,5 @@ data class Channel(
var nextpage: String? = null, var nextpage: String? = null,
var subscriberCount: Long = 0, var subscriberCount: Long = 0,
var verified: Boolean = false, var verified: Boolean = false,
var relatedStreams: List<StreamItem>? = null var relatedStreams: List<com.github.libretube.api.obj.StreamItem>? = null
) )

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,10 +1,10 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
data class CommentsPage( data class CommentsPage(
val comments: MutableList<Comment> = arrayListOf(), val comments: MutableList<com.github.libretube.api.obj.Comment> = arrayListOf(),
val disabled: Boolean? = null, val disabled: Boolean? = null,
val nextpage: String? = "" val nextpage: String? = ""
) )

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
data class DeleteUserRequest( data class DeleteUserRequest(
var password: String? = null var password: String? = null

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
data class Message( data class Message(
var message: String? = null var message: String? = null

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@ -12,5 +12,5 @@ data class Playlist(
var uploaderUrl: String? = null, var uploaderUrl: String? = null,
var uploaderAvatar: String? = null, var uploaderAvatar: String? = null,
var videos: Int? = 0, var videos: Int? = 0,
var relatedStreams: List<StreamItem>? = null var relatedStreams: List<com.github.libretube.api.obj.StreamItem>? = null
) )

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,8 +1,8 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
data class Segments( data class Segments(
val segments: MutableList<Segment> = arrayListOf() val segments: MutableList<com.github.libretube.api.obj.Segment> = arrayListOf()
) )

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@ -19,13 +19,13 @@ data class Streams(
val views: Long?, val views: Long?,
val likes: Long?, val likes: Long?,
val dislikes: Long?, val dislikes: Long?,
val audioStreams: List<PipedStream>?, val audioStreams: List<com.github.libretube.api.obj.PipedStream>?,
val videoStreams: List<PipedStream>?, val videoStreams: List<com.github.libretube.api.obj.PipedStream>?,
val relatedStreams: List<StreamItem>?, val relatedStreams: List<com.github.libretube.api.obj.StreamItem>?,
val subtitles: List<Subtitle>?, val subtitles: List<com.github.libretube.api.obj.Subtitle>?,
val livestream: Boolean?, val livestream: Boolean?,
val proxyUrl: String?, val proxyUrl: String?,
val chapters: List<ChapterSegment>? val chapters: List<com.github.libretube.api.obj.ChapterSegment>?
) { ) {
constructor() : this( constructor() : this(
"", "", "", "", "", "", "", "", "", "", null, -1, -1, -1, -1, emptyList(), emptyList(), "", "", "", "", "", "", "", "", "", "", null, -1, -1, -1, -1, emptyList(), emptyList(),

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,16 +1,16 @@
package com.github.libretube.db package com.github.libretube.db
import com.github.libretube.api.obj.Streams
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.db.DatabaseHolder.Companion.Database import com.github.libretube.db.DatabaseHolder.Companion.Database
import com.github.libretube.db.obj.SearchHistoryItem import com.github.libretube.db.obj.SearchHistoryItem
import com.github.libretube.db.obj.WatchHistoryItem import com.github.libretube.db.obj.WatchHistoryItem
import com.github.libretube.db.obj.WatchPosition import com.github.libretube.db.obj.WatchPosition
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.obj.Streams
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
object DatabaseHelper { object DatabaseHelper {
fun addToWatchHistory(videoId: String, streams: Streams) { fun addToWatchHistory(videoId: String, streams: com.github.libretube.api.obj.Streams) {
val watchHistoryItem = WatchHistoryItem( val watchHistoryItem = WatchHistoryItem(
videoId, videoId,
streams.title, streams.title,

View File

@ -5,10 +5,10 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.SubscriptionHelper import com.github.libretube.api.SubscriptionHelper
import com.github.libretube.api.obj.StreamItem
import com.github.libretube.api.obj.Subscription
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.obj.StreamItem
import com.github.libretube.obj.Subscription
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -19,11 +19,11 @@ class SubscriptionsViewModel : ViewModel() {
value = false value = false
} }
var videoFeed = MutableLiveData<List<StreamItem>?>().apply { var videoFeed = MutableLiveData<List<com.github.libretube.api.obj.StreamItem>?>().apply {
value = null value = null
} }
var subscriptions = MutableLiveData<List<Subscription>?>().apply { var subscriptions = MutableLiveData<List<com.github.libretube.api.obj.Subscription>?>().apply {
value = null value = null
} }

View File

@ -1,4 +1,4 @@
package com.github.libretube.update package com.github.libretube.obj.update
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.update package com.github.libretube.obj.update
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.update package com.github.libretube.obj.update
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.update package com.github.libretube.obj.update
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -1,4 +1,4 @@
package com.github.libretube.update package com.github.libretube.obj.update
import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View File

@ -13,14 +13,14 @@ import android.widget.Toast
import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.ObjectMapper
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.obj.Segment
import com.github.libretube.api.obj.Segments
import com.github.libretube.api.obj.Streams
import com.github.libretube.constants.BACKGROUND_CHANNEL_ID import com.github.libretube.constants.BACKGROUND_CHANNEL_ID
import com.github.libretube.constants.IntentData import com.github.libretube.constants.IntentData
import com.github.libretube.constants.PLAYER_NOTIFICATION_ID import com.github.libretube.constants.PLAYER_NOTIFICATION_ID
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.obj.Segment
import com.github.libretube.obj.Segments
import com.github.libretube.obj.Streams
import com.github.libretube.util.AutoPlayHelper import com.github.libretube.util.AutoPlayHelper
import com.github.libretube.util.NowPlayingNotification import com.github.libretube.util.NowPlayingNotification
import com.github.libretube.util.PlayerHelper import com.github.libretube.util.PlayerHelper
@ -52,7 +52,7 @@ class BackgroundMode : Service() {
/** /**
* The response that gets when called the Api. * The response that gets when called the Api.
*/ */
private var streams: Streams? = null private var streams: com.github.libretube.api.obj.Streams? = null
/** /**
* The [ExoPlayer] player. Followed tutorial [here](https://developer.android.com/codelabs/exoplayer-intro) * The [ExoPlayer] player. Followed tutorial [here](https://developer.android.com/codelabs/exoplayer-intro)
@ -68,7 +68,7 @@ class BackgroundMode : Service() {
/** /**
* SponsorBlock Segment data * SponsorBlock Segment data
*/ */
private var segmentData: Segments? = null private var segmentData: com.github.libretube.api.obj.Segments? = null
/** /**
* [Notification] for the player * [Notification] for the player
@ -307,7 +307,7 @@ class BackgroundMode : Service() {
if (segmentData == null || segmentData!!.segments.isEmpty()) return if (segmentData == null || segmentData!!.segments.isEmpty()) return
segmentData!!.segments.forEach { segment: Segment -> segmentData!!.segments.forEach { segment: com.github.libretube.api.obj.Segment ->
val segmentStart = (segment.segment!![0] * 1000f).toLong() val segmentStart = (segment.segment!![0] * 1000f).toLong()
val segmentEnd = (segment.segment[1] * 1000f).toLong() val segmentEnd = (segment.segment[1] * 1000f).toLong()
val currentPosition = player?.currentPosition val currentPosition = player?.currentPosition

View File

@ -58,12 +58,15 @@ class UpdateService : Service() {
val id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1) val id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1)
if (downloadId == id) { if (downloadId == id) {
// install the apk after download finished // install the apk after download finished
val installIntent = Intent(Intent.ACTION_VIEW) val installIntent = Intent(Intent.ACTION_VIEW).apply {
installIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
installIntent.setDataAndType( addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
setDataAndType(
Uri.fromFile(file), Uri.fromFile(file),
downloadManager.getMimeTypeForDownloadedFile(downloadId) downloadManager.getMimeTypeForDownloadedFile(downloadId)
) )
}
try { try {
startActivity(installIntent) startActivity(installIntent)
} catch (e: Exception) { } catch (e: Exception) {

View File

@ -6,14 +6,14 @@ import android.util.Log
import android.widget.Toast import android.widget.Toast
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.obj.PlaylistId
import com.github.libretube.databinding.DialogTextPreferenceBinding import com.github.libretube.databinding.DialogTextPreferenceBinding
import com.github.libretube.dialogs.ShareDialog
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.obj.PlaylistId import com.github.libretube.ui.dialogs.ShareDialog
import com.github.libretube.ui.views.BottomSheet
import com.github.libretube.util.BackgroundHelper import com.github.libretube.util.BackgroundHelper
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import com.github.libretube.views.BottomSheet
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -114,7 +114,10 @@ class PlaylistOptionsBottomSheet(
private fun importPlaylist(token: String, playlistId: String) { private fun importPlaylist(token: String, playlistId: String) {
CoroutineScope(Dispatchers.IO).launch { CoroutineScope(Dispatchers.IO).launch {
val response = try { val response = try {
RetrofitInstance.authApi.importPlaylist(token, PlaylistId(playlistId)) RetrofitInstance.authApi.importPlaylist(
token,
com.github.libretube.api.obj.PlaylistId(playlistId)
)
} catch (e: IOException) { } catch (e: IOException) {
println(e) println(e)
return@launch return@launch
@ -130,7 +133,7 @@ class PlaylistOptionsBottomSheet(
try { try {
RetrofitInstance.authApi.renamePlaylist( RetrofitInstance.authApi.renamePlaylist(
PreferenceHelper.getToken(), PreferenceHelper.getToken(),
PlaylistId( com.github.libretube.api.obj.PlaylistId(
playlistId = id, playlistId = id,
newName = newName newName = newName
) )
@ -146,7 +149,7 @@ class PlaylistOptionsBottomSheet(
try { try {
RetrofitInstance.authApi.deletePlaylist( RetrofitInstance.authApi.deletePlaylist(
PreferenceHelper.getToken(), PreferenceHelper.getToken(),
PlaylistId(id) com.github.libretube.api.obj.PlaylistId(id)
) )
} catch (e: Exception) { } catch (e: Exception) {
return@launch return@launch

View File

@ -4,13 +4,13 @@ import android.os.Bundle
import android.widget.Toast import android.widget.Toast
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.constants.IntentData import com.github.libretube.constants.IntentData
import com.github.libretube.dialogs.AddToPlaylistDialog import com.github.libretube.ui.dialogs.AddToPlaylistDialog
import com.github.libretube.dialogs.DownloadDialog import com.github.libretube.ui.dialogs.DownloadDialog
import com.github.libretube.dialogs.ShareDialog import com.github.libretube.ui.dialogs.ShareDialog
import com.github.libretube.ui.views.BottomSheet
import com.github.libretube.util.BackgroundHelper import com.github.libretube.util.BackgroundHelper
import com.github.libretube.util.PlayingQueue import com.github.libretube.util.PlayingQueue
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import com.github.libretube.views.BottomSheet
/** /**
* Dialog with different options for a selected video. * Dialog with different options for a selected video.

View File

@ -1,4 +1,4 @@
package com.github.libretube.activities package com.github.libretube.ui.activities
import android.content.ClipData import android.content.ClipData
import android.content.ClipboardManager import android.content.ClipboardManager

View File

@ -1,4 +1,4 @@
package com.github.libretube.activities package com.github.libretube.ui.activities
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri

View File

@ -1,4 +1,4 @@
package com.github.libretube.activities package com.github.libretube.ui.activities
import android.content.Intent import android.content.Intent
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
@ -25,14 +25,14 @@ import com.github.libretube.R
import com.github.libretube.constants.IntentData import com.github.libretube.constants.IntentData
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.databinding.ActivityMainBinding import com.github.libretube.databinding.ActivityMainBinding
import com.github.libretube.dialogs.ErrorDialog
import com.github.libretube.extensions.BaseActivity import com.github.libretube.extensions.BaseActivity
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.fragments.PlayerFragment
import com.github.libretube.models.PlayerViewModel import com.github.libretube.models.PlayerViewModel
import com.github.libretube.models.SearchViewModel import com.github.libretube.models.SearchViewModel
import com.github.libretube.models.SubscriptionsViewModel import com.github.libretube.models.SubscriptionsViewModel
import com.github.libretube.services.ClosingService import com.github.libretube.services.ClosingService
import com.github.libretube.ui.dialogs.ErrorDialog
import com.github.libretube.ui.fragments.PlayerFragment
import com.github.libretube.util.NavBarHelper import com.github.libretube.util.NavBarHelper
import com.github.libretube.util.NetworkHelper import com.github.libretube.util.NetworkHelper
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper

View File

@ -1,4 +1,4 @@
package com.github.libretube.activities package com.github.libretube.ui.activities
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
@ -7,7 +7,7 @@ import com.github.libretube.R
import com.github.libretube.databinding.ActivityNointernetBinding import com.github.libretube.databinding.ActivityNointernetBinding
import com.github.libretube.extensions.BaseActivity import com.github.libretube.extensions.BaseActivity
import com.github.libretube.extensions.getStyledSnackBar import com.github.libretube.extensions.getStyledSnackBar
import com.github.libretube.fragments.DownloadsFragment import com.github.libretube.ui.fragments.DownloadsFragment
import com.github.libretube.util.NetworkHelper import com.github.libretube.util.NetworkHelper
import com.github.libretube.util.ThemeHelper import com.github.libretube.util.ThemeHelper

View File

@ -1,4 +1,4 @@
package com.github.libretube.activities package com.github.libretube.ui.activities
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import android.graphics.Color import android.graphics.Color

View File

@ -1,4 +1,4 @@
package com.github.libretube.activities package com.github.libretube.ui.activities
import android.content.Intent import android.content.Intent
import android.content.pm.PackageManager import android.content.pm.PackageManager

View File

@ -1,11 +1,11 @@
package com.github.libretube.activities package com.github.libretube.ui.activities
import android.os.Bundle import android.os.Bundle
import androidx.activity.OnBackPressedCallback import androidx.activity.OnBackPressedCallback
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.databinding.ActivitySettingsBinding import com.github.libretube.databinding.ActivitySettingsBinding
import com.github.libretube.extensions.BaseActivity import com.github.libretube.extensions.BaseActivity
import com.github.libretube.preferences.MainSettings import com.github.libretube.ui.preferences.MainSettings
class SettingsActivity : BaseActivity() { class SettingsActivity : BaseActivity() {
lateinit var binding: ActivitySettingsBinding lateinit var binding: ActivitySettingsBinding

View File

@ -1,4 +1,4 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup

View File

@ -1,4 +1,4 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View

View File

@ -1,21 +1,21 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.text.format.DateUtils import android.text.format.DateUtils
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.api.obj.StreamItem
import com.github.libretube.databinding.VideoRowBinding import com.github.libretube.databinding.VideoRowBinding
import com.github.libretube.extensions.formatShort import com.github.libretube.extensions.formatShort
import com.github.libretube.extensions.setWatchProgressLength import com.github.libretube.extensions.setWatchProgressLength
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.obj.StreamItem
import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.sheets.VideoOptionsBottomSheet
import com.github.libretube.util.ImageHelper import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper import com.github.libretube.util.NavigationHelper
class ChannelAdapter( class ChannelAdapter(
private val videoFeed: MutableList<StreamItem>, private val videoFeed: MutableList<com.github.libretube.api.obj.StreamItem>,
private val childFragmentManager: FragmentManager private val childFragmentManager: FragmentManager
) : ) :
RecyclerView.Adapter<ChannelViewHolder>() { RecyclerView.Adapter<ChannelViewHolder>() {
@ -24,7 +24,7 @@ class ChannelAdapter(
return videoFeed.size return videoFeed.size
} }
fun updateItems(newItems: List<StreamItem>) { fun updateItems(newItems: List<com.github.libretube.api.obj.StreamItem>) {
val feedSize = videoFeed.size val feedSize = videoFeed.size
videoFeed.addAll(newItems) videoFeed.addAll(newItems)
notifyItemRangeInserted(feedSize, newItems.size) notifyItemRangeInserted(feedSize, newItems.size)

View File

@ -1,17 +1,17 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.graphics.Color import android.graphics.Color
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.api.obj.ChapterSegment
import com.github.libretube.databinding.ChapterColumnBinding import com.github.libretube.databinding.ChapterColumnBinding
import com.github.libretube.obj.ChapterSegment
import com.github.libretube.util.ImageHelper import com.github.libretube.util.ImageHelper
import com.github.libretube.util.ThemeHelper import com.github.libretube.util.ThemeHelper
import com.google.android.exoplayer2.ExoPlayer import com.google.android.exoplayer2.ExoPlayer
class ChaptersAdapter( class ChaptersAdapter(
private val chapters: List<ChapterSegment>, private val chapters: List<com.github.libretube.api.obj.ChapterSegment>,
private val exoPlayer: ExoPlayer private val exoPlayer: ExoPlayer
) : RecyclerView.Adapter<ChaptersViewHolder>() { ) : RecyclerView.Adapter<ChaptersViewHolder>() {
private var selectedPosition = 0 private var selectedPosition = 0

View File

@ -1,4 +1,4 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.util.Log import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
@ -9,11 +9,11 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.obj.Comment
import com.github.libretube.api.obj.CommentsPage
import com.github.libretube.databinding.CommentsRowBinding import com.github.libretube.databinding.CommentsRowBinding
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.formatShort import com.github.libretube.extensions.formatShort
import com.github.libretube.obj.Comment
import com.github.libretube.obj.CommentsPage
import com.github.libretube.util.ImageHelper import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper import com.github.libretube.util.NavigationHelper
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
@ -24,14 +24,14 @@ import java.io.IOException
class CommentsAdapter( class CommentsAdapter(
private val videoId: String, private val videoId: String,
private val comments: MutableList<Comment> private val comments: MutableList<com.github.libretube.api.obj.Comment>
) : RecyclerView.Adapter<CommentsViewHolder>() { ) : RecyclerView.Adapter<CommentsViewHolder>() {
private var isLoading = false private var isLoading = false
private var nextpage = "" private var nextpage = ""
private var repliesPage = CommentsPage() private var repliesPage = com.github.libretube.api.obj.CommentsPage()
fun updateItems(newItems: List<Comment>) { fun updateItems(newItems: List<com.github.libretube.api.obj.Comment>) {
val commentsSize = comments.size val commentsSize = comments.size
comments.addAll(newItems) comments.addAll(newItems)
notifyItemRangeInserted(commentsSize, newItems.size) notifyItemRangeInserted(commentsSize, newItems.size)

View File

@ -1,4 +1,4 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
@ -6,10 +6,10 @@ import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.OfflinePlayerActivity
import com.github.libretube.constants.IntentData import com.github.libretube.constants.IntentData
import com.github.libretube.databinding.DownloadedMediaRowBinding import com.github.libretube.databinding.DownloadedMediaRowBinding
import com.github.libretube.obj.DownloadedFile import com.github.libretube.obj.DownloadedFile
import com.github.libretube.ui.activities.OfflinePlayerActivity
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.File import java.io.File

View File

@ -1,16 +1,16 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.api.obj.Subscription
import com.github.libretube.databinding.LegacySubscriptionChannelBinding import com.github.libretube.databinding.LegacySubscriptionChannelBinding
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.obj.Subscription
import com.github.libretube.util.ImageHelper import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper import com.github.libretube.util.NavigationHelper
class LegacySubscriptionAdapter( class LegacySubscriptionAdapter(
private val subscriptions: List<Subscription> private val subscriptions: List<com.github.libretube.api.obj.Subscription>
) : RecyclerView.Adapter<LegacySubscriptionViewHolder>() { ) : RecyclerView.Adapter<LegacySubscriptionViewHolder>() {
override fun onCreateViewHolder( override fun onCreateViewHolder(

View File

@ -1,4 +1,4 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup

View File

@ -1,4 +1,4 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.app.Activity import android.app.Activity
import android.util.Log import android.util.Log
@ -8,13 +8,13 @@ import android.view.ViewGroup
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.obj.PlaylistId
import com.github.libretube.api.obj.StreamItem
import com.github.libretube.databinding.PlaylistRowBinding import com.github.libretube.databinding.PlaylistRowBinding
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.setFormattedDuration import com.github.libretube.extensions.setFormattedDuration
import com.github.libretube.extensions.setWatchProgressLength import com.github.libretube.extensions.setWatchProgressLength
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.obj.PlaylistId
import com.github.libretube.obj.StreamItem
import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.sheets.VideoOptionsBottomSheet
import com.github.libretube.util.ImageHelper import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper import com.github.libretube.util.NavigationHelper
@ -26,7 +26,7 @@ import retrofit2.HttpException
import java.io.IOException import java.io.IOException
class PlaylistAdapter( class PlaylistAdapter(
private val videoFeed: MutableList<StreamItem>, private val videoFeed: MutableList<com.github.libretube.api.obj.StreamItem>,
private val playlistId: String, private val playlistId: String,
private val isOwner: Boolean, private val isOwner: Boolean,
private val activity: Activity, private val activity: Activity,
@ -37,7 +37,7 @@ class PlaylistAdapter(
return videoFeed.size return videoFeed.size
} }
fun updateItems(newItems: List<StreamItem>) { fun updateItems(newItems: List<com.github.libretube.api.obj.StreamItem>) {
val oldSize = videoFeed.size val oldSize = videoFeed.size
videoFeed.addAll(newItems) videoFeed.addAll(newItems)
notifyItemRangeInserted(oldSize, videoFeed.size) notifyItemRangeInserted(oldSize, videoFeed.size)
@ -83,7 +83,10 @@ class PlaylistAdapter(
try { try {
RetrofitInstance.authApi.removeFromPlaylist( RetrofitInstance.authApi.removeFromPlaylist(
PreferenceHelper.getToken(), PreferenceHelper.getToken(),
PlaylistId(playlistId = playlistId, index = position) com.github.libretube.api.obj.PlaylistId(
playlistId = playlistId,
index = position
)
) )
} catch (e: IOException) { } catch (e: IOException) {
println(e) println(e)

View File

@ -1,4 +1,4 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.app.Activity import android.app.Activity
import android.util.Log import android.util.Log
@ -8,10 +8,10 @@ import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.obj.PlaylistId
import com.github.libretube.api.obj.Playlists
import com.github.libretube.databinding.PlaylistsRowBinding import com.github.libretube.databinding.PlaylistsRowBinding
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.obj.PlaylistId
import com.github.libretube.obj.Playlists
import com.github.libretube.sheets.PlaylistOptionsBottomSheet import com.github.libretube.sheets.PlaylistOptionsBottomSheet
import com.github.libretube.util.ImageHelper import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper import com.github.libretube.util.NavigationHelper
@ -24,7 +24,7 @@ import retrofit2.HttpException
import java.io.IOException import java.io.IOException
class PlaylistsAdapter( class PlaylistsAdapter(
private val playlists: MutableList<Playlists>, private val playlists: MutableList<com.github.libretube.api.obj.Playlists>,
private val childFragmentManager: FragmentManager, private val childFragmentManager: FragmentManager,
private val activity: Activity private val activity: Activity
) : RecyclerView.Adapter<PlaylistsViewHolder>() { ) : RecyclerView.Adapter<PlaylistsViewHolder>() {
@ -33,7 +33,7 @@ class PlaylistsAdapter(
return playlists.size return playlists.size
} }
fun updateItems(newItems: List<Playlists>) { fun updateItems(newItems: List<com.github.libretube.api.obj.Playlists>) {
val oldSize = playlists.size val oldSize = playlists.size
playlists.addAll(newItems) playlists.addAll(newItems)
notifyItemRangeInserted(oldSize, playlists.size) notifyItemRangeInserted(oldSize, playlists.size)
@ -90,7 +90,7 @@ class PlaylistsAdapter(
val response = try { val response = try {
RetrofitInstance.authApi.deletePlaylist( RetrofitInstance.authApi.deletePlaylist(
PreferenceHelper.getToken(), PreferenceHelper.getToken(),
PlaylistId(id) com.github.libretube.api.obj.PlaylistId(id)
) )
} catch (e: IOException) { } catch (e: IOException) {
println(e) println(e)

View File

@ -1,17 +1,17 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
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 androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.api.obj.Comment
import com.github.libretube.databinding.RepliesRowBinding import com.github.libretube.databinding.RepliesRowBinding
import com.github.libretube.extensions.formatShort import com.github.libretube.extensions.formatShort
import com.github.libretube.obj.Comment
import com.github.libretube.util.ImageHelper import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper import com.github.libretube.util.NavigationHelper
class RepliesAdapter( class RepliesAdapter(
private val replies: MutableList<Comment> private val replies: MutableList<com.github.libretube.api.obj.Comment>
) : RecyclerView.Adapter<RepliesViewHolder>() { ) : RecyclerView.Adapter<RepliesViewHolder>() {
fun clear() { fun clear() {
@ -20,7 +20,7 @@ class RepliesAdapter(
notifyItemRangeRemoved(0, size) notifyItemRangeRemoved(0, size)
} }
fun updateItems(newItems: List<Comment>) { fun updateItems(newItems: List<com.github.libretube.api.obj.Comment>) {
var repliesSize = replies.size var repliesSize = replies.size
replies.addAll(newItems) replies.addAll(newItems)
notifyItemRangeInserted(repliesSize, newItems.size) notifyItemRangeInserted(repliesSize, newItems.size)

View File

@ -1,4 +1,4 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -7,6 +7,7 @@ import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.api.SubscriptionHelper import com.github.libretube.api.SubscriptionHelper
import com.github.libretube.api.obj.SearchItem
import com.github.libretube.databinding.ChannelRowBinding import com.github.libretube.databinding.ChannelRowBinding
import com.github.libretube.databinding.PlaylistSearchRowBinding import com.github.libretube.databinding.PlaylistSearchRowBinding
import com.github.libretube.databinding.VideoRowBinding import com.github.libretube.databinding.VideoRowBinding
@ -14,7 +15,6 @@ import com.github.libretube.extensions.formatShort
import com.github.libretube.extensions.setFormattedDuration import com.github.libretube.extensions.setFormattedDuration
import com.github.libretube.extensions.setWatchProgressLength import com.github.libretube.extensions.setWatchProgressLength
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.obj.SearchItem
import com.github.libretube.sheets.PlaylistOptionsBottomSheet import com.github.libretube.sheets.PlaylistOptionsBottomSheet
import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.sheets.VideoOptionsBottomSheet
import com.github.libretube.util.ImageHelper import com.github.libretube.util.ImageHelper
@ -24,12 +24,12 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
class SearchAdapter( class SearchAdapter(
private val searchItems: MutableList<SearchItem>, private val searchItems: MutableList<com.github.libretube.api.obj.SearchItem>,
private val childFragmentManager: FragmentManager private val childFragmentManager: FragmentManager
) : ) :
RecyclerView.Adapter<SearchViewHolder>() { RecyclerView.Adapter<SearchViewHolder>() {
fun updateItems(newItems: List<SearchItem>) { fun updateItems(newItems: List<com.github.libretube.api.obj.SearchItem>) {
val searchItemsSize = searchItems.size val searchItemsSize = searchItems.size
searchItems.addAll(newItems) searchItems.addAll(newItems)
notifyItemRangeInserted(searchItemsSize, newItems.size) notifyItemRangeInserted(searchItemsSize, newItems.size)
@ -79,7 +79,7 @@ class SearchAdapter(
} }
} }
private fun bindWatch(item: SearchItem, binding: VideoRowBinding) { private fun bindWatch(item: com.github.libretube.api.obj.SearchItem, binding: VideoRowBinding) {
binding.apply { binding.apply {
ImageHelper.loadImage(item.thumbnail, thumbnail) ImageHelper.loadImage(item.thumbnail, thumbnail)
thumbnailDuration.setFormattedDuration(item.duration!!) thumbnailDuration.setFormattedDuration(item.duration!!)
@ -110,7 +110,7 @@ class SearchAdapter(
} }
} }
private fun bindChannel(item: SearchItem, binding: ChannelRowBinding) { private fun bindChannel(item: com.github.libretube.api.obj.SearchItem, binding: ChannelRowBinding) {
binding.apply { binding.apply {
ImageHelper.loadImage(item.thumbnail, searchChannelImage) ImageHelper.loadImage(item.thumbnail, searchChannelImage)
searchChannelName.text = item.name searchChannelName.text = item.name
@ -157,7 +157,7 @@ class SearchAdapter(
} }
} }
private fun bindPlaylist(item: SearchItem, binding: PlaylistSearchRowBinding) { private fun bindPlaylist(item: com.github.libretube.api.obj.SearchItem, binding: PlaylistSearchRowBinding) {
binding.apply { binding.apply {
ImageHelper.loadImage(item.thumbnail, searchThumbnail) ImageHelper.loadImage(item.thumbnail, searchThumbnail)
if (item.videos?.toInt() != -1) searchPlaylistNumber.text = item.videos.toString() if (item.videos?.toInt() != -1) searchPlaylistNumber.text = item.videos.toString()

View File

@ -1,4 +1,4 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup

View File

@ -1,4 +1,4 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup

View File

@ -1,17 +1,17 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.api.SubscriptionHelper import com.github.libretube.api.SubscriptionHelper
import com.github.libretube.api.obj.Subscription
import com.github.libretube.databinding.ChannelSubscriptionRowBinding import com.github.libretube.databinding.ChannelSubscriptionRowBinding
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.obj.Subscription
import com.github.libretube.util.ImageHelper import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper import com.github.libretube.util.NavigationHelper
class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscription>) : class SubscriptionChannelAdapter(private val subscriptions: MutableList<com.github.libretube.api.obj.Subscription>) :
RecyclerView.Adapter<SubscriptionChannelViewHolder>() { RecyclerView.Adapter<SubscriptionChannelViewHolder>() {
override fun getItemCount(): Int { override fun getItemCount(): Int {

View File

@ -1,22 +1,22 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.text.format.DateUtils import android.text.format.DateUtils
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.api.obj.StreamItem
import com.github.libretube.databinding.TrendingRowBinding import com.github.libretube.databinding.TrendingRowBinding
import com.github.libretube.extensions.formatShort import com.github.libretube.extensions.formatShort
import com.github.libretube.extensions.setFormattedDuration import com.github.libretube.extensions.setFormattedDuration
import com.github.libretube.extensions.setWatchProgressLength import com.github.libretube.extensions.setWatchProgressLength
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.obj.StreamItem
import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.sheets.VideoOptionsBottomSheet
import com.github.libretube.util.ImageHelper import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper import com.github.libretube.util.NavigationHelper
class TrendingAdapter( class TrendingAdapter(
private val streamItems: List<StreamItem>, private val streamItems: List<com.github.libretube.api.obj.StreamItem>,
private val childFragmentManager: FragmentManager, private val childFragmentManager: FragmentManager,
private val showAllAtOne: Boolean = true private val showAllAtOne: Boolean = true
) : RecyclerView.Adapter<SubscriptionViewHolder>() { ) : RecyclerView.Adapter<SubscriptionViewHolder>() {

View File

@ -1,4 +1,4 @@
package com.github.libretube.adapters package com.github.libretube.ui.adapters
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup

View File

@ -1,4 +1,4 @@
package com.github.libretube.dialogs package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.os.Bundle import android.os.Bundle
@ -11,11 +11,11 @@ import androidx.fragment.app.activityViewModels
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.obj.PlaylistId
import com.github.libretube.constants.IntentData import com.github.libretube.constants.IntentData
import com.github.libretube.databinding.DialogAddtoplaylistBinding import com.github.libretube.databinding.DialogAddtoplaylistBinding
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.models.PlaylistViewModel import com.github.libretube.models.PlaylistViewModel
import com.github.libretube.obj.PlaylistId
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.ThemeHelper import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -92,7 +92,10 @@ class AddToPlaylistDialog : DialogFragment() {
fun run() { fun run() {
lifecycleScope.launchWhenCreated { lifecycleScope.launchWhenCreated {
val response = try { val response = try {
RetrofitInstance.authApi.addToPlaylist(token, PlaylistId(playlistId, videoId)) RetrofitInstance.authApi.addToPlaylist(
token,
com.github.libretube.api.obj.PlaylistId(playlistId, videoId)
)
} catch (e: IOException) { } catch (e: IOException) {
println(e) println(e)
Log.e(TAG(), "IOException, you might not have internet connection") Log.e(TAG(), "IOException, you might not have internet connection")

View File

@ -1,15 +1,15 @@
package com.github.libretube.dialogs package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.os.Bundle import android.os.Bundle
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.adapters.BackupOptionsAdapter
import com.github.libretube.databinding.DialogBackupBinding import com.github.libretube.databinding.DialogBackupBinding
import com.github.libretube.db.DatabaseHolder.Companion.Database import com.github.libretube.db.DatabaseHolder.Companion.Database
import com.github.libretube.extensions.await import com.github.libretube.extensions.await
import com.github.libretube.obj.BackupFile import com.github.libretube.obj.BackupFile
import com.github.libretube.ui.adapters.BackupOptionsAdapter
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
class BackupDialog( class BackupDialog(

View File

@ -1,4 +1,4 @@
package com.github.libretube.dialogs package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.os.Bundle import android.os.Bundle
@ -8,10 +8,10 @@ import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.obj.Playlists
import com.github.libretube.databinding.DialogCreatePlaylistBinding import com.github.libretube.databinding.DialogCreatePlaylistBinding
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.fragments.LibraryFragment import com.github.libretube.ui.fragments.LibraryFragment
import com.github.libretube.obj.Playlists
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.ThemeHelper import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -52,7 +52,10 @@ class CreatePlaylistDialog : DialogFragment() {
private fun createPlaylist(name: String) { private fun createPlaylist(name: String) {
lifecycleScope.launchWhenCreated { lifecycleScope.launchWhenCreated {
val response = try { val response = try {
RetrofitInstance.authApi.createPlaylist(token, Playlists(name = name)) RetrofitInstance.authApi.createPlaylist(
token,
com.github.libretube.api.obj.Playlists(name = name)
)
} catch (e: IOException) { } catch (e: IOException) {
println(e) println(e)
Log.e(TAG(), "IOException, you might not have internet connection") Log.e(TAG(), "IOException, you might not have internet connection")

View File

@ -1,4 +1,4 @@
package com.github.libretube.dialogs package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.os.Bundle import android.os.Bundle

View File

@ -1,4 +1,4 @@
package com.github.libretube.dialogs package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.os.Bundle import android.os.Bundle
@ -8,9 +8,9 @@ import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.obj.DeleteUserRequest
import com.github.libretube.databinding.DialogDeleteAccountBinding import com.github.libretube.databinding.DialogDeleteAccountBinding
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.obj.DeleteUserRequest
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.ThemeHelper import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -45,7 +45,10 @@ class DeleteAccountDialog : DialogFragment() {
val token = PreferenceHelper.getToken() val token = PreferenceHelper.getToken()
try { try {
RetrofitInstance.authApi.deleteAccount(token, DeleteUserRequest(password)) RetrofitInstance.authApi.deleteAccount(
token,
com.github.libretube.api.obj.DeleteUserRequest(password)
)
} catch (e: Exception) { } catch (e: Exception) {
Log.e(TAG(), e.toString()) Log.e(TAG(), e.toString())
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show() Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()

View File

@ -1,4 +1,4 @@
package com.github.libretube.dialogs package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.content.Intent import android.content.Intent
@ -12,9 +12,9 @@ import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.obj.Streams
import com.github.libretube.databinding.DialogDownloadBinding import com.github.libretube.databinding.DialogDownloadBinding
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.obj.Streams
import com.github.libretube.services.DownloadService import com.github.libretube.services.DownloadService
import com.github.libretube.util.ThemeHelper import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -66,7 +66,7 @@ class DownloadDialog(
} }
} }
private fun initDownloadOptions(streams: Streams) { private fun initDownloadOptions(streams: com.github.libretube.api.obj.Streams) {
val vidName = arrayListOf<String>() val vidName = arrayListOf<String>()
val videoUrl = arrayListOf<String>() val videoUrl = arrayListOf<String>()

View File

@ -1,4 +1,4 @@
package com.github.libretube.dialogs package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.content.ClipData import android.content.ClipData

View File

@ -1,4 +1,4 @@
package com.github.libretube.dialogs package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.os.Bundle import android.os.Bundle
@ -8,9 +8,9 @@ import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.obj.Login
import com.github.libretube.databinding.DialogLoginBinding import com.github.libretube.databinding.DialogLoginBinding
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.obj.Login
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.ThemeHelper import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -26,7 +26,10 @@ class LoginDialog : DialogFragment() {
binding.login.setOnClickListener { binding.login.setOnClickListener {
if (binding.username.text.toString() != "" && binding.password.text.toString() != "") { if (binding.username.text.toString() != "" && binding.password.text.toString() != "") {
val login = val login =
Login(binding.username.text.toString(), binding.password.text.toString()) com.github.libretube.api.obj.Login(
binding.username.text.toString(),
binding.password.text.toString()
)
login(login) login(login)
} else { } else {
Toast.makeText(context, R.string.empty, Toast.LENGTH_SHORT).show() Toast.makeText(context, R.string.empty, Toast.LENGTH_SHORT).show()
@ -37,7 +40,7 @@ class LoginDialog : DialogFragment() {
binding.username.text.toString() != "" && binding.username.text.toString() != "" &&
binding.password.text.toString() != "" binding.password.text.toString() != ""
) { ) {
val login = Login( val login = com.github.libretube.api.obj.Login(
binding.username.text.toString(), binding.username.text.toString(),
binding.password.text.toString() binding.password.text.toString()
) )
@ -54,7 +57,7 @@ class LoginDialog : DialogFragment() {
.show() .show()
} }
private fun login(login: Login) { private fun login(login: com.github.libretube.api.obj.Login) {
lifecycleScope.launchWhenCreated { lifecycleScope.launchWhenCreated {
val response = try { val response = try {
RetrofitInstance.authApi.login(login) RetrofitInstance.authApi.login(login)
@ -83,7 +86,7 @@ class LoginDialog : DialogFragment() {
} }
} }
private fun register(login: Login) { private fun register(login: com.github.libretube.api.obj.Login) {
fun run() { fun run() {
lifecycleScope.launchWhenCreated { lifecycleScope.launchWhenCreated {
val response = try { val response = try {

View File

@ -1,4 +1,4 @@
package com.github.libretube.dialogs package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.os.Bundle import android.os.Bundle

View File

@ -1,4 +1,4 @@
package com.github.libretube.dialogs package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.os.Bundle import android.os.Bundle
@ -7,8 +7,8 @@ import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.adapters.NavBarOptionsAdapter
import com.github.libretube.databinding.DialogNavbarOptionsBinding import com.github.libretube.databinding.DialogNavbarOptionsBinding
import com.github.libretube.ui.adapters.NavBarOptionsAdapter
import com.github.libretube.util.NavBarHelper import com.github.libretube.util.NavBarHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder

View File

@ -1,4 +1,4 @@
package com.github.libretube.dialogs package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.os.Bundle import android.os.Bundle

View File

@ -1,4 +1,4 @@
package com.github.libretube.dialogs package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.content.Intent import android.content.Intent

View File

@ -1,4 +1,4 @@
package com.github.libretube.dialogs package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.content.Intent import android.content.Intent
@ -8,8 +8,8 @@ import android.os.Bundle
import android.util.Log import android.util.Log
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.obj.update.UpdateInfo
import com.github.libretube.services.UpdateService import com.github.libretube.services.UpdateService
import com.github.libretube.update.UpdateInfo
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
class UpdateDialog( class UpdateDialog(

View File

@ -1,4 +1,4 @@
package com.github.libretube.fragments package com.github.libretube.ui.fragments
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
@ -8,7 +8,6 @@ import android.view.ViewGroup
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.adapters.ChannelAdapter
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.SubscriptionHelper import com.github.libretube.api.SubscriptionHelper
import com.github.libretube.constants.IntentData import com.github.libretube.constants.IntentData
@ -17,6 +16,7 @@ import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.formatShort import com.github.libretube.extensions.formatShort
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.ui.adapters.ChannelAdapter
import com.github.libretube.util.ImageHelper import com.github.libretube.util.ImageHelper
import retrofit2.HttpException import retrofit2.HttpException
import java.io.IOException import java.io.IOException

View File

@ -1,4 +1,4 @@
package com.github.libretube.fragments package com.github.libretube.ui.fragments
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
@ -7,9 +7,9 @@ import android.view.ViewGroup
import androidx.core.view.size import androidx.core.view.size
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.adapters.DownloadsAdapter
import com.github.libretube.databinding.FragmentDownloadsBinding import com.github.libretube.databinding.FragmentDownloadsBinding
import com.github.libretube.extensions.BaseFragment import com.github.libretube.extensions.BaseFragment
import com.github.libretube.ui.adapters.DownloadsAdapter
import com.github.libretube.util.DownloadHelper import com.github.libretube.util.DownloadHelper
class DownloadsFragment : BaseFragment() { class DownloadsFragment : BaseFragment() {

View File

@ -1,4 +1,4 @@
package com.github.libretube.fragments package com.github.libretube.ui.fragments
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
@ -10,13 +10,13 @@ import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.adapters.ChannelAdapter
import com.github.libretube.adapters.TrendingAdapter
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.databinding.FragmentHomeBinding import com.github.libretube.databinding.FragmentHomeBinding
import com.github.libretube.extensions.BaseFragment import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.ui.adapters.ChannelAdapter
import com.github.libretube.ui.adapters.TrendingAdapter
import com.github.libretube.util.LocaleHelper import com.github.libretube.util.LocaleHelper
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import retrofit2.HttpException import retrofit2.HttpException

View File

@ -1,4 +1,4 @@
package com.github.libretube.fragments package com.github.libretube.ui.fragments
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
@ -12,14 +12,14 @@ import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.adapters.PlaylistsAdapter
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.databinding.FragmentLibraryBinding import com.github.libretube.databinding.FragmentLibraryBinding
import com.github.libretube.dialogs.CreatePlaylistDialog
import com.github.libretube.extensions.BaseFragment import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.models.PlayerViewModel import com.github.libretube.models.PlayerViewModel
import com.github.libretube.ui.adapters.PlaylistsAdapter
import com.github.libretube.ui.dialogs.CreatePlaylistDialog
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import retrofit2.HttpException import retrofit2.HttpException
import java.io.IOException import java.io.IOException

View File

@ -1,4 +1,4 @@
package com.github.libretube.fragments package com.github.libretube.ui.fragments
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.ActivityManager import android.app.ActivityManager
@ -36,10 +36,6 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.ObjectMapper
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.MainActivity
import com.github.libretube.adapters.ChaptersAdapter
import com.github.libretube.adapters.CommentsAdapter
import com.github.libretube.adapters.TrendingAdapter
import com.github.libretube.api.CronetHelper import com.github.libretube.api.CronetHelper
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.SubscriptionHelper import com.github.libretube.api.SubscriptionHelper
@ -50,9 +46,6 @@ import com.github.libretube.databinding.ExoStyledPlayerControlViewBinding
import com.github.libretube.databinding.FragmentPlayerBinding import com.github.libretube.databinding.FragmentPlayerBinding
import com.github.libretube.db.DatabaseHelper import com.github.libretube.db.DatabaseHelper
import com.github.libretube.db.DatabaseHolder.Companion.Database import com.github.libretube.db.DatabaseHolder.Companion.Database
import com.github.libretube.dialogs.AddToPlaylistDialog
import com.github.libretube.dialogs.DownloadDialog
import com.github.libretube.dialogs.ShareDialog
import com.github.libretube.extensions.BaseFragment import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.await import com.github.libretube.extensions.await
@ -61,12 +54,15 @@ import com.github.libretube.extensions.hideKeyboard
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.interfaces.PlayerOptionsInterface import com.github.libretube.interfaces.PlayerOptionsInterface
import com.github.libretube.models.PlayerViewModel import com.github.libretube.models.PlayerViewModel
import com.github.libretube.obj.ChapterSegment
import com.github.libretube.obj.Segment
import com.github.libretube.obj.Segments
import com.github.libretube.obj.Streams
import com.github.libretube.services.BackgroundMode import com.github.libretube.services.BackgroundMode
import com.github.libretube.services.DownloadService import com.github.libretube.services.DownloadService
import com.github.libretube.ui.activities.MainActivity
import com.github.libretube.ui.adapters.ChaptersAdapter
import com.github.libretube.ui.adapters.CommentsAdapter
import com.github.libretube.ui.adapters.TrendingAdapter
import com.github.libretube.ui.dialogs.AddToPlaylistDialog
import com.github.libretube.ui.dialogs.DownloadDialog
import com.github.libretube.ui.dialogs.ShareDialog
import com.github.libretube.util.AutoPlayHelper import com.github.libretube.util.AutoPlayHelper
import com.github.libretube.util.BackgroundHelper import com.github.libretube.util.BackgroundHelper
import com.github.libretube.util.ImageHelper import com.github.libretube.util.ImageHelper
@ -119,7 +115,7 @@ class PlayerFragment : BaseFragment() {
private var playlistId: String? = null private var playlistId: String? = null
private var isSubscribed: Boolean? = false private var isSubscribed: Boolean? = false
private var isLive = false private var isLive = false
private lateinit var streams: Streams private lateinit var streams: com.github.libretube.api.obj.Streams
/** /**
* for the transition * for the transition
@ -141,8 +137,8 @@ class PlayerFragment : BaseFragment() {
*/ */
private lateinit var exoPlayer: ExoPlayer private lateinit var exoPlayer: ExoPlayer
private lateinit var trackSelector: DefaultTrackSelector private lateinit var trackSelector: DefaultTrackSelector
private lateinit var segmentData: Segments private lateinit var segmentData: com.github.libretube.api.obj.Segments
private lateinit var chapters: List<ChapterSegment> private lateinit var chapters: List<com.github.libretube.api.obj.ChapterSegment>
/** /**
* for the player view * for the player view
@ -724,7 +720,7 @@ class PlayerFragment : BaseFragment() {
if (!::segmentData.isInitialized || segmentData.segments.isEmpty()) return if (!::segmentData.isInitialized || segmentData.segments.isEmpty()) return
val currentPosition = exoPlayer.currentPosition val currentPosition = exoPlayer.currentPosition
segmentData.segments.forEach { segment: Segment -> segmentData.segments.forEach { segment: com.github.libretube.api.obj.Segment ->
val segmentStart = (segment.segment!![0] * 1000f).toLong() val segmentStart = (segment.segment!![0] * 1000f).toLong()
val segmentEnd = (segment.segment[1] * 1000f).toLong() val segmentEnd = (segment.segment[1] * 1000f).toLong()
@ -922,7 +918,7 @@ class PlayerFragment : BaseFragment() {
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
private fun initializePlayerView(response: Streams) { private fun initializePlayerView(response: com.github.libretube.api.obj.Streams) {
// initialize the player view actions // initialize the player view actions
binding.player.initialize( binding.player.initialize(
childFragmentManager, childFragmentManager,
@ -1288,7 +1284,7 @@ class PlayerFragment : BaseFragment() {
} }
private fun setStreamSource( private fun setStreamSource(
streams: Streams, streams: com.github.libretube.api.obj.Streams,
videosNameArray: Array<String>, videosNameArray: Array<String>,
videosUrlArray: Array<Uri> videosUrlArray: Array<Uri>
) { ) {

View File

@ -1,4 +1,4 @@
package com.github.libretube.fragments package com.github.libretube.ui.fragments
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
@ -10,7 +10,6 @@ import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.adapters.PlaylistAdapter
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.constants.IntentData import com.github.libretube.constants.IntentData
import com.github.libretube.databinding.FragmentPlaylistBinding import com.github.libretube.databinding.FragmentPlaylistBinding
@ -18,6 +17,7 @@ import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.sheets.PlaylistOptionsBottomSheet import com.github.libretube.sheets.PlaylistOptionsBottomSheet
import com.github.libretube.ui.adapters.PlaylistAdapter
import retrofit2.HttpException import retrofit2.HttpException
import java.io.IOException import java.io.IOException

View File

@ -1,4 +1,4 @@
package com.github.libretube.fragments package com.github.libretube.ui.fragments
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
@ -10,9 +10,6 @@ import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.MainActivity
import com.github.libretube.adapters.SearchHistoryAdapter
import com.github.libretube.adapters.SearchSuggestionsAdapter
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.FragmentSearchBinding import com.github.libretube.databinding.FragmentSearchBinding
import com.github.libretube.db.DatabaseHolder.Companion.Database import com.github.libretube.db.DatabaseHolder.Companion.Database
@ -20,6 +17,9 @@ import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.await import com.github.libretube.extensions.await
import com.github.libretube.models.SearchViewModel import com.github.libretube.models.SearchViewModel
import com.github.libretube.ui.activities.MainActivity
import com.github.libretube.ui.adapters.SearchHistoryAdapter
import com.github.libretube.ui.adapters.SearchSuggestionsAdapter
import retrofit2.HttpException import retrofit2.HttpException
import java.io.IOException import java.io.IOException

View File

@ -1,4 +1,4 @@
package com.github.libretube.fragments package com.github.libretube.ui.fragments
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
@ -9,8 +9,6 @@ import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.MainActivity
import com.github.libretube.adapters.SearchAdapter
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.databinding.FragmentSearchResultBinding import com.github.libretube.databinding.FragmentSearchResultBinding
@ -19,6 +17,8 @@ import com.github.libretube.db.obj.SearchHistoryItem
import com.github.libretube.extensions.BaseFragment import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.hideKeyboard import com.github.libretube.extensions.hideKeyboard
import com.github.libretube.ui.activities.MainActivity
import com.github.libretube.ui.adapters.SearchAdapter
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import retrofit2.HttpException import retrofit2.HttpException
import java.io.IOException import java.io.IOException

View File

@ -1,4 +1,4 @@
package com.github.libretube.fragments package com.github.libretube.ui.fragments
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
@ -10,15 +10,15 @@ import androidx.fragment.app.activityViewModels
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.adapters.LegacySubscriptionAdapter
import com.github.libretube.adapters.SubscriptionChannelAdapter
import com.github.libretube.adapters.TrendingAdapter
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.databinding.FragmentSubscriptionsBinding import com.github.libretube.databinding.FragmentSubscriptionsBinding
import com.github.libretube.extensions.BaseFragment import com.github.libretube.extensions.BaseFragment
import com.github.libretube.models.SubscriptionsViewModel import com.github.libretube.models.SubscriptionsViewModel
import com.github.libretube.ui.adapters.LegacySubscriptionAdapter
import com.github.libretube.ui.adapters.SubscriptionChannelAdapter
import com.github.libretube.ui.adapters.TrendingAdapter
import com.github.libretube.ui.views.BottomSheet
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import com.github.libretube.views.BottomSheet
class SubscriptionsFragment : BaseFragment() { class SubscriptionsFragment : BaseFragment() {
private lateinit var binding: FragmentSubscriptionsBinding private lateinit var binding: FragmentSubscriptionsBinding

View File

@ -1,4 +1,4 @@
package com.github.libretube.fragments package com.github.libretube.ui.fragments
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
@ -7,12 +7,12 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.adapters.WatchHistoryAdapter
import com.github.libretube.databinding.FragmentWatchHistoryBinding import com.github.libretube.databinding.FragmentWatchHistoryBinding
import com.github.libretube.db.DatabaseHolder.Companion.Database import com.github.libretube.db.DatabaseHolder.Companion.Database
import com.github.libretube.db.obj.WatchHistoryItem import com.github.libretube.db.obj.WatchHistoryItem
import com.github.libretube.extensions.BaseFragment import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.await import com.github.libretube.extensions.await
import com.github.libretube.ui.adapters.WatchHistoryAdapter
class WatchHistoryFragment : BaseFragment() { class WatchHistoryFragment : BaseFragment() {
private lateinit var binding: FragmentWatchHistoryBinding private lateinit var binding: FragmentWatchHistoryBinding

View File

@ -1,4 +1,4 @@
package com.github.libretube.preferences package com.github.libretube.ui.preferences
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
@ -8,14 +8,14 @@ import androidx.activity.result.contract.ActivityResultContracts.CreateDocument
import androidx.preference.ListPreference import androidx.preference.ListPreference
import androidx.preference.Preference import androidx.preference.Preference
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.dialogs.BackupDialog
import com.github.libretube.obj.BackupFile import com.github.libretube.obj.BackupFile
import com.github.libretube.ui.activities.SettingsActivity
import com.github.libretube.ui.dialogs.BackupDialog
import com.github.libretube.ui.views.MaterialPreferenceFragment
import com.github.libretube.util.BackupHelper import com.github.libretube.util.BackupHelper
import com.github.libretube.util.ImageHelper import com.github.libretube.util.ImageHelper
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import com.github.libretube.views.MaterialPreferenceFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
class AdvancedSettings : MaterialPreferenceFragment() { class AdvancedSettings : MaterialPreferenceFragment() {

View File

@ -1,4 +1,4 @@
package com.github.libretube.preferences package com.github.libretube.ui.preferences
import android.content.ActivityNotFoundException import android.content.ActivityNotFoundException
import android.content.Intent import android.content.Intent
@ -9,12 +9,12 @@ import androidx.preference.ListPreference
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.SwitchPreferenceCompat import androidx.preference.SwitchPreferenceCompat
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.dialogs.RequireRestartDialog import com.github.libretube.ui.activities.SettingsActivity
import com.github.libretube.ui.dialogs.RequireRestartDialog
import com.github.libretube.ui.views.MaterialPreferenceFragment
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.ThemeHelper import com.github.libretube.util.ThemeHelper
import com.github.libretube.views.MaterialPreferenceFragment
import com.google.android.material.color.DynamicColors import com.google.android.material.color.DynamicColors
class AppearanceSettings : MaterialPreferenceFragment() { class AppearanceSettings : MaterialPreferenceFragment() {

View File

@ -1,9 +1,9 @@
package com.github.libretube.preferences package com.github.libretube.ui.preferences
import android.os.Bundle import android.os.Bundle
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity import com.github.libretube.ui.activities.SettingsActivity
import com.github.libretube.views.MaterialPreferenceFragment import com.github.libretube.ui.views.MaterialPreferenceFragment
class AudioVideoSettings : MaterialPreferenceFragment() { class AudioVideoSettings : MaterialPreferenceFragment() {

View File

@ -1,4 +1,4 @@
package com.github.libretube.preferences package com.github.libretube.ui.preferences
import android.os.Bundle import android.os.Bundle
import androidx.preference.EditTextPreference import androidx.preference.EditTextPreference
@ -6,12 +6,12 @@ import androidx.preference.ListPreference
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.SwitchPreferenceCompat import androidx.preference.SwitchPreferenceCompat
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.dialogs.NavBarOptionsDialog import com.github.libretube.ui.activities.SettingsActivity
import com.github.libretube.dialogs.RequireRestartDialog import com.github.libretube.ui.dialogs.NavBarOptionsDialog
import com.github.libretube.ui.dialogs.RequireRestartDialog
import com.github.libretube.ui.views.MaterialPreferenceFragment
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import com.github.libretube.views.MaterialPreferenceFragment
class GeneralSettings : MaterialPreferenceFragment() { class GeneralSettings : MaterialPreferenceFragment() {

View File

@ -1,12 +1,12 @@
package com.github.libretube.preferences package com.github.libretube.ui.preferences
import android.os.Bundle import android.os.Bundle
import androidx.preference.Preference import androidx.preference.Preference
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.db.DatabaseHolder.Companion.Database import com.github.libretube.db.DatabaseHolder.Companion.Database
import com.github.libretube.views.MaterialPreferenceFragment import com.github.libretube.ui.activities.SettingsActivity
import com.github.libretube.ui.views.MaterialPreferenceFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
class HistorySettings : MaterialPreferenceFragment() { class HistorySettings : MaterialPreferenceFragment() {

View File

@ -1,4 +1,4 @@
package com.github.libretube.preferences package com.github.libretube.ui.preferences
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
@ -12,19 +12,19 @@ import androidx.preference.ListPreference
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.SwitchPreferenceCompat import androidx.preference.SwitchPreferenceCompat
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.db.DatabaseHolder.Companion.Database import com.github.libretube.db.DatabaseHolder.Companion.Database
import com.github.libretube.db.obj.CustomInstance import com.github.libretube.db.obj.CustomInstance
import com.github.libretube.dialogs.CustomInstanceDialog
import com.github.libretube.dialogs.DeleteAccountDialog
import com.github.libretube.dialogs.LoginDialog
import com.github.libretube.dialogs.LogoutDialog
import com.github.libretube.extensions.await import com.github.libretube.extensions.await
import com.github.libretube.ui.activities.SettingsActivity
import com.github.libretube.ui.dialogs.CustomInstanceDialog
import com.github.libretube.ui.dialogs.DeleteAccountDialog
import com.github.libretube.ui.dialogs.LoginDialog
import com.github.libretube.ui.dialogs.LogoutDialog
import com.github.libretube.ui.views.MaterialPreferenceFragment
import com.github.libretube.util.ImportHelper import com.github.libretube.util.ImportHelper
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import com.github.libretube.views.MaterialPreferenceFragment
class InstanceSettings : MaterialPreferenceFragment() { class InstanceSettings : MaterialPreferenceFragment() {

View File

@ -1,16 +1,16 @@
package com.github.libretube.preferences package com.github.libretube.ui.preferences
import android.os.Bundle import android.os.Bundle
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.preference.Preference import androidx.preference.Preference
import com.github.libretube.BuildConfig import com.github.libretube.BuildConfig
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.dialogs.UpdateDialog
import com.github.libretube.extensions.getStyledSnackBar import com.github.libretube.extensions.getStyledSnackBar
import com.github.libretube.ui.activities.SettingsActivity
import com.github.libretube.ui.dialogs.UpdateDialog
import com.github.libretube.ui.views.MaterialPreferenceFragment
import com.github.libretube.util.NetworkHelper import com.github.libretube.util.NetworkHelper
import com.github.libretube.views.MaterialPreferenceFragment
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch

View File

@ -1,14 +1,14 @@
package com.github.libretube.preferences package com.github.libretube.ui.preferences
import android.os.Bundle import android.os.Bundle
import androidx.preference.ListPreference import androidx.preference.ListPreference
import androidx.preference.SwitchPreferenceCompat import androidx.preference.SwitchPreferenceCompat
import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.ExistingPeriodicWorkPolicy
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.ui.activities.SettingsActivity
import com.github.libretube.ui.views.MaterialPreferenceFragment
import com.github.libretube.util.NotificationHelper import com.github.libretube.util.NotificationHelper
import com.github.libretube.views.MaterialPreferenceFragment
class NotificationSettings : MaterialPreferenceFragment() { class NotificationSettings : MaterialPreferenceFragment() {

View File

@ -1,14 +1,14 @@
package com.github.libretube.preferences package com.github.libretube.ui.preferences
import android.os.Bundle import android.os.Bundle
import androidx.preference.ListPreference import androidx.preference.ListPreference
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.SwitchPreferenceCompat import androidx.preference.SwitchPreferenceCompat
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.ui.activities.SettingsActivity
import com.github.libretube.ui.views.MaterialPreferenceFragment
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import com.github.libretube.views.MaterialPreferenceFragment
import java.util.* import java.util.*
class PlayerSettings : MaterialPreferenceFragment() { class PlayerSettings : MaterialPreferenceFragment() {

View File

@ -1,9 +1,9 @@
package com.github.libretube.preferences package com.github.libretube.ui.preferences
import android.os.Bundle import android.os.Bundle
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity import com.github.libretube.ui.activities.SettingsActivity
import com.github.libretube.views.MaterialPreferenceFragment import com.github.libretube.ui.views.MaterialPreferenceFragment
class SponsorBlockSettings : MaterialPreferenceFragment() { class SponsorBlockSettings : MaterialPreferenceFragment() {

View File

@ -1,13 +1,13 @@
package com.github.libretube.views package com.github.libretube.ui.views
import android.os.Bundle import android.os.Bundle
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 androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.adapters.BottomSheetAdapter
import com.github.libretube.databinding.BottomSheetBinding import com.github.libretube.databinding.BottomSheetBinding
import com.github.libretube.obj.BottomSheetItem import com.github.libretube.obj.BottomSheetItem
import com.github.libretube.ui.adapters.BottomSheetAdapter
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
open class BottomSheet : BottomSheetDialogFragment() { open class BottomSheet : BottomSheetDialogFragment() {

View File

@ -1,4 +1,4 @@
package com.github.libretube.views package com.github.libretube.ui.views
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
@ -10,7 +10,6 @@ import android.view.MotionEvent
import android.view.View import android.view.View
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.MainActivity
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.constants.PreferenceRanges import com.github.libretube.constants.PreferenceRanges
import com.github.libretube.databinding.DialogSliderBinding import com.github.libretube.databinding.DialogSliderBinding
@ -20,6 +19,7 @@ import com.github.libretube.extensions.setSliderRangeAndValue
import com.github.libretube.interfaces.DoubleTapInterface import com.github.libretube.interfaces.DoubleTapInterface
import com.github.libretube.interfaces.PlayerOptionsInterface import com.github.libretube.interfaces.PlayerOptionsInterface
import com.github.libretube.obj.BottomSheetItem import com.github.libretube.obj.BottomSheetItem
import com.github.libretube.ui.activities.MainActivity
import com.github.libretube.util.DoubleTapListener import com.github.libretube.util.DoubleTapListener
import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.PreferenceHelper
import com.google.android.exoplayer2.trackselection.TrackSelector import com.google.android.exoplayer2.trackselection.TrackSelector

View File

@ -1,4 +1,4 @@
package com.github.libretube.views package com.github.libretube.ui.views
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet

View File

@ -1,4 +1,4 @@
package com.github.libretube.views package com.github.libretube.ui.views
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet

Some files were not shown because too many files have changed in this diff Show More