Skip to content

Commit

Permalink
6.15.6 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Dec 10, 2024
1 parent f547df6 commit 1b176b7
Show file tree
Hide file tree
Showing 21 changed files with 306 additions and 392 deletions.
2 changes: 0 additions & 2 deletions Licenses_and_permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ Apache License 2.0

[com.squareup.okhttp3](https://github.com/square/okhttp/blob/master/LICENSE.txt) Apache License 2.0

[com.mikepenz:iconics-core](https://github.com/mikepenz/Android-Iconics/blob/develop/LICENSE) Apache License 2.0

[com.github.ByteHamster](https://github.com/ByteHamster/SearchPreference/blob/master/LICENSE) MIT License

[com.github.skydoves](https://github.com/skydoves/Only/blob/master/LICENSE) Apache License 2.0
Expand Down
17 changes: 6 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
vectorDrawables.useSupportLibrary false
vectorDrawables.generatedDensities = []

versionCode 3020314
versionName "6.15.5"
versionCode 3020315
versionName "6.15.6"

applicationId "ac.mdiq.podcini.R"
def commit = ""
Expand Down Expand Up @@ -175,11 +175,13 @@ dependencies {

implementation platform("androidx.compose:compose-bom:2024.11.00")
implementation "androidx.compose.material3:material3:1.3.1"

implementation "androidx.activity:activity-compose:1.9.3"
implementation "androidx.constraintlayout:constraintlayout-compose:1.1.0"
implementation "androidx.navigation:navigation-compose:2.8.4"
implementation "androidx.compose.ui:ui-tooling-preview:1.7.5"

implementation "androidx.annotation:annotation:1.9.1"
implementation "androidx.appcompat:appcompat:1.7.0"
implementation "androidx.constraintlayout:constraintlayout-compose:1.1.0"
implementation "androidx.coordinatorlayout:coordinatorlayout:1.2.0"
implementation "androidx.core:core-ktx:1.15.0"
implementation "androidx.documentfile:documentfile:1.0.1"
Expand All @@ -188,11 +190,9 @@ dependencies {
implementation "androidx.media3:media3-exoplayer:1.5.0"
implementation "androidx.media3:media3-datasource-okhttp:1.5.0"
implementation "androidx.media3:media3-ui:1.5.0"
implementation "androidx.navigation:navigation-compose:2.8.4"
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.3.2"
implementation "androidx.preference:preference-ktx:1.2.1"
implementation "androidx.compose.ui:ui-tooling-preview:1.7.5"
implementation "androidx.webkit:webkit:1.12.1"
implementation "androidx.window:window:1.3.0"
implementation "androidx.work:work-runtime:2.10.0"
Expand All @@ -214,11 +214,6 @@ dependencies {
implementation "org.apache.commons:commons-lang3:3.15.0"
implementation "com.github.mfietz:fyydlin:v0.5.0"

implementation "com.mikepenz:google-material-typeface-outlined:4.0.0.2-kotlin"
implementation "com.mikepenz:google-material-typeface:4.0.0.3-kotlin"
implementation "com.mikepenz:iconics-views:5.5.0-b01"
implementation "com.mikepenz:iconics-core:5.5.0-b01"

implementation "org.jsoup:jsoup:1.18.1"
implementation "io.realm.kotlin:library-base:2.1.0"
implementation "com.squareup.okhttp3:okhttp:4.12.0"
Expand Down
24 changes: 0 additions & 24 deletions app/src/main/assets/licenses.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,12 @@
website="https://github.com/coil-kt/coil"
license="Apache 2.0"
licenseText="LICENSE_APACHE-2.0.txt" />
<library
name="Android-Iconics"
author="Mike Penz and Peter Gulko"
website="https://github.com/mikepenz/Android-Iconics"
license="Apache 2.0"
licenseText="LICENSE_APACHE-2.0.txt" />
<library
name="jsoup"
author="Jonathan Hedley"
website="https://jsoup.org/"
license="MIT"
licenseText="LICENSE_JSOUP.txt" />
<!-- <library-->
<!-- name="Lightweight-Stream-API"-->
<!-- author="Victor Melnik"-->
<!-- website="https://github.com/aNNiMON/Lightweight-Stream-API"-->
<!-- license="Apache 2.0"-->
<!-- licenseText="LICENSE_APACHE-2.0.txt" />-->
<library
name="Material Components for Android"
author="Google"
Expand All @@ -84,12 +72,6 @@
website="https://github.com/google/material-design-icons"
license="Apache 2.0"
licenseText="LICENSE_APACHE-2.0.txt" />
<library
name="Material Design Icons"
author="Templarian"
website="https://github.com/Templarian/MaterialDesign"
license="Pictogrammers Free License"
licenseText="LICENSE_PICTOGRAMMERS.txt" />
<library
name="OkHttp"
author="Square"
Expand All @@ -114,10 +96,4 @@
website="https://github.com/ByteHamster/SearchPreference"
license="MIT"
licenseText="LICENSE_SEARCHPREFERENCE.txt" />
<!-- <library-->
<!-- name="Triangle Label View"-->
<!-- author="Shota Saito"-->
<!-- website="https://github.com/shts/TriangleLabelView"-->
<!-- license="Apache 2.0"-->
<!-- licenseText="LICENSE_TRIANGLE_LABEL_VIEW.txt" />-->
</libraries>
16 changes: 11 additions & 5 deletions app/src/main/kotlin/ac/mdiq/podcini/playback/base/InTheatre.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import ac.mdiq.podcini.storage.model.CurrentState.Companion.NO_MEDIA_PLAYING
import ac.mdiq.podcini.storage.model.CurrentState.Companion.PLAYER_STATUS_OTHER
import ac.mdiq.podcini.util.Logd
import android.util.Log
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableLongStateOf
import androidx.compose.runtime.setValue
import io.realm.kotlin.query.Sort
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand All @@ -29,8 +32,6 @@ object InTheatre {
value != null -> {
field = unmanaged(value)
if (field?.media != null && curMedia?.getIdentifier() != field?.media?.getIdentifier()) curMedia = unmanaged(field!!.media!!)
// field = value
// if (field?.media != null && curMedia?.getIdentifier() != field?.media?.getIdentifier()) curMedia = field!!.media!!
}
else -> {
field = null
Expand All @@ -44,18 +45,23 @@ object InTheatre {
when {
value is EpisodeMedia -> {
field = unmanaged(value)
curMediaId = value.id
if (value.episode != null && curEpisode?.id != value.episode?.id) curEpisode = unmanaged(value.episode!!)
// field = value
// if (value.episode != null && curEpisode?.id != value.episode?.id) curEpisode = value.episode!!
}
value == null -> {
field = null
curMediaId = -1L
if (curEpisode != null) curEpisode = null
}
else -> field = value
else -> {
field = value
curMediaId = 0L
}
}
}

var curMediaId by mutableLongStateOf(-1L)

var curState: CurrentState // managed

init {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ac.mdiq.podcini.playback.base

//import ac.mdiq.podcini.preferences.UserPreferences.videoPlaybackSpeed
import ac.mdiq.podcini.net.download.service.HttpCredentialEncoder
import ac.mdiq.podcini.net.download.service.PodciniHttpClient
import ac.mdiq.podcini.net.utils.NetworkUtils.isNetworkRestricted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ object UserPreferences {
get() {
val buttons = appPrefs.getString(Prefs.prefFullNotificationButtons.name, "${NOTIFICATION_BUTTON.SKIP.ordinal},${NOTIFICATION_BUTTON.PLAYBACK_SPEED.ordinal}")?.split(",") ?: listOf()
val notificationButtons: MutableList<Int> = ArrayList()
for (button in buttons) {
notificationButtons.add(button.toInt())
}
for (button in buttons) notificationButtons.add(button.toInt())
return notificationButtons
}
set(items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ac.mdiq.podcini.ui.activity
import ac.mdiq.podcini.R
import ac.mdiq.podcini.databinding.VideoplayerActivityBinding
import ac.mdiq.podcini.playback.base.InTheatre.curMedia
import ac.mdiq.podcini.playback.base.InTheatre.curMediaId
import ac.mdiq.podcini.playback.base.LocalMediaPlayer
import ac.mdiq.podcini.playback.base.MediaPlayerBase
import ac.mdiq.podcini.playback.base.PlayerStatus
Expand All @@ -23,11 +24,7 @@ import ac.mdiq.podcini.storage.database.RealmDB.upsert
import ac.mdiq.podcini.storage.model.EpisodeMedia
import ac.mdiq.podcini.storage.model.Playable
import ac.mdiq.podcini.ui.activity.starter.MainActivityStarter
import ac.mdiq.podcini.ui.compose.ChaptersDialog
import ac.mdiq.podcini.ui.compose.CustomTextStyles
import ac.mdiq.podcini.ui.compose.CustomTheme
import ac.mdiq.podcini.ui.compose.PlaybackSpeedFullDialog
import ac.mdiq.podcini.ui.dialog.MediaPlayerErrorDialog
import ac.mdiq.podcini.ui.compose.*
import ac.mdiq.podcini.ui.dialog.ShareDialog
import ac.mdiq.podcini.ui.dialog.SleepTimerDialog
import ac.mdiq.podcini.ui.utils.ShownotesCleaner
Expand Down Expand Up @@ -56,9 +53,13 @@ import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.*
import androidx.compose.material3.darkColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
Expand All @@ -79,12 +80,19 @@ class VideoplayerActivity : CastEnabledActivity() {
private var _binding: VideoplayerActivityBinding? = null
private val binding get() = _binding!!
var switchToAudioOnly = false

private var cleanedNotes by mutableStateOf<String?>(null)
private var feedTitle by mutableStateOf("")
private var episodeTitle by mutableStateOf("")
private var showAcrionBar by mutableStateOf(false)
var landscape by mutableStateOf(false)

var showChapterDialog by mutableStateOf(false)
var showAudioControlDialog by mutableStateOf(false)
var showSpeedDialog by mutableStateOf(false)
val showErrorDialog = mutableStateOf(false)
var errorMessage by mutableStateOf("")

override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.Theme_Podcini_VideoPlayer)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
Expand Down Expand Up @@ -118,14 +126,19 @@ class VideoplayerActivity : CastEnabledActivity() {
setForVideoMode()

binding.mainView.setContent {
CustomTheme(this) {
MaterialTheme(colorScheme = darkColorScheme(), typography = CustomTypography, shapes = Shapes) {
if (showChapterDialog) ChaptersDialog(curMedia!!, onDismissRequest = { showChapterDialog = false })
if (showAudioControlDialog) PlaybackControlsDialog(onDismiss = { showAudioControlDialog = false })
if (showSpeedDialog) PlaybackSpeedFullDialog(settingCode = booleanArrayOf(true, true, true), indexDefault = 0, maxSpeed = 3f, onDismiss = { showSpeedDialog = false })
MediaPlayerErrorDialog(this, errorMessage, showErrorDialog)

if (landscape) Box(modifier = Modifier.fillMaxSize()) { VideoPlayer() }
else {
val textColor = MaterialTheme.colorScheme.onSurface
Column(modifier = Modifier.fillMaxSize()) {
Box(modifier = Modifier.fillMaxWidth().aspectRatio(16 / 9f)) { VideoPlayer() }
Text(curMedia?.getFeedTitle()?:"", color = textColor, style = CustomTextStyles.titleCustom, modifier = Modifier.padding(horizontal = 10.dp))
Text(curMedia?.getEpisodeTitle()?:"", color = textColor, style = CustomTextStyles.titleCustom, modifier = Modifier.padding(horizontal = 10.dp))
Text(curMedia?.getFeedTitle()?:"", color = textColor, style = MaterialTheme.typography.titleSmall, modifier = Modifier.padding(horizontal = 10.dp))
MediaDetails()
}
}
Expand Down Expand Up @@ -203,15 +216,15 @@ class VideoplayerActivity : CastEnabledActivity() {
@Composable
fun MediaDetails() {
val textColor = MaterialTheme.colorScheme.onSurface
if (cleanedNotes == null) loadMediaInfo()
LaunchedEffect(curMediaId) { loadMediaInfo() }
AndroidView(modifier = Modifier.fillMaxSize(), factory = { context ->
ShownotesWebView(context).apply {
setTimecodeSelectedListener { time: Int -> seekTo(time) }
setPageFinishedListener {
postDelayed({ }, 50)
}
}
}, update = { webView -> webView.loadDataWithBaseURL("https://127.0.0.1", cleanedNotes?:"No notes", "text/html", "utf-8", "about:blank") })
}, update = { webView -> webView.loadDataWithBaseURL("https://127.0.0.1", if (cleanedNotes.isNullOrBlank()) "No notes" else cleanedNotes!!, "text/html", "utf-8", "about:blank") })
}

override fun onConfigurationChanged(newConfig: Configuration) {
Expand Down Expand Up @@ -318,7 +331,11 @@ class VideoplayerActivity : CastEnabledActivity() {
when (event) {
is FlowEvent.SleepTimerUpdatedEvent -> if (event.isCancelled || event.wasJustEnabled()) supportInvalidateOptionsMenu()
is FlowEvent.PlaybackServiceEvent -> if (event.action == FlowEvent.PlaybackServiceEvent.Action.SERVICE_SHUT_DOWN) finish()
is FlowEvent.PlayerErrorEvent -> MediaPlayerErrorDialog.show(this@VideoplayerActivity, event)
is FlowEvent.PlayerErrorEvent -> {
showErrorDialog.value = true
errorMessage = event.message
// MediaPlayerErrorDialog.show(this@VideoplayerActivity, event)
}
is FlowEvent.MessageEvent -> onEventMainThread(event)
else -> {}
}
Expand Down Expand Up @@ -346,7 +363,6 @@ class VideoplayerActivity : CastEnabledActivity() {

override fun onPrepareOptionsMenu(menu: Menu): Boolean {
super.onPrepareOptionsMenu(menu)

val media = curMedia
val isEpisodeMedia = (media is EpisodeMedia)

Expand Down Expand Up @@ -395,19 +411,7 @@ class VideoplayerActivity : CastEnabledActivity() {
return true
}
R.id.player_show_chapters -> {
val composeView = ComposeView(this).apply {
setContent {
val showDialog = remember { mutableStateOf(true) }
CustomTheme(this@VideoplayerActivity) {
ChaptersDialog(curMedia!!, onDismissRequest = {
showDialog.value = false
(binding.root as? ViewGroup)?.removeView(this@apply)
})
}
}
}
(binding.root as? ViewGroup)?.addView(composeView)
// ChaptersFragment().show(supportFragmentManager, ChaptersFragment.TAG)
showChapterDialog = true
return true
}
else -> {
Expand All @@ -416,20 +420,7 @@ class VideoplayerActivity : CastEnabledActivity() {
when {
item.itemId == R.id.disable_sleeptimer_item || item.itemId == R.id.set_sleeptimer_item ->
SleepTimerDialog().show(supportFragmentManager, "SleepTimerDialog")
item.itemId == R.id.audio_controls -> {
// val dialog = PlaybackControlsDialog.newInstance()
// dialog.show(supportFragmentManager, "playback_controls")
val composeView = ComposeView(this).apply {
setContent {
var showAudioControlDialog by remember { mutableStateOf(true) }
if (showAudioControlDialog) PlaybackControlsDialog(onDismiss = {
showAudioControlDialog = false
(parent as? ViewGroup)?.removeView(this)
})
}
}
(window.decorView as? ViewGroup)?.addView(composeView)
}
item.itemId == R.id.audio_controls -> showAudioControlDialog = true
item.itemId == R.id.open_feed_item && feedItem != null -> {
val intent = MainActivity.getIntentToOpenFeed(this, feedItem.feedId!!)
startActivity(intent)
Expand All @@ -442,20 +433,7 @@ class VideoplayerActivity : CastEnabledActivity() {
val shareDialog = ShareDialog.newInstance(feedItem)
shareDialog.show(supportFragmentManager, "ShareEpisodeDialog")
}
item.itemId == R.id.playback_speed -> {
val composeView = ComposeView(this).apply {
setContent {
var showSpeedDialog by remember { mutableStateOf(true) }
if (showSpeedDialog) PlaybackSpeedFullDialog(settingCode = booleanArrayOf(true, true, true), indexDefault = 0, maxSpeed = 3f,
onDismiss = {
showSpeedDialog = false
(parent as? ViewGroup)?.removeView(this)
})
}
}
(window.decorView as? ViewGroup)?.addView(composeView)
// VariableSpeedDialog.newInstance(booleanArrayOf(true, true, true))?.show(supportFragmentManager, null)
}
item.itemId == R.id.playback_speed -> showSpeedDialog = true
else -> return false
}
return true
Expand Down
Loading

0 comments on commit 1b176b7

Please sign in to comment.