You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement settings persistence, improve pager navigation, and fix UI imports
- Persist visualizer, overlay, and idle settings via SharedPreferences in `MainViewModel`.
- Overhaul `HorizontalPager` scrolling with spring animations and improved haptic feedback logic.
- Initialize dynamic gain and strobe settings in `AudioCaptureService` from preferences.
- Fix Bluetooth device detection logic for older Android versions.
- Clean up UI component imports and references in `AudioSetupScreen` and `GlyphSettingsScreen`.
@@ -412,10 +421,10 @@ fun AudioDeviceInfo.isBluetoothOutput(): Boolean {
412
421
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.TIRAMISU) {
413
422
type ==AudioDeviceInfo.TYPE_BLUETOOTH_A2DP|| type ==AudioDeviceInfo.TYPE_BLE_HEADSET|| type ==AudioDeviceInfo.TYPE_BLE_SPEAKER|| type ==AudioDeviceInfo.TYPE_BLE_BROADCAST
414
423
} else {
415
-
TODO("VERSION.SDK_INT < TIRAMISU")
424
+
type ==AudioDeviceInfo.TYPE_BLUETOOTH_A2DP
416
425
}
417
426
} else {
418
-
TODO("VERSION.SDK_INT < S")
427
+
type ==AudioDeviceInfo.TYPE_BLUETOOTH_A2DP
419
428
}
420
429
}
421
430
@@ -446,28 +455,62 @@ internal fun BetterVizApp(
446
455
447
456
val context =LocalContext.current
448
457
val pagerState = rememberPagerState(initialPage = selectedTab.ordinal) { Tab.entries.size }
458
+
var isProgrammaticScroll by remember { mutableStateOf(false) }
449
459
450
460
LaunchedEffect(selectedTab) {
451
461
val target = selectedTab.ordinal
452
-
if (pagerState.targetPage != target) {
453
-
val distance = (pagerState.currentPage - target).absoluteValue
454
-
val duration = (250+ distance *80).toInt().coerceIn(250, 600)
455
-
456
-
pagerState.animateScrollToPage(
457
-
page = target,
458
-
animationSpec = tween(
459
-
durationMillis = duration,
460
-
easing =FastOutSlowInEasing
462
+
val current = pagerState.currentPage
463
+
if (current != target) {
464
+
val direction =if (target > current) 1else-1
465
+
val steps = (target - current).absoluteValue
466
+
467
+
if (steps >2) {
468
+
isProgrammaticScroll =true
469
+
try {
470
+
for (i in1 until steps) {
471
+
val isFirstStep = i ==1
472
+
val duration =if (isFirstStep) 200else100
473
+
val easing =if (isFirstStep) FastOutLinearInEasingelseLinearEasing
0 commit comments