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
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
namespace 'org.libre.agosto.p2play'
lint {
abortOnError false
checkReleaseBuilds false
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
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 'androidx.preference:preference:1.2.0'
testImplementation 'junit:junit:4.12'
implementation 'androidx.preference:preference:1.2.1'
testImplementation 'junit:junit:4.13.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-dash: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.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.transition.Visibility
import com.google.android.material.navigation.NavigationView
import com.squareup.picasso.Picasso
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.swipeContainer
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_image
import kotlinx.android.synthetic.main.mini_player.mini_player_title
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.ajax.Videos
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)
intent.putExtra("resume", true)
startActivity(intent)
}
private fun playPausePlayer () {
private fun playPausePlayer() {
PlaybackSingleton.player?.let {
if (it.isPlaying) {
it.pause()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
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"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files