diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index b7d85991e..c035dfb82 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -24,7 +24,7 @@
-keep class com.github.libretube.obj.** { *; }
# prevents android from removing it
--keep class com.github.libretube.update.** { *; }
+-keep class com.github.libretube.obj.**.** { *; }
# prevents obfuscation in debug logs
-dontobfuscate
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4491ea9e2..e77abb8c6 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -22,27 +22,27 @@
tools:targetApi="n">
@@ -84,7 +84,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_fire_round"
android:supportsPictureInPicture="true"
- android:targetActivity=".activities.MainActivity"
+ android:targetActivity=".ui.activities.MainActivity"
android:windowSoftInputMode="adjustPan">
@@ -102,7 +102,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_flame_round"
android:supportsPictureInPicture="true"
- android:targetActivity=".activities.MainActivity"
+ android:targetActivity=".ui.activities.MainActivity"
android:windowSoftInputMode="adjustPan">
@@ -120,7 +120,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_shaped_round"
android:supportsPictureInPicture="true"
- android:targetActivity=".activities.MainActivity"
+ android:targetActivity=".ui.activities.MainActivity"
android:windowSoftInputMode="adjustPan">
@@ -138,7 +138,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_torch_round"
android:supportsPictureInPicture="true"
- android:targetActivity=".activities.MainActivity"
+ android:targetActivity=".ui.activities.MainActivity"
android:windowSoftInputMode="adjustPan">
@@ -156,7 +156,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_legacy_round"
android:supportsPictureInPicture="true"
- android:targetActivity=".activities.MainActivity"
+ android:targetActivity=".ui.activities.MainActivity"
android:windowSoftInputMode="adjustPan">
@@ -174,7 +174,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_bird_round"
android:supportsPictureInPicture="true"
- android:targetActivity=".activities.MainActivity"
+ android:targetActivity=".ui.activities.MainActivity"
android:windowSoftInputMode="adjustPan">
@@ -183,7 +183,7 @@
diff --git a/app/src/main/java/com/github/libretube/api/ExternalApi.kt b/app/src/main/java/com/github/libretube/api/ExternalApi.kt
index 9daf29192..ab9c8d3eb 100644
--- a/app/src/main/java/com/github/libretube/api/ExternalApi.kt
+++ b/app/src/main/java/com/github/libretube/api/ExternalApi.kt
@@ -1,15 +1,15 @@
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.PIPED_INSTANCES_URL
-import com.github.libretube.obj.Instances
-import com.github.libretube.update.UpdateInfo
+import com.github.libretube.obj.update.UpdateInfo
import retrofit2.http.GET
interface ExternalApi {
// only for fetching servers list
@GET(PIPED_INSTANCES_URL)
- suspend fun getInstances(): List
+ suspend fun getInstances(): List
// fetch latest version info
@GET(GITHUB_API_URL)
diff --git a/app/src/main/java/com/github/libretube/api/PipedApi.kt b/app/src/main/java/com/github/libretube/api/PipedApi.kt
index 1139da77c..1dd62eb3c 100644
--- a/app/src/main/java/com/github/libretube/api/PipedApi.kt
+++ b/app/src/main/java/com/github/libretube/api/PipedApi.kt
@@ -1,21 +1,21 @@
package com.github.libretube.api
-import com.github.libretube.obj.Channel
-import com.github.libretube.obj.CommentsPage
-import com.github.libretube.obj.DeleteUserRequest
-import com.github.libretube.obj.Login
-import com.github.libretube.obj.Message
-import com.github.libretube.obj.Playlist
-import com.github.libretube.obj.PlaylistId
-import com.github.libretube.obj.Playlists
-import com.github.libretube.obj.SearchResult
-import com.github.libretube.obj.Segments
-import com.github.libretube.obj.StreamItem
-import com.github.libretube.obj.Streams
-import com.github.libretube.obj.Subscribe
-import com.github.libretube.obj.Subscribed
-import com.github.libretube.obj.Subscription
-import com.github.libretube.obj.Token
+import com.github.libretube.api.obj.Channel
+import com.github.libretube.api.obj.CommentsPage
+import com.github.libretube.api.obj.DeleteUserRequest
+import com.github.libretube.api.obj.Login
+import com.github.libretube.api.obj.Message
+import com.github.libretube.api.obj.Playlist
+import com.github.libretube.api.obj.PlaylistId
+import com.github.libretube.api.obj.Playlists
+import com.github.libretube.api.obj.SearchResult
+import com.github.libretube.api.obj.Segments
+import com.github.libretube.api.obj.StreamItem
+import com.github.libretube.api.obj.Streams
+import com.github.libretube.api.obj.Subscribe
+import com.github.libretube.api.obj.Subscribed
+import com.github.libretube.api.obj.Subscription
+import com.github.libretube.api.obj.Token
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
@@ -25,148 +25,148 @@ import retrofit2.http.Query
interface PipedApi {
@GET("trending")
- suspend fun getTrending(@Query("region") region: String): List
+ suspend fun getTrending(@Query("region") region: String): List
@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}")
- suspend fun getComments(@Path("videoId") videoId: String): CommentsPage
+ suspend fun getComments(@Path("videoId") videoId: String): com.github.libretube.api.obj.CommentsPage
@GET("sponsors/{videoId}")
suspend fun getSegments(
@Path("videoId") videoId: String,
@Query("category") category: String
- ): Segments
+ ): com.github.libretube.api.obj.Segments
@GET("nextpage/comments/{videoId}")
suspend fun getCommentsNextPage(
@Path("videoId") videoId: String,
@Query("nextpage") nextPage: String
- ): CommentsPage
+ ): com.github.libretube.api.obj.CommentsPage
@GET("search")
suspend fun getSearchResults(
@Query("q") searchQuery: String,
@Query("filter") filter: String
- ): SearchResult
+ ): com.github.libretube.api.obj.SearchResult
@GET("nextpage/search")
suspend fun getSearchResultsNextPage(
@Query("q") searchQuery: String,
@Query("filter") filter: String,
@Query("nextpage") nextPage: String
- ): SearchResult
+ ): com.github.libretube.api.obj.SearchResult
@GET("suggestions")
suspend fun getSuggestions(@Query("query") query: String): List
@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}")
- 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}")
suspend fun getChannelNextPage(
@Path("channelId") channelId: String,
@Query("nextpage") nextPage: String
- ): Channel
+ ): com.github.libretube.api.obj.Channel
@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}")
suspend fun getPlaylistNextPage(
@Path("playlistId") playlistId: String,
@Query("nextpage") nextPage: String
- ): Playlist
+ ): com.github.libretube.api.obj.Playlist
@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")
- 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")
suspend fun deleteAccount(
@Header("Authorization") token: String,
- @Body password: DeleteUserRequest
+ @Body password: com.github.libretube.api.obj.DeleteUserRequest
)
@GET("feed")
- suspend fun getFeed(@Query("authToken") token: String?): List
+ suspend fun getFeed(@Query("authToken") token: String?): List
@GET("feed/unauthenticated")
- suspend fun getUnauthenticatedFeed(@Query("channels") channels: String): List
+ suspend fun getUnauthenticatedFeed(@Query("channels") channels: String): List
@GET("subscribed")
suspend fun isSubscribed(
@Query("channelId") channelId: String,
@Header("Authorization") token: String
- ): Subscribed
+ ): com.github.libretube.api.obj.Subscribed
@GET("subscriptions")
- suspend fun subscriptions(@Header("Authorization") token: String): List
+ suspend fun subscriptions(@Header("Authorization") token: String): List
@GET("subscriptions/unauthenticated")
- suspend fun unauthenticatedSubscriptions(@Query("channels") channels: String): List
+ suspend fun unauthenticatedSubscriptions(@Query("channels") channels: String): List
@POST("subscribe")
suspend fun subscribe(
@Header("Authorization") token: String,
- @Body subscribe: Subscribe
- ): Message
+ @Body subscribe: com.github.libretube.api.obj.Subscribe
+ ): com.github.libretube.api.obj.Message
@POST("unsubscribe")
suspend fun unsubscribe(
@Header("Authorization") token: String,
- @Body subscribe: Subscribe
- ): Message
+ @Body subscribe: com.github.libretube.api.obj.Subscribe
+ ): com.github.libretube.api.obj.Message
@POST("import")
suspend fun importSubscriptions(
@Query("override") override: Boolean,
@Header("Authorization") token: String,
@Body channels: List
- ): Message
+ ): com.github.libretube.api.obj.Message
@POST("import/playlist")
suspend fun importPlaylist(
@Header("Authorization") token: String,
- @Body playlistId: PlaylistId
- ): Message
+ @Body playlistId: com.github.libretube.api.obj.PlaylistId
+ ): com.github.libretube.api.obj.Message
@GET("user/playlists")
- suspend fun playlists(@Header("Authorization") token: String): List
+ suspend fun playlists(@Header("Authorization") token: String): List
@POST("user/playlists/rename")
suspend fun renamePlaylist(
@Header("Authorization") token: String,
- @Body playlistId: PlaylistId
+ @Body playlistId: com.github.libretube.api.obj.PlaylistId
)
@POST("user/playlists/delete")
suspend fun deletePlaylist(
@Header("Authorization") token: String,
- @Body playlistId: PlaylistId
- ): Message
+ @Body playlistId: com.github.libretube.api.obj.PlaylistId
+ ): com.github.libretube.api.obj.Message
@POST("user/playlists/create")
suspend fun createPlaylist(
@Header("Authorization") token: String,
- @Body name: Playlists
- ): PlaylistId
+ @Body name: com.github.libretube.api.obj.Playlists
+ ): com.github.libretube.api.obj.PlaylistId
@POST("user/playlists/add")
suspend fun addToPlaylist(
@Header("Authorization") token: String,
- @Body playlistId: PlaylistId
- ): Message
+ @Body playlistId: com.github.libretube.api.obj.PlaylistId
+ ): com.github.libretube.api.obj.Message
@POST("user/playlists/remove")
suspend fun removeFromPlaylist(
@Header("Authorization") token: String,
- @Body playlistId: PlaylistId
- ): Message
+ @Body playlistId: com.github.libretube.api.obj.PlaylistId
+ ): com.github.libretube.api.obj.Message
}
diff --git a/app/src/main/java/com/github/libretube/api/SubscriptionHelper.kt b/app/src/main/java/com/github/libretube/api/SubscriptionHelper.kt
index 510b1362a..c39936590 100644
--- a/app/src/main/java/com/github/libretube/api/SubscriptionHelper.kt
+++ b/app/src/main/java/com/github/libretube/api/SubscriptionHelper.kt
@@ -1,11 +1,11 @@
package com.github.libretube.api
import android.util.Log
+import com.github.libretube.api.obj.Subscribe
import com.github.libretube.db.DatabaseHolder.Companion.Database
import com.github.libretube.db.obj.LocalSubscription
import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.await
-import com.github.libretube.obj.Subscribe
import com.github.libretube.util.PreferenceHelper
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -19,7 +19,7 @@ object SubscriptionHelper {
try {
RetrofitInstance.authApi.subscribe(
PreferenceHelper.getToken(),
- Subscribe(channelId)
+ com.github.libretube.api.obj.Subscribe(channelId)
)
} catch (e: Exception) {
Log.e(TAG(), e.toString())
@@ -40,7 +40,7 @@ object SubscriptionHelper {
try {
RetrofitInstance.authApi.unsubscribe(
PreferenceHelper.getToken(),
- Subscribe(channelId)
+ com.github.libretube.api.obj.Subscribe(channelId)
)
} catch (e: Exception) {
Log.e(TAG(), e.toString())
diff --git a/app/src/main/java/com/github/libretube/obj/Channel.kt b/app/src/main/java/com/github/libretube/api/obj/Channel.kt
similarity index 77%
rename from app/src/main/java/com/github/libretube/obj/Channel.kt
rename to app/src/main/java/com/github/libretube/api/obj/Channel.kt
index 3cccb1c94..9ef59269f 100644
--- a/app/src/main/java/com/github/libretube/obj/Channel.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Channel.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@@ -12,5 +12,5 @@ data class Channel(
var nextpage: String? = null,
var subscriberCount: Long = 0,
var verified: Boolean = false,
- var relatedStreams: List? = null
+ var relatedStreams: List? = null
)
diff --git a/app/src/main/java/com/github/libretube/obj/ChapterSegment.kt b/app/src/main/java/com/github/libretube/api/obj/ChapterSegment.kt
similarity index 85%
rename from app/src/main/java/com/github/libretube/obj/ChapterSegment.kt
rename to app/src/main/java/com/github/libretube/api/obj/ChapterSegment.kt
index 38120cc81..6fbdfed00 100644
--- a/app/src/main/java/com/github/libretube/obj/ChapterSegment.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/ChapterSegment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/Comment.kt b/app/src/main/java/com/github/libretube/api/obj/Comment.kt
similarity index 93%
rename from app/src/main/java/com/github/libretube/obj/Comment.kt
rename to app/src/main/java/com/github/libretube/api/obj/Comment.kt
index 5266c0d47..398689d8b 100644
--- a/app/src/main/java/com/github/libretube/obj/Comment.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Comment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/CommentsPage.kt b/app/src/main/java/com/github/libretube/api/obj/CommentsPage.kt
similarity index 62%
rename from app/src/main/java/com/github/libretube/obj/CommentsPage.kt
rename to app/src/main/java/com/github/libretube/api/obj/CommentsPage.kt
index 1244cc4a9..e0b8a01bf 100644
--- a/app/src/main/java/com/github/libretube/obj/CommentsPage.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/CommentsPage.kt
@@ -1,10 +1,10 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@JsonIgnoreProperties(ignoreUnknown = true)
data class CommentsPage(
- val comments: MutableList = arrayListOf(),
+ val comments: MutableList = arrayListOf(),
val disabled: Boolean? = null,
val nextpage: String? = ""
)
diff --git a/app/src/main/java/com/github/libretube/obj/DeleteUserRequest.kt b/app/src/main/java/com/github/libretube/api/obj/DeleteUserRequest.kt
similarity index 64%
rename from app/src/main/java/com/github/libretube/obj/DeleteUserRequest.kt
rename to app/src/main/java/com/github/libretube/api/obj/DeleteUserRequest.kt
index f48084e46..e4a961836 100644
--- a/app/src/main/java/com/github/libretube/obj/DeleteUserRequest.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/DeleteUserRequest.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
data class DeleteUserRequest(
var password: String? = null
diff --git a/app/src/main/java/com/github/libretube/obj/Instances.kt b/app/src/main/java/com/github/libretube/api/obj/Instances.kt
similarity index 91%
rename from app/src/main/java/com/github/libretube/obj/Instances.kt
rename to app/src/main/java/com/github/libretube/api/obj/Instances.kt
index 99a75c2d8..053cb8b63 100644
--- a/app/src/main/java/com/github/libretube/obj/Instances.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Instances.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/Login.kt b/app/src/main/java/com/github/libretube/api/obj/Login.kt
similarity index 83%
rename from app/src/main/java/com/github/libretube/obj/Login.kt
rename to app/src/main/java/com/github/libretube/api/obj/Login.kt
index 962d9394c..0636d72d9 100644
--- a/app/src/main/java/com/github/libretube/obj/Login.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Login.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/Message.kt b/app/src/main/java/com/github/libretube/api/obj/Message.kt
similarity index 59%
rename from app/src/main/java/com/github/libretube/obj/Message.kt
rename to app/src/main/java/com/github/libretube/api/obj/Message.kt
index 5a0afeb26..93f063af0 100644
--- a/app/src/main/java/com/github/libretube/obj/Message.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Message.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
data class Message(
var message: String? = null
diff --git a/app/src/main/java/com/github/libretube/obj/PipedStream.kt b/app/src/main/java/com/github/libretube/api/obj/PipedStream.kt
similarity index 93%
rename from app/src/main/java/com/github/libretube/obj/PipedStream.kt
rename to app/src/main/java/com/github/libretube/api/obj/PipedStream.kt
index 59109a210..ed9e9d973 100644
--- a/app/src/main/java/com/github/libretube/obj/PipedStream.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/PipedStream.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/Playlist.kt b/app/src/main/java/com/github/libretube/api/obj/Playlist.kt
similarity index 77%
rename from app/src/main/java/com/github/libretube/obj/Playlist.kt
rename to app/src/main/java/com/github/libretube/api/obj/Playlist.kt
index 1c1a054b4..7cd691cb6 100644
--- a/app/src/main/java/com/github/libretube/obj/Playlist.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Playlist.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@@ -12,5 +12,5 @@ data class Playlist(
var uploaderUrl: String? = null,
var uploaderAvatar: String? = null,
var videos: Int? = 0,
- var relatedStreams: List? = null
+ var relatedStreams: List? = null
)
diff --git a/app/src/main/java/com/github/libretube/obj/PlaylistId.kt b/app/src/main/java/com/github/libretube/api/obj/PlaylistId.kt
similarity index 87%
rename from app/src/main/java/com/github/libretube/obj/PlaylistId.kt
rename to app/src/main/java/com/github/libretube/api/obj/PlaylistId.kt
index b814e0055..088a105c2 100644
--- a/app/src/main/java/com/github/libretube/obj/PlaylistId.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/PlaylistId.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/Playlists.kt b/app/src/main/java/com/github/libretube/api/obj/Playlists.kt
similarity index 87%
rename from app/src/main/java/com/github/libretube/obj/Playlists.kt
rename to app/src/main/java/com/github/libretube/api/obj/Playlists.kt
index f5dd42a61..2d46ced8f 100644
--- a/app/src/main/java/com/github/libretube/obj/Playlists.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Playlists.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/SearchItem.kt b/app/src/main/java/com/github/libretube/api/obj/SearchItem.kt
similarity index 95%
rename from app/src/main/java/com/github/libretube/obj/SearchItem.kt
rename to app/src/main/java/com/github/libretube/api/obj/SearchItem.kt
index 526ecc071..f55604d8b 100644
--- a/app/src/main/java/com/github/libretube/obj/SearchItem.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/SearchItem.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/SearchResult.kt b/app/src/main/java/com/github/libretube/api/obj/SearchResult.kt
similarity index 88%
rename from app/src/main/java/com/github/libretube/obj/SearchResult.kt
rename to app/src/main/java/com/github/libretube/api/obj/SearchResult.kt
index 49286ce93..42ff66005 100644
--- a/app/src/main/java/com/github/libretube/obj/SearchResult.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/SearchResult.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/Segment.kt b/app/src/main/java/com/github/libretube/api/obj/Segment.kt
similarity index 86%
rename from app/src/main/java/com/github/libretube/obj/Segment.kt
rename to app/src/main/java/com/github/libretube/api/obj/Segment.kt
index b4eff6aec..ea92df057 100644
--- a/app/src/main/java/com/github/libretube/obj/Segment.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Segment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/Segments.kt b/app/src/main/java/com/github/libretube/api/obj/Segments.kt
similarity index 51%
rename from app/src/main/java/com/github/libretube/obj/Segments.kt
rename to app/src/main/java/com/github/libretube/api/obj/Segments.kt
index e7c1b1297..2d70bfe72 100644
--- a/app/src/main/java/com/github/libretube/obj/Segments.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Segments.kt
@@ -1,8 +1,8 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@JsonIgnoreProperties(ignoreUnknown = true)
data class Segments(
- val segments: MutableList = arrayListOf()
+ val segments: MutableList = arrayListOf()
)
diff --git a/app/src/main/java/com/github/libretube/obj/StreamItem.kt b/app/src/main/java/com/github/libretube/api/obj/StreamItem.kt
similarity index 93%
rename from app/src/main/java/com/github/libretube/obj/StreamItem.kt
rename to app/src/main/java/com/github/libretube/api/obj/StreamItem.kt
index b8eb2ee9e..ad612a9fc 100644
--- a/app/src/main/java/com/github/libretube/obj/StreamItem.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/StreamItem.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/Streams.kt b/app/src/main/java/com/github/libretube/api/obj/Streams.kt
similarity index 66%
rename from app/src/main/java/com/github/libretube/obj/Streams.kt
rename to app/src/main/java/com/github/libretube/api/obj/Streams.kt
index b497859ac..13dd5efea 100644
--- a/app/src/main/java/com/github/libretube/obj/Streams.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Streams.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@@ -19,13 +19,13 @@ data class Streams(
val views: Long?,
val likes: Long?,
val dislikes: Long?,
- val audioStreams: List?,
- val videoStreams: List?,
- val relatedStreams: List?,
- val subtitles: List?,
+ val audioStreams: List?,
+ val videoStreams: List?,
+ val relatedStreams: List?,
+ val subtitles: List?,
val livestream: Boolean?,
val proxyUrl: String?,
- val chapters: List?
+ val chapters: List?
) {
constructor() : this(
"", "", "", "", "", "", "", "", "", "", null, -1, -1, -1, -1, emptyList(), emptyList(),
diff --git a/app/src/main/java/com/github/libretube/obj/Subscribe.kt b/app/src/main/java/com/github/libretube/api/obj/Subscribe.kt
similarity index 81%
rename from app/src/main/java/com/github/libretube/obj/Subscribe.kt
rename to app/src/main/java/com/github/libretube/api/obj/Subscribe.kt
index 83995018b..f474e129b 100644
--- a/app/src/main/java/com/github/libretube/obj/Subscribe.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Subscribe.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/Subscribed.kt b/app/src/main/java/com/github/libretube/api/obj/Subscribed.kt
similarity index 81%
rename from app/src/main/java/com/github/libretube/obj/Subscribed.kt
rename to app/src/main/java/com/github/libretube/api/obj/Subscribed.kt
index ebe36afc0..f20324e50 100644
--- a/app/src/main/java/com/github/libretube/obj/Subscribed.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Subscribed.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/Subscription.kt b/app/src/main/java/com/github/libretube/api/obj/Subscription.kt
similarity index 87%
rename from app/src/main/java/com/github/libretube/obj/Subscription.kt
rename to app/src/main/java/com/github/libretube/api/obj/Subscription.kt
index 5eb7eccc4..5ddcf0861 100644
--- a/app/src/main/java/com/github/libretube/obj/Subscription.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Subscription.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/Subtitle.kt b/app/src/main/java/com/github/libretube/api/obj/Subtitle.kt
similarity index 88%
rename from app/src/main/java/com/github/libretube/obj/Subtitle.kt
rename to app/src/main/java/com/github/libretube/api/obj/Subtitle.kt
index 1bcdc6957..74454e802 100644
--- a/app/src/main/java/com/github/libretube/obj/Subtitle.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Subtitle.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/obj/Token.kt b/app/src/main/java/com/github/libretube/api/obj/Token.kt
similarity index 83%
rename from app/src/main/java/com/github/libretube/obj/Token.kt
rename to app/src/main/java/com/github/libretube/api/obj/Token.kt
index 9682cec96..6f49ff7e8 100644
--- a/app/src/main/java/com/github/libretube/obj/Token.kt
+++ b/app/src/main/java/com/github/libretube/api/obj/Token.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.obj
+package com.github.libretube.api.obj
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/db/DatabaseHelper.kt b/app/src/main/java/com/github/libretube/db/DatabaseHelper.kt
index e4dcb9780..f8ea13d62 100644
--- a/app/src/main/java/com/github/libretube/db/DatabaseHelper.kt
+++ b/app/src/main/java/com/github/libretube/db/DatabaseHelper.kt
@@ -1,16 +1,16 @@
package com.github.libretube.db
+import com.github.libretube.api.obj.Streams
import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.db.DatabaseHolder.Companion.Database
import com.github.libretube.db.obj.SearchHistoryItem
import com.github.libretube.db.obj.WatchHistoryItem
import com.github.libretube.db.obj.WatchPosition
import com.github.libretube.extensions.toID
-import com.github.libretube.obj.Streams
import com.github.libretube.util.PreferenceHelper
object DatabaseHelper {
- fun addToWatchHistory(videoId: String, streams: Streams) {
+ fun addToWatchHistory(videoId: String, streams: com.github.libretube.api.obj.Streams) {
val watchHistoryItem = WatchHistoryItem(
videoId,
streams.title,
diff --git a/app/src/main/java/com/github/libretube/models/SubscriptionsViewModel.kt b/app/src/main/java/com/github/libretube/models/SubscriptionsViewModel.kt
index 7cd7213b7..fd139e4be 100644
--- a/app/src/main/java/com/github/libretube/models/SubscriptionsViewModel.kt
+++ b/app/src/main/java/com/github/libretube/models/SubscriptionsViewModel.kt
@@ -5,10 +5,10 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.github.libretube.api.RetrofitInstance
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.toID
-import com.github.libretube.obj.StreamItem
-import com.github.libretube.obj.Subscription
import com.github.libretube.util.PreferenceHelper
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -19,11 +19,11 @@ class SubscriptionsViewModel : ViewModel() {
value = false
}
- var videoFeed = MutableLiveData?>().apply {
+ var videoFeed = MutableLiveData?>().apply {
value = null
}
- var subscriptions = MutableLiveData?>().apply {
+ var subscriptions = MutableLiveData?>().apply {
value = null
}
diff --git a/app/src/main/java/com/github/libretube/update/Asset.kt b/app/src/main/java/com/github/libretube/obj/update/Asset.kt
similarity index 93%
rename from app/src/main/java/com/github/libretube/update/Asset.kt
rename to app/src/main/java/com/github/libretube/obj/update/Asset.kt
index a1e4a2c5e..1388df1c1 100644
--- a/app/src/main/java/com/github/libretube/update/Asset.kt
+++ b/app/src/main/java/com/github/libretube/obj/update/Asset.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.update
+package com.github.libretube.obj.update
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/update/Author.kt b/app/src/main/java/com/github/libretube/obj/update/Author.kt
similarity index 95%
rename from app/src/main/java/com/github/libretube/update/Author.kt
rename to app/src/main/java/com/github/libretube/obj/update/Author.kt
index 6b9ecd84d..ae61b7660 100644
--- a/app/src/main/java/com/github/libretube/update/Author.kt
+++ b/app/src/main/java/com/github/libretube/obj/update/Author.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.update
+package com.github.libretube.obj.update
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/update/Reactions.kt b/app/src/main/java/com/github/libretube/obj/update/Reactions.kt
similarity index 90%
rename from app/src/main/java/com/github/libretube/update/Reactions.kt
rename to app/src/main/java/com/github/libretube/obj/update/Reactions.kt
index 9a87fc84d..0ec667860 100644
--- a/app/src/main/java/com/github/libretube/update/Reactions.kt
+++ b/app/src/main/java/com/github/libretube/obj/update/Reactions.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.update
+package com.github.libretube.obj.update
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/update/UpdateInfo.kt b/app/src/main/java/com/github/libretube/obj/update/UpdateInfo.kt
similarity index 95%
rename from app/src/main/java/com/github/libretube/update/UpdateInfo.kt
rename to app/src/main/java/com/github/libretube/obj/update/UpdateInfo.kt
index f72391c3e..8491dc734 100644
--- a/app/src/main/java/com/github/libretube/update/UpdateInfo.kt
+++ b/app/src/main/java/com/github/libretube/obj/update/UpdateInfo.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.update
+package com.github.libretube.obj.update
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/update/Uploader.kt b/app/src/main/java/com/github/libretube/obj/update/Uploader.kt
similarity index 95%
rename from app/src/main/java/com/github/libretube/update/Uploader.kt
rename to app/src/main/java/com/github/libretube/obj/update/Uploader.kt
index 6c19aff19..9dc63930b 100644
--- a/app/src/main/java/com/github/libretube/update/Uploader.kt
+++ b/app/src/main/java/com/github/libretube/obj/update/Uploader.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.update
+package com.github.libretube.obj.update
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
diff --git a/app/src/main/java/com/github/libretube/services/BackgroundMode.kt b/app/src/main/java/com/github/libretube/services/BackgroundMode.kt
index 3fd4010b2..b3a4f0ae1 100644
--- a/app/src/main/java/com/github/libretube/services/BackgroundMode.kt
+++ b/app/src/main/java/com/github/libretube/services/BackgroundMode.kt
@@ -13,14 +13,14 @@ import android.widget.Toast
import com.fasterxml.jackson.databind.ObjectMapper
import com.github.libretube.R
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.IntentData
import com.github.libretube.constants.PLAYER_NOTIFICATION_ID
import com.github.libretube.constants.PreferenceKeys
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.NowPlayingNotification
import com.github.libretube.util.PlayerHelper
@@ -52,7 +52,7 @@ class BackgroundMode : Service() {
/**
* 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)
@@ -68,7 +68,7 @@ class BackgroundMode : Service() {
/**
* SponsorBlock Segment data
*/
- private var segmentData: Segments? = null
+ private var segmentData: com.github.libretube.api.obj.Segments? = null
/**
* [Notification] for the player
@@ -307,7 +307,7 @@ class BackgroundMode : Service() {
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 segmentEnd = (segment.segment[1] * 1000f).toLong()
val currentPosition = player?.currentPosition
diff --git a/app/src/main/java/com/github/libretube/services/UpdateService.kt b/app/src/main/java/com/github/libretube/services/UpdateService.kt
index 76dab8b38..8b3e566de 100644
--- a/app/src/main/java/com/github/libretube/services/UpdateService.kt
+++ b/app/src/main/java/com/github/libretube/services/UpdateService.kt
@@ -58,12 +58,15 @@ class UpdateService : Service() {
val id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1)
if (downloadId == id) {
// install the apk after download finished
- val installIntent = Intent(Intent.ACTION_VIEW)
- installIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
- installIntent.setDataAndType(
- Uri.fromFile(file),
- downloadManager.getMimeTypeForDownloadedFile(downloadId)
- )
+ val installIntent = Intent(Intent.ACTION_VIEW).apply {
+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+ setDataAndType(
+ Uri.fromFile(file),
+ downloadManager.getMimeTypeForDownloadedFile(downloadId)
+ )
+ }
+
try {
startActivity(installIntent)
} catch (e: Exception) {
diff --git a/app/src/main/java/com/github/libretube/sheets/PlaylistOptionsBottomSheet.kt b/app/src/main/java/com/github/libretube/sheets/PlaylistOptionsBottomSheet.kt
index 1969219ce..8a1201830 100644
--- a/app/src/main/java/com/github/libretube/sheets/PlaylistOptionsBottomSheet.kt
+++ b/app/src/main/java/com/github/libretube/sheets/PlaylistOptionsBottomSheet.kt
@@ -6,14 +6,14 @@ import android.util.Log
import android.widget.Toast
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
+import com.github.libretube.api.obj.PlaylistId
import com.github.libretube.databinding.DialogTextPreferenceBinding
-import com.github.libretube.dialogs.ShareDialog
import com.github.libretube.extensions.TAG
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.PreferenceHelper
-import com.github.libretube.views.BottomSheet
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -114,7 +114,10 @@ class PlaylistOptionsBottomSheet(
private fun importPlaylist(token: String, playlistId: String) {
CoroutineScope(Dispatchers.IO).launch {
val response = try {
- RetrofitInstance.authApi.importPlaylist(token, PlaylistId(playlistId))
+ RetrofitInstance.authApi.importPlaylist(
+ token,
+ com.github.libretube.api.obj.PlaylistId(playlistId)
+ )
} catch (e: IOException) {
println(e)
return@launch
@@ -130,7 +133,7 @@ class PlaylistOptionsBottomSheet(
try {
RetrofitInstance.authApi.renamePlaylist(
PreferenceHelper.getToken(),
- PlaylistId(
+ com.github.libretube.api.obj.PlaylistId(
playlistId = id,
newName = newName
)
@@ -146,7 +149,7 @@ class PlaylistOptionsBottomSheet(
try {
RetrofitInstance.authApi.deletePlaylist(
PreferenceHelper.getToken(),
- PlaylistId(id)
+ com.github.libretube.api.obj.PlaylistId(id)
)
} catch (e: Exception) {
return@launch
diff --git a/app/src/main/java/com/github/libretube/sheets/VideoOptionsBottomSheet.kt b/app/src/main/java/com/github/libretube/sheets/VideoOptionsBottomSheet.kt
index ba4fa68af..a9a39b859 100644
--- a/app/src/main/java/com/github/libretube/sheets/VideoOptionsBottomSheet.kt
+++ b/app/src/main/java/com/github/libretube/sheets/VideoOptionsBottomSheet.kt
@@ -4,13 +4,13 @@ import android.os.Bundle
import android.widget.Toast
import com.github.libretube.R
import com.github.libretube.constants.IntentData
-import com.github.libretube.dialogs.AddToPlaylistDialog
-import com.github.libretube.dialogs.DownloadDialog
-import com.github.libretube.dialogs.ShareDialog
+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.ui.views.BottomSheet
import com.github.libretube.util.BackgroundHelper
import com.github.libretube.util.PlayingQueue
import com.github.libretube.util.PreferenceHelper
-import com.github.libretube.views.BottomSheet
/**
* Dialog with different options for a selected video.
diff --git a/app/src/main/java/com/github/libretube/activities/AboutActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt
similarity index 99%
rename from app/src/main/java/com/github/libretube/activities/AboutActivity.kt
rename to app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt
index 7a8eacacc..277d65cc5 100644
--- a/app/src/main/java/com/github/libretube/activities/AboutActivity.kt
+++ b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.activities
+package com.github.libretube.ui.activities
import android.content.ClipData
import android.content.ClipboardManager
diff --git a/app/src/main/java/com/github/libretube/activities/CommunityActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/CommunityActivity.kt
similarity index 97%
rename from app/src/main/java/com/github/libretube/activities/CommunityActivity.kt
rename to app/src/main/java/com/github/libretube/ui/activities/CommunityActivity.kt
index d4d1f57e0..b48da6bc0 100644
--- a/app/src/main/java/com/github/libretube/activities/CommunityActivity.kt
+++ b/app/src/main/java/com/github/libretube/ui/activities/CommunityActivity.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.activities
+package com.github.libretube.ui.activities
import android.content.Intent
import android.net.Uri
diff --git a/app/src/main/java/com/github/libretube/activities/MainActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt
similarity index 99%
rename from app/src/main/java/com/github/libretube/activities/MainActivity.kt
rename to app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt
index 27c49c31a..74374a1c8 100644
--- a/app/src/main/java/com/github/libretube/activities/MainActivity.kt
+++ b/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.activities
+package com.github.libretube.ui.activities
import android.content.Intent
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.PreferenceKeys
import com.github.libretube.databinding.ActivityMainBinding
-import com.github.libretube.dialogs.ErrorDialog
import com.github.libretube.extensions.BaseActivity
import com.github.libretube.extensions.toID
-import com.github.libretube.fragments.PlayerFragment
import com.github.libretube.models.PlayerViewModel
import com.github.libretube.models.SearchViewModel
import com.github.libretube.models.SubscriptionsViewModel
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.NetworkHelper
import com.github.libretube.util.PreferenceHelper
diff --git a/app/src/main/java/com/github/libretube/activities/NoInternetActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/NoInternetActivity.kt
similarity index 95%
rename from app/src/main/java/com/github/libretube/activities/NoInternetActivity.kt
rename to app/src/main/java/com/github/libretube/ui/activities/NoInternetActivity.kt
index aa6da6756..c76a0b1f9 100644
--- a/app/src/main/java/com/github/libretube/activities/NoInternetActivity.kt
+++ b/app/src/main/java/com/github/libretube/ui/activities/NoInternetActivity.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.activities
+package com.github.libretube.ui.activities
import android.content.Intent
import android.os.Bundle
@@ -7,7 +7,7 @@ import com.github.libretube.R
import com.github.libretube.databinding.ActivityNointernetBinding
import com.github.libretube.extensions.BaseActivity
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.ThemeHelper
diff --git a/app/src/main/java/com/github/libretube/activities/OfflinePlayerActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/OfflinePlayerActivity.kt
similarity index 99%
rename from app/src/main/java/com/github/libretube/activities/OfflinePlayerActivity.kt
rename to app/src/main/java/com/github/libretube/ui/activities/OfflinePlayerActivity.kt
index 077e036ad..ab148e5f9 100644
--- a/app/src/main/java/com/github/libretube/activities/OfflinePlayerActivity.kt
+++ b/app/src/main/java/com/github/libretube/ui/activities/OfflinePlayerActivity.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.activities
+package com.github.libretube.ui.activities
import android.content.pm.ActivityInfo
import android.graphics.Color
diff --git a/app/src/main/java/com/github/libretube/activities/RouterActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/RouterActivity.kt
similarity index 98%
rename from app/src/main/java/com/github/libretube/activities/RouterActivity.kt
rename to app/src/main/java/com/github/libretube/ui/activities/RouterActivity.kt
index 7c9f98ee1..8d0319a75 100644
--- a/app/src/main/java/com/github/libretube/activities/RouterActivity.kt
+++ b/app/src/main/java/com/github/libretube/ui/activities/RouterActivity.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.activities
+package com.github.libretube.ui.activities
import android.content.Intent
import android.content.pm.PackageManager
diff --git a/app/src/main/java/com/github/libretube/activities/SettingsActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/SettingsActivity.kt
similarity index 94%
rename from app/src/main/java/com/github/libretube/activities/SettingsActivity.kt
rename to app/src/main/java/com/github/libretube/ui/activities/SettingsActivity.kt
index 7ec558e68..416bdc213 100644
--- a/app/src/main/java/com/github/libretube/activities/SettingsActivity.kt
+++ b/app/src/main/java/com/github/libretube/ui/activities/SettingsActivity.kt
@@ -1,11 +1,11 @@
-package com.github.libretube.activities
+package com.github.libretube.ui.activities
import android.os.Bundle
import androidx.activity.OnBackPressedCallback
import com.github.libretube.R
import com.github.libretube.databinding.ActivitySettingsBinding
import com.github.libretube.extensions.BaseActivity
-import com.github.libretube.preferences.MainSettings
+import com.github.libretube.ui.preferences.MainSettings
class SettingsActivity : BaseActivity() {
lateinit var binding: ActivitySettingsBinding
diff --git a/app/src/main/java/com/github/libretube/adapters/BackupOptionsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/BackupOptionsAdapter.kt
similarity index 96%
rename from app/src/main/java/com/github/libretube/adapters/BackupOptionsAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/BackupOptionsAdapter.kt
index afae49d93..df171b4af 100644
--- a/app/src/main/java/com/github/libretube/adapters/BackupOptionsAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/BackupOptionsAdapter.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.view.LayoutInflater
import android.view.ViewGroup
diff --git a/app/src/main/java/com/github/libretube/adapters/BottomSheetAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/BottomSheetAdapter.kt
similarity index 97%
rename from app/src/main/java/com/github/libretube/adapters/BottomSheetAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/BottomSheetAdapter.kt
index 80fff9c24..35076697d 100644
--- a/app/src/main/java/com/github/libretube/adapters/BottomSheetAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/BottomSheetAdapter.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.view.LayoutInflater
import android.view.View
diff --git a/app/src/main/java/com/github/libretube/adapters/ChannelAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/ChannelAdapter.kt
similarity index 90%
rename from app/src/main/java/com/github/libretube/adapters/ChannelAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/ChannelAdapter.kt
index e09ada15c..2f80e0ea7 100644
--- a/app/src/main/java/com/github/libretube/adapters/ChannelAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/ChannelAdapter.kt
@@ -1,21 +1,21 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.text.format.DateUtils
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView
+import com.github.libretube.api.obj.StreamItem
import com.github.libretube.databinding.VideoRowBinding
import com.github.libretube.extensions.formatShort
import com.github.libretube.extensions.setWatchProgressLength
import com.github.libretube.extensions.toID
-import com.github.libretube.obj.StreamItem
import com.github.libretube.sheets.VideoOptionsBottomSheet
import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper
class ChannelAdapter(
- private val videoFeed: MutableList,
+ private val videoFeed: MutableList,
private val childFragmentManager: FragmentManager
) :
RecyclerView.Adapter() {
@@ -24,7 +24,7 @@ class ChannelAdapter(
return videoFeed.size
}
- fun updateItems(newItems: List) {
+ fun updateItems(newItems: List) {
val feedSize = videoFeed.size
videoFeed.addAll(newItems)
notifyItemRangeInserted(feedSize, newItems.size)
diff --git a/app/src/main/java/com/github/libretube/adapters/ChaptersAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/ChaptersAdapter.kt
similarity index 92%
rename from app/src/main/java/com/github/libretube/adapters/ChaptersAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/ChaptersAdapter.kt
index f85c6536c..f75b43b85 100644
--- a/app/src/main/java/com/github/libretube/adapters/ChaptersAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/ChaptersAdapter.kt
@@ -1,17 +1,17 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.graphics.Color
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
+import com.github.libretube.api.obj.ChapterSegment
import com.github.libretube.databinding.ChapterColumnBinding
-import com.github.libretube.obj.ChapterSegment
import com.github.libretube.util.ImageHelper
import com.github.libretube.util.ThemeHelper
import com.google.android.exoplayer2.ExoPlayer
class ChaptersAdapter(
- private val chapters: List,
+ private val chapters: List,
private val exoPlayer: ExoPlayer
) : RecyclerView.Adapter() {
private var selectedPosition = 0
diff --git a/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/CommentsAdapter.kt
similarity index 91%
rename from app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/CommentsAdapter.kt
index 4f40dc1f8..199162429 100644
--- a/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/CommentsAdapter.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.util.Log
import android.view.LayoutInflater
@@ -9,11 +9,11 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
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.extensions.TAG
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.NavigationHelper
import kotlinx.coroutines.CoroutineScope
@@ -24,14 +24,14 @@ import java.io.IOException
class CommentsAdapter(
private val videoId: String,
- private val comments: MutableList
+ private val comments: MutableList
) : RecyclerView.Adapter() {
private var isLoading = false
private var nextpage = ""
- private var repliesPage = CommentsPage()
+ private var repliesPage = com.github.libretube.api.obj.CommentsPage()
- fun updateItems(newItems: List) {
+ fun updateItems(newItems: List) {
val commentsSize = comments.size
comments.addAll(newItems)
notifyItemRangeInserted(commentsSize, newItems.size)
diff --git a/app/src/main/java/com/github/libretube/adapters/DownloadsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/DownloadsAdapter.kt
similarity index 96%
rename from app/src/main/java/com/github/libretube/adapters/DownloadsAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/DownloadsAdapter.kt
index 0be4e5129..e0b0fa10b 100644
--- a/app/src/main/java/com/github/libretube/adapters/DownloadsAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/DownloadsAdapter.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.annotation.SuppressLint
import android.content.Intent
@@ -6,10 +6,10 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
-import com.github.libretube.activities.OfflinePlayerActivity
import com.github.libretube.constants.IntentData
import com.github.libretube.databinding.DownloadedMediaRowBinding
import com.github.libretube.obj.DownloadedFile
+import com.github.libretube.ui.activities.OfflinePlayerActivity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.File
diff --git a/app/src/main/java/com/github/libretube/adapters/LegacySubscriptionAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/LegacySubscriptionAdapter.kt
similarity index 90%
rename from app/src/main/java/com/github/libretube/adapters/LegacySubscriptionAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/LegacySubscriptionAdapter.kt
index 253e6fb75..2bd0ad2bc 100644
--- a/app/src/main/java/com/github/libretube/adapters/LegacySubscriptionAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/LegacySubscriptionAdapter.kt
@@ -1,16 +1,16 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
+import com.github.libretube.api.obj.Subscription
import com.github.libretube.databinding.LegacySubscriptionChannelBinding
import com.github.libretube.extensions.toID
-import com.github.libretube.obj.Subscription
import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper
class LegacySubscriptionAdapter(
- private val subscriptions: List
+ private val subscriptions: List
) : RecyclerView.Adapter() {
override fun onCreateViewHolder(
diff --git a/app/src/main/java/com/github/libretube/adapters/NavBarOptionsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/NavBarOptionsAdapter.kt
similarity index 97%
rename from app/src/main/java/com/github/libretube/adapters/NavBarOptionsAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/NavBarOptionsAdapter.kt
index a419cb466..55f6513bb 100644
--- a/app/src/main/java/com/github/libretube/adapters/NavBarOptionsAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/NavBarOptionsAdapter.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.view.LayoutInflater
import android.view.ViewGroup
diff --git a/app/src/main/java/com/github/libretube/adapters/PlaylistAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt
similarity index 88%
rename from app/src/main/java/com/github/libretube/adapters/PlaylistAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt
index 4bb6767e7..8880c73f7 100644
--- a/app/src/main/java/com/github/libretube/adapters/PlaylistAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.app.Activity
import android.util.Log
@@ -8,13 +8,13 @@ import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView
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.extensions.TAG
import com.github.libretube.extensions.setFormattedDuration
import com.github.libretube.extensions.setWatchProgressLength
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.util.ImageHelper
import com.github.libretube.util.NavigationHelper
@@ -26,7 +26,7 @@ import retrofit2.HttpException
import java.io.IOException
class PlaylistAdapter(
- private val videoFeed: MutableList,
+ private val videoFeed: MutableList,
private val playlistId: String,
private val isOwner: Boolean,
private val activity: Activity,
@@ -37,7 +37,7 @@ class PlaylistAdapter(
return videoFeed.size
}
- fun updateItems(newItems: List) {
+ fun updateItems(newItems: List) {
val oldSize = videoFeed.size
videoFeed.addAll(newItems)
notifyItemRangeInserted(oldSize, videoFeed.size)
@@ -83,7 +83,10 @@ class PlaylistAdapter(
try {
RetrofitInstance.authApi.removeFromPlaylist(
PreferenceHelper.getToken(),
- PlaylistId(playlistId = playlistId, index = position)
+ com.github.libretube.api.obj.PlaylistId(
+ playlistId = playlistId,
+ index = position
+ )
)
} catch (e: IOException) {
println(e)
diff --git a/app/src/main/java/com/github/libretube/adapters/PlaylistsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistsAdapter.kt
similarity index 92%
rename from app/src/main/java/com/github/libretube/adapters/PlaylistsAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/PlaylistsAdapter.kt
index 761eb00ea..a4614fa49 100644
--- a/app/src/main/java/com/github/libretube/adapters/PlaylistsAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistsAdapter.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.app.Activity
import android.util.Log
@@ -8,10 +8,10 @@ import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
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.extensions.TAG
-import com.github.libretube.obj.PlaylistId
-import com.github.libretube.obj.Playlists
import com.github.libretube.sheets.PlaylistOptionsBottomSheet
import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper
@@ -24,7 +24,7 @@ import retrofit2.HttpException
import java.io.IOException
class PlaylistsAdapter(
- private val playlists: MutableList,
+ private val playlists: MutableList,
private val childFragmentManager: FragmentManager,
private val activity: Activity
) : RecyclerView.Adapter() {
@@ -33,7 +33,7 @@ class PlaylistsAdapter(
return playlists.size
}
- fun updateItems(newItems: List) {
+ fun updateItems(newItems: List) {
val oldSize = playlists.size
playlists.addAll(newItems)
notifyItemRangeInserted(oldSize, playlists.size)
@@ -90,7 +90,7 @@ class PlaylistsAdapter(
val response = try {
RetrofitInstance.authApi.deletePlaylist(
PreferenceHelper.getToken(),
- PlaylistId(id)
+ com.github.libretube.api.obj.PlaylistId(id)
)
} catch (e: IOException) {
println(e)
diff --git a/app/src/main/java/com/github/libretube/adapters/RepliesAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/RepliesAdapter.kt
similarity index 90%
rename from app/src/main/java/com/github/libretube/adapters/RepliesAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/RepliesAdapter.kt
index 3339d25dd..ccf0571f8 100644
--- a/app/src/main/java/com/github/libretube/adapters/RepliesAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/RepliesAdapter.kt
@@ -1,17 +1,17 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
+import com.github.libretube.api.obj.Comment
import com.github.libretube.databinding.RepliesRowBinding
import com.github.libretube.extensions.formatShort
-import com.github.libretube.obj.Comment
import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper
class RepliesAdapter(
- private val replies: MutableList
+ private val replies: MutableList
) : RecyclerView.Adapter() {
fun clear() {
@@ -20,7 +20,7 @@ class RepliesAdapter(
notifyItemRangeRemoved(0, size)
}
- fun updateItems(newItems: List) {
+ fun updateItems(newItems: List) {
var repliesSize = replies.size
replies.addAll(newItems)
notifyItemRangeInserted(repliesSize, newItems.size)
diff --git a/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/SearchAdapter.kt
similarity index 93%
rename from app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/SearchAdapter.kt
index 1561faec8..4e77f6657 100644
--- a/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/SearchAdapter.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.view.LayoutInflater
import android.view.View
@@ -7,6 +7,7 @@ import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
import com.github.libretube.api.SubscriptionHelper
+import com.github.libretube.api.obj.SearchItem
import com.github.libretube.databinding.ChannelRowBinding
import com.github.libretube.databinding.PlaylistSearchRowBinding
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.setWatchProgressLength
import com.github.libretube.extensions.toID
-import com.github.libretube.obj.SearchItem
import com.github.libretube.sheets.PlaylistOptionsBottomSheet
import com.github.libretube.sheets.VideoOptionsBottomSheet
import com.github.libretube.util.ImageHelper
@@ -24,12 +24,12 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class SearchAdapter(
- private val searchItems: MutableList,
+ private val searchItems: MutableList,
private val childFragmentManager: FragmentManager
) :
RecyclerView.Adapter() {
- fun updateItems(newItems: List) {
+ fun updateItems(newItems: List) {
val searchItemsSize = searchItems.size
searchItems.addAll(newItems)
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 {
ImageHelper.loadImage(item.thumbnail, thumbnail)
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 {
ImageHelper.loadImage(item.thumbnail, searchChannelImage)
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 {
ImageHelper.loadImage(item.thumbnail, searchThumbnail)
if (item.videos?.toInt() != -1) searchPlaylistNumber.text = item.videos.toString()
diff --git a/app/src/main/java/com/github/libretube/adapters/SearchHistoryAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/SearchHistoryAdapter.kt
similarity index 97%
rename from app/src/main/java/com/github/libretube/adapters/SearchHistoryAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/SearchHistoryAdapter.kt
index e8377b69a..1326ac7ee 100644
--- a/app/src/main/java/com/github/libretube/adapters/SearchHistoryAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/SearchHistoryAdapter.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.view.LayoutInflater
import android.view.ViewGroup
diff --git a/app/src/main/java/com/github/libretube/adapters/SearchSuggestionsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/SearchSuggestionsAdapter.kt
similarity index 96%
rename from app/src/main/java/com/github/libretube/adapters/SearchSuggestionsAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/SearchSuggestionsAdapter.kt
index d2df68374..c3fdca2ee 100644
--- a/app/src/main/java/com/github/libretube/adapters/SearchSuggestionsAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/SearchSuggestionsAdapter.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.view.LayoutInflater
import android.view.ViewGroup
diff --git a/app/src/main/java/com/github/libretube/adapters/SubscriptionChannelAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionChannelAdapter.kt
similarity index 93%
rename from app/src/main/java/com/github/libretube/adapters/SubscriptionChannelAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/SubscriptionChannelAdapter.kt
index 23d5489a9..ee7f36f9d 100644
--- a/app/src/main/java/com/github/libretube/adapters/SubscriptionChannelAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionChannelAdapter.kt
@@ -1,17 +1,17 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
import com.github.libretube.api.SubscriptionHelper
+import com.github.libretube.api.obj.Subscription
import com.github.libretube.databinding.ChannelSubscriptionRowBinding
import com.github.libretube.extensions.toID
-import com.github.libretube.obj.Subscription
import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper
-class SubscriptionChannelAdapter(private val subscriptions: MutableList) :
+class SubscriptionChannelAdapter(private val subscriptions: MutableList) :
RecyclerView.Adapter() {
override fun getItemCount(): Int {
diff --git a/app/src/main/java/com/github/libretube/adapters/TrendingAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/TrendingAdapter.kt
similarity index 94%
rename from app/src/main/java/com/github/libretube/adapters/TrendingAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/TrendingAdapter.kt
index 3d7069bf0..8f4174e0e 100644
--- a/app/src/main/java/com/github/libretube/adapters/TrendingAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/TrendingAdapter.kt
@@ -1,22 +1,22 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.text.format.DateUtils
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView
+import com.github.libretube.api.obj.StreamItem
import com.github.libretube.databinding.TrendingRowBinding
import com.github.libretube.extensions.formatShort
import com.github.libretube.extensions.setFormattedDuration
import com.github.libretube.extensions.setWatchProgressLength
import com.github.libretube.extensions.toID
-import com.github.libretube.obj.StreamItem
import com.github.libretube.sheets.VideoOptionsBottomSheet
import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper
class TrendingAdapter(
- private val streamItems: List,
+ private val streamItems: List,
private val childFragmentManager: FragmentManager,
private val showAllAtOne: Boolean = true
) : RecyclerView.Adapter() {
diff --git a/app/src/main/java/com/github/libretube/adapters/WatchHistoryAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt
similarity index 98%
rename from app/src/main/java/com/github/libretube/adapters/WatchHistoryAdapter.kt
rename to app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt
index 7252332d0..74409f0be 100644
--- a/app/src/main/java/com/github/libretube/adapters/WatchHistoryAdapter.kt
+++ b/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.adapters
+package com.github.libretube.ui.adapters
import android.view.LayoutInflater
import android.view.ViewGroup
diff --git a/app/src/main/java/com/github/libretube/dialogs/AddToPlaylistDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt
similarity index 94%
rename from app/src/main/java/com/github/libretube/dialogs/AddToPlaylistDialog.kt
rename to app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt
index 74ac7a9a9..8b746c157 100644
--- a/app/src/main/java/com/github/libretube/dialogs/AddToPlaylistDialog.kt
+++ b/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.dialogs
+package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.os.Bundle
@@ -11,11 +11,11 @@ import androidx.fragment.app.activityViewModels
import androidx.lifecycle.lifecycleScope
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
+import com.github.libretube.api.obj.PlaylistId
import com.github.libretube.constants.IntentData
import com.github.libretube.databinding.DialogAddtoplaylistBinding
import com.github.libretube.extensions.TAG
import com.github.libretube.models.PlaylistViewModel
-import com.github.libretube.obj.PlaylistId
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@@ -92,7 +92,10 @@ class AddToPlaylistDialog : DialogFragment() {
fun run() {
lifecycleScope.launchWhenCreated {
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) {
println(e)
Log.e(TAG(), "IOException, you might not have internet connection")
diff --git a/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/BackupDialog.kt
similarity index 96%
rename from app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt
rename to app/src/main/java/com/github/libretube/ui/dialogs/BackupDialog.kt
index 62148198f..c9c0b233b 100644
--- a/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt
+++ b/app/src/main/java/com/github/libretube/ui/dialogs/BackupDialog.kt
@@ -1,15 +1,15 @@
-package com.github.libretube.dialogs
+package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.os.Bundle
import androidx.fragment.app.DialogFragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.R
-import com.github.libretube.adapters.BackupOptionsAdapter
import com.github.libretube.databinding.DialogBackupBinding
import com.github.libretube.db.DatabaseHolder.Companion.Database
import com.github.libretube.extensions.await
import com.github.libretube.obj.BackupFile
+import com.github.libretube.ui.adapters.BackupOptionsAdapter
import com.google.android.material.dialog.MaterialAlertDialogBuilder
class BackupDialog(
diff --git a/app/src/main/java/com/github/libretube/dialogs/CreatePlaylistDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/CreatePlaylistDialog.kt
similarity index 90%
rename from app/src/main/java/com/github/libretube/dialogs/CreatePlaylistDialog.kt
rename to app/src/main/java/com/github/libretube/ui/dialogs/CreatePlaylistDialog.kt
index c2ea2cc9f..5291a679b 100644
--- a/app/src/main/java/com/github/libretube/dialogs/CreatePlaylistDialog.kt
+++ b/app/src/main/java/com/github/libretube/ui/dialogs/CreatePlaylistDialog.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.dialogs
+package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.os.Bundle
@@ -8,10 +8,10 @@ import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
+import com.github.libretube.api.obj.Playlists
import com.github.libretube.databinding.DialogCreatePlaylistBinding
import com.github.libretube.extensions.TAG
-import com.github.libretube.fragments.LibraryFragment
-import com.github.libretube.obj.Playlists
+import com.github.libretube.ui.fragments.LibraryFragment
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@@ -52,7 +52,10 @@ class CreatePlaylistDialog : DialogFragment() {
private fun createPlaylist(name: String) {
lifecycleScope.launchWhenCreated {
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) {
println(e)
Log.e(TAG(), "IOException, you might not have internet connection")
diff --git a/app/src/main/java/com/github/libretube/dialogs/CustomInstanceDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/CustomInstanceDialog.kt
similarity index 98%
rename from app/src/main/java/com/github/libretube/dialogs/CustomInstanceDialog.kt
rename to app/src/main/java/com/github/libretube/ui/dialogs/CustomInstanceDialog.kt
index a1e246dc6..44058104d 100644
--- a/app/src/main/java/com/github/libretube/dialogs/CustomInstanceDialog.kt
+++ b/app/src/main/java/com/github/libretube/ui/dialogs/CustomInstanceDialog.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.dialogs
+package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.os.Bundle
diff --git a/app/src/main/java/com/github/libretube/dialogs/DeleteAccountDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/DeleteAccountDialog.kt
similarity index 88%
rename from app/src/main/java/com/github/libretube/dialogs/DeleteAccountDialog.kt
rename to app/src/main/java/com/github/libretube/ui/dialogs/DeleteAccountDialog.kt
index ecc2aca20..a9b49fae0 100644
--- a/app/src/main/java/com/github/libretube/dialogs/DeleteAccountDialog.kt
+++ b/app/src/main/java/com/github/libretube/ui/dialogs/DeleteAccountDialog.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.dialogs
+package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.os.Bundle
@@ -8,9 +8,9 @@ import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
+import com.github.libretube.api.obj.DeleteUserRequest
import com.github.libretube.databinding.DialogDeleteAccountBinding
import com.github.libretube.extensions.TAG
-import com.github.libretube.obj.DeleteUserRequest
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@@ -45,7 +45,10 @@ class DeleteAccountDialog : DialogFragment() {
val token = PreferenceHelper.getToken()
try {
- RetrofitInstance.authApi.deleteAccount(token, DeleteUserRequest(password))
+ RetrofitInstance.authApi.deleteAccount(
+ token,
+ com.github.libretube.api.obj.DeleteUserRequest(password)
+ )
} catch (e: Exception) {
Log.e(TAG(), e.toString())
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
diff --git a/app/src/main/java/com/github/libretube/dialogs/DownloadDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt
similarity index 96%
rename from app/src/main/java/com/github/libretube/dialogs/DownloadDialog.kt
rename to app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt
index 3c88f17f7..868f37416 100644
--- a/app/src/main/java/com/github/libretube/dialogs/DownloadDialog.kt
+++ b/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.dialogs
+package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.content.Intent
@@ -12,9 +12,9 @@ import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
+import com.github.libretube.api.obj.Streams
import com.github.libretube.databinding.DialogDownloadBinding
import com.github.libretube.extensions.TAG
-import com.github.libretube.obj.Streams
import com.github.libretube.services.DownloadService
import com.github.libretube.util.ThemeHelper
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()
val videoUrl = arrayListOf()
diff --git a/app/src/main/java/com/github/libretube/dialogs/ErrorDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/ErrorDialog.kt
similarity index 97%
rename from app/src/main/java/com/github/libretube/dialogs/ErrorDialog.kt
rename to app/src/main/java/com/github/libretube/ui/dialogs/ErrorDialog.kt
index 66dc11a6a..ffbd54eb7 100644
--- a/app/src/main/java/com/github/libretube/dialogs/ErrorDialog.kt
+++ b/app/src/main/java/com/github/libretube/ui/dialogs/ErrorDialog.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.dialogs
+package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.content.ClipData
diff --git a/app/src/main/java/com/github/libretube/dialogs/LoginDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/LoginDialog.kt
similarity index 90%
rename from app/src/main/java/com/github/libretube/dialogs/LoginDialog.kt
rename to app/src/main/java/com/github/libretube/ui/dialogs/LoginDialog.kt
index b182fb64a..28bfa929f 100644
--- a/app/src/main/java/com/github/libretube/dialogs/LoginDialog.kt
+++ b/app/src/main/java/com/github/libretube/ui/dialogs/LoginDialog.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.dialogs
+package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.os.Bundle
@@ -8,9 +8,9 @@ import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
+import com.github.libretube.api.obj.Login
import com.github.libretube.databinding.DialogLoginBinding
import com.github.libretube.extensions.TAG
-import com.github.libretube.obj.Login
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@@ -26,7 +26,10 @@ class LoginDialog : DialogFragment() {
binding.login.setOnClickListener {
if (binding.username.text.toString() != "" && binding.password.text.toString() != "") {
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)
} else {
Toast.makeText(context, R.string.empty, Toast.LENGTH_SHORT).show()
@@ -37,7 +40,7 @@ class LoginDialog : DialogFragment() {
binding.username.text.toString() != "" &&
binding.password.text.toString() != ""
) {
- val login = Login(
+ val login = com.github.libretube.api.obj.Login(
binding.username.text.toString(),
binding.password.text.toString()
)
@@ -54,7 +57,7 @@ class LoginDialog : DialogFragment() {
.show()
}
- private fun login(login: Login) {
+ private fun login(login: com.github.libretube.api.obj.Login) {
lifecycleScope.launchWhenCreated {
val response = try {
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() {
lifecycleScope.launchWhenCreated {
val response = try {
diff --git a/app/src/main/java/com/github/libretube/dialogs/LogoutDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/LogoutDialog.kt
similarity index 96%
rename from app/src/main/java/com/github/libretube/dialogs/LogoutDialog.kt
rename to app/src/main/java/com/github/libretube/ui/dialogs/LogoutDialog.kt
index b4df8e9a9..9a152a1e6 100644
--- a/app/src/main/java/com/github/libretube/dialogs/LogoutDialog.kt
+++ b/app/src/main/java/com/github/libretube/ui/dialogs/LogoutDialog.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.dialogs
+package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.os.Bundle
diff --git a/app/src/main/java/com/github/libretube/dialogs/NavBarOptionsDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/NavBarOptionsDialog.kt
similarity index 96%
rename from app/src/main/java/com/github/libretube/dialogs/NavBarOptionsDialog.kt
rename to app/src/main/java/com/github/libretube/ui/dialogs/NavBarOptionsDialog.kt
index 3eebad887..e9d0c62a7 100644
--- a/app/src/main/java/com/github/libretube/dialogs/NavBarOptionsDialog.kt
+++ b/app/src/main/java/com/github/libretube/ui/dialogs/NavBarOptionsDialog.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.dialogs
+package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.os.Bundle
@@ -7,8 +7,8 @@ import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
-import com.github.libretube.adapters.NavBarOptionsAdapter
import com.github.libretube.databinding.DialogNavbarOptionsBinding
+import com.github.libretube.ui.adapters.NavBarOptionsAdapter
import com.github.libretube.util.NavBarHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
diff --git a/app/src/main/java/com/github/libretube/dialogs/RequireRestartDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/RequireRestartDialog.kt
similarity index 95%
rename from app/src/main/java/com/github/libretube/dialogs/RequireRestartDialog.kt
rename to app/src/main/java/com/github/libretube/ui/dialogs/RequireRestartDialog.kt
index 5c2f3faf0..26ef14fc6 100644
--- a/app/src/main/java/com/github/libretube/dialogs/RequireRestartDialog.kt
+++ b/app/src/main/java/com/github/libretube/ui/dialogs/RequireRestartDialog.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.dialogs
+package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.os.Bundle
diff --git a/app/src/main/java/com/github/libretube/dialogs/ShareDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/ShareDialog.kt
similarity index 98%
rename from app/src/main/java/com/github/libretube/dialogs/ShareDialog.kt
rename to app/src/main/java/com/github/libretube/ui/dialogs/ShareDialog.kt
index 4118e0c6f..9756bc45c 100644
--- a/app/src/main/java/com/github/libretube/dialogs/ShareDialog.kt
+++ b/app/src/main/java/com/github/libretube/ui/dialogs/ShareDialog.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.dialogs
+package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.content.Intent
diff --git a/app/src/main/java/com/github/libretube/dialogs/UpdateDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/UpdateDialog.kt
similarity index 95%
rename from app/src/main/java/com/github/libretube/dialogs/UpdateDialog.kt
rename to app/src/main/java/com/github/libretube/ui/dialogs/UpdateDialog.kt
index d55ef37f9..88c1d636d 100644
--- a/app/src/main/java/com/github/libretube/dialogs/UpdateDialog.kt
+++ b/app/src/main/java/com/github/libretube/ui/dialogs/UpdateDialog.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.dialogs
+package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.content.Intent
@@ -8,8 +8,8 @@ import android.os.Bundle
import android.util.Log
import androidx.fragment.app.DialogFragment
import com.github.libretube.R
+import com.github.libretube.obj.update.UpdateInfo
import com.github.libretube.services.UpdateService
-import com.github.libretube.update.UpdateInfo
import com.google.android.material.dialog.MaterialAlertDialogBuilder
class UpdateDialog(
diff --git a/app/src/main/java/com/github/libretube/fragments/ChannelFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt
similarity index 98%
rename from app/src/main/java/com/github/libretube/fragments/ChannelFragment.kt
rename to app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt
index 41e18ef2a..b88f03142 100644
--- a/app/src/main/java/com/github/libretube/fragments/ChannelFragment.kt
+++ b/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.fragments
+package com.github.libretube.ui.fragments
import android.os.Bundle
import android.util.Log
@@ -8,7 +8,6 @@ import android.view.ViewGroup
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.R
-import com.github.libretube.adapters.ChannelAdapter
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.SubscriptionHelper
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.formatShort
import com.github.libretube.extensions.toID
+import com.github.libretube.ui.adapters.ChannelAdapter
import com.github.libretube.util.ImageHelper
import retrofit2.HttpException
import java.io.IOException
diff --git a/app/src/main/java/com/github/libretube/fragments/DownloadsFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/DownloadsFragment.kt
similarity index 94%
rename from app/src/main/java/com/github/libretube/fragments/DownloadsFragment.kt
rename to app/src/main/java/com/github/libretube/ui/fragments/DownloadsFragment.kt
index cf2befe32..c19d552dc 100644
--- a/app/src/main/java/com/github/libretube/fragments/DownloadsFragment.kt
+++ b/app/src/main/java/com/github/libretube/ui/fragments/DownloadsFragment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.fragments
+package com.github.libretube.ui.fragments
import android.os.Bundle
import android.view.LayoutInflater
@@ -7,9 +7,9 @@ import android.view.ViewGroup
import androidx.core.view.size
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
-import com.github.libretube.adapters.DownloadsAdapter
import com.github.libretube.databinding.FragmentDownloadsBinding
import com.github.libretube.extensions.BaseFragment
+import com.github.libretube.ui.adapters.DownloadsAdapter
import com.github.libretube.util.DownloadHelper
class DownloadsFragment : BaseFragment() {
diff --git a/app/src/main/java/com/github/libretube/fragments/HomeFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/HomeFragment.kt
similarity index 96%
rename from app/src/main/java/com/github/libretube/fragments/HomeFragment.kt
rename to app/src/main/java/com/github/libretube/ui/fragments/HomeFragment.kt
index 1ac110440..aea4f99e1 100644
--- a/app/src/main/java/com/github/libretube/fragments/HomeFragment.kt
+++ b/app/src/main/java/com/github/libretube/ui/fragments/HomeFragment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.fragments
+package com.github.libretube.ui.fragments
import android.os.Bundle
import android.util.Log
@@ -10,13 +10,13 @@ import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
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.constants.PreferenceKeys
import com.github.libretube.databinding.FragmentHomeBinding
import com.github.libretube.extensions.BaseFragment
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.PreferenceHelper
import retrofit2.HttpException
diff --git a/app/src/main/java/com/github/libretube/fragments/LibraryFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt
similarity index 97%
rename from app/src/main/java/com/github/libretube/fragments/LibraryFragment.kt
rename to app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt
index 95391b886..b4eb72b19 100644
--- a/app/src/main/java/com/github/libretube/fragments/LibraryFragment.kt
+++ b/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.fragments
+package com.github.libretube.ui.fragments
import android.os.Bundle
import android.util.Log
@@ -12,14 +12,14 @@ import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
-import com.github.libretube.adapters.PlaylistsAdapter
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.databinding.FragmentLibraryBinding
-import com.github.libretube.dialogs.CreatePlaylistDialog
import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG
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 retrofit2.HttpException
import java.io.IOException
diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt
similarity index 98%
rename from app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt
rename to app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt
index 0d2d048cb..7e60fe5bf 100644
--- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt
+++ b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.fragments
+package com.github.libretube.ui.fragments
import android.annotation.SuppressLint
import android.app.ActivityManager
@@ -36,10 +36,6 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.fasterxml.jackson.databind.ObjectMapper
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.RetrofitInstance
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.db.DatabaseHelper
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.TAG
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.interfaces.PlayerOptionsInterface
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.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.BackgroundHelper
import com.github.libretube.util.ImageHelper
@@ -119,7 +115,7 @@ class PlayerFragment : BaseFragment() {
private var playlistId: String? = null
private var isSubscribed: Boolean? = false
private var isLive = false
- private lateinit var streams: Streams
+ private lateinit var streams: com.github.libretube.api.obj.Streams
/**
* for the transition
@@ -141,8 +137,8 @@ class PlayerFragment : BaseFragment() {
*/
private lateinit var exoPlayer: ExoPlayer
private lateinit var trackSelector: DefaultTrackSelector
- private lateinit var segmentData: Segments
- private lateinit var chapters: List
+ private lateinit var segmentData: com.github.libretube.api.obj.Segments
+ private lateinit var chapters: List
/**
* for the player view
@@ -724,7 +720,7 @@ class PlayerFragment : BaseFragment() {
if (!::segmentData.isInitialized || segmentData.segments.isEmpty()) return
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 segmentEnd = (segment.segment[1] * 1000f).toLong()
@@ -922,7 +918,7 @@ class PlayerFragment : BaseFragment() {
}
@SuppressLint("SetTextI18n")
- private fun initializePlayerView(response: Streams) {
+ private fun initializePlayerView(response: com.github.libretube.api.obj.Streams) {
// initialize the player view actions
binding.player.initialize(
childFragmentManager,
@@ -1288,7 +1284,7 @@ class PlayerFragment : BaseFragment() {
}
private fun setStreamSource(
- streams: Streams,
+ streams: com.github.libretube.api.obj.Streams,
videosNameArray: Array,
videosUrlArray: Array
) {
diff --git a/app/src/main/java/com/github/libretube/fragments/PlaylistFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt
similarity index 98%
rename from app/src/main/java/com/github/libretube/fragments/PlaylistFragment.kt
rename to app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt
index 478b64316..daac0ed01 100644
--- a/app/src/main/java/com/github/libretube/fragments/PlaylistFragment.kt
+++ b/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.fragments
+package com.github.libretube.ui.fragments
import android.os.Bundle
import android.util.Log
@@ -10,7 +10,6 @@ import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
-import com.github.libretube.adapters.PlaylistAdapter
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.constants.IntentData
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.toID
import com.github.libretube.sheets.PlaylistOptionsBottomSheet
+import com.github.libretube.ui.adapters.PlaylistAdapter
import retrofit2.HttpException
import java.io.IOException
diff --git a/app/src/main/java/com/github/libretube/fragments/SearchFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/SearchFragment.kt
similarity index 94%
rename from app/src/main/java/com/github/libretube/fragments/SearchFragment.kt
rename to app/src/main/java/com/github/libretube/ui/fragments/SearchFragment.kt
index 14d4356a7..c796f7bc4 100644
--- a/app/src/main/java/com/github/libretube/fragments/SearchFragment.kt
+++ b/app/src/main/java/com/github/libretube/ui/fragments/SearchFragment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.fragments
+package com.github.libretube.ui.fragments
import android.os.Bundle
import android.util.Log
@@ -10,9 +10,6 @@ import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
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.databinding.FragmentSearchBinding
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.await
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 java.io.IOException
diff --git a/app/src/main/java/com/github/libretube/fragments/SearchResultFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/SearchResultFragment.kt
similarity index 97%
rename from app/src/main/java/com/github/libretube/fragments/SearchResultFragment.kt
rename to app/src/main/java/com/github/libretube/ui/fragments/SearchResultFragment.kt
index dbc6a5bf1..413eef6e8 100644
--- a/app/src/main/java/com/github/libretube/fragments/SearchResultFragment.kt
+++ b/app/src/main/java/com/github/libretube/ui/fragments/SearchResultFragment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.fragments
+package com.github.libretube.ui.fragments
import android.os.Bundle
import android.util.Log
@@ -9,8 +9,6 @@ import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
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.constants.PreferenceKeys
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.TAG
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 retrofit2.HttpException
import java.io.IOException
diff --git a/app/src/main/java/com/github/libretube/fragments/SubscriptionsFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/SubscriptionsFragment.kt
similarity index 96%
rename from app/src/main/java/com/github/libretube/fragments/SubscriptionsFragment.kt
rename to app/src/main/java/com/github/libretube/ui/fragments/SubscriptionsFragment.kt
index eb8412763..6eaef2abd 100644
--- a/app/src/main/java/com/github/libretube/fragments/SubscriptionsFragment.kt
+++ b/app/src/main/java/com/github/libretube/ui/fragments/SubscriptionsFragment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.fragments
+package com.github.libretube.ui.fragments
import android.os.Bundle
import android.view.LayoutInflater
@@ -10,15 +10,15 @@ import androidx.fragment.app.activityViewModels
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
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.databinding.FragmentSubscriptionsBinding
import com.github.libretube.extensions.BaseFragment
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.views.BottomSheet
class SubscriptionsFragment : BaseFragment() {
private lateinit var binding: FragmentSubscriptionsBinding
diff --git a/app/src/main/java/com/github/libretube/fragments/WatchHistoryFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/WatchHistoryFragment.kt
similarity index 96%
rename from app/src/main/java/com/github/libretube/fragments/WatchHistoryFragment.kt
rename to app/src/main/java/com/github/libretube/ui/fragments/WatchHistoryFragment.kt
index 967a565a9..3ab9820e0 100644
--- a/app/src/main/java/com/github/libretube/fragments/WatchHistoryFragment.kt
+++ b/app/src/main/java/com/github/libretube/ui/fragments/WatchHistoryFragment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.fragments
+package com.github.libretube.ui.fragments
import android.os.Bundle
import android.view.LayoutInflater
@@ -7,12 +7,12 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
-import com.github.libretube.adapters.WatchHistoryAdapter
import com.github.libretube.databinding.FragmentWatchHistoryBinding
import com.github.libretube.db.DatabaseHolder.Companion.Database
import com.github.libretube.db.obj.WatchHistoryItem
import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.await
+import com.github.libretube.ui.adapters.WatchHistoryAdapter
class WatchHistoryFragment : BaseFragment() {
private lateinit var binding: FragmentWatchHistoryBinding
diff --git a/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/AdvancedSettings.kt
similarity index 95%
rename from app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt
rename to app/src/main/java/com/github/libretube/ui/preferences/AdvancedSettings.kt
index 376e6a5f1..bbf458ee9 100644
--- a/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt
+++ b/app/src/main/java/com/github/libretube/ui/preferences/AdvancedSettings.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.preferences
+package com.github.libretube.ui.preferences
import android.net.Uri
import android.os.Bundle
@@ -8,14 +8,14 @@ import androidx.activity.result.contract.ActivityResultContracts.CreateDocument
import androidx.preference.ListPreference
import androidx.preference.Preference
import com.github.libretube.R
-import com.github.libretube.activities.SettingsActivity
import com.github.libretube.constants.PreferenceKeys
-import com.github.libretube.dialogs.BackupDialog
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.ImageHelper
import com.github.libretube.util.PreferenceHelper
-import com.github.libretube.views.MaterialPreferenceFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
class AdvancedSettings : MaterialPreferenceFragment() {
diff --git a/app/src/main/java/com/github/libretube/preferences/AppearanceSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/AppearanceSettings.kt
similarity index 95%
rename from app/src/main/java/com/github/libretube/preferences/AppearanceSettings.kt
rename to app/src/main/java/com/github/libretube/ui/preferences/AppearanceSettings.kt
index 4299bcd34..16219cc42 100644
--- a/app/src/main/java/com/github/libretube/preferences/AppearanceSettings.kt
+++ b/app/src/main/java/com/github/libretube/ui/preferences/AppearanceSettings.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.preferences
+package com.github.libretube.ui.preferences
import android.content.ActivityNotFoundException
import android.content.Intent
@@ -9,12 +9,12 @@ import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.SwitchPreferenceCompat
import com.github.libretube.R
-import com.github.libretube.activities.SettingsActivity
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.ThemeHelper
-import com.github.libretube.views.MaterialPreferenceFragment
import com.google.android.material.color.DynamicColors
class AppearanceSettings : MaterialPreferenceFragment() {
diff --git a/app/src/main/java/com/github/libretube/preferences/AudioVideoSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/AudioVideoSettings.kt
similarity index 71%
rename from app/src/main/java/com/github/libretube/preferences/AudioVideoSettings.kt
rename to app/src/main/java/com/github/libretube/ui/preferences/AudioVideoSettings.kt
index 757d92669..3c92ca802 100644
--- a/app/src/main/java/com/github/libretube/preferences/AudioVideoSettings.kt
+++ b/app/src/main/java/com/github/libretube/ui/preferences/AudioVideoSettings.kt
@@ -1,9 +1,9 @@
-package com.github.libretube.preferences
+package com.github.libretube.ui.preferences
import android.os.Bundle
import com.github.libretube.R
-import com.github.libretube.activities.SettingsActivity
-import com.github.libretube.views.MaterialPreferenceFragment
+import com.github.libretube.ui.activities.SettingsActivity
+import com.github.libretube.ui.views.MaterialPreferenceFragment
class AudioVideoSettings : MaterialPreferenceFragment() {
diff --git a/app/src/main/java/com/github/libretube/preferences/GeneralSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/GeneralSettings.kt
similarity index 88%
rename from app/src/main/java/com/github/libretube/preferences/GeneralSettings.kt
rename to app/src/main/java/com/github/libretube/ui/preferences/GeneralSettings.kt
index b9bc731a4..75ddf94ce 100644
--- a/app/src/main/java/com/github/libretube/preferences/GeneralSettings.kt
+++ b/app/src/main/java/com/github/libretube/ui/preferences/GeneralSettings.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.preferences
+package com.github.libretube.ui.preferences
import android.os.Bundle
import androidx.preference.EditTextPreference
@@ -6,12 +6,12 @@ import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.SwitchPreferenceCompat
import com.github.libretube.R
-import com.github.libretube.activities.SettingsActivity
import com.github.libretube.constants.PreferenceKeys
-import com.github.libretube.dialogs.NavBarOptionsDialog
-import com.github.libretube.dialogs.RequireRestartDialog
+import com.github.libretube.ui.activities.SettingsActivity
+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.views.MaterialPreferenceFragment
class GeneralSettings : MaterialPreferenceFragment() {
diff --git a/app/src/main/java/com/github/libretube/preferences/HistorySettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/HistorySettings.kt
similarity index 92%
rename from app/src/main/java/com/github/libretube/preferences/HistorySettings.kt
rename to app/src/main/java/com/github/libretube/ui/preferences/HistorySettings.kt
index f89a827b4..04eb1fb4b 100644
--- a/app/src/main/java/com/github/libretube/preferences/HistorySettings.kt
+++ b/app/src/main/java/com/github/libretube/ui/preferences/HistorySettings.kt
@@ -1,12 +1,12 @@
-package com.github.libretube.preferences
+package com.github.libretube.ui.preferences
import android.os.Bundle
import androidx.preference.Preference
import com.github.libretube.R
-import com.github.libretube.activities.SettingsActivity
import com.github.libretube.constants.PreferenceKeys
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
class HistorySettings : MaterialPreferenceFragment() {
diff --git a/app/src/main/java/com/github/libretube/preferences/InstanceSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt
similarity index 95%
rename from app/src/main/java/com/github/libretube/preferences/InstanceSettings.kt
rename to app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt
index b90a24854..ccd1a029c 100644
--- a/app/src/main/java/com/github/libretube/preferences/InstanceSettings.kt
+++ b/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.preferences
+package com.github.libretube.ui.preferences
import android.net.Uri
import android.os.Bundle
@@ -12,19 +12,19 @@ import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.SwitchPreferenceCompat
import com.github.libretube.R
-import com.github.libretube.activities.SettingsActivity
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.db.DatabaseHolder.Companion.Database
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.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.PreferenceHelper
-import com.github.libretube.views.MaterialPreferenceFragment
class InstanceSettings : MaterialPreferenceFragment() {
diff --git a/app/src/main/java/com/github/libretube/preferences/MainSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/MainSettings.kt
similarity index 95%
rename from app/src/main/java/com/github/libretube/preferences/MainSettings.kt
rename to app/src/main/java/com/github/libretube/ui/preferences/MainSettings.kt
index 5a1dcd500..34502f460 100644
--- a/app/src/main/java/com/github/libretube/preferences/MainSettings.kt
+++ b/app/src/main/java/com/github/libretube/ui/preferences/MainSettings.kt
@@ -1,16 +1,16 @@
-package com.github.libretube.preferences
+package com.github.libretube.ui.preferences
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.preference.Preference
import com.github.libretube.BuildConfig
import com.github.libretube.R
-import com.github.libretube.activities.SettingsActivity
import com.github.libretube.api.RetrofitInstance
-import com.github.libretube.dialogs.UpdateDialog
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.views.MaterialPreferenceFragment
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
diff --git a/app/src/main/java/com/github/libretube/preferences/NotificationSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/NotificationSettings.kt
similarity index 91%
rename from app/src/main/java/com/github/libretube/preferences/NotificationSettings.kt
rename to app/src/main/java/com/github/libretube/ui/preferences/NotificationSettings.kt
index 0feaf5ed5..8e87f58de 100644
--- a/app/src/main/java/com/github/libretube/preferences/NotificationSettings.kt
+++ b/app/src/main/java/com/github/libretube/ui/preferences/NotificationSettings.kt
@@ -1,14 +1,14 @@
-package com.github.libretube.preferences
+package com.github.libretube.ui.preferences
import android.os.Bundle
import androidx.preference.ListPreference
import androidx.preference.SwitchPreferenceCompat
import androidx.work.ExistingPeriodicWorkPolicy
import com.github.libretube.R
-import com.github.libretube.activities.SettingsActivity
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.views.MaterialPreferenceFragment
class NotificationSettings : MaterialPreferenceFragment() {
diff --git a/app/src/main/java/com/github/libretube/preferences/PlayerSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/PlayerSettings.kt
similarity index 92%
rename from app/src/main/java/com/github/libretube/preferences/PlayerSettings.kt
rename to app/src/main/java/com/github/libretube/ui/preferences/PlayerSettings.kt
index aaa869e0f..cba39cd54 100644
--- a/app/src/main/java/com/github/libretube/preferences/PlayerSettings.kt
+++ b/app/src/main/java/com/github/libretube/ui/preferences/PlayerSettings.kt
@@ -1,14 +1,14 @@
-package com.github.libretube.preferences
+package com.github.libretube.ui.preferences
import android.os.Bundle
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.SwitchPreferenceCompat
import com.github.libretube.R
-import com.github.libretube.activities.SettingsActivity
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.views.MaterialPreferenceFragment
import java.util.*
class PlayerSettings : MaterialPreferenceFragment() {
diff --git a/app/src/main/java/com/github/libretube/preferences/SponsorBlockSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/SponsorBlockSettings.kt
similarity index 71%
rename from app/src/main/java/com/github/libretube/preferences/SponsorBlockSettings.kt
rename to app/src/main/java/com/github/libretube/ui/preferences/SponsorBlockSettings.kt
index 511880d9f..eccd7a290 100644
--- a/app/src/main/java/com/github/libretube/preferences/SponsorBlockSettings.kt
+++ b/app/src/main/java/com/github/libretube/ui/preferences/SponsorBlockSettings.kt
@@ -1,9 +1,9 @@
-package com.github.libretube.preferences
+package com.github.libretube.ui.preferences
import android.os.Bundle
import com.github.libretube.R
-import com.github.libretube.activities.SettingsActivity
-import com.github.libretube.views.MaterialPreferenceFragment
+import com.github.libretube.ui.activities.SettingsActivity
+import com.github.libretube.ui.views.MaterialPreferenceFragment
class SponsorBlockSettings : MaterialPreferenceFragment() {
diff --git a/app/src/main/java/com/github/libretube/views/BottomSheet.kt b/app/src/main/java/com/github/libretube/ui/views/BottomSheet.kt
similarity index 94%
rename from app/src/main/java/com/github/libretube/views/BottomSheet.kt
rename to app/src/main/java/com/github/libretube/ui/views/BottomSheet.kt
index b0e99b1a4..8838c0337 100644
--- a/app/src/main/java/com/github/libretube/views/BottomSheet.kt
+++ b/app/src/main/java/com/github/libretube/ui/views/BottomSheet.kt
@@ -1,13 +1,13 @@
-package com.github.libretube.views
+package com.github.libretube.ui.views
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
-import com.github.libretube.adapters.BottomSheetAdapter
import com.github.libretube.databinding.BottomSheetBinding
import com.github.libretube.obj.BottomSheetItem
+import com.github.libretube.ui.adapters.BottomSheetAdapter
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
open class BottomSheet : BottomSheetDialogFragment() {
diff --git a/app/src/main/java/com/github/libretube/views/CustomExoPlayerView.kt b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt
similarity index 99%
rename from app/src/main/java/com/github/libretube/views/CustomExoPlayerView.kt
rename to app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt
index adfe27c03..6c5e91b24 100644
--- a/app/src/main/java/com/github/libretube/views/CustomExoPlayerView.kt
+++ b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.views
+package com.github.libretube.ui.views
import android.annotation.SuppressLint
import android.content.Context
@@ -10,7 +10,6 @@ import android.view.MotionEvent
import android.view.View
import androidx.fragment.app.FragmentManager
import com.github.libretube.R
-import com.github.libretube.activities.MainActivity
import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.constants.PreferenceRanges
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.PlayerOptionsInterface
import com.github.libretube.obj.BottomSheetItem
+import com.github.libretube.ui.activities.MainActivity
import com.github.libretube.util.DoubleTapListener
import com.github.libretube.util.PreferenceHelper
import com.google.android.exoplayer2.trackselection.TrackSelector
diff --git a/app/src/main/java/com/github/libretube/views/CustomSwipeToRefresh.kt b/app/src/main/java/com/github/libretube/ui/views/CustomSwipeToRefresh.kt
similarity index 96%
rename from app/src/main/java/com/github/libretube/views/CustomSwipeToRefresh.kt
rename to app/src/main/java/com/github/libretube/ui/views/CustomSwipeToRefresh.kt
index 96476579c..13a2ac5db 100644
--- a/app/src/main/java/com/github/libretube/views/CustomSwipeToRefresh.kt
+++ b/app/src/main/java/com/github/libretube/ui/views/CustomSwipeToRefresh.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.views
+package com.github.libretube.ui.views
import android.content.Context
import android.util.AttributeSet
diff --git a/app/src/main/java/com/github/libretube/views/DoubleTapOverlay.kt b/app/src/main/java/com/github/libretube/ui/views/DoubleTapOverlay.kt
similarity index 93%
rename from app/src/main/java/com/github/libretube/views/DoubleTapOverlay.kt
rename to app/src/main/java/com/github/libretube/ui/views/DoubleTapOverlay.kt
index bdd2a3fcb..1c98462ff 100644
--- a/app/src/main/java/com/github/libretube/views/DoubleTapOverlay.kt
+++ b/app/src/main/java/com/github/libretube/ui/views/DoubleTapOverlay.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.views
+package com.github.libretube.ui.views
import android.content.Context
import android.util.AttributeSet
diff --git a/app/src/main/java/com/github/libretube/views/MaterialPreferenceFragment.kt b/app/src/main/java/com/github/libretube/ui/views/MaterialPreferenceFragment.kt
similarity index 98%
rename from app/src/main/java/com/github/libretube/views/MaterialPreferenceFragment.kt
rename to app/src/main/java/com/github/libretube/ui/views/MaterialPreferenceFragment.kt
index 98838be28..01abb2ea0 100644
--- a/app/src/main/java/com/github/libretube/views/MaterialPreferenceFragment.kt
+++ b/app/src/main/java/com/github/libretube/ui/views/MaterialPreferenceFragment.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.views
+package com.github.libretube.ui.views
import android.os.Bundle
import androidx.preference.EditTextPreference
diff --git a/app/src/main/java/com/github/libretube/views/SingleViewTouchableMotionLayout.kt b/app/src/main/java/com/github/libretube/ui/views/SingleViewTouchableMotionLayout.kt
similarity index 98%
rename from app/src/main/java/com/github/libretube/views/SingleViewTouchableMotionLayout.kt
rename to app/src/main/java/com/github/libretube/ui/views/SingleViewTouchableMotionLayout.kt
index 51d2871d0..28249ef69 100644
--- a/app/src/main/java/com/github/libretube/views/SingleViewTouchableMotionLayout.kt
+++ b/app/src/main/java/com/github/libretube/ui/views/SingleViewTouchableMotionLayout.kt
@@ -1,4 +1,4 @@
-package com.github.libretube.views
+package com.github.libretube.ui.views
import android.annotation.SuppressLint
import android.content.Context
diff --git a/app/src/main/java/com/github/libretube/util/AutoPlayHelper.kt b/app/src/main/java/com/github/libretube/util/AutoPlayHelper.kt
index af2084374..4eaeffdce 100644
--- a/app/src/main/java/com/github/libretube/util/AutoPlayHelper.kt
+++ b/app/src/main/java/com/github/libretube/util/AutoPlayHelper.kt
@@ -1,8 +1,8 @@
package com.github.libretube.util
import com.github.libretube.api.RetrofitInstance
+import com.github.libretube.api.obj.StreamItem
import com.github.libretube.extensions.toID
-import com.github.libretube.obj.StreamItem
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
@@ -18,7 +18,7 @@ class AutoPlayHelper(
*/
suspend fun getNextVideoId(
currentVideoId: String,
- relatedStreams: List?
+ relatedStreams: List?
): String? {
return if (playlistId == null) {
getNextTrendingVideoId(
@@ -35,7 +35,7 @@ class AutoPlayHelper(
* get the id of the next related video
*/
private fun getNextTrendingVideoId(
- relatedStreams: List?
+ relatedStreams: List?
): String? {
// don't play a video if it got played before already
if (relatedStreams == null || relatedStreams.isEmpty()) return null
diff --git a/app/src/main/java/com/github/libretube/util/NavigationHelper.kt b/app/src/main/java/com/github/libretube/util/NavigationHelper.kt
index 0450a41e1..125ac01c2 100644
--- a/app/src/main/java/com/github/libretube/util/NavigationHelper.kt
+++ b/app/src/main/java/com/github/libretube/util/NavigationHelper.kt
@@ -5,10 +5,10 @@ import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.os.bundleOf
import com.github.libretube.R
-import com.github.libretube.activities.MainActivity
import com.github.libretube.constants.IntentData
import com.github.libretube.extensions.toID
-import com.github.libretube.fragments.PlayerFragment
+import com.github.libretube.ui.activities.MainActivity
+import com.github.libretube.ui.fragments.PlayerFragment
object NavigationHelper {
fun navigateChannel(
diff --git a/app/src/main/java/com/github/libretube/util/NotificationHelper.kt b/app/src/main/java/com/github/libretube/util/NotificationHelper.kt
index c8b2e9369..7780cfbb0 100644
--- a/app/src/main/java/com/github/libretube/util/NotificationHelper.kt
+++ b/app/src/main/java/com/github/libretube/util/NotificationHelper.kt
@@ -13,13 +13,13 @@ import androidx.work.NetworkType
import androidx.work.PeriodicWorkRequest
import androidx.work.WorkManager
import com.github.libretube.R
-import com.github.libretube.activities.MainActivity
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.SubscriptionHelper
import com.github.libretube.constants.NOTIFICATION_WORK_NAME
import com.github.libretube.constants.PUSH_CHANNEL_ID
import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.extensions.toID
+import com.github.libretube.ui.activities.MainActivity
import kotlinx.coroutines.async
import kotlinx.coroutines.runBlocking
import java.util.concurrent.TimeUnit
diff --git a/app/src/main/java/com/github/libretube/util/NowPlayingNotification.kt b/app/src/main/java/com/github/libretube/util/NowPlayingNotification.kt
index 25aec4703..9cce6ee5d 100644
--- a/app/src/main/java/com/github/libretube/util/NowPlayingNotification.kt
+++ b/app/src/main/java/com/github/libretube/util/NowPlayingNotification.kt
@@ -9,10 +9,9 @@ import android.graphics.drawable.BitmapDrawable
import android.os.Build
import android.support.v4.media.session.MediaSessionCompat
import coil.request.ImageRequest
-import com.github.libretube.activities.MainActivity
import com.github.libretube.constants.BACKGROUND_CHANNEL_ID
import com.github.libretube.constants.PLAYER_NOTIFICATION_ID
-import com.github.libretube.obj.Streams
+import com.github.libretube.ui.activities.MainActivity
import com.google.android.exoplayer2.ExoPlayer
import com.google.android.exoplayer2.Player
import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector
@@ -22,7 +21,7 @@ class NowPlayingNotification(
private val context: Context,
private val player: ExoPlayer
) {
- private var streams: Streams? = null
+ private var streams: com.github.libretube.api.obj.Streams? = null
/**
* The [MediaSessionCompat] for the [streams].
@@ -122,7 +121,7 @@ class NowPlayingNotification(
* Updates or creates the [playerNotification]
*/
fun updatePlayerNotification(
- streams: Streams
+ streams: com.github.libretube.api.obj.Streams
) {
this.streams = streams
if (playerNotification == null) {
diff --git a/app/src/main/java/com/github/libretube/util/PlayerHelper.kt b/app/src/main/java/com/github/libretube/util/PlayerHelper.kt
index ae8401768..6efdba774 100644
--- a/app/src/main/java/com/github/libretube/util/PlayerHelper.kt
+++ b/app/src/main/java/com/github/libretube/util/PlayerHelper.kt
@@ -2,13 +2,13 @@ package com.github.libretube.util
import android.content.Context
import android.view.accessibility.CaptioningManager
+import com.github.libretube.api.obj.PipedStream
import com.github.libretube.constants.PreferenceKeys
-import com.github.libretube.obj.PipedStream
import com.google.android.exoplayer2.ui.CaptionStyleCompat
object PlayerHelper {
// get the audio source following the users preferences
- fun getAudioSource(context: Context, audios: List): String {
+ fun getAudioSource(context: Context, audios: List): String {
val audioFormat = PreferenceHelper.getString(PreferenceKeys.PLAYER_AUDIO_FORMAT, "all")
val audioQuality = if (
NetworkHelper.isNetworkMobile(context)
@@ -34,7 +34,7 @@ object PlayerHelper {
}
// get the best bit rate from audio streams
- private fun getMostBitRate(audios: List): String {
+ private fun getMostBitRate(audios: List): String {
var bitrate = 0
var audioUrl = ""
audios.forEach {
@@ -47,7 +47,7 @@ object PlayerHelper {
}
// get the best bit rate from audio streams
- private fun getLeastBitRate(audios: List): String {
+ private fun getLeastBitRate(audios: List): String {
var bitrate = 1000000000
var audioUrl = ""
audios.forEach {
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 43ea01a21..11b3b443e 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutDescription="@xml/activity_main_scene"
- tools:context=".activities.MainActivity">
+ tools:context=".ui.activities.MainActivity">
-
-
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_channel.xml b/app/src/main/res/layout/fragment_channel.xml
index 9090cfcd8..e3028d0d8 100644
--- a/app/src/main/res/layout/fragment_channel.xml
+++ b/app/src/main/res/layout/fragment_channel.xml
@@ -1,5 +1,5 @@
-
+ tools:context=".ui.fragments.ChannelFragment">
-
+
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
index 4b859beac..31af0267b 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".fragments.HomeFragment">
+ tools:context=".ui.fragments.HomeFragment">
+ tools:context=".ui.fragments.LibraryFragment">
-
@@ -113,7 +113,7 @@
-
+
-
+ tools:context=".ui.fragments.PlayerFragment">
-
-
-
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_playlist.xml b/app/src/main/res/layout/fragment_playlist.xml
index 821883788..c39957aa3 100644
--- a/app/src/main/res/layout/fragment_playlist.xml
+++ b/app/src/main/res/layout/fragment_playlist.xml
@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".fragments.PlaylistFragment">
+ tools:context=".ui.fragments.PlaylistFragment">
+ tools:context=".ui.fragments.SearchFragment">
+ tools:context=".ui.fragments.SearchFragment">
+ tools:context=".ui.fragments.SubscriptionsFragment">
-
@@ -144,5 +144,5 @@
-
+
diff --git a/app/src/main/res/navigation/nav.xml b/app/src/main/res/navigation/nav.xml
index d8ea003e1..1b311537d 100644
--- a/app/src/main/res/navigation/nav.xml
+++ b/app/src/main/res/navigation/nav.xml
@@ -7,47 +7,47 @@
\ No newline at end of file