6.6.7 commit

This commit is contained in:
Xilin Jia 2024-09-17 09:03:34 +01:00
parent 7d78f2b337
commit 338788a8ad
6 changed files with 24 additions and 20 deletions

View File

@ -31,8 +31,8 @@ android {
testApplicationId "ac.mdiq.podcini.tests"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
versionCode 3020251
versionName "6.6.6"
versionCode 3020252
versionName "6.6.7"
applicationId "ac.mdiq.podcini.R"
def commit = ""

View File

@ -6,12 +6,12 @@ enum class VolumeAdaptionSetting(private val value: Int, @JvmField val adaptionF
OFF(0, 1.0f, R.string.feed_volume_reduction_off),
LIGHT_REDUCTION(1, 0.5f, R.string.feed_volume_reduction_light),
HEAVY_REDUCTION(2, 0.2f, R.string.feed_volume_reduction_heavy),
// LIGHT_BOOST(3, 1.5f, R.string.feed_volume_boost_light),
LIGHT_BOOST(3, 1.6f, R.string.feed_volume_boost_light),
// MEDIUM_BOOST(4, 2f, R.string.feed_volume_boost_medium),
// HEAVY_BOOST(5, 2.5f, R.string.feed_volume_boost_heavy);
LIGHT_BOOST(3, 2f, R.string.feed_volume_boost_light),
MEDIUM_BOOST(4, 4f, R.string.feed_volume_boost_medium),
HEAVY_BOOST(5, 7f, R.string.feed_volume_boost_heavy);
// LIGHT_BOOST(3, 2f, R.string.feed_volume_boost_light),
MEDIUM_BOOST(4, 2.4f, R.string.feed_volume_boost_medium),
HEAVY_BOOST(5, 3.6f, R.string.feed_volume_boost_heavy);
fun toInteger(): Int {
return value

View File

@ -79,6 +79,12 @@ class SleepTimerDialog : DialogFragment() {
etxtTime = binding.etxtTime
binding.timeDisplay.visibility = View.GONE
val timeLeft = (playbackService?.taskManager?.sleepTimerTimeLeft?:0)
if (timeLeft > 0) {
binding.timeSetup.visibility = View.GONE
binding.timeDisplay.visibility = View.VISIBLE
binding.time.text = getDurationStringLong(timeLeft.toInt())
}
val extendSleepFiveMinutesButton = binding.extendSleepFiveMinutesButton
extendSleepFiveMinutesButton.text = getString(R.string.extend_sleep_timer_label, 5)
val extendSleepTenMinutesButton = binding.extendSleepTenMinutesButton
@ -125,7 +131,6 @@ class SleepTimerDialog : DialogFragment() {
}
binding.disableSleeptimerButton.setOnClickListener { playbackService?.taskManager?.disableSleepTimer() }
binding.setSleeptimerButton.setOnClickListener {
if (!PlaybackService.isRunning) {
Snackbar.make(content, R.string.no_media_playing_label, Snackbar.LENGTH_LONG).show()
@ -265,7 +270,6 @@ class SleepTimerDialog : DialogFragment() {
paintText.color = getColorFromAttr(context, android.R.attr.textColorPrimary)
paintText.textAlign = Paint.Align.CENTER
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
when {
MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY && MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY ->
@ -276,15 +280,12 @@ class SleepTimerDialog : DialogFragment() {
else -> super.onMeasure(heightMeasureSpec, heightMeasureSpec)
}
}
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
val size = height.toFloat() // square
val padding = size * 0.1f
paintDial.strokeWidth = size * 0.005f
bounds[padding, padding, size - padding] = size - padding
paintText.alpha = DIAL_ALPHA
canvas.drawArc(bounds, 0f, 360f, false, paintDial)
for (i in 0..23) {
@ -301,7 +302,6 @@ class SleepTimerDialog : DialogFragment() {
canvas.drawLine(outer.x.toFloat(), outer.y.toFloat(), inner.x.toFloat(), inner.y.toFloat(), paintDial)
}
paintText.alpha = 255
val angleFrom = from.toFloat() / 24 * 360 - 90
val angleDistance = ((to - from + 24) % 24).toFloat() / 24 * 360
paintSelected.strokeWidth = padding / 6
@ -312,7 +312,6 @@ class SleepTimerDialog : DialogFragment() {
canvas.drawCircle(p1.x.toFloat(), p1.y.toFloat(), padding / 2, paintSelected)
val p2 = radToPoint(angleFrom + angleDistance + 90, size / 2 - padding)
canvas.drawCircle(p2.x.toFloat(), p2.y.toFloat(), padding / 2, paintSelected)
paintText.textSize = 0.6f * padding
val timeRange = when {
from == to -> context.getString(R.string.sleep_timer_always)
@ -324,12 +323,10 @@ class SleepTimerDialog : DialogFragment() {
}
canvas.drawText(timeRange, size / 2, (size - paintText.descent() - paintText.ascent()) / 2, paintText)
}
private fun radToPoint(angle: Float, radius: Float): Point {
return Point((width / 2 + radius * sin(-angle * Math.PI / 180 + Math.PI)).toInt(),
(height / 2 + radius * cos(-angle * Math.PI / 180 + Math.PI)).toInt())
}
override fun onTouchEvent(event: MotionEvent): Boolean {
parent.requestDisallowInterceptTouchEvent(true)
val center = Point(width / 2, height / 2)
@ -337,7 +334,6 @@ class SleepTimerDialog : DialogFragment() {
var angle = (angleRad * (180 / Math.PI)).toFloat()
angle += (360 + 360 - 90).toFloat()
angle %= 360f
when {
event.action == MotionEvent.ACTION_DOWN -> {
val fromDistance = abs((angle - from.toFloat() / 24 * 360).toDouble()).toFloat()

View File

@ -391,7 +391,8 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar
is FlowEvent.PlayEvent -> onPlayEvent(event)
is FlowEvent.FavoritesEvent -> onFavoriteEvent(event)
is FlowEvent.PlayerErrorEvent -> MediaPlayerErrorDialog.show(activity as Activity, event)
is FlowEvent.SleepTimerUpdatedEvent -> if (event.isCancelled || event.wasJustEnabled()) loadMediaInfo(false)
// is FlowEvent.SleepTimerUpdatedEvent -> if (event.isCancelled || event.wasJustEnabled()) loadMediaInfo(false)
is FlowEvent.SleepTimerUpdatedEvent -> if (event.isCancelled || event.wasJustEnabled()) setupOptionsMenu()
is FlowEvent.PlaybackPositionEvent -> onPlaybackPositionEvent(event)
is FlowEvent.SpeedChangedEvent -> playerUI?.updatePlaybackSpeedButton(event)
else -> {}
@ -707,9 +708,7 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar
fun onPlaybackServiceChanged(event: FlowEvent.PlaybackServiceEvent) {
when (event.action) {
FlowEvent.PlaybackServiceEvent.Action.SERVICE_SHUT_DOWN -> (activity as MainActivity).setPlayerVisible(false)
FlowEvent.PlaybackServiceEvent.Action.SERVICE_STARTED -> {
if (curMedia != null) (activity as MainActivity).setPlayerVisible(true)
}
FlowEvent.PlaybackServiceEvent.Action.SERVICE_STARTED -> if (curMedia != null) (activity as MainActivity).setPlayerVisible(true)
// PlaybackServiceEvent.Action.SERVICE_RESTARTED -> (activity as MainActivity).setPlayerVisible(true)
}
}

View File

@ -1,3 +1,8 @@
# 6.6.7
* volume adaptation numbers were changed to 0.2, 0.5, 1, 1.6, 2.4, 3.6 to avoid much distortion
* sleep timer and related menu item are enhanced
# 6.6.6
* fixed difference between the count of episodes and the actual number of episodes (seen when the number is small) in History, AllEpisodes, and OnlineFeed views

View File

@ -0,0 +1,4 @@
Version 6.6.7:
* volume adaptation numbers were changed to 0.2, 0.5, 1, 1.6, 2.4, 3.6 to avoid much distortion
* sleep timer and related menu item are enhanced