├── app ├── OnyxPenDemo │ ├── .gitignore │ ├── src │ │ └── main │ │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── drawable │ │ │ │ ├── scribble_back_ground_grid.png │ │ │ │ ├── border_black_2dp.xml │ │ │ │ ├── bg_button_click_solid.xml │ │ │ │ ├── ic_width_minus_circle.xml │ │ │ │ ├── ic_marker_pen.xml │ │ │ │ ├── ic_pen_hard.xml │ │ │ │ ├── ic_width_plus_circle.xml │ │ │ │ ├── ic_pen_soft.xml │ │ │ │ ├── ic_pen_fountain.xml │ │ │ │ └── ic_charcoal_pen.xml │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── values-zh-rCN │ │ │ │ └── strings.xml │ │ │ ├── layout │ │ │ │ ├── activity_main.xml │ │ │ │ ├── layout_pen_setting_pop_brush_item.xml │ │ │ │ ├── activity_scribble_webview_stylus_demo.xml │ │ │ │ ├── activity_scribble_move_erase_stylus_demo.xml │ │ │ │ └── activity_scribble_epd_controller_demo.xml │ │ │ ├── raw │ │ │ │ └── demo.html │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── onyx │ │ │ │ └── android │ │ │ │ └── eink │ │ │ │ └── pen │ │ │ │ └── demo │ │ │ │ ├── data │ │ │ │ ├── InteractiveMode.java │ │ │ │ ├── ShapeType.java │ │ │ │ ├── StrokeColor.java │ │ │ │ └── ShapeTexture.java │ │ │ │ ├── event │ │ │ │ ├── ApplyFastModeEvent.java │ │ │ │ ├── StatusBarChangeEvent.java │ │ │ │ ├── PopupWindowChangeEvent.java │ │ │ │ ├── ActivityFocusChangedEvent.java │ │ │ │ ├── FloatButtonChangedEvent.java │ │ │ │ ├── NotificationPanelChangeEvent.java │ │ │ │ ├── DemoFloatMenuStateChangeEvent.java │ │ │ │ ├── FloatButtonMenuStateChangedEvent.java │ │ │ │ └── PenEvent.java │ │ │ │ ├── request │ │ │ │ ├── RendererToScreenRequest.java │ │ │ │ ├── PauseRawInputRenderRequest.java │ │ │ │ ├── PauseRawDrawingRenderRequest.java │ │ │ │ ├── StrokeColorChangeRequest.java │ │ │ │ ├── StrokeWidthChangeRequest.java │ │ │ │ ├── StrokesEraseFinishedRequest.java │ │ │ │ ├── StrokeStyleChangeRequest.java │ │ │ │ ├── AddShapeRequest.java │ │ │ │ ├── PartialRefreshRequest.java │ │ │ │ ├── AttachNoteViewRequest.java │ │ │ │ ├── BaseRequest.java │ │ │ │ └── StrokeErasingRequest.java │ │ │ │ ├── action │ │ │ │ ├── BaseAction.java │ │ │ │ ├── CommonPenAction.java │ │ │ │ ├── StrokeColorChangeAction.java │ │ │ │ ├── StrokeWidthChangeAction.java │ │ │ │ ├── StrokeStyleChangeAction.java │ │ │ │ ├── PopupChangeAction.java │ │ │ │ └── RefreshScreenAction.java │ │ │ │ ├── DemoApplication.java │ │ │ │ ├── shape │ │ │ │ ├── MarkerScribbleShape.java │ │ │ │ ├── NewBrushScribbleShape.java │ │ │ │ ├── BrushScribbleShape.java │ │ │ │ ├── NormalPencilShape.java │ │ │ │ └── CharcoalScribbleShape.java │ │ │ │ ├── scribble │ │ │ │ ├── util │ │ │ │ │ └── TouchUtils.java │ │ │ │ ├── request │ │ │ │ │ ├── RendererToScreenRequest.java │ │ │ │ │ └── PartialRefreshRequest.java │ │ │ │ └── ui │ │ │ │ │ └── ScribbleDemoActivity.java │ │ │ │ ├── ui │ │ │ │ ├── popup │ │ │ │ │ └── BasePopup.java │ │ │ │ └── MainActivity.java │ │ │ │ ├── render │ │ │ │ ├── Renderer.java │ │ │ │ ├── PartialRefreshRenderer.java │ │ │ │ ├── BaseRenderer.java │ │ │ │ └── NormalRenderer.java │ │ │ │ ├── util │ │ │ │ ├── RendererUtils.java │ │ │ │ └── ShapeUtils.java │ │ │ │ └── bean │ │ │ │ └── EraseArgs.java │ │ │ └── AndroidManifest.xml │ ├── proguard-rules.pro │ └── build.gradle ├── OnyxAndroidDemo │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── values │ │ │ │ │ ├── colors.xml │ │ │ │ │ ├── dimens.xml │ │ │ │ │ └── styles.xml │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ │ ├── ic_launcher.xml │ │ │ │ │ └── ic_launcher_round.xml │ │ │ │ ├── drawable │ │ │ │ │ ├── shape_corner.xml │ │ │ │ │ ├── bg_common_button.xml │ │ │ │ │ └── seekbar_progress.xml │ │ │ │ ├── xml │ │ │ │ │ └── file_paths.xml │ │ │ │ ├── layout │ │ │ │ │ ├── activity_full_screen_demo.xml │ │ │ │ │ ├── activity_scribble_hwr_demo.xml │ │ │ │ │ ├── activity_dictquery.xml │ │ │ │ │ ├── activity_scribble_touch_screen_demo.xml │ │ │ │ │ ├── activity_scribble_surfaceview_stylus_demo.xml │ │ │ │ │ ├── activity_scribble_touch_helper_stylus_demo.xml │ │ │ │ │ ├── activity_webview_optimize.xml │ │ │ │ │ ├── activity_scribble_state_demo.xml │ │ │ │ │ ├── activity_open_setting.xml │ │ │ │ │ ├── activity_app_optimize.xml │ │ │ │ │ ├── activity_boox_setting.xml │ │ │ │ │ ├── activity_reader_demo.xml │ │ │ │ │ ├── activity_screen_saver.xml │ │ │ │ │ ├── activity_scribble_save_points_demo.xml │ │ │ │ │ └── activity_ota_demo.xml │ │ │ │ └── drawable-v24 │ │ │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── android │ │ │ │ │ └── onyx │ │ │ │ │ └── demo │ │ │ │ │ ├── FullScreenDemoActivity.java │ │ │ │ │ ├── utils │ │ │ │ │ └── RendererUtils.java │ │ │ │ │ ├── EnvironmentDemoActivity.java │ │ │ │ │ ├── factory │ │ │ │ │ └── FrontLightFactory.java │ │ │ │ │ ├── SampleApplication.java │ │ │ │ │ ├── WebViewOptimizeActivity.java │ │ │ │ │ ├── FrontLightDemoActivity.java │ │ │ │ │ ├── AppOptimizeActivity.java │ │ │ │ │ ├── OpenSettingActivity.java │ │ │ │ │ ├── BooxSettingsDemoActivity.java │ │ │ │ │ ├── model │ │ │ │ │ ├── BaseLightModel.java │ │ │ │ │ └── FLLightModel.java │ │ │ │ │ ├── OTADemoActivity.java │ │ │ │ │ ├── ScreensaverActivity.java │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── RefreshModeDemoActivity.java │ │ │ └── AndroidManifest.xml │ │ ├── test │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── onyx │ │ │ │ └── android │ │ │ │ └── sample │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── com │ │ │ └── onyx │ │ │ └── android │ │ │ └── sample │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle └── moreApps │ └── daydreamdemo │ ├── .gitignore │ ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ ├── layout_image_daydream.xml │ │ │ │ ├── layout_daydream.xml │ │ │ │ └── activity_main.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── onyx │ │ │ │ └── daydreamdemo │ │ │ │ ├── MainActivity.java │ │ │ │ ├── utils │ │ │ │ ├── ScreenUtils.java │ │ │ │ └── ReflectUtils.java │ │ │ │ └── service │ │ │ │ └── MyDreamService.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── onyx │ │ │ └── daydreamdemo │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── onyx │ │ └── daydreamdemo │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── doc ├── DeviceEnvironment.md ├── Home.md ├── Eink-Develop-Guide_zh.md ├── FrontLightController.md ├── EpdController.md ├── EPD-Screen-Update.md ├── Onyx-Scribble-SDK.md ├── Eink-Develop-Guide.md ├── EpdDeviceManager.md ├── AppOpenGuide.md ├── Onyx-Base-SDK.md ├── DPI-and-DP-for-each-devices.asciidoc ├── EPD-Update-Mode.md ├── Onyx-Data-SDK.md ├── DictionaryUtils-API.md └── EPD-Touch.md ├── .gitignore ├── gradle.properties └── gradlew.bat /app/OnyxPenDemo/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app:OnyxAndroidDemo' 2 | include ':app:OnyxPenDemo' 3 | include ':app:moreApps:daydreamdemo' 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /doc/DeviceEnvironment.md: -------------------------------------------------------------------------------- 1 | Provide access to removable sdcard on the device 2 | 3 | DeviceEnvironment.getRemovableSDCardDirectory() -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DaydreamDemo 3 | 4 | -------------------------------------------------------------------------------- /doc/Home.md: -------------------------------------------------------------------------------- 1 | OnyxAndroidSample contains examples of [onyxsdk-base](./Onyx-Base-SDK.md), which is the SDK for Onyx-Intl Android E-Ink devices. 2 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxPenDemo/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxPenDemo/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxPenDemo/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxPenDemo/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxAndroidDemo/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxAndroidDemo/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxAndroidDemo/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxPenDemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxAndroidDemo/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxAndroidDemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxPenDemo/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxPenDemo/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxPenDemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxAndroidDemo/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxAndroidDemo/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxPenDemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxPenDemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/moreApps/daydreamdemo/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/moreApps/daydreamdemo/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxAndroidDemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxAndroidDemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/drawable/scribble_back_ground_grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxPenDemo/src/main/res/drawable/scribble_back_ground_grid.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/moreApps/daydreamdemo/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/moreApps/daydreamdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/OnyxAndroidDemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/moreApps/daydreamdemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/moreApps/daydreamdemo/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/moreApps/daydreamdemo/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/moreApps/daydreamdemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/moreApps/daydreamdemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/HEAD/app/moreApps/daydreamdemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/data/InteractiveMode.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.data; 2 | 3 | public enum InteractiveMode { 4 | SCRIBBLE, 5 | SCRIBBLE_ERASE, 6 | SCRIBBLE_PARTIAL_REFRESH 7 | } 8 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | /.idea/caches 6 | /.idea/libraries 7 | /.idea/modules.xml 8 | /.idea/workspace.xml 9 | /.idea/navEditor.xml 10 | /.idea/assetWizardSettings.xml 11 | .DS_Store 12 | /build 13 | /captures 14 | .externalNativeBuild 15 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 400dp 4 | 16dp 5 | 16dp 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Aug 08 20:14:14 CST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 7 | -------------------------------------------------------------------------------- /doc/Eink-Develop-Guide_zh.md: -------------------------------------------------------------------------------- 1 | # UI/UX 2 | 3 | ## BOOX Eink设备上的应用开发适配建议: 4 | 5 | 1. 页面颜色尽量黑白为主,如若有状态切换需要,尽可能保证颜色在256级灰度上. 6 | 2. 避免透明度遮罩图片/文字. 7 | 3. 使用翻页实现替代跟随划屏.(九宫格/单行列更替内容实现列表加载) 8 | 4. 避免使用动画过场/转场. 9 | 5. 字体大小不小于14sp,如果有嵌入字体的需求,尽可能使用黑体或粗体. 10 | 6. 中心区域按钮原则上不小于36dp x 36dp,边缘区域按钮大小不小于48dp x 48dp. -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/drawable/border_black_2dp.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/event/ApplyFastModeEvent.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.event; 2 | 3 | public class ApplyFastModeEvent { 4 | public boolean enable; 5 | 6 | public ApplyFastModeEvent(boolean enable) { 7 | this.enable = enable; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/event/StatusBarChangeEvent.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.event; 2 | 3 | public class StatusBarChangeEvent { 4 | public boolean show; 5 | 6 | public StatusBarChangeEvent(boolean show) { 7 | this.show = show; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/event/PopupWindowChangeEvent.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.event; 2 | 3 | public class PopupWindowChangeEvent { 4 | public boolean show; 5 | 6 | public PopupWindowChangeEvent(boolean show) { 7 | this.show = show; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/event/ActivityFocusChangedEvent.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.event; 2 | 3 | public class ActivityFocusChangedEvent { 4 | public boolean hasFocus; 5 | 6 | public ActivityFocusChangedEvent(boolean hasFocus) { 7 | this.hasFocus = hasFocus; 8 | } 9 | } -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/event/FloatButtonChangedEvent.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.event; 2 | 3 | public class FloatButtonChangedEvent { 4 | public boolean active; 5 | 6 | public FloatButtonChangedEvent(boolean active) { 7 | this.active = active; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/event/NotificationPanelChangeEvent.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.event; 2 | 3 | public class NotificationPanelChangeEvent { 4 | public boolean show; 5 | 6 | public NotificationPanelChangeEvent(boolean show) { 7 | this.show = show; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/event/DemoFloatMenuStateChangeEvent.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.event; 2 | 3 | public class DemoFloatMenuStateChangeEvent { 4 | public boolean active; 5 | 6 | public DemoFloatMenuStateChangeEvent(boolean active) { 7 | this.active = active; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/event/FloatButtonMenuStateChangedEvent.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.event; 2 | 3 | public class FloatButtonMenuStateChangedEvent { 4 | public boolean active; 5 | 6 | public FloatButtonMenuStateChangedEvent(boolean active) { 7 | this.active = active; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /doc/FrontLightController.md: -------------------------------------------------------------------------------- 1 | Provide methods to turn on/off front light, get/set front light level. 2 | 3 | You need declare WRITE_SETTINGS permission in the AndroidManifest.xml 4 | 5 | `` 6 | 7 | You can see sample code in [FrontLightDemoActivity](../app/src/main/java/com/android/onyx/demo/FrontLightDemoActivity.java) -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/drawable/shape_corner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/java/com/onyx/daydreamdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.onyx.daydreamdemo; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | 6 | public class MainActivity extends AppCompatActivity { 7 | 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.activity_main); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/layout/layout_image_daydream.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/test/java/com/onyx/android/sample/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.sample; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/test/java/com/onyx/daydreamdemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.onyx.daydreamdemo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/drawable/bg_button_click_solid.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/request/RendererToScreenRequest.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.request; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import com.onyx.android.eink.pen.demo.PenManager; 6 | 7 | public class RendererToScreenRequest extends BaseRequest { 8 | 9 | public RendererToScreenRequest(@NonNull PenManager noteManager) { 10 | super(noteManager); 11 | } 12 | 13 | @Override 14 | public void execute(PenManager penManager) throws Exception { 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/layout/layout_daydream.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/action/BaseAction.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.action; 2 | 3 | import com.onyx.android.eink.pen.demo.PenBundle; 4 | import com.onyx.android.eink.pen.demo.PenManager; 5 | import com.onyx.android.sdk.rx.RxBaseAction; 6 | 7 | public abstract class BaseAction extends RxBaseAction { 8 | 9 | protected PenBundle getDataBundle() { 10 | return PenBundle.getInstance(); 11 | } 12 | 13 | protected PenManager getPenManager() { 14 | return getDataBundle().getPenManager(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 40dp 6 | 6dp 7 | 15dp 8 | 0dp 9 | 8dp 10 | 10dp 11 | 12 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/request/PauseRawInputRenderRequest.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.request; 2 | 3 | import com.onyx.android.eink.pen.demo.PenManager; 4 | import com.onyx.android.sdk.rx.RxRequest; 5 | 6 | public class PauseRawInputRenderRequest extends RxRequest { 7 | private PenManager penManager; 8 | 9 | public PauseRawInputRenderRequest(PenManager penManager) { 10 | this.penManager = penManager; 11 | } 12 | 13 | @Override 14 | public void execute() throws Exception { 15 | penManager.setRawInputReaderEnable(false); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/request/PauseRawDrawingRenderRequest.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.request; 2 | 3 | import com.onyx.android.eink.pen.demo.PenManager; 4 | import com.onyx.android.sdk.rx.RxRequest; 5 | 6 | public class PauseRawDrawingRenderRequest extends RxRequest { 7 | private PenManager penManager; 8 | 9 | public PauseRawDrawingRenderRequest(PenManager penManager) { 10 | this.penManager = penManager; 11 | } 12 | 13 | @Override 14 | public void execute() throws Exception { 15 | penManager.setRawDrawingRenderEnabled(false); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/xml/file_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 10 | 13 | 14 | 17 | 18 | 21 | 24 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/drawable/ic_width_minus_circle.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | 11 | #000084 12 | #FF6163 13 | #00B036 14 | #404040 15 | 16 | -------------------------------------------------------------------------------- /doc/EpdController.md: -------------------------------------------------------------------------------- 1 | Provide [EPD Screen Update](./EPD-Screen-Update.md) API and [Scribble API](./Scribble-API.md) or [Touch Disable Function](./EPD-Touch.md) 2 | 3 | 4 | [EPD Screen Update](./EPD-Screen-Update.md) API provided by `EpdController` is rather primitive, for APPs to update screen, it's recommended to use [EpdDeviceManager](./EpdDeviceManager.md) as wrapper 5 | 6 | provided api to prevent webview enter A2 mode, for more detail to see [ScribbleWebViewDemoActivity](../app/src/main/java/com/android/onyx/demo/ScribbleWebViewDemoActivity..java) 7 | ``` 8 | /** 9 | * 10 | * @param view 11 | * @param enabled 12 | */ 13 | public static void setWebViewContrastOptimize(WebView view, boolean enabled) 14 | ``` -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/drawable/ic_marker_pen.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/drawable/ic_pen_hard.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/drawable/ic_width_plus_circle.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/request/StrokeColorChangeRequest.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.request; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import com.onyx.android.eink.pen.demo.PenManager; 6 | 7 | public class StrokeColorChangeRequest extends BaseRequest { 8 | private int color; 9 | 10 | public StrokeColorChangeRequest(@NonNull PenManager penManager) { 11 | super(penManager); 12 | } 13 | 14 | public StrokeColorChangeRequest setColor(int color) { 15 | this.color = color; 16 | return this; 17 | } 18 | 19 | @Override 20 | public void execute(PenManager penManager) throws Exception { 21 | getPenManager().setStrokeColor(color); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/request/StrokeWidthChangeRequest.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.request; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import com.onyx.android.eink.pen.demo.PenManager; 6 | 7 | public class StrokeWidthChangeRequest extends BaseRequest { 8 | private float width; 9 | 10 | public StrokeWidthChangeRequest(@NonNull PenManager penManager) { 11 | super(penManager); 12 | } 13 | 14 | public StrokeWidthChangeRequest setWidth(float width) { 15 | this.width = width; 16 | return this; 17 | } 18 | 19 | @Override 20 | public void execute(PenManager penManager) throws Exception { 21 | getPenManager().setStrokeWidth(width); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/drawable/ic_pen_soft.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/request/StrokesEraseFinishedRequest.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.request; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import com.onyx.android.eink.pen.demo.PenManager; 6 | import com.onyx.android.eink.pen.demo.data.InteractiveMode; 7 | 8 | public class StrokesEraseFinishedRequest extends BaseRequest { 9 | 10 | public StrokesEraseFinishedRequest(@NonNull PenManager penManager) { 11 | super(penManager); 12 | } 13 | 14 | @Override 15 | public void execute(PenManager penManager) throws Exception { 16 | penManager.activeRenderMode(InteractiveMode.SCRIBBLE); 17 | penManager.getRenderContext().eraseArgs = null; 18 | penManager.renderToBitmap(penManager.getDrawShape()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | android.useAndroidX=true 11 | # When configured, Gradle will run in incubating parallel mode. 12 | # This option should only be used with decoupled projects. More details, visit 13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 14 | # org.gradle.parallel=true 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo; 2 | 3 | import android.app.Application; 4 | import android.os.Build; 5 | 6 | import com.onyx.android.sdk.rx.RxBaseAction; 7 | import com.onyx.android.sdk.utils.ResManager; 8 | 9 | import org.lsposed.hiddenapibypass.HiddenApiBypass; 10 | 11 | public class DemoApplication extends Application { 12 | 13 | @Override 14 | public void onCreate() { 15 | super.onCreate(); 16 | ResManager.init(this); 17 | RxBaseAction.init(this); 18 | checkHiddenApiBypass(); 19 | } 20 | 21 | private void checkHiddenApiBypass() { 22 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { 23 | HiddenApiBypass.addHiddenApiExemptions(""); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/drawable/ic_pen_fountain.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/java/com/onyx/daydreamdemo/utils/ScreenUtils.java: -------------------------------------------------------------------------------- 1 | package com.onyx.daydreamdemo.utils; 2 | 3 | import android.content.Context; 4 | import android.graphics.Point; 5 | import android.util.Size; 6 | import android.view.WindowManager; 7 | 8 | public class ScreenUtils { 9 | 10 | public static Size getScreenSize(final Context context) { 11 | WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); 12 | if (wm == null) { 13 | return new Size(context.getResources().getDisplayMetrics().widthPixels, 14 | context.getResources().getDisplayMetrics().heightPixels); 15 | } 16 | Point point = new Point(); 17 | wm.getDefaultDisplay().getRealSize(point); 18 | return new Size(point.x, point.y); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/drawable/ic_charcoal_pen.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /doc/EPD-Screen-Update.md: -------------------------------------------------------------------------------- 1 | [EpdController](./EpdController.md) provides API to update screen with different [Update Mode](./EPD-Update-Mode.md): 2 | * Partial 3 | 4 | Default update mode 5 | 6 | `EpdController.setViewDefaultUpdateMode(view, UpdateMode.GU);` 7 | 8 | * Regal Partial 9 | 10 | Optimized partial update mode for text pages 11 | 12 | `EpdController.setViewDefaultUpdateMode(view, UpdateMode.REGAL);` 13 | 14 | * Full screen 15 | 16 | Full screen update 17 | 18 | `EpdController.invalidate(view, UpdateMode.GC);` 19 | 20 | * Fast (Animation) mode 21 | 22 | Black/white mode for fast screen update, such as zooming/scrolling/dragging 23 | 24 | Enter fast mode: 25 | 26 | `EpdController.applyApplicationFastMode(APP, true, clear);` 27 | 28 | Leave fast mdoe: 29 | 30 | `EpdController.applyApplicationFastMode(APP, false, clear);` 31 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/layout/activity_full_screen_demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 11 | 12 | 36 | 37 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 29 5 | buildToolsVersion "29.0.3" 6 | 7 | defaultConfig { 8 | applicationId "com.onyx.daydreamdemo" 9 | minSdkVersion 26 10 | targetSdkVersion 29 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | 24 | } 25 | 26 | dependencies { 27 | implementation fileTree(dir: 'libs', include: ['*.jar']) 28 | 29 | implementation 'com.android.support:appcompat-v7:28.0.0' 30 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 31 | testImplementation 'junit:junit:4.12' 32 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 33 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 34 | 35 | api "io.reactivex.rxjava2:rxjava:2.1.13" 36 | api "io.reactivex.rxjava2:rxandroid:2.1.0" 37 | 38 | implementation('com.onyx.android.sdk:onyxsdk-base:1.5.5') 39 | } 40 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/SampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo; 2 | 3 | import android.content.Context; 4 | import android.os.Build; 5 | import android.support.multidex.MultiDex; 6 | import android.support.multidex.MultiDexApplication; 7 | 8 | import com.onyx.android.sdk.rx.RxManager; 9 | 10 | import org.lsposed.hiddenapibypass.HiddenApiBypass; 11 | 12 | /** 13 | * Created by suicheng on 2017/3/23. 14 | */ 15 | 16 | public class SampleApplication extends MultiDexApplication { 17 | private static SampleApplication sInstance; 18 | 19 | @Override 20 | protected void attachBaseContext(Context base) { 21 | super.attachBaseContext(base); 22 | MultiDex.install(SampleApplication.this); 23 | } 24 | 25 | @Override 26 | public void onCreate() { 27 | super.onCreate(); 28 | initConfig(); 29 | RxManager.Builder.initAppContext(this); 30 | checkHiddenApiBypass(); 31 | } 32 | 33 | private void initConfig() { 34 | try { 35 | sInstance = this; 36 | } catch (Exception e) { 37 | } 38 | } 39 | 40 | private void checkHiddenApiBypass() { 41 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { 42 | HiddenApiBypass.addHiddenApiExemptions(""); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/request/PartialRefreshRequest.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.request; 2 | 3 | import android.graphics.RectF; 4 | 5 | import com.onyx.android.eink.pen.demo.PenManager; 6 | import com.onyx.android.eink.pen.demo.data.InteractiveMode; 7 | import com.onyx.android.sdk.api.device.epd.EpdController; 8 | import com.onyx.android.sdk.api.device.epd.UpdateMode; 9 | import com.onyx.android.sdk.rx.RxRequest; 10 | 11 | public class PartialRefreshRequest extends RxRequest { 12 | private final RectF refreshRect; 13 | private final PenManager penManager; 14 | 15 | public PartialRefreshRequest(PenManager penManager, RectF refreshRect) { 16 | this.penManager = penManager; 17 | this.refreshRect = refreshRect; 18 | } 19 | 20 | @Override 21 | public void execute() throws Exception { 22 | try { 23 | EpdController.setViewDefaultUpdateMode(penManager.getSurfaceView(), UpdateMode.HAND_WRITING_REPAINT_MODE); 24 | penManager.getRenderContext().clipRect = refreshRect; 25 | penManager.activeRenderMode(InteractiveMode.SCRIBBLE_PARTIAL_REFRESH); 26 | penManager.renderToScreen(); 27 | } finally { 28 | EpdController.resetViewUpdateMode(penManager.getSurfaceView()); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/WebViewOptimizeActivity.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.view.View; 6 | import android.webkit.WebView; 7 | import android.webkit.WebViewClient; 8 | 9 | import androidx.databinding.DataBindingUtil; 10 | 11 | import com.onyx.android.demo.R; 12 | import com.onyx.android.demo.databinding.ActivityWebviewOptimizeBinding; 13 | import com.onyx.android.sdk.api.device.epd.EpdController; 14 | 15 | 16 | public class WebViewOptimizeActivity extends AppCompatActivity { 17 | 18 | WebView webView; 19 | 20 | private boolean toggled = true; 21 | 22 | private ActivityWebviewOptimizeBinding binding; 23 | 24 | @Override 25 | protected void onCreate(Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | binding = DataBindingUtil.setContentView(this, R.layout.activity_webview_optimize); 28 | binding.setActivityWebview(this); 29 | 30 | webView = binding.webView; 31 | webView.setWebViewClient(new WebViewClient()); 32 | webView.loadUrl("https://www.google.com"); 33 | } 34 | 35 | public void toggleOptimize(View view) { 36 | toggled = !toggled; 37 | EpdController.setWebViewContrastOptimize(webView, toggled); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/layout/layout_pen_setting_pop_brush_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 15 | 16 | 21 | 22 | 29 | 30 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/ui/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.ui; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.view.View; 7 | 8 | import androidx.databinding.DataBindingUtil; 9 | 10 | import com.onyx.android.eink.pen.demo.R; 11 | import com.onyx.android.eink.pen.demo.databinding.ActivityMainBinding; 12 | import com.onyx.android.eink.pen.demo.scribble.ui.ScribbleDemoActivity; 13 | 14 | public class MainActivity extends Activity { 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main); 20 | binding.buttonScribbleDemo.setOnClickListener(new View.OnClickListener() { 21 | @Override 22 | public void onClick(View v) { 23 | go(ScribbleDemoActivity.class); 24 | } 25 | }); 26 | binding.buttonPenDemo.setOnClickListener(new View.OnClickListener() { 27 | @Override 28 | public void onClick(View v) { 29 | go(PenDemoActivity.class); 30 | } 31 | }); 32 | } 33 | 34 | private void go(Class activityClass) { 35 | startActivity(new Intent(this, activityClass)); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/action/StrokeWidthChangeAction.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.action; 2 | 3 | import com.onyx.android.eink.pen.demo.request.StrokeWidthChangeRequest; 4 | 5 | import io.reactivex.Observable; 6 | import io.reactivex.android.schedulers.AndroidSchedulers; 7 | 8 | public class StrokeWidthChangeAction extends BaseAction { 9 | private final int shapeType; 10 | private final float width; 11 | 12 | public StrokeWidthChangeAction(int shapeType, float width) { 13 | this.shapeType = shapeType; 14 | this.width = width; 15 | } 16 | 17 | @Override 18 | protected Observable create() { 19 | return getPenManager().createObservable() 20 | .map(o -> change()) 21 | .observeOn(AndroidSchedulers.mainThread()) 22 | .map(o -> updateDrawingArgs()); 23 | } 24 | 25 | private StrokeWidthChangeRequest change() throws Exception { 26 | final StrokeWidthChangeRequest request = new StrokeWidthChangeRequest(getPenManager()) 27 | .setWidth(width); 28 | request.execute(); 29 | return request; 30 | } 31 | 32 | private StrokeWidthChangeAction updateDrawingArgs() { 33 | getDataBundle().setCurrentStrokeWidth(width); 34 | getDataBundle().savePenLineWidth(shapeType, width); 35 | return this; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/render/PartialRefreshRenderer.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.render; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Rect; 5 | import android.view.SurfaceView; 6 | 7 | import com.onyx.android.eink.pen.demo.helper.RendererHelper; 8 | import com.onyx.android.eink.pen.demo.util.RendererUtils; 9 | import com.onyx.android.sdk.utils.CanvasUtils; 10 | import com.onyx.android.sdk.utils.RectUtils; 11 | 12 | public class PartialRefreshRenderer extends BaseRenderer { 13 | 14 | @Override 15 | public void renderToScreen(SurfaceView surfaceView, RendererHelper.RenderContext renderContext) { 16 | if (surfaceView == null) { 17 | return; 18 | } 19 | Rect renderRect = RectUtils.toRect(renderContext.clipRect); 20 | Rect viewRect = RendererUtils.checkSurfaceView(surfaceView); 21 | Canvas canvas = lockHardwareCanvas(surfaceView.getHolder(), renderRect); 22 | if (canvas == null) { 23 | return; 24 | } 25 | try { 26 | CanvasUtils.clipRect(canvas, renderRect); 27 | RendererUtils.renderBackground(canvas, viewRect); 28 | drawRendererContent(renderContext.bitmap, canvas); 29 | } catch (Exception e) { 30 | e.printStackTrace(); 31 | } finally { 32 | surfaceView.getHolder().unlockCanvasAndPost(canvas); 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/FrontLightDemoActivity.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | 6 | import androidx.databinding.DataBindingUtil; 7 | 8 | import com.android.onyx.demo.factory.FrontLightFactory; 9 | import com.android.onyx.demo.model.BaseLightModel; 10 | import com.onyx.android.demo.R; 11 | import com.onyx.android.demo.databinding.ActivityFrontLightDemoBinding; 12 | 13 | 14 | public class FrontLightDemoActivity extends AppCompatActivity { 15 | private ActivityFrontLightDemoBinding binding; 16 | private BaseLightModel lightModel; 17 | 18 | @Override 19 | protected void onCreate(Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | binding = DataBindingUtil.setContentView(this, R.layout.activity_front_light_demo); 22 | initLightModel(); 23 | } 24 | 25 | private void initLightModel() { 26 | lightModel = FrontLightFactory.createLightModel(this); 27 | if (lightModel != null) { 28 | lightModel.initView(binding); 29 | binding.buttonShowBrightnessSetting.setOnClickListener(v -> lightModel.showBrightnessSetting(v)); 30 | } 31 | } 32 | 33 | @Override 34 | protected void onResume() { 35 | super.onResume(); 36 | if (lightModel != null) { 37 | lightModel.updateLightValue(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/action/StrokeStyleChangeAction.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.action; 2 | 3 | import com.onyx.android.eink.pen.demo.request.StrokeStyleChangeRequest; 4 | 5 | import io.reactivex.Observable; 6 | import io.reactivex.android.schedulers.AndroidSchedulers; 7 | 8 | public class StrokeStyleChangeAction extends BaseAction { 9 | private final int shapeType; 10 | private final int texture; 11 | 12 | public StrokeStyleChangeAction(int shapeType, int texture) { 13 | this.shapeType = shapeType; 14 | this.texture = texture; 15 | } 16 | 17 | @Override 18 | protected Observable create() { 19 | return getPenManager().createObservable() 20 | .map(o -> change()) 21 | .observeOn(AndroidSchedulers.mainThread()) 22 | .map(o -> updateDrawingArgs()); 23 | } 24 | 25 | private StrokeStyleChangeRequest change() throws Exception { 26 | final StrokeStyleChangeRequest request = new StrokeStyleChangeRequest(getPenManager()) 27 | .setShapeType(shapeType) 28 | .setTexture(texture); 29 | request.execute(); 30 | return request; 31 | } 32 | 33 | private StrokeStyleChangeAction updateDrawingArgs() { 34 | getDataBundle().setCurrentShapeType(shapeType); 35 | getDataBundle().setCurrentTexture(texture); 36 | return this; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /doc/DictionaryUtils-API.md: -------------------------------------------------------------------------------- 1 | update `onyx-base-sdk` to version 1.4.3.7 or above 2 | 3 | 4 | This Method may block thread, Do not invoke in UI thread, for more detail to see [DictionaryActivity](../app/src/main/java/com/android/onyx/demo/DictionaryActivity.java) 5 | 6 | ``` 7 | /** 8 | * 9 | * @param context 10 | * @param keyword 11 | * @return DictionaryQuery 12 | * 13 | */ 14 | public static DictionaryQuery queryKeyWord(Context context, String keyword) 15 | ``` 16 | 17 | POJO **DictionaryQuery** FIELD EXPLAIN 18 | 19 | 20 | | field | meaning | 21 | |:--|--:| 22 | | state | the total state of query result | 23 | | `List` | a list contain result from multiple dictionary | 24 | | `DictionaryQuery.Dictionary` | POJO for single result | 25 | | state | state for single result in list | 26 | | dictName | name of dictionary | 27 | | keyword | the keyword to query | 28 | | explanation | explanation of the keyword | 29 | 30 | > be careful. for single result, even state field is success, the explantion field may null 31 | 32 | **state** EXPLAIN 33 | 34 | 35 | | field | meaning | 36 | |:--|--:| 37 | | DICT_STATE_ERROR | query failed, the dictionary not installed or query occur exception | 38 | | DICT_STATE_PARAM_ERROR | query failed, the params incorrect | 39 | | DICT_STATE_QUERY_SUCCESSFUL | query success | 40 | | DICT_STATE_QUERY_FAILED | query failed | 41 | | DICT_STATE_LOADING | is loading | 42 | | DICT_STATE_NO_DATA | query success, but no data get | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/request/AttachNoteViewRequest.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.request; 2 | 3 | import android.view.SurfaceView; 4 | import android.view.View; 5 | 6 | import androidx.annotation.NonNull; 7 | 8 | import com.onyx.android.eink.pen.demo.PenManager; 9 | import com.onyx.android.sdk.pen.RawInputCallback; 10 | 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | public class AttachNoteViewRequest extends BaseRequest { 14 | private SurfaceView hostView; 15 | private View floatMenuLayout; 16 | private boolean windowFocused = true; 17 | private RawInputCallback callback; 18 | 19 | public AttachNoteViewRequest(@NonNull @NotNull PenManager penManager) { 20 | super(penManager); 21 | } 22 | 23 | public AttachNoteViewRequest setHostView(SurfaceView hostView) { 24 | this.hostView = hostView; 25 | return this; 26 | } 27 | 28 | public AttachNoteViewRequest setFloatMenuLayout(View floatMenuLayout) { 29 | this.floatMenuLayout = floatMenuLayout; 30 | return this; 31 | } 32 | 33 | public AttachNoteViewRequest setCallback(RawInputCallback callback) { 34 | this.callback = callback; 35 | return this; 36 | } 37 | 38 | @Override 39 | public void execute(PenManager penManager) throws Exception { 40 | penManager.attachHostView(hostView, floatMenuLayout, windowFocused, callback); 41 | penManager.setViewPoint(hostView); 42 | setRenderToScreen(false); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/data/ShapeType.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.data; 2 | 3 | import com.onyx.android.eink.pen.demo.R; 4 | 5 | public enum ShapeType { 6 | 7 | FOUNTAIN_PEN(R.drawable.ic_pen_fountain, R.string.fountain_pen, ShapeFactory.SHAPE_BRUSH_SCRIBBLE), 8 | SOFT_PEN(R.drawable.ic_pen_soft, R.string.brush_pen, ShapeFactory.SHAPE_NEO_BRUSH_SCRIBBLE), 9 | HARD_PEN(R.drawable.ic_pen_hard, R.string.ballpoint_pen, ShapeFactory.SHAPE_PENCIL_SCRIBBLE), 10 | CHARCOAL_PEN(R.drawable.ic_charcoal_pen, R.string.pencil, ShapeFactory.SHAPE_CHARCOAL_SCRIBBLE), 11 | MARKER_PEN(R.drawable.ic_marker_pen, R.string.marker_pen, ShapeFactory.SHAPE_MARKER_SCRIBBLE); 12 | 13 | private final int iconResId; 14 | private final int textResId; 15 | private final int value; 16 | 17 | ShapeType(int iconResId, int textResId, int value) { 18 | this.iconResId = iconResId; 19 | this.textResId = textResId; 20 | this.value = value; 21 | } 22 | 23 | public int getIconResId() { 24 | return iconResId; 25 | } 26 | 27 | public int getTextResId() { 28 | return textResId; 29 | } 30 | 31 | public int getValue() { 32 | return value; 33 | } 34 | 35 | 36 | public static ShapeType find(int shapeType) { 37 | for (ShapeType style : ShapeType.values()) { 38 | if (style.value == shapeType) { 39 | return style; 40 | } 41 | } 42 | return ShapeType.FOUNTAIN_PEN; 43 | } 44 | } -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/util/RendererUtils.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.util; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Color; 5 | import android.graphics.Matrix; 6 | import android.graphics.Paint; 7 | import android.graphics.Point; 8 | import android.graphics.Rect; 9 | import android.view.SurfaceView; 10 | 11 | import com.onyx.android.eink.pen.demo.helper.RendererHelper; 12 | 13 | public class RendererUtils { 14 | 15 | public static void renderBackground(Canvas canvas, 16 | Rect viewRect) { 17 | RendererUtils.clearBackground(canvas, new Paint(), viewRect); 18 | } 19 | 20 | 21 | public static Rect checkSurfaceView(SurfaceView surfaceView) { 22 | if (surfaceView == null || !surfaceView.getHolder().getSurface().isValid()) { 23 | return null; 24 | } 25 | return new Rect(0, 0, surfaceView.getWidth(), surfaceView.getHeight()); 26 | } 27 | 28 | public static void clearBackground(final Canvas canvas, final Paint paint, final Rect rect) { 29 | paint.setStyle(Paint.Style.FILL); 30 | paint.setColor(Color.WHITE); 31 | canvas.drawRect(rect, paint); 32 | } 33 | 34 | public static Matrix getPointMatrix(final RendererHelper.RenderContext renderContext) { 35 | Point anchorPoint = renderContext.viewPoint; 36 | Matrix matrix = new Matrix(); 37 | matrix.postTranslate(anchorPoint.x, anchorPoint.y); 38 | return matrix; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/bean/EraseArgs.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.eink.pen.demo.bean; 2 | 3 | import com.onyx.android.sdk.data.note.TouchPoint; 4 | import com.onyx.android.sdk.pen.data.TouchPointList; 5 | 6 | public class EraseArgs { 7 | public TouchPointList eraseTrackPoints; 8 | public float eraserWidth = 20f; 9 | public float drawRadius = eraserWidth / 2; 10 | public boolean showEraseCircle; 11 | private int eraserType; 12 | 13 | public EraseArgs setEraseTrackPoints(TouchPointList eraseTrackPoints) { 14 | this.eraseTrackPoints = eraseTrackPoints; 15 | return this; 16 | } 17 | 18 | public EraseArgs setDrawRadius(float drawRadius) { 19 | this.drawRadius = drawRadius; 20 | return this; 21 | } 22 | 23 | public EraseArgs setShowEraseCircle(boolean showEraseCircle) { 24 | this.showEraseCircle = showEraseCircle; 25 | return this; 26 | } 27 | 28 | public TouchPoint getErasePoint() { 29 | TouchPoint erasePoint = eraseTrackPoints.get(eraseTrackPoints.size() - 1); 30 | return erasePoint; 31 | } 32 | 33 | public int getEraserType() { 34 | return eraserType; 35 | } 36 | 37 | public EraseArgs setEraserType(int eraserType) { 38 | this.eraserType = eraserType; 39 | return this; 40 | } 41 | 42 | public float getEraserWidth() { 43 | return eraserWidth; 44 | } 45 | 46 | public EraseArgs setEraserWidth(float eraserWidth) { 47 | this.eraserWidth = eraserWidth; 48 | return this; 49 | } 50 | } -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/layout/activity_scribble_hwr_demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 19 | 20 |