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"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
versionCode 3020240
versionName "6.5.6"
versionCode 3020241
versionName "6.5.7"
applicationId "ac.mdiq.podcini.R"
def commit = ""

View File

@ -50,7 +50,6 @@ class AutoDownloadPreferencesFragment : PreferenceFragmentCompat() {
true
}
if (Build.VERSION.SDK_INT >= 29) findPreference<Preference>(UserPreferences.Prefs.prefEnableAutoDownloadWifiFilter.name)!!.isVisible = false
findPreference<Preference>(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()

View File

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

View File

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

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

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