Skip to content

Commit

Permalink
Bump androidx.compose.material3:material3 from 1.1.2 to 1.2.0 (#635)
Browse files Browse the repository at this point in the history
* Bump androidx.compose.material3:material3 from 1.1.2 to 1.2.0

Bumps androidx.compose.material3:material3 from 1.1.2 to 1.2.0.

---
updated-dependencies:
- dependency-name: androidx.compose.material3:material3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Rename Divider to HorizontalDivider

* Remove ContentAlpha usage

* Replace Swipeable with AnchoredDraggable in PlayerOverlay

* Replace SwipeToDismiss with Material3 equivalent

* Migrate PullRefresh to material3 equivalent and remove material dependency

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charlotte Van Petegem <[email protected]>
  • Loading branch information
dependabot[bot] and chvp authored Feb 10, 2024
1 parent ac2dec4 commit 6ce47a9
Show file tree
Hide file tree
Showing 12 changed files with 196 additions and 161 deletions.
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ android {
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs += [
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
"-opt-in=coil.annotation.ExperimentalCoilApi"
Expand Down Expand Up @@ -102,8 +102,7 @@ dependencies {
// AndroidX Compose
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.foundation:foundation:$compose_version"
implementation "androidx.compose.material3:material3:1.1.2"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.material3:material3:1.2.0"
implementation "androidx.compose.material:material-icons-core:$compose_version"
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation "androidx.activity:activity-compose:1.8.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.ContentAlpha
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material3.Card
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -32,6 +30,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
Expand Down Expand Up @@ -76,7 +75,7 @@ public fun AlbumCard(
maxLines = 1,
modifier = Modifier.padding(bottom = 4.dp, start = 4.dp, end = 4.dp),
style = MaterialTheme.typography.bodyMedium,
color = LocalContentColor.current.copy(alpha = ContentAlpha.medium),
fontWeight = FontWeight.Normal,
overflow = TextOverflow.Ellipsis,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.ContentAlpha
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -23,6 +21,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
Expand Down Expand Up @@ -69,15 +68,15 @@ fun AlbumView(
Text(
album.stringifyAlbumArtists().let { if (it.isEmpty()) stringResource(R.string.various_artists) else it },
style = MaterialTheme.typography.titleMedium,
color = LocalContentColor.current.copy(alpha = ContentAlpha.medium),
fontWeight = FontWeight.Normal,
modifier = Modifier.padding(start = 8.dp),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
Text(
if (album.edition == null) album.release.format() else "${album.release.format()} (${album.edition.format()})",
style = MaterialTheme.typography.titleSmall,
color = LocalContentColor.current.copy(alpha = ContentAlpha.medium),
fontWeight = FontWeight.Normal,
modifier = Modifier.padding(start = 8.dp),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
Expand Down
38 changes: 24 additions & 14 deletions app/src/main/java/me/vanpetegem/accentor/ui/main/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,17 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.material.ContentAlpha
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.pullrefresh.PullRefreshIndicator
import androidx.compose.material.pullrefresh.pullRefresh
import androidx.compose.material.pullrefresh.rememberPullRefreshState
import androidx.compose.material3.DismissibleDrawerSheet
import androidx.compose.material3.DismissibleNavigationDrawer
import androidx.compose.material3.Divider
import androidx.compose.material3.DrawerState
import androidx.compose.material3.DrawerValue
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalContentColor
Expand All @@ -42,6 +37,8 @@ import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.contentColorFor
import androidx.compose.material3.pulltorefresh.PullToRefreshContainer
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
import androidx.compose.material3.rememberDrawerState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand All @@ -57,10 +54,12 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
Expand Down Expand Up @@ -229,7 +228,7 @@ fun Base(
navController.navigate("playlists")
scope.launch { drawerState.close() }
}
Divider()
HorizontalDivider()
DrawerRow(stringResource(R.string.preferences), false, R.drawable.ic_menu_preferences) {
context.startActivity(Intent(context, PreferencesActivity::class.java))
scope.launch { drawerState.close() }
Expand All @@ -242,10 +241,20 @@ fun Base(
topBar = { toolbar(drawerState) },
) { contentPadding ->
val isRefreshing by mainViewModel.isRefreshing.observeAsState()
val state = rememberPullRefreshState(isRefreshing ?: false, { mainViewModel.refresh() })
Box(modifier = Modifier.pullRefresh(state).padding(contentPadding)) {
val state = rememberPullToRefreshState()
if (state.isRefreshing) {
LaunchedEffect(true) {
mainViewModel.refresh()
}
}
if (!(isRefreshing ?: false)) {
LaunchedEffect(true) {
state.endRefresh()
}
}
Box(modifier = Modifier.nestedScroll(state.nestedScrollConnection).padding(contentPadding)) {
mainContent()
PullRefreshIndicator(isRefreshing ?: false, state, Modifier.align(Alignment.TopCenter))
PullToRefreshContainer(state = state, modifier = Modifier.align(Alignment.TopCenter))
}
}
}
Expand Down Expand Up @@ -317,7 +326,7 @@ fun SearchToolbar(
onClick = { exit() },
modifier = Modifier.padding(start = 8.dp),
) {
Icon(Icons.Filled.ArrowBack, contentDescription = stringResource(R.string.stop_searching))
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.stop_searching))
}
},
title = {
Expand All @@ -328,15 +337,16 @@ fun SearchToolbar(
placeholder = {
Text(
stringResource(R.string.search),
color = MaterialTheme.colorScheme.contentColorFor(MaterialTheme.colorScheme.primaryContainer).copy(ContentAlpha.medium),
color = MaterialTheme.colorScheme.contentColorFor(MaterialTheme.colorScheme.primaryContainer),
fontWeight = FontWeight.Normal,
)
},
colors =
TextFieldDefaults.colors(
focusedContainerColor = Color.Transparent,
unfocusedContainerColor = Color.Transparent,
disabledContainerColor = Color.Transparent,
cursorColor = LocalContentColor.current.copy(LocalContentAlpha.current),
cursorColor = LocalContentColor.current,
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -48,7 +47,7 @@ fun Controls(playerViewModel: PlayerViewModel = viewModel()) {
painterResource(R.drawable.ic_repeat_all),
contentDescription = stringResource(R.string.repeat_all),
modifier = Modifier.height(32.dp).aspectRatio(1f),
tint = MaterialTheme.colorScheme.primary.copy(alpha = LocalContentAlpha.current),
tint = MaterialTheme.colorScheme.primary,
)
}
}
Expand All @@ -58,7 +57,7 @@ fun Controls(playerViewModel: PlayerViewModel = viewModel()) {
painterResource(R.drawable.ic_repeat_one),
contentDescription = stringResource(R.string.repeat_one),
modifier = Modifier.height(32.dp).aspectRatio(1f),
tint = MaterialTheme.colorScheme.primary.copy(alpha = LocalContentAlpha.current),
tint = MaterialTheme.colorScheme.primary,
)
}
}
Expand Down Expand Up @@ -127,7 +126,7 @@ fun Controls(playerViewModel: PlayerViewModel = viewModel()) {
painterResource(R.drawable.ic_shuffle_all),
contentDescription = stringResource(R.string.shuffle_all),
modifier = Modifier.height(32.dp).aspectRatio(1f),
tint = MaterialTheme.colorScheme.primary.copy(alpha = LocalContentAlpha.current),
tint = MaterialTheme.colorScheme.primary,
)
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.ContentAlpha
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
Expand All @@ -17,6 +16,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
Expand Down Expand Up @@ -50,15 +50,17 @@ fun CurrentTrackInfo(playerViewModel: PlayerViewModel = viewModel()) {
overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(horizontal = 8.dp),
style = MaterialTheme.typography.titleMedium,
color = LocalContentColor.current.copy(alpha = ContentAlpha.medium),
fontWeight = FontWeight.Normal,
color = LocalContentColor.current,
)
Text(
currentAlbum?.title ?: "",
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(horizontal = 8.dp),
style = MaterialTheme.typography.titleSmall,
color = LocalContentColor.current.copy(alpha = ContentAlpha.medium),
fontWeight = FontWeight.Normal,
color = LocalContentColor.current,
)
}
}
Loading

0 comments on commit 6ce47a9

Please sign in to comment.