Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Attributes | Package Functions | Package Attributes | List of all members
io.flutter.plugin.platform.PlatformPlugin Class Reference

Classes

interface  PlatformPluginDelegate
 

Public Member Functions

 PlatformPlugin (@NonNull Activity activity, @NonNull PlatformChannel platformChannel)
 
 PlatformPlugin ( @NonNull Activity activity, @NonNull PlatformChannel platformChannel, @Nullable PlatformPluginDelegate delegate)
 
void destroy ()
 
void updateSystemUiOverlays ()
 

Static Public Attributes

static final int DEFAULT_SYSTEM_UI
 

Package Functions

void vibrateHapticFeedback ( @NonNull PlatformChannel.HapticFeedbackType feedbackType)
 

Package Attributes

final PlatformChannel.PlatformMessageHandler mPlatformMessageHandler
 

Detailed Description

Android implementation of the platform plugin.

Definition at line 36 of file PlatformPlugin.java.

Constructor & Destructor Documentation

◆ PlatformPlugin() [1/2]

io.flutter.plugin.platform.PlatformPlugin.PlatformPlugin ( @NonNull Activity  activity,
@NonNull PlatformChannel  platformChannel 
)
inline

Definition at line 158 of file PlatformPlugin.java.

158 {
159 this(activity, platformChannel, null);
160 }

◆ PlatformPlugin() [2/2]

io.flutter.plugin.platform.PlatformPlugin.PlatformPlugin ( @NonNull Activity  activity,
@NonNull PlatformChannel  platformChannel,
@Nullable PlatformPluginDelegate  delegate 
)
inline

Definition at line 162 of file PlatformPlugin.java.

165 {
166 this.activity = activity;
167 this.platformChannel = platformChannel;
168 this.platformChannel.setPlatformMessageHandler(mPlatformMessageHandler);
169 this.platformPluginDelegate = delegate;
170
171 mEnabledOverlays = DEFAULT_SYSTEM_UI;
172 }
final PlatformChannel.PlatformMessageHandler mPlatformMessageHandler

Member Function Documentation

◆ destroy()

void io.flutter.plugin.platform.PlatformPlugin.destroy ( )
inline

Releases all resources held by this PlatformPlugin.

Do not invoke any methods on a PlatformPlugin after invoking this method.

Definition at line 179 of file PlatformPlugin.java.

179 {
180 this.platformChannel.setPlatformMessageHandler(null);
181 }

◆ updateSystemUiOverlays()

void io.flutter.plugin.platform.PlatformPlugin.updateSystemUiOverlays ( )
inline

Refreshes Android's window system UI (AKA system chrome) to match Flutter's desired PlatformChannel.SystemChromeStyle.

Updating the system UI Overlays is accomplished by altering the decor view of the Window associated with the android.app.Activity that was provided to this
PlatformPlugin
.

Definition at line 372 of file PlatformPlugin.java.

372 {
373 activity.getWindow().getDecorView().setSystemUiVisibility(mEnabledOverlays);
374 if (currentTheme != null) {
375 setSystemChromeSystemUIOverlayStyle(currentTheme);
376 }
377 }

◆ vibrateHapticFeedback()

void io.flutter.plugin.platform.PlatformPlugin.vibrateHapticFeedback ( @NonNull PlatformChannel.HapticFeedbackType  feedbackType)
inlinepackage

Definition at line 191 of file PlatformPlugin.java.

192 {
193 View view = activity.getWindow().getDecorView();
194 switch (feedbackType) {
195 case STANDARD:
196 view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
197 break;
198 case LIGHT_IMPACT:
199 view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
200 break;
201 case MEDIUM_IMPACT:
202 view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
203 break;
204 case HEAVY_IMPACT:
205 if (Build.VERSION.SDK_INT >= API_LEVELS.API_23) {
206 view.performHapticFeedback(HapticFeedbackConstants.CONTEXT_CLICK);
207 }
208 break;
209 case SELECTION_CLICK:
210 view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK);
211 break;
212 }
213 }
Build(configs, env, options)
Definition build.py:232

Member Data Documentation

◆ DEFAULT_SYSTEM_UI

final int io.flutter.plugin.platform.PlatformPlugin.DEFAULT_SYSTEM_UI
static
Initial value:
=
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN

Definition at line 37 of file PlatformPlugin.java.

◆ mPlatformMessageHandler

final PlatformChannel.PlatformMessageHandler io.flutter.plugin.platform.PlatformPlugin.mPlatformMessageHandler
package

Definition at line 76 of file PlatformPlugin.java.

77 {
78 @Override
79 public void playSystemSound(@NonNull PlatformChannel.SoundType soundType) {
80 PlatformPlugin.this.playSystemSound(soundType);
81 }
82
83 @Override
84 public void vibrateHapticFeedback(
85 @NonNull PlatformChannel.HapticFeedbackType feedbackType) {
86 PlatformPlugin.this.vibrateHapticFeedback(feedbackType);
87 }
88
89 @Override
90 public void setPreferredOrientations(int androidOrientation) {
91 setSystemChromePreferredOrientations(androidOrientation);
92 }
93
94 @Override
95 public void setApplicationSwitcherDescription(
96 @NonNull PlatformChannel.AppSwitcherDescription description) {
97 setSystemChromeApplicationSwitcherDescription(description);
98 }
99
100 @Override
101 public void showSystemOverlays(@NonNull List<PlatformChannel.SystemUiOverlay> overlays) {
102 setSystemChromeEnabledSystemUIOverlays(overlays);
103 }
104
105 @Override
106 public void showSystemUiMode(@NonNull PlatformChannel.SystemUiMode mode) {
107 setSystemChromeEnabledSystemUIMode(mode);
108 }
109
110 @Override
111 public void setSystemUiChangeListener() {
112 setSystemChromeChangeListener();
113 }
114
115 @Override
116 public void restoreSystemUiOverlays() {
117 restoreSystemChromeSystemUIOverlays();
118 }
119
120 @Override
121 public void setSystemUiOverlayStyle(
122 @NonNull PlatformChannel.SystemChromeStyle systemUiOverlayStyle) {
123 setSystemChromeSystemUIOverlayStyle(systemUiOverlayStyle);
124 }
125
126 @Override
127 public void setFrameworkHandlesBack(boolean frameworkHandlesBack) {
128 PlatformPlugin.this.setFrameworkHandlesBack(frameworkHandlesBack);
129 }
130
131 @Override
132 public void popSystemNavigator() {
133 PlatformPlugin.this.popSystemNavigator();
134 }
135
136 @Override
137 public CharSequence getClipboardData(
138 @Nullable PlatformChannel.ClipboardContentFormat format) {
139 return PlatformPlugin.this.getClipboardData(format);
140 }
141
142 @Override
143 public void setClipboardData(@NonNull String text) {
144 PlatformPlugin.this.setClipboardData(text);
145 }
146
147 @Override
148 public boolean clipboardHasStrings() {
149 return PlatformPlugin.this.clipboardHasStrings();
150 }
151
152 @Override
153 public void share(@NonNull String text) {
154 PlatformPlugin.this.share(text);
155 }
156 };
void vibrateHapticFeedback( @NonNull PlatformChannel.HapticFeedbackType feedbackType)
PlatformPlugin(@NonNull Activity activity, @NonNull PlatformChannel platformChannel)
uint32_t uint32_t * format

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