diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
index a6c6bf96..d99d7807 100644
--- a/android/src/main/AndroidManifest.xml
+++ b/android/src/main/AndroidManifest.xml
@@ -1,6 +1,8 @@
-
+
+
+
diff --git a/android/src/main/java/com/idlefish/flutterboost/XAndroidKeyProcessor.java b/android/src/main/java/com/idlefish/flutterboost/XAndroidKeyProcessor.java
index 260e9087..6e42f78f 100644
--- a/android/src/main/java/com/idlefish/flutterboost/XAndroidKeyProcessor.java
+++ b/android/src/main/java/com/idlefish/flutterboost/XAndroidKeyProcessor.java
@@ -1,12 +1,12 @@
package com.idlefish.flutterboost;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
import io.flutter.embedding.engine.systemchannels.KeyEventChannel;
-import io.flutter.plugin.editing.TextInputPlugin;
public class XAndroidKeyProcessor {
@NonNull
@@ -24,9 +24,11 @@ public XAndroidKeyProcessor(@NonNull KeyEventChannel keyEventChannel, @NonNull X
public void onKeyUp(@NonNull KeyEvent keyEvent) {
Character complexCharacter = applyCombiningCharacterToBaseCharacter(keyEvent.getUnicodeChar());
- keyEventChannel.keyUp(
- new KeyEventChannel.FlutterKeyEvent(keyEvent, complexCharacter)
- );
+ if(complexCharacter != null){
+ keyEventChannel.keyUp(
+ new KeyEventChannel.FlutterKeyEvent(keyEvent, complexCharacter)
+ );
+ }
}
public void onKeyDown(@NonNull KeyEvent keyEvent) {
@@ -36,9 +38,11 @@ public void onKeyDown(@NonNull KeyEvent keyEvent) {
}
Character complexCharacter = applyCombiningCharacterToBaseCharacter(keyEvent.getUnicodeChar());
- keyEventChannel.keyDown(
- new KeyEventChannel.FlutterKeyEvent(keyEvent, complexCharacter)
- );
+ if(complexCharacter != null){
+ keyEventChannel.keyDown(
+ new KeyEventChannel.FlutterKeyEvent(keyEvent, complexCharacter)
+ );
+ }
}
/**
diff --git a/android/src/main/java/com/idlefish/flutterboost/XFlutterView.java b/android/src/main/java/com/idlefish/flutterboost/XFlutterView.java
index 7eb66415..4149ec8d 100644
--- a/android/src/main/java/com/idlefish/flutterboost/XFlutterView.java
+++ b/android/src/main/java/com/idlefish/flutterboost/XFlutterView.java
@@ -1,18 +1,12 @@
package com.idlefish.flutterboost;
-import android.annotation.TargetApi;
import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Configuration;
-//import android.graphics.Insets;
import android.graphics.Rect;
import android.os.Build;
import android.os.LocaleList;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.annotation.RequiresApi;
-import androidx.annotation.VisibleForTesting;
-import androidx.core.view.ViewCompat;
import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.view.KeyEvent;
@@ -25,7 +19,11 @@
import android.view.inputmethod.InputConnection;
import android.widget.FrameLayout;
-import java.lang.reflect.Field;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
+import androidx.annotation.VisibleForTesting;
+
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -33,7 +31,9 @@
import java.util.Set;
import io.flutter.Log;
-import io.flutter.embedding.android.*;
+import io.flutter.embedding.android.AndroidTouchProcessor;
+import io.flutter.embedding.android.FlutterSurfaceView;
+import io.flutter.embedding.android.FlutterView;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.renderer.FlutterRenderer;
import io.flutter.embedding.engine.renderer.FlutterUiDisplayListener;
@@ -42,6 +42,8 @@
import io.flutter.plugin.platform.PlatformViewsController;
import io.flutter.view.AccessibilityBridge;
+//import android.graphics.Insets;
+
public class XFlutterView extends FrameLayout {
private static final String TAG = "FlutterView";
@@ -581,7 +583,7 @@ public void attachToFlutterEngine(
textInputPlugin
);
- this.androidTouchProcessor = new AndroidTouchProcessor(this.flutterEngine.getRenderer());
+ this.androidTouchProcessor = new AndroidTouchProcessor(this.flutterEngine.getRenderer(),true);
this.accessibilityBridge = new AccessibilityBridge(
this,
flutterEngine.getAccessibilityChannel(),
diff --git a/android/src/main/java/com/idlefish/flutterboost/XPlatformPlugin.java b/android/src/main/java/com/idlefish/flutterboost/XPlatformPlugin.java
index debc2e41..fc1b11fc 100644
--- a/android/src/main/java/com/idlefish/flutterboost/XPlatformPlugin.java
+++ b/android/src/main/java/com/idlefish/flutterboost/XPlatformPlugin.java
@@ -7,19 +7,17 @@
import android.content.Context;
import android.graphics.Rect;
import android.os.Build;
-
-
import android.view.HapticFeedbackConstants;
import android.view.SoundEffectConstants;
import android.view.View;
import android.view.Window;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
import java.util.ArrayList;
import java.util.List;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
import io.flutter.embedding.engine.systemchannels.PlatformChannel;
public class XPlatformPlugin {
@@ -84,15 +82,24 @@ public void setClipboardData(@NonNull String text) {
XPlatformPlugin.this.setClipboardData(text);
}
+ /**
+ * The Flutter application would like to know if the clipboard currently contains a string that
+ * can be pasted.
+ */
@Override
- public List getSystemGestureExclusionRects() {
- return XPlatformPlugin.this.getSystemGestureExclusionRects();
+ public boolean clipboardHasStrings() {
+ return false;
}
- @Override
- public void setSystemGestureExclusionRects(@NonNull ArrayList rects) {
- XPlatformPlugin.this.setSystemGestureExclusionRects(rects);
- }
+// @Override
+// public List getSystemGestureExclusionRects() {
+// return XPlatformPlugin.this.getSystemGestureExclusionRects();
+// }
+
+// @Override
+// public void setSystemGestureExclusionRects(@NonNull ArrayList rects) {
+// XPlatformPlugin.this.setSystemGestureExclusionRects(rects);
+// }
};
public XPlatformPlugin(PlatformChannel platformChannel) {
diff --git a/android/src/main/java/com/idlefish/flutterboost/XTextInputPlugin.java b/android/src/main/java/com/idlefish/flutterboost/XTextInputPlugin.java
index 016d410c..75287fe2 100644
--- a/android/src/main/java/com/idlefish/flutterboost/XTextInputPlugin.java
+++ b/android/src/main/java/com/idlefish/flutterboost/XTextInputPlugin.java
@@ -7,6 +7,7 @@
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
+import android.os.Bundle;
import android.provider.Settings;
import android.text.Editable;
@@ -97,6 +98,16 @@ public void hide() {
hideTextInput(mView);
}
+ @Override
+ public void requestAutofill() {
+
+ }
+
+ @Override
+ public void finishAutofillContext(boolean shouldSave) {
+
+ }
+
@Override
public void setClient(int textInputClientId, TextInputChannel.Configuration configuration) {
setTextInputClient(textInputClientId, configuration);
@@ -107,6 +118,11 @@ public void setPlatformViewClient(int platformViewId) {
setPlatformViewTextInputClient(platformViewId);
}
+ @Override
+ public void setEditableSizeAndTransform(double width, double height, double[] transform) {
+
+ }
+
@Override
public void setEditingState(TextInputChannel.TextEditState editingState) {
setTextInputEditingState(mView, editingState);
@@ -116,6 +132,11 @@ public void setEditingState(TextInputChannel.TextEditState editingState) {
public void clearClient() {
clearTextInputClient();
}
+
+ @Override
+ public void sendAppPrivateCommand(String action, Bundle data) {
+
+ }
});
restartAlwaysRequired = isRestartAlwaysRequired();
diff --git a/android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterActivity.java b/android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterActivity.java
index bcbaf148..0828d2fc 100644
--- a/android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterActivity.java
+++ b/android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterActivity.java
@@ -2,9 +2,6 @@
import android.app.Activity;
-import androidx.lifecycle.Lifecycle;
-import androidx.lifecycle.LifecycleOwner;
-import androidx.lifecycle.LifecycleRegistry;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@@ -15,13 +12,26 @@
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.ImageView;
+
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import android.view.*;
-import android.widget.*;
+import androidx.fragment.app.FragmentActivity;
+import androidx.lifecycle.Lifecycle;
+import androidx.lifecycle.LifecycleOwner;
+import androidx.lifecycle.LifecycleRegistry;
+
import com.idlefish.flutterboost.FlutterBoost;
import com.idlefish.flutterboost.XFlutterView;
import com.idlefish.flutterboost.XPlatformPlugin;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
import io.flutter.Log;
import io.flutter.embedding.android.DrawableSplashScreen;
import io.flutter.embedding.android.FlutterView;
@@ -30,11 +40,7 @@
import io.flutter.embedding.engine.FlutterShellArgs;
import io.flutter.plugin.platform.PlatformPlugin;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-public class BoostFlutterActivity extends Activity
+public class BoostFlutterActivity extends FragmentActivity
implements FlutterActivityAndFragmentDelegate.Host,
LifecycleOwner {
@@ -130,13 +136,13 @@ public void setMap(Map map) {
private LifecycleRegistry lifecycle;
public BoostFlutterActivity() {
- lifecycle = new LifecycleRegistry(this);
+// lifecycle = new LifecycleRegistry(this);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
switchLaunchThemeForNormalTheme();
-
+ getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
super.onCreate(savedInstanceState);
lifecycle.handleLifecycleEvent(Lifecycle.Event.ON_CREATE);
@@ -284,11 +290,12 @@ protected void onDestroy() {
super.onDestroy();
delegate.onDestroyView();
delegate.onDetach();
-// lifecycle.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
+ lifecycle.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode,resultCode,data);
delegate.onActivityResult(requestCode, resultCode, data);
}
@@ -353,6 +360,9 @@ public Activity getActivity() {
@Override
@NonNull
public Lifecycle getLifecycle() {
+ if (lifecycle == null) {
+ lifecycle = new LifecycleRegistry(this);
+ }
return lifecycle;
}
@@ -478,7 +488,7 @@ public String getContainerUrl() {
}
@Override
- public Map getContainerUrlParams() {
+ public Map getContainerUrlParams() {
if (getIntent().hasExtra(EXTRA_PARAMS)) {
SerializableMap serializableMap = (SerializableMap) getIntent().getSerializableExtra(EXTRA_PARAMS);
@@ -503,6 +513,4 @@ public enum BackgroundMode {
*/
transparent
}
-
-
}