Skip to content

Commit 0c6e067

Browse files
committed
style: fix more style issues manually
1 parent 8cdc72d commit 0c6e067

25 files changed

Lines changed: 590 additions & 412 deletions

base/src/main/java/io/github/sds100/keymapper/base/actions/Action.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package io.github.sds100.keymapper.base.actions
22

33
import io.github.sds100.keymapper.base.keymaps.KeyMap
4+
import io.github.sds100.keymapper.common.utils.Success
45
import io.github.sds100.keymapper.common.utils.hasFlag
5-
import io.github.sds100.keymapper.common.utils.success
66
import io.github.sds100.keymapper.common.utils.then
77
import io.github.sds100.keymapper.common.utils.valueOrNull
88
import io.github.sds100.keymapper.common.utils.withFlag
@@ -37,7 +37,7 @@ object ActionEntityMapper {
3737

3838
val stopHoldDownWhenTriggerPressedAgain: Boolean =
3939
entity.extras.getData(ActionEntity.EXTRA_CUSTOM_HOLD_DOWN_BEHAVIOUR).then {
40-
(it == ActionEntity.STOP_HOLD_DOWN_BEHAVIOR_TRIGGER_PRESSED_AGAIN.toString()).success()
40+
Success(it == ActionEntity.STOP_HOLD_DOWN_BEHAVIOR_TRIGGER_PRESSED_AGAIN.toString())
4141
}.valueOrNull() == true
4242

4343
val repeatRate =
@@ -72,7 +72,8 @@ object ActionEntityMapper {
7272

7373
when (repeatBehaviourExtra) {
7474
ActionEntity.STOP_REPEAT_BEHAVIOUR_LIMIT_REACHED -> RepeatMode.LIMIT_REACHED
75-
ActionEntity.STOP_REPEAT_BEHAVIOUR_TRIGGER_PRESSED_AGAIN -> RepeatMode.TRIGGER_PRESSED_AGAIN
75+
ActionEntity.STOP_REPEAT_BEHAVIOUR_TRIGGER_PRESSED_AGAIN ->
76+
RepeatMode.TRIGGER_PRESSED_AGAIN
7677
else -> RepeatMode.TRIGGER_RELEASED
7778
}
7879
} else {

base/src/main/java/io/github/sds100/keymapper/base/actions/ActionDataEntityMapper.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ object ActionDataEntityMapper {
795795
return flags
796796
}
797797

798+
@Suppress("ktlint:standard:max-line-length")
798799
private fun getDataString(data: ActionData): String = when (data) {
799800
is ActionData.Intent -> data.uri
800801
is ActionData.InputKeyEvent -> data.keyCode.toString()

base/src/main/java/io/github/sds100/keymapper/base/actions/ActionErrorSnapshot.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import io.github.sds100.keymapper.common.utils.valueOrNull
1515
import io.github.sds100.keymapper.data.Keys
1616
import io.github.sds100.keymapper.data.repositories.PreferenceRepository
1717
import io.github.sds100.keymapper.sysbridge.manager.SystemBridgeConnectionManager
18-
import io.github.sds100.keymapper.sysbridge.manager.SystemBridgeConnectionState
18+
import io.github.sds100.keymapper.sysbridge.manager.isConnected
1919
import io.github.sds100.keymapper.sysbridge.utils.SystemBridgeError
2020
import io.github.sds100.keymapper.system.SystemError
2121
import io.github.sds100.keymapper.system.apps.PackageManagerAdapter
@@ -67,8 +67,7 @@ class LazyActionErrorSnapshot(
6767

6868
private val isSystemBridgeConnected: Boolean by lazy {
6969
if (buildConfigProvider.sdkInt >= Constants.SYSTEM_BRIDGE_MIN_API) {
70-
@SuppressLint("NewApi")
71-
systemBridgeConnectionManager.connectionState.value is SystemBridgeConnectionState.Connected
70+
systemBridgeConnectionManager.isConnected()
7271
} else {
7372
false
7473
}

base/src/main/java/io/github/sds100/keymapper/base/actions/ActionOptionsBottomSheet.kt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ fun ActionOptionsBottomSheet(
255255
if (state.showHoldDownDuration) {
256256
Spacer(Modifier.height(8.dp))
257257

258+
val holdDownDurationMin = SliderMinimums.ACTION_HOLD_DOWN_DURATION.toFloat()
259+
val holdDownDurationMax = SliderMaximums.ACTION_HOLD_DOWN_DURATION.toFloat()
258260
SliderOptionText(
259261
modifier = Modifier
260262
.fillMaxWidth()
@@ -264,8 +266,7 @@ fun ActionOptionsBottomSheet(
264266
value = state.holdDownDuration.toFloat(),
265267
valueText = { "${it.toInt()} ms" },
266268
onValueChange = { callback.onHoldDownDurationChanged(it.toInt()) },
267-
valueRange =
268-
SliderMinimums.ACTION_HOLD_DOWN_DURATION.toFloat()..SliderMaximums.ACTION_HOLD_DOWN_DURATION.toFloat(),
269+
valueRange = holdDownDurationMin..holdDownDurationMax,
269270
stepSize = SliderStepSizes.ACTION_HOLD_DOWN_DURATION,
270271
)
271272
}
@@ -313,6 +314,10 @@ fun ActionOptionsBottomSheet(
313314
if (state.showDelayBeforeNextAction) {
314315
Spacer(Modifier.height(8.dp))
315316

317+
val delayBeforeNextActionMin =
318+
SliderMinimums.DELAY_BEFORE_NEXT_ACTION.toFloat()
319+
val delayBeforeNextActionMax =
320+
SliderMaximums.DELAY_BEFORE_NEXT_ACTION.toFloat()
316321
SliderOptionText(
317322
modifier = Modifier
318323
.fillMaxWidth()
@@ -322,14 +327,15 @@ fun ActionOptionsBottomSheet(
322327
value = state.delayBeforeNextAction.toFloat(),
323328
valueText = { "${it.toInt()} ms" },
324329
onValueChange = { callback.onDelayBeforeNextActionChanged(it.toInt()) },
325-
valueRange =
326-
SliderMinimums.DELAY_BEFORE_NEXT_ACTION.toFloat()..SliderMaximums.DELAY_BEFORE_NEXT_ACTION.toFloat(),
330+
valueRange = delayBeforeNextActionMin..delayBeforeNextActionMax,
327331
stepSize = SliderStepSizes.DELAY_BEFORE_NEXT_ACTION,
328332
)
329333
}
330334

331335
Spacer(Modifier.height(8.dp))
332336

337+
val actionMultiplierMin = SliderMinimums.ACTION_MULTIPLIER.toFloat()
338+
val actionMultiplierMax = SliderMaximums.ACTION_MULTIPLIER.toFloat()
333339
SliderOptionText(
334340
modifier = Modifier
335341
.fillMaxWidth()
@@ -343,8 +349,7 @@ fun ActionOptionsBottomSheet(
343349
value = state.multiplier.toFloat(),
344350
valueText = { "${it.toInt()}x" },
345351
onValueChange = { callback.onMultiplierChanged(it.toInt()) },
346-
valueRange =
347-
SliderMinimums.ACTION_MULTIPLIER.toFloat()..SliderMaximums.ACTION_MULTIPLIER.toFloat(),
352+
valueRange = actionMultiplierMin..actionMultiplierMax,
348353
stepSize = SliderStepSizes.ACTION_MULTIPLIER,
349354
)
350355

base/src/main/java/io/github/sds100/keymapper/base/actions/ActionUtils.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,8 @@ object ActionUtils {
370370
ActionId.INTENT -> R.string.action_send_intent
371371
ActionId.PHONE_CALL -> R.string.action_phone_call
372372
ActionId.SOUND -> R.string.action_play_sound
373-
ActionId.DISMISS_MOST_RECENT_NOTIFICATION -> R.string.action_dismiss_most_recent_notification
373+
ActionId.DISMISS_MOST_RECENT_NOTIFICATION ->
374+
R.string.action_dismiss_most_recent_notification
374375
ActionId.DISMISS_ALL_NOTIFICATIONS -> R.string.action_dismiss_all_notifications
375376
ActionId.ANSWER_PHONE_CALL -> R.string.action_answer_call
376377
ActionId.END_PHONE_CALL -> R.string.action_end_call

base/src/main/java/io/github/sds100/keymapper/base/actions/ActionsScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ private fun EmptyPreview() {
358358
),
359359
ShortcutModel(
360360
icon = ComposeIconInfo.Vector(Icons.Rounded.Pinch),
361-
text = "Pinch in with 2 finger(s) on coordinates 5/4 with a pinch distance of 8px in 200ms",
361+
text = "Pinch in with 2 finger(s) on coordinates 5/4",
362362
data = ActionData.ConsumeKeyEvent,
363363
),
364364
),
@@ -405,7 +405,7 @@ private fun LoadedPreview() {
405405
),
406406
ShortcutModel(
407407
icon = ComposeIconInfo.Vector(Icons.Rounded.Pinch),
408-
text = "Pinch in with 2 finger(s) on coordinates 5/4 with a pinch distance of 8px in 200ms",
408+
text = "Pinch in with 2 finger(s) on coordinates 5/4",
409409
data = ActionData.ConsumeKeyEvent,
410410
),
411411
),

base/src/main/java/io/github/sds100/keymapper/base/actions/CreateActionDelegate.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ class CreateActionDelegate(
380380

381381
volumeActionState = VolumeActionBottomSheetState(
382382
actionId = newActionId,
383-
volumeStream = oldStream ?: VolumeStream.MUSIC, // Default to MUSIC for old stream actions
383+
// Default to MUSIC for old stream actions
384+
volumeStream = oldStream ?: VolumeStream.MUSIC,
384385
showVolumeUi = oldShowVolumeUi,
385386
)
386387
return null

base/src/main/java/io/github/sds100/keymapper/base/actions/keyevent/FixKeyEventActionBottomSheet.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ fun FixKeyEventActionBottomSheet(
169169
Placeholder(
170170
width = MaterialTheme.typography.bodyLarge.fontSize,
171171
height = MaterialTheme.typography.bodyLarge.fontSize,
172-
placeholderVerticalAlign = PlaceholderVerticalAlign.TextCenter,
172+
placeholderVerticalAlign =
173+
PlaceholderVerticalAlign.TextCenter,
173174
),
174175
) {
175176
Icon(

base/src/main/java/io/github/sds100/keymapper/base/constraints/ConstraintErrorSnapshot.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ class LazyConstraintErrorSnapshot(
120120
}
121121
}
122122

123-
is ConstraintData.InPhoneCall, is ConstraintData.PhoneRinging, is ConstraintData.NotInPhoneCall -> {
123+
is ConstraintData.InPhoneCall,
124+
is ConstraintData.PhoneRinging,
125+
is ConstraintData.NotInPhoneCall,
126+
-> {
124127
if (!isPermissionGranted(Permission.READ_PHONE_STATE)) {
125128
return SystemError.PermissionDenied(Permission.READ_PHONE_STATE)
126129
}

base/src/main/java/io/github/sds100/keymapper/base/constraints/ConstraintUtils.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ object ConstraintUtils {
106106
ConstraintId.MEDIA_NOT_PLAYING -> R.string.constraint_choose_media_not_playing
107107
ConstraintId.MEDIA_PLAYING -> R.string.constraint_choose_media_playing
108108
ConstraintId.BT_DEVICE_CONNECTED -> R.string.constraint_choose_bluetooth_device_connected
109-
ConstraintId.BT_DEVICE_DISCONNECTED -> R.string.constraint_choose_bluetooth_device_disconnected
109+
ConstraintId.BT_DEVICE_DISCONNECTED ->
110+
R.string.constraint_choose_bluetooth_device_disconnected
110111
ConstraintId.SCREEN_ON -> R.string.constraint_choose_screen_on_description
111112
ConstraintId.SCREEN_OFF -> R.string.constraint_choose_screen_off_description
112113
ConstraintId.ORIENTATION_PORTRAIT -> R.string.constraint_choose_orientation_portrait

0 commit comments

Comments
 (0)