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
21ebee21
Commit
21ebee21
authored
Oct 31, 2019
by
yangwu.jia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复输入框的bug
parent
9c19498c
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
741 additions
and
13 deletions
+741
-13
android/src/main/java/com/idlefish/flutterboost/XAndroidKeyProcessor.java
.../java/com/idlefish/flutterboost/XAndroidKeyProcessor.java
+99
-0
android/src/main/java/com/idlefish/flutterboost/XFlutterView.java
...src/main/java/com/idlefish/flutterboost/XFlutterView.java
+18
-12
android/src/main/java/com/idlefish/flutterboost/XInputConnectionAdaptor.java
...va/com/idlefish/flutterboost/XInputConnectionAdaptor.java
+263
-0
android/src/main/java/com/idlefish/flutterboost/XTextInputPlugin.java
...main/java/com/idlefish/flutterboost/XTextInputPlugin.java
+356
-0
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
...rboost/containers/FlutterActivityAndFragmentDelegate.java
+1
-0
android/src/main/java/com/idlefish/flutterboost/containers/FlutterSplashView.java
...m/idlefish/flutterboost/containers/FlutterSplashView.java
+4
-1
No files found.
android/src/main/java/com/idlefish/flutterboost/XAndroidKeyProcessor.java
0 → 100644
View file @
21ebee21
package
com.idlefish.flutterboost
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
android.view.KeyCharacterMap
;
import
android.view.KeyEvent
;
import
io.flutter.embedding.engine.systemchannels.KeyEventChannel
;
import
io.flutter.plugin.editing.TextInputPlugin
;
public
class
XAndroidKeyProcessor
{
@NonNull
private
final
KeyEventChannel
keyEventChannel
;
@NonNull
private
final
XTextInputPlugin
textInputPlugin
;
private
int
combiningCharacter
;
public
XAndroidKeyProcessor
(
@NonNull
KeyEventChannel
keyEventChannel
,
@NonNull
XTextInputPlugin
textInputPlugin
)
{
this
.
keyEventChannel
=
keyEventChannel
;
this
.
textInputPlugin
=
textInputPlugin
;
}
public
void
onKeyUp
(
@NonNull
KeyEvent
keyEvent
)
{
Character
complexCharacter
=
applyCombiningCharacterToBaseCharacter
(
keyEvent
.
getUnicodeChar
());
keyEventChannel
.
keyUp
(
new
KeyEventChannel
.
FlutterKeyEvent
(
keyEvent
,
complexCharacter
)
);
}
public
void
onKeyDown
(
@NonNull
KeyEvent
keyEvent
)
{
if
(
textInputPlugin
.
getLastInputConnection
()
!=
null
&&
textInputPlugin
.
getInputMethodManager
().
isAcceptingText
())
{
textInputPlugin
.
getLastInputConnection
().
sendKeyEvent
(
keyEvent
);
}
Character
complexCharacter
=
applyCombiningCharacterToBaseCharacter
(
keyEvent
.
getUnicodeChar
());
keyEventChannel
.
keyDown
(
new
KeyEventChannel
.
FlutterKeyEvent
(
keyEvent
,
complexCharacter
)
);
}
/**
* Applies the given Unicode character in {@code newCharacterCodePoint} to a previously
* entered Unicode combining character and returns the combination of these characters
* if a combination exists.
* <p>
* This method mutates {@link #combiningCharacter} over time to combine characters.
* <p>
* One of the following things happens in this method:
* <ul>
* <li>If no previous {@link #combiningCharacter} exists and the {@code newCharacterCodePoint}
* is not a combining character, then {@code newCharacterCodePoint} is returned.</li>
* <li>If no previous {@link #combiningCharacter} exists and the {@code newCharacterCodePoint}
* is a combining character, then {@code newCharacterCodePoint} is saved as the
* {@link #combiningCharacter} and null is returned.</li>
* <li>If a previous {@link #combiningCharacter} exists and the {@code newCharacterCodePoint}
* is also a combining character, then the {@code newCharacterCodePoint} is combined with
* the existing {@link #combiningCharacter} and null is returned.</li>
* <li>If a previous {@link #combiningCharacter} exists and the {@code newCharacterCodePoint}
* is not a combining character, then the {@link #combiningCharacter} is applied to the
* regular {@code newCharacterCodePoint} and the resulting complex character is returned. The
* {@link #combiningCharacter} is cleared.</li>
* </ul>
* <p>
* The following reference explains the concept of a "combining character":
* https://en.wikipedia.org/wiki/Combining_character
*/
@Nullable
private
Character
applyCombiningCharacterToBaseCharacter
(
int
newCharacterCodePoint
)
{
if
(
newCharacterCodePoint
==
0
)
{
return
null
;
}
Character
complexCharacter
=
(
char
)
newCharacterCodePoint
;
boolean
isNewCodePointACombiningCharacter
=
(
newCharacterCodePoint
&
KeyCharacterMap
.
COMBINING_ACCENT
)
!=
0
;
if
(
isNewCodePointACombiningCharacter
)
{
// If a combining character was entered before, combine this one with that one.
int
plainCodePoint
=
newCharacterCodePoint
&
KeyCharacterMap
.
COMBINING_ACCENT_MASK
;
if
(
combiningCharacter
!=
0
)
{
combiningCharacter
=
KeyCharacterMap
.
getDeadChar
(
combiningCharacter
,
plainCodePoint
);
}
else
{
combiningCharacter
=
plainCodePoint
;
}
}
else
{
// The new character is a regular character. Apply combiningCharacter to it, if it exists.
if
(
combiningCharacter
!=
0
)
{
int
combinedChar
=
KeyCharacterMap
.
getDeadChar
(
combiningCharacter
,
newCharacterCodePoint
);
if
(
combinedChar
>
0
)
{
complexCharacter
=
(
char
)
combinedChar
;
}
combiningCharacter
=
0
;
}
}
return
complexCharacter
;
}
}
\ No newline at end of file
android/src/main/java/com/idlefish/flutterboost/XFlutterView.java
View file @
21ebee21
...
@@ -90,9 +90,9 @@ public class XFlutterView extends FrameLayout {
...
@@ -90,9 +90,9 @@ public class XFlutterView extends FrameLayout {
// These components essentially add some additional behavioral logic on top of
// These components essentially add some additional behavioral logic on top of
// existing, stateless system channels, e.g., KeyEventChannel, TextInputChannel, etc.
// existing, stateless system channels, e.g., KeyEventChannel, TextInputChannel, etc.
@Nullable
@Nullable
private
TextInputPlugin
textInputPlugin
;
private
X
TextInputPlugin
textInputPlugin
;
@Nullable
@Nullable
private
AndroidKeyProcessor
androidKeyProcessor
;
private
X
AndroidKeyProcessor
androidKeyProcessor
;
@Nullable
@Nullable
private
AndroidTouchProcessor
androidTouchProcessor
;
private
AndroidTouchProcessor
androidTouchProcessor
;
@Nullable
@Nullable
...
@@ -585,7 +585,7 @@ public class XFlutterView extends FrameLayout {
...
@@ -585,7 +585,7 @@ public class XFlutterView extends FrameLayout {
+
" to new engine."
);
+
" to new engine."
);
detachFromFlutterEngine
();
detachFromFlutterEngine
();
}
}
this
.
requestFocus
();
this
.
flutterEngine
=
flutterEngine
;
this
.
flutterEngine
=
flutterEngine
;
// Instruct our FlutterRenderer that we are now its designated RenderSurface.
// Instruct our FlutterRenderer that we are now its designated RenderSurface.
...
@@ -599,16 +599,21 @@ public class XFlutterView extends FrameLayout {
...
@@ -599,16 +599,21 @@ public class XFlutterView extends FrameLayout {
// 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
(
this
.
textInputPlugin
!=
null
){
this
.
textInputPlugin
.
destroy
();
resolveMemoryLeaks
();
if
(
textInputPlugin
==
null
){
textInputPlugin
=
new
XTextInputPlugin
(
this
,
flutterEngine
.
getTextInputChannel
(),
this
.
flutterEngine
.
getPlatformViewsController
()
);
}
}
this
.
textInputPlugin
=
new
TextInputPlugin
(
this
,
this
.
flutterEngine
.
getDartExecutor
(),
this
.
flutterEngine
.
getPlatformViewsController
());
textInputPlugin
.
setTextInputMethodHandler
();
textInputPlugin
.
getInputMethodManager
().
restartInput
(
this
);
this
.
androidKeyProcessor
=
new
AndroidKeyProcessor
(
this
.
androidKeyProcessor
=
new
X
AndroidKeyProcessor
(
this
.
flutterEngine
.
getKeyEventChannel
(),
this
.
flutterEngine
.
getKeyEventChannel
(),
textInputPlugin
textInputPlugin
);
);
...
@@ -687,9 +692,8 @@ public class XFlutterView extends FrameLayout {
...
@@ -687,9 +692,8 @@ 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
.
destroy
();
// resolveMemoryLeaks();
resolveMemoryLeaks
();
// 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.
FlutterRenderer
flutterRenderer
=
flutterEngine
.
getRenderer
();
FlutterRenderer
flutterRenderer
=
flutterEngine
.
getRenderer
();
// didRenderFirstFrame = false;
// didRenderFirstFrame = false;
...
@@ -697,7 +701,9 @@ public class XFlutterView extends FrameLayout {
...
@@ -697,7 +701,9 @@ public class XFlutterView extends FrameLayout {
flutterRenderer
.
detachFromRenderSurface
();
flutterRenderer
.
detachFromRenderSurface
();
flutterEngine
=
null
;
flutterEngine
=
null
;
}
}
public
void
release
(){
textInputPlugin
.
release
();
}
public
void
resolveMemoryLeaks
(){
public
void
resolveMemoryLeaks
(){
try
{
try
{
...
...
android/src/main/java/com/idlefish/flutterboost/XInputConnectionAdaptor.java
0 → 100644
View file @
21ebee21
This diff is collapsed.
Click to expand it.
android/src/main/java/com/idlefish/flutterboost/XTextInputPlugin.java
0 → 100644
View file @
21ebee21
This diff is collapsed.
Click to expand it.
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
View file @
21ebee21
...
@@ -226,6 +226,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContaine
...
@@ -226,6 +226,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContaine
flutterEngine
.
getActivityControlSurface
().
detachFromActivityForConfigChanges
();
flutterEngine
.
getActivityControlSurface
().
detachFromActivityForConfigChanges
();
}
}
flutterView
.
release
();
}
}
...
...
android/src/main/java/com/idlefish/flutterboost/containers/FlutterSplashView.java
View file @
21ebee21
...
@@ -54,7 +54,7 @@ public class FlutterSplashView extends FrameLayout {
...
@@ -54,7 +54,7 @@ public class FlutterSplashView extends FrameLayout {
public
void
onFlutterEngineDetachedFromFlutterView
()
{
public
void
onFlutterEngineDetachedFromFlutterView
()
{
}
}
};
};
int
i
=
0
;
@NonNull
@NonNull
private
final
OnFirstFrameRenderedListener
onFirstFrameRenderedListener
=
new
OnFirstFrameRenderedListener
()
{
private
final
OnFirstFrameRenderedListener
onFirstFrameRenderedListener
=
new
OnFirstFrameRenderedListener
()
{
@Override
@Override
...
@@ -291,6 +291,9 @@ public class FlutterSplashView extends FrameLayout {
...
@@ -291,6 +291,9 @@ public class FlutterSplashView extends FrameLayout {
}
}
}
}
public
void
onAttach
()
{
public
void
onAttach
()
{
Debuger
.
log
(
"BoostFlutterView onAttach"
);
Debuger
.
log
(
"BoostFlutterView onAttach"
);
...
...
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