From 24cb13cd888ad1523ab935ad07a4a9a2552fb9dc Mon Sep 17 00:00:00 2001 From: Xilin Jia <6257601+XilinJia@users.noreply.github.com> Date: Sat, 7 Sep 2024 22:22:04 +0100 Subject: [PATCH] 6.5.7 commit --- app/build.gradle | 4 +- .../AutoDownloadPreferencesFragment.kt | 2 - .../ui/activity/ShareReceiverActivity.kt | 3 +- .../ui/fragment/AudioPlayerFragment.kt | 2 + .../ui/fragment/FeedSettingsFragment.kt | 49 +++++++------------ changelog.md | 6 +++ .../android/en-US/changelogs/3020241.txt | 5 ++ 7 files changed, 36 insertions(+), 35 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/3020241.txt diff --git a/app/build.gradle b/app/build.gradle index 44b3f858..6e77b238 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 3020240 - versionName "6.5.6" + versionCode 3020241 + versionName "6.5.7" applicationId "ac.mdiq.podcini.R" def commit = "" diff --git a/app/src/main/kotlin/ac/mdiq/podcini/preferences/fragments/AutoDownloadPreferencesFragment.kt b/app/src/main/kotlin/ac/mdiq/podcini/preferences/fragments/AutoDownloadPreferencesFragment.kt index 8e1f932c..410abbef 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/preferences/fragments/AutoDownloadPreferencesFragment.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/preferences/fragments/AutoDownloadPreferencesFragment.kt @@ -50,7 +50,6 @@ class AutoDownloadPreferencesFragment : PreferenceFragmentCompat() { true } if (Build.VERSION.SDK_INT >= 29) findPreference(UserPreferences.Prefs.prefEnableAutoDownloadWifiFilter.name)!!.isVisible = false - findPreference(UserPreferences.Prefs.prefEnableAutoDownloadWifiFilter.name)?.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _: Preference?, newValue: Any? -> if (newValue is Boolean) { @@ -71,7 +70,6 @@ class AutoDownloadPreferencesFragment : PreferenceFragmentCompat() { @SuppressLint("MissingPermission") // getConfiguredNetworks needs location permission starting with API 29 private fun buildAutodownloadSelectedNetworksPreference() { if (Build.VERSION.SDK_INT >= 29) return - val activity: Activity? = activity if (selectedNetworks != null) clearAutodownloadSelectedNetworsPreference() diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/activity/ShareReceiverActivity.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/activity/ShareReceiverActivity.kt index 5a7f7556..cb0d95ce 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/activity/ShareReceiverActivity.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/activity/ShareReceiverActivity.kt @@ -36,7 +36,8 @@ class ShareReceiverActivity : AppCompatActivity() { Log.e(TAG, "feedUrl is empty or null.") showNoPodcastFoundError() } - !feedUrl.matches(Regex("[./%]")) -> { +// plain text + feedUrl.matches(Regex("^[^\\s<>/]+\$")) -> { val intent = MainActivity.showOnlineSearch(this, feedUrl) startActivity(intent) finish() 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 0acaf2af..bcef46c4 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 @@ -549,9 +549,11 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar val mediaType = media.getMediaType() if (mediaType == MediaType.AUDIO || videoPlayMode == VideoMode.AUDIO_ONLY.code || videoMode == VideoMode.AUDIO_ONLY || (media is EpisodeMedia && media.episode?.feed?.preferences?.videoModePolicy == VideoMode.AUDIO_ONLY)) { + Logd(TAG, "popping as audio episode") ensureService() (activity as MainActivity).bottomSheet.setState(BottomSheetBehavior.STATE_EXPANDED) } else { + Logd(TAG, "popping video activity") // playPause() // controller!!.ensureService() val intent = getPlayerActivityIntent(requireContext(), mediaType) diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/FeedSettingsFragment.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/FeedSettingsFragment.kt index c66023d1..4f857c30 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/FeedSettingsFragment.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/FeedSettingsFragment.kt @@ -10,7 +10,6 @@ import ac.mdiq.podcini.playback.base.VideoMode.Companion.videoModeTags import ac.mdiq.podcini.preferences.UserPreferences.isEnableAutodownload import ac.mdiq.podcini.storage.database.Feeds.persistFeedPreferences import ac.mdiq.podcini.storage.database.RealmDB.realm -import ac.mdiq.podcini.storage.database.RealmDB.runOnIOScope import ac.mdiq.podcini.storage.database.RealmDB.upsertBlk import ac.mdiq.podcini.storage.model.* import ac.mdiq.podcini.storage.model.FeedPreferences.* @@ -416,7 +415,7 @@ class FeedSettingsFragment : Fragment() { } if (isEnableAutodownload && feed?.type != Feed.FeedType.YOUTUBE.name) { // auto download - var audoDownloadChecked by remember { mutableStateOf(feed?.preferences?.autoDownload ?: true) } + var audoDownloadChecked by remember { mutableStateOf(feed?.preferences?.autoDownload ?: false) } Column { Row(Modifier.fillMaxWidth()) { Text( @@ -430,9 +429,7 @@ class FeedSettingsFragment : Fragment() { modifier = Modifier.height(24.dp), onCheckedChange = { audoDownloadChecked = it - feed = upsertBlk(feed!!) { f -> - f.preferences?.autoDownload = audoDownloadChecked - } + feed = upsertBlk(feed!!) { f -> f.preferences?.autoDownload = audoDownloadChecked } } ) } @@ -768,9 +765,7 @@ class FeedSettingsFragment : Fragment() { Logd(TAG, "row clicked: $item $selectedOption") if (item != selectedOption) { onOptionSelected(item) - feed = upsertBlk(feed!!) { - it.preferences?.volumeAdaptionSetting = item - } + feed = upsertBlk(feed!!) { it.preferences?.volumeAdaptionSetting = item } onDismissRequest() } } @@ -817,9 +812,7 @@ class FeedSettingsFragment : Fragment() { Logd(TAG, "row clicked: $item $selectedOption") if (item != selectedOption) { onOptionSelected(item) - feed = upsertBlk(feed!!) { - it.preferences?.autoDLPolicy = item - } + feed = upsertBlk(feed!!) { it.preferences?.autoDLPolicy = item } // getAutoDeletePolicy() onDismissRequest() } @@ -854,18 +847,14 @@ class FeedSettingsFragment : Fragment() { ) { var newCache by remember { mutableStateOf((feed?.preferences?.autoDLMaxEpisodes ?: 1).toString()) } TextField(value = newCache, - onValueChange = { if (it.toIntOrNull() != null) newCache = it }, + onValueChange = { if (it.isEmpty() || it.toIntOrNull() != null) newCache = it }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), - visualTransformation = PositiveIntegerTransform(), +// visualTransformation = PositiveIntegerTransform(), label = { Text("Max episodes allowed") } ) Button(onClick = { if (newCache.isNotEmpty()) { - runOnIOScope { - feed = upsertBlk(feed!!) { - it.preferences?.autoDLMaxEpisodes = newCache.toIntOrNull() ?: 1 - } - } + feed = upsertBlk(feed!!) { it.preferences?.autoDLMaxEpisodes = newCache.toIntOrNull() ?: 1 } onDismiss() } }) { @@ -993,16 +982,16 @@ class FeedSettingsFragment : Fragment() { ) { var intro by remember { mutableStateOf((feed?.preferences?.introSkip ?: 0).toString()) } TextField(value = intro, - onValueChange = { if (it.toIntOrNull() != null) intro = it }, + onValueChange = { if (it.isEmpty() || it.toIntOrNull() != null) intro = it }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), - visualTransformation = PositiveIntegerTransform(), +// visualTransformation = PositiveIntegerTransform(), label = { Text("Skip first (seconds)") } ) var ending by remember { mutableStateOf((feed?.preferences?.endingSkip ?: 0).toString()) } TextField(value = ending, - onValueChange = { if (it.toIntOrNull() != null) ending = it }, + onValueChange = { if (it.isEmpty() || it.toIntOrNull() != null) ending = it }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), - visualTransformation = PositiveIntegerTransform(), +// visualTransformation = PositiveIntegerTransform(), label = { Text("Skip last (seconds)") } ) Button(onClick = { @@ -1022,7 +1011,7 @@ class FeedSettingsFragment : Fragment() { } } - fun PlaybackSpeedDialog(): AlertDialog { + private fun PlaybackSpeedDialog(): AlertDialog { val binding = PlaybackSpeedFeedSettingDialogBinding.inflate(LayoutInflater.from(requireContext())) binding.seekBar.setProgressChangedListener { speed: Float? -> binding.currentSpeedLabel.text = String.format(Locale.getDefault(), "%.2fx", speed) @@ -1049,13 +1038,13 @@ class FeedSettingsFragment : Fragment() { .create() } - class PositiveIntegerTransform : VisualTransformation { - override fun filter(text: AnnotatedString): TransformedText { - val trimmedText = text.text.filter { it.isDigit() } - val transformedText = if (trimmedText.isNotEmpty() && trimmedText.toInt() > 0) trimmedText else "" - return TransformedText(AnnotatedString(transformedText), OffsetMapping.Identity) - } - } +// class PositiveIntegerTransform : VisualTransformation { +// override fun filter(text: AnnotatedString): TransformedText { +// val trimmedText = text.text.filter { it.isDigit() } +// val transformedText = if (trimmedText.isNotEmpty() && trimmedText.toInt() > 0) trimmedText else "" +// return TransformedText(AnnotatedString(transformedText), OffsetMapping.Identity) +// } +// } /** * Displays a dialog with a text box for filtering episodes and two radio buttons for exclusion/inclusion diff --git a/changelog.md b/changelog.md index 0c2cd3d7..86391acd 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +# 6.5.7 + +* in every feed settings, in case the preferences are not properly set, auto-download is by default disabled +* fixed mis-behavior of entering number in textfield in FeedSettings +* fixed the issue of ShareReceiver not detecting url or plain text correctly + # 6.5.6 * in feed preferences, the setting "play audio only" for video feed is replaced with the setting of a video mode. If you set the previous setting, you need to redo with the new setting. diff --git a/fastlane/metadata/android/en-US/changelogs/3020241.txt b/fastlane/metadata/android/en-US/changelogs/3020241.txt new file mode 100644 index 00000000..73891f91 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/3020241.txt @@ -0,0 +1,5 @@ + Version 6.5.7 brings several changes: + +* in every feed settings, in case the preferences are not properly set, auto-download is by default disabled +* fixed mis-behavior of entering number in textfield in FeedSettings +* fixed the issue of ShareReceiver not detecting url or plain text correctly