Trending videos added
This commit is contained in:
parent
d680eb77b8
commit
90f2ab6e7d
|
@ -60,7 +60,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||||
// Init RecyclerView
|
// Init RecyclerView
|
||||||
this.initRecycler()
|
this.initRecycler()
|
||||||
|
|
||||||
this.getLastVideos()
|
this.getTrengindVideos()
|
||||||
|
|
||||||
swipeContainer.setOnRefreshListener {
|
swipeContainer.setOnRefreshListener {
|
||||||
this.refresh()
|
this.refresh()
|
||||||
|
@ -127,6 +127,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||||
when(section){
|
when(section){
|
||||||
"local" -> this.getLocalVideos()
|
"local" -> this.getLocalVideos()
|
||||||
"popular" -> this.getPopularVideos()
|
"popular" -> this.getPopularVideos()
|
||||||
|
"trending" -> this.getTrengindVideos()
|
||||||
"last" -> this.getLastVideos()
|
"last" -> this.getLastVideos()
|
||||||
"sub" -> this.getSubscriptionVideos()
|
"sub" -> this.getSubscriptionVideos()
|
||||||
"search" -> this.searchVideos()
|
"search" -> this.searchVideos()
|
||||||
|
@ -182,6 +183,19 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Trending videos
|
||||||
|
private fun getTrengindVideos(){
|
||||||
|
swipeContainer.isRefreshing = true
|
||||||
|
section = "trending"
|
||||||
|
setTitle(R.string.title_trending)
|
||||||
|
AsyncTask.execute {
|
||||||
|
val videos = client.getTrendingVideos(this.pagination)
|
||||||
|
runOnUiThread {
|
||||||
|
this.addVideos(videos)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Local videos
|
// Local videos
|
||||||
private fun getLocalVideos(){
|
private fun getLocalVideos(){
|
||||||
swipeContainer.isRefreshing = true
|
swipeContainer.isRefreshing = true
|
||||||
|
@ -286,18 +300,11 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||||
|
|
||||||
// item.isChecked = true
|
// item.isChecked = true
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.nav_subscriptions->{
|
R.id.nav_subscriptions -> getSubscriptionVideos()
|
||||||
getSubscriptionVideos()
|
R.id.nav_popular -> getPopularVideos()
|
||||||
}
|
R.id.nav_trending -> getTrengindVideos()
|
||||||
R.id.nav_popular-> {
|
R.id.nav_recent -> getLastVideos()
|
||||||
getPopularVideos()
|
R.id.nav_local -> getLocalVideos()
|
||||||
}
|
|
||||||
R.id.nav_recent-> {
|
|
||||||
getLastVideos()
|
|
||||||
}
|
|
||||||
R.id.nav_local-> {
|
|
||||||
getLocalVideos()
|
|
||||||
}
|
|
||||||
R.id.nav_about -> {
|
R.id.nav_about -> {
|
||||||
val intent = Intent(this, AboutActivity::class.java)
|
val intent = Intent(this, AboutActivity::class.java)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
|
@ -320,6 +327,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||||
if(ManagerSingleton.user.avatar!="" && side_imageView != null)
|
if(ManagerSingleton.user.avatar!="" && side_imageView != null)
|
||||||
Picasso.get().load("https://"+ManagerSingleton.url+ManagerSingleton.user.avatar).into(side_imageView)
|
Picasso.get().load("https://"+ManagerSingleton.url+ManagerSingleton.user.avatar).into(side_imageView)
|
||||||
side_imageView?.setOnClickListener {
|
side_imageView?.setOnClickListener {
|
||||||
|
pagination = 0
|
||||||
getMyVideos()
|
getMyVideos()
|
||||||
drawer_layout.closeDrawer(GravityCompat.START)
|
drawer_layout.closeDrawer(GravityCompat.START)
|
||||||
}
|
}
|
||||||
|
@ -355,6 +363,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||||
when(section){
|
when(section){
|
||||||
"local" -> this.getLocalVideos()
|
"local" -> this.getLocalVideos()
|
||||||
"popular" -> this.getPopularVideos()
|
"popular" -> this.getPopularVideos()
|
||||||
|
"trending" -> this.getTrengindVideos()
|
||||||
"last" -> this.getLastVideos()
|
"last" -> this.getLastVideos()
|
||||||
"sub" -> this.getSubscriptionVideos()
|
"sub" -> this.getSubscriptionVideos()
|
||||||
"search" -> this.searchVideos()
|
"search" -> this.searchVideos()
|
||||||
|
|
|
@ -119,6 +119,10 @@ class Videos: Client() {
|
||||||
return this.getVideos(start,"-views")
|
return this.getVideos(start,"-views")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getTrendingVideos(start:Int = 0): ArrayList<VideoModel>{
|
||||||
|
return this.getVideos(start,"-trending")
|
||||||
|
}
|
||||||
|
|
||||||
fun getLocalVideos(start:Int = 0): ArrayList<VideoModel>{
|
fun getLocalVideos(start:Int = 0): ArrayList<VideoModel>{
|
||||||
return this.getVideos(start,"-publishedAt", "local")
|
return this.getVideos(start,"-publishedAt", "local")
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M16,6l2.29,2.29 -4.88,4.88 -4,-4L2,16.59 3.41,18l6,-6 4,4 6.3,-6.29L22,12V6z"/>
|
||||||
|
</vector>
|
|
@ -16,6 +16,10 @@
|
||||||
android:id="@+id/nav_popular"
|
android:id="@+id/nav_popular"
|
||||||
android:icon="@android:drawable/btn_star"
|
android:icon="@android:drawable/btn_star"
|
||||||
android:title="@string/nav_popular" />
|
android:title="@string/nav_popular" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/nav_trending"
|
||||||
|
android:icon="@drawable/ic_trending_up_black_24dp"
|
||||||
|
android:title="@string/nav_trending" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_recent"
|
android:id="@+id/nav_recent"
|
||||||
android:icon="@drawable/ic_add_circle_black_24dp"
|
android:icon="@drawable/ic_add_circle_black_24dp"
|
||||||
|
|
|
@ -92,6 +92,8 @@
|
||||||
<string name="pref_message_exit">Reinicia para aplicar los cambios</string>
|
<string name="pref_message_exit">Reinicia para aplicar los cambios</string>
|
||||||
<string name="pref_videos_count_title">Videos por pagina</string>
|
<string name="pref_videos_count_title">Videos por pagina</string>
|
||||||
<string name="showMore">Mostrar mas</string>
|
<string name="showMore">Mostrar mas</string>
|
||||||
|
<string name="nav_trending">Tendencias</string>
|
||||||
|
<string name="title_trending">Tendencias</string>
|
||||||
<!-- End Settings strings -->
|
<!-- End Settings strings -->
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -48,8 +48,9 @@
|
||||||
<!-- End Login strings -->
|
<!-- End Login strings -->
|
||||||
<!-- Start Main strings -->
|
<!-- Start Main strings -->
|
||||||
<string name="title_subscriptions">Subscriptions</string>
|
<string name="title_subscriptions">Subscriptions</string>
|
||||||
<string name="title_recent">Recent videos</string>
|
<string name="title_recent">Recent</string>
|
||||||
<string name="title_popular">Popular videos</string>
|
<string name="title_popular">Popular</string>
|
||||||
|
<string name="title_trending">Trending</string>
|
||||||
<string name="title_local">Local videos</string>
|
<string name="title_local">Local videos</string>
|
||||||
<string name="title_myVideos">My videos</string>
|
<string name="title_myVideos">My videos</string>
|
||||||
<string name="view_text">views</string>
|
<string name="view_text">views</string>
|
||||||
|
@ -64,6 +65,7 @@
|
||||||
<!-- Start Menu strings -->
|
<!-- Start Menu strings -->
|
||||||
<string name="nav_subscriptions">Subscriptions</string>
|
<string name="nav_subscriptions">Subscriptions</string>
|
||||||
<string name="nav_popular">Popular</string>
|
<string name="nav_popular">Popular</string>
|
||||||
|
<string name="nav_trending">Trending</string>
|
||||||
<string name="nav_recent">Recent</string>
|
<string name="nav_recent">Recent</string>
|
||||||
<string name="nav_local">Local</string>
|
<string name="nav_local">Local</string>
|
||||||
<string name="nav_about">About</string>
|
<string name="nav_about">About</string>
|
||||||
|
|
Loading…
Reference in New Issue