diff --git a/app/build.gradle b/app/build.gradle index c073e74e..f0364133 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,8 +31,8 @@ android { testApplicationId "ac.mdiq.podcini.tests" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - versionCode 3020278 - versionName "6.12.0" + versionCode 3020279 + versionName "6.12.1" applicationId "ac.mdiq.podcini.R" def commit = "" diff --git a/app/src/free/kotlin/ac/mdiq/podcini/playback/cast/CastEnabledActivity.kt b/app/src/free/kotlin/ac/mdiq/podcini/playback/cast/CastEnabledActivity.kt index 36d34d05..aed13e03 100644 --- a/app/src/free/kotlin/ac/mdiq/podcini/playback/cast/CastEnabledActivity.kt +++ b/app/src/free/kotlin/ac/mdiq/podcini/playback/cast/CastEnabledActivity.kt @@ -2,6 +2,7 @@ package ac.mdiq.podcini.playback.cast import android.view.Menu import androidx.appcompat.app.AppCompatActivity +import androidx.compose.runtime.Composable /** * Activity that allows for showing the MediaRouter button whenever there's a cast device in the @@ -10,8 +11,8 @@ import androidx.appcompat.app.AppCompatActivity abstract class CastEnabledActivity : AppCompatActivity() { val TAG = this::class.simpleName ?: "Anonymous" - fun requestCastButton(menu: Menu?) { - // no-op - } + fun requestCastButton(menu: Menu?) {} + @Composable + fun CastIconButton() {} } diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/AudioPlayerFragment.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/AudioPlayerFragment.kt index bf4ddf0d..b2f9d905 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/AudioPlayerFragment.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/AudioPlayerFragment.kt @@ -6,11 +6,10 @@ import ac.mdiq.podcini.playback.PlaybackServiceStarter import ac.mdiq.podcini.playback.ServiceStatusHandler import ac.mdiq.podcini.playback.base.InTheatre.curEpisode import ac.mdiq.podcini.playback.base.InTheatre.curMedia -import ac.mdiq.podcini.playback.base.InTheatre.curQueue -import ac.mdiq.podcini.playback.base.InTheatre.isCurrentlyPlaying import ac.mdiq.podcini.playback.base.MediaPlayerBase.Companion.status import ac.mdiq.podcini.playback.base.PlayerStatus import ac.mdiq.podcini.playback.base.VideoMode +import ac.mdiq.podcini.playback.cast.CastEnabledActivity import ac.mdiq.podcini.playback.service.PlaybackService.Companion.curDurationFB import ac.mdiq.podcini.playback.service.PlaybackService.Companion.curPositionFB import ac.mdiq.podcini.playback.service.PlaybackService.Companion.curSpeedFB @@ -338,7 +337,7 @@ class AudioPlayerFragment : Fragment() { val textColor = MaterialTheme.colorScheme.onSurface val mediaType = curMedia?.getMediaType() val notAudioOnly = (curMedia as? EpisodeMedia)?.episode?.feed?.preferences?.videoModePolicy != VideoMode.AUDIO_ONLY - Row(modifier = Modifier.fillMaxWidth().padding(10.dp), horizontalArrangement = Arrangement.SpaceBetween) { + Row(modifier = Modifier.fillMaxWidth().padding(10.dp), horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically) { Icon(imageVector = ImageVector.vectorResource(R.drawable.ic_arrow_down), tint = textColor, contentDescription = "Collapse", modifier = Modifier.clickable { (activity as MainActivity).bottomSheet.setState(BottomSheetBehavior.STATE_COLLAPSED) }) @@ -389,6 +388,7 @@ class AudioPlayerFragment : Fragment() { context.startActivity(intent) } }) + (activity as? CastEnabledActivity)?.CastIconButton() } } @@ -555,7 +555,7 @@ class AudioPlayerFragment : Fragment() { private fun updateDetails() { // if (isLoading) return lifecycleScope.launch { - Logd(TAG, "in updateInfo") + Logd(TAG, "in updateDetails") isLoading = true withContext(Dispatchers.IO) { currentMedia = curMedia @@ -589,7 +589,7 @@ class AudioPlayerFragment : Fragment() { withContext(Dispatchers.Main) { Logd(TAG, "subscribe: ${currentMedia?.getEpisodeTitle()}") displayMediaInfo(currentMedia!!) - (activity as MainActivity).setPlayerVisible(curMedia != null) +// (activity as MainActivity).setPlayerVisible(curMedia != null) // shownoteView.loadDataWithBaseURL("https://127.0.0.1", cleanedNotes?:"No notes", "text/html", "utf-8", "about:blank") Logd(TAG, "Webview loaded") } diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/SubscriptionsFragment.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/SubscriptionsFragment.kt index aeb7bd51..b330259e 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/SubscriptionsFragment.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/SubscriptionsFragment.kt @@ -987,7 +987,7 @@ class SubscriptionsFragment : Fragment(), Toolbar.OnMenuItemClickListener { Row { if (feed.rating != Rating.UNRATED.code) Icon(imageVector = ImageVector.vectorResource(Rating.fromCode(feed.rating).res), tint = MaterialTheme.colorScheme.tertiary, contentDescription = "rating", - modifier = Modifier.background(MaterialTheme.colorScheme.tertiaryContainer)) + modifier = Modifier.width(20.dp).height(20.dp).background(MaterialTheme.colorScheme.tertiaryContainer)) Text(feed.title ?: "No title", color = textColor, maxLines = 1, overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.bodyMedium.copy(fontWeight = FontWeight.Bold)) } diff --git a/app/src/main/res/drawable/baseline_cast_connected_24.xml b/app/src/main/res/drawable/baseline_cast_connected_24.xml new file mode 100644 index 00000000..e91dd98c --- /dev/null +++ b/app/src/main/res/drawable/baseline_cast_connected_24.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/play/kotlin/ac/mdiq/podcini/playback/cast/CastEnabledActivity.kt b/app/src/play/kotlin/ac/mdiq/podcini/playback/cast/CastEnabledActivity.kt index 0d82458a..9f76d71b 100644 --- a/app/src/play/kotlin/ac/mdiq/podcini/playback/cast/CastEnabledActivity.kt +++ b/app/src/play/kotlin/ac/mdiq/podcini/playback/cast/CastEnabledActivity.kt @@ -1,9 +1,21 @@ package ac.mdiq.podcini.playback.cast import ac.mdiq.podcini.R +import ac.mdiq.podcini.util.Logd import android.os.Bundle import android.view.Menu +import android.view.View import androidx.appcompat.app.AppCompatActivity +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.size +import androidx.compose.material3.Icon +import androidx.compose.runtime.* +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.unit.dp +import androidx.compose.ui.viewinterop.AndroidView +import androidx.mediarouter.app.MediaRouteButton import com.google.android.gms.cast.framework.CastButtonFactory import com.google.android.gms.cast.framework.CastContext import com.google.android.gms.common.ConnectionResult @@ -14,7 +26,7 @@ import com.google.android.gms.common.GoogleApiAvailability * network. */ abstract class CastEnabledActivity : AppCompatActivity() { - private var canCast = false + private var canCast by mutableStateOf(false) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -33,4 +45,17 @@ abstract class CastEnabledActivity : AppCompatActivity() { menuInflater.inflate(R.menu.cast_button, menu) CastButtonFactory.setUpMediaRouteButton(applicationContext, menu!!, R.id.media_route_menu_item) } + + @Composable + fun CastIconButton() { + if (canCast) { + AndroidView( modifier = Modifier.size(24.dp), + factory = { ctx -> + MediaRouteButton(ctx).apply { + CastButtonFactory.setUpMediaRouteButton(ctx, this) + } + }, + ) + } + } } diff --git a/changelog.md b/changelog.md index 801b16de..5f5039a5 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +# 6.12.1 + +* fixed circular calling functions when PlayerDetailed view is open +* in the Play apk, added back the cast button that's been missing after 6.10.0 + # 6.12.0 * created a new play state system: Unspecified, Building, New, Unplayed, Later, Soon, InQueue, InProgress, Skipped, Played, Ignored, diff --git a/fastlane/metadata/android/en-US/changelogs/3020279.txt b/fastlane/metadata/android/en-US/changelogs/3020279.txt new file mode 100644 index 00000000..e0541c74 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/3020279.txt @@ -0,0 +1,4 @@ + Version 6.12.1 + +* fixed circular calling functions when PlayerDetailed view is open +* in the Play apk, added back the cast button that's been missing after 6.10.0