Skip to content

Commit

Permalink
update:Theme&color
Browse files Browse the repository at this point in the history
  • Loading branch information
ZTFtrue committed Feb 4, 2024
1 parent 0861170 commit 29e1534
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 111 deletions.
4 changes: 3 additions & 1 deletion app/src/main/java/com/ztftrue/music/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,9 @@ class MainActivity : ComponentActivity() {
Icon(
Icons.Filled.Search,
modifier = Modifier.size(30.dp),
contentDescription = "Search"
contentDescription = "Search",
tint = MaterialTheme.colorScheme.onBackground

)
}
}
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/java/com/ztftrue/music/ui/home/AlbumGridView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ fun AlbumItemView(
}
Column(modifier = Modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.primary, RoundedCornerShape(5.dp))
.background(MaterialTheme.colorScheme.surfaceVariant, RoundedCornerShape(5.dp))
.clip(RoundedCornerShape(5.dp))
.combinedClickable(
onLongClick = {
Expand All @@ -269,6 +269,7 @@ fun AlbumItemView(
modifier = Modifier
.zIndex(0f)
.fillMaxWidth()
.background(MaterialTheme.colorScheme.primaryContainer)
.aspectRatio(1f),
)
if (item.id == musicViewModel.playListCurrent.value?.id && item.type == musicViewModel.playListCurrent.value?.type) {
Expand Down Expand Up @@ -297,7 +298,7 @@ fun AlbumItemView(
) {
Text(
text = item.name,
color = MaterialTheme.colorScheme.onPrimary,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.horizontalScroll(rememberScrollState(0))
)
Row(
Expand All @@ -306,7 +307,7 @@ fun AlbumItemView(
) {
Text(
text = "$number song${if (number <= 1L) "" else "s"}",
color = MaterialTheme.colorScheme.onPrimary,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
IconButton(
modifier = Modifier
Expand All @@ -320,6 +321,7 @@ fun AlbumItemView(
modifier = Modifier
.size(20.dp)
.clip(CircleShape),
tint = MaterialTheme.colorScheme.onSurfaceVariant
)
}
}
Expand Down
22 changes: 14 additions & 8 deletions app/src/main/java/com/ztftrue/music/ui/home/ArtistsGridView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,16 @@ fun ArtistsGridView(
LazyRow(
contentPadding = PaddingValues(5.dp),
state = rowListSate,
modifier = modifier.background(MaterialTheme.colorScheme.background).fillMaxWidth()
modifier = modifier
.background(MaterialTheme.colorScheme.background)
.fillMaxWidth()
) {
items(artistLists.size) { index ->
val item = artistLists[index]
Box(
modifier = Modifier
.padding(5.dp).fillMaxSize()
.padding(5.dp)
.fillMaxSize()
.width(((configuration.screenWidthDp - 80) / musicViewModel.albumItemsCount.intValue).dp)
) {
ArtistItemView(
Expand All @@ -157,7 +160,9 @@ fun ArtistsGridView(
columns = GridCells.Fixed(musicViewModel.artistItemsCount.intValue), // Number of columns in the grid
contentPadding = PaddingValues(5.dp),
state = listState,
modifier = modifier.background(MaterialTheme.colorScheme.background).fillMaxSize()
modifier = modifier
.background(MaterialTheme.colorScheme.background)
.fillMaxSize()
) {
items(artistLists.size) { index ->
val item = artistLists[index]
Expand Down Expand Up @@ -230,7 +235,7 @@ fun ArtistItemView(
val number = item.trackNumber
Column(modifier = Modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.primary, RoundedCornerShape(5.dp))
.background(MaterialTheme.colorScheme.surfaceVariant, RoundedCornerShape(5.dp))
.clip(RoundedCornerShape(5.dp))
.combinedClickable(
onLongClick = {
Expand Down Expand Up @@ -264,9 +269,9 @@ fun ArtistItemView(
contentDescription = "Album cover",
modifier = Modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.secondary)
.background(MaterialTheme.colorScheme.primaryContainer)
.aspectRatio(1f),
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onSecondary)
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimaryContainer)
)
if (item.id == musicViewModel.playListCurrent.value?.id && item.type == musicViewModel.playListCurrent.value?.type) {
Image(
Expand Down Expand Up @@ -294,7 +299,7 @@ fun ArtistItemView(
) {
Text(
text = item.name,
color = MaterialTheme.colorScheme.onPrimary,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.horizontalScroll(rememberScrollState(0))
)
Row(
Expand All @@ -303,7 +308,7 @@ fun ArtistItemView(
) {
Text(
text = "$number song${if (number <= 1L) "" else "s"}",
color = MaterialTheme.colorScheme.onPrimary,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
IconButton(
modifier = Modifier
Expand All @@ -317,6 +322,7 @@ fun ArtistItemView(
modifier = Modifier
.size(20.dp)
.clip(CircleShape),
tint = MaterialTheme.colorScheme.onSurfaceVariant
)
}
}
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/java/com/ztftrue/music/ui/home/GenreGridView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ fun GenreItemView(
Column(
modifier = Modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.primary, RoundedCornerShape(5.dp))
.background(MaterialTheme.colorScheme.surfaceVariant, RoundedCornerShape(5.dp))
.clip(RoundedCornerShape(5.dp))
.combinedClickable(onLongClick = {
showOperateDialog = true
Expand All @@ -246,9 +246,9 @@ fun GenreItemView(
modifier = Modifier
.zIndex(0f)
.fillMaxWidth()
.background(MaterialTheme.colorScheme.secondary)
.background(MaterialTheme.colorScheme.primaryContainer)
.aspectRatio(1f),
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onSecondary)
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimaryContainer)
)
if (item.id == musicViewModel.playListCurrent.value?.id && item.type == musicViewModel.playListCurrent.value?.type) {
Image(
Expand Down Expand Up @@ -276,7 +276,7 @@ fun GenreItemView(
) {
Text(
text = item.name,
color = MaterialTheme.colorScheme.onPrimary,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.horizontalScroll(rememberScrollState(0))
)
Row(
Expand All @@ -285,7 +285,7 @@ fun GenreItemView(
) {
Text(
text = "$number song${if (number <= 1L) "" else "s"}",
color = MaterialTheme.colorScheme.onPrimary,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
IconButton(
modifier = Modifier
Expand All @@ -299,6 +299,7 @@ fun GenreItemView(
modifier = Modifier
.size(20.dp)
.clip(CircleShape),
tint = MaterialTheme.colorScheme.onSurfaceVariant
)
}
}
Expand Down
20 changes: 2 additions & 18 deletions app/src/main/java/com/ztftrue/music/ui/other/SearchPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ fun SearchPage(
BackButton(navController)
Row(verticalAlignment = Alignment.CenterVertically) {
CompositionLocalProvider(
LocalContentColor provides MaterialTheme.colorScheme.onPrimary
LocalContentColor provides MaterialTheme.colorScheme.onBackground
) {
ProvideTextStyle(TextStyle(color = MaterialTheme.colorScheme.onPrimary)) {
ProvideTextStyle(TextStyle(color = MaterialTheme.colorScheme.onBackground)) {
OutlinedTextField(
value = keywords,
onValueChange = {
Expand Down Expand Up @@ -195,26 +195,10 @@ fun SearchPage(

},
colors = TextFieldDefaults.colors(
focusedPlaceholderColor = Color.Red, // Set your desired text color here
unfocusedPlaceholderColor = Color.Red, // Set your desired text color here
disabledPlaceholderColor = Color.Red, // Set your desired text color here
errorPlaceholderColor = Color.Red, // Set your desired text color here
focusedLabelColor = Color.Red, // Set your desired text color here
unfocusedLabelColor = Color.Red, // Set your desired text color here
disabledLabelColor = Color.Red, // Set your desired text color here
errorLabelColor = Color.Red, // Set your desired text color here
focusedContainerColor = MaterialTheme.colorScheme.background, // Set your desired text color here
unfocusedContainerColor = MaterialTheme.colorScheme.background, // Set your desired text color here
disabledContainerColor = MaterialTheme.colorScheme.background, // Set your desired text color here
errorContainerColor = MaterialTheme.colorScheme.background, // Set your desired text color here
focusedTextColor = Color.Red, // Set your desired text color here
unfocusedTextColor = Color.Red, // Set your desired text color here
disabledTextColor = Color.Red, // Set your desired text color here
errorTextColor = Color.Red, // Set your desired text color here
focusedSupportingTextColor = Color.Red, // Set your desired text color here
unfocusedSupportingTextColor = Color.Red, // Set your desired text color here
disabledSupportingTextColor = Color.Red, // Set your desired text color here
errorSupportingTextColor = Color.Red, // Set your desired text color here
cursorColor = MaterialTheme.colorScheme.onBackground, // Set your desired text color here
errorCursorColor =MaterialTheme.colorScheme.onBackground, // Set your desired text color here
)
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/ztftrue/music/ui/other/SettingsPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ fun SettingsPage(
modifier = Modifier
.fillMaxWidth()
.background(
MaterialTheme.colorScheme.primary
MaterialTheme.colorScheme.tertiaryContainer
),
offset = DpOffset(
x = 0.dp,
Expand All @@ -227,7 +227,7 @@ fun SettingsPage(
text = {
Text(
item,
color = MaterialTheme.colorScheme.onBackground
color = MaterialTheme.colorScheme.onTertiaryContainer
)
},
onClick = {
Expand Down
10 changes: 3 additions & 7 deletions app/src/main/java/com/ztftrue/music/ui/play/LyricsView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,7 @@ fun LyricsView(
) {
val textToolbar = LocalTextToolbar.current
val focusManager = LocalFocusManager.current
val colorI: Int = getContrastingColor(
MaterialTheme.colorScheme.background.toArgb().toAndroidColor(),
MaterialTheme.colorScheme.onBackground.toArgb().toAndroidColor()
)
val color = Color(colorI)

SelectionContainer(
modifier = Modifier,
content = {
Expand Down Expand Up @@ -393,7 +389,7 @@ fun LyricsView(
text = annotatedString,
style = TextStyle(
color = if (currentI == listIndex && musicViewModel.autoHighLight.value) {
MaterialTheme.colorScheme.onPrimary
MaterialTheme.colorScheme.onTertiaryContainer
} else {
MaterialTheme.colorScheme.onBackground
},
Expand All @@ -409,7 +405,7 @@ fun LyricsView(
modifier = Modifier
.fillMaxWidth()
.background(
if (currentI == listIndex && musicViewModel.autoHighLight.value) MaterialTheme.colorScheme.primaryContainer.copy(
if (currentI == listIndex && musicViewModel.autoHighLight.value) MaterialTheme.colorScheme.tertiaryContainer.copy(
alpha = 0.3f
) else MaterialTheme.colorScheme.background
)
Expand Down
20 changes: 10 additions & 10 deletions app/src/main/java/com/ztftrue/music/ui/play/PlayingPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ fun PlayingPage(
popupWindow = false
}
) {
val color = MaterialTheme.colorScheme.onPrimary
val color = MaterialTheme.colorScheme.secondary
val configuration = LocalConfiguration.current
Column(
modifier = Modifier
Expand All @@ -376,7 +376,7 @@ fun PlayingPage(
)
.border(
1.dp,
color = Color.Black,
color = MaterialTheme.colorScheme.primary,
RoundedCornerShape(10.dp)
)
) {
Expand Down Expand Up @@ -421,7 +421,7 @@ fun PlayingPage(
)
}
},
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimary)
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onBackground)
)
}
}
Expand Down Expand Up @@ -460,7 +460,7 @@ fun PlayingPage(
)
}
},
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimary)
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onBackground)
)
}
}
Expand Down Expand Up @@ -499,7 +499,7 @@ fun PlayingPage(
)
}
},
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimary)
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onBackground)
)
}
}
Expand Down Expand Up @@ -537,7 +537,7 @@ fun PlayingPage(
style = Stroke(4f)
)
},
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimary)
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onBackground)
)
}
}
Expand All @@ -561,7 +561,7 @@ fun PlayingPage(
modifier = Modifier
.width(24.dp)
.height(24.dp),
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimary)
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onBackground)
)
}
}
Expand All @@ -584,7 +584,7 @@ fun PlayingPage(
modifier = Modifier
.width(24.dp)
.height(24.dp),
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimary)
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onBackground)
)
}
}
Expand Down Expand Up @@ -690,7 +690,7 @@ fun PlayingPage(
modifier = Modifier
.width(24.dp)
.height(24.dp),
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimary)
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onBackground)
)
}
}
Expand Down Expand Up @@ -1035,7 +1035,7 @@ fun PlayingPage(
modifier = Modifier
.width(24.dp)
.height(24.dp),
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimary)
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onBackground)
)
}

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/ztftrue/music/ui/public/BackButton.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.navigation.NavHostController
import com.ztftrue.music.Router
Expand All @@ -22,7 +23,7 @@ fun BackButton(
IconButton(onClick = {
navController.navigateBack { }
}) {
Icon(Icons.Filled.ArrowBack, contentDescription = "Back")
Icon(Icons.Filled.ArrowBack, contentDescription = "Back", tint = MaterialTheme.colorScheme.onBackground)
}
}

Expand Down
Loading

0 comments on commit 29e1534

Please sign in to comment.