File name is always shown in the changes log to cut the dir path
This commit is contained in:
parent
250ca295b9
commit
970132f1d7
@ -13,12 +13,44 @@ import app.theme.addFile
|
||||
import app.theme.modifyFile
|
||||
import org.eclipse.jgit.diff.DiffEntry
|
||||
|
||||
val DiffEntry.filePath: String
|
||||
val DiffEntry.parentDirectoryPath: String
|
||||
get() {
|
||||
return if (this.changeType == DiffEntry.ChangeType.DELETE) {
|
||||
val path = if (this.changeType == DiffEntry.ChangeType.DELETE) {
|
||||
this.oldPath
|
||||
} else
|
||||
this.newPath
|
||||
|
||||
val pathSplit = path.split(systemSeparator).toMutableList()
|
||||
pathSplit.removeLast()
|
||||
|
||||
val directoryPath = pathSplit.joinToString(systemSeparator)
|
||||
|
||||
return if (directoryPath.isEmpty())
|
||||
""
|
||||
else
|
||||
"${directoryPath}/"
|
||||
}
|
||||
|
||||
val DiffEntry.fileName: String
|
||||
get() {
|
||||
val path = if (this.changeType == DiffEntry.ChangeType.DELETE) {
|
||||
this.oldPath
|
||||
} else
|
||||
this.newPath
|
||||
|
||||
val pathSplit = path.split(systemSeparator)
|
||||
|
||||
return pathSplit.lastOrNull() ?: ""
|
||||
}
|
||||
|
||||
val DiffEntry.filePath: String
|
||||
get() {
|
||||
val path = if (this.changeType == DiffEntry.ChangeType.DELETE) {
|
||||
this.oldPath
|
||||
} else
|
||||
this.newPath
|
||||
|
||||
return path
|
||||
}
|
||||
|
||||
val DiffEntry.icon: ImageVector
|
||||
|
@ -46,6 +46,10 @@ fun AppTheme(theme: Themes = Themes.LIGHT, content: @Composable() () -> Unit) {
|
||||
val Colors.primaryTextColor: Color
|
||||
get() = if (isLight) mainText else mainTextDark
|
||||
|
||||
@get:Composable
|
||||
val Colors.halfPrimary: Color
|
||||
get() = primary.copy(alpha = 0.8f)
|
||||
|
||||
@get:Composable
|
||||
val Colors.inversePrimaryTextColor: Color
|
||||
get() = if (isLight) mainTextDark else mainText
|
||||
|
@ -11,15 +11,14 @@ import androidx.compose.material.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import app.extensions.*
|
||||
import app.theme.headerBackground
|
||||
import app.theme.headerText
|
||||
import app.theme.primaryTextColor
|
||||
import app.theme.secondaryTextColor
|
||||
import app.theme.*
|
||||
import app.ui.components.AvatarImage
|
||||
import app.ui.components.ScrollableLazyColumn
|
||||
import app.ui.components.TooltipText
|
||||
@ -184,10 +183,16 @@ fun CommitLogChanges(diffEntries: List<DiffEntry>, onDiffSelected: (DiffEntry) -
|
||||
.fillMaxSize()
|
||||
) {
|
||||
itemsIndexed(items = diffEntries) { index, diffEntry ->
|
||||
val textColor = if (selectedIndex.value == index) {
|
||||
MaterialTheme.colors.primary
|
||||
} else
|
||||
MaterialTheme.colors.primaryTextColor
|
||||
val textColor: Color
|
||||
val secondaryTextColor: Color
|
||||
|
||||
if (selectedIndex.value == index) {
|
||||
textColor = MaterialTheme.colors.primary
|
||||
secondaryTextColor = MaterialTheme.colors.halfPrimary
|
||||
} else {
|
||||
textColor = MaterialTheme.colors.primaryTextColor
|
||||
secondaryTextColor = MaterialTheme.colors.secondaryTextColor
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
@ -213,12 +218,21 @@ fun CommitLogChanges(diffEntries: List<DiffEntry>, onDiffSelected: (DiffEntry) -
|
||||
)
|
||||
|
||||
Text(
|
||||
text = diffEntry.filePath,
|
||||
modifier = Modifier.padding(horizontal = 8.dp),
|
||||
color = textColor,
|
||||
text = diffEntry.parentDirectoryPath,
|
||||
modifier = Modifier.weight(1f, fill = false),
|
||||
maxLines = 1,
|
||||
fontSize = 13.sp,
|
||||
softWrap = false,
|
||||
fontSize = 13.sp,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
color = secondaryTextColor,
|
||||
)
|
||||
Text(
|
||||
text = diffEntry.fileName,
|
||||
modifier = Modifier.weight(1f, fill = false),
|
||||
maxLines = 1,
|
||||
softWrap = false,
|
||||
fontSize = 13.sp,
|
||||
color = textColor,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,12 @@ import androidx.compose.ui.input.pointer.pointerMoveFilter
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import app.extensions.fileName
|
||||
import app.extensions.filePath
|
||||
import app.extensions.parentDirectoryPath
|
||||
import app.extensions.isMerging
|
||||
import app.git.DiffEntryType
|
||||
import app.git.StatusEntry
|
||||
@ -558,8 +561,17 @@ private fun FileEntry(
|
||||
)
|
||||
|
||||
Text(
|
||||
text = diffEntry.filePath,
|
||||
modifier = Modifier.weight(1f, fill = true),
|
||||
text = diffEntry.parentDirectoryPath,
|
||||
modifier = Modifier.weight(1f, fill = false),
|
||||
maxLines = 1,
|
||||
softWrap = false,
|
||||
fontSize = 13.sp,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
color = MaterialTheme.colors.secondaryTextColor,
|
||||
)
|
||||
Text(
|
||||
text = diffEntry.fileName,
|
||||
modifier = Modifier.weight(1f, fill = false),
|
||||
maxLines = 1,
|
||||
softWrap = false,
|
||||
fontSize = 13.sp,
|
||||
|
Loading…
Reference in New Issue
Block a user