Update to sdk 32

This commit is contained in:
Ivan Agosto 2024-03-25 18:53:01 -06:00
parent 40b193a816
commit 0d9bd5410a
10 changed files with 61 additions and 30 deletions

View File

@ -6,14 +6,13 @@ plugins {
} }
android { android {
compileSdkVersion 30 compileSdkVersion 32
defaultConfig { defaultConfig {
applicationId "org.libre.agosto.p2play" applicationId "org.libre.agosto.p2play"
minSdkVersion 26 minSdkVersion 26
//noinspection OldTargetApi targetSdkVersion 32
targetSdkVersion 28 versionCode 9
versionCode 8 versionName "0.6.0"
versionName "0.5.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
@ -22,7 +21,6 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
} }
buildToolsVersion '30.0.2'
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
@ -31,6 +29,7 @@ android {
checkReleaseBuilds false checkReleaseBuilds false
abortOnError false abortOnError false
} }
namespace 'org.libre.agosto.p2play'
} }
dependencies { dependencies {
@ -40,7 +39,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.4.0' implementation 'com.google.android.material:material:1.6.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.5.2' androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android">
package="org.libre.agosto.p2play">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@ -13,10 +12,12 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.P2play"> android:theme="@style/Theme.P2play">
<activity android:name=".ChannelActivity" <activity android:name=".ChannelActivity"
android:theme="@style/Theme.P2play.NoActionBar" /> android:theme="@style/Theme.P2play.NoActionBar"
android:exported="false" />
<activity <activity
android:name=".SplashActivity" android:name=".SplashActivity"
android:theme="@style/Theme.P2play.NoActionBar"> android:theme="@style/Theme.P2play.NoActionBar"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -25,22 +26,26 @@
</activity> </activity>
<activity <activity
android:name=".HostActivity" android:name=".HostActivity"
android:theme="@style/Theme.P2play.NoActionBar"/> android:theme="@style/Theme.P2play.NoActionBar"
android:exported="false" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:theme="@style/Theme.P2play.NoActionBar" /> android:theme="@style/Theme.P2play.NoActionBar"
android:exported="false" />
<activity <activity
android:name=".ReproductorActivity" android:name=".ReproductorActivity"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:theme="@style/Theme.P2play.NoActionBar" /> android:theme="@style/Theme.P2play.NoActionBar"
<activity android:name=".LoginActivity" /> android:exported="false" />
<activity android:name=".RegisterActivity" /> <activity android:name=".LoginActivity" android:exported="false" />
<activity android:name=".AboutActivity" /> <activity android:name=".RegisterActivity" android:exported="false" />
<activity android:name=".AboutActivity" android:exported="false" />
<activity <activity
android:name=".SettingsActivity" android:name=".SettingsActivity"
android:label="@string/title_activity_settings" android:label="@string/title_activity_settings"
android:theme="@style/Theme.P2play"/> android:theme="@style/Theme.P2play"
android:exported="false"/>
</application> </application>
</manifest> </manifest>

View File

@ -50,8 +50,6 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
.setAction("Action", null).show() .setAction("Action", null).show()
} */ } */
val toggle = ActionBarDrawerToggle(this, drawer_layout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) val toggle = ActionBarDrawerToggle(this, drawer_layout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close)
drawer_layout.addDrawerListener(toggle) drawer_layout.addDrawerListener(toggle)
toggle.syncState() toggle.syncState()
@ -376,6 +374,8 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
myMenu.findItem(R.id.action_logout).isVisible = true myMenu.findItem(R.id.action_logout).isVisible = true
} }
} else {
nav_view.menu.findItem(R.id.ml).isVisible = false
} }
} }
@ -394,7 +394,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
this.refresh() this.refresh()
ManagerSingleton.Toast(getString(R.string.logout_msg), this) ManagerSingleton.Toast(getString(R.string.logout_msg), this)
setSideData()
} }
private fun loadMore(){ private fun loadMore(){

View File

@ -1,6 +1,7 @@
package org.libre.agosto.p2play.adapters package org.libre.agosto.p2play.adapters
import android.content.Context import android.content.Context
import android.content.Intent
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import android.text.Html import android.text.Html
import android.view.LayoutInflater import android.view.LayoutInflater
@ -9,6 +10,7 @@ import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import com.squareup.picasso.Picasso import com.squareup.picasso.Picasso
import kotlinx.android.synthetic.main.view_video.view.userImg
import org.libre.agosto.p2play.* import org.libre.agosto.p2play.*
import org.libre.agosto.p2play.models.CommentaryModel import org.libre.agosto.p2play.models.CommentaryModel
@ -42,6 +44,7 @@ class CommentariesAdapter(private val myDataset: ArrayList<CommentaryModel>) :
// create a new view // create a new view
val view = LayoutInflater.from(parent.context) val view = LayoutInflater.from(parent.context)
.inflate(R.layout.view_commentary, parent, false) as View .inflate(R.layout.view_commentary, parent, false) as View
// set the view's size, margins, paddings and layout parameters // set the view's size, margins, paddings and layout parameters
return ViewHolder(view) return ViewHolder(view)
} }
@ -63,6 +66,12 @@ class CommentariesAdapter(private val myDataset: ArrayList<CommentaryModel>) :
holder.commentary.text = Html.fromHtml(myDataset[position].commentary) holder.commentary.text = Html.fromHtml(myDataset[position].commentary)
// TODO: Support for view and account (is different than a video channel)
// holder.userImg.setOnClickListener {
// val intent = Intent(holder.context, ChannelActivity::class.java)
// intent.putExtra("channel", myDataset[position].getAccount())
// holder.context.startActivity(intent)
// }
} }
// Return the size of your dataset (invoked by the layout manager) // Return the size of your dataset (invoked by the layout manager)

View File

@ -56,11 +56,12 @@ class VideosAdapter(private val myDataset: ArrayList<VideoModel>) :
// - get element from your dataset at this position // - get element from your dataset at this position
// - replace the contents of the view with that element // - replace the contents of the view with that element
holder.tittle.text = myDataset[position].name holder.tittle.text = myDataset[position].name
holder.tittle.setOnClickListener {
this.launchChannelActivity(myDataset[position] as Serializable, holder.context)
}
Picasso.get().load("https://"+ManagerSingleton.url+myDataset[position].thumbUrl).into(holder.thumb) Picasso.get().load("https://"+ManagerSingleton.url+myDataset[position].thumbUrl).into(holder.thumb)
holder.thumb.setOnClickListener { holder.thumb.setOnClickListener {
val intent = Intent(holder.context, ReproductorActivity::class.java) this.launchChannelActivity(myDataset[position] as Serializable, holder.context)
intent.putExtra("video", myDataset[position] as Serializable)
holder.context.startActivity(intent)
} }
holder.userImg.setOnClickListener { holder.userImg.setOnClickListener {
@ -98,5 +99,9 @@ class VideosAdapter(private val myDataset: ArrayList<VideoModel>) :
notifyItemRangeInserted(lastPos, newItems.size) notifyItemRangeInserted(lastPos, newItems.size)
} }
private fun launchChannelActivity (data: Serializable, context: Context) {
val intent = Intent(context, ReproductorActivity::class.java)
intent.putExtra("video", data)
context.startActivity(intent)
}
} }

View File

@ -11,7 +11,8 @@ class CommentaryModel (
var userImageUrl: String = "", var userImageUrl: String = "",
var commentary: String = "", var commentary: String = "",
var userHost: String = "", var userHost: String = "",
var replies: Int = 0 var replies: Int = 0,
var nameChannel: String = ""
) { ) {
fun parseCommentary(data: JsonReader) { fun parseCommentary(data: JsonReader) {
data.beginObject() data.beginObject()
@ -46,6 +47,7 @@ class CommentaryModel (
} }
"uuid" -> this.userUuid = data.nextString() "uuid" -> this.userUuid = data.nextString()
"host" -> this.userHost = data.nextString() "host" -> this.userHost = data.nextString()
"name" -> this.nameChannel = data.nextString()
else -> data.skipValue() else -> data.skipValue()
} }
} }
@ -56,4 +58,9 @@ class CommentaryModel (
} }
data.endObject() data.endObject()
} }
fun getAccount(): String {
return "$nameChannel@$userHost"
}
} }

View File

@ -16,12 +16,15 @@
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:id="@+id/thumb" android:id="@+id/thumb"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="230dp" android:layout_height="230dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"

View File

@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.6.20' ext.kotlin_version = '1.6.21'
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.4.2' classpath 'com.android.tools.build:gradle:8.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files

View File

@ -9,6 +9,9 @@
org.gradle.jvmargs=-Xmx1536m org.gradle.jvmargs=-Xmx1536m
android.enableJetifier=true android.enableJetifier=true
android.useAndroidX=true android.useAndroidX=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # This option should only be used with decoupled projects. More details, visit

View File

@ -1,6 +1,6 @@
#Mon Mar 18 13:17:32 CST 2024 #Mon Mar 18 13:17:32 CST 2024
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists