Skip to content

Commit

Permalink
refactor(home): clean up home ui
Browse files Browse the repository at this point in the history
  • Loading branch information
libhide committed Jun 10, 2024
1 parent a00b7c1 commit a3d35aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
15 changes: 11 additions & 4 deletions app/src/main/kotlin/com/ratik/uttam/ui/feature/home/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import androidx.compose.ui.graphics.Color.Companion.White
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.core.content.FileProvider.getUriForFile
import androidx.core.net.toUri
import androidx.hilt.navigation.compose.hiltViewModel
Expand All @@ -61,6 +60,7 @@ import com.ratik.uttam.ui.feature.home.HomeEffect.SetWallpaperSilently
import com.ratik.uttam.ui.modifiers.shimmerBackground
import com.ratik.uttam.ui.theme.ColorPrimary
import com.ratik.uttam.ui.theme.ColorPrimaryVariant
import com.ratik.uttam.ui.theme.Dimens.NoElevation
import com.ratik.uttam.ui.theme.Dimens.PERCENT_10
import com.ratik.uttam.ui.theme.Dimens.SpacingNormal
import com.ratik.uttam.ui.theme.setNavigationBarColors
Expand Down Expand Up @@ -110,6 +110,7 @@ internal fun HomeScreen(
val wallpaperUri =
getUriForFile(context, "${context.packageName}.provider", wallpaperFile)
wallpaperManager.setStream(context.contentResolver.openInputStream(wallpaperUri))
Toast.makeText(context, R.string.wallpaper_set_text, Toast.LENGTH_SHORT).show()
}
}
}
Expand Down Expand Up @@ -219,7 +220,7 @@ private fun HomeAppBar(
TopAppBar(
modifier = modifier,
backgroundColor = Transparent,
elevation = 0.dp,
elevation = NoElevation,
title = {
Image(
painter = painterResource(id = R.drawable.uttam),
Expand All @@ -242,10 +243,16 @@ private fun HomeAppBar(
if (showMenu) {
DropdownMenu(expanded = true, onDismissRequest = { showMenu = false }) {
DropdownMenuItem(onClick = shareWallpaper) {
Text(text = "Share", color = ColorPrimaryVariant)
Text(
text = stringResource(id = R.string.share_label),
color = ColorPrimaryVariant,
)
}
DropdownMenuItem(onClick = navigateToSettings) {
Text(text = "Settings", color = ColorPrimaryVariant)
Text(
text = stringResource(id = R.string.settings_label),
color = ColorPrimaryVariant,
)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/kotlin/com/ratik/uttam/ui/theme/Dimens.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ object Dimens {
val SpacingXXXXXLarge = 56.dp

// Elevation
val NoElevation = 0.dp
val ElevationSmall = 2.dp
val ElevationLarge = 10.dp

Expand Down

0 comments on commit a3d35aa

Please sign in to comment.