Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
[infra_ui][keyboard] Change android plugin to java
Jaylen Bianb227a19c59d0
diff --git a/app_flowy/packages/flowy_infra_ui/android/build.gradle b/app_flowy/packages/flowy_infra_ui/android/build.gradleindex f1e1c9e76e..ab675678b5 100644--- a/app_flowy/packages/flowy_infra_ui/android/build.gradle+++ b/app_flowy/packages/flowy_infra_ui/android/build.gradle@@ -1,8 +1,7 @@group 'com.example.flowy_infra_ui'-version '1.0-SNAPSHOT'+version '1.0'buildscript {- ext.kotlin_version = '1.3.50'repositories {google()mavenCentral()@@ -10,7 +9,6 @@ buildscript {dependencies {classpath 'com.android.tools.build:gradle:4.1.0'- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"}}@@ -22,7 +20,6 @@ rootProject.allprojects {}apply plugin: 'com.android.library'-apply plugin: 'kotlin-android'android {compileSdkVersion 30@@ -32,19 +29,7 @@ android {targetCompatibility JavaVersion.VERSION_1_8}- kotlinOptions {- jvmTarget = '1.8'- }-- sourceSets {- main.java.srcDirs += 'src/main/kotlin'- }-defaultConfig {minSdkVersion 16}}--dependencies {- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"-}diff --git a/app_flowy/packages/flowy_infra_ui/android/src/main/java/com/example/flowy_infra_ui/FlowyInfraUiPlugin.java b/app_flowy/packages/flowy_infra_ui/android/src/main/java/com/example/flowy_infra_ui/FlowyInfraUiPlugin.javanew file mode 100644index 0000000000..9211fe6f4c--- /dev/null+++ b/app_flowy/packages/flowy_infra_ui/android/src/main/java/com/example/flowy_infra_ui/FlowyInfraUiPlugin.java@@ -0,0 +1,38 @@+package com.example.flowy_infra_ui;++import androidx.annotation.NonNull;++import io.flutter.embedding.engine.plugins.FlutterPlugin;+import io.flutter.plugin.common.MethodCall;+import io.flutter.plugin.common.MethodChannel;+import io.flutter.plugin.common.MethodChannel.MethodCallHandler;+import io.flutter.plugin.common.MethodChannel.Result;++/** FlowyInfraUiPlugin */+public class FlowyInfraUiPlugin implements FlutterPlugin, MethodCallHandler {+ /// The MethodChannel that will the communication between Flutter and native Android+ ///+ /// This local reference serves to register the plugin with the Flutter Engine and unregister it+ /// when the Flutter Engine is detached from the Activity+ private MethodChannel channel;++ @Override+ public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {+ channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "flowy_infra_ui");+ channel.setMethodCallHandler(this);+ }++ @Override+ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {+ if (call.method.equals("getPlatformVersion")) {+ result.success("Android " + android.os.Build.VERSION.RELEASE);+ } else {+ result.notImplemented();+ }+ }++ @Override+ public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {+ channel.setMethodCallHandler(null);+ }+}diff --git a/app_flowy/packages/flowy_infra_ui/android/src/main/kotlin/com/example/flowy_infra_ui/FlowyInfraUiPlugin.kt b/app_flowy/packages/flowy_infra_ui/android/src/main/kotlin/com/example/flowy_infra_ui/FlowyInfraUiPlugin.ktdeleted file mode 100644index 5d98dd8f10..0000000000--- a/app_flowy/packages/flowy_infra_ui/android/src/main/kotlin/com/example/flowy_infra_ui/FlowyInfraUiPlugin.kt+++ /dev/null@@ -1,35 +0,0 @@-package com.example.flowy_infra_ui--import androidx.annotation.NonNull--import io.flutter.embedding.engine.plugins.FlutterPlugin-import io.flutter.plugin.common.MethodCall-import io.flutter.plugin.common.MethodChannel-import io.flutter.plugin.common.MethodChannel.MethodCallHandler-import io.flutter.plugin.common.MethodChannel.Result--/** FlowyInfraUiPlugin */-class FlowyInfraUiPlugin: FlutterPlugin, MethodCallHandler {- /// The MethodChannel that will the communication between Flutter and native Android- ///- /// This local reference serves to register the plugin with the Flutter Engine and unregister it- /// when the Flutter Engine is detached from the Activity- private lateinit var channel : MethodChannel-- override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {- channel = MethodChannel(flutterPluginBinding.binaryMessenger, "flowy_infra_ui")- channel.setMethodCallHandler(this)- }-- override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {- if (call.method == "getPlatformVersion") {- result.success("Android ${android.os.Build.VERSION.RELEASE}")- } else {- result.notImplemented()- }- }-- override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {- channel.setMethodCallHandler(null)- }-}diff --git a/app_flowy/packages/flowy_infra_ui/example/android/app/src/main/java/com/example/flowy_infra_ui_example/MainActivity.java b/app_flowy/packages/flowy_infra_ui/example/android/app/src/main/java/com/example/flowy_infra_ui_example/MainActivity.javanew file mode 100644index 0000000000..5f08c1b321--- /dev/null+++ b/app_flowy/packages/flowy_infra_ui/example/android/app/src/main/java/com/example/flowy_infra_ui_example/MainActivity.java@@ -0,0 +1,6 @@+package com.example.flowy_infra_ui_example;++import io.flutter.embedding.android.FlutterActivity;++public class MainActivity extends FlutterActivity {+}