Skip to content

Commit

Permalink
Fix for Android: Double tap opens the item twice. Also fixes this for…
Browse files Browse the repository at this point in the history
… all other clickable items across the app.

Upping versionCode to 121
  • Loading branch information
Dima-Android committed Dec 3, 2024
1 parent 0282e52 commit 1bbcf97
Show file tree
Hide file tree
Showing 21 changed files with 116 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package org.zotero.android.pdf.annotation

import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.FlowRow
Expand Down Expand Up @@ -30,6 +29,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import org.zotero.android.architecture.ui.CustomLayoutSize
import org.zotero.android.uicomponents.Strings
import org.zotero.android.uicomponents.foundation.debounceClickable
import org.zotero.android.uicomponents.foundation.safeClickable
import org.zotero.android.uicomponents.theme.CustomPalette
import org.zotero.android.uicomponents.theme.CustomTheme
Expand Down Expand Up @@ -58,7 +58,7 @@ internal fun FilterCircle(hex: String, isSelected: Boolean, onClick: () -> Unit)
Canvas(modifier = Modifier
.padding(4.dp)
.size(32.dp)
.clickable(
.debounceClickable(
interactionSource = remember { MutableInteractionSource() },
indication = null,
onClick = onClick
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.zotero.android.pdf.annotation

import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Text
Expand All @@ -11,6 +10,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import org.zotero.android.architecture.ui.CustomLayoutSize
import org.zotero.android.uicomponents.Strings
import org.zotero.android.uicomponents.foundation.debounceClickable
import org.zotero.android.uicomponents.textinput.CustomTextField
import org.zotero.android.uicomponents.theme.CustomTheme

Expand Down Expand Up @@ -41,7 +41,7 @@ internal fun TagsSection(
Text(
modifier = Modifier
.padding(start = 16.dp)
.clickable(
.debounceClickable(
interactionSource = remember { MutableInteractionSource() },
indication = null,
onClick = { viewModel.onTagsClicked() }
Expand All @@ -55,7 +55,7 @@ internal fun TagsSection(
Text(
modifier = Modifier
.padding(start = 8.dp)
.clickable(
.debounceClickable(
interactionSource = remember { MutableInteractionSource() },
indication = null,
onClick = { viewModel.onTagsClicked() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package org.zotero.android.pdf.annotationmore

import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.ColumnScope
Expand Down Expand Up @@ -33,6 +32,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import org.zotero.android.architecture.ui.CustomLayoutSize
import org.zotero.android.uicomponents.Strings
import org.zotero.android.uicomponents.foundation.debounceClickable
import org.zotero.android.uicomponents.foundation.safeClickable
import org.zotero.android.uicomponents.theme.CustomPalette
import org.zotero.android.uicomponents.theme.CustomTheme
Expand Down Expand Up @@ -92,7 +92,7 @@ internal fun MoreFilterCircle(hex: String, isSelected: Boolean, onClick: () -> U
Canvas(modifier = Modifier
.padding(4.dp)
.size(28.dp)
.clickable(
.debounceClickable(
interactionSource = remember { MutableInteractionSource() },
indication = null,
onClick = onClick
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package org.zotero.android.pdf.colorpicker

import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement
Expand Down Expand Up @@ -33,6 +32,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import org.zotero.android.architecture.ui.CustomLayoutSize
import org.zotero.android.uicomponents.CustomScaffold
import org.zotero.android.uicomponents.Strings
import org.zotero.android.uicomponents.foundation.debounceClickable
import org.zotero.android.uicomponents.theme.CustomPalette
import org.zotero.android.uicomponents.theme.CustomTheme
import org.zotero.android.uicomponents.theme.CustomThemeWithStatusAndNavBars
Expand Down Expand Up @@ -129,7 +129,7 @@ private fun FilterCircle(hex: String, isSelected: Boolean, onClick: () -> Unit)
Canvas(modifier = Modifier
.padding(4.dp)
.size(32.dp)
.clickable(
.debounceClickable(
interactionSource = remember { MutableInteractionSource() },
indication = null,
onClick = onClick
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.zotero.android.pdf.reader.pdfsearch

import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
Expand All @@ -18,6 +17,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import org.zotero.android.pdf.reader.pdfsearch.data.PdfReaderSearchItem
import org.zotero.android.uicomponents.Strings
import org.zotero.android.uicomponents.foundation.debounceCombinedClickable
import org.zotero.android.uicomponents.misc.NewDivider
import org.zotero.android.uicomponents.theme.CustomTheme

Expand All @@ -38,7 +38,7 @@ private fun PdfReaderSearchRow(
Column(
modifier = Modifier
.padding(horizontal = 16.dp)
.combinedClickable(
.debounceCombinedClickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(),
onClick = onItemTapped,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.zotero.android.pdf.reader.sidebar
import android.graphics.Bitmap
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.IntrinsicSize
Expand Down Expand Up @@ -38,6 +37,7 @@ import org.zotero.android.pdf.reader.PdfReaderVMInterface
import org.zotero.android.pdf.reader.PdfReaderViewState
import org.zotero.android.uicomponents.Drawables
import org.zotero.android.uicomponents.Strings
import org.zotero.android.uicomponents.foundation.debounceClickable
import org.zotero.android.uicomponents.foundation.safeClickable
import org.zotero.android.uicomponents.textinput.CustomTextField
import org.zotero.android.uicomponents.theme.CustomTheme
Expand Down Expand Up @@ -171,7 +171,7 @@ internal fun PdfReaderAnnotationsSidebarTagsSection(
}
if (shouldDisplayTagsSection) {
Box(modifier = Modifier
.clickable(
.debounceClickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(bounded = true),
onClick = { vMInterface.onTagsClicked(annotation) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.zotero.android.pdf.reader.sidebar

import androidx.compose.foundation.background
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -35,6 +34,7 @@ import org.zotero.android.pdf.reader.sidebar.data.Outline
import org.zotero.android.pdf.reader.sidebar.data.PdfReaderOutlineOptionsWithChildren
import org.zotero.android.uicomponents.Drawables
import org.zotero.android.uicomponents.Strings
import org.zotero.android.uicomponents.foundation.debounceCombinedClickable
import org.zotero.android.uicomponents.icon.IconWithPadding
import org.zotero.android.uicomponents.misc.NewDivider
import org.zotero.android.uicomponents.theme.CustomPalette
Expand Down Expand Up @@ -160,7 +160,7 @@ private fun OutlineItem(
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = rowModifier
.combinedClickable(
.debounceCombinedClickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(),
onClick = onItemTapped,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.zotero.android.screens.allitems.table.rows

import androidx.compose.foundation.background
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
Expand All @@ -17,6 +16,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import org.zotero.android.architecture.ui.CustomLayoutSize
import org.zotero.android.screens.allitems.data.ItemCellModel
import org.zotero.android.uicomponents.foundation.debounceCombinedClickable
import org.zotero.android.uicomponents.misc.CustomDivider
import org.zotero.android.uicomponents.theme.CustomTheme

Expand All @@ -40,7 +40,7 @@ internal fun ItemRow(
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = rowModifier
.combinedClickable(
.debounceCombinedClickable(
interactionSource = remember { MutableInteractionSource() },
indication = if (isEditing) null else ripple(),
onClick = { onItemTapped(cellModel) },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.zotero.android.screens.collections

import androidx.compose.foundation.background
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -31,6 +30,7 @@ import org.zotero.android.sync.Collection
import org.zotero.android.sync.CollectionIdentifier
import org.zotero.android.uicomponents.Drawables
import org.zotero.android.uicomponents.badge.RoundBadgeIcon
import org.zotero.android.uicomponents.foundation.debounceCombinedClickable
import org.zotero.android.uicomponents.icon.IconWithPadding
import org.zotero.android.uicomponents.misc.NewDivider
import org.zotero.android.uicomponents.theme.CustomTheme
Expand Down Expand Up @@ -129,7 +129,7 @@ private fun CollectionItem(
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = rowModifier
.combinedClickable(
.debounceCombinedClickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(),
onClick = onItemTapped,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -46,6 +45,7 @@ import org.zotero.android.uicomponents.attachmentprogress.FileAttachmentView
import org.zotero.android.uicomponents.attachmentprogress.State
import org.zotero.android.uicomponents.attachmentprogress.Style
import org.zotero.android.uicomponents.checkbox.CircleCheckBox
import org.zotero.android.uicomponents.foundation.debounceCombinedClickable
import org.zotero.android.uicomponents.foundation.safeClickable
import org.zotero.android.uicomponents.misc.CustomDivider
import org.zotero.android.uicomponents.reorder.ReorderableState
Expand Down Expand Up @@ -260,7 +260,7 @@ private fun LazyListScope.listOfNotes(
itemsIndexed(
itemTitles
) { index, item ->
Column(modifier = Modifier.combinedClickable(
Column(modifier = Modifier.debounceCombinedClickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(),
onClick = { onItemClicked(index) },
Expand Down Expand Up @@ -338,7 +338,7 @@ private fun LazyListScope.listOfTags(
items(
viewState.tags
) { item ->
Column(modifier = Modifier.combinedClickable(
Column(modifier = Modifier.debounceCombinedClickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(),
onClick = {},
Expand Down Expand Up @@ -393,7 +393,7 @@ private fun LazyListScope.listOfAttachments(
Row(
modifier = Modifier
.fillMaxWidth()
.combinedClickable(
.debounceCombinedClickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(),
onClick = { viewModel.openAttachment(item) },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.zotero.android.screens.itemdetails

import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand All @@ -22,6 +21,7 @@ import org.zotero.android.architecture.ui.CustomLayoutSize
import org.zotero.android.screens.itemdetails.data.ItemDetailCreator
import org.zotero.android.screens.itemdetails.data.ItemDetailField
import org.zotero.android.uicomponents.Strings
import org.zotero.android.uicomponents.foundation.debounceCombinedClickable
import org.zotero.android.uicomponents.misc.CustomDivider
import org.zotero.android.uicomponents.theme.CustomPalette
import org.zotero.android.uicomponents.theme.CustomTheme
Expand Down Expand Up @@ -108,7 +108,7 @@ private fun ListOfCreatorRows(
val value = creator.name
Row(
modifier = Modifier
.combinedClickable(
.debounceCombinedClickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(),
onLongClick = { onCreatorLongClick(creator) },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.zotero.android.screens.libraries

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand Down Expand Up @@ -31,6 +30,7 @@ import androidx.compose.ui.window.PopupProperties
import org.zotero.android.uicomponents.CustomScaffold
import org.zotero.android.uicomponents.Drawables
import org.zotero.android.uicomponents.Strings
import org.zotero.android.uicomponents.foundation.debounceClickable
import org.zotero.android.uicomponents.theme.CustomTheme

@Composable
Expand Down Expand Up @@ -61,7 +61,7 @@ internal fun DeleteGroupPopup(
modifier = Modifier
.fillMaxHeight()
.background(color = CustomTheme.colors.cardBackground)
.clickable(
.debounceClickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(bounded = true),
onClick = { onDeleteGroup() }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.zotero.android.screens.libraries

import androidx.compose.foundation.background
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
Expand All @@ -15,7 +14,6 @@ import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.Divider
import androidx.compose.material.ripple
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -30,6 +28,7 @@ import org.zotero.android.screens.libraries.data.LibraryRowData
import org.zotero.android.screens.libraries.data.LibraryState
import org.zotero.android.uicomponents.Drawables
import org.zotero.android.uicomponents.Strings
import org.zotero.android.uicomponents.foundation.debounceCombinedClickable
import org.zotero.android.uicomponents.misc.NewDivider
import org.zotero.android.uicomponents.theme.CustomTheme

Expand Down Expand Up @@ -112,7 +111,7 @@ private fun LibrariesItem(
// .fillMaxWidth()
.height(44.dp)
.background(CustomTheme.colors.surface)
.combinedClickable(
.debounceCombinedClickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(),
onClick = onItemTapped,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.zotero.android.screens.share.sharecollectionpicker

import androidx.annotation.DrawableRes
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
Expand All @@ -28,6 +27,7 @@ import org.zotero.android.architecture.ui.CustomLayoutSize
import org.zotero.android.screens.collections.data.CollectionItemWithChildren
import org.zotero.android.sync.Library
import org.zotero.android.uicomponents.Drawables
import org.zotero.android.uicomponents.foundation.debounceCombinedClickable
import org.zotero.android.uicomponents.icon.IconWithPadding
import org.zotero.android.uicomponents.misc.NewDivider
import org.zotero.android.uicomponents.theme.CustomTheme
Expand Down Expand Up @@ -136,7 +136,7 @@ private fun ShareRowItem(
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = rowModifier
.combinedClickable(
.debounceCombinedClickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(),
onClick = onRowTapped,
Expand Down
Loading

0 comments on commit 1bbcf97

Please sign in to comment.