Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ android {
resValue("string", "commit_hash", getGitCommitHash())
resValue("bool", "is_prerelease", "false")

manifestPlaceholders["target_sdk_version"] = libs.versions.targetSdk.get()

// Reads local.properties
val localProperties = gradleLocalProperties(rootDir, project.providers)

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:targetApi="35">
tools:targetApi="${target_sdk_version}">

<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
Expand Down
53 changes: 29 additions & 24 deletions app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ import com.lagradost.cloudstream3.ui.search.SearchResultBuilder
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
import com.lagradost.cloudstream3.ui.settings.Globals.TV
import com.lagradost.cloudstream3.ui.settings.Globals.isLandscape
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
import com.lagradost.cloudstream3.ui.settings.Globals.updateTv
import com.lagradost.cloudstream3.ui.settings.SettingsGeneral
Expand Down Expand Up @@ -162,12 +163,14 @@ import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
import com.lagradost.cloudstream3.utils.SnackbarHelper.showSnackbar
import com.lagradost.cloudstream3.utils.UIHelper.changeStatusBarState
import com.lagradost.cloudstream3.utils.UIHelper.checkWrite
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
import com.lagradost.cloudstream3.utils.UIHelper.enableEdgeToEdgeCompat
import com.lagradost.cloudstream3.utils.UIHelper.fixSystemBarsPadding
import com.lagradost.cloudstream3.utils.UIHelper.getResourceColor
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
import com.lagradost.cloudstream3.utils.UIHelper.navigate
import com.lagradost.cloudstream3.utils.UIHelper.requestRW
import com.lagradost.cloudstream3.utils.UIHelper.setNavigationBarColorCompat
import com.lagradost.cloudstream3.utils.UIHelper.toPx
import com.lagradost.cloudstream3.utils.USER_PROVIDER_API
import com.lagradost.cloudstream3.utils.USER_SELECTED_HOMEPAGE_API
Expand Down Expand Up @@ -539,25 +542,14 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
layoutParams = params
}*/

val landscape = when (resources.configuration.orientation) {
Configuration.ORIENTATION_LANDSCAPE -> {
true
}

Configuration.ORIENTATION_PORTRAIT -> {
isLayout(TV or EMULATOR)
}

else -> {
false
}
}

binding?.apply {
navRailView.isVisible = isNavVisible && landscape
navView.isVisible = isNavVisible && !landscape
navHostFragment.layoutParams = (navHostFragment.layoutParams as ViewGroup.MarginLayoutParams).apply {
marginStart = if (isNavVisible && landscape && isLayout(TV or EMULATOR)) 62.toPx else 0
navRailView.isVisible = isNavVisible && isLandscape()
navView.isVisible = isNavVisible && !isLandscape()
navHostFragment.apply {
val marginPx = resources.getDimensionPixelSize(R.dimen.nav_rail_view_width)
layoutParams = (navHostFragment.layoutParams as ViewGroup.MarginLayoutParams).apply {
marginStart = if (isNavVisible && isLandscape() && isLayout(TV or EMULATOR)) marginPx else 0
}
}

/**
Expand Down Expand Up @@ -1185,6 +1177,8 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
MainAPI.settingsForProvider = settingsForProvider

loadThemes(this)
enableEdgeToEdgeCompat()
setNavigationBarColorCompat(R.attr.primaryGrayBackground)
updateLocale()
super.onCreate(savedInstanceState)
try {
Expand Down Expand Up @@ -1268,6 +1262,20 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
null
}

fixSystemBarsPadding(
binding?.navView,
heightResId = R.dimen.nav_view_height,
padTop = false,
overlayCutout = false
)

fixSystemBarsPadding(
binding?.navRailView,
widthResId = R.dimen.nav_rail_view_width,
padRight = false,
padTop = false
)

// overscan
val padding = settingsManager.getInt(getString(R.string.overscan_key), 0).toPx
binding?.homeRoot?.setPadding(padding, padding, padding, padding)
Expand Down Expand Up @@ -1650,9 +1658,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
if (navDestination.matchDestination(R.id.navigation_home)) {
attachBackPressedCallback("MainActivity") {
showConfirmExitDialog(settingsManager)
@Suppress("DEPRECATION")
window?.navigationBarColor =
colorFromAttribute(R.attr.primaryGrayBackground)
setNavigationBarColorCompat(R.attr.primaryGrayBackground)
updateLocale()
}
} else detachBackPressedCallback("MainActivity")
Expand Down Expand Up @@ -2021,8 +2027,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
this,
object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
@Suppress("DEPRECATION")
window?.navigationBarColor = colorFromAttribute(R.attr.primaryGrayBackground)
setNavigationBarColorCompat(R.attr.primaryGrayBackground)
updateLocale()

// If we don't disable we end up in a loop with default behavior calling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ import com.lagradost.cloudstream3.utils.BiometricAuthenticator.startBiometricAut
import com.lagradost.cloudstream3.utils.DataStoreHelper.accounts
import com.lagradost.cloudstream3.utils.DataStoreHelper.selectedKeyIndex
import com.lagradost.cloudstream3.utils.DataStoreHelper.setAccount
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
import com.lagradost.cloudstream3.utils.UIHelper.enableEdgeToEdgeCompat
import com.lagradost.cloudstream3.utils.UIHelper.fixSystemBarsPadding
import com.lagradost.cloudstream3.utils.UIHelper.openActivity
import com.lagradost.cloudstream3.utils.UIHelper.setNavigationBarColorCompat

class AccountSelectActivity : FragmentActivity(), BiometricCallback {

Expand All @@ -43,8 +45,8 @@ class AccountSelectActivity : FragmentActivity(), BiometricCallback {
super.onCreate(savedInstanceState)
loadThemes(this)

@Suppress("DEPRECATION")
window.navigationBarColor = colorFromAttribute(R.attr.primaryBlackBackground)
enableEdgeToEdgeCompat()
setNavigationBarColorCompat(R.attr.primaryBlackBackground)

// Are we editing and coming from MainActivity?
val isEditingFromMainActivity = intent.getBooleanExtra(
Expand Down Expand Up @@ -105,6 +107,7 @@ class AccountSelectActivity : FragmentActivity(), BiometricCallback {

val binding = ActivityAccountSelectBinding.inflate(layoutInflater)
setContentView(binding.root)
fixSystemBarsPadding(binding.root, padTop = false)

val recyclerView: AutofitRecyclerView = binding.accountRecyclerView

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ import com.lagradost.cloudstream3.ui.result.FOCUS_SELF
import com.lagradost.cloudstream3.ui.result.setLinearListLayout
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
import com.lagradost.cloudstream3.ui.settings.Globals.TV
import com.lagradost.cloudstream3.ui.settings.Globals.isLandscape
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
import com.lagradost.cloudstream3.utils.BackPressedCallbackHelper.attachBackPressedCallback
import com.lagradost.cloudstream3.utils.BackPressedCallbackHelper.detachBackPressedCallback
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
import com.lagradost.cloudstream3.utils.UIHelper.fixSystemBarsPadding
import com.lagradost.cloudstream3.utils.UIHelper.setAppBarNoScrollFlagsOnTV

class DownloadChildFragment : Fragment() {
Expand Down Expand Up @@ -162,7 +164,11 @@ class DownloadChildFragment : Fragment() {
}

context?.let { downloadsViewModel.updateChildList(it, folder) }
fixPaddingStatusbar(binding?.downloadChildRoot)
fixSystemBarsPadding(
binding?.downloadChildRoot,
padBottom = isLandscape(),
padLeft = isLayout(TV or EMULATOR)
)
}

private fun handleSelectedChange(selected: MutableSet<Int>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ import com.lagradost.cloudstream3.ui.player.LinkGenerator
import com.lagradost.cloudstream3.ui.player.OfflinePlaybackHelper.playUri
import com.lagradost.cloudstream3.ui.result.FOCUS_SELF
import com.lagradost.cloudstream3.ui.result.setLinearListLayout
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
import com.lagradost.cloudstream3.ui.settings.Globals.TV
import com.lagradost.cloudstream3.ui.settings.Globals.isLandscape
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
import com.lagradost.cloudstream3.utils.AppContextUtils.loadResult
import com.lagradost.cloudstream3.utils.BackPressedCallbackHelper.attachBackPressedCallback
import com.lagradost.cloudstream3.utils.BackPressedCallbackHelper.detachBackPressedCallback
import com.lagradost.cloudstream3.utils.DOWNLOAD_EPISODE_CACHE
import com.lagradost.cloudstream3.utils.DataStore.getFolderName
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
import com.lagradost.cloudstream3.utils.UIHelper.fixSystemBarsPadding
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
import com.lagradost.cloudstream3.utils.UIHelper.navigate
import com.lagradost.cloudstream3.utils.UIHelper.setAppBarNoScrollFlagsOnTV
Expand Down Expand Up @@ -236,7 +238,11 @@ class DownloadFragment : Fragment() {
}

context?.let { downloadsViewModel.updateHeaderList(it) }
fixPaddingStatusbar(binding?.downloadRoot)
fixSystemBarsPadding(
binding?.downloadRoot,
padBottom = isLandscape(),
padLeft = isLayout(TV or EMULATOR)
)
}

private fun handleItemClick(click: DownloadHeaderClickEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import com.lagradost.cloudstream3.ui.search.SearchHelper.handleSearchClickCallba
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
import com.lagradost.cloudstream3.ui.settings.Globals.TV
import com.lagradost.cloudstream3.ui.settings.Globals.isLandscape
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
import com.lagradost.cloudstream3.utils.AppContextUtils.filterProviderByPreferredMedia
import com.lagradost.cloudstream3.utils.AppContextUtils.getApiProviderLangSettings
Expand All @@ -70,6 +71,7 @@ import com.lagradost.cloudstream3.utils.Event
import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso
import com.lagradost.cloudstream3.utils.TvChannelUtils
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
import com.lagradost.cloudstream3.utils.UIHelper.fixSystemBarsPadding
import com.lagradost.cloudstream3.utils.UIHelper.getSpanCount
import com.lagradost.cloudstream3.utils.UIHelper.navigate
import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIconsAndNoStringRes
Expand Down Expand Up @@ -642,6 +644,12 @@ class HomeFragment : Fragment() {
context?.let { HomeChildItemAdapter.updatePosterSize(it) }

binding?.apply {
fixSystemBarsPadding(
root,
padTop = false,
padBottom = isLandscape(),
padLeft = isLayout(TV or EMULATOR)
)
//homeChangeApiLoading.setOnClickListener(apiChangeClickListener)
//homeChangeApiLoading.setOnClickListener(apiChangeClickListener)
homeApiFab.setOnClickListener(apiChangeClickListener)
Expand All @@ -666,7 +674,6 @@ class HomeFragment : Fragment() {
homeViewModel, accountViewModel
)
homeMasterRecycler.adapter = homeMasterAdapter
//fixPaddingStatusbar(homeLoadingStatusbar)

homeApiFab.isVisible = isLayout(PHONE)

Expand Down Expand Up @@ -849,10 +856,6 @@ class HomeFragment : Fragment() {
}
}


//context?.fixPaddingStatusbarView(home_statusbar)
//context?.fixPaddingStatusbar(home_padding)

observeNullable(homeViewModel.popup) { item ->
if (item == null) {
bottomSheetDialog?.dismissSafe()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ class HomeParentItemAdapterPreview(
nextLeft = R.id.nav_rail_view,
nextRight = FOCUS_SELF
)

bookmarkRecyclerView.setLinearListLayout(
nextLeft = R.id.nav_rail_view,
nextRight = FOCUS_SELF
Expand Down Expand Up @@ -602,9 +603,7 @@ class HomeParentItemAdapterPreview(
params.height = 0
layoutParams = params
}
} else {
fixPaddingStatusbarView(homeNonePadding)
}
} else fixPaddingStatusbarView(homeNonePadding)

when (preview) {
is Resource.Success -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.lagradost.cloudstream3.ui.home

import android.content.res.Configuration
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand All @@ -13,6 +12,7 @@ import com.lagradost.cloudstream3.ui.NoStateAdapter
import com.lagradost.cloudstream3.ui.ViewHolderState
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
import com.lagradost.cloudstream3.ui.settings.Globals.TV
import com.lagradost.cloudstream3.ui.settings.Globals.isLandscape
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
import com.lagradost.cloudstream3.utils.ImageLoader.loadImage

Expand Down Expand Up @@ -40,11 +40,9 @@ class HomeScrollAdapter(
) {
val binding = holder.view
val itemView = holder.itemView
val isHorizontal =
binding is HomeScrollViewTvBinding || itemView.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE

val posterUrl =
if (isHorizontal) item.backgroundPosterUrl ?: item.posterUrl else item.posterUrl
if (isLandscape()) item.backgroundPosterUrl ?: item.posterUrl else item.posterUrl
?: item.backgroundPosterUrl

when (binding) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ import com.lagradost.cloudstream3.ui.search.SEARCH_ACTION_SHOW_METADATA
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
import com.lagradost.cloudstream3.ui.settings.Globals.TV
import com.lagradost.cloudstream3.ui.settings.Globals.isLandscape
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
import com.lagradost.cloudstream3.utils.AppContextUtils.loadResult
import com.lagradost.cloudstream3.utils.AppContextUtils.loadSearchResult
import com.lagradost.cloudstream3.utils.AppContextUtils.reduceDragSensitivity
import com.lagradost.cloudstream3.utils.DataStoreHelper.currentAccount
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
import com.lagradost.cloudstream3.utils.UIHelper.fixSystemBarsPadding
import com.lagradost.cloudstream3.utils.UIHelper.getSpanCount
import java.util.concurrent.CopyOnWriteArrayList
import kotlin.math.abs
Expand Down Expand Up @@ -150,7 +151,11 @@ class LibraryFragment : Fragment() {
@SuppressLint("ResourceType", "CutPasteId")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
fixPaddingStatusbar(binding?.searchStatusBarPadding)
fixSystemBarsPadding(
binding?.root,
padBottom = isLandscape(),
padLeft = isLayout(TV or EMULATOR)
)

binding?.sortFab?.setOnClickListener(sortChangeClickListener)
binding?.librarySort?.setOnClickListener(sortChangeClickListener)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.lagradost.cloudstream3.mvvm.safe
import com.lagradost.cloudstream3.ui.player.OfflinePlaybackHelper.playLink
import com.lagradost.cloudstream3.ui.player.OfflinePlaybackHelper.playUri
import com.lagradost.cloudstream3.utils.BackPressedCallbackHelper.attachBackPressedCallback
import com.lagradost.cloudstream3.utils.UIHelper.enableEdgeToEdgeCompat

class DownloadedPlayerActivity : AppCompatActivity() {
private val dTAG = "DownloadedPlayerAct"
Expand All @@ -30,6 +31,7 @@ class DownloadedPlayerActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
CommonActivity.loadThemes(this)
CommonActivity.init(this)
enableEdgeToEdgeCompat()
setContentView(R.layout.empty_layout)
Log.i(dTAG, "onCreate")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import com.lagradost.cloudstream3.utils.BackPressedCallbackHelper.detachBackPres
import com.lagradost.cloudstream3.utils.DataStoreHelper
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
import com.lagradost.cloudstream3.utils.UIHelper.fixSystemBarsPadding
import com.lagradost.cloudstream3.utils.UIHelper.getNavigationBarHeight
import com.lagradost.cloudstream3.utils.UIHelper.getStatusBarHeight
import com.lagradost.cloudstream3.utils.UIHelper.hideSystemUI
Expand Down Expand Up @@ -550,10 +551,11 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
val binding = SubtitleOffsetBinding.inflate(LayoutInflater.from(ctx), null, false)

// Use dialog as opposed to alertdialog to get fullscreen
val dialog = Dialog(ctx, R.style.AlertDialogCustomBlack).apply {
val dialog = Dialog(ctx, R.style.DialogFullscreenPlayer).apply {
setContentView(binding.root)
}
dialog.show()
fixSystemBarsPadding(binding.root)

var currentOffset = subtitleDelay
binding.apply {
Expand Down
Loading