Changed log to use the new design

This commit is contained in:
Abdelilah El Aissaoui 2021-11-26 05:32:14 +01:00
parent b394d9f33b
commit a89317305e

View file

@ -1,10 +1,7 @@
package app.ui package app.ui
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.items
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
@ -33,19 +30,21 @@ fun Diff(gitManager: GitManager, diffEntryType: DiffEntryType, onCloseDiffView:
text = gitManager.diffFormat(diffEntryType) text = gitManager.diffFormat(diffEntryType)
} }
Column(
Card(
modifier = Modifier modifier = Modifier
.padding(8.dp) .padding(8.dp)
.background(MaterialTheme.colors.surface) .background(MaterialTheme.colors.background)
.fillMaxSize() .fillMaxSize()
) { ) {
Column {
OutlinedButton( OutlinedButton(
modifier = Modifier modifier = Modifier
.padding(vertical = 16.dp, horizontal = 16.dp) .padding(vertical = 16.dp, horizontal = 16.dp)
.align(Alignment.End), .align(Alignment.End),
onClick = onCloseDiffView, onClick = onCloseDiffView,
colors = ButtonDefaults.buttonColors(
backgroundColor = MaterialTheme.colors.background,
contentColor = MaterialTheme.colors.primary,
)
) { ) {
Text("Close diff") Text("Close diff")
} }
@ -56,7 +55,7 @@ fun Diff(gitManager: GitManager, diffEntryType: DiffEntryType, onCloseDiffView:
.padding(16.dp) .padding(16.dp)
) { ) {
items(text) { line -> items(text) { line ->
val isHunkLine = line.startsWith("@@") && line.endsWith("@@") val isHunkLine = line.startsWith("@@")
val backgroundColor = when { val backgroundColor = when {
line.startsWith("+") -> { line.startsWith("+") -> {
@ -66,10 +65,10 @@ fun Diff(gitManager: GitManager, diffEntryType: DiffEntryType, onCloseDiffView:
Color(0x77dea2a2) Color(0x77dea2a2)
} }
isHunkLine -> { isHunkLine -> {
MaterialTheme.colors.background MaterialTheme.colors.surface
} }
else -> { else -> {
MaterialTheme.colors.surface MaterialTheme.colors.background
} }
} }
@ -94,6 +93,5 @@ fun Diff(gitManager: GitManager, diffEntryType: DiffEntryType, onCloseDiffView:
} }
} }
}
} }