Skip to content

Commit 4036c7a

Browse files
authored
chore(android): bump ktlint to 1.3.0 (#2085)
1 parent ef32bb8 commit 4036c7a

File tree

20 files changed

+76
-104
lines changed

20 files changed

+76
-104
lines changed

android/app/src/camera/java/com/microsoft/reacttestapp/camera/MainActivityExtensions.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ import com.google.android.material.snackbar.Snackbar
1010
import com.microsoft.reacttestapp.MainActivity
1111
import com.microsoft.reacttestapp.R
1212

13-
fun MainActivity.canUseCamera(): Boolean {
14-
return ContextCompat.checkSelfPermission(
15-
this,
16-
Manifest.permission.CAMERA
17-
) == PackageManager.PERMISSION_GRANTED
18-
}
13+
fun MainActivity.canUseCamera(): Boolean = ContextCompat.checkSelfPermission(
14+
this,
15+
Manifest.permission.CAMERA
16+
) == PackageManager.PERMISSION_GRANTED
1917

2018
fun MainActivity.scanForQrCode() {
2119
when {

android/app/src/devserverhelper-0.73/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import com.facebook.react.devsupport.InspectorPackagerConnection.BundleStatus
66
import com.facebook.react.modules.debug.interfaces.DeveloperSettings
77
import com.facebook.react.packagerconnection.PackagerConnectionSettings
88

9-
fun createDevServerHelper(context: Context, developerSettings: DeveloperSettings): DevServerHelper {
10-
return DevServerHelper(
9+
fun createDevServerHelper(context: Context, developerSettings: DeveloperSettings): DevServerHelper =
10+
DevServerHelper(
1111
developerSettings,
1212
context.packageName,
1313
{ BundleStatus() },
1414
PackagerConnectionSettings(context)
1515
)
16-
}

android/app/src/devserverhelper-0.74/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ import com.facebook.react.devsupport.DevServerHelper
55
import com.facebook.react.modules.debug.interfaces.DeveloperSettings
66
import com.facebook.react.packagerconnection.PackagerConnectionSettings
77

8-
fun createDevServerHelper(context: Context, developerSettings: DeveloperSettings): DevServerHelper {
9-
return DevServerHelper(
8+
fun createDevServerHelper(context: Context, developerSettings: DeveloperSettings): DevServerHelper =
9+
DevServerHelper(
1010
developerSettings,
1111
context.packageName,
1212
PackagerConnectionSettings(context)
1313
)
14-
}

android/app/src/devserverhelper-0.75/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ import com.facebook.react.devsupport.DevServerHelper
55
import com.facebook.react.modules.debug.interfaces.DeveloperSettings
66
import com.facebook.react.packagerconnection.PackagerConnectionSettings
77

8-
fun createDevServerHelper(context: Context, developerSettings: DeveloperSettings): DevServerHelper {
9-
return DevServerHelper(
8+
fun createDevServerHelper(context: Context, developerSettings: DeveloperSettings): DevServerHelper =
9+
DevServerHelper(
1010
developerSettings,
1111
context,
1212
PackagerConnectionSettings(context)
1313
)
14-
}

android/app/src/devserverhelper-pre-0.73/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ import com.facebook.react.modules.debug.interfaces.DeveloperSettings
99
fun createDevServerHelper(
1010
context: Context,
1111
@Suppress("UNUSED_PARAMETER") developerSettings: DeveloperSettings
12-
): DevServerHelper {
13-
return DevServerHelper(
14-
DevInternalSettings(context) {},
15-
context.packageName,
16-
{ BundleStatus() }
17-
)
18-
}
12+
): DevServerHelper = DevServerHelper(
13+
DevInternalSettings(context) {},
14+
context.packageName,
15+
{ BundleStatus() }
16+
)

android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentActivity.kt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,21 @@ class ComponentActivity : ReactActivity() {
1616
private const val COMPONENT_DISPLAY_NAME = "extra:componentDisplayName"
1717
const val COMPONENT_INITIAL_PROPERTIES = "extra:componentInitialProperties"
1818

19-
fun newIntent(activity: Activity, component: ComponentViewModel): Intent {
20-
return Intent(activity, ComponentActivity::class.java).apply {
19+
fun newIntent(activity: Activity, component: ComponentViewModel): Intent =
20+
Intent(activity, ComponentActivity::class.java).apply {
2121
putExtra(COMPONENT_NAME, component.name)
2222
putExtra(COMPONENT_DISPLAY_NAME, component.displayName)
2323

2424
if (component.initialProperties != null) {
2525
putExtra(COMPONENT_INITIAL_PROPERTIES, component.initialProperties)
2626
}
2727
}
28-
}
2928
}
3029

3130
// ReactActivity overrides
3231

33-
override fun createReactActivityDelegate(): ReactActivityDelegate {
34-
return ComponentActivityDelegate(this, mainComponentName)
35-
}
32+
override fun createReactActivityDelegate(): ReactActivityDelegate =
33+
ComponentActivityDelegate(this, mainComponentName)
3634

3735
override fun onCreate(savedInstanceState: Bundle?) {
3836
super.onCreate(savedInstanceState)
@@ -82,11 +80,9 @@ class ComponentActivity : ReactActivity() {
8280

8381
// Private
8482

85-
private fun findClass(name: String): Class<*>? {
86-
return try {
87-
Class.forName(name)
88-
} catch (e: ClassNotFoundException) {
89-
null
90-
}
83+
private fun findClass(name: String): Class<*>? = try {
84+
Class.forName(name)
85+
} catch (e: ClassNotFoundException) {
86+
null
9187
}
9288
}

android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentListAdapter.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@ class ComponentListAdapter(
3030

3131
override fun getItemCount() = components.size
3232

33-
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ComponentViewHolder {
34-
return ComponentViewHolder(
33+
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ComponentViewHolder =
34+
ComponentViewHolder(
3535
layoutInflater.inflate(
3636
R.layout.recyclerview_item_component,
3737
parent,
3838
false
3939
) as TextView
4040
)
41-
}
4241

4342
override fun onBindViewHolder(holder: ComponentViewHolder, position: Int) {
4443
holder.bindTo(components[position])

android/app/src/main/java/com/microsoft/reacttestapp/react/TestAppReactNativeHost.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ sealed class BundleSource {
3333
}
3434

3535
object Server : BundleSource() {
36-
override fun moveTo(to: BundleSource): Action {
37-
return when (to) {
38-
Disk -> Action.RESTART
39-
Server -> Action.RELOAD
40-
}
36+
override fun moveTo(to: BundleSource): Action = when (to) {
37+
Disk -> Action.RESTART
38+
Server -> Action.RELOAD
4139
}
4240
}
4341
}

android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import com.facebook.react.defaults.DefaultReactNativeHost
66
import com.facebook.soloader.SoLoader
77
import com.microsoft.reacttestapp.BuildConfig
88

9-
abstract class ReactNativeHostCompat(application: Application) : DefaultReactNativeHost(
10-
application
11-
) {
9+
abstract class ReactNativeHostCompat(application: Application) :
10+
DefaultReactNativeHost(application) {
11+
1212
companion object {
1313
init {
1414
try {

android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ import com.facebook.soloader.SoLoader
99
* The corresponding C++ implementation is in `android/app/src/main/jni/ComponentsRegistry.cpp`
1010
*/
1111
@DoNotStrip
12-
class ComponentsRegistry @DoNotStrip private constructor(
13-
componentFactory: ComponentFactory
14-
) {
12+
class ComponentsRegistry @DoNotStrip private constructor(componentFactory: ComponentFactory) {
13+
1514
companion object {
1615
@DoNotStrip
17-
fun register(componentFactory: ComponentFactory): ComponentsRegistry {
18-
return ComponentsRegistry(componentFactory)
19-
}
16+
fun register(componentFactory: ComponentFactory): ComponentsRegistry =
17+
ComponentsRegistry(componentFactory)
2018

2119
init {
2220
SoLoader.loadLibrary("fabricjni")

0 commit comments

Comments
 (0)