Diff header now shrinks path to fit other ui elements if needed (like changed files in a commit)
This commit is contained in:
parent
096f4128b2
commit
3ff18edaad
@ -624,17 +624,28 @@ private fun DiffHeader(
|
|||||||
.padding(start = 8.dp, end = 8.dp),
|
.padding(start = 8.dp, end = 8.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
val filePath = if (diffEntry.newPath != "/dev/null")
|
val fileName = diffEntry.fileName
|
||||||
diffEntry.newPath
|
val dirPath: String = diffEntry.parentDirectoryPath
|
||||||
else
|
|
||||||
diffEntry.oldPath
|
|
||||||
|
|
||||||
|
if(dirPath.isNotEmpty()) {
|
||||||
|
Text(
|
||||||
|
text = dirPath,
|
||||||
|
style = MaterialTheme.typography.body2,
|
||||||
|
color = MaterialTheme.colors.secondaryTextColor,
|
||||||
|
maxLines = 1,
|
||||||
|
softWrap = false,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f, false)
|
||||||
|
.padding(start = 16.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
Text(
|
Text(
|
||||||
text = filePath,
|
text = fileName,
|
||||||
style = MaterialTheme.typography.body2,
|
style = MaterialTheme.typography.body2,
|
||||||
color = MaterialTheme.colors.onBackground,
|
color = MaterialTheme.colors.onBackground,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
modifier = Modifier.padding(horizontal = 16.dp),
|
modifier = Modifier.padding(end = 16.dp),
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
Loading…
Reference in New Issue
Block a user