Saving video views in history

This commit is contained in:
Ivan Agosto 2019-10-24 13:46:23 -05:00
parent 9167977c7c
commit c26ab0b8a2
4 changed files with 25 additions and 4 deletions

View File

@ -318,6 +318,10 @@ class ReproductorActivity : AppCompatActivity() {
private var mOriginalSystemUiVisibility: Int = 0
override fun getDefaultVideoPoster(): Bitmap? {
AsyncTask.execute {
this@ReproductorActivity._actions.watchVideo(this@ReproductorActivity.video.id, ManagerSingleton.token.token)
}
return if (mCustomView == null) {
null
} else BitmapFactory.decodeResource(this@ReproductorActivity.resources, 2130837573)
@ -377,6 +381,5 @@ class ReproductorActivity : AppCompatActivity() {
err.printStackTrace()
}
}
}
}

View File

@ -144,4 +144,22 @@ class Actions: Client() {
return response
}
fun watchVideo(videoId: Int, token: String): Boolean {
val con = this._newCon("videos/$videoId/watching", "PUT", token)
val params = "currentTime=1"
con.outputStream.write(params.toByteArray())
var response = false
try {
if(con.responseCode == 204){
response = true
}
} catch (err: Exception) {
err.printStackTrace()
response = false
}
return response
}
}

View File

@ -8,7 +8,7 @@
<!-- Start About strings -->
<string name="aboutLabel">Sobre P2Play</string>
<string name="aboutText">P2Play es una aplicacion no-oficial de PeerTube. Tu puedes ver y cntribuir con el codigo en GitLab:</string>
<string name="aboutStatus">Puedes subscribirte a nuestro perfil en GNU Social:</string>
<string name="aboutStatus">Puedes seguir nuestro blog:</string>
<string name="aboutLicense">Copyleft GNU GPLv3 License</string>
<string name="aboutInstance">Sobre la instancia</string>
<string name="aboutInWeb">Para ver los terminos y mas visita la web:</string>

View File

@ -12,10 +12,10 @@
<!-- Start About strings -->
<string name="aboutGitUrl" translatable="false">https://gitlab.com/agosto182/p2play/</string>
<string name="aboutGnuUrl" translatable="false">https://gnusocial.ml/p2play</string>
<string name="aboutGnuUrl" translatable="false">https://personaljournal.ca/p2play/</string>
<string name="aboutLabel">About P2Play</string>
<string name="aboutText">P2Play is an Android application unnoficial of PeerTube. You can watch and contribute with the code on GitLab:</string>
<string name="aboutStatus">You can subscribe to our profile on GNU Social:</string>
<string name="aboutStatus">You can follow our blog:</string>
<string name="aboutLicense">Copyleft GNU GPLv3 License</string>
<string name="aboutInstance">About instance</string>
<string name="aboutInWeb">You can see terms and more on the web:</string>