Unverified Commit c61dc2a5 authored by Gray Mackall's avatar Gray Mackall Committed by GitHub

Format all kotlin according to ktlint (#143390)

Entire pr generated with [ktlint](https://github.com/pinterest/ktlint) --format. First step before enabling linting as part of presubmit for kotlin changes.
parent dc1f9f18
...@@ -2,5 +2,4 @@ package com.example.a11y_assessments ...@@ -2,5 +2,4 @@ package com.example.a11y_assessments
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() { class MainActivity : FlutterActivity()
}
...@@ -4,18 +4,13 @@ ...@@ -4,18 +4,13 @@
package dev.flutter.multipleflutters package dev.flutter.multipleflutters
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle import android.os.Bundle
import android.view.View
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TextView
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import io.flutter.FlutterInjector import io.flutter.FlutterInjector
import io.flutter.embedding.android.FlutterFragment import io.flutter.embedding.android.FlutterFragment
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.engine.FlutterEngineCache import io.flutter.embedding.engine.FlutterEngineCache
import io.flutter.embedding.engine.dart.DartExecutor import io.flutter.embedding.engine.dart.DartExecutor
...@@ -25,10 +20,11 @@ class MainActivity : FragmentActivity() { ...@@ -25,10 +20,11 @@ class MainActivity : FragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
val root = LinearLayout(this) val root = LinearLayout(this)
root.layoutParams = LinearLayout.LayoutParams( root.layoutParams =
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT LinearLayout.LayoutParams.MATCH_PARENT,
) LinearLayout.LayoutParams.MATCH_PARENT,
)
root.orientation = LinearLayout.VERTICAL root.orientation = LinearLayout.VERTICAL
root.weightSum = numberOfFlutters.toFloat() root.weightSum = numberOfFlutters.toFloat()
...@@ -39,21 +35,24 @@ class MainActivity : FragmentActivity() { ...@@ -39,21 +35,24 @@ class MainActivity : FragmentActivity() {
val app = applicationContext as App val app = applicationContext as App
val dartEntrypoint = val dartEntrypoint =
DartExecutor.DartEntrypoint( DartExecutor.DartEntrypoint(
FlutterInjector.instance().flutterLoader().findAppBundlePath(), "main" FlutterInjector.instance().flutterLoader().findAppBundlePath(),
"main",
) )
val engines = generateSequence(0) { it + 1 } val engines =
.take(numberOfFlutters) generateSequence(0) { it + 1 }
.map { app.engines.createAndRunEngine(this, dartEntrypoint) } .take(numberOfFlutters)
.toList() .map { app.engines.createAndRunEngine(this, dartEntrypoint) }
.toList()
for (i in 0 until numberOfFlutters) { for (i in 0 until numberOfFlutters) {
val flutterContainer = FrameLayout(this) val flutterContainer = FrameLayout(this)
root.addView(flutterContainer) root.addView(flutterContainer)
flutterContainer.id = 12345 + i flutterContainer.id = 12345 + i
flutterContainer.layoutParams = LinearLayout.LayoutParams( flutterContainer.layoutParams =
FrameLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT,
1.0f FrameLayout.LayoutParams.MATCH_PARENT,
) 1.0f,
)
val engine = engines[i] val engine = engines[i]
FlutterEngineCache.getInstance().put(i.toString(), engine) FlutterEngineCache.getInstance().put(i.toString(), engine)
val flutterFragment = val flutterFragment =
...@@ -62,7 +61,7 @@ class MainActivity : FragmentActivity() { ...@@ -62,7 +61,7 @@ class MainActivity : FragmentActivity() {
.beginTransaction() .beginTransaction()
.add( .add(
12345 + i, 12345 + i,
flutterFragment flutterFragment,
) )
.commit() .commit()
} }
......
...@@ -11,28 +11,40 @@ import io.flutter.plugin.common.BinaryCodec ...@@ -11,28 +11,40 @@ import io.flutter.plugin.common.BinaryCodec
import io.flutter.plugin.common.StandardMessageCodec import io.flutter.plugin.common.StandardMessageCodec
import java.nio.ByteBuffer import java.nio.ByteBuffer
class MainActivity: FlutterActivity() { class MainActivity : FlutterActivity() {
// We allow for the caching of a response in the binary channel case since // We allow for the caching of a response in the binary channel case since
// the reply requires a direct buffer, but the input is not a direct buffer. // the reply requires a direct buffer, but the input is not a direct buffer.
// We can't directly send the input back to the reply currently. // We can't directly send the input back to the reply currently.
private var byteBufferCache : ByteBuffer? = null private var byteBufferCache: ByteBuffer? = null
override fun configureFlutterEngine(flutterEngine: FlutterEngine) { override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
val reset = BasicMessageChannel(flutterEngine.dartExecutor, "dev.flutter.echo.reset", StandardMessageCodec.INSTANCE) val reset = BasicMessageChannel(flutterEngine.dartExecutor, "dev.flutter.echo.reset", StandardMessageCodec.INSTANCE)
reset.setMessageHandler { message, reply -> run { reset.setMessageHandler { message, reply ->
byteBufferCache = null run {
} } byteBufferCache = null
val basicStandard = BasicMessageChannel(flutterEngine.dartExecutor, "dev.flutter.echo.basic.standard", StandardMessageCodec.INSTANCE) }
}
val basicStandard =
BasicMessageChannel(flutterEngine.dartExecutor, "dev.flutter.echo.basic.standard", StandardMessageCodec.INSTANCE)
basicStandard.setMessageHandler { message, reply -> reply.reply(message) } basicStandard.setMessageHandler { message, reply -> reply.reply(message) }
val basicBinary = BasicMessageChannel(flutterEngine.dartExecutor, "dev.flutter.echo.basic.binary", BinaryCodec.INSTANCE_DIRECT) val basicBinary = BasicMessageChannel(flutterEngine.dartExecutor, "dev.flutter.echo.basic.binary", BinaryCodec.INSTANCE_DIRECT)
basicBinary.setMessageHandler { message, reply -> run { basicBinary.setMessageHandler { message, reply ->
if (byteBufferCache == null) { run {
byteBufferCache = ByteBuffer.allocateDirect(message!!.capacity()) if (byteBufferCache == null) {
byteBufferCache!!.put(message) byteBufferCache = ByteBuffer.allocateDirect(message!!.capacity())
byteBufferCache!!.put(message)
}
reply.reply(byteBufferCache)
} }
reply.reply(byteBufferCache) }
} } val taskQueue = flutterEngine.dartExecutor.getBinaryMessenger().makeBackgroundTaskQueue()
val taskQueue = flutterEngine.dartExecutor.getBinaryMessenger().makeBackgroundTaskQueue(); val backgroundStandard =
val backgroundStandard = BasicMessageChannel(flutterEngine.dartExecutor, "dev.flutter.echo.background.standard", StandardMessageCodec.INSTANCE, taskQueue) BasicMessageChannel(
flutterEngine.dartExecutor,
"dev.flutter.echo.background.standard",
StandardMessageCodec.INSTANCE,
taskQueue,
)
backgroundStandard.setMessageHandler { message, reply -> reply.reply(message) } backgroundStandard.setMessageHandler { message, reply -> reply.reply(message) }
super.configureFlutterEngine(flutterEngine) super.configureFlutterEngine(flutterEngine)
} }
......
...@@ -2,7 +2,6 @@ package com.example.abstract_method_smoke_test ...@@ -2,7 +2,6 @@ package com.example.abstract_method_smoke_test
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color
import android.os.Bundle
import android.view.View import android.view.View
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import androidx.annotation.NonNull import androidx.annotation.NonNull
...@@ -30,25 +29,34 @@ class MainActivity : FlutterActivity() { ...@@ -30,25 +29,34 @@ class MainActivity : FlutterActivity() {
} }
} }
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { override fun configureFlutterEngine(
GeneratedPluginRegistrant.registerWith(flutterEngine); @NonNull flutterEngine: FlutterEngine,
) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
val shimPluginRegistry = ShimPluginRegistry(flutterEngine); val shimPluginRegistry = ShimPluginRegistry(flutterEngine)
shimPluginRegistry.registrarFor("com.example.abstract_method_smoke_test") shimPluginRegistry.registrarFor("com.example.abstract_method_smoke_test")
.platformViewRegistry() .platformViewRegistry()
.registerViewFactory("simple", object : PlatformViewFactory(StandardMessageCodec.INSTANCE) { .registerViewFactory(
override fun create(context: Context?, viewId: Int, args: Any?): PlatformView { "simple",
object : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
override fun create(
context: Context?,
viewId: Int,
args: Any?,
): PlatformView {
return SimplePlatformView(this@MainActivity) return SimplePlatformView(this@MainActivity)
} }
}) },
)
// Triggers the Android keyboard, which causes the resize of the Flutter view. // Triggers the Android keyboard, which causes the resize of the Flutter view.
// We need to wait for the app to complete. // We need to wait for the app to complete.
MethodChannel(flutterEngine.getDartExecutor(), "com.example.abstract_method_smoke_test") MethodChannel(flutterEngine.getDartExecutor(), "com.example.abstract_method_smoke_test")
.setMethodCallHandler { _, result -> .setMethodCallHandler { _, result ->
toggleInput() toggleInput()
result.success(null) result.success(null)
} }
} }
override fun onPause() { override fun onPause() {
......
package com.example.android_embedding_v2_smoke_test package com.example.android_embedding_v2_smoke_test
import androidx.annotation.NonNull; import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterActivity() { class MainActivity : FlutterActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { override fun configureFlutterEngine(
GeneratedPluginRegistrant.registerWith(flutterEngine); @NonNull flutterEngine: FlutterEngine,
) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
} }
} }
...@@ -2,5 +2,4 @@ package io.flutter.integration.deferred_components_test ...@@ -2,5 +2,4 @@ package io.flutter.integration.deferred_components_test
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() { class MainActivity : FlutterActivity()
}
...@@ -2,5 +2,4 @@ package com.example.non_nullable ...@@ -2,5 +2,4 @@ package com.example.non_nullable
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() { class MainActivity : FlutterActivity()
}
...@@ -2,5 +2,4 @@ package com.example.spell_check ...@@ -2,5 +2,4 @@ package com.example.spell_check
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() { class MainActivity : FlutterActivity()
}
...@@ -2,5 +2,4 @@ package dev.flutter.manual_tests ...@@ -2,5 +2,4 @@ package dev.flutter.manual_tests
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() { class MainActivity : FlutterActivity()
}
...@@ -2,5 +2,4 @@ package com.example.tracing_tests ...@@ -2,5 +2,4 @@ package com.example.tracing_tests
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() { class MainActivity : FlutterActivity()
}
...@@ -2,5 +2,4 @@ package dev.flutter.flutter_api_samples ...@@ -2,5 +2,4 @@ package dev.flutter.flutter_api_samples
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() { class MainActivity : FlutterActivity()
}
...@@ -24,7 +24,7 @@ subprojects { ...@@ -24,7 +24,7 @@ subprojects {
ignoredDependencies.add("io.flutter:*") ignoredDependencies.add("io.flutter:*")
lockFile = file("${rootProject.projectDir}/project-${project.name}.lockfile") lockFile = file("${rootProject.projectDir}/project-${project.name}.lockfile")
if (!project.hasProperty("local-engine-repo")) { if (!project.hasProperty("local-engine-repo")) {
lockAllConfigurations() lockAllConfigurations()
} }
} }
} }
......
...@@ -7,13 +7,14 @@ ...@@ -7,13 +7,14 @@
// See #141540. // See #141540.
pluginManagement { pluginManagement {
val flutterSdkPath = run { val flutterSdkPath =
val properties = java.util.Properties() run {
file("local.properties").inputStream().use { properties.load(it) } val properties = java.util.Properties()
val flutterSdkPath = properties.getProperty("flutter.sdk") file("local.properties").inputStream().use { properties.load(it) }
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } val flutterSdkPath = properties.getProperty("flutter.sdk")
flutterSdkPath require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
} flutterSdkPath
}
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
......
...@@ -7,7 +7,6 @@ plugins { ...@@ -7,7 +7,6 @@ plugins {
`groovy` `groovy`
} }
group = "dev.flutter.plugin" group = "dev.flutter.plugin"
version = "1.0.0" version = "1.0.0"
......
dependencyResolutionManagement { dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment