Skip to content

Commit

Permalink
6.5.7 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Sep 7, 2024
1 parent 621809d commit 24cb13c
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 35 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 3020240
versionName "6.5.6"
versionCode 3020241
versionName "6.5.7"

applicationId "ac.mdiq.podcini.R"
def commit = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down Expand Up @@ -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(
Expand All @@ -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 }
}
)
}
Expand Down Expand Up @@ -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()
}
}
Expand Down Expand Up @@ -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()
}
Expand Down Expand Up @@ -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()
}
}) {
Expand Down Expand Up @@ -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 = {
Expand All @@ -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)
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 5 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/3020241.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 24cb13c

Please sign in to comment.