|
| 1 | +package com.onyx.android.sdk.api.device.epd; |
| 2 | + |
| 3 | +import android.content.Context; |
| 4 | +import android.content.Intent; |
| 5 | +import android.graphics.Paint; |
| 6 | +import android.graphics.Rect; |
| 7 | +import android.graphics.RectF; |
| 8 | +import android.view.View; |
| 9 | +import android.webkit.WebView; |
| 10 | + |
| 11 | +import com.onyx.android.sdk.device.Device; |
| 12 | + |
| 13 | +public abstract class EpdController { |
| 14 | + private static String TAG = EpdController.class.getSimpleName(); |
| 15 | + public static int SCHEME_START = 1; |
| 16 | + public static int SCHEME_NORMAL = 1; |
| 17 | + public static int SCHEME_KEYBOARD = 2; |
| 18 | + public static int SCHEME_SCRIBBLE = 3; |
| 19 | + public static int SCHEME_APPLICATION_ANIMATION = 4; |
| 20 | + public static int SCHEME_SYSTEM_ANIMATION = 5; |
| 21 | + public static int SCHEME_END = SCHEME_SYSTEM_ANIMATION; |
| 22 | + private static final String ENABLE_SYSTEM_CTP_ACTION = "action.enable.all.tp.region"; |
| 23 | + private static final String RESET_SYSTEM_CTP_ACTION = "action.disable.tp.exclude.bar.region"; |
| 24 | + |
| 25 | + public static void invalidate(View view, UpdateMode mode) { |
| 26 | + Device.currentDevice().invalidate(view, mode); |
| 27 | + } |
| 28 | + |
| 29 | + public static void invalidate(View view, int left, int top, int right, int bottom, UpdateMode mode) { |
| 30 | + Device.currentDevice().invalidate(view, left, top, right, bottom, mode); |
| 31 | + } |
| 32 | + |
| 33 | + public static void postInvalidate(View view, UpdateMode mode) { |
| 34 | + Device.currentDevice().postInvalidate(view, mode); |
| 35 | + } |
| 36 | + |
| 37 | + public static boolean enableScreenUpdate(View view, boolean enable) { |
| 38 | + return Device.currentDevice().enableScreenUpdate(view, enable); |
| 39 | + } |
| 40 | + |
| 41 | + public static boolean setViewDefaultUpdateMode(View view, UpdateMode mode) { |
| 42 | + Device.currentDevice().setViewDefaultUpdateMode(view, mode); |
| 43 | + return true; |
| 44 | + } |
| 45 | + |
| 46 | + public static UpdateMode getViewDefaultUpdateMode(View view) { |
| 47 | + return Device.currentDevice().getViewDefaultUpdateMode(view); |
| 48 | + } |
| 49 | + |
| 50 | + public static void useFastScheme() { |
| 51 | + setDisplayScheme(SCHEME_SCRIBBLE); |
| 52 | + } |
| 53 | + |
| 54 | + public static void resetUpdateMode(View view) { |
| 55 | + resetViewUpdateMode(view); |
| 56 | + useFastScheme(); |
| 57 | + } |
| 58 | + |
| 59 | + public static boolean resetViewUpdateMode(View view) { |
| 60 | + Device.currentDevice().resetViewUpdateMode(view); |
| 61 | + return true; |
| 62 | + } |
| 63 | + |
| 64 | + public static UpdateMode getSystemDefaultUpdateMode() { |
| 65 | + return Device.currentDevice().getSystemDefaultUpdateMode(); |
| 66 | + } |
| 67 | + |
| 68 | + public static boolean setSystemDefaultUpdateMode(UpdateMode mode) { |
| 69 | + Device.currentDevice().setSystemDefaultUpdateMode(mode); |
| 70 | + return false; |
| 71 | + } |
| 72 | + |
| 73 | + public static boolean setSystemUpdateModeAndScheme(UpdateMode mode, UpdateScheme scheme, int count) { |
| 74 | + Device.currentDevice().setSystemUpdateModeAndScheme(mode, scheme, count); |
| 75 | + return false; |
| 76 | + } |
| 77 | + |
| 78 | + public static boolean clearSystemUpdateModeAndScheme() { |
| 79 | + Device.currentDevice().clearSystemUpdateModeAndScheme(); |
| 80 | + return false; |
| 81 | + } |
| 82 | + |
| 83 | + public static boolean applyApplicationFastMode(String application, boolean enable, boolean clear) { |
| 84 | + Device.currentDevice().applyApplicationFastMode(application, enable, clear); |
| 85 | + return true; |
| 86 | + } |
| 87 | + |
| 88 | + public static boolean applyApplicationFastMode(String application, boolean enable, boolean clear, UpdateMode repeatMode, int repeatLimit) { |
| 89 | + Device.currentDevice().applyApplicationFastMode(application, enable, clear, repeatMode, repeatLimit); |
| 90 | + return true; |
| 91 | + } |
| 92 | + |
| 93 | + public static boolean setDisplayScheme(int scheme) { |
| 94 | + Device.currentDevice().setDisplayScheme(scheme); |
| 95 | + return true; |
| 96 | + } |
| 97 | + |
| 98 | + public static void waitForUpdateFinished() { |
| 99 | + Device.currentDevice().waitForUpdateFinished(); |
| 100 | + } |
| 101 | + |
| 102 | + public static void refreshScreen(View view, UpdateMode mode) { |
| 103 | + Device.currentDevice().refreshScreen(view, mode); |
| 104 | + } |
| 105 | + |
| 106 | + public static void refreshScreenRegion(View view, int left, int top, int width, int height, UpdateMode mode) { |
| 107 | + Device.currentDevice().refreshScreenRegion(view, left, top, width, height, mode); |
| 108 | + } |
| 109 | + |
| 110 | + public static boolean supportRegal() { |
| 111 | + return Device.currentDevice().supportRegal(); |
| 112 | + } |
| 113 | + |
| 114 | + public static void holdDisplay(boolean hold, UpdateMode updateMode, int ignoreFrame) { |
| 115 | + Device.currentDevice().holdDisplay(hold, updateMode, ignoreFrame); |
| 116 | + } |
| 117 | + |
| 118 | + public static void setStrokeWidth(float width) { |
| 119 | + Device.currentDevice().setStrokeWidth(width); |
| 120 | + } |
| 121 | + |
| 122 | + public static void setStrokeStyle(int style) { |
| 123 | + Device.currentDevice().setStrokeStyle(style); |
| 124 | + } |
| 125 | + |
| 126 | + public static void setStrokeColor(int color) { |
| 127 | + Device.currentDevice().setStrokeColor(color); |
| 128 | + } |
| 129 | + |
| 130 | + public static void setScreenHandWritingPenState(View view, int penState) { |
| 131 | + Device.currentDevice().setScreenHandWritingPenState(view, penState); |
| 132 | + } |
| 133 | + |
| 134 | + public static void setScreenHandWritingRegionLimit(View view, int left, int top, int right, int bottom) { |
| 135 | + Device.currentDevice().setScreenHandWritingRegionLimit(view, left, top, right, bottom); |
| 136 | + } |
| 137 | + |
| 138 | + public static void setScreenHandWritingRegionLimit(View view) { |
| 139 | + Device.currentDevice().setScreenHandWritingRegionLimit(view); |
| 140 | + } |
| 141 | + |
| 142 | + public static void setScreenHandWritingRegionLimit(View view, int[] array) { |
| 143 | + Device.currentDevice().setScreenHandWritingRegionLimit(view, array); |
| 144 | + } |
| 145 | + |
| 146 | + public static void setScreenHandWritingRegionLimit(View view, Rect[] regions) { |
| 147 | + Device.currentDevice().setScreenHandWritingRegionLimit(view, regions); |
| 148 | + } |
| 149 | + |
| 150 | + public static void setScreenHandWritingRegionExclude(View view, Rect[] regions) { |
| 151 | + Device.currentDevice().setScreenHandWritingRegionExclude(view, regions); |
| 152 | + } |
| 153 | + |
| 154 | + public static float startStroke(float baseWidth, float x, float y, float pressure, float size, float time) { |
| 155 | + return Device.currentDevice().startStroke(baseWidth, x, y, pressure, size, time); |
| 156 | + } |
| 157 | + |
| 158 | + public static float addStrokePoint(float baseWidth, float x, float y, float pressure, float size, float time) { |
| 159 | + return Device.currentDevice().addStrokePoint(baseWidth, x, y, pressure, size, time); |
| 160 | + } |
| 161 | + |
| 162 | + public static float finishStroke(float baseWidth, float x, float y, float pressure, float size, float time) { |
| 163 | + return Device.currentDevice().finishStroke(baseWidth, x, y, pressure, size, time); |
| 164 | + } |
| 165 | + |
| 166 | + public static void enterScribbleMode(View view) { |
| 167 | + Device.currentDevice().enterScribbleMode(view); |
| 168 | + } |
| 169 | + |
| 170 | + public static void leaveScribbleMode(View view) { |
| 171 | + Device.currentDevice().leaveScribbleMode(view); |
| 172 | + } |
| 173 | + |
| 174 | + public static void enablePost(View view, int enable) { |
| 175 | + Device.currentDevice().enablePost(view, enable); |
| 176 | + } |
| 177 | + |
| 178 | + public static void resetEpdPost() { |
| 179 | + Device.currentDevice().resetEpdPost(); |
| 180 | + } |
| 181 | + |
| 182 | + public static void setPainterStyle(boolean antiAlias, Paint.Style strokeStyle, Paint.Join joinStyle, Paint.Cap capStyle) { |
| 183 | + Device.currentDevice().setPainterStyle(antiAlias, strokeStyle, joinStyle, capStyle); |
| 184 | + } |
| 185 | + |
| 186 | + public static void moveTo(float x, float y, float width) { |
| 187 | + Device.currentDevice().moveTo(x, y, width); |
| 188 | + } |
| 189 | + |
| 190 | + public static void moveTo(View view, float x, float y, float width) { |
| 191 | + Device.currentDevice().moveTo(view, x, y, width); |
| 192 | + } |
| 193 | + |
| 194 | + public static void lineTo(float x, float y, UpdateMode mode) { |
| 195 | + Device.currentDevice().lineTo(x, y, mode); |
| 196 | + } |
| 197 | + |
| 198 | + public static void lineTo(View view, float x, float y, UpdateMode mode) { |
| 199 | + Device.currentDevice().lineTo(view, x, y, mode); |
| 200 | + } |
| 201 | + |
| 202 | + public static void quadTo(float x, float y, UpdateMode mode) { |
| 203 | + Device.currentDevice().quadTo(x, y, mode); |
| 204 | + } |
| 205 | + |
| 206 | + public static void quadTo(View view, float x, float y, UpdateMode mode) { |
| 207 | + Device.currentDevice().quadTo(view, x, y, mode); |
| 208 | + } |
| 209 | + |
| 210 | + public static void disableA2ForSpecificView(View view) { |
| 211 | + Device.currentDevice().disableA2ForSpecificView(view); |
| 212 | + } |
| 213 | + |
| 214 | + public static void enableA2ForSpecificView(View view) { |
| 215 | + Device.currentDevice().enableA2ForSpecificView(view); |
| 216 | + } |
| 217 | + |
| 218 | + public static void setWebViewContrastOptimize(WebView view, boolean enabled) { |
| 219 | + Device.currentDevice().setWebViewContrastOptimize(view, enabled); |
| 220 | + } |
| 221 | + |
| 222 | + public static void mapToView(View view, float[] src, float[] dst) { |
| 223 | + Device.currentDevice().mapToView(view, src, dst); |
| 224 | + } |
| 225 | + |
| 226 | + public static void mapToEpd(View view, float[] src, float[] dst) { |
| 227 | + Device.currentDevice().mapToEpd(view, src, dst); |
| 228 | + } |
| 229 | + |
| 230 | + public static Rect mapToEpd(View view, Rect src) { |
| 231 | + return Device.currentDevice().mapToEpd(view, src); |
| 232 | + } |
| 233 | + |
| 234 | + public static void mapFromRawTouchPoint(View view, float[] src, float[] dst) { |
| 235 | + Device.currentDevice().mapFromRawTouchPoint(view, src, dst); |
| 236 | + } |
| 237 | + |
| 238 | + public static void mapToRawTouchPoint(View view, float[] src, float[] dst) { |
| 239 | + Device.currentDevice().mapToRawTouchPoint(view, src, dst); |
| 240 | + } |
| 241 | + |
| 242 | + public static RectF mapToRawTouchPoint(View view, RectF rect) { |
| 243 | + return Device.currentDevice().mapToRawTouchPoint(view, rect); |
| 244 | + } |
| 245 | + |
| 246 | + public static float getTouchWidth() { |
| 247 | + return Device.currentDevice().getTouchWidth(); |
| 248 | + } |
| 249 | + |
| 250 | + public static float getTouchHeight() { |
| 251 | + return Device.currentDevice().getTouchHeight(); |
| 252 | + } |
| 253 | + |
| 254 | + public static float getMaxTouchPressure() { |
| 255 | + return Device.currentDevice().getMaxTouchPressure(); |
| 256 | + } |
| 257 | + |
| 258 | + public static float getEpdWidth() { |
| 259 | + return Device.currentDevice().getEpdWidth(); |
| 260 | + } |
| 261 | + |
| 262 | + public static float getEpdHeight() { |
| 263 | + return Device.currentDevice().getEpdHeight(); |
| 264 | + } |
| 265 | + |
| 266 | + public static void enableRegal() { |
| 267 | + Device.currentDevice().enableRegal(true); |
| 268 | + } |
| 269 | + |
| 270 | + public static void disableRegal() { |
| 271 | + Device.currentDevice().enableRegal(false); |
| 272 | + } |
| 273 | + |
| 274 | + public static void setUpdListSize(int size) { |
| 275 | + Device.currentDevice().setUpdListSize(size); |
| 276 | + } |
| 277 | + |
| 278 | + public static void resetUpdListSize() { |
| 279 | + Device.currentDevice().setUpdListSize(-1); |
| 280 | + } |
| 281 | + |
| 282 | + public static boolean inSystemFastMode() { |
| 283 | + return Device.currentDevice().inSystemFastMode(); |
| 284 | + } |
| 285 | + |
| 286 | + public static void setAppCTPDisableRegion(Context context, int[] disableRegionArray) { |
| 287 | + setAppCTPDisableRegion(context, disableRegionArray, null); |
| 288 | + } |
| 289 | + |
| 290 | + public static void setAppCTPDisableRegion(Context context, Rect[] disableRegions) { |
| 291 | + setAppCTPDisableRegion(context, disableRegions, null); |
| 292 | + } |
| 293 | + |
| 294 | + public static void setAppCTPDisableRegion(Context context, int[] disableRegionArray, int[] excludeRegionArray) { |
| 295 | + Device.currentDevice().setAppCTPDisableRegion(context, disableRegionArray, excludeRegionArray); |
| 296 | + } |
| 297 | + |
| 298 | + public static void setAppCTPDisableRegion(Context context, Rect[] disableRegions, Rect[] excludeRegions) { |
| 299 | + Device.currentDevice().setAppCTPDisableRegion(context, disableRegions, excludeRegions); |
| 300 | + } |
| 301 | + |
| 302 | + public static boolean isCTPDisableRegion(Context context) { |
| 303 | + return Device.currentDevice().isCTPDisableRegion(context); |
| 304 | + } |
| 305 | + |
| 306 | + public static void appResetCTPDisableRegion(Context context) { |
| 307 | + Device.currentDevice().appResetCTPDisableRegion(context); |
| 308 | + } |
| 309 | + |
| 310 | + public static void setSystemCTPDisableRegion(Context context) { |
| 311 | + context.sendBroadcast(new Intent(ENABLE_SYSTEM_CTP_ACTION)); |
| 312 | + } |
| 313 | + |
| 314 | + public static void systemResetCTPDisableRegion(Context context) { |
| 315 | + context.sendBroadcast(new Intent(RESET_SYSTEM_CTP_ACTION)); |
| 316 | + } |
| 317 | + |
| 318 | + public static boolean isCTPPowerOn() { |
| 319 | + return Device.currentDevice().isCTPPowerOn(); |
| 320 | + } |
| 321 | + |
| 322 | + public static boolean isEMTPPowerOn() { |
| 323 | + return Device.currentDevice().isEMTPPowerOn(); |
| 324 | + } |
| 325 | + |
| 326 | + public static void powerCTP(boolean enable) { |
| 327 | + Device.currentDevice().powerCTP(enable); |
| 328 | + } |
| 329 | + |
| 330 | + public static void powerEMTP(boolean enable) { |
| 331 | + Device.currentDevice().powerEMTP(enable); |
| 332 | + } |
| 333 | + |
| 334 | + public static void switchToA2Mode() { |
| 335 | + Device.currentDevice().switchToA2Mode(); |
| 336 | + } |
| 337 | + |
| 338 | + public static void applyGammaCorrection(boolean apply, int value) { |
| 339 | + Device.currentDevice.applyGammaCorrection(apply, value); |
| 340 | + } |
| 341 | + |
| 342 | + public static void applyGCOnce() { |
| 343 | + Device.currentDevice().applyGCOnce(); |
| 344 | + } |
| 345 | + |
| 346 | + public static void setTrigger(int count) { |
| 347 | + Device.currentDevice().setTrigger(count); |
| 348 | + } |
| 349 | +} |
0 commit comments