pull/47/head
kunfei 5 years ago
parent c3628cf44c
commit e6b613d92a
  1. 7
      app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt
  2. 15
      app/src/main/res/layout/activity_audio_play.xml

@ -16,6 +16,7 @@ import io.legado.app.utils.getViewModel
import io.legado.app.utils.observeEvent import io.legado.app.utils.observeEvent
import kotlinx.android.synthetic.main.activity_audio_play.* import kotlinx.android.synthetic.main.activity_audio_play.*
import kotlinx.android.synthetic.main.view_title_bar.* import kotlinx.android.synthetic.main.view_title_bar.*
import org.apache.commons.lang3.time.DateFormatUtils
import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick import org.jetbrains.anko.sdk27.listeners.onLongClick
@ -52,7 +53,7 @@ class AudioPlayActivity : VMBaseActivity<AudioPlayViewModel>(R.layout.activity_a
} }
player_progress.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { player_progress.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
tv_dur_time.text = DateFormatUtils.format(progress.toLong(), "mm:ss")
} }
override fun onStartTrackingTouch(seekBar: SeekBar?) { override fun onStartTrackingTouch(seekBar: SeekBar?) {
@ -67,7 +68,7 @@ class AudioPlayActivity : VMBaseActivity<AudioPlayViewModel>(R.layout.activity_a
} }
private fun upView(book: Book) { private fun upView(book: Book) {
actionBar?.title = book.name title_bar.title = book.name
ImageLoader.load(this, book.getDisplayCover()) ImageLoader.load(this, book.getDisplayCover())
.placeholder(R.drawable.image_cover_default) .placeholder(R.drawable.image_cover_default)
.error(R.drawable.image_cover_default) .error(R.drawable.image_cover_default)
@ -121,9 +122,11 @@ class AudioPlayActivity : VMBaseActivity<AudioPlayViewModel>(R.layout.activity_a
} }
observeEvent<Int>(Bus.AUDIO_PROGRESS) { observeEvent<Int>(Bus.AUDIO_PROGRESS) {
if (!adjustProgress) player_progress.progress = it if (!adjustProgress) player_progress.progress = it
tv_dur_time.text = DateFormatUtils.format(it.toLong(), "mm:ss")
} }
observeEvent<Int>(Bus.AUDIO_SIZE) { observeEvent<Int>(Bus.AUDIO_SIZE) {
player_progress.max = it player_progress.max = it
tv_all_time.text = DateFormatUtils.format(it.toLong(), "mm:ss")
} }
} }
} }

@ -50,15 +50,16 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="5dp" android:paddingStart="16dp"
android:paddingEnd="5dp" android:paddingEnd="16dp"
app:layout_constraintBottom_toTopOf="@+id/ll_play_menu"> app:layout_constraintBottom_toTopOf="@+id/ll_play_menu">
<TextView <TextView
android:id="@+id/tv_dur_time" android:id="@+id/tv_dur_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:ignore="RtlSymmetry" /> android:text="00:00"
tools:ignore="HardcodedText,RtlSymmetry" />
<io.legado.app.lib.theme.view.ATESeekBar <io.legado.app.lib.theme.view.ATESeekBar
android:id="@+id/player_progress" android:id="@+id/player_progress"
@ -70,7 +71,9 @@
<TextView <TextView
android:id="@+id/tv_all_time" android:id="@+id/tv_all_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:text="00:00"
tools:ignore="HardcodedText" />
</LinearLayout> </LinearLayout>
@ -78,8 +81,8 @@
android:id="@+id/ll_play_menu" android:id="@+id/ll_play_menu"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="15dp" android:paddingLeft="24dp"
android:paddingRight="15dp" android:paddingRight="24dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"> app:layout_constraintBottom_toBottomOf="parent">

Loading…
Cancel
Save