pull/49/head
kunfei 5 years ago
parent a31eca0d7e
commit c75960b7d2
  1. 12
      app/src/main/java/io/legado/app/service/AudioPlayService.kt
  2. 7
      app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt
  3. 2
      app/src/main/java/io/legado/app/ui/widget/BadgeView.kt
  4. 7
      app/src/main/res/layout/activity_audio_play.xml

@ -9,6 +9,7 @@ import android.graphics.BitmapFactory
import android.media.AudioFocusRequest
import android.media.AudioManager
import android.media.MediaPlayer
import android.os.Build
import android.os.Handler
import android.support.v4.media.session.MediaSessionCompat
import android.support.v4.media.session.PlaybackStateCompat
@ -159,6 +160,17 @@ class AudioPlayService : BaseService(),
}
}
private fun changeplayerSpeed(speed: Float) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (mediaPlayer.isPlaying) {
mediaPlayer.playbackParams = mediaPlayer.playbackParams.setSpeed(speed)
} else {
mediaPlayer.playbackParams = mediaPlayer.playbackParams.setSpeed(speed)
mediaPlayer.pause()
}
}
}
/**
* 加载完成
*/

@ -30,6 +30,7 @@ import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
import org.jetbrains.anko.startActivityForResult
class AudioPlayActivity : VMBaseActivity<AudioPlayViewModel>(R.layout.activity_audio_play) {
override val viewModel: AudioPlayViewModel
@ -82,6 +83,12 @@ class AudioPlayActivity : VMBaseActivity<AudioPlayViewModel>(R.layout.activity_a
)
}
}
iv_fast_forward.onClick {
}
iv_fast_rewind.onClick {
}
}
private fun upCover(path: String) {

@ -23,7 +23,7 @@ import io.legado.app.utils.visible
/**
* Created by milad heydari on 5/6/2016.
*/
class BadgeView @JvmOverloads constructor(
class BadgeView(
context: Context,
attrs: AttributeSet? = null,
defStyle: Int = android.R.attr.textViewStyle

@ -29,6 +29,13 @@
app:layout_constraintTop_toBottomOf="@+id/title_bar"
app:layout_constraintBottom_toBottomOf="parent" />
<io.legado.app.ui.widget.BadgeView
android:id="@+id/tv_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/title_bar"
app:layout_constraintRight_toRightOf="parent" />
<io.legado.app.ui.widget.image.CircleImageView
android:id="@+id/iv_cover"
android:layout_width="260dp"

Loading…
Cancel
Save