add buttons to insert values to playlist

This commit is contained in:
Christian Schabesberger 2024-08-26 17:08:08 +02:00
parent 8f78d72a13
commit 99b79816f0
3 changed files with 117 additions and 46 deletions

View File

@ -75,6 +75,18 @@ class MainActivity : AppCompatActivity() {
newPlayer.playStream("portrait", PlayMode.EMBEDDED_VIDEO)
}
binding.add6502StreamButton.setOnClickListener {
newPlayer.addToPlaylist("6502")
}
binding.addImuStreamButton.setOnClickListener {
newPlayer.addToPlaylist("imu")
}
binding.addPortraitStreamButton.setOnClickListener {
newPlayer.addToPlaylist("portrait")
}
videoPlayerViewModel.newPlayer = newPlayer
videoPlayerViewModel.contentFitMode = ContentScale.FIT_INSIDE

View File

@ -62,8 +62,7 @@
</LinearLayout>
<LinearLayout
<ScrollView
android:id="@+id/buttons_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -74,6 +73,12 @@
app:layout_constraintStart_toEndOf="@id/embedded_player_layout"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/start_6502_stream_button"
android:layout_width="wrap_content"
@ -93,9 +98,33 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Start Landscape Stream" />
android:text="Start Portrait Stream" />
<Button
android:id="@+id/add_6502_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:backgroundTint="@color/material_dynamic_primary50"
android:text="Append 6502 Stream" />
<Button
android:id="@+id/add_imu_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:backgroundTint="@color/material_dynamic_primary50"
android:text="Append IMU Stream" />
<Button
android:id="@+id/add_portrait_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:backgroundTint="@color/material_dynamic_primary50"
android:text="Append Portrait Stream" />
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- NewPlayer
<?xml version="1.0" encoding="utf-8"?><!-- NewPlayer
@author Christian Schabesberger
@ -33,8 +32,8 @@
android:layout_height="match_parent"
android:minHeight="50dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -63,17 +62,22 @@
</LinearLayout>
<LinearLayout
<ScrollView
android:id="@id/buttons_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/embedded_player_layout"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/embedded_player_layout"
app:layout_constraintVertical_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/start_6502_stream_button"
android:layout_width="wrap_content"
@ -93,9 +97,35 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Start Landscape Stream" />
android:text="Start Portrait Stream" />
<Button
android:id="@+id/add_6502_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Append 6502 Stream"
android:backgroundTint="@color/material_dynamic_primary50"/>
<Button
android:id="@+id/add_imu_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Append IMU Stream"
android:backgroundTint="@color/material_dynamic_primary50"/>
<Button
android:id="@+id/add_portrait_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Append Portrait Stream"
android:backgroundTint="@color/material_dynamic_primary50"/>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>