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