Skip to content

Commit

Permalink
feat(MiniPlayer): Enhance layout and styling for improved UI experience
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrave-dev committed Feb 1, 2025
1 parent aa53da6 commit d46a34c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 193 deletions.
3 changes: 0 additions & 3 deletions app/src/main/java/com/maxrave/simpmusic/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ class MainActivity : AppCompatActivity() {
@UnstableApi
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// if (viewModel.simpleMediaServiceHandler == null) {
// startMusicService()
// }
VersionManager.initialize(applicationContext)
checkForUpdate()
if (viewModel.recreateActivity.value == true) {
Expand Down
29 changes: 18 additions & 11 deletions app/src/main/java/com/maxrave/simpmusic/ui/screen/MiniPlayer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
Expand Down Expand Up @@ -187,6 +188,7 @@ fun MiniPlayer(

ElevatedCard(
elevation = CardDefaults.elevatedCardElevation(10.dp),
shape = RoundedCornerShape(8.dp),
colors =
CardDefaults.elevatedCardColors(
containerColor = background.value,
Expand Down Expand Up @@ -228,12 +230,12 @@ fun MiniPlayer(
)
},
) {
Column(modifier = Modifier.fillMaxHeight()) {
Box(modifier = Modifier.fillMaxHeight()) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier =
Modifier
.weight(1F),
.fillMaxSize(),
) {
Spacer(modifier = Modifier.size(8.dp))
Box(modifier = Modifier.weight(1F)) {
Expand Down Expand Up @@ -300,14 +302,16 @@ fun MiniPlayer(
modifier =
Modifier
.size(40.dp)
.align(Alignment.CenterVertically)
.clip(
RoundedCornerShape(8.dp),
RoundedCornerShape(4.dp),
),
)
Spacer(modifier = Modifier.width(10.dp))
AnimatedContent(
targetState = songEntity,
modifier = Modifier.weight(1F),
modifier = Modifier.weight(1F).fillMaxHeight(),
contentAlignment = Alignment.CenterStart,
transitionSpec = {
// Compare the incoming number with the previous number.
if (targetState != initialState) {
Expand Down Expand Up @@ -338,10 +342,14 @@ fun MiniPlayer(
},
) { target ->
if (target != null) {
Column {
Column(
Modifier
.wrapContentHeight()
.align(Alignment.CenterVertically),
) {
Text(
text = (songEntity?.title ?: "").toString(),
style = typo.labelMedium,
style = typo.labelSmall,
color = Color.White,
maxLines = 1,
modifier =
Expand Down Expand Up @@ -370,7 +378,6 @@ fun MiniPlayer(
Text(
text = (songEntity?.artistName?.connectArtists() ?: "").toString(),
style = typo.bodySmall,
color = Color.White,
maxLines = 1,
modifier =
Modifier
Expand Down Expand Up @@ -418,19 +425,19 @@ fun MiniPlayer(
.wrapContentSize(Alignment.Center)
.padding(
horizontal = 10.dp,
),
).align(Alignment.BottomCenter),
) {
LinearProgressIndicator(
progress = { animatedProgress },
modifier =
Modifier
.fillMaxWidth()
.height(3.dp)
.height(1.dp)
.background(
color = Color.Transparent,
shape = RoundedCornerShape(8.dp),
shape = RoundedCornerShape(4.dp),
),
color = Color(0xB2FFFFFF),
color = Color.White,
trackColor = Color.Transparent,
strokeCap = StrokeCap.Round,
drawStopIndicator = {},
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/transparent_rect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<gradient
android:startColor="#00100000"
android:centerColor="#C30B0A0A"
android:endColor="#0B0A0A"
android:endColor="#070707"
android:angle="270"/>
</shape>
180 changes: 2 additions & 178 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,189 +17,13 @@
app:navGraph="@navigation/nav_bottom_navigation" />

</FrameLayout>

<!-- <com.daimajia.swipe.SwipeLayout-->
<!-- android:id="@+id/miniplayer"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="60sp"-->
<!-- android:layout_marginStart="5sp"-->
<!-- android:layout_marginEnd="5sp"-->
<!-- android:layout_above="@+id/bottom_navigation_view">-->
<!-- <LinearLayout-->
<!-- android:layout_width="120dp"-->
<!-- android:layout_height="60sp"-->
<!-- android:weightSum="1"-->
<!-- android:id="@+id/llBottom">-->
<!-- <com.google.android.material.card.MaterialCardView-->
<!-- android:id="@+id/cardBottom"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="60sp"-->
<!-- style="?attr/materialCardViewElevatedStyle"-->
<!-- app:cardCornerRadius="0sp"-->
<!-- android:layout_gravity="bottom"-->
<!-- app:cardPreventCornerOverlap="true">-->

<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:orientation="horizontal"-->
<!-- android:background="@android:color/transparent">-->

<!-- <ImageButton-->
<!-- android:background="@null"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:src="@drawable/baseline_skip_next_24"-->
<!-- android:id="@+id/btSkipNext"-->
<!-- android:layout_weight="1"-->
<!-- android:layout_gravity="center_vertical"></ImageButton>-->

<!-- <ImageButton-->
<!-- android:layout_weight="1"-->
<!-- android:background="@null"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:src="@drawable/baseline_close_24"-->
<!-- android:id="@+id/btRemoveMiniPlayer"-->
<!-- android:layout_gravity="center_vertical"></ImageButton>-->
<!-- </LinearLayout>-->

<!-- </com.google.android.material.card.MaterialCardView>-->
<!-- </LinearLayout>-->
<!-- <LinearLayout-->
<!-- android:id="@+id/llMiniPlayer"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:weightSum="1">-->

<!-- <com.google.android.material.card.MaterialCardView-->
<!-- android:id="@+id/card"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:cardCornerRadius="10dp"-->
<!-- style="?attr/materialCardViewElevatedStyle"-->
<!-- app:cardElevation="3dp"-->
<!-- android:layout_gravity="bottom"-->
<!-- app:cardPreventCornerOverlap="true">-->

<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content">-->

<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_alignParentTop="true"-->
<!-- android:padding="0dp">-->

<!-- <com.google.android.material.imageview.ShapeableImageView-->
<!-- android:id="@+id/ivArt"-->
<!-- android:layout_width="40sp"-->
<!-- android:layout_height="40sp"-->
<!-- android:layout_alignParentStart="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginStart="8sp"-->
<!-- android:src="@drawable/outline_album_24">-->

<!-- </com.google.android.material.imageview.ShapeableImageView>-->

<!-- <LinearLayout-->
<!-- android:id="@+id/llSongInfo"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginStart="10sp"-->
<!-- android:layout_marginEnd="100dp"-->
<!-- android:layout_toEndOf="@+id/ivArt"-->
<!-- android:orientation="vertical">-->

<!-- <TextView-->
<!-- android:id="@+id/song_title"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginBottom="4dp"-->
<!-- android:ellipsize="marquee"-->
<!-- android:focusable="true"-->
<!-- android:focusableInTouchMode="true"-->
<!-- android:marqueeRepeatLimit="marquee_forever"-->
<!-- android:scrollHorizontally="true"-->
<!-- android:singleLine="true"-->
<!-- android:text=""-->
<!-- android:textColor="@android:color/white"-->
<!-- android:textSize="15sp"-->
<!-- android:textStyle="bold" />-->

<!-- <TextView-->
<!-- android:id="@+id/song_artist"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:ellipsize="marquee"-->
<!-- android:focusable="true"-->
<!-- android:focusableInTouchMode="true"-->
<!-- android:marqueeRepeatLimit="marquee_forever"-->
<!-- android:scrollHorizontally="true"-->
<!-- android:singleLine="true"-->
<!-- android:text=""-->
<!-- android:textColor="@android:color/white"-->
<!-- android:textSize="10sp" />-->
<!-- </LinearLayout>-->

<!-- <com.google.android.material.checkbox.MaterialCheckBox-->
<!-- android:id="@+id/cbFavorite"-->
<!-- android:layout_width="50dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_toStartOf="@id/btPlayPause"-->
<!-- android:button="@drawable/selector_favorite_check_box"-->
<!-- android:clickable="true"-->
<!-- android:focusable="true"-->
<!-- app:buttonIconTint="@color/selector_favorite_check_box"-->
<!-- app:buttonTint="@color/selector_favorite_check_box">-->

<!-- </com.google.android.material.checkbox.MaterialCheckBox>-->

<!-- <ImageButton-->
<!-- android:id="@+id/btPlayPause"-->
<!-- android:layout_width="40dp"-->
<!-- android:layout_height="40dp"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginEnd="10sp"-->
<!-- android:background="@null"-->
<!-- android:layout_alignParentEnd="true"-->
<!-- android:scaleType="fitCenter"-->
<!-- android:src="@drawable/baseline_play_arrow_24">-->

<!-- </ImageButton>-->
<!-- </RelativeLayout>-->

<!-- <com.google.android.material.progressindicator.LinearProgressIndicator-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:id="@+id/progressBar"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="3sp"-->
<!-- android:layout_marginStart="10sp"-->
<!-- android:layout_marginEnd="6sp"-->
<!-- android:max="100"-->
<!-- android:min="0"-->
<!-- android:progress="60"-->
<!-- app:indicatorColor="#B2FFFFFF"-->
<!-- app:trackColor="@android:color/transparent"-->
<!-- app:trackCornerRadius="3sp">-->

<!-- </com.google.android.material.progressindicator.LinearProgressIndicator>-->
<!-- </RelativeLayout>-->


<!-- </com.google.android.material.card.MaterialCardView>-->
<!-- </LinearLayout>-->
<!-- </com.daimajia.swipe.SwipeLayout>-->
<androidx.compose.ui.platform.ComposeView
android:id="@+id/miniplayer"
android:layout_width="match_parent"
android:layout_height="60sp"
android:layout_height="55dp"
android:layout_marginStart="5sp"
android:layout_marginEnd="5sp"
android:elevation="2dp"
android:layout_above="@+id/bottom_navigation_view">

</androidx.compose.ui.platform.ComposeView>
Expand Down

0 comments on commit d46a34c

Please sign in to comment.