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) 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.newPlayer = newPlayer
videoPlayerViewModel.contentFitMode = ContentScale.FIT_INSIDE videoPlayerViewModel.contentFitMode = ContentScale.FIT_INSIDE

View File

@ -62,8 +62,7 @@
</LinearLayout> </LinearLayout>
<ScrollView
<LinearLayout
android:id="@+id/buttons_layout" android:id="@+id/buttons_layout"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -74,28 +73,58 @@
app:layout_constraintStart_toEndOf="@id/embedded_player_layout" app:layout_constraintStart_toEndOf="@id/embedded_player_layout"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<Button <LinearLayout
android:id="@+id/start_6502_stream_button" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:orientation="vertical">
android:text="Start 6502 Stream" />
<Button
android:id="@+id/start_imu_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Start IMU Stream" />
<Button
android:id="@+id/start_portrait_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Start Landscape Stream" />
</LinearLayout> <Button
android:id="@+id/start_6502_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Start 6502 Stream" />
<Button
android:id="@+id/start_imu_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Start IMU Stream" />
<Button
android:id="@+id/start_portrait_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
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> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!-- NewPlayer
<!-- NewPlayer
@author Christian Schabesberger @author Christian Schabesberger
@ -33,8 +32,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:minHeight="50dp" android:minHeight="50dp"
android:visibility="gone" android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -63,39 +62,70 @@
</LinearLayout> </LinearLayout>
<LinearLayout <ScrollView
android:id="@id/buttons_layout" android:id="@id/buttons_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/embedded_player_layout"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/embedded_player_layout"
app:layout_constraintVertical_weight="1"> app:layout_constraintVertical_weight="1">
<Button <LinearLayout
android:id="@+id/start_6502_stream_button" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:orientation="vertical">
android:text="Start 6502 Stream" />
<Button
android:id="@+id/start_imu_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Start IMU Stream" />
<Button <Button
android:id="@+id/start_portrait_stream_button" android:id="@+id/start_6502_stream_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="Start Landscape Stream" /> android:text="Start 6502 Stream" />
</LinearLayout> <Button
android:id="@+id/start_imu_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Start IMU Stream" />
<Button
android:id="@+id/start_portrait_stream_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
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> </androidx.constraintlayout.widget.ConstraintLayout>