Subscriptions library and subcribe action
This commit is contained in:
parent
cd21704a49
commit
df04a0b9d9
72
app/app.iml
72
app/app.iml
|
@ -50,19 +50,19 @@
|
|||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/compileDebugUnitTestJavaWithJavac/classes" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources/debugAndroidTest/processDebugAndroidTestResources/r" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||
|
@ -97,13 +97,6 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
|
@ -111,32 +104,46 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotation_processor_list" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/apk_list" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-libraries" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/checkDebugClasspath" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-apk" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-main-apk-res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_merged_manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_split_apk_resources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint_jar" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/processed_res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split_list" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/kotlin" />
|
||||
|
@ -145,36 +152,37 @@
|
|||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:transition-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-v4-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:transition-27.1.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:runner-1.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.1.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-annotations:27.1.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-compat-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.51@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support:support-annotations:27.1.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.2.51@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel-1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:recyclerview-v7-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-v4-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-compat-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:recyclerview-v7-27.1.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-media-compat-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-ui-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-media-compat-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-annotations:27.1.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout-1.1.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-utils-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-utils-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-ui-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.jetbrains:annotations:13.0@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.okio:okio:1.14.0@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-core-3.0.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-fragment-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-fragment-27.1.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.2.51@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:design-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.core:runtime-1.1.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.51@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:design-27.1.1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:monitor-1.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:appcompat-v7-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:appcompat-v7-27.1.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-idling-resource-3.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.okhttp3:okhttp:3.10.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout-solver:1.1.2@jar" level="project" />
|
||||
|
|
|
@ -20,7 +20,7 @@ android {
|
|||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
buildToolsVersion '27.0.3'
|
||||
buildToolsVersion '28.0.2'
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_6
|
||||
targetCompatibility JavaVersion.VERSION_1_6
|
||||
|
@ -29,11 +29,11 @@ android {
|
|||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
|
||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'com.android.support:appcompat-v7:27.1.0'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
|
||||
implementation 'com.android.support:support-v4:27.1.1'
|
||||
implementation 'com.android.support:design:27.1.1'
|
||||
implementation 'com.android.support:support-v4:27.1.0'
|
||||
implementation 'com.android.support:design:27.1.0'
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
|
|
|
@ -29,6 +29,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
|||
private lateinit var viewManager: RecyclerView.LayoutManager
|
||||
val client: Videos = Videos()
|
||||
private lateinit var lastItem: MenuItem
|
||||
private lateinit var subItem: MenuItem
|
||||
lateinit var myMenu: Menu
|
||||
val _db = Database(this)
|
||||
var section: String = ""
|
||||
|
@ -89,6 +90,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
|||
"local" -> this.getLocalVideos()
|
||||
"popular" -> this.getPopularVideos()
|
||||
"last" -> this.getLastVideos()
|
||||
"sub" -> this.getSubscriptionVideos()
|
||||
"my_videos" -> {
|
||||
if(ManagerSingleton.token.token != "")
|
||||
this.getMyVideos()
|
||||
|
@ -98,6 +100,23 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
|||
}
|
||||
}
|
||||
|
||||
fun getSubscriptionVideos(){
|
||||
if(ManagerSingleton.user.status != 1){
|
||||
ManagerSingleton.Toast("Inicia session primero")
|
||||
startActivity(Intent(this, LoginActivity::class.java))
|
||||
return
|
||||
}
|
||||
swipeContainer.isRefreshing = true
|
||||
section = "sub"
|
||||
setTitle(R.string.title_subscriptions)
|
||||
AsyncTask.execute {
|
||||
val videos = client.videoSubscriptions(ManagerSingleton.token.token)
|
||||
runOnUiThread {
|
||||
this.setData(videos)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Last videos
|
||||
fun getLastVideos(){
|
||||
swipeContainer.isRefreshing = true
|
||||
|
@ -202,6 +221,9 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
|||
lastItem = item
|
||||
// item.isChecked = true
|
||||
when (item.itemId) {
|
||||
R.id.nav_subscriptions->{
|
||||
getSubscriptionVideos()
|
||||
}
|
||||
R.id.nav_popular-> {
|
||||
getPopularVideos()
|
||||
}
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
package org.libre.agosto.p2play
|
||||
|
||||
import android.os.AsyncTask
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import com.squareup.picasso.Picasso
|
||||
import kotlinx.android.synthetic.main.activity_reproductor.*
|
||||
import org.libre.agosto.p2play.ajax.Subscriptions
|
||||
import org.libre.agosto.p2play.models.VideoModel
|
||||
|
||||
class ReproductorActivity : AppCompatActivity() {
|
||||
lateinit var video:VideoModel
|
||||
private val _subsciption: Subscriptions = Subscriptions()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -17,6 +21,12 @@ class ReproductorActivity : AppCompatActivity() {
|
|||
|
||||
videoView.settings.javaScriptEnabled = true
|
||||
videoView.settings.allowContentAccess = true
|
||||
videoView.settings.javaScriptCanOpenWindowsAutomatically = true
|
||||
videoView.settings.allowFileAccess = true
|
||||
videoView.settings.allowFileAccessFromFileURLs = true
|
||||
videoView.settings.allowUniversalAccessFromFileURLs = true
|
||||
videoView.settings.domStorageEnabled = true
|
||||
|
||||
try {
|
||||
this.video = this.intent.extras.getSerializable("video") as VideoModel
|
||||
tittleVideoTxt.text = this.video.name
|
||||
|
@ -34,6 +44,21 @@ class ReproductorActivity : AppCompatActivity() {
|
|||
Log.d("Error", err?.message)
|
||||
}
|
||||
|
||||
subscribeBtn.setOnClickListener { ManagerSingleton.Toast(getString(R.string.comming)) }
|
||||
// subscribeBtn.setOnClickListener { ManagerSingleton.Toast(getString(R.string.comming)) }
|
||||
subscribeBtn.setOnClickListener { subscribe() }
|
||||
}
|
||||
|
||||
fun subscribe(){
|
||||
val account = this.video.userUuid+"@"+this.video.userHost
|
||||
AsyncTask.execute {
|
||||
if (Looper.myLooper() == null)
|
||||
Looper.prepare()
|
||||
val res = this._subsciption.subscribe(ManagerSingleton.token.token, account)
|
||||
if (res == 1) {
|
||||
runOnUiThread {
|
||||
ManagerSingleton.Toast(getString(R.string.subscribeMsg))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package org.libre.agosto.p2play.ajax
|
||||
|
||||
class Subscriptions: Client() {
|
||||
|
||||
fun subscribe(token: String, account: String):Int{
|
||||
var con=this._newCon("users/me/subscriptions","POST", token)
|
||||
val params:String= "uri=$account"
|
||||
con.outputStream.write(params.toByteArray())
|
||||
var response = 0
|
||||
|
||||
try {
|
||||
if (con.responseCode == 204) {
|
||||
response = 1
|
||||
}
|
||||
}
|
||||
catch (err: Exception){
|
||||
err.printStackTrace()
|
||||
response = -1
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
||||
}
|
|
@ -42,13 +42,13 @@ class Videos: Client() {
|
|||
"views"->{
|
||||
video.views = data.nextInt()
|
||||
}
|
||||
"account"->{
|
||||
"channel"->{
|
||||
data.beginObject()
|
||||
while (data.hasNext()){
|
||||
val acKey = data.nextName()
|
||||
when(acKey.toString()){
|
||||
"name"->video.username=data.nextString()
|
||||
"avatar"->{
|
||||
"displayName"-> video.username=data.nextString()
|
||||
"avatar"-> {
|
||||
if(data.peek() == JsonToken.BEGIN_OBJECT){
|
||||
data.beginObject()
|
||||
while (data.hasNext()){
|
||||
|
@ -64,6 +64,8 @@ class Videos: Client() {
|
|||
data.skipValue()
|
||||
|
||||
}
|
||||
"uuid" -> video.userUuid = data.nextString()
|
||||
"host" -> video.userHost = data.nextString()
|
||||
else-> data.skipValue()
|
||||
}
|
||||
}
|
||||
|
@ -133,4 +135,21 @@ class Videos: Client() {
|
|||
}
|
||||
return videos
|
||||
}
|
||||
|
||||
fun videoSubscriptions(token: String): ArrayList<VideoModel>{
|
||||
var con=this._newCon("users/me/subscriptions/videos","GET", token)
|
||||
var videos = arrayListOf<VideoModel>()
|
||||
try {
|
||||
if (con.responseCode == 200) {
|
||||
var response = InputStreamReader(con.inputStream)
|
||||
var data = JsonReader(response)
|
||||
videos = parseVideos(data)
|
||||
}
|
||||
} catch(err:Exception){
|
||||
err?.printStackTrace()
|
||||
Log.d("TypeErr",err?.message ,err.cause)
|
||||
Log.d("Error","fallo la coneccion")
|
||||
}
|
||||
return videos
|
||||
}
|
||||
}
|
|
@ -3,12 +3,14 @@ package org.libre.agosto.p2play.models
|
|||
import java.io.Serializable
|
||||
|
||||
class VideoModel(
|
||||
var name:String="",
|
||||
var description:String="",
|
||||
var thumbUrl:String="",
|
||||
var userImageUrl:String="",
|
||||
var embedUrl:String="",
|
||||
var duration:Number=0,
|
||||
var username:String="",
|
||||
var views:Number=0
|
||||
var name: String = "",
|
||||
var description: String = "",
|
||||
var thumbUrl: String = "",
|
||||
var userImageUrl: String = "",
|
||||
var embedUrl: String = "",
|
||||
var duration: Number = 0,
|
||||
var username: String = "",
|
||||
var views: Number = 0,
|
||||
var userUuid: String = "",
|
||||
var userHost: String = ""
|
||||
):Serializable
|
|
@ -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="M4,6L2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6zM20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM12,14.5v-9l6,4.5 -6,4.5z"/>
|
||||
</vector>
|
|
@ -111,8 +111,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/subscribeBtn"
|
||||
android:visibility="invisible" />
|
||||
android:text="@string/subscribeBtn" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
|
||||
<item android:title="Videos">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/nav_subscriptions"
|
||||
android:icon="@drawable/ic_video_library_black_24dp"
|
||||
android:title="@string/nav_subscriptions" />
|
||||
<item
|
||||
android:id="@+id/nav_popular"
|
||||
android:icon="@android:drawable/btn_star"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="title_subscriptions">Subscriptions</string>
|
||||
<string name="title_recent">Recent videos</string>
|
||||
<string name="title_popular">Popular videos</string>
|
||||
<string name="title_local">Local videos</string>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="nav_subscriptions">Subscriptions</string>
|
||||
<string name="nav_popular">Popular</string>
|
||||
<string name="nav_recent">Recent</string>
|
||||
<string name="nav_local">Local</string>
|
||||
|
|
|
@ -5,5 +5,8 @@
|
|||
<string name="dislikeBtn">Dislike</string>
|
||||
<string name="shareBtn">Share</string>
|
||||
<string name="reportBtn">Report</string>
|
||||
|
||||
<!-- Subscriptions -->
|
||||
<string name="subscribeBtn">Subscribe</string>
|
||||
<string name="subscribeMsg">You are subscribed to this channel</string>
|
||||
</resources>
|
Loading…
Reference in New Issue