Skip to content

Commit

Permalink
6.8.0 preview commit
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Sep 26, 2024
1 parent 0b68607 commit 1684190
Show file tree
Hide file tree
Showing 24 changed files with 640 additions and 1,658 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ android {
testApplicationId "ac.mdiq.podcini.tests"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

versionCode 3020256
versionName "6.7.3"
versionCode 3020257
versionName "6.8.0"

applicationId "ac.mdiq.podcini.R"
def commit = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,9 @@ object Episodes {
}
if (resetMediaPosition) it.media?.setPosition(0)
}
Logd(TAG, "setPlayStateSync played0: ${result.playState}")
if (played == PlayState.PLAYED.code && shouldMarkedPlayedRemoveFromQueues()) removeFromAllQueuesSync(result)
Logd(TAG, "setPlayStateSync played: ${result.playState}")
Logd(TAG, "setPlayStateSync played1: ${result.playState}")
EventFlow.postEvent(FlowEvent.EpisodePlayedEvent(result))
return result
}
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/kotlin/ac/mdiq/podcini/storage/model/Episode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,13 @@ class Episode : RealmObject {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is Episode) return false
return id == other.id
return id == other.id && playState == other.playState
}

override fun hashCode(): Int {
return (id xor (id ushr 32)).toInt()
var result = (id xor (id ushr 32)).toInt()
result = 31 * result + playState.hashCode()
return result
}

enum class PlayState(val code: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ abstract class EpisodeActionButton internal constructor(@JvmField var item: Epis
val composeView = ComposeView(context).apply {
setContent {
val showDialog = remember { mutableStateOf(true) }
CustomTheme(context) {
AltActionsDialog(context, showDialog.value, onDismiss = {
showDialog.value = false
})
}
CustomTheme(context) { AltActionsDialog(context, showDialog.value, onDismiss = { showDialog.value = false }) }
}
}
(button as? ViewGroup)?.addView(composeView)
Expand All @@ -66,69 +62,38 @@ abstract class EpisodeActionButton internal constructor(@JvmField var item: Epis
fun AltActionsDialog(context: Context, showDialog: Boolean, onDismiss: () -> Unit) {
if (showDialog) {
Dialog(onDismissRequest = onDismiss) {
Card(modifier = Modifier
.wrapContentSize(align = Alignment.Center)
.padding(16.dp),
shape = RoundedCornerShape(16.dp),
) {
Row(modifier = Modifier.padding(16.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
Card(modifier = Modifier.wrapContentSize(align = Alignment.Center).padding(16.dp), shape = RoundedCornerShape(16.dp)) {
Row(modifier = Modifier.padding(16.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
val label = getLabel()
if (label != R.string.play_label && label != R.string.pause_label && label != R.string.download_label) {
IconButton(onClick = {
PlayActionButton(item).onClick(context)
onDismiss()
}) {
Image(
painter = painterResource(R.drawable.ic_play_24dp),
contentDescription = "Play"
)
}
}) { Image(painter = painterResource(R.drawable.ic_play_24dp), contentDescription = "Play") }
}
if (label != R.string.stream_label && label != R.string.pause_label) {
if (label != R.string.stream_label && label != R.string.play_label && label != R.string.pause_label && label != R.string.delete_label) {
IconButton(onClick = {
StreamActionButton(item).onClick(context)
onDismiss()
}) {
Image(
painter = painterResource(R.drawable.ic_stream),
contentDescription = "Stream"
)
}
}) { Image(painter = painterResource(R.drawable.ic_stream), contentDescription = "Stream") }
}
if (label != R.string.download_label && label != R.string.play_label) {
if (label != R.string.download_label && label != R.string.play_label && label != R.string.delete_label) {
IconButton(onClick = {
DownloadActionButton(item).onClick(context)
onDismiss()
}) {
Image(
painter = painterResource(R.drawable.ic_download),
contentDescription = "Download"
)
}
}) { Image(painter = painterResource(R.drawable.ic_download), contentDescription = "Download") }
}
if (label != R.string.delete_label && label != R.string.download_label && label != R.string.stream_label) {
IconButton(onClick = {
DeleteActionButton(item).onClick(context)
onDismiss()
}) {
Image(
painter = painterResource(R.drawable.ic_delete),
contentDescription = "Delete"
)
}
}) { Image(painter = painterResource(R.drawable.ic_delete), contentDescription = "Delete") }
}
if (label != R.string.visit_website_label) {
IconButton(onClick = {
VisitWebsiteActionButton(item).onClick(context)
onDismiss()
}) {
Image(
painter = painterResource(R.drawable.ic_web),
contentDescription = "Web"
)
}
}) { Image(painter = painterResource(R.drawable.ic_web), contentDescription = "Web") }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ import ac.mdiq.podcini.ui.actions.actionbutton.DownloadActionButton
import ac.mdiq.podcini.ui.actions.swipeactions.SwipeAction.Companion.NO_ACTION
import ac.mdiq.podcini.ui.activity.MainActivity
import ac.mdiq.podcini.ui.dialog.SwipeActionsDialog
import ac.mdiq.podcini.ui.fragment.AllEpisodesFragment
import ac.mdiq.podcini.ui.fragment.DownloadsFragment
import ac.mdiq.podcini.ui.fragment.HistoryFragment
import ac.mdiq.podcini.ui.fragment.QueuesFragment
import ac.mdiq.podcini.ui.fragment.*
import ac.mdiq.podcini.ui.utils.LocalDeleteModal.deleteEpisodesWarnLocal
import ac.mdiq.podcini.ui.utils.ThemeUtils.getColorFromAttr
import ac.mdiq.podcini.ui.view.EpisodeViewHolder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ class MainActivity : CastEnabledActivity() {
QueuesFragment.TAG -> fragment = QueuesFragment()
AllEpisodesFragment.TAG -> fragment = AllEpisodesFragment()
DownloadsFragment.TAG -> fragment = DownloadsFragment()
DownloadsCFragment.TAG -> fragment = DownloadsCFragment()
HistoryFragment.TAG -> fragment = HistoryFragment()
OnlineSearchFragment.TAG -> fragment = OnlineSearchFragment()
SubscriptionsFragment.TAG -> fragment = SubscriptionsFragment()
Expand Down
38 changes: 0 additions & 38 deletions app/src/main/kotlin/ac/mdiq/podcini/ui/compose/Composables.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
package ac.mdiq.podcini.ui.compose

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp

@OptIn(ExperimentalMaterialApi::class)
@Composable
Expand Down Expand Up @@ -51,35 +45,3 @@ fun Spinner(
}
}
}

@Composable
fun SpeedDial(
modifier: Modifier = Modifier,
mainButtonIcon: @Composable () -> Unit,
fabButtons: List<@Composable () -> Unit>,
onMainButtonClick: () -> Unit,
onFabButtonClick: (Int) -> Unit
) {
var isExpanded by remember { mutableStateOf(false) }
Column(
modifier = modifier,
verticalArrangement = Arrangement.Bottom
) {
if (isExpanded) {
fabButtons.forEachIndexed { index, button ->
FloatingActionButton(
onClick = { onFabButtonClick(index) },
modifier = Modifier.padding(bottom = 4.dp)
) {
button()
}
}
}
FloatingActionButton(
onClick = { onMainButtonClick(); isExpanded = !isExpanded },
// modifier = Modifier.padding(bottom = 16.dp)
) {
mainButtonIcon()
}
}
}
Loading

0 comments on commit 1684190

Please sign in to comment.