Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flutter_boost_1.22.4
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢冠章
flutter_boost_1.22.4
Commits
676d14dc
You need to sign in or sign up before continuing.
Commit
676d14dc
authored
Sep 18, 2019
by
yangwu.jia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix textfield bug
parent
35811132
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
11 deletions
+22
-11
android/src/main/java/com/idlefish/flutterboost/XFlutterView.java
...src/main/java/com/idlefish/flutterboost/XFlutterView.java
+14
-7
android/src/main/java/com/idlefish/flutterboost/XTextInputPlugin.java
...main/java/com/idlefish/flutterboost/XTextInputPlugin.java
+8
-4
No files found.
android/src/main/java/com/idlefish/flutterboost/XFlutterView.java
View file @
676d14dc
package
com.idlefish.flutterboost
;
package
com.idlefish.flutterboost
;
import
android.annotation.TargetApi
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.res.Configuration
;
import
android.content.res.Configuration
;
import
android.graphics.Rect
;
import
android.graphics.Rect
;
...
@@ -34,6 +35,7 @@ import io.flutter.embedding.engine.FlutterEngine;
...
@@ -34,6 +35,7 @@ import io.flutter.embedding.engine.FlutterEngine;
import
io.flutter.embedding.engine.renderer.FlutterRenderer
;
import
io.flutter.embedding.engine.renderer.FlutterRenderer
;
import
io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener
;
import
io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener
;
import
io.flutter.plugin.editing.TextInputPlugin
;
import
io.flutter.plugin.editing.TextInputPlugin
;
import
io.flutter.plugin.platform.PlatformPlugin
;
import
io.flutter.view.AccessibilityBridge
;
import
io.flutter.view.AccessibilityBridge
;
public
class
XFlutterView
extends
FrameLayout
{
public
class
XFlutterView
extends
FrameLayout
{
...
@@ -430,6 +432,7 @@ public class XFlutterView extends FrameLayout {
...
@@ -430,6 +432,7 @@ public class XFlutterView extends FrameLayout {
* {@link FlutterEngine}.
* {@link FlutterEngine}.
*/
*/
public
void
attachToFlutterEngine
(
@NonNull
FlutterEngine
flutterEngine
)
{
public
void
attachToFlutterEngine
(
@NonNull
FlutterEngine
flutterEngine
)
{
Log
.
d
(
TAG
,
"attachToFlutterEngine()"
);
Log
.
d
(
TAG
,
"attachToFlutterEngine()"
);
if
(
isAttachedToFlutterEngine
())
{
if
(
isAttachedToFlutterEngine
())
{
if
(
flutterEngine
==
this
.
flutterEngine
)
{
if
(
flutterEngine
==
this
.
flutterEngine
)
{
...
@@ -447,14 +450,18 @@ public class XFlutterView extends FrameLayout {
...
@@ -447,14 +450,18 @@ public class XFlutterView extends FrameLayout {
// Instruct our FlutterRenderer that we are now its designated RenderSurface.
// Instruct our FlutterRenderer that we are now its designated RenderSurface.
this
.
flutterEngine
.
getRenderer
().
attachToRenderSurface
(
renderSurface
);
this
.
flutterEngine
.
getRenderer
().
attachToRenderSurface
(
renderSurface
);
// Initialize various components that know how to process Android View I/O
// Initialize various components that know how to process Android View I/O
// in a way that Flutter understands.
// in a way that Flutter understands.
if
(
textInputPlugin
==
null
){
textInputPlugin
=
new
XTextInputPlugin
(
textInputPlugin
=
new
XTextInputPlugin
(
this
,
this
,
this
.
flutterEngine
.
getDartExecutor
()
flutterEngine
.
getTextInputChannel
()
);
);
}
textInputPlugin
.
setTextInputMethodHandler
();
textInputPlugin
.
getInputMethodManager
().
restartInput
(
this
);
androidKeyProcessor
=
new
XAndroidKeyProcessor
(
androidKeyProcessor
=
new
XAndroidKeyProcessor
(
this
.
flutterEngine
.
getKeyEventChannel
(),
this
.
flutterEngine
.
getKeyEventChannel
(),
textInputPlugin
textInputPlugin
...
@@ -479,7 +486,6 @@ public class XFlutterView extends FrameLayout {
...
@@ -479,7 +486,6 @@ public class XFlutterView extends FrameLayout {
accessibilityBridge
.
isAccessibilityEnabled
(),
accessibilityBridge
.
isAccessibilityEnabled
(),
accessibilityBridge
.
isTouchExplorationEnabled
()
accessibilityBridge
.
isTouchExplorationEnabled
()
);
);
textInputPlugin
.
getInputMethodManager
().
restartInput
(
this
);
}
}
...
@@ -527,8 +533,9 @@ public class XFlutterView extends FrameLayout {
...
@@ -527,8 +533,9 @@ public class XFlutterView extends FrameLayout {
// now that the engine is detached. The new InputConnection will be null, which
// now that the engine is detached. The new InputConnection will be null, which
// signifies that this View does not process input (until a new engine is attached).
// signifies that this View does not process input (until a new engine is attached).
// TODO(mattcarroll): once this is proven to work, move this line ot TextInputPlugin
// TODO(mattcarroll): once this is proven to work, move this line ot TextInputPlugin
textInputPlugin
.
getInputMethodManager
().
restartInput
(
this
);
//
textInputPlugin.getInputMethodManager().restartInput(this);
// Instruct our FlutterRenderer that we are no longer interested in being its RenderSurface.
// Instruct our FlutterRenderer that we are no longer interested in being its RenderSurface.
// this.textInputPlugin.getInputMethodManager().restartInput(this);
flutterEngine
.
getRenderer
().
detachFromRenderSurface
();
flutterEngine
.
getRenderer
().
detachFromRenderSurface
();
flutterEngine
=
null
;
flutterEngine
=
null
;
...
...
android/src/main/java/com/idlefish/flutterboost/XTextInputPlugin.java
View file @
676d14dc
...
@@ -24,7 +24,6 @@ public class XTextInputPlugin {
...
@@ -24,7 +24,6 @@ public class XTextInputPlugin {
@NonNull
@NonNull
private
final
InputMethodManager
mImm
;
private
final
InputMethodManager
mImm
;
@NonNull
@NonNull
private
final
TextInputChannel
textInputChannel
;
private
int
mClient
=
0
;
private
int
mClient
=
0
;
@Nullable
@Nullable
private
TextInputChannel
.
Configuration
configuration
;
private
TextInputChannel
.
Configuration
configuration
;
...
@@ -33,13 +32,17 @@ public class XTextInputPlugin {
...
@@ -33,13 +32,17 @@ public class XTextInputPlugin {
private
boolean
mRestartInputPending
;
private
boolean
mRestartInputPending
;
@Nullable
@Nullable
private
InputConnection
lastInputConnection
;
private
InputConnection
lastInputConnection
;
private
TextInputChannel
textInputChannel
;
public
XTextInputPlugin
(
View
view
,
@NonNull
DartExecutor
dartExecutor
)
{
public
XTextInputPlugin
(
View
view
,
TextInputChannel
mTextInputChannel
)
{
mView
=
view
;
mView
=
view
;
mImm
=
(
InputMethodManager
)
view
.
getContext
().
getSystemService
(
mImm
=
(
InputMethodManager
)
view
.
getContext
().
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
Context
.
INPUT_METHOD_SERVICE
);
textInputChannel
=
mTextInputChannel
;
}
textInputChannel
=
new
TextInputChannel
(
dartExecutor
);
public
void
setTextInputMethodHandler
(
){
textInputChannel
.
setTextInputMethodHandler
(
new
TextInputChannel
.
TextInputMethodHandler
()
{
textInputChannel
.
setTextInputMethodHandler
(
new
TextInputChannel
.
TextInputMethodHandler
()
{
@Override
@Override
public
void
show
()
{
public
void
show
()
{
...
@@ -173,6 +176,7 @@ public class XTextInputPlugin {
...
@@ -173,6 +176,7 @@ public class XTextInputPlugin {
}
}
private
void
showTextInput
(
View
view
)
{
private
void
showTextInput
(
View
view
)
{
if
(
view
==
null
)
return
;
view
.
requestFocus
();
view
.
requestFocus
();
mImm
.
showSoftInput
(
view
,
0
);
mImm
.
showSoftInput
(
view
,
0
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment