Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Package Attributes | List of all members
io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView Class Reference
Inheritance diagram for io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView:

Public Member Functions

 FlutterMutatorView ( @NonNull Context context, float screenDensity, @Nullable AndroidTouchProcessor androidTouchProcessor)
 
 FlutterMutatorView (@NonNull Context context)
 
void setOnDescendantFocusChangeListener (@NonNull OnFocusChangeListener userFocusListener)
 
void unsetOnDescendantFocusChangeListener ()
 
void readyToDisplay ( @NonNull FlutterMutatorsStack mutatorsStack, int left, int top, int width, int height)
 
void draw (Canvas canvas)
 
void dispatchDraw (Canvas canvas)
 
boolean onInterceptTouchEvent (MotionEvent event)
 
boolean requestSendAccessibilityEvent (View child, AccessibilityEvent event)
 
boolean onTouchEvent (MotionEvent event)
 

Package Attributes

ViewTreeObserver.OnGlobalFocusChangeListener activeFocusListener
 

Detailed Description

A view that applies the io.flutter.embedding.engine.mutatorsstack.FlutterMutatorsStack to its children.

Definition at line 25 of file FlutterMutatorView.java.

Constructor & Destructor Documentation

◆ FlutterMutatorView() [1/2]

io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView.FlutterMutatorView ( @NonNull Context  context,
float  screenDensity,
@Nullable AndroidTouchProcessor  androidTouchProcessor 
)
inline

Initialize the FlutterMutatorView. Use this to set the screenDensity, which will be used to correct the final transform matrix.

Definition at line 39 of file FlutterMutatorView.java.

42 {
43 super(context, null);
44 this.screenDensity = screenDensity;
45 this.androidTouchProcessor = androidTouchProcessor;
46 }

◆ FlutterMutatorView() [2/2]

io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView.FlutterMutatorView ( @NonNull Context  context)
inline

Initialize the FlutterMutatorView.

Definition at line 49 of file FlutterMutatorView.java.

49 {
50 this(context, 1, /* androidTouchProcessor=*/ null);
51 }

Member Function Documentation

◆ dispatchDraw()

void io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView.dispatchDraw ( Canvas  canvas)
inline

Definition at line 126 of file FlutterMutatorView.java.

126 {
127 // Apply all the transforms on the child canvas.
128 canvas.save();
129
130 canvas.concat(getPlatformViewMatrix());
131 super.dispatchDraw(canvas);
132 canvas.restore();
133 }

◆ draw()

void io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView.draw ( Canvas  canvas)
inline

Definition at line 107 of file FlutterMutatorView.java.

107 {
108 // Apply all clippings on the parent canvas.
109 canvas.save();
110 for (Path path : mutatorsStack.getFinalClippingPaths()) {
111 // Reverse the current offset.
112 //
113 // The frame of this view includes the final offset of the bounding rect.
114 // We need to apply all the mutators to the view, which includes the mutation that leads to
115 // the final offset. We should reverse this final offset, both as a translate mutation and to
116 // all the clipping paths
117 Path pathCopy = new Path(path);
118 pathCopy.offset(-left, -top);
119 canvas.clipPath(pathCopy);
120 }
121 super.draw(canvas);
122 canvas.restore();
123 }
CanvasPath Path
Definition dart_ui.cc:58

◆ onInterceptTouchEvent()

boolean io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView.onInterceptTouchEvent ( MotionEvent  event)
inline

Intercept the events here and do not propagate them to the child platform views.

Definition at line 160 of file FlutterMutatorView.java.

160 {
161 return true;
162 }

◆ onTouchEvent()

boolean io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView.onTouchEvent ( MotionEvent  event)
inline

Definition at line 181 of file FlutterMutatorView.java.

181 {
182 if (androidTouchProcessor == null) {
183 return super.onTouchEvent(event);
184 }
185
186 final Matrix screenMatrix = new Matrix();
187
188 switch (event.getAction()) {
189 case MotionEvent.ACTION_DOWN:
190 prevLeft = left;
191 prevTop = top;
192 screenMatrix.postTranslate(left, top);
193 break;
194 case MotionEvent.ACTION_MOVE:
195 // While the view is dragged, use the left and top positions as
196 // they were at the moment the touch event fired.
197 screenMatrix.postTranslate(prevLeft, prevTop);
198 prevLeft = left;
199 prevTop = top;
200 break;
201 case MotionEvent.ACTION_UP:
202 default:
203 screenMatrix.postTranslate(left, top);
204 break;
205 }
206 return androidTouchProcessor.onTouchEvent(event, screenMatrix);
207 }
FlKeyEvent * event

◆ readyToDisplay()

void io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView.readyToDisplay ( @NonNull FlutterMutatorsStack  mutatorsStack,
int  left,
int  top,
int  width,
int  height 
)
inline

Pass the necessary parameters to the view so it can apply correct mutations to its children.

Definition at line 94 of file FlutterMutatorView.java.

95 {
96 this.mutatorsStack = mutatorsStack;
97 this.left = left;
98 this.top = top;
99 FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(width, height);
100 layoutParams.leftMargin = left;
101 layoutParams.topMargin = top;
102 setLayoutParams(layoutParams);
103 setWillNotDraw(false);
104 }
int32_t height
int32_t width

◆ requestSendAccessibilityEvent()

boolean io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView.requestSendAccessibilityEvent ( View  child,
AccessibilityEvent  event 
)
inline

Definition at line 165 of file FlutterMutatorView.java.

165 {
166 final View embeddedView = getChildAt(0);
167 if (embeddedView != null
168 && embeddedView.getImportantForAccessibility()
169 == View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS) {
170 return false;
171 }
172 // Forward the request only if the embedded view is in the Flutter accessibility tree.
173 // The embedded view may be ignored when the framework doesn't populate a SemanticNode
174 // for the current platform view.
175 // See AccessibilityBridge for more.
176 return super.requestSendAccessibilityEvent(child, event);
177 }

◆ setOnDescendantFocusChangeListener()

void io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView.setOnDescendantFocusChangeListener ( @NonNull OnFocusChangeListener  userFocusListener)
inline

Sets a focus change listener that notifies when the current view or any of its descendant views have received focus.

If there's an active focus listener, it will first remove the current listener, and then add the new one.

Parameters
userFocusListenerA user provided focus listener.

Definition at line 64 of file FlutterMutatorView.java.

64 {
66
67 final View mutatorView = this;
68 final ViewTreeObserver observer = getViewTreeObserver();
69 if (observer.isAlive() && activeFocusListener == null) {
71 new ViewTreeObserver.OnGlobalFocusChangeListener() {
72 @Override
73 public void onGlobalFocusChanged(View oldFocus, View newFocus) {
74 userFocusListener.onFocusChange(mutatorView, ViewUtils.childHasFocus(mutatorView));
75 }
76 };
77 observer.addOnGlobalFocusChangeListener(activeFocusListener);
78 }
79 }
ViewTreeObserver.OnGlobalFocusChangeListener activeFocusListener

◆ unsetOnDescendantFocusChangeListener()

void io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView.unsetOnDescendantFocusChangeListener ( )
inline

Unsets any active focus listener.

Definition at line 82 of file FlutterMutatorView.java.

82 {
83 final ViewTreeObserver observer = getViewTreeObserver();
84 if (observer.isAlive() && activeFocusListener != null) {
85 final ViewTreeObserver.OnGlobalFocusChangeListener currFocusListener = activeFocusListener;
87 observer.removeOnGlobalFocusChangeListener(currFocusListener);
88 }
89 }

Member Data Documentation

◆ activeFocusListener

ViewTreeObserver.OnGlobalFocusChangeListener io.flutter.embedding.engine.mutatorsstack.FlutterMutatorView.activeFocusListener
package

Definition at line 53 of file FlutterMutatorView.java.


The documentation for this class was generated from the following file: