6.5.7 commit

This commit is contained in:
Xilin Jia 2024-09-07 22:22:04 +01:00
parent 621809dc42
commit 24cb13cd88
7 changed files with 36 additions and 35 deletions

View File

@ -31,8 +31,8 @@ android {
testApplicationId "ac.mdiq.podcini.tests" testApplicationId "ac.mdiq.podcini.tests"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
versionCode 3020240 versionCode 3020241
versionName "6.5.6" versionName "6.5.7"
applicationId "ac.mdiq.podcini.R" applicationId "ac.mdiq.podcini.R"
def commit = "" def commit = ""

View File

@ -50,7 +50,6 @@ class AutoDownloadPreferencesFragment : PreferenceFragmentCompat() {
true true
} }
if (Build.VERSION.SDK_INT >= 29) findPreference<Preference>(UserPreferences.Prefs.prefEnableAutoDownloadWifiFilter.name)!!.isVisible = false if (Build.VERSION.SDK_INT >= 29) findPreference<Preference>(UserPreferences.Prefs.prefEnableAutoDownloadWifiFilter.name)!!.isVisible = false
findPreference<Preference>(UserPreferences.Prefs.prefEnableAutoDownloadWifiFilter.name)?.onPreferenceChangeListener = findPreference<Preference>(UserPreferences.Prefs.prefEnableAutoDownloadWifiFilter.name)?.onPreferenceChangeListener =
Preference.OnPreferenceChangeListener { _: Preference?, newValue: Any? -> Preference.OnPreferenceChangeListener { _: Preference?, newValue: Any? ->
if (newValue is Boolean) { if (newValue is Boolean) {
@ -71,7 +70,6 @@ class AutoDownloadPreferencesFragment : PreferenceFragmentCompat() {
@SuppressLint("MissingPermission") // getConfiguredNetworks needs location permission starting with API 29 @SuppressLint("MissingPermission") // getConfiguredNetworks needs location permission starting with API 29
private fun buildAutodownloadSelectedNetworksPreference() { private fun buildAutodownloadSelectedNetworksPreference() {
if (Build.VERSION.SDK_INT >= 29) return if (Build.VERSION.SDK_INT >= 29) return
val activity: Activity? = activity val activity: Activity? = activity
if (selectedNetworks != null) clearAutodownloadSelectedNetworsPreference() if (selectedNetworks != null) clearAutodownloadSelectedNetworsPreference()

View File

@ -36,7 +36,8 @@ class ShareReceiverActivity : AppCompatActivity() {
Log.e(TAG, "feedUrl is empty or null.") Log.e(TAG, "feedUrl is empty or null.")
showNoPodcastFoundError() showNoPodcastFoundError()
} }
!feedUrl.matches(Regex("[./%]")) -> { // plain text
feedUrl.matches(Regex("^[^\\s<>/]+\$")) -> {
val intent = MainActivity.showOnlineSearch(this, feedUrl) val intent = MainActivity.showOnlineSearch(this, feedUrl)
startActivity(intent) startActivity(intent)
finish() finish()

View File

@ -549,9 +549,11 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar
val mediaType = media.getMediaType() val mediaType = media.getMediaType()
if (mediaType == MediaType.AUDIO || videoPlayMode == VideoMode.AUDIO_ONLY.code || videoMode == VideoMode.AUDIO_ONLY if (mediaType == MediaType.AUDIO || videoPlayMode == VideoMode.AUDIO_ONLY.code || videoMode == VideoMode.AUDIO_ONLY
|| (media is EpisodeMedia && media.episode?.feed?.preferences?.videoModePolicy == VideoMode.AUDIO_ONLY)) { || (media is EpisodeMedia && media.episode?.feed?.preferences?.videoModePolicy == VideoMode.AUDIO_ONLY)) {
Logd(TAG, "popping as audio episode")
ensureService() ensureService()
(activity as MainActivity).bottomSheet.setState(BottomSheetBehavior.STATE_EXPANDED) (activity as MainActivity).bottomSheet.setState(BottomSheetBehavior.STATE_EXPANDED)
} else { } else {
Logd(TAG, "popping video activity")
// playPause() // playPause()
// controller!!.ensureService() // controller!!.ensureService()
val intent = getPlayerActivityIntent(requireContext(), mediaType) val intent = getPlayerActivityIntent(requireContext(), mediaType)

View File

@ -10,7 +10,6 @@ import ac.mdiq.podcini.playback.base.VideoMode.Companion.videoModeTags
import ac.mdiq.podcini.preferences.UserPreferences.isEnableAutodownload import ac.mdiq.podcini.preferences.UserPreferences.isEnableAutodownload
import ac.mdiq.podcini.storage.database.Feeds.persistFeedPreferences import ac.mdiq.podcini.storage.database.Feeds.persistFeedPreferences
import ac.mdiq.podcini.storage.database.RealmDB.realm 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.database.RealmDB.upsertBlk
import ac.mdiq.podcini.storage.model.* import ac.mdiq.podcini.storage.model.*
import ac.mdiq.podcini.storage.model.FeedPreferences.* import ac.mdiq.podcini.storage.model.FeedPreferences.*
@ -416,7 +415,7 @@ class FeedSettingsFragment : Fragment() {
} }
if (isEnableAutodownload && feed?.type != Feed.FeedType.YOUTUBE.name) { if (isEnableAutodownload && feed?.type != Feed.FeedType.YOUTUBE.name) {
// auto download // auto download
var audoDownloadChecked by remember { mutableStateOf(feed?.preferences?.autoDownload ?: true) } var audoDownloadChecked by remember { mutableStateOf(feed?.preferences?.autoDownload ?: false) }
Column { Column {
Row(Modifier.fillMaxWidth()) { Row(Modifier.fillMaxWidth()) {
Text( Text(
@ -430,9 +429,7 @@ class FeedSettingsFragment : Fragment() {
modifier = Modifier.height(24.dp), modifier = Modifier.height(24.dp),
onCheckedChange = { onCheckedChange = {
audoDownloadChecked = it audoDownloadChecked = it
feed = upsertBlk(feed!!) { f -> feed = upsertBlk(feed!!) { f -> f.preferences?.autoDownload = audoDownloadChecked }
f.preferences?.autoDownload = audoDownloadChecked
}
} }
) )
} }
@ -768,9 +765,7 @@ class FeedSettingsFragment : Fragment() {
Logd(TAG, "row clicked: $item $selectedOption") Logd(TAG, "row clicked: $item $selectedOption")
if (item != selectedOption) { if (item != selectedOption) {
onOptionSelected(item) onOptionSelected(item)
feed = upsertBlk(feed!!) { feed = upsertBlk(feed!!) { it.preferences?.volumeAdaptionSetting = item }
it.preferences?.volumeAdaptionSetting = item
}
onDismissRequest() onDismissRequest()
} }
} }
@ -817,9 +812,7 @@ class FeedSettingsFragment : Fragment() {
Logd(TAG, "row clicked: $item $selectedOption") Logd(TAG, "row clicked: $item $selectedOption")
if (item != selectedOption) { if (item != selectedOption) {
onOptionSelected(item) onOptionSelected(item)
feed = upsertBlk(feed!!) { feed = upsertBlk(feed!!) { it.preferences?.autoDLPolicy = item }
it.preferences?.autoDLPolicy = item
}
// getAutoDeletePolicy() // getAutoDeletePolicy()
onDismissRequest() onDismissRequest()
} }
@ -854,18 +847,14 @@ class FeedSettingsFragment : Fragment() {
) { ) {
var newCache by remember { mutableStateOf((feed?.preferences?.autoDLMaxEpisodes ?: 1).toString()) } var newCache by remember { mutableStateOf((feed?.preferences?.autoDLMaxEpisodes ?: 1).toString()) }
TextField(value = newCache, TextField(value = newCache,
onValueChange = { if (it.toIntOrNull() != null) newCache = it }, onValueChange = { if (it.isEmpty() || it.toIntOrNull() != null) newCache = it },
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
visualTransformation = PositiveIntegerTransform(), // visualTransformation = PositiveIntegerTransform(),
label = { Text("Max episodes allowed") } label = { Text("Max episodes allowed") }
) )
Button(onClick = { Button(onClick = {
if (newCache.isNotEmpty()) { if (newCache.isNotEmpty()) {
runOnIOScope { feed = upsertBlk(feed!!) { it.preferences?.autoDLMaxEpisodes = newCache.toIntOrNull() ?: 1 }
feed = upsertBlk(feed!!) {
it.preferences?.autoDLMaxEpisodes = newCache.toIntOrNull() ?: 1
}
}
onDismiss() onDismiss()
} }
}) { }) {
@ -993,16 +982,16 @@ class FeedSettingsFragment : Fragment() {
) { ) {
var intro by remember { mutableStateOf((feed?.preferences?.introSkip ?: 0).toString()) } var intro by remember { mutableStateOf((feed?.preferences?.introSkip ?: 0).toString()) }
TextField(value = intro, TextField(value = intro,
onValueChange = { if (it.toIntOrNull() != null) intro = it }, onValueChange = { if (it.isEmpty() || it.toIntOrNull() != null) intro = it },
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
visualTransformation = PositiveIntegerTransform(), // visualTransformation = PositiveIntegerTransform(),
label = { Text("Skip first (seconds)") } label = { Text("Skip first (seconds)") }
) )
var ending by remember { mutableStateOf((feed?.preferences?.endingSkip ?: 0).toString()) } var ending by remember { mutableStateOf((feed?.preferences?.endingSkip ?: 0).toString()) }
TextField(value = ending, TextField(value = ending,
onValueChange = { if (it.toIntOrNull() != null) ending = it }, onValueChange = { if (it.isEmpty() || it.toIntOrNull() != null) ending = it },
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
visualTransformation = PositiveIntegerTransform(), // visualTransformation = PositiveIntegerTransform(),
label = { Text("Skip last (seconds)") } label = { Text("Skip last (seconds)") }
) )
Button(onClick = { Button(onClick = {
@ -1022,7 +1011,7 @@ class FeedSettingsFragment : Fragment() {
} }
} }
fun PlaybackSpeedDialog(): AlertDialog { private fun PlaybackSpeedDialog(): AlertDialog {
val binding = PlaybackSpeedFeedSettingDialogBinding.inflate(LayoutInflater.from(requireContext())) val binding = PlaybackSpeedFeedSettingDialogBinding.inflate(LayoutInflater.from(requireContext()))
binding.seekBar.setProgressChangedListener { speed: Float? -> binding.seekBar.setProgressChangedListener { speed: Float? ->
binding.currentSpeedLabel.text = String.format(Locale.getDefault(), "%.2fx", speed) binding.currentSpeedLabel.text = String.format(Locale.getDefault(), "%.2fx", speed)
@ -1049,13 +1038,13 @@ class FeedSettingsFragment : Fragment() {
.create() .create()
} }
class PositiveIntegerTransform : VisualTransformation { // class PositiveIntegerTransform : VisualTransformation {
override fun filter(text: AnnotatedString): TransformedText { // override fun filter(text: AnnotatedString): TransformedText {
val trimmedText = text.text.filter { it.isDigit() } // val trimmedText = text.text.filter { it.isDigit() }
val transformedText = if (trimmedText.isNotEmpty() && trimmedText.toInt() > 0) trimmedText else "" // val transformedText = if (trimmedText.isNotEmpty() && trimmedText.toInt() > 0) trimmedText else ""
return TransformedText(AnnotatedString(transformedText), OffsetMapping.Identity) // return TransformedText(AnnotatedString(transformedText), OffsetMapping.Identity)
} // }
} // }
/** /**
* Displays a dialog with a text box for filtering episodes and two radio buttons for exclusion/inclusion * Displays a dialog with a text box for filtering episodes and two radio buttons for exclusion/inclusion

View File

@ -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 # 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. * 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.

View File

@ -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