Audio Track View
Import
dependencies {
implementation project(':audiotrack')
}
Loop Audio Track View
<com.example.audiotrack.LoopAudioTrackView
android:id="@+id/loopAudioTrackView"
android:layout_width="0dp"
android:layout_height="40dp"
android:background="@color/colorAudioTrackBackgroung"
app:endDrawable="@drawable/ic_arrow_right_b"
app:innerColor="@color/colorAccent"
app:innerText="Music Name"
app:innerTextPadding="8dp"
app:innerTextSize="14sp"
app:innerWidthRatio=".7"
app:isLoop="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
class AudioTrackActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_audio_track)
loopAudioTrackView.onSelectListener =
object :LoopAudioTrackView.OnSelectListener{
override fun onSelect() {
}
}
loopAudioTrackView.onScrollListener =
object : AudioTrackView.OnScrollListener {
override fun onScroll(scrollRatio: Double) {
Log.d("Debug", "scroll track $scrollRatio")
}
}
loopAudioTrackView.onLoopScrollListener =
object : LoopAudioTrackView.OnLoopScrollListener {
override fun onScroll(scrollRatio: Double) {
Log.d("Debug", "scroll track $scrollRatio")
}
}
}
}
Edit Audio Track View
<com.example.audiotrack.EditAudioTrackView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/colorAudioTrackBackgroung"
app:dialogTextSize="16sp"
app:endDrawable="@drawable/ic_arrow_right_b"
app:headDrawable="@drawable/ic_arrow_left_b"
app:innerColor="@color/colorAccent"
app:innerHeight="40dp"
app:innerWidthRatio="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:playProgress=".5"
app:playProgressDialogColor="@android:color/holo_orange_light"
app:playProgressText="0:20"
app:scrollProgressDialogColor="@android:color/holo_orange_dark"
app:scrollProgressText="0:30" />
class AudioTrackActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_audio_track)
editAudioTrackView.onHeadScrollListener =
object :EditAudioTrackView.OnEditScrollListener{
override fun onScroll(view: EditAudioTrackView, scrollRatio: Double) {
}
}
editAudioTrackView.onEndScrollListener =
object :EditAudioTrackView.OnEditScrollListener{
override fun onScroll(view: EditAudioTrackView, scrollRatio: Double) {
}
}
}
}