pull/51/head
kunfei 5 years ago
parent 58a075ba8e
commit e5631fe024
  1. 28
      app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt
  2. 9
      app/src/main/res/menu/audio_play.xml

@ -5,6 +5,8 @@ import android.content.Intent
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.widget.SeekBar
import androidx.lifecycle.Observer
import com.bumptech.glide.RequestBuilder
@ -13,12 +15,14 @@ import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.Bus
import io.legado.app.constant.Status
import io.legado.app.data.entities.Book
import io.legado.app.help.BlurTransformation
import io.legado.app.help.ImageLoader
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.noButton
import io.legado.app.lib.dialogs.okButton
import io.legado.app.service.help.AudioPlay
import io.legado.app.ui.changesource.ChangeSourceDialog
import io.legado.app.ui.chapterlist.ChapterListActivity
import io.legado.app.utils.*
import kotlinx.android.synthetic.main.activity_audio_play.*
@ -29,7 +33,8 @@ import org.jetbrains.anko.sdk27.listeners.onLongClick
import org.jetbrains.anko.startActivityForResult
class AudioPlayActivity : VMBaseActivity<AudioPlayViewModel>(R.layout.activity_audio_play) {
class AudioPlayActivity : VMBaseActivity<AudioPlayViewModel>(R.layout.activity_audio_play),
ChangeSourceDialog.CallBack {
override val viewModel: AudioPlayViewModel
get() = getViewModel(AudioPlayViewModel::class.java)
@ -45,6 +50,20 @@ class AudioPlayActivity : VMBaseActivity<AudioPlayViewModel>(R.layout.activity_a
initView()
}
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.audio_play, menu)
return super.onCompatCreateOptionsMenu(menu)
}
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_change_source -> {
}
}
return super.onCompatOptionsItemSelected(item)
}
private fun initView() {
fab_play_stop.onClick {
playButton()
@ -119,6 +138,13 @@ class AudioPlayActivity : VMBaseActivity<AudioPlayViewModel>(R.layout.activity_a
}
}
override val oldBook: Book?
get() = AudioPlay.book
override fun changeTo(book: Book) {
viewModel.changeTo(book)
}
override fun finish() {
AudioPlay.book?.let {
if (!AudioPlay.inBookshelf) {

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_change_source"
android:title="@string/change_origin"
app:showAsAction="always" />
</menu>
Loading…
Cancel
Save