Count videos added

This commit is contained in:
ivan agosto 2019-02-10 12:10:52 -06:00
parent d783b4887d
commit 4347831907
3 changed files with 16 additions and 11 deletions

View File

@ -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","")

View File

@ -92,8 +92,9 @@ class Videos: Client() {
return videos
}
private fun getVideos(start:Int, count:Int, sort:String = "-publishedAt", filter:String = ""):ArrayList<VideoModel>{
private fun getVideos(start:Int, sort:String = "-publishedAt", filter:String = ""):ArrayList<VideoModel>{
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<VideoModel>{
return this.getVideos(start, count)
fun getLastVideos(start:Int = 0): ArrayList<VideoModel>{
return this.getVideos(start)
}
fun getPopularVideos(start:Int = 0, count:Int = 30): ArrayList<VideoModel>{
return this.getVideos(start, count,"-views")
fun getPopularVideos(start:Int = 0): ArrayList<VideoModel>{
return this.getVideos(start,"-views")
}
fun getLocalVideos(start:Int = 0, count:Int = 30): ArrayList<VideoModel>{
return this.getVideos(start, count,"-publishedAt", "local")
fun getLocalVideos(start:Int = 0): ArrayList<VideoModel>{
return this.getVideos(start,"-publishedAt", "local")
}
fun myVideos(token: String, start: Int = 0, count: Int = 30): ArrayList<VideoModel>{
fun myVideos(token: String, start: Int = 0): ArrayList<VideoModel>{
val count = ManagerSingleton.videos_count
val params = "start=$start&count=$count"
var con=this._newCon("users/me/videos?$params","GET", token)
var videos = arrayListOf<VideoModel>()
@ -139,7 +141,8 @@ class Videos: Client() {
return videos
}
fun videoSubscriptions(token: String, start: Int = 0, count: Int = 30): ArrayList<VideoModel>{
fun videoSubscriptions(token: String, start: Int = 0): ArrayList<VideoModel>{
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<VideoModel>()
@ -155,7 +158,8 @@ class Videos: Client() {
return videos
}
fun search(text: String, start: Int = 0, count: Int = 30): ArrayList<VideoModel>{
fun search(text: String, start: Int = 0): ArrayList<VideoModel>{
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")

View File

@ -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" />