expreimental large screen layout on landscape

This commit is contained in:
Christian Schabesberger 2024-07-02 18:07:12 +02:00
parent 8012d1aa16
commit d31e3437b7
3 changed files with 70 additions and 11 deletions

View File

@ -1,8 +1,6 @@
package net.newpipe.newplayer.ui package net.newpipe.newplayer.ui
import android.app.Activity
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
@ -11,9 +9,12 @@ import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Fullscreen import androidx.compose.material.icons.filled.Fullscreen
import androidx.compose.material.icons.filled.ShoppingCart import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.material.icons.filled.SkipNext
import androidx.compose.material.icons.filled.SkipPrevious
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material3.Slider import androidx.compose.material3.Slider
@ -28,7 +29,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewScreenSizes
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import net.newpipe.newplayer.ui.theme.VideoPlayerTheme import net.newpipe.newplayer.ui.theme.VideoPlayerTheme
@ -41,11 +41,14 @@ fun PlayerUI() {
.background(Color.White) .background(Color.White)
) { ) {
Box() { Box() {
BottomUI(modifier = Modifier CenterUI(modifier = Modifier.align(Alignment.Center))
BottomUI(
modifier = Modifier
.align(Alignment.BottomStart) .align(Alignment.BottomStart)
.padding(start = 16.dp, end = 16.dp) .padding(start = 16.dp, end = 16.dp)
.defaultMinSize(minHeight = 40.dp) .defaultMinSize(minHeight = 40.dp)
.fillMaxWidth()) .fillMaxWidth()
)
} }
Text("hello gurken") Text("hello gurken")
} }
@ -53,7 +56,41 @@ fun PlayerUI() {
@Composable @Composable
private fun CenterUI(modifier: Modifier) { private fun CenterUI(modifier: Modifier) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween,
modifier = modifier
) {
IconButton(
onClick = { /*TODO*/ }, modifier = Modifier
.size(40.dp)
.padding(end = 10.dp)
) {
Icon(
imageVector = Icons.Filled.SkipPrevious,
modifier = Modifier.fillMaxSize(),
contentDescription = "Previous Stream"
)
}
IconButton(onClick = { /*TODO*/ }, modifier = Modifier.size(60.dp)) {
Icon(
imageVector = Icons.Filled.PlayArrow,
modifier = Modifier.fillMaxSize(),
contentDescription = "Pause"
)
}
IconButton(
onClick = { /*TODO*/ }, modifier = Modifier
.size(40.dp)
.padding(start = 10.dp)
) {
Icon(
imageVector = Icons.Filled.SkipNext,
modifier = Modifier.fillMaxSize(),
contentDescription = "Next Stream"
)
}
}
} }
@Composable @Composable

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/player_frament_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="parent"
android:name="net.newpipe.newplayer.PlayerFragment"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -11,7 +11,7 @@
<androidx.fragment.app.FragmentContainerView <androidx.fragment.app.FragmentContainerView
android:id="@+id/player_frament_view" android:id="@+id/player_frament_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="200dp" android:layout_height="300dp"
app:layout_constraintEnd_toEndOf="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"