Skip to content

Commit

Permalink
make category nullable type
Browse files Browse the repository at this point in the history
fix FC
  • Loading branch information
tsynik committed Apr 15, 2024
1 parent 000d6de commit c03ab55
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/ru/yourok/torrserve/atv/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ object Utils {
vintent.putExtra("hash", torr.hash)
vintent.putExtra("title", torr.title)
vintent.putExtra("poster", torr.poster)
vintent.putExtra("category", torr.category)
vintent.putExtra("data", torr.data)
torr.category?.let { if (it.isNotBlank()) vintent.putExtra("category", it) }
if (torr.data.isNotBlank()) vintent.putExtra("data", torr.data)
vintent.putExtra("save", false)
return vintent
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ru.yourok.torrserve.server.models.torrent
data class Torrent(
var title: String,
var poster: String,
var category: String,
var category: String?,
var data: String,
var timestamp: Long,
var name: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TorrentsAdapter(private val activity: FragmentActivity) : BaseAdapter() {
override fun getView(position: Int, view: View?, parent: ViewGroup?): View {
val vi = view ?: LayoutInflater.from(parent?.context).inflate(R.layout.torrent_item, parent, false)

val category = list[position].category
val category = list[position].category ?: ""
var title = if (category.isNotBlank()) "${category.uppercase()}${list[position].title}" else list[position].title
val poster = list[position].poster
val hash = list[position].hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TorrentsFragment : TSFragment() {
intent.action = Intent.ACTION_VIEW
intent.putExtra("hash", torr.hash)
intent.putExtra("title", torr.title)
intent.putExtra("category", torr.category)
torr.category?.let { if (it.isNotBlank()) intent.putExtra("category", it) }
intent.putExtra("poster", torr.poster)
intent.putExtra("action", "play")
App.context.startActivity(intent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ open class InfoFragment : TSFragment() {
else
findViewById<ImageView>(R.id.ivPoster)?.visibility = View.GONE
}
val category = torr.category
val category = torr.category ?: ""
val title = if (category.isNotBlank()) "${category.uppercase()}${torr.title}" else torr.title

if (title.isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ object TorrentHelper {
}
}
val title = format.tags?.title ?: torrent.title
val category = torrent.category
val category = torrent.category ?: ""
val size = Format.byteFmt(ffp.format.size.toDouble())
val duration = Format.durFmtS(ffp.format.duration.toDouble())
val bitrate = Format.speedFmt(ffp.format.bit_rate.toDouble() / 8)
Expand Down

0 comments on commit c03ab55

Please sign in to comment.