Fix lint errors

This commit is contained in:
Ivan Agosto 2024-04-15 22:07:14 -06:00
parent 826bb79431
commit d6aeadc489
8 changed files with 27 additions and 38 deletions

View File

@ -26,26 +26,26 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
lintOptions {
checkReleaseBuilds false
abortOnError false
}
namespace 'org.libre.agosto.p2play' namespace 'org.libre.agosto.p2play'
lint {
abortOnError false
checkReleaseBuilds false
}
} }
dependencies { dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'com.squareup.picasso:picasso:2.71828' implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.support:appcompat-v7:23.2.0' implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.material:material:1.6.0' implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.preference:preference:1.2.0' implementation 'androidx.preference:preference:1.2.1'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
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.1'
implementation 'androidx.media3:media3-exoplayer:1.1.1' implementation 'androidx.media3:media3-exoplayer:1.1.1'
implementation 'androidx.media3:media3-exoplayer-dash:1.1.1' implementation 'androidx.media3:media3-exoplayer-dash:1.1.1'
implementation 'androidx.media3:media3-ui:1.1.1' implementation 'androidx.media3:media3-ui:1.1.1'

View File

@ -13,7 +13,6 @@ import androidx.appcompat.widget.SearchView
import androidx.core.view.GravityCompat import androidx.core.view.GravityCompat
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.transition.Visibility
import com.google.android.material.navigation.NavigationView import com.google.android.material.navigation.NavigationView
import com.squareup.picasso.Picasso import com.squareup.picasso.Picasso
import kotlinx.android.synthetic.main.activity_main.drawer_layout import kotlinx.android.synthetic.main.activity_main.drawer_layout
@ -22,12 +21,10 @@ import kotlinx.android.synthetic.main.app_bar_main.toolbar
import kotlinx.android.synthetic.main.content_main.mini import kotlinx.android.synthetic.main.content_main.mini
import kotlinx.android.synthetic.main.content_main.swipeContainer import kotlinx.android.synthetic.main.content_main.swipeContainer
import kotlinx.android.synthetic.main.mini_player.mini_play_pause import kotlinx.android.synthetic.main.mini_player.mini_play_pause
import kotlinx.android.synthetic.main.mini_player.mini_player
import kotlinx.android.synthetic.main.mini_player.mini_player_author import kotlinx.android.synthetic.main.mini_player.mini_player_author
import kotlinx.android.synthetic.main.mini_player.mini_player_image import kotlinx.android.synthetic.main.mini_player.mini_player_image
import kotlinx.android.synthetic.main.mini_player.mini_player_title import kotlinx.android.synthetic.main.mini_player.mini_player_title
import kotlinx.android.synthetic.main.nav_header_main.* import kotlinx.android.synthetic.main.nav_header_main.*
import kotlinx.android.synthetic.main.view_video.view.thumb
import org.libre.agosto.p2play.adapters.VideosAdapter import org.libre.agosto.p2play.adapters.VideosAdapter
import org.libre.agosto.p2play.ajax.Videos import org.libre.agosto.p2play.ajax.Videos
import org.libre.agosto.p2play.models.VideoModel import org.libre.agosto.p2play.models.VideoModel
@ -457,13 +454,13 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
} }
} }
private fun resumeVideo () { private fun resumeVideo() {
val intent = Intent(this, ReproductorActivity::class.java) val intent = Intent(this, ReproductorActivity::class.java)
intent.putExtra("resume", true) intent.putExtra("resume", true)
startActivity(intent) startActivity(intent)
} }
private fun playPausePlayer () { private fun playPausePlayer() {
PlaybackSingleton.player?.let { PlaybackSingleton.player?.let {
if (it.isPlaying) { if (it.isPlaying) {
it.pause() it.pause()

View File

@ -1,7 +1,6 @@
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 android.os.Bundle import android.os.Bundle
import android.text.Html import android.text.Html
import android.view.LayoutInflater import android.view.LayoutInflater
@ -15,7 +14,6 @@ import androidx.recyclerview.widget.RecyclerView
import com.squareup.picasso.Picasso import com.squareup.picasso.Picasso
import org.libre.agosto.p2play.ManagerSingleton import org.libre.agosto.p2play.ManagerSingleton
import org.libre.agosto.p2play.R import org.libre.agosto.p2play.R
import org.libre.agosto.p2play.ajax.Comments
import org.libre.agosto.p2play.dialogs.ThreadDialog import org.libre.agosto.p2play.dialogs.ThreadDialog
import org.libre.agosto.p2play.models.CommentaryModel import org.libre.agosto.p2play.models.CommentaryModel
import java.io.Serializable import java.io.Serializable
@ -23,12 +21,12 @@ import java.io.Serializable
class CommentariesAdapter(private val myDataset: ArrayList<CommentaryModel>) : class CommentariesAdapter(private val myDataset: ArrayList<CommentaryModel>) :
RecyclerView.Adapter<CommentariesAdapter.ViewHolder>() { RecyclerView.Adapter<CommentariesAdapter.ViewHolder>() {
private lateinit var fragmentManager: FragmentManager private lateinit var fragmentManager: FragmentManager
fun setFragmentManager (manager: FragmentManager): CommentariesAdapter { fun setFragmentManager(manager: FragmentManager): CommentariesAdapter {
this.fragmentManager = manager this.fragmentManager = manager
return this return this
} }
// Provide a reference to the views for each data item // Provide a reference to the views for each data item
// Complex data items may need more than one view per item, and // Complex data items may need more than one view per item, and
@ -98,7 +96,7 @@ class CommentariesAdapter(private val myDataset: ArrayList<CommentaryModel>) :
// Return the size of your dataset (invoked by the layout manager) // Return the size of your dataset (invoked by the layout manager)
override fun getItemCount() = myDataset.size override fun getItemCount() = myDataset.size
private fun initRepliesDialog (commentData: CommentaryModel) { private fun initRepliesDialog(commentData: CommentaryModel) {
val dialog = ThreadDialog() val dialog = ThreadDialog()
val bundle = Bundle() val bundle = Bundle()
bundle.putSerializable("comment", commentData as Serializable) bundle.putSerializable("comment", commentData as Serializable)
@ -114,6 +112,5 @@ class CommentariesAdapter(private val myDataset: ArrayList<CommentaryModel>) :
.add(android.R.id.content, dialog) .add(android.R.id.content, dialog)
.addToBackStack("comments") .addToBackStack("comments")
.commit() .commit()
} }
} }

View File

@ -72,7 +72,7 @@ class Comments : Client() {
fun getCommentariesThread(videoId: Int, threadId: Int): ArrayList<CommentaryModel> { fun getCommentariesThread(videoId: Int, threadId: Int): ArrayList<CommentaryModel> {
var commentaries = arrayListOf<CommentaryModel>() var commentaries = arrayListOf<CommentaryModel>()
val con = this.newCon("videos/$videoId/comment-threads/${threadId}", "GET") val con = this.newCon("videos/$videoId/comment-threads/$threadId", "GET")
try { try {
if (con.responseCode == 200) { if (con.responseCode == 200) {
@ -86,7 +86,7 @@ class Comments : Client() {
while (data.hasNext()) { while (data.hasNext()) {
data.beginObject() data.beginObject()
while (data.hasNext()) { while (data.hasNext()) {
when(data.nextName()) { when (data.nextName()) {
"comment" -> { "comment" -> {
val comment = CommentaryModel() val comment = CommentaryModel()
comment.parseCommentary(data) comment.parseCommentary(data)
@ -112,8 +112,8 @@ class Comments : Client() {
return commentaries return commentaries
} }
fun replyThread(token: String, videoId: Int, threadId: Int , text: String): Boolean { fun replyThread(token: String, videoId: Int, threadId: Int, text: String): Boolean {
val con = this.newCon("videos/$videoId/comments/${threadId}", "POST", token) val con = this.newCon("videos/$videoId/comments/$threadId", "POST", token)
val params = "text=$text" val params = "text=$text"
con.outputStream.write(params.toByteArray()) con.outputStream.write(params.toByteArray())

View File

@ -1,16 +1,12 @@
package org.libre.agosto.p2play.dialogs package org.libre.agosto.p2play.dialogs
import android.app.Dialog import android.app.Dialog
import android.content.AsyncQueryHandler
import android.content.Context
import android.os.AsyncTask import android.os.AsyncTask
import android.os.Bundle import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.Window import android.view.Window
import android.view.inputmethod.InputMethodManager
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -24,7 +20,6 @@ import kotlinx.android.synthetic.main.comment_component.view.commentaryLayout
import kotlinx.android.synthetic.main.comment_component.view.commentaryText import kotlinx.android.synthetic.main.comment_component.view.commentaryText
import kotlinx.android.synthetic.main.comment_component.view.userImgCom import kotlinx.android.synthetic.main.comment_component.view.userImgCom
import kotlinx.android.synthetic.main.dialog_thread.view.materialToolbar import kotlinx.android.synthetic.main.dialog_thread.view.materialToolbar
import kotlinx.android.synthetic.main.two_factor_dialog.twoFactorText
import kotlinx.android.synthetic.main.view_commentary.view.replyBtn import kotlinx.android.synthetic.main.view_commentary.view.replyBtn
import kotlinx.android.synthetic.main.view_commentary.view.userCommentImg import kotlinx.android.synthetic.main.view_commentary.view.userCommentImg
import kotlinx.android.synthetic.main.view_commentary.view.userCommentary import kotlinx.android.synthetic.main.view_commentary.view.userCommentary
@ -39,12 +34,13 @@ class ThreadDialog : DialogFragment() {
private lateinit var comment: CommentaryModel private lateinit var comment: CommentaryModel
lateinit var fragmentManager2: FragmentManager lateinit var fragmentManager2: FragmentManager
private val client: Comments = Comments() private val client: Comments = Comments()
// The system calls this to get the DialogFragment's layout, regardless of // The system calls this to get the DialogFragment's layout, regardless of
// whether it's being displayed as a dialog or an embedded fragment. // whether it's being displayed as a dialog or an embedded fragment.
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, inflater: LayoutInflater,
container: ViewGroup?, container: ViewGroup?,
savedInstanceState: Bundle? savedInstanceState: Bundle?,
): View { ): View {
// Inflate the layout to use as a dialog or embedded fragment. // Inflate the layout to use as a dialog or embedded fragment.
val view = inflater.inflate(R.layout.dialog_thread, container, false) val view = inflater.inflate(R.layout.dialog_thread, container, false)

View File

@ -14,8 +14,8 @@ class CommentaryModel(
var userHost: String = "", var userHost: String = "",
var replies: Int = 0, var replies: Int = 0,
var nameChannel: String = "", var nameChannel: String = "",
var videoId: Int = 0 var videoId: Int = 0,
): Serializable { ) : Serializable {
fun parseCommentary(data: JsonReader) { fun parseCommentary(data: JsonReader) {
data.beginObject() data.beginObject()
while (data.hasNext()) { while (data.hasNext()) {

View File

@ -2,7 +2,6 @@ package org.libre.agosto.p2play.singletons
import android.content.ComponentName import android.content.ComponentName
import android.content.Context import android.content.Context
import android.util.Log
import androidx.media3.common.MediaItem import androidx.media3.common.MediaItem
import androidx.media3.exoplayer.ExoPlayer import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.session.MediaController import androidx.media3.session.MediaController

View File

@ -7,7 +7,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:8.3.0' classpath 'com.android.tools.build:gradle:8.3.2'
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