Merge pull request #11 from ProjectInfinity/double-click-checkout
Add double click to checkout branch
This commit is contained in:
commit
f3ec209e41
@ -44,6 +44,7 @@ fun Branches(
|
|||||||
currentBranch = currentBranch,
|
currentBranch = currentBranch,
|
||||||
isCurrentBranch = currentBranch?.name == branch.name,
|
isCurrentBranch = currentBranch?.name == branch.name,
|
||||||
onBranchClicked = { branchesViewModel.selectBranch(branch) },
|
onBranchClicked = { branchesViewModel.selectBranch(branch) },
|
||||||
|
onBranchDoubleClicked = { branchesViewModel.checkoutRef(branch) },
|
||||||
onCheckoutBranch = { branchesViewModel.checkoutRef(branch) },
|
onCheckoutBranch = { branchesViewModel.checkoutRef(branch) },
|
||||||
onMergeBranch = { setMergeBranch(branch) },
|
onMergeBranch = { setMergeBranch(branch) },
|
||||||
onDeleteBranch = { branchesViewModel.deleteBranch(branch) },
|
onDeleteBranch = { branchesViewModel.deleteBranch(branch) },
|
||||||
@ -80,6 +81,7 @@ private fun BranchLineEntry(
|
|||||||
currentBranch: Ref?,
|
currentBranch: Ref?,
|
||||||
isCurrentBranch: Boolean,
|
isCurrentBranch: Boolean,
|
||||||
onBranchClicked: () -> Unit,
|
onBranchClicked: () -> Unit,
|
||||||
|
onBranchDoubleClicked: () -> Unit,
|
||||||
onCheckoutBranch: () -> Unit,
|
onCheckoutBranch: () -> Unit,
|
||||||
onMergeBranch: () -> Unit,
|
onMergeBranch: () -> Unit,
|
||||||
onRebaseBranch: () -> Unit,
|
onRebaseBranch: () -> Unit,
|
||||||
@ -107,7 +109,8 @@ private fun BranchLineEntry(
|
|||||||
text = branch.simpleName,
|
text = branch.simpleName,
|
||||||
iconResourcePath = "branch.svg",
|
iconResourcePath = "branch.svg",
|
||||||
bold = isCurrentBranch,
|
bold = isCurrentBranch,
|
||||||
onClick = onBranchClicked
|
onClick = onBranchClicked,
|
||||||
|
onDoubleClick = onBranchDoubleClicked
|
||||||
) {
|
) {
|
||||||
if (isCurrentBranch) {
|
if (isCurrentBranch) {
|
||||||
Icon(
|
Icon(
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
package app.ui.components
|
package app.ui.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.Icon
|
import androidx.compose.material.Icon
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
@ -19,6 +21,7 @@ import androidx.compose.ui.unit.sp
|
|||||||
import app.ENTRY_HEIGHT
|
import app.ENTRY_HEIGHT
|
||||||
import app.theme.primaryTextColor
|
import app.theme.primaryTextColor
|
||||||
|
|
||||||
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun SideMenuSubentry(
|
fun SideMenuSubentry(
|
||||||
text: String,
|
text: String,
|
||||||
@ -26,6 +29,7 @@ fun SideMenuSubentry(
|
|||||||
bold: Boolean = false,
|
bold: Boolean = false,
|
||||||
extraPadding: Dp = 0.dp,
|
extraPadding: Dp = 0.dp,
|
||||||
onClick: (() -> Unit)? = null,
|
onClick: (() -> Unit)? = null,
|
||||||
|
onDoubleClick: (() -> Unit)? = null,
|
||||||
additionalInfo: @Composable () -> Unit = {}
|
additionalInfo: @Composable () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
@ -33,8 +37,8 @@ fun SideMenuSubentry(
|
|||||||
.height(ENTRY_HEIGHT.dp)
|
.height(ENTRY_HEIGHT.dp)
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.run {
|
.run {
|
||||||
if (onClick != null)
|
if (onClick != null && onDoubleClick != null)
|
||||||
clickable(onClick = onClick)
|
combinedClickable(onClick = onClick, onDoubleClick = onDoubleClick)
|
||||||
else
|
else
|
||||||
this
|
this
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user