pull/2533/head
parent
5b49c1c380
commit
44670a664f
@ -1,10 +1,44 @@ |
|||||||
package io.legado.app.ui.book.audio |
package io.legado.app.ui.book.audio |
||||||
|
|
||||||
|
import android.content.Context |
||||||
|
import android.view.LayoutInflater |
||||||
|
import android.view.View |
||||||
import android.view.ViewGroup |
import android.view.ViewGroup |
||||||
import android.widget.PopupWindow |
import android.widget.PopupWindow |
||||||
|
import android.widget.SeekBar |
||||||
|
import io.legado.app.databinding.PopupSeekBarBinding |
||||||
|
import io.legado.app.model.AudioPlay |
||||||
|
import io.legado.app.service.AudioPlayService |
||||||
|
import io.legado.app.ui.widget.seekbar.SeekBarChangeListener |
||||||
|
|
||||||
class TimerSliderPopup : |
class TimerSliderPopup(context: Context) : |
||||||
PopupWindow(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) { |
PopupWindow(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) { |
||||||
|
|
||||||
|
private val binding = PopupSeekBarBinding.inflate(LayoutInflater.from(context)) |
||||||
|
|
||||||
|
init { |
||||||
|
contentView = binding.root |
||||||
|
|
||||||
|
isTouchable = true |
||||||
|
isOutsideTouchable = true |
||||||
|
isFocusable = false |
||||||
|
|
||||||
|
binding.seekBar.max = 180 |
||||||
|
|
||||||
|
binding.seekBar.setOnSeekBarChangeListener(object : SeekBarChangeListener { |
||||||
|
|
||||||
|
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { |
||||||
|
if (fromUser) { |
||||||
|
AudioPlay.setTimer(progress) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
override fun showAsDropDown(anchor: View?) { |
||||||
|
super.showAsDropDown(anchor) |
||||||
|
binding.seekBar.progress = AudioPlayService.timeMinute |
||||||
|
} |
||||||
|
|
||||||
} |
} |
@ -0,0 +1,13 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:background="@drawable/shape_card_view" |
||||||
|
android:padding="8dp"> |
||||||
|
|
||||||
|
<io.legado.app.lib.theme.view.ThemeSeekBar |
||||||
|
android:id="@+id/seek_bar" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" /> |
||||||
|
|
||||||
|
</FrameLayout> |
Loading…
Reference in new issue