Skip to content
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
5 changes: 0 additions & 5 deletions feature/git/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@
<ID>CyclomaticComplexMethod:GitHistoryScreen.kt$@Composable private fun GitHistoryScreen( uiState: GitHistoryUiState, interactionListener: GitHistoryInteractionListener, onBack: () -&gt; Unit, onOpenDiff: (String, String) -&gt; Unit, )</ID>
<ID>CyclomaticComplexMethod:GitPanelScreen.kt$@Composable private fun GitChangesHeader( uiState: GitPanelUiState, interactionListener: GitPanelInteractionListener, )</ID>
<ID>CyclomaticComplexMethod:GitPanelScreen.kt$@Composable private fun GitPanelScreen( uiState: GitPanelUiState, interactionListener: GitPanelInteractionListener, onClose: () -&gt; Unit, onOpenDiff: (String, GitDiffTarget) -&gt; Unit, onOpenHistory: () -&gt; Unit, onOpenBranches: () -&gt; Unit, onOpenTags: () -&gt; Unit, onOpenStashes: () -&gt; Unit, onOpenConflicts: () -&gt; Unit, )</ID>
<ID>ForbiddenImport:GitAuthPrompt.kt$import androidx.compose.material3.MaterialTheme</ID>
<ID>ForbiddenImport:GitBlameScreen.kt$import androidx.compose.material3.MaterialTheme</ID>
<ID>ForbiddenImport:GitConflictScreen.kt$import androidx.compose.material3.MaterialTheme</ID>
<ID>ForbiddenImport:GitDiffScreen.kt$import androidx.compose.material3.MaterialTheme</ID>
<ID>ForbiddenImport:GitHistoryScreen.kt$import androidx.compose.material3.MaterialTheme</ID>
<ID>ForbiddenImport:GitPanelScreen.kt$import androidx.compose.material3.MaterialTheme</ID>
<ID>ForbiddenImport:GitRefsScreen.kt$import androidx.compose.material3.MaterialTheme</ID>
<ID>LambdaParameterInRestartableEffect:GitHistoryScreen.kt$onLoadNext</ID>
<ID>LongMethod:GitAuthPrompt.kt$@Composable fun GitHubAuthDialog(state: GitAuthPromptState, actions: GitAuthPromptActions)</ID>
<ID>LongMethod:GitDiffScreen.kt$@Composable private fun GitDiffScreen( uiState: GitDiffUiState, interactionListener: GitDiffInteractionListener, onBack: () -&gt; Unit, )</ID>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand Down Expand Up @@ -58,6 +57,7 @@ import com.ahmadkharfan.androidstudiolite.designsystem.component.navigation.AslT
import com.ahmadkharfan.androidstudiolite.designsystem.component.navigation.rememberAslToolWindowWidth
import com.ahmadkharfan.androidstudiolite.designsystem.theme.AslShape
import com.ahmadkharfan.androidstudiolite.designsystem.theme.AslTheme
import com.ahmadkharfan.androidstudiolite.designsystem.theme.AslTypography
import com.ahmadkharfan.androidstudiolite.domain.model.GitFileStatus
import com.ahmadkharfan.androidstudiolite.domain.model.GitDiffTarget
import com.ahmadkharfan.androidstudiolite.domain.model.PullMode
Expand Down Expand Up @@ -293,7 +293,7 @@ private fun GitChangesHeader(
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
text = statusText,
style = MaterialTheme.typography.labelSmall,
style = AslTypography.labelSmall,
color = colors.textSecondary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
Expand Down Expand Up @@ -472,7 +472,7 @@ private fun SubmodulesView(
Column(modifier = Modifier.fillMaxSize()) {
Text(
text = stringResource(R.string.git_submodules_hint),
style = MaterialTheme.typography.bodySmall,
style = AslTypography.bodySmall,
color = AslTheme.colors.textSecondary,
modifier = Modifier.padding(12.dp),
)
Expand Down Expand Up @@ -551,6 +551,7 @@ private fun BootstrapDialog(uiState: GitPanelUiState, interactionListener: GitPa

@Composable
private fun OperationBanner(uiState: GitPanelUiState, interactionListener: GitPanelInteractionListener) {
val colors = AslTheme.colors
Row(
modifier = Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
Expand All @@ -562,8 +563,8 @@ private fun OperationBanner(uiState: GitPanelUiState, interactionListener: GitPa
repositoryStateLabel(uiState.repositoryState),
),
modifier = Modifier.weight(1f),
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.error,
style = AslTypography.labelMedium,
color = colors.error,
)
if (uiState.repositoryState == GitRepositoryState.REBASING) {
AslButton(stringResource(R.string.git_operation_continue), interactionListener::onContinueOperation, variant = AslButtonVariant.Tertiary, disabled = uiState.isBusy)
Expand Down Expand Up @@ -738,12 +739,12 @@ private fun SectionHeader(
}
Text(
text = title,
style = MaterialTheme.typography.labelMedium,
style = AslTypography.labelMedium,
color = colors.textSecondary,
)
Text(
text = count.toString(),
style = MaterialTheme.typography.labelSmall,
style = AslTypography.labelSmall,
color = colors.textTertiary,
modifier = Modifier
.background(colors.surfaceContainerLow, AslShape.xs)
Expand Down Expand Up @@ -832,7 +833,7 @@ private fun RemotesView(uiState: GitPanelUiState, interactionListener: GitPanelI
) {
Text(
text = stringResource(R.string.git_remotes_configured),
style = MaterialTheme.typography.labelMedium,
style = AslTypography.labelMedium,
color = AslTheme.colors.textSecondary,
modifier = Modifier.weight(1f),
)
Expand Down Expand Up @@ -933,7 +934,7 @@ private fun DiffView(
AslIconButton(icon = "arrow-left", contentDescription = stringResource(CommonR.string.action_back), onClick = { interactionListener.onCloseDiff() })
Text(
text = uiState.selectedPath.orEmpty(),
style = MaterialTheme.typography.bodySmall,
style = AslTypography.bodySmall,
color = colors.textPrimary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -27,6 +26,7 @@ import com.ahmadkharfan.androidstudiolite.designsystem.component.feedback.AslDia
import com.ahmadkharfan.androidstudiolite.designsystem.component.feedback.AslDialogVariant
import com.ahmadkharfan.androidstudiolite.designsystem.component.feedback.AslLinearProgress
import com.ahmadkharfan.androidstudiolite.designsystem.component.navigation.AslTopAppBar
import com.ahmadkharfan.androidstudiolite.designsystem.theme.AslTypography
import java.io.File
import org.koin.androidx.compose.koinViewModel
import org.koin.core.parameter.parametersOf
Expand Down Expand Up @@ -76,8 +76,8 @@ private fun GitConflictScreen(
else -> LazyColumn(Modifier.padding(padding).fillMaxSize()) {
items(uiState.entries, key = { it.path }) { entry ->
Column(Modifier.fillMaxWidth().padding(16.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) {
Text(entry.path.middleEllipsis(), style = MaterialTheme.typography.titleSmall, fontFamily = FontFamily.Monospace)
Text(entry.worktree.orEmpty().lineSequence().take(8).joinToString("\n"), fontFamily = FontFamily.Monospace, style = MaterialTheme.typography.bodySmall)
Text(entry.path.middleEllipsis(), style = AslTypography.titleSmall, fontFamily = FontFamily.Monospace)
Text(entry.worktree.orEmpty().lineSequence().take(8).joinToString("\n"), fontFamily = FontFamily.Monospace, style = AslTypography.bodySmall)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
AslButton(stringResource(R.string.git_conflict_accept_ours), { interactionListener.acceptOurs(entry.path) }, variant = AslButtonVariant.Secondary)
AslButton(stringResource(R.string.git_conflict_accept_theirs), { interactionListener.acceptTheirs(entry.path) }, variant = AslButtonVariant.Secondary)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ import com.ahmadkharfan.androidstudiolite.designsystem.component.inputs.AslSegme
import com.ahmadkharfan.androidstudiolite.designsystem.component.content.AslEmptyState
import com.ahmadkharfan.androidstudiolite.designsystem.component.feedback.AslLinearProgress
import com.ahmadkharfan.androidstudiolite.designsystem.component.navigation.AslTopAppBar
import com.ahmadkharfan.androidstudiolite.designsystem.theme.AslTheme
import com.ahmadkharfan.androidstudiolite.designsystem.theme.AslTypography
import com.ahmadkharfan.androidstudiolite.domain.model.GitFileDiff
import com.ahmadkharfan.androidstudiolite.domain.model.GitDiffHunk
import com.ahmadkharfan.androidstudiolite.domain.model.GitDiffKind
Expand Down Expand Up @@ -265,10 +267,11 @@ private fun DiffPaneColumn(

@Composable
private fun DiffPaneCell(line: GitDiffLine?, isLeft: Boolean) {
val colors = AslTheme.colors
val kind = line?.kind
val bg = when (kind) {
GitDiffKind.REMOVED -> MaterialTheme.colorScheme.error.copy(alpha = 0.10f)
GitDiffKind.ADDED, GitDiffKind.MODIFIED -> MaterialTheme.colorScheme.primary.copy(alpha = 0.10f)
GitDiffKind.REMOVED -> colors.error.copy(alpha = 0.10f)
GitDiffKind.ADDED, GitDiffKind.MODIFIED -> colors.accentPrimary.copy(alpha = 0.10f)
else -> Color.Transparent
}
val number = if (isLeft) line?.oldNo else line?.newNo
Expand All @@ -280,16 +283,16 @@ private fun DiffPaneCell(line: GitDiffLine?, isLeft: Boolean) {
number?.toString().orEmpty(),
modifier = Modifier.width(42.dp).padding(end = 6.dp),
textAlign = androidx.compose.ui.text.style.TextAlign.End,
color = MaterialTheme.colorScheme.onSurfaceVariant,
color = colors.textSecondary,
fontFamily = FontFamily.Monospace,
style = MaterialTheme.typography.labelSmall,
style = AslTypography.labelSmall,
)
Text(
line?.text.orEmpty(),
modifier = Modifier.padding(end = 12.dp),
fontFamily = FontFamily.Monospace,
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurface,
style = AslTypography.bodySmall,
color = colors.textPrimary,
softWrap = false,
maxLines = 1,
overflow = TextOverflow.Clip,
Expand All @@ -299,21 +302,22 @@ private fun DiffPaneCell(line: GitDiffLine?, isLeft: Boolean) {

@Composable
private fun HunkNavBar(count: Int, onPrevious: () -> Unit, onNext: () -> Unit) {
val colors = AslTheme.colors
Row(
Modifier.fillMaxWidth().padding(horizontal = 8.dp, vertical = 4.dp),
horizontalArrangement = Arrangement.spacedBy(6.dp),
verticalAlignment = androidx.compose.ui.Alignment.CenterVertically,
) {
Text(
pluralStringResource(R.plurals.git_diff_hunks, count, count),
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
style = AslTypography.labelSmall,
color = colors.textSecondary,
modifier = Modifier.weight(1f),
)
AslIconButton(icon = "chevron-up", contentDescription = stringResource(R.string.git_diff_previous_hunk), onClick = onPrevious, size = 32.dp, iconSize = 16.dp)
AslIconButton(icon = "chevron-down", contentDescription = stringResource(R.string.git_diff_next_hunk), onClick = onNext, size = 32.dp, iconSize = 16.dp)
}
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant)
HorizontalDivider(color = colors.borderDefault)
}

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import com.ahmadkharfan.androidstudiolite.designsystem.component.buttons.AslButton
import com.ahmadkharfan.androidstudiolite.designsystem.component.buttons.AslButtonVariant
Expand All @@ -33,6 +32,7 @@ import com.ahmadkharfan.androidstudiolite.designsystem.component.inputs.AslTextF
import com.ahmadkharfan.androidstudiolite.designsystem.component.inputs.AslTextFieldType
import com.ahmadkharfan.androidstudiolite.designsystem.theme.AslShape
import com.ahmadkharfan.androidstudiolite.designsystem.theme.AslTheme
import com.ahmadkharfan.androidstudiolite.designsystem.theme.AslTypography
import com.ahmadkharfan.androidstudiolite.domain.model.GitCredentials
import com.ahmadkharfan.androidstudiolite.domain.repository.GitCredentialStore
import com.ahmadkharfan.androidstudiolite.domain.repository.GitHubDeviceAuthState
Expand Down Expand Up @@ -214,12 +214,12 @@ fun GitHubAuthDialog(state: GitAuthPromptState, actions: GitAuthPromptActions) {
if (state.succeeded) {
Text(
text = stringResource(R.string.git_auth_connected_github),
style = MaterialTheme.typography.titleSmall,
style = AslTypography.titleSmall,
color = colors.success,
)
Text(
text = stringResource(R.string.git_auth_connected_hint),
style = MaterialTheme.typography.bodySmall,
style = AslTypography.bodySmall,
color = colors.textSecondary,
)
return@Column
Expand All @@ -246,18 +246,18 @@ fun GitHubAuthDialog(state: GitAuthPromptState, actions: GitAuthPromptActions) {
if (device == null) {
Text(
stringResource(R.string.git_auth_device_hint),
style = MaterialTheme.typography.bodySmall,
style = AslTypography.bodySmall,
color = colors.textSecondary,
)
} else {
Text(
stringResource(R.string.git_auth_copy_code_hint),
style = MaterialTheme.typography.bodySmall,
style = AslTypography.bodySmall,
color = colors.textSecondary,
)
Text(
text = device.userCode,
style = MaterialTheme.typography.headlineSmall,
style = AslTypography.headlineSmall,
color = colors.textPrimary,
textAlign = TextAlign.Center,
modifier = Modifier
Expand All @@ -271,7 +271,7 @@ fun GitHubAuthDialog(state: GitAuthPromptState, actions: GitAuthPromptActions) {
)
Text(
text = stringResource(if (codeCopied) R.string.git_auth_copied else R.string.git_auth_tap_copy),
style = MaterialTheme.typography.labelSmall,
style = AslTypography.labelSmall,
color = if (codeCopied) colors.success else colors.textTertiary,
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth(),
Expand All @@ -285,14 +285,14 @@ fun GitHubAuthDialog(state: GitAuthPromptState, actions: GitAuthPromptActions) {
)
Text(
stringResource(R.string.git_auth_waiting_github),
style = MaterialTheme.typography.bodySmall,
style = AslTypography.bodySmall,
color = colors.textTertiary,
)
}
} else {
Text(
stringResource(R.string.git_auth_token_hint, host),
style = MaterialTheme.typography.bodySmall,
style = AslTypography.bodySmall,
color = colors.textSecondary,
)
AslTextField(
Expand All @@ -315,7 +315,7 @@ fun GitHubAuthDialog(state: GitAuthPromptState, actions: GitAuthPromptActions) {
}

state.error?.let {
Text(text = it, style = MaterialTheme.typography.bodySmall, color = colors.error)
Text(text = it, style = AslTypography.bodySmall, color = colors.error)
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.rememberScrollState
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -21,6 +20,7 @@ import com.ahmadkharfan.androidstudiolite.core.format.middleEllipsis
import com.ahmadkharfan.androidstudiolite.designsystem.component.content.AslEmptyState
import com.ahmadkharfan.androidstudiolite.designsystem.component.feedback.AslLinearProgress
import com.ahmadkharfan.androidstudiolite.designsystem.component.navigation.AslTopAppBar
import com.ahmadkharfan.androidstudiolite.designsystem.theme.AslTypography
import com.ahmadkharfan.androidstudiolite.feature.editor.git.blameGutterText
import org.koin.androidx.compose.koinViewModel
import org.koin.core.parameter.parametersOf
Expand Down Expand Up @@ -48,8 +48,8 @@ fun GitBlameRoute(
LazyColumn(Modifier.padding(padding).fillMaxSize()) {
items(state.lines, key = { it.lineNo }) { line ->
Row(Modifier.horizontalScroll(scroll).padding(horizontal = 8.dp, vertical = 2.dp)) {
Text(blameGutterText(line.lineNo, line.shortId, line.authorName), fontFamily = FontFamily.Monospace, style = MaterialTheme.typography.bodySmall)
Text(line.lineText, fontFamily = FontFamily.Monospace, style = MaterialTheme.typography.bodySmall)
Text(blameGutterText(line.lineNo, line.shortId, line.authorName), fontFamily = FontFamily.Monospace, style = AslTypography.bodySmall)
Text(line.lineText, fontFamily = FontFamily.Monospace, style = AslTypography.bodySmall)
}
}
}
Expand Down
Loading
Loading