Most liked videos
This commit is contained in:
parent
390b1a7add
commit
a66acfbcea
|
@ -235,10 +235,27 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Most liked
|
||||||
|
private fun getMostLiked(){
|
||||||
|
swipeContainer.isRefreshing = true
|
||||||
|
section = "liked"
|
||||||
|
setTitle(R.string.nav_likes)
|
||||||
|
AsyncTask.execute {
|
||||||
|
val videos = client.getMostLikedVideos(this.pagination)
|
||||||
|
runOnUiThread {
|
||||||
|
this.addVideos(videos)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
if (drawer_layout.isDrawerOpen(GravityCompat.START)) {
|
if (drawer_layout.isDrawerOpen(GravityCompat.START)) {
|
||||||
drawer_layout.closeDrawer(GravityCompat.START)
|
drawer_layout.closeDrawer(GravityCompat.START)
|
||||||
} else {
|
}
|
||||||
|
else if(!section.equals("trending")) {
|
||||||
|
this.getTrengindVideos()
|
||||||
|
}
|
||||||
|
else {
|
||||||
super.onBackPressed()
|
super.onBackPressed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,6 +341,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||||
}
|
}
|
||||||
R.id.nav_history -> getHistory()
|
R.id.nav_history -> getHistory()
|
||||||
R.id.nav_myVideos -> getMyVideos()
|
R.id.nav_myVideos -> getMyVideos()
|
||||||
|
R.id.nav_likes -> getMostLiked()
|
||||||
}
|
}
|
||||||
|
|
||||||
drawer_layout.closeDrawer(GravityCompat.START)
|
drawer_layout.closeDrawer(GravityCompat.START)
|
||||||
|
@ -392,6 +410,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||||
else
|
else
|
||||||
this.getLastVideos()
|
this.getLastVideos()
|
||||||
}
|
}
|
||||||
|
"liked" -> this.getMostLiked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.libre.agosto.p2play.models.VideoModel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Suppress("NAME_SHADOWING")
|
||||||
class ReproductorActivity : AppCompatActivity() {
|
class ReproductorActivity : AppCompatActivity() {
|
||||||
lateinit var video: VideoModel
|
lateinit var video: VideoModel
|
||||||
private val _actions: Actions = Actions()
|
private val _actions: Actions = Actions()
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.io.InputStream
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
class CommentariesAdapter(private val myDataset: ArrayList<CommentaryModel>) :
|
class CommentariesAdapter(private val myDataset: ArrayList<CommentaryModel>) :
|
||||||
RecyclerView.Adapter<CommentariesAdapter.ViewHolder>() {
|
RecyclerView.Adapter<CommentariesAdapter.ViewHolder>() {
|
||||||
|
|
||||||
|
|
|
@ -194,4 +194,8 @@ class Videos: Client() {
|
||||||
con.disconnect()
|
con.disconnect()
|
||||||
return videos
|
return videos
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getMostLikedVideos(start:Int = 0): ArrayList<VideoModel>{
|
||||||
|
return this.getVideos(start,"-likes")
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -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="M1,21h4L5,9L1,9v12zM23,10c0,-1.1 -0.9,-2 -2,-2h-6.31l0.95,-4.57 0.03,-0.32c0,-0.41 -0.17,-0.79 -0.44,-1.06L14.17,1 7.59,7.59C7.22,7.95 7,8.45 7,9v10c0,1.1 0.9,2 2,2h9c0.83,0 1.54,-0.5 1.84,-1.22l3.02,-7.05c0.09,-0.23 0.14,-0.47 0.14,-0.73v-1.91l-0.01,-0.01L23,10z"/>
|
||||||
|
</vector>
|
|
@ -36,6 +36,10 @@
|
||||||
android:id="@+id/nav_trending"
|
android:id="@+id/nav_trending"
|
||||||
android:icon="@drawable/ic_trending_up_black_24dp"
|
android:icon="@drawable/ic_trending_up_black_24dp"
|
||||||
android:title="@string/nav_trending" />
|
android:title="@string/nav_trending" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/nav_likes"
|
||||||
|
android:icon="@drawable/ic_thumb_up_black_24dp"
|
||||||
|
android:title="@string/nav_likes" />
|
||||||
<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"
|
||||||
|
|
|
@ -102,6 +102,7 @@
|
||||||
<string name="hostIndicator">Host:</string>
|
<string name="hostIndicator">Host:</string>
|
||||||
<string name="reportDialog">Razon para reportar:</string>
|
<string name="reportDialog">Razon para reportar:</string>
|
||||||
<string name="reportDialogMsg">Has reportado el video</string>
|
<string name="reportDialogMsg">Has reportado el video</string>
|
||||||
|
<string name="nav_likes">Mas gustados</string>
|
||||||
<!-- End Settings strings -->
|
<!-- End Settings strings -->
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -73,6 +73,7 @@
|
||||||
<string name="nav_menu_myLibrary">My Library</string>
|
<string name="nav_menu_myLibrary">My Library</string>
|
||||||
<string name="nav_menu_videos">Videos</string>
|
<string name="nav_menu_videos">Videos</string>
|
||||||
<string name="nav_menu_more">More</string>
|
<string name="nav_menu_more">More</string>
|
||||||
|
<string name="nav_likes">Most liked</string>
|
||||||
<!-- End Menu strings -->
|
<!-- End Menu strings -->
|
||||||
<!-- Start MiniMenu strings -->
|
<!-- Start MiniMenu strings -->
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
|
|
Loading…
Reference in New Issue