Skip to content

Commit

Permalink
Fix colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Sep 20, 2023
1 parent 7a2f0c8 commit c4a6e91
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ fun ContentBlockersDisableModeCellSubtitle(modifier: Modifier) {
Text(
text = spanned.toAnnotatedString(boldFontWeight = FontWeight.ExtraBold),
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.onSecondary,
modifier = modifier
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
Expand Down Expand Up @@ -111,132 +112,137 @@ fun SplitTunnelingScreen(
)
},
) {
LazyColumn(
modifier = Modifier.drawVerticalScrollbar(state = lazyListState).fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally,
state = lazyListState
) {
item(key = CommonContentKey.DESCRIPTION, contentType = ContentType.DESCRIPTION) {
Box(modifier = Modifier.fillMaxWidth()) {
Text(
style = MaterialTheme.typography.labelMedium,
text = stringResource(id = R.string.split_tunneling_description),
modifier =
Modifier.padding(
start = Dimens.mediumPadding,
end = Dimens.mediumPadding,
bottom = Dimens.mediumPadding
)
)
}
}
when (uiState) {
SplitTunnelingUiState.Loading -> {
item(key = CommonContentKey.PROGRESS, contentType = ContentType.PROGRESS) {
CircularProgressIndicator(
color = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.size(Dimens.progressIndicatorSize),
strokeCap = StrokeCap.Round
Surface(color = MaterialTheme.colorScheme.background) {
LazyColumn(
modifier = Modifier.drawVerticalScrollbar(state = lazyListState).fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally,
state = lazyListState
) {
item(key = CommonContentKey.DESCRIPTION, contentType = ContentType.DESCRIPTION) {
Box(modifier = Modifier.fillMaxWidth()) {
Text(
style = MaterialTheme.typography.labelMedium,
text = stringResource(id = R.string.split_tunneling_description),
modifier =
Modifier.padding(
start = Dimens.mediumPadding,
end = Dimens.mediumPadding,
bottom = Dimens.mediumPadding
)
)
}
}
is SplitTunnelingUiState.ShowAppList -> {
if (uiState.excludedApps.isNotEmpty()) {
when (uiState) {
SplitTunnelingUiState.Loading -> {
item(key = CommonContentKey.PROGRESS, contentType = ContentType.PROGRESS) {
CircularProgressIndicator(
color = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.size(Dimens.progressIndicatorSize),
strokeCap = StrokeCap.Round
)
}
}
is SplitTunnelingUiState.ShowAppList -> {
if (uiState.excludedApps.isNotEmpty()) {
itemWithDivider(
key = SplitTunnelingContentKey.EXCLUDED_APPLICATIONS,
contentType = ContentType.HEADER
) {
BaseCell(
title = {
Text(
text =
stringResource(id = R.string.exclude_applications),
style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.onPrimary
)
},
bodyView = {},
background = MaterialTheme.colorScheme.primary,
)
}
itemsIndexed(
items = uiState.excludedApps,
key = { _, listItem -> listItem.packageName },
contentType = { _, _ -> ContentType.ITEM }
) { index, listItem ->
SplitTunnelingCell(
title = listItem.name,
packageName = listItem.packageName,
isSelected = true,
modifier = Modifier.animateItemPlacement().fillMaxWidth(),
onResolveIcon = onResolveIcon
) {
// Move focus down unless the clicked item was the last in this
// section.
if (index < uiState.excludedApps.size - 1) {
focusManager.moveFocus(FocusDirection.Down)
} else {
focusManager.moveFocus(FocusDirection.Up)
}

onIncludeAppClick(listItem.packageName)
}
}
item(key = CommonContentKey.SPACER, contentType = ContentType.SPACER) {
Spacer(
modifier =
Modifier.animateItemPlacement().height(Dimens.mediumPadding)
)
}
}

itemWithDivider(
key = SplitTunnelingContentKey.EXCLUDED_APPLICATIONS,
key = SplitTunnelingContentKey.SHOW_SYSTEM_APPLICATIONS,
contentType = ContentType.OTHER_ITEM
) {
HeaderSwitchComposeCell(
title = stringResource(id = R.string.show_system_apps),
isToggled = uiState.showSystemApps,
onCellClicked = { newValue -> onShowSystemAppsClick(newValue) },
modifier = Modifier.animateItemPlacement()
)
}
itemWithDivider(
key = SplitTunnelingContentKey.INCLUDED_APPLICATIONS,
contentType = ContentType.HEADER
) {
BaseCell(
modifier = Modifier.animateItemPlacement(),
title = {
Text(
text = stringResource(id = R.string.exclude_applications),
style = MaterialTheme.typography.titleMedium
text = stringResource(id = R.string.all_applications),
style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.onPrimary
)
},
bodyView = {},
background = MaterialTheme.colorScheme.primary,
)
}
itemsIndexed(
items = uiState.excludedApps,
items = uiState.includedApps,
key = { _, listItem -> listItem.packageName },
contentType = { _, _ -> ContentType.ITEM }
) { index, listItem ->
SplitTunnelingCell(
title = listItem.name,
packageName = listItem.packageName,
isSelected = true,
isSelected = false,
modifier = Modifier.animateItemPlacement().fillMaxWidth(),
onResolveIcon = onResolveIcon
) {
// Move focus down unless the clicked item was the last in this
// section.
if (index < uiState.excludedApps.size - 1) {
if (index < uiState.includedApps.size - 1) {
focusManager.moveFocus(FocusDirection.Down)
} else {
focusManager.moveFocus(FocusDirection.Up)
}

onIncludeAppClick(listItem.packageName)
onExcludeAppClick(listItem.packageName)
}
}
item(key = CommonContentKey.SPACER, contentType = ContentType.SPACER) {
Spacer(
modifier =
Modifier.animateItemPlacement().height(Dimens.mediumPadding)
)
}
}

itemWithDivider(
key = SplitTunnelingContentKey.SHOW_SYSTEM_APPLICATIONS,
contentType = ContentType.OTHER_ITEM
) {
HeaderSwitchComposeCell(
title = stringResource(id = R.string.show_system_apps),
isToggled = uiState.showSystemApps,
onCellClicked = { newValue -> onShowSystemAppsClick(newValue) },
modifier = Modifier.animateItemPlacement()
)
}
itemWithDivider(
key = SplitTunnelingContentKey.INCLUDED_APPLICATIONS,
contentType = ContentType.HEADER
) {
BaseCell(
modifier = Modifier.animateItemPlacement(),
title = {
Text(
text = stringResource(id = R.string.all_applications),
style = MaterialTheme.typography.titleMedium
)
},
bodyView = {},
background = MaterialTheme.colorScheme.primary,
)
}
itemsIndexed(
items = uiState.includedApps,
key = { _, listItem -> listItem.packageName },
contentType = { _, _ -> ContentType.ITEM }
) { index, listItem ->
SplitTunnelingCell(
title = listItem.name,
packageName = listItem.packageName,
isSelected = false,
modifier = Modifier.animateItemPlacement().fillMaxWidth(),
onResolveIcon = onResolveIcon
) {
// Move focus down unless the clicked item was the last in this
// section.
if (index < uiState.includedApps.size - 1) {
focusManager.moveFocus(FocusDirection.Down)
} else {
focusManager.moveFocus(FocusDirection.Up)
}

onExcludeAppClick(listItem.packageName)
}
}
}
}
Expand Down

0 comments on commit c4a6e91

Please sign in to comment.