Skip to content

Commit

Permalink
Merge pull request #2540 from quran/hide_speed_pre_23
Browse files Browse the repository at this point in the history
Hide playback speed on unsupported versions
  • Loading branch information
ahmedre authored Jan 12, 2024
2 parents df9308e + 1038222 commit 36b5e0b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,12 @@ class AudioService : Service(), OnCompletionListener, OnPreparedListener,
val timeDelta = gaplessSuraData[updatedAyah + 1] - localPlayer.currentPosition
val t = clamp(timeDelta, 100, 10000)
val tAccountingForSpeed = t / (audioRequest?.playbackSpeed ?: 1f)
Timber.d("updateAudioPlayPosition after: %d, speed %f", t, tAccountingForSpeed)
Timber.d(
"updateAudioPlayPosition before: %d, after %f, speed: %f",
t,
tAccountingForSpeed,
audioRequest?.playbackSpeed
)
serviceHandler.sendEmptyMessageDelayed(MSG_UPDATE_AUDIO_POS, tAccountingForSpeed.toLong())
} else if (maxAyahs == updatedAyah) {
serviceHandler.sendEmptyMessageDelayed(MSG_UPDATE_AUDIO_POS, 150)
Expand Down Expand Up @@ -1395,7 +1400,6 @@ class AudioService : Service(), OnCompletionListener, OnPreparedListener,

// so user can pass in a serializable LegacyAudioRequest to the intent
const val EXTRA_PLAY_INFO = "com.quran.labs.androidquran.PLAY_INFO"
const val EXTRA_PLAY_SPEED = "com.quran.labs.androidquran.PLAY_SPEED"
private const val NOTIFICATION_CHANNEL_ID = Constants.AUDIO_CHANNEL
private const val MSG_INCOMING = 1
private const val MSG_START_AUDIO = 2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.quran.labs.androidquran.ui.fragment

import android.content.Context
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
Expand Down Expand Up @@ -80,6 +81,11 @@ class AyahPlaybackFragment : AyahActionFragment() {
repeatRangePicker = view.findViewById(R.id.repeat_range_picker)
playbackSpeedPicker = view.findViewById(R.id.playback_speed_picker)

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
val speedArea = view.findViewById<View>(R.id.playback_speed_area)
speedArea.visibility = View.GONE
}

val context = requireContext()
val isArabicNames = QuranSettings.getInstance(context).isArabicNames
val locale: Locale = if (isArabicNames) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/playback_speed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/playback_speed_area"
>
<TextView
android:layout_width="wrap_content"
Expand Down

0 comments on commit 36b5e0b

Please sign in to comment.