Skip to content

Commit 915ed6a

Browse files
committed
style: reformat system module
1 parent fff5f34 commit 915ed6a

71 files changed

Lines changed: 262 additions & 271 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

system/src/main/java/io/github/sds100/keymapper/system/AndroidSystemFeatureAdapter.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ package io.github.sds100.keymapper.system
22

33
import android.content.Context
44
import dagger.hilt.android.qualifiers.ApplicationContext
5+
import io.github.sds100.keymapper.system.permissions.SystemFeatureAdapter
56
import javax.inject.Inject
67
import javax.inject.Singleton
7-
import io.github.sds100.keymapper.system.permissions.SystemFeatureAdapter
88

99
@Singleton
1010
class AndroidSystemFeatureAdapter @Inject constructor(
11-
@ApplicationContext private val context: Context
11+
@ApplicationContext private val context: Context,
1212
) : SystemFeatureAdapter {
1313
private val ctx = context.applicationContext
1414

15-
override fun hasSystemFeature(feature: String): Boolean = ctx.packageManager.hasSystemFeature(feature)
15+
override fun hasSystemFeature(feature: String): Boolean =
16+
ctx.packageManager.hasSystemFeature(feature)
1617

1718
override fun getSystemFeatures(): List<String> {
1819
return ctx.packageManager.systemAvailableFeatures.map { it.name }

system/src/main/java/io/github/sds100/keymapper/system/JobSchedulerHelper.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ object JobSchedulerHelper {
7474
)
7575

7676
val historyContentUri = JobInfo.TriggerContentUri(
77-
Settings.Secure.getUriFor(AndroidInputMethodAdapter.SETTINGS_SECURE_SUBTYPE_HISTORY_KEY),
77+
Settings.Secure.getUriFor(
78+
AndroidInputMethodAdapter.SETTINGS_SECURE_SUBTYPE_HISTORY_KEY,
79+
),
7880
JobInfo.TriggerContentUri.FLAG_NOTIFY_FOR_DESCENDANTS,
7981
)
8082

system/src/main/java/io/github/sds100/keymapper/system/SystemHiltModule.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ abstract class SystemHiltModule {
8282

8383
@Singleton
8484
@Binds
85-
abstract fun providePackageManagerAdapter(impl: AndroidPackageManagerAdapter): PackageManagerAdapter
85+
abstract fun providePackageManagerAdapter(
86+
impl: AndroidPackageManagerAdapter,
87+
): PackageManagerAdapter
8688

8789
@Singleton
8890
@Binds
@@ -182,9 +184,13 @@ abstract class SystemHiltModule {
182184

183185
@Singleton
184186
@Binds
185-
abstract fun provideNotificationReceiverAdapter(impl: NotificationReceiverAdapterImpl): NotificationReceiverAdapter
187+
abstract fun provideNotificationReceiverAdapter(
188+
impl: NotificationReceiverAdapterImpl,
189+
): NotificationReceiverAdapter
186190

187191
@Singleton
188192
@Binds
189-
abstract fun provideSystemFeatureAdapter(impl: AndroidSystemFeatureAdapter): SystemFeatureAdapter
193+
abstract fun provideSystemFeatureAdapter(
194+
impl: AndroidSystemFeatureAdapter,
195+
): SystemFeatureAdapter
190196
}

system/src/main/java/io/github/sds100/keymapper/system/accessibility/AccessibilityServiceState.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.github.sds100.keymapper.system.accessibility
22

3-
43
enum class AccessibilityServiceState {
54
ENABLED,
65
CRASHED,

system/src/main/java/io/github/sds100/keymapper/system/airplanemode/AndroidAirplaneModeAdapter.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ import io.github.sds100.keymapper.common.utils.SettingsUtils
1111
import io.github.sds100.keymapper.common.utils.Success
1212
import io.github.sds100.keymapper.sysbridge.manager.SystemBridgeConnectionManager
1313
import io.github.sds100.keymapper.system.root.SuAdapter
14-
import kotlinx.coroutines.CoroutineScope
15-
import kotlinx.coroutines.launch
1614
import javax.inject.Inject
1715
import javax.inject.Singleton
16+
import kotlinx.coroutines.CoroutineScope
17+
import kotlinx.coroutines.launch
1818

1919
@Singleton
2020
class AndroidAirplaneModeAdapter @Inject constructor(
2121
@ApplicationContext private val ctx: Context,
2222
private val systemBridgeConnectionManager: SystemBridgeConnectionManager,
2323
private val suAdapter: SuAdapter,
24-
private val coroutineScope: CoroutineScope
24+
private val coroutineScope: CoroutineScope,
2525
) : AirplaneModeAdapter {
2626

2727
override suspend fun enable(): KMResult<*> {
@@ -57,7 +57,9 @@ class AndroidAirplaneModeAdapter @Inject constructor(
5757

5858
private fun broadcastAirplaneModeChanged(enabled: Boolean) {
5959
coroutineScope.launch {
60-
suAdapter.execute("am broadcast -a android.intent.action.AIRPLANE_MODE --ez state $enabled")
60+
suAdapter.execute(
61+
"am broadcast -a android.intent.action.AIRPLANE_MODE --ez state $enabled",
62+
)
6163
}
6264
}
6365
}

system/src/main/java/io/github/sds100/keymapper/system/apps/ActivityInfo.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@ package io.github.sds100.keymapper.system.apps
33
import kotlinx.serialization.Serializable
44

55
@Serializable
6-
data class ActivityInfo(
7-
val activityName: String,
8-
val packageName: String,
9-
)
6+
data class ActivityInfo(val activityName: String, val packageName: String)

system/src/main/java/io/github/sds100/keymapper/system/apps/AndroidAppShortcutAdapter.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import io.github.sds100.keymapper.common.utils.KMResult
1919
import io.github.sds100.keymapper.common.utils.State
2020
import io.github.sds100.keymapper.common.utils.Success
2121
import io.github.sds100.keymapper.common.utils.success
22-
import kotlinx.coroutines.flow.Flow
23-
import kotlinx.coroutines.flow.flow
2422
import java.util.UUID
2523
import javax.inject.Inject
2624
import javax.inject.Singleton
25+
import kotlinx.coroutines.flow.Flow
26+
import kotlinx.coroutines.flow.flow
2727

2828
@Singleton
2929
class AndroidAppShortcutAdapter @Inject constructor(
@@ -106,7 +106,8 @@ class AndroidAppShortcutAdapter @Inject constructor(
106106
}
107107
}
108108

109-
override fun createShortcutResultIntent(shortcut: ShortcutInfoCompat): Intent = ShortcutManagerCompat.createShortcutResultIntent(ctx, shortcut)
109+
override fun createShortcutResultIntent(shortcut: ShortcutInfoCompat): Intent =
110+
ShortcutManagerCompat.createShortcutResultIntent(ctx, shortcut)
110111

111112
override fun getShortcutName(info: AppShortcutInfo): KMResult<String> {
112113
try {

system/src/main/java/io/github/sds100/keymapper/system/apps/AndroidPackageManagerAdapter.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ import io.github.sds100.keymapper.common.utils.KMResult
2929
import io.github.sds100.keymapper.common.utils.State
3030
import io.github.sds100.keymapper.common.utils.Success
3131
import io.github.sds100.keymapper.common.utils.success
32+
import java.io.IOException
33+
import javax.inject.Inject
34+
import javax.inject.Singleton
3235
import kotlinx.coroutines.CoroutineScope
3336
import kotlinx.coroutines.Dispatchers
3437
import kotlinx.coroutines.flow.MutableSharedFlow
@@ -38,9 +41,6 @@ import kotlinx.coroutines.flow.distinctUntilChanged
3841
import kotlinx.coroutines.flow.map
3942
import kotlinx.coroutines.launch
4043
import kotlinx.coroutines.withContext
41-
import java.io.IOException
42-
import javax.inject.Inject
43-
import javax.inject.Singleton
4444

4545
@Singleton
4646
class AndroidPackageManagerAdapter @Inject constructor(
@@ -234,7 +234,8 @@ class AndroidPackageManagerAdapter @Inject constructor(
234234
}
235235
}
236236

237-
@SuppressLint("UnspecifiedImmutableFlag") // only specify the flag on SDK 23+. SDK 31 is first to enforce it.
237+
// only specify the flag on SDK 23+. SDK 31 is first to enforce it.
238+
@SuppressLint("UnspecifiedImmutableFlag")
238239
override fun openApp(packageName: String): KMResult<*> {
239240
val leanbackIntent = packageManager.getLeanbackLaunchIntentForPackage(packageName)
240241
val normalIntent = packageManager.getLaunchIntentForPackage(packageName)
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
package io.github.sds100.keymapper.system.apps
22

3-
data class AppShortcutInfo(
4-
val packageName: String,
5-
val activityName: String,
6-
)
3+
data class AppShortcutInfo(val packageName: String, val activityName: String)

system/src/main/java/io/github/sds100/keymapper/system/apps/KeyMapShortcutActivityIntentBuilder.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,5 @@ import android.content.Intent
44
import android.os.Bundle
55

66
interface KeyMapShortcutActivityIntentBuilder {
7-
fun build(
8-
intentAction: String,
9-
intentExtras: Bundle,
10-
): Intent
7+
fun build(intentAction: String, intentExtras: Bundle): Intent
118
}

0 commit comments

Comments
 (0)