Reestructured project directories
This commit is contained in:
parent
0d7c42b1bf
commit
1433c0f601
@ -1,3 +1,5 @@
|
||||
package git
|
||||
|
||||
import org.eclipse.jgit.diff.DiffEntry
|
||||
|
||||
sealed class DiffEntryType(val diffEntry: DiffEntry) {
|
@ -1,6 +1,5 @@
|
||||
package git
|
||||
|
||||
import DiffEntryType
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.eclipse.jgit.api.Git
|
||||
@ -15,7 +14,6 @@ import org.eclipse.jgit.treewalk.AbstractTreeIterator
|
||||
import org.eclipse.jgit.treewalk.CanonicalTreeParser
|
||||
import org.eclipse.jgit.treewalk.FileTreeIterator
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.IOException
|
||||
|
||||
class DiffManager {
|
||||
suspend fun diffFormat(git: Git, diffEntryType: DiffEntryType): List<String> = withContext(Dispatchers.IO) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package git
|
||||
|
||||
import credentials.CredentialsState
|
||||
import credentials.CredentialsStateManager
|
||||
import git.*
|
||||
import kotlinx.coroutines.*
|
||||
import credentials.CredentialsStateManager import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import org.eclipse.jgit.api.Git
|
||||
@ -10,6 +10,7 @@ import org.eclipse.jgit.lib.Ref
|
||||
import org.eclipse.jgit.lib.Repository
|
||||
import org.eclipse.jgit.revwalk.RevCommit
|
||||
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
|
||||
import GPreferences
|
||||
import java.io.File
|
||||
|
||||
|
@ -15,7 +15,11 @@ import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.window.*
|
||||
import git.GitManager
|
||||
import git.RepositorySelectionStatus
|
||||
import theme.*
|
||||
import ui.RepositoryOpenPage
|
||||
import ui.WelcomePage
|
||||
import javax.swing.JFileChooser
|
||||
|
||||
|
||||
@ -72,13 +76,13 @@ fun Gitnuro(gitManager: GitManager) {
|
||||
@Suppress("UnnecessaryVariable") // Don't inline it because smart cast won't work
|
||||
when (repositorySelectionStatus) {
|
||||
RepositorySelectionStatus.None -> {
|
||||
NoneRepository()
|
||||
WelcomePage()
|
||||
}
|
||||
RepositorySelectionStatus.Loading -> {
|
||||
LoadingRepository()
|
||||
}
|
||||
is RepositorySelectionStatus.Open -> {
|
||||
RepositorySelected(gitManager = gitManager)
|
||||
RepositoryOpenPage(gitManager = gitManager)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -93,14 +97,6 @@ fun LoadingRepository() {
|
||||
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun NoneRepository() {
|
||||
Box(
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text("Open a repository to start using Gitnuro")
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun GMenu(
|
||||
|
@ -1,7 +1,8 @@
|
||||
package ui
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
@ -17,8 +18,9 @@ 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 components.ScrollableLazyColumn
|
||||
import ui.components.ScrollableLazyColumn
|
||||
import extensions.simpleName
|
||||
import git.GitManager
|
||||
import org.eclipse.jgit.lib.Ref
|
||||
import theme.headerBackground
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ui
|
||||
|
||||
import androidx.compose.foundation.*
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material.*
|
||||
@ -28,7 +29,8 @@ import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.setValue
|
||||
import components.ScrollableLazyColumn
|
||||
import ui.components.ScrollableLazyColumn
|
||||
import git.GitManager
|
||||
|
||||
@Composable
|
||||
fun CommitChanges(
|
@ -1,9 +1,10 @@
|
||||
package 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.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.setValue
|
||||
@ -19,7 +20,9 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import components.ScrollableLazyColumn
|
||||
import ui.components.ScrollableLazyColumn
|
||||
import git.DiffEntryType
|
||||
import git.GitManager
|
||||
import theme.primaryTextColor
|
||||
|
||||
@Composable
|
@ -1,11 +1,9 @@
|
||||
import androidx.compose.foundation.VerticalScrollbar
|
||||
package ui
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.rememberScrollbarAdapter
|
||||
import androidx.compose.material.Card
|
||||
import androidx.compose.material.Divider
|
||||
import androidx.compose.material.MaterialTheme
|
||||
@ -17,8 +15,9 @@ import androidx.compose.ui.text.font.FontStyle
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import components.ScrollableLazyColumn
|
||||
import ui.components.ScrollableLazyColumn
|
||||
import extensions.toSmartSystemString
|
||||
import git.GitManager
|
||||
import git.LogStatus
|
||||
import org.eclipse.jgit.revwalk.RevCommit
|
||||
import theme.primaryTextColor
|
39
src/main/kotlin/ui/RepositoryNone.kt
Normal file
39
src/main/kotlin/ui/RepositoryNone.kt
Normal file
@ -0,0 +1,39 @@
|
||||
package ui
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.res.painterResource
|
||||
|
||||
|
||||
@Composable
|
||||
fun WelcomePage() {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxSize(),
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxHeight(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
) {
|
||||
Button(onClick = {}) {
|
||||
Image(
|
||||
painter = painterResource("open.svg"),
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(contentColorFor(MaterialTheme.colors.primary))
|
||||
|
||||
)
|
||||
Text("Open repository")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
package ui
|
||||
|
||||
import androidx.compose.animation.Crossfade
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.*
|
||||
@ -6,24 +8,17 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import credentials.CredentialsState
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.diff.DiffEntry
|
||||
import org.eclipse.jgit.lib.Repository
|
||||
import git.DiffEntryType
|
||||
import git.GitManager
|
||||
import org.eclipse.jgit.revwalk.RevCommit
|
||||
import org.eclipse.jgit.revwalk.RevTree
|
||||
import org.eclipse.jgit.revwalk.RevWalk
|
||||
import org.eclipse.jgit.treewalk.AbstractTreeIterator
|
||||
import org.eclipse.jgit.treewalk.CanonicalTreeParser
|
||||
import java.io.IOException
|
||||
|
||||
|
||||
@Composable
|
||||
fun RepositorySelected(gitManager: GitManager) {
|
||||
fun RepositoryOpenPage(gitManager: GitManager) {
|
||||
var selectedRevCommit by remember {
|
||||
mutableStateOf<RevCommit?>(null)
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
package ui
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.MoreVert
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.ui.Alignment
|
||||
@ -16,7 +15,8 @@ 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 components.ScrollableLazyColumn
|
||||
import ui.components.ScrollableLazyColumn
|
||||
import git.GitManager
|
||||
import git.StashStatus
|
||||
import org.eclipse.jgit.revwalk.RevCommit
|
||||
import theme.headerBackground
|
||||
@ -43,7 +43,7 @@ fun Stashes(gitManager: GitManager) {
|
||||
.background(MaterialTheme.colors.headerBackground)
|
||||
.padding(vertical = 8.dp)
|
||||
.fillMaxWidth(),
|
||||
text = "Stashes",
|
||||
text = "ui.Stashes",
|
||||
fontWeight = FontWeight.Bold,
|
||||
textAlign = TextAlign.Center,
|
||||
color = MaterialTheme.colors.primary,
|
@ -1,39 +1,34 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package ui
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.ExperimentalAnimationApi
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.foundation.*
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.RectangleShape
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.input.pointer.pointerMoveFilter
|
||||
import androidx.compose.ui.platform.ContextMenuItem
|
||||
import androidx.compose.ui.platform.ContextMenuState
|
||||
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 components.ScrollableLazyColumn
|
||||
import ui.components.ScrollableLazyColumn
|
||||
import extensions.filePath
|
||||
import extensions.icon
|
||||
import extensions.iconColor
|
||||
import git.GitManager
|
||||
import git.StageStatus
|
||||
import org.eclipse.jgit.diff.DiffEntry
|
||||
import theme.headerBackground
|
@ -1,4 +1,4 @@
|
||||
package components
|
||||
package ui.components
|
||||
|
||||
import androidx.compose.foundation.VerticalScrollbar
|
||||
import androidx.compose.foundation.layout.Box
|
Loading…
Reference in New Issue
Block a user