Skip to content

Commit f321e98

Browse files
authored
Merge pull request #2177 from Luna712/cleanup
Some cleanup to redundant calls
2 parents cefe43d + 05752bf commit f321e98

File tree

24 files changed

+32
-33
lines changed

24 files changed

+32
-33
lines changed

app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/Addic7ed.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class Addic7ed : SubtitleAPI() {
8686
newSubtitleEntity(
8787
displayName = node.select("td:eq(2)").text() + "\n" + node.select("td:eq(4)").text(),
8888
link = node.selectFirst("a[href~=updated\\/|original\\/]")?.attr("href")?.fixUrl(),
89-
isHearingImpaired = node.select("td:eq(6)")!!.text().isNotEmpty()
89+
isHearingImpaired = node.select("td:eq(6)").text().isNotEmpty()
9090
)
9191
else null
9292
}

app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadChildFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class DownloadChildFragment : BaseFragment<FragmentChildDownloadsBinding>(
146146
}
147147
)
148148

149-
binding.downloadChildList?.apply {
149+
binding.downloadChildList.apply {
150150
setHasFixedSize(true)
151151
setItemViewCacheSize(20)
152152
this.adapter = adapter

app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ class DownloadFragment : BaseFragment<FragmentDownloadsBinding>(
386386
ActivityResultContracts.StartActivityForResult()
387387
) { result ->
388388
if (result.resultCode != Activity.RESULT_OK) return@registerForActivityResult
389-
val selectedVideoUri = result?.data?.data ?: return@registerForActivityResult
389+
val selectedVideoUri = result.data?.data ?: return@registerForActivityResult
390390
playUri(activity ?: return@registerForActivityResult, selectedVideoUri)
391391
}
392392
}

app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(
309309
val pairList = getPairList(header)
310310
for ((button, types) in pairList) {
311311
button?.isChecked =
312-
button?.isVisible == true && selectedTypes.any { types.contains(it) }
312+
button.isVisible && selectedTypes.any { types.contains(it) }
313313
}
314314
}
315315

@@ -419,7 +419,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(
419419
val name = getItem(position)
420420
titleText?.text = name
421421
val isPinned =
422-
pinnedphashset.contains(currentValidApis[position].name ?: "")
422+
pinnedphashset.contains(currentValidApis[position].name)
423423
pinIcon.visibility = if (isPinned) View.VISIBLE else View.GONE
424424
return view
425425
}

app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ class LibraryFragment : BaseFragment<FragmentLibraryBinding>(
470470
val all = binding.viewpager.allViews.toList()
471471
.filterIsInstance<AutofitRecyclerView>()
472472

473-
all?.forEach { view ->
473+
all.forEach { view ->
474474
view.isVisible = view.tag == position
475475
view.isFocusable = view.tag == position
476476

app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchResultBuilder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ object SearchResultBuilder {
266266

267267
if (card.type?.isMovieType() == false) {
268268
cardText?.text =
269-
cardText?.context?.getNameFull(card.name, card.episode, card.season)
269+
cardText.context?.getNameFull(card.name, card.episode, card.season)
270270
}
271271
}
272272

app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsGeneral.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ import java.util.Locale
5050
// Change local language settings in the app.
5151
fun getCurrentLocale(context: Context): String {
5252
val conf = context.resources.configuration
53-
54-
return ConfigurationCompat.getLocales(conf)?.get(0)?.toLanguageTag() ?: "en"
53+
return ConfigurationCompat.getLocales(conf).get(0)?.toLanguageTag() ?: "en"
5554
}
5655

5756
/**

app/src/main/java/com/lagradost/cloudstream3/utils/FillerEpisodeCheck.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ object FillerEpisodeCheck {
9292
if (!localList.containsKey(realQuery)) return null
9393
val href = localList[realQuery]?.replace(MAIN_URL, "") ?: return null // JUST IN CASE
9494
val result = app.get("$MAIN_URL$href").text
95-
val documented = Jsoup.parse(result) ?: return null
95+
val documented = Jsoup.parse(result)
9696
val hashMap = HashMap<Int, Boolean>()
9797
documented.select("table.EpisodeList > tbody > tr").forEach {
9898
val type = it.selectFirst("td.Type > span")?.text() == "Filler"

app/src/main/java/com/lagradost/cloudstream3/utils/PercentageCropImageView.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ class PercentageCropImageView : androidx.appcompat.widget.AppCompatImageView {
9292
var dy = 0f
9393
if (dWidth * vHeight > vWidth * dHeight) {
9494
val cropXCenterOffsetPct =
95-
if (mCropXCenterOffsetPct != null) mCropXCenterOffsetPct!!.toFloat() else 0.5f
95+
if (mCropXCenterOffsetPct != null) mCropXCenterOffsetPct!! else 0.5f
9696
scale = vHeight.toFloat() / dHeight.toFloat()
9797
dx = (vWidth - dWidth * scale) * cropXCenterOffsetPct
9898
} else {
9999
val cropYCenterOffsetPct =
100-
if (mCropYCenterOffsetPct != null) mCropYCenterOffsetPct!!.toFloat() else 0f
100+
if (mCropYCenterOffsetPct != null) mCropYCenterOffsetPct!! else 0f
101101
scale = vWidth.toFloat() / dWidth.toFloat()
102102
dy = (vHeight - dHeight * scale) * cropYCenterOffsetPct
103103
}

app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ object VideoDownloadManager {
388388
val mbFormat = "%.1f MB"
389389

390390
if (hlsProgress != null && hlsTotal != null) {
391-
progressPercentage = hlsProgress.toLong() * 100 / hlsTotal
391+
progressPercentage = hlsProgress * 100 / hlsTotal
392392
progressMbString = hlsProgress.toString()
393393
totalMbString = hlsTotal.toString()
394394
suffix = " - $mbFormat".format(progress / 1000000f)

0 commit comments

Comments
 (0)