diff --git a/core/presentation/src/main/res/drawable/ic_drag.xml b/core/presentation/src/main/res/drawable/ic_drag.xml deleted file mode 100644 index fa9b3221..00000000 --- a/core/presentation/src/main/res/drawable/ic_drag.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/core/presentation/src/main/res/values-tr/strings.xml b/core/presentation/src/main/res/values-tr/strings.xml index da6bada6..3c7c4e0c 100644 --- a/core/presentation/src/main/res/values-tr/strings.xml +++ b/core/presentation/src/main/res/values-tr/strings.xml @@ -51,7 +51,8 @@ \n\nDoğru tahminler alabilmek için veritabanını en az haftada bir güncelleyin. What\'s new in Look4Sat - * Ayarlar sayfasında kaydırırken oluşan çökme düzeltildi (sayfa sırası listesi yüksekliği) + * Ayarlar sayfasında kaydırırken oluşan çökme düzeltildi + * Sayfa sırası: tek hareketle birden fazla konum atlanabilir; tutamaç tek nokta oldu Geri diff --git a/core/presentation/src/main/res/values-zh/strings.xml b/core/presentation/src/main/res/values-zh/strings.xml index 38d4b848..32e5d395 100644 --- a/core/presentation/src/main/res/values-zh/strings.xml +++ b/core/presentation/src/main/res/values-zh/strings.xml @@ -41,7 +41,8 @@ 请务必在设置中通过GPS、经纬度或QTH定位您的位置\n建议至少每周更新一次数据库,以确保预测结果的准确性 Look4Sat Pro 更新内容 - * 修复设置页滑动时闪退的问题(页面顺序列表高度) + * 修复设置页滑动时闪退的问题 + * 页面顺序:可一次拖动越过多个位置;拖拽手柄改为小圆点 后退 diff --git a/core/presentation/src/main/res/values/strings.xml b/core/presentation/src/main/res/values/strings.xml index c0f7fd64..27ca4eba 100644 --- a/core/presentation/src/main/res/values/strings.xml +++ b/core/presentation/src/main/res/values/strings.xml @@ -53,7 +53,8 @@ \n\nPlease update the database at least weekly to get accurate predictions. What\'s new in Look4Sat - * Fixed a crash when scrolling the Settings page (page-order list height) + * Fixed a crash when scrolling the Settings page + * Page order: drag a page past multiple positions in one gesture; grip is now a single dot Back diff --git a/feature/settings/src/main/java/com/rtbishop/look4sat/feature/settings/SettingsScreen.kt b/feature/settings/src/main/java/com/rtbishop/look4sat/feature/settings/SettingsScreen.kt index da43c4a0..30c0b052 100644 --- a/feature/settings/src/main/java/com/rtbishop/look4sat/feature/settings/SettingsScreen.kt +++ b/feature/settings/src/main/java/com/rtbishop/look4sat/feature/settings/SettingsScreen.kt @@ -22,15 +22,19 @@ import android.os.Build import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.foundation.clickable +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.layout.width import androidx.compose.foundation.gestures.detectDragGestures import androidx.compose.foundation.layout.height @@ -639,23 +643,22 @@ private fun DragOrderList( text = stringResource(id = screen.first), modifier = Modifier.weight(1f) ) - Icon( - painter = painterResource(id = R.drawable.ic_drag), - contentDescription = stringResource(id = R.string.prefs_ui_order_title), - tint = MaterialTheme.colorScheme.onSurfaceVariant, + Box( modifier = Modifier .size(48.dp) + .padding(20.dp) .pointerInput(screen.second) { detectDragGestures( - onDragStart = { draggingIndex = index }, + onDragStart = { draggingIndex = items.indexOf(screen) }, onDrag = { change, dragAmount -> change.consume() dragOffset += dragAmount.y - val target = (index + (dragOffset / itemHeightPx).roundToInt()) + val currentIndex = draggingIndex + val target = (currentIndex + (dragOffset / itemHeightPx).roundToInt()) .coerceIn(0, items.size - 1) - if (target != index) { - items.add(target, items.removeAt(index)) - dragOffset += (index - target) * itemHeightPx + if (target != currentIndex) { + items.add(target, items.removeAt(currentIndex)) + dragOffset += (currentIndex - target) * itemHeightPx draggingIndex = target } }, @@ -670,7 +673,14 @@ private fun DragOrderList( } ) } - ) + ) { + // 小圆点手柄(触控区 padding 20dp 居中 -> 8dp 圆点) + Box( + modifier = Modifier + .fillMaxSize() + .background(MaterialTheme.colorScheme.onSurfaceVariant, CircleShape) + ) + } } } }