diff --git a/app/src/main/java/org/libre/agosto/p2play/SplashActivity.kt b/app/src/main/java/org/libre/agosto/p2play/SplashActivity.kt index cf3e2db..d5bca99 100644 --- a/app/src/main/java/org/libre/agosto/p2play/SplashActivity.kt +++ b/app/src/main/java/org/libre/agosto/p2play/SplashActivity.kt @@ -25,7 +25,7 @@ class SplashActivity : AppCompatActivity() { settings = PreferenceManager.getDefaultSharedPreferences(this) ManagerSingleton.nfsw = settings.getBoolean("show_nfsw", false) - ManagerSingleton.videos_count = settings.getInt("videos_count", 15) + ManagerSingleton.videos_count = settings.getString("videos_count", "15").toInt() val host = settings.getString("hostP2play","") diff --git a/app/src/main/java/org/libre/agosto/p2play/ajax/Videos.kt b/app/src/main/java/org/libre/agosto/p2play/ajax/Videos.kt index 86c518b..795b8f6 100644 --- a/app/src/main/java/org/libre/agosto/p2play/ajax/Videos.kt +++ b/app/src/main/java/org/libre/agosto/p2play/ajax/Videos.kt @@ -92,8 +92,9 @@ class Videos: Client() { return videos } - private fun getVideos(start:Int, count:Int, sort:String = "-publishedAt", filter:String = ""):ArrayList{ + private fun getVideos(start:Int, sort:String = "-publishedAt", filter:String = ""):ArrayList{ val nsfw = ManagerSingleton.nfsw + val count = ManagerSingleton.videos_count var params = "start=$start&count=$count&sort=$sort&nsfw=$nsfw" if(filter != "") params+="&filter=$filter" @@ -111,19 +112,20 @@ class Videos: Client() { return videos } - fun getLastVideos(start:Int = 0, count:Int = 30): ArrayList{ - return this.getVideos(start, count) + fun getLastVideos(start:Int = 0): ArrayList{ + return this.getVideos(start) } - fun getPopularVideos(start:Int = 0, count:Int = 30): ArrayList{ - return this.getVideos(start, count,"-views") + fun getPopularVideos(start:Int = 0): ArrayList{ + return this.getVideos(start,"-views") } - fun getLocalVideos(start:Int = 0, count:Int = 30): ArrayList{ - return this.getVideos(start, count,"-publishedAt", "local") + fun getLocalVideos(start:Int = 0): ArrayList{ + return this.getVideos(start,"-publishedAt", "local") } - fun myVideos(token: String, start: Int = 0, count: Int = 30): ArrayList{ + fun myVideos(token: String, start: Int = 0): ArrayList{ + val count = ManagerSingleton.videos_count val params = "start=$start&count=$count" var con=this._newCon("users/me/videos?$params","GET", token) var videos = arrayListOf() @@ -139,7 +141,8 @@ class Videos: Client() { return videos } - fun videoSubscriptions(token: String, start: Int = 0, count: Int = 30): ArrayList{ + fun videoSubscriptions(token: String, start: Int = 0): ArrayList{ + val count = ManagerSingleton.videos_count val params = "start=$start&count=$count" var con=this._newCon("users/me/subscriptions/videos?$params","GET", token) var videos = arrayListOf() @@ -155,7 +158,8 @@ class Videos: Client() { return videos } - fun search(text: String, start: Int = 0, count: Int = 30): ArrayList{ + fun search(text: String, start: Int = 0): ArrayList{ + val count = ManagerSingleton.videos_count val nsfw = ManagerSingleton.nfsw val params = "search=$text&start=$start&count=$count&nsfw=$nsfw" var con=this._newCon("search/videos?$params","GET") diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index a61d8a6..d4750d9 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -18,6 +18,7 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" + android:background="@android:color/darker_gray" android:fitsSystemWindows="true" app:headerLayout="@layout/nav_header_main" app:menu="@menu/activity_main_drawer" />