Compare commits
4 Commits
jetpack/to
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
5e1a8b40c6 | ||
|
3f461792e5 | ||
|
4738c317cc | ||
|
3997b38120 |
@ -9,8 +9,8 @@ android {
|
|||||||
compileSdk 35
|
compileSdk 35
|
||||||
minSdkVersion 26
|
minSdkVersion 26
|
||||||
targetSdkVersion 32
|
targetSdkVersion 32
|
||||||
versionCode 13
|
versionCode 15
|
||||||
versionName "0.8.2"
|
versionName "0.8.4"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
}
|
}
|
||||||
|
@ -66,11 +66,6 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
|||||||
binding.content.mini.miniPlayerAuthor.setOnClickListener { this.resumeVideo() }
|
binding.content.mini.miniPlayerAuthor.setOnClickListener { this.resumeVideo() }
|
||||||
// binding.content.mini.setOnClickListener { this.resumeVideo() }
|
// binding.content.mini.setOnClickListener { this.resumeVideo() }
|
||||||
binding.content.mini.miniPlayPause.setOnClickListener { this.playPausePlayer() }
|
binding.content.mini.miniPlayPause.setOnClickListener { this.playPausePlayer() }
|
||||||
|
|
||||||
Handler().postDelayed({
|
|
||||||
// Title for nav_bar
|
|
||||||
binding.navView.getHeaderView(0).findViewById<TextView>(R.id.side_emailTxt).text = getString(R.string.nav_header_subtitle) + " " + this.packageManager.getPackageInfo(this.packageName, 0).versionName
|
|
||||||
}, 2000)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic function for set data to RecyclerView
|
// Generic function for set data to RecyclerView
|
||||||
@ -374,10 +369,10 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setSideData() {
|
private fun setSideData() {
|
||||||
|
val headerView = binding.navView.getHeaderView(0)
|
||||||
if (ManagerSingleton.user.status == 1) {
|
if (ManagerSingleton.user.status == 1) {
|
||||||
binding.navView.menu.findItem(R.id.ml).isVisible = true
|
binding.navView.menu.findItem(R.id.ml).isVisible = true
|
||||||
|
|
||||||
val headerView = binding.navView.getHeaderView(0)
|
|
||||||
headerView.findViewById<TextView>(R.id.side_usernameTxt).text = ManagerSingleton.user.username
|
headerView.findViewById<TextView>(R.id.side_usernameTxt).text = ManagerSingleton.user.username
|
||||||
headerView.findViewById<TextView>(R.id.side_emailTxt).text = ManagerSingleton.user.email
|
headerView.findViewById<TextView>(R.id.side_emailTxt).text = ManagerSingleton.user.email
|
||||||
if (ManagerSingleton.user.avatar != "" && headerView.findViewById<ImageView>(R.id.side_imageView) != null) {
|
if (ManagerSingleton.user.avatar != "" && headerView.findViewById<ImageView>(R.id.side_imageView) != null) {
|
||||||
@ -394,6 +389,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
binding.navView.menu.findItem(R.id.ml).isVisible = false
|
binding.navView.menu.findItem(R.id.ml).isVisible = false
|
||||||
|
headerView.findViewById<TextView>(R.id.side_emailTxt).text = getString(R.string.nav_header_subtitle) + " " + this.packageManager.getPackageInfo(this.packageName, 0).versionName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import android.net.Uri
|
|||||||
import android.os.AsyncTask
|
import android.os.AsyncTask
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.webkit.WebChromeClient
|
import android.webkit.WebChromeClient
|
||||||
@ -139,7 +140,10 @@ class ReproductorActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AsyncTask.execute {
|
AsyncTask.execute {
|
||||||
videoPlayback = this.clientVideo.getVideo(this.video.uuid)
|
videoPlayback = if (ManagerSingleton.token.status == 1)
|
||||||
|
this.clientVideo.getVideo(this.video.uuid, ManagerSingleton.token.token)
|
||||||
|
else
|
||||||
|
this.clientVideo.getVideo(this.video.uuid)
|
||||||
// TODO: Make this configurable
|
// TODO: Make this configurable
|
||||||
// val bufferSize = 1024 * 1024 // 1mb
|
// val bufferSize = 1024 * 1024 // 1mb
|
||||||
// val allocator = DefaultAllocator(true, bufferSize)
|
// val allocator = DefaultAllocator(true, bufferSize)
|
||||||
|
@ -46,7 +46,6 @@ class SplashActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun checkUser() {
|
private fun checkUser() {
|
||||||
Log.d("was", "Checked")
|
|
||||||
try {
|
try {
|
||||||
val token = db.getToken()
|
val token = db.getToken()
|
||||||
val user = db.getUser()
|
val user = db.getUser()
|
||||||
@ -56,8 +55,11 @@ class SplashActivity : AppCompatActivity() {
|
|||||||
val clientSecret = settings.getString("client_secret", "")!!
|
val clientSecret = settings.getString("client_secret", "")!!
|
||||||
val task = TaskManager<TokenModel>()
|
val task = TaskManager<TokenModel>()
|
||||||
|
|
||||||
task.runTask({client.refreshToken(token, clientId, clientSecret)}, {
|
task.runTask(
|
||||||
when (token.status.toString()) {
|
{
|
||||||
|
client.refreshToken(token, clientId, clientSecret)
|
||||||
|
}, {
|
||||||
|
when (it.status.toString()) {
|
||||||
"1" -> {
|
"1" -> {
|
||||||
db.newToken(it)
|
db.newToken(it)
|
||||||
ManagerSingleton.token = it
|
ManagerSingleton.token = it
|
||||||
@ -65,12 +67,12 @@ class SplashActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
else -> ManagerSingleton.logout()
|
else -> ManagerSingleton.logout()
|
||||||
}
|
}
|
||||||
|
startApp()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
ManagerSingleton.logout()
|
ManagerSingleton.logout()
|
||||||
}
|
|
||||||
|
|
||||||
startApp()
|
startApp()
|
||||||
|
}
|
||||||
} catch (err: Exception) {
|
} catch (err: Exception) {
|
||||||
err.printStackTrace()
|
err.printStackTrace()
|
||||||
Thread.sleep(2000)
|
Thread.sleep(2000)
|
||||||
|
@ -9,7 +9,7 @@ import java.net.HttpURLConnection
|
|||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
|
||||||
open class Client {
|
open class Client {
|
||||||
protected fun newCon(uri: String, method: String, token: String = ""): HttpURLConnection {
|
protected fun newCon(uri: String, method: String, token: String? = null): HttpURLConnection {
|
||||||
val url = URL("https://${ManagerSingleton.url}/api/v1/$uri")
|
val url = URL("https://${ManagerSingleton.url}/api/v1/$uri")
|
||||||
val con = url.openConnection() as HttpURLConnection
|
val con = url.openConnection() as HttpURLConnection
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ open class Client {
|
|||||||
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded")
|
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded")
|
||||||
con.setRequestProperty("Accept", "*/*")
|
con.setRequestProperty("Accept", "*/*")
|
||||||
|
|
||||||
if (token != "") {
|
if (token !== null) {
|
||||||
con.setRequestProperty("Authorization", "Bearer $token")
|
con.setRequestProperty("Authorization", "Bearer $token")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,8 +201,8 @@ class Videos : Client() {
|
|||||||
return this.getVideos(start, "-likes")
|
return this.getVideos(start, "-likes")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getVideo(uuid: String): VideoModel {
|
fun getVideo(uuid: String, token: String? = null): VideoModel {
|
||||||
val con = this.newCon("videos/$uuid", "GET")
|
val con = this.newCon("videos/$uuid", "GET", token)
|
||||||
val video = VideoModel()
|
val video = VideoModel()
|
||||||
try {
|
try {
|
||||||
if (con.responseCode == 200) {
|
if (con.responseCode == 200) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user