4.9.4 commit

This commit is contained in:
Xilin Jia 2024-04-25 22:41:17 +01:00
parent 9476d7d681
commit 3566f60b3e
13 changed files with 58 additions and 41 deletions

View File

@ -158,8 +158,8 @@ android {
// Version code schema (not used):
// "1.2.3-beta4" -> 1020304
// "1.2.3" -> 1020395
versionCode 3020134
versionName "4.9.3"
versionCode 3020135
versionName "4.9.4"
def commit = ""
try {

View File

@ -33,7 +33,7 @@ class FeedParserTask(private val request: DownloadRequest) : Callable<FeedHandle
feed.file_url = request.destination
feed.id = request.feedfileId
feed.setDownloaded(true)
feed.preferences = FeedPreferences(0, true, FeedPreferences.AutoDeleteAction.GLOBAL,
feed.preferences = FeedPreferences(0, false, FeedPreferences.AutoDeleteAction.GLOBAL,
VolumeAdaptionSetting.OFF, FeedPreferences.NewEpisodesAction.GLOBAL, request.username, request.password)
if (request.arguments != null) feed.pageNr = request.arguments.getInt(DownloadRequest.REQUEST_ARG_PAGE_NR, 0)

View File

@ -499,7 +499,7 @@ class PlaybackService : MediaSessionService() {
Log.d(TAG, "Received media button event")
notificationButton = true
}
// val handled = handleKeycode(keycode, notificationButton)
val handled = handleKeycode(keycode, notificationButton)
}
playable != null -> {
val allowStreamThisTime = intent.getBooleanExtra(PlaybackServiceInterface.EXTRA_ALLOW_STREAM_THIS_TIME, false)

View File

@ -42,6 +42,7 @@ open class AutomaticDownloadAlgorithm {
// true if we should auto download based on power status
val powerShouldAutoDl = (deviceCharging(context) || isEnableAutodownloadOnBattery)
Log.d(TAG, "prepare autoDownloadUndownloadedItems $networkShouldAutoDl $powerShouldAutoDl")
// we should only auto download if both network AND power are happy
if (networkShouldAutoDl && powerShouldAutoDl) {
@ -49,7 +50,9 @@ open class AutomaticDownloadAlgorithm {
val candidates: MutableList<FeedItem>
val queue = getQueue()
val newItems = getEpisodes(0, Int.MAX_VALUE, FeedItemFilter(FeedItemFilter.NEW), SortOrder.DATE_NEW_OLD)
Log.d(TAG, "newItems: ${newItems.size}")
candidates = ArrayList(queue.size + newItems.size)
candidates.addAll(queue)
for (newItem in newItems) {
@ -84,9 +87,7 @@ open class AutomaticDownloadAlgorithm {
}
}
}
else {
Log.d(TAG, "not auto downloaded networkShouldAutoDl: $networkShouldAutoDl powerShouldAutoDl $powerShouldAutoDl")
}
else Log.d(TAG, "not auto downloaded networkShouldAutoDl: $networkShouldAutoDl powerShouldAutoDl $powerShouldAutoDl")
}
}

View File

@ -222,6 +222,10 @@ import java.util.concurrent.*
savedFeed.preferences!!.updateFromOther(newFeed.preferences)
}
val priorMostRecent = savedFeed.mostRecentItem
var priorMostRecentDate: Date? = Date()
priorMostRecentDate = priorMostRecent?.getPubDate()
// Look for new or updated Items
for (idx in newFeed.items.indices) {
val item = newFeed.items[idx]
@ -282,6 +286,12 @@ import java.util.concurrent.*
if (idx >= savedFeed.items.size) savedFeed.items.add(item)
else savedFeed.items.add(idx, item)
val pubDate = item.getPubDate()
if (pubDate == null || priorMostRecentDate == null || priorMostRecentDate.before(pubDate) || priorMostRecentDate == pubDate) {
Log.d(TAG, "Marking item published on ${pubDate} new, prior most recent date = $priorMostRecentDate")
item.setNew()
}
}
}

View File

@ -205,10 +205,8 @@ class Feed : FeedFile {
* This constructor is used for requesting a feed download (it must not be used for anything else!). It should be
* used if the title of the feed is already known.
*/
constructor(url: String?, lastUpdate: String?, title: String?, username: String?, password: String?) : this(url,
lastUpdate,
title) {
preferences = FeedPreferences(0, true, FeedPreferences.AutoDeleteAction.GLOBAL, VolumeAdaptionSetting.OFF,
constructor(url: String?, lastUpdate: String?, title: String?, username: String?, password: String?) : this(url, lastUpdate, title) {
preferences = FeedPreferences(0, false, FeedPreferences.AutoDeleteAction.GLOBAL, VolumeAdaptionSetting.OFF,
FeedPreferences.NewEpisodesAction.GLOBAL, username, password)
}

View File

@ -92,8 +92,7 @@ class FeedItem : FeedComponent, Serializable {
*/
constructor(id: Long, title: String?, link: String?, pubDate: Date?, paymentLink: String?, feedId: Long,
hasChapters: Boolean, imageUrl: String?, state: Int,
itemIdentifier: String?, autoDownloadEnabled: Boolean, podcastIndexChapterUrl: String?
) {
itemIdentifier: String?, autoDownloadEnabled: Boolean, podcastIndexChapterUrl: String?) {
this.id = id
this.title = title
this.link = link
@ -111,14 +110,7 @@ class FeedItem : FeedComponent, Serializable {
/**
* This constructor should be used for creating test objects.
*/
constructor(id: Long,
title: String?,
itemIdentifier: String?,
link: String?,
pubDate: Date?,
state: Int,
feed: Feed?
) {
constructor(id: Long, title: String?, itemIdentifier: String?, link: String?, pubDate: Date?, state: Int, feed: Feed?) {
this.id = id
this.title = title
this.itemIdentifier = itemIdentifier
@ -132,15 +124,7 @@ class FeedItem : FeedComponent, Serializable {
/**
* This constructor should be used for creating test objects involving chapter marks.
*/
constructor(id: Long,
title: String?,
itemIdentifier: String?,
link: String?,
pubDate: Date?,
state: Int,
feed: Feed?,
hasChapters: Boolean
) {
constructor(id: Long, title: String?, itemIdentifier: String?, link: String?, pubDate: Date?, state: Int, feed: Feed?, hasChapters: Boolean) {
this.id = id
this.title = title
this.itemIdentifier = itemIdentifier

View File

@ -68,8 +68,8 @@ class FeedPreferences(@JvmField var feedID: Long,
constructor(feedID: Long, autoDownload: Boolean, autoDeleteAction: AutoDeleteAction,
volumeAdaptionSetting: VolumeAdaptionSetting?, newEpisodesAction: NewEpisodesAction?,
username: String?, password: String?
) : this(feedID, autoDownload, true, autoDeleteAction, volumeAdaptionSetting, username, password,
username: String?, password: String?)
: this(feedID, autoDownload, true, autoDeleteAction, volumeAdaptionSetting, username, password,
FeedFilter(), SPEED_USE_GLOBAL, 0, 0, false, newEpisodesAction, HashSet<String>())
init {

View File

@ -57,7 +57,7 @@ class FeedMultiSelectActionHandler(private val activity: MainActivity, private v
val preferenceSwitchDialog = PreferenceSwitchDialog(activity, activity.getString(R.string.auto_download_settings_label), activity.getString(R.string.auto_download_label))
preferenceSwitchDialog.setOnPreferenceChangedListener(@UnstableApi object: PreferenceSwitchDialog.OnPreferenceChangedListener {
override fun preferenceChanged(enabled: Boolean) {
saveFeedPreferences { feedPreferences: FeedPreferences -> feedPreferences.autoDownload = enabled }
// saveFeedPreferences { feedPreferences: FeedPreferences -> feedPreferences.autoDownload = enabled }
}
})
preferenceSwitchDialog.openDialog()

View File

@ -487,11 +487,11 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar
txtvLength = binding.txtvLength
setupLengthTextView()
// setupControlButtons()
setupControlButtons()
butPlaybackSpeed.setOnClickListener {
VariableSpeedDialog.newInstance(booleanArrayOf(true, true, true), null)?.show(childFragmentManager, null)
}
// sbPosition.setOnSeekBarChangeListener(null)
sbPosition.setOnSeekBarChangeListener(this)
binding.internalPlayerFragment.setOnClickListener {
Log.d(TAG, "internalPlayerFragment was clicked")
@ -534,9 +534,9 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar
requireContext().startActivity(PlaybackService.getPlayerActivityIntent(requireContext(), media.getMediaType()))
} else controller!!.playPause()
if (!isControlButtonsSet) {
setupControlButtons()
// setupControlButtons()
sbPosition.visibility = View.VISIBLE
sbPosition.setOnSeekBarChangeListener(this)
// sbPosition.setOnSeekBarChangeListener(this)
isControlButtonsSet = true
}
}
@ -548,6 +548,7 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar
if (controller != null && controller!!.isPlaybackServiceReady()) {
val curr: Int = controller!!.position
controller!!.seekTo(curr - UserPreferences.rewindSecs * 1000)
sbPosition.visibility = View.VISIBLE
}
}
butRev.setOnLongClickListener {
@ -569,6 +570,7 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar
if (controller != null && controller!!.isPlaybackServiceReady()) {
val curr: Int = controller!!.position
controller!!.seekTo(curr + UserPreferences.fastForwardSecs * 1000)
sbPosition.visibility = View.VISIBLE
}
}
butFF.setOnLongClickListener {
@ -632,8 +634,12 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar
txtvLength.text = Converter.getDurationStringLong(duration)
}
if (sbPosition.visibility == View.INVISIBLE && controller != null && controller!!.isPlaybackServiceReady()) {
sbPosition.visibility = View.VISIBLE
}
if (!sbPosition.isPressed) {
val progress: Float = (event.position.toFloat()) / event.duration
// Log.d(TAG, "updating sbPosition: $progress")
sbPosition.progress = (progress * sbPosition.max).toInt()
}
}

View File

@ -7,10 +7,10 @@ class TimeSpeedConverter(private val speed: Float) {
* @param time time to convert
* @return converted time (can be < 0 if time is < 0)
*/
fun convert(time: Int): Int {
val timeRespectsSpeed = UserPreferences.timeRespectsSpeed()
if (time > 0 && timeRespectsSpeed) return (time / speed).toInt()
var timeRespectsSpeed: Boolean = UserPreferences.timeRespectsSpeed()
fun convert(time: Int): Int {
if (time > 0 && timeRespectsSpeed) return (time / speed).toInt()
return time
}
}

View File

@ -300,4 +300,13 @@
* show toast message when episode home views are not available
* fixed crash bug on app startup when player buttons are clicked before play
* large codebase cleaning
* episode home menu item is disable on video player
* episode home menu item is disable on video player
## 4.9.4
* fixed non-functioning pause button in queue list
* fixed player control buttons not being properly activated
* enabled the function for auto downloading of feeds
* when global auto download setting is enabled, no existing feed is automatically included for auto download
* when subscribing a new feed, there an option for auto download
* new episode of a feed is auto downloaded at a feed refresh only when both global and feed settings for auto download are enabled

View File

@ -0,0 +1,9 @@
Version 4.9.4 brings several changes:
* fixed non-functioning pause button in queue list
* fixed player control buttons not being properly activated
* enabled the function for auto downloading of feeds
* when global auto download setting is enabled, no existing feed is automatically included for auto download
* when subscribing a new feed, there an option for auto download
* new episode of a feed is auto downloaded at a feed refresh only when both global and feed settings for auto download are enabled