Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android SDK] Edge-to-edge to WooLogViewer activity #13372

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class WooLogViewerActivity : AppCompatActivity() {
intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name) + " " + title)
try {
startActivity(Intent.createChooser(intent, getString(R.string.share)))
} catch (ex: android.content.ActivityNotFoundException) {
} catch (_: android.content.ActivityNotFoundException) {
ToastUtils.showToast(this, R.string.logviewer_share_error)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ package com.woocommerce.android.support
import androidx.annotation.ColorRes
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.text.selection.SelectionContainer
Expand Down Expand Up @@ -42,27 +46,35 @@ fun WooLogViewerScreen(
) {
Scaffold(
topBar = {
Toolbar(
title = stringResource(id = R.string.logviewer_activity_title),
onNavigationButtonClick = onBackPress,
actions = {
IconButton(onClick = { onCopyButtonClick() }) {
Icon(
painter = painterResource(R.drawable.ic_copy_white_24dp),
contentDescription = stringResource(id = R.string.copy),
tint = colorResource(id = R.color.color_icon_menu)
)
}
IconButton(onClick = { onShareButtonClick() }) {
Icon(
Icons.Filled.Share,
contentDescription = stringResource(id = R.string.share),
tint = colorResource(id = R.color.color_icon_menu)
)
}
}
)
}
Box(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not really a nice way of doing this, but it looks like due to usage of the theme that has background that don't match the toolbar, the status bar would have a different color, which kills "edge-to-edge" filling

modifier = Modifier
.fillMaxWidth()
.background(color = colorResource(id = R.color.color_toolbar))
) {
Toolbar(
title = stringResource(id = R.string.logviewer_activity_title),
onNavigationButtonClick = onBackPress,
actions = {
IconButton(onClick = { onCopyButtonClick() }) {
Icon(
painter = painterResource(R.drawable.ic_copy_white_24dp),
contentDescription = stringResource(id = R.string.copy),
tint = colorResource(id = R.color.color_icon_menu)
)
}
IconButton(onClick = { onShareButtonClick() }) {
Icon(
Icons.Filled.Share,
contentDescription = stringResource(id = R.string.share),
tint = colorResource(id = R.color.color_icon_menu)
)
}
},
modifier = Modifier
.windowInsetsPadding(WindowInsets.statusBars)
)
}
},
) { padding ->
LogViewerEntries(
entries,
Expand Down
Loading