Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick: swap input/output with button and drag #136

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ object CurrUtils {
"#." + "#".repeat(fractionSize),
DecimalFormatSymbols(Locale.ENGLISH),
)
df.roundingMode = RoundingMode.CEILING
return df.format(number)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ object ArkColor {
val UtilitySuccess200 = Color(0xFFABEFC6)
val UtilitySuccess500 = Color(0xFF17B26A)
val UtilitySuccess700 = Color(0xFF067647)

val NeutralGray500 = Color(0xFF6C737F)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package dev.arkbuilders.rate.core.presentation.utils

import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalView
import androidx.core.view.HapticFeedbackConstantsCompat
import androidx.core.view.ViewCompat

enum class ReorderHapticFeedbackType {
START,
MOVE,
END,
}

open class ReorderHapticFeedback {
open fun performHapticFeedback(type: ReorderHapticFeedbackType) {
// no-op
}
}

@Composable
fun rememberReorderHapticFeedback(): ReorderHapticFeedback {
val view = LocalView.current

val reorderHapticFeedback =
remember {
object : ReorderHapticFeedback() {
override fun performHapticFeedback(type: ReorderHapticFeedbackType) {
when (type) {
ReorderHapticFeedbackType.START ->
ViewCompat.performHapticFeedback(
view,
HapticFeedbackConstantsCompat.GESTURE_START,
)

ReorderHapticFeedbackType.MOVE ->
ViewCompat.performHapticFeedback(
view,
HapticFeedbackConstantsCompat.SEGMENT_FREQUENT_TICK,
)

ReorderHapticFeedbackType.END ->
ViewCompat.performHapticFeedback(
view,
HapticFeedbackConstantsCompat.GESTURE_END,
)
}
}
}
}

return reorderHapticFeedback
}
30 changes: 30 additions & 0 deletions core/presentation/src/main/res/drawable/ic_drag.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="16dp"
android:viewportWidth="12"
android:viewportHeight="16">
<path
android:pathData="M8,2.167C8,1.246 8.746,0.5 9.667,0.5C10.587,0.5 11.333,1.246 11.333,2.167C11.333,3.087 10.587,3.833 9.667,3.833C8.746,3.833 8,3.087 8,2.167Z"
android:fillColor="#6C737F"
android:fillType="evenOdd"/>
<path
android:pathData="M8,8C8,7.08 8.746,6.333 9.667,6.333C10.587,6.333 11.333,7.08 11.333,8C11.333,8.92 10.587,9.667 9.667,9.667C8.746,9.667 8,8.92 8,8Z"
android:fillColor="#6C737F"
android:fillType="evenOdd"/>
<path
android:pathData="M8,13.833C8,12.913 8.746,12.167 9.667,12.167C10.587,12.167 11.333,12.913 11.333,13.833C11.333,14.754 10.587,15.5 9.667,15.5C8.746,15.5 8,14.754 8,13.833Z"
android:fillColor="#6C737F"
android:fillType="evenOdd"/>
<path
android:pathData="M0.667,2.167C0.667,1.246 1.413,0.5 2.334,0.5C3.254,0.5 4,1.246 4,2.167C4,3.087 3.254,3.833 2.334,3.833C1.413,3.833 0.667,3.087 0.667,2.167Z"
android:fillColor="#6C737F"
android:fillType="evenOdd"/>
<path
android:pathData="M0.667,8C0.667,7.08 1.413,6.333 2.334,6.333C3.254,6.333 4,7.08 4,8C4,8.92 3.254,9.667 2.334,9.667C1.413,9.667 0.667,8.92 0.667,8Z"
android:fillColor="#6C737F"
android:fillType="evenOdd"/>
<path
android:pathData="M0.667,13.833C0.667,12.913 1.413,12.167 2.334,12.167C3.254,12.167 4,12.913 4,13.833C4,14.754 3.254,15.5 2.334,15.5C1.413,15.5 0.667,14.754 0.667,13.833Z"
android:fillColor="#6C737F"
android:fillType="evenOdd"/>
</vector>
12 changes: 12 additions & 0 deletions core/presentation/src/main/res/drawable/ic_refresh.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="17dp"
android:height="20dp"
android:viewportWidth="17"
android:viewportHeight="20">
<path
android:pathData="M2.608,15.893C-0.647,12.638 -0.647,7.362 2.608,4.108C3.273,3.443 3.83,2.917 4.295,2.5L1.834,2.5C1.373,2.5 1,2.127 1,1.667C1,1.207 1.373,0.833 1.834,0.833L6.834,0.833C7.294,0.833 7.667,1.207 7.667,1.667V6.667C7.667,7.127 7.294,7.5 6.834,7.5C6.373,7.5 6,7.127 6,6.667L6,3.229C5.486,3.656 4.768,4.304 3.786,5.286C1.183,7.89 1.183,12.111 3.786,14.714C4.71,15.638 5.834,16.232 7.018,16.501C7.467,16.603 7.748,17.049 7.646,17.498C7.544,17.947 7.098,18.228 6.649,18.126C5.168,17.79 3.76,17.045 2.608,15.893Z"
android:fillColor="#000000"/>
<path
android:pathData="M9.983,3.499C9.534,3.398 9.252,2.951 9.354,2.502C9.456,2.053 9.903,1.772 10.351,1.874C11.833,2.21 13.241,2.955 14.393,4.108C17.647,7.362 17.647,12.638 14.393,15.893C13.728,16.558 13.171,17.084 12.706,17.5H15.167C15.627,17.5 16,17.873 16,18.333C16,18.794 15.627,19.167 15.167,19.167H10.167C9.707,19.167 9.334,18.794 9.334,18.333V13.333C9.334,12.873 9.707,12.5 10.167,12.5C10.627,12.5 11,12.873 11,13.333V16.772C11.514,16.345 12.232,15.697 13.214,14.714C15.818,12.111 15.818,7.89 13.214,5.286C12.291,4.363 11.167,3.768 9.983,3.499Z"
android:fillColor="#000000"/>
</vector>
1 change: 1 addition & 0 deletions feature/quick/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ dependencies {
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(libs.constraintlayout.compose)
implementation(libs.reorderable)

implementation(libs.timber)

Expand Down
Loading
Loading