├── .gitignore ├── README.md ├── README_zh.md ├── app ├── OnyxAndroidDemo │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── onyx │ │ │ └── android │ │ │ └── sample │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── android │ │ │ │ └── onyx │ │ │ │ └── demo │ │ │ │ ├── AppOptimizeActivity.java │ │ │ │ ├── BooxSettingsDemoActivity.java │ │ │ │ ├── DictionaryActivity.java │ │ │ │ ├── EacDemoActivity.java │ │ │ │ ├── EnvironmentDemoActivity.java │ │ │ │ ├── EpdDemoActivity.java │ │ │ │ ├── FrontLightDemoActivity.java │ │ │ │ ├── FullScreenDemoActivity.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── OTADemoActivity.java │ │ │ │ ├── OpenKcbActivity.java │ │ │ │ ├── OpenSettingActivity.java │ │ │ │ ├── ReaderDemoActivity.java │ │ │ │ ├── RefreshModeDemoActivity.java │ │ │ │ ├── SampleApplication.java │ │ │ │ ├── ScreensaverActivity.java │ │ │ │ ├── WebViewOptimizeActivity.java │ │ │ │ ├── data │ │ │ │ └── GObject.java │ │ │ │ ├── factory │ │ │ │ └── FrontLightFactory.java │ │ │ │ ├── model │ │ │ │ ├── BaseLightModel.java │ │ │ │ ├── CTMAllLightModel.java │ │ │ │ ├── FLLightModel.java │ │ │ │ └── WarmAndColdLightModel.java │ │ │ │ └── utils │ │ │ │ ├── RawResourceUtil.java │ │ │ │ ├── RectUtils.java │ │ │ │ ├── RendererUtils.java │ │ │ │ └── StringUtils.java │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ ├── bg_common_button.xml │ │ │ ├── ic_launcher_background.xml │ │ │ ├── seekbar_progress.xml │ │ │ └── shape_corner.xml │ │ │ ├── layout │ │ │ ├── activity_app_optimize.xml │ │ │ ├── activity_boox_setting.xml │ │ │ ├── activity_dictquery.xml │ │ │ ├── activity_eac_demo.xml │ │ │ ├── activity_environment_demo.xml │ │ │ ├── activity_epd_demo.xml │ │ │ ├── activity_front_light_demo.xml │ │ │ ├── activity_full_screen_demo.xml │ │ │ ├── activity_main.xml │ │ │ ├── activity_note_demo.xml │ │ │ ├── activity_open_kcb.xml │ │ │ ├── activity_open_setting.xml │ │ │ ├── activity_ota_demo.xml │ │ │ ├── activity_reader_demo.xml │ │ │ ├── activity_refresh_mode_demo.xml │ │ │ ├── activity_screen_saver.xml │ │ │ ├── activity_scribble_hwr_demo.xml │ │ │ ├── activity_scribble_save_points_demo.xml │ │ │ ├── activity_scribble_state_demo.xml │ │ │ ├── activity_scribble_surfaceview_stylus_demo.xml │ │ │ ├── activity_scribble_touch_helper_stylus_demo.xml │ │ │ ├── activity_scribble_touch_screen_demo.xml │ │ │ └── activity_webview_optimize.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.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 │ │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ │ └── xml │ │ │ └── file_paths.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── onyx │ │ └── android │ │ └── sample │ │ └── ExampleUnitTest.java ├── OnyxPenDemo │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── onyx │ │ │ └── android │ │ │ └── eink │ │ │ └── pen │ │ │ └── demo │ │ │ ├── DemoApplication.java │ │ │ ├── PenBundle.java │ │ │ ├── PenManager.java │ │ │ ├── action │ │ │ ├── BaseAction.java │ │ │ ├── CommonPenAction.java │ │ │ ├── PopupChangeAction.java │ │ │ ├── RefreshScreenAction.java │ │ │ ├── StrokeColorChangeAction.java │ │ │ ├── StrokeStyleChangeAction.java │ │ │ └── StrokeWidthChangeAction.java │ │ │ ├── bean │ │ │ └── EraseArgs.java │ │ │ ├── data │ │ │ ├── InteractiveMode.java │ │ │ ├── ShapeFactory.java │ │ │ ├── ShapeTexture.java │ │ │ ├── ShapeType.java │ │ │ └── StrokeColor.java │ │ │ ├── event │ │ │ ├── ActivityFocusChangedEvent.java │ │ │ ├── ApplyFastModeEvent.java │ │ │ ├── FloatButtonChangedEvent.java │ │ │ ├── FloatButtonMenuStateChangedEvent.java │ │ │ ├── FloatMenuStateChangeEvent.java │ │ │ ├── NotificationPanelChangeEvent.java │ │ │ ├── PenEvent.java │ │ │ ├── PopupWindowChangeEvent.java │ │ │ └── StatusBarChangeEvent.java │ │ │ ├── helper │ │ │ └── RendererHelper.java │ │ │ ├── receiver │ │ │ └── GlobalDeviceReceiver.java │ │ │ ├── render │ │ │ ├── BaseRenderer.java │ │ │ ├── EraseRenderer.java │ │ │ ├── NormalRenderer.java │ │ │ ├── PartialRefreshRenderer.java │ │ │ └── Renderer.java │ │ │ ├── request │ │ │ ├── AddShapeRequest.java │ │ │ ├── AttachNoteViewRequest.java │ │ │ ├── BaseRequest.java │ │ │ ├── PartialRefreshRequest.java │ │ │ ├── PauseRawDrawingRenderRequest.java │ │ │ ├── PauseRawInputRenderRequest.java │ │ │ ├── RendererToScreenRequest.java │ │ │ ├── ResumeRawDrawingRequest.java │ │ │ ├── StrokeColorChangeRequest.java │ │ │ ├── StrokeErasingRequest.java │ │ │ ├── StrokeStyleChangeRequest.java │ │ │ ├── StrokeWidthChangeRequest.java │ │ │ └── StrokesEraseFinishedRequest.java │ │ │ ├── scribble │ │ │ ├── broadcast │ │ │ │ └── GlobalDeviceReceiver.java │ │ │ ├── request │ │ │ │ ├── PartialRefreshRequest.java │ │ │ │ └── RendererToScreenRequest.java │ │ │ ├── ui │ │ │ │ ├── ScribbleDemoActivity.java │ │ │ │ ├── ScribbleEpdControllerDemoActivity.java │ │ │ │ ├── ScribbleFingerTouchDemoActivity.java │ │ │ │ ├── ScribbleMoveEraserDemoActivity.java │ │ │ │ ├── ScribbleMultipleScribbleViewActivity.java │ │ │ │ ├── ScribblePenUpRefreshDemoActivity.java │ │ │ │ ├── ScribbleTouchHelperDemoActivity.java │ │ │ │ └── ScribbleWebViewDemoActivity.java │ │ │ └── util │ │ │ │ └── TouchUtils.java │ │ │ ├── shape │ │ │ ├── BrushScribbleShape.java │ │ │ ├── CharcoalScribbleShape.java │ │ │ ├── MarkerScribbleShape.java │ │ │ ├── NewBrushScribbleShape.java │ │ │ ├── NormalPencilShape.java │ │ │ └── Shape.java │ │ │ ├── ui │ │ │ ├── MainActivity.java │ │ │ ├── PenDemoActivity.java │ │ │ ├── popup │ │ │ │ ├── BasePopup.java │ │ │ │ └── PenSettingPop.java │ │ │ └── view │ │ │ │ └── FloatingMenuDragHandler.java │ │ │ └── util │ │ │ ├── PenInfoUtils.java │ │ │ ├── RendererUtils.java │ │ │ └── ShapeUtils.java │ │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── bg_button_click_solid.xml │ │ ├── border_black_2dp.xml │ │ ├── ic_charcoal_pen.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_marker_pen.xml │ │ ├── ic_pen_fountain.xml │ │ ├── ic_pen_hard.xml │ │ ├── ic_pen_soft.xml │ │ ├── ic_width_minus_circle.xml │ │ ├── ic_width_plus_circle.xml │ │ └── scribble_back_ground_grid.png │ │ ├── layout │ │ ├── activity_finger_touch_helper_demo.xml │ │ ├── activity_main.xml │ │ ├── activity_pen_demo.xml │ │ ├── activity_pen_stylus_touch_helper_demo.xml │ │ ├── activity_pen_up_refresh_demo.xml │ │ ├── activity_scribble_epd_controller_demo.xml │ │ ├── activity_scribble_move_erase_stylus_demo.xml │ │ ├── activity_scribble_multiple_scrubble_view_demo.xml │ │ ├── activity_scribble_webview_stylus_demo.xml │ │ ├── activity_sribble_demo.xml │ │ ├── layout_erase_setting_pop.xml │ │ ├── layout_float_menu.xml │ │ ├── layout_float_menu_vertical.xml │ │ ├── layout_pen_setting_pop.xml │ │ └── layout_pen_setting_pop_brush_item.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.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 │ │ ├── raw │ │ └── demo.html │ │ ├── values-zh-rCN │ │ └── strings.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml └── moreApps │ └── daydreamdemo │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── onyx │ │ └── daydreamdemo │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── onyx │ │ │ └── daydreamdemo │ │ │ ├── ImageDayDream.java │ │ │ ├── MainActivity.java │ │ │ ├── service │ │ │ └── MyDreamService.java │ │ │ └── utils │ │ │ ├── ReflectUtils.java │ │ │ └── ScreenUtils.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── layout_daydream.xml │ │ └── layout_image_daydream.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.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 │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── onyx │ └── daydreamdemo │ └── ExampleUnitTest.java ├── build.gradle ├── doc ├── AppOpenGuide.md ├── DPI-and-DP-for-each-devices.asciidoc ├── DeviceEnvironment.md ├── DictionaryUtils-API.md ├── EPD-Screen-Update.md ├── EPD-Touch.md ├── EPD-Update-Mode.md ├── Eink-Develop-Guide.md ├── Eink-Develop-Guide_zh.md ├── EpdController.md ├── EpdDeviceManager.md ├── FrontLightController.md ├── Home.md ├── Onyx-Base-SDK.md ├── Onyx-Data-SDK.md ├── Onyx-Pen-SDK.md ├── Onyx-Scribble-SDK.md ├── Scribble-API.md └── Scribble-TouchHelper-API.md ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.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/OnyxAndroidDemo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 30 5 | buildToolsVersion "29.0.2" 6 | dataBinding { 7 | enabled = true 8 | } 9 | defaultConfig { 10 | applicationId "com.android.onyx.demo" 11 | minSdkVersion 23 12 | targetSdkVersion 30 13 | versionCode 1 14 | versionName "1.0" 15 | multiDexEnabled true 16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 17 | 18 | javaCompileOptions { 19 | annotationProcessorOptions { 20 | includeCompileClasspath = true 21 | arguments=['targetModuleName':'Scribble'] 22 | } 23 | } 24 | 25 | ndk { 26 | abiFilters "armeabi-v7a" 27 | } 28 | } 29 | buildTypes { 30 | release { 31 | minifyEnabled false 32 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 33 | } 34 | } 35 | 36 | lintOptions { 37 | abortOnError false 38 | } 39 | 40 | packagingOptions { 41 | pickFirst 'lib/*/libc++_shared.so' 42 | pickFirst 'androidsupportmultidexversion.txt' 43 | } 44 | 45 | compileOptions { 46 | sourceCompatibility 1.8 47 | targetCompatibility 1.8 48 | } 49 | } 50 | 51 | dependencies { 52 | implementation fileTree(dir: 'libs', include: ['*.jar']) 53 | implementation 'com.android.support:appcompat-v7:28.0.0' 54 | testImplementation 'junit:junit:4.12' 55 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 56 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 57 | 58 | implementation('com.onyx.android.sdk:onyxsdk-device:1.3.0') 59 | implementation('com.onyx.android.sdk:onyxsdk-pen:1.4.10.1') 60 | 61 | implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3' 62 | 63 | implementation "com.android.support:multidex:1.0.3" 64 | api "com.android.support.constraint:constraint-layout:1.1.3" 65 | 66 | 67 | annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:4.2.4" 68 | implementation "com.github.Raizlabs.DBFlow:dbflow-core:4.2.4" 69 | implementation "com.github.Raizlabs.DBFlow:dbflow:4.2.4" 70 | } 71 | -------------------------------------------------------------------------------- /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/OnyxAndroidDemo/src/androidTest/java/com/onyx/android/sample/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.onyx.android.sample; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.onyx.android.demo", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 44 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/AppOptimizeActivity.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.view.View; 8 | import android.widget.Button; 9 | import android.widget.EditText; 10 | 11 | 12 | import androidx.databinding.DataBindingUtil; 13 | 14 | 15 | import com.onyx.android.demo.R; 16 | import com.onyx.android.demo.databinding.ActivityAppOptimizeBinding; 17 | 18 | /** 19 | * Created by Administrator on 2018/3/26 17:35. 20 | */ 21 | 22 | public class AppOptimizeActivity extends Activity { 23 | private EditText etIsFull; 24 | private EditText etPkgName; 25 | private Button btnSendBroadcast; 26 | private ActivityAppOptimizeBinding binding; 27 | 28 | @Override 29 | protected void onCreate(@Nullable Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | binding = DataBindingUtil.setContentView(this, R.layout.activity_app_optimize); 32 | 33 | 34 | } 35 | 36 | public void onClick(View v) { 37 | boolean isfull; 38 | String isfullTxt = etIsFull.getText().toString(); 39 | if (isfullTxt.equals("false")) { 40 | isfull = false; 41 | } else { 42 | isfull = true; 43 | } 44 | String pkgnameTxt = etPkgName.getText().toString(); 45 | Intent intent = new Intent(); 46 | intent.setAction("com.onyx.app.optimize.setting"); 47 | intent.putExtra("optimize_fullScreen", isfull); 48 | intent.putExtra("optimize_pkgName", pkgnameTxt); 49 | sendBroadcast(intent); 50 | } 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/BooxSettingsDemoActivity.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.widget.CompoundButton; 6 | 7 | import androidx.databinding.DataBindingUtil; 8 | import androidx.databinding.ObservableBoolean; 9 | 10 | import com.onyx.android.demo.R; 11 | import com.onyx.android.demo.databinding.ActivityBooxSettingBinding; 12 | import com.onyx.android.sdk.api.device.GlobalContrastController; 13 | import com.onyx.android.sdk.utils.SystemPropertiesUtil; 14 | 15 | public class BooxSettingsDemoActivity extends AppCompatActivity { 16 | 17 | private ActivityBooxSettingBinding binding; 18 | public ObservableBoolean isHighContrastEnabled = new ObservableBoolean(); 19 | public ObservableBoolean supportHighContrast = new ObservableBoolean(); 20 | 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | binding = DataBindingUtil.setContentView(this, R.layout.activity_boox_setting); 25 | binding.setActivity(this); 26 | updateData(); 27 | } 28 | 29 | private void updateData() { 30 | isHighContrastEnabled.set(GlobalContrastController.isHighContrastEnabled()); 31 | supportHighContrast.set(SystemPropertiesUtil.isPhone() || SystemPropertiesUtil.isTablet()); 32 | } 33 | 34 | /** 35 | * {@link GlobalContrastController#isHighContrastEnabled()} 36 | * {@link GlobalContrastController#setHighContrastEnabled(boolean)} 37 | * Please be careful not to call it directly during the initial lifecycle of the application when using it, as this may cause incorrect results.You can use {@link android.view.View#post(Runnable)} call it. 38 | */ 39 | public void onHighContrastCheckedChanged(CompoundButton view, boolean isChecked) { 40 | GlobalContrastController.setHighContrastEnabled(isChecked); 41 | isHighContrastEnabled.set(isChecked); 42 | } 43 | } -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/EnvironmentDemoActivity.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo; 2 | 3 | import android.os.Bundle; 4 | import android.os.Environment; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.widget.TextView; 7 | 8 | import androidx.databinding.DataBindingUtil; 9 | 10 | import com.onyx.android.demo.R; 11 | import com.onyx.android.demo.databinding.ActivityEnvironmentDemoBinding; 12 | import com.onyx.android.sdk.api.device.DeviceEnvironment; 13 | 14 | public class EnvironmentDemoActivity extends AppCompatActivity { 15 | private ActivityEnvironmentDemoBinding binding; 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | binding = DataBindingUtil.setContentView(this, R.layout.activity_environment_demo); 21 | 22 | binding.textViewFlashPath.setText(Environment.getExternalStorageDirectory().getAbsolutePath()); 23 | binding.textViewFlashState.setText(Environment.getExternalStorageState()); 24 | binding.textViewSdCardPath.setText(DeviceEnvironment.getRemovableSDCardDirectory().getAbsolutePath()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /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/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/FullScreenDemoActivity.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 | 7 | import androidx.databinding.DataBindingUtil; 8 | 9 | import com.onyx.android.demo.R; 10 | import com.onyx.android.demo.databinding.ActivityFullScreenDemoBinding; 11 | import com.onyx.android.sdk.utils.DeviceUtils; 12 | 13 | 14 | public class FullScreenDemoActivity extends AppCompatActivity { 15 | private ActivityFullScreenDemoBinding binding; 16 | 17 | protected void onCreate(Bundle savedInstanceState) { 18 | 19 | super.onCreate(savedInstanceState); 20 | binding = DataBindingUtil.setContentView(this, R.layout.activity_full_screen_demo); 21 | 22 | } 23 | 24 | public void switchFullScreen(View v) { 25 | boolean fullscreen = !DeviceUtils.isFullScreen(this); 26 | DeviceUtils.setFullScreenOnResume(this, fullscreen); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.View; 7 | 8 | import androidx.databinding.DataBindingUtil; 9 | 10 | import com.onyx.android.demo.R; 11 | import com.onyx.android.demo.databinding.ActivityMainBinding; 12 | import com.onyx.android.sdk.api.device.epd.EpdController; 13 | 14 | 15 | public class MainActivity extends AppCompatActivity { 16 | private ActivityMainBinding binding; 17 | 18 | @Override 19 | protected void onCreate(Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | binding = DataBindingUtil.setContentView(this, R.layout.activity_main); 22 | final View view = binding.getRoot(); 23 | binding.setActivityMain(this); 24 | EpdController.enablePost(view, 1); 25 | } 26 | 27 | public void button_epd(View view) { 28 | go(EpdDemoActivity.class); 29 | } 30 | 31 | public void button_front_light(View view) { 32 | go(FrontLightDemoActivity.class); 33 | } 34 | 35 | public void button_full_screen(View view) { 36 | go(FullScreenDemoActivity.class); 37 | } 38 | 39 | public void button_environment(View view) { 40 | go(EnvironmentDemoActivity.class); 41 | } 42 | 43 | public void btn_dict_query(View view) { 44 | go(DictionaryActivity.class); 45 | } 46 | 47 | public void btn_reader(View view) { 48 | go(ReaderDemoActivity.class); 49 | } 50 | 51 | public void btn_screen_saver(View view) { 52 | go(ScreensaverActivity.class); 53 | } 54 | 55 | public void btn_open_setting(View view) { 56 | go(OpenSettingActivity.class); 57 | } 58 | 59 | public void btn_webview_optimize(View view) { 60 | go(WebViewOptimizeActivity.class); 61 | } 62 | 63 | public void btn_open_kcb(View view) { 64 | go(OpenKcbActivity.class); 65 | } 66 | 67 | public void btn_open_ota(View view) { 68 | go(OTADemoActivity.class); 69 | } 70 | 71 | public void onClickButtonRefreshMode(View view) { 72 | go(RefreshModeDemoActivity.class); 73 | } 74 | 75 | public void onClickButtonEacDemo(View view) { 76 | go(EacDemoActivity.class); 77 | } 78 | 79 | public void openBooxSettingDemo(View view) { 80 | go(BooxSettingsDemoActivity.class); 81 | } 82 | 83 | private void go(Class activityClass) { 84 | startActivity(new Intent(this, activityClass)); 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/OTADemoActivity.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.View; 7 | import android.widget.EditText; 8 | 9 | 10 | import androidx.databinding.DataBindingUtil; 11 | 12 | import com.onyx.android.demo.R; 13 | import com.onyx.android.demo.databinding.ActivityOtaDemoBinding; 14 | import com.onyx.android.sdk.api.data.model.FirmwareBean; 15 | import com.onyx.android.sdk.api.device.OTAManager; 16 | import com.onyx.android.sdk.rx.RxUtils; 17 | import com.onyx.android.sdk.utils.JSONUtils; 18 | 19 | import java.util.concurrent.Callable; 20 | 21 | import io.reactivex.functions.Consumer; 22 | 23 | /** 24 | * Created by seeksky on 2018/5/17. 25 | */ 26 | 27 | public class OTADemoActivity extends AppCompatActivity { 28 | private ActivityOtaDemoBinding binding; 29 | 30 | @Override 31 | protected void onCreate(@Nullable Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | binding = DataBindingUtil.setContentView(this, R.layout.activity_ota_demo); 34 | binding.setActivityOta(this); 35 | initData(); 36 | } 37 | 38 | private void initData() { 39 | RxUtils.runWithInComputation(new Callable() { 40 | @Override 41 | public FirmwareBean call() throws Exception { 42 | return getCurrentFirmwareInfo(); 43 | } 44 | }, new Consumer() { 45 | @Override 46 | public void accept(FirmwareBean firmwareBean) throws Exception { 47 | if (firmwareBean != null) { 48 | binding.tvFirmwareInfo.setText(JSONUtils.toJson(firmwareBean)); 49 | } 50 | } 51 | }); 52 | } 53 | 54 | @Override 55 | protected void onDestroy() { 56 | super.onDestroy(); 57 | } 58 | 59 | public void onOTAUpdate(View view) { 60 | EditText editText = binding.edittextOtaPackagePath; 61 | String path = editText.getText().toString(); 62 | //TODO 63 | //OTAManager.startFirmwareUpdate(this, path); 64 | } 65 | 66 | private FirmwareBean getCurrentFirmwareInfo() { 67 | return OTAManager.getCurrentFirmware(this); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/OpenSettingActivity.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo; 2 | 3 | import android.content.ComponentName; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.view.View; 8 | 9 | import android.widget.Toast; 10 | 11 | import androidx.databinding.DataBindingUtil; 12 | 13 | import com.onyx.android.demo.R; 14 | import com.onyx.android.demo.databinding.ActivityOpenSettingBinding; 15 | 16 | 17 | public class OpenSettingActivity extends AppCompatActivity { 18 | private ActivityOpenSettingBinding binding; 19 | 20 | private static final String PACKAGE_NAME = "com.onyx"; 21 | private static final String ACTIVITY_KCB_SETTING = "com.onyx.common.setting.ui.SettingContainerActivity"; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | binding = DataBindingUtil.setContentView(this, R.layout.activity_open_setting); 27 | binding.setActivityOpenSetting(this); 28 | } 29 | 30 | public void openNetwork(View view) { 31 | openActivity(PACKAGE_NAME, ACTIVITY_KCB_SETTING, "onyx.settings.action.network"); 32 | } 33 | 34 | public void openDateTime(View view) { 35 | openActivity(PACKAGE_NAME, ACTIVITY_KCB_SETTING, "onyx.settings.action.datetime"); 36 | } 37 | 38 | private void openActivity(String pkgName, String className, String action) { 39 | try { 40 | Intent intent = new Intent(action); 41 | ComponentName componentName = new ComponentName(pkgName, className); 42 | intent.setComponent(componentName); 43 | startActivity(intent); 44 | } catch (Exception e) { 45 | e.printStackTrace(); 46 | Toast.makeText(getApplicationContext(), "open settings failed!", Toast.LENGTH_SHORT).show(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/RefreshModeDemoActivity.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.widget.RadioGroup; 7 | 8 | import androidx.databinding.DataBindingUtil; 9 | 10 | import com.onyx.android.demo.R; 11 | import com.onyx.android.demo.databinding.ActivityRefreshModeDemoBinding; 12 | import com.onyx.android.sdk.api.device.epd.UpdateOption; 13 | import com.onyx.android.sdk.device.Device; 14 | 15 | 16 | public class RefreshModeDemoActivity extends AppCompatActivity implements RadioGroup.OnCheckedChangeListener { 17 | 18 | private static final String TAG = RefreshModeDemoActivity.class.getSimpleName(); 19 | 20 | private ActivityRefreshModeDemoBinding binding; 21 | 22 | @Override 23 | protected void onCreate(@Nullable Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | binding = DataBindingUtil.setContentView(this, R.layout.activity_refresh_mode_demo); 26 | 27 | initData(); 28 | binding.rgRefreshMode.setOnCheckedChangeListener(this); 29 | } 30 | 31 | private void initData() { 32 | UpdateOption updateOption = Device.currentDevice().getAppScopeRefreshMode(); 33 | binding.rgRefreshMode.check(getRadioButtonIdByUpdateOption(updateOption)); 34 | } 35 | 36 | @Override 37 | public void onCheckedChanged(RadioGroup radioGroup, int checkedId) { 38 | switch (checkedId) { 39 | case R.id.rb_normal: 40 | Device.currentDevice().setAppScopeRefreshMode(UpdateOption.NORMAL); 41 | break; 42 | case R.id.rb_fast_quality: 43 | Device.currentDevice().setAppScopeRefreshMode(UpdateOption.FAST_QUALITY); 44 | break; 45 | case R.id.rb_regal: 46 | Device.currentDevice().setAppScopeRefreshMode(UpdateOption.REGAL); 47 | break; 48 | case R.id.rb_fast: 49 | Device.currentDevice().setAppScopeRefreshMode(UpdateOption.FAST); 50 | break; 51 | case R.id.rb_fast_x: 52 | Device.currentDevice().setAppScopeRefreshMode(UpdateOption.FAST_X); 53 | break; 54 | } 55 | } 56 | 57 | public int getRadioButtonIdByUpdateOption(UpdateOption updateOption) { 58 | switch (updateOption) { 59 | case NORMAL: 60 | return R.id.rb_normal; 61 | case FAST_QUALITY: 62 | return R.id.rb_fast_quality; 63 | case FAST: 64 | return R.id.rb_fast; 65 | case FAST_X: 66 | return R.id.rb_fast_x; 67 | case REGAL: 68 | return R.id.rb_regal; 69 | } 70 | return -1; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /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/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/ScreensaverActivity.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.widget.Toast; 7 | 8 | import androidx.annotation.NonNull; 9 | import androidx.databinding.DataBindingUtil; 10 | import androidx.databinding.ObservableBoolean; 11 | 12 | import com.onyx.android.demo.R; 13 | import com.onyx.android.demo.databinding.ActivityScreenSaverBinding; 14 | import com.onyx.android.sdk.api.device.screensaver.ScreenResourceManager; 15 | 16 | 17 | public class ScreensaverActivity extends AppCompatActivity { 18 | private ActivityScreenSaverBinding binding; 19 | public ObservableBoolean supportWallpaper = new ObservableBoolean(); 20 | public ObservableBoolean supportSetShutdown = new ObservableBoolean(); 21 | 22 | @Override 23 | protected void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | binding = DataBindingUtil.setContentView(this, R.layout.activity_screen_saver); 26 | binding.setActivityScreenSaver(this); 27 | initData(); 28 | } 29 | 30 | private void initData() { 31 | supportWallpaper.set(ScreenResourceManager.supportWallpaperSetting()); 32 | supportSetShutdown.set(ScreenResourceManager.supportShutdownSetting()); 33 | } 34 | 35 | public void setScreensaver(View view) { 36 | boolean success = ScreenResourceManager.setScreensaver(this, getFilePath(), true); 37 | if (!success) { 38 | Toast.makeText(this, "Set screensaver failed, detailed information can be found in the logs.", Toast.LENGTH_LONG).show(); 39 | } 40 | } 41 | 42 | public void setShutdown(View view) { 43 | boolean success = ScreenResourceManager.setShutdown(this, getFilePath(), true); 44 | if (!success) { 45 | Toast.makeText(this, "Set shutdown failed, detailed information can be found in the logs.", Toast.LENGTH_LONG).show(); 46 | } 47 | } 48 | 49 | public void setWallpaper(View view) { 50 | boolean success = ScreenResourceManager.setWallpaper(this, getFilePath(), true); 51 | if (!success) { 52 | Toast.makeText(this, "Set wallpaper failed, detailed information can be found in the logs.", Toast.LENGTH_LONG).show(); 53 | } 54 | } 55 | 56 | @NonNull 57 | private String getFilePath() { 58 | return binding.etImage.getText().toString(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /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/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/factory/FrontLightFactory.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo.factory; 2 | 3 | import android.content.Context; 4 | 5 | import com.android.onyx.demo.model.BaseLightModel; 6 | import com.android.onyx.demo.model.CTMAllLightModel; 7 | import com.android.onyx.demo.model.FLLightModel; 8 | import com.android.onyx.demo.model.WarmAndColdLightModel; 9 | import com.onyx.android.sdk.api.device.brightness.BrightnessController; 10 | 11 | public class FrontLightFactory { 12 | 13 | public static BaseLightModel createLightModel(Context context) { 14 | BaseLightModel lightModel = null; 15 | switch (BrightnessController.getBrightnessType(context)) { 16 | case FL: 17 | lightModel = new FLLightModel(context); 18 | break; 19 | case WARM_AND_COLD: 20 | lightModel = new WarmAndColdLightModel(context); 21 | break; 22 | case CTM: 23 | lightModel = new CTMAllLightModel(context); 24 | break; 25 | case NONE: 26 | default: 27 | break; 28 | } 29 | return lightModel; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/model/BaseLightModel.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo.model; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.database.ContentObserver; 6 | import android.provider.Settings; 7 | import android.view.View; 8 | import android.widget.SeekBar; 9 | 10 | import com.onyx.android.demo.databinding.ActivityFrontLightDemoBinding; 11 | import com.onyx.android.sdk.api.device.brightness.BaseBrightnessProvider; 12 | import com.onyx.android.sdk.utils.RxTimerUtil; 13 | 14 | import java.util.concurrent.TimeUnit; 15 | 16 | public abstract class BaseLightModel { 17 | protected static final String TAG = "LightModel"; 18 | protected Context mContext; 19 | protected ActivityFrontLightDemoBinding binding; 20 | 21 | public BaseLightModel(Context mContext) { 22 | this.mContext = mContext; 23 | } 24 | 25 | public abstract void updateLightValue(); 26 | 27 | public abstract void initView(ActivityFrontLightDemoBinding binding); 28 | 29 | public void initSeekBar(SeekBar seekBar, BaseBrightnessProvider provider) { 30 | seekBar.setMax(provider.getMaxIndex()); 31 | seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { 32 | @Override 33 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { 34 | if (fromUser) { 35 | provider.setIndex(progress); 36 | } 37 | } 38 | 39 | @Override 40 | public void onStartTrackingTouch(SeekBar seekBar) { 41 | 42 | } 43 | 44 | @Override 45 | public void onStopTrackingTouch(SeekBar seekBar) { 46 | 47 | } 48 | }); 49 | seekBar.setProgress(provider.getIndex()); 50 | } 51 | 52 | public void showBrightnessSetting(View view) { 53 | mContext.sendBroadcast(new Intent("action.show.brightness.dialog")); 54 | } 55 | 56 | public void delay(RxTimerUtil.TimerObserver timerObserver) { 57 | RxTimerUtil.timer(100, TimeUnit.MILLISECONDS, timerObserver); 58 | } 59 | 60 | public void registerObserver(String key, ContentObserver contentObserver) { 61 | mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(key), false, contentObserver); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/model/FLLightModel.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo.model; 2 | 3 | import android.content.Context; 4 | import android.database.ContentObserver; 5 | import android.util.Log; 6 | import android.view.View; 7 | 8 | import androidx.databinding.ObservableInt; 9 | 10 | import com.onyx.android.demo.databinding.ActivityFrontLightDemoBinding; 11 | import com.onyx.android.sdk.api.device.brightness.BaseBrightnessProvider; 12 | import com.onyx.android.sdk.api.device.brightness.BrightnessController; 13 | import com.onyx.android.sdk.device.BaseDevice; 14 | import com.onyx.android.sdk.utils.RxTimerUtil; 15 | 16 | public class FLLightModel extends BaseLightModel { 17 | private static final String KEY_FL_BRIGHTNESS_STATE = "screen_brightness"; 18 | private static final String KEY_FL_BRIGHTNESS = "screen_cold_brightness"; 19 | 20 | private BaseBrightnessProvider flProvider; 21 | 22 | public ObservableInt lightValue = new ObservableInt(){ 23 | @Override 24 | public int get() { 25 | if (flProvider == null) { 26 | return 0; 27 | } 28 | return flProvider.getIndex(); 29 | } 30 | }; 31 | 32 | public FLLightModel(Context mContext) { 33 | super(mContext); 34 | } 35 | 36 | @Override 37 | public void updateLightValue() { 38 | lightValue.notifyChange(); 39 | } 40 | 41 | @Override 42 | public void initView(ActivityFrontLightDemoBinding binding) { 43 | this.binding = binding; 44 | binding.setFlLightModel(this); 45 | binding.flContainer.setVisibility(View.VISIBLE); 46 | flProvider = BrightnessController.getBrightnessProvider(mContext, BaseDevice.LIGHT_TYPE_FL); 47 | initSeekBar(binding.flBrightnessSeek, flProvider); 48 | 49 | registerObserver(KEY_FL_BRIGHTNESS, new ContentObserver(null) { 50 | @Override 51 | public void onChange(boolean selfChange) { 52 | lightValue.notifyChange(); 53 | } 54 | }); 55 | registerObserver(KEY_FL_BRIGHTNESS_STATE, new ContentObserver(null) { 56 | @Override 57 | public void onChange(boolean selfChange) { 58 | Log.i(TAG, "Cold brightness light on: " + flProvider.isLightOn()); 59 | } 60 | }); 61 | } 62 | 63 | public void toggleFLLight() { 64 | flProvider.toggle(); 65 | delay(new RxTimerUtil.TimerObserver() { 66 | @Override 67 | public void onNext(Long aLong) { 68 | updateLightValue(); 69 | } 70 | }); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/java/com/android/onyx/demo/utils/RendererUtils.java: -------------------------------------------------------------------------------- 1 | package com.android.onyx.demo.utils; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Color; 5 | import android.graphics.Paint; 6 | import android.graphics.Rect; 7 | import android.view.SurfaceView; 8 | 9 | public class RendererUtils { 10 | 11 | public static void renderBackground(Canvas canvas, 12 | Rect viewRect) { 13 | RendererUtils.clearBackground(canvas, new Paint(), viewRect); 14 | } 15 | 16 | public static Rect checkSurfaceView(SurfaceView surfaceView) { 17 | if (surfaceView == null || !surfaceView.getHolder().getSurface().isValid()) { 18 | return null; 19 | } 20 | return new Rect(0, 0, surfaceView.getWidth(), surfaceView.getHeight()); 21 | } 22 | 23 | public static void clearBackground(final Canvas canvas, final Paint paint, final Rect rect) { 24 | paint.setStyle(Paint.Style.FILL); 25 | paint.setColor(Color.WHITE); 26 | canvas.drawRect(rect, paint); 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/drawable/bg_common_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/drawable/seekbar_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 22 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/drawable/shape_corner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/OnyxAndroidDemo/src/main/res/layout/activity_app_optimize.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 13 | 14 | 19 | 20 | 21 | 27 | 28 | 34 | 35 | 36 | 36 | 37 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/values-zh-rCN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 笔刷 3 | 擦除 4 | 擦除轨迹 5 | 抬笔刷新 6 | 颜色 7 | 纹理 8 | 线宽 9 | 10 | 钢笔 11 | 毛笔 12 | 圆珠笔 13 | 马克笔 14 | 铅笔 15 | 16 | 黑色 17 | 灰色 18 | 绿色 19 | 红色 20 | 蓝色 21 | 22 | 纹理1 23 | 纹理2 24 | 25 | 移动擦除 26 | 区域擦除 27 | 笔画擦除 28 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 400dp 4 | 16dp 5 | 16dp 6 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | OnyxPenDemo 3 | Brush 4 | Eraser 5 | Erasing Track 6 | Pen Up Refresh 7 | Color 8 | Texture 9 | Line width 10 | 11 | Pen 12 | Brush Pen 13 | Ballpoint Pen 14 | Marker 15 | Pencil 16 | 17 | Black 18 | Gray 19 | Green 20 | Red 21 | Blue 22 | 23 | Texture One 24 | Texture Two 25 | 26 | Move Eraser 27 | Lasso Eraser 28 | Stroke Eraser 29 | 30 | ok 31 | This is a test tile 32 | This is a test message.\nIn handwriting state, the screen will be locked. If the page view changed, you need to pause the handwriting first. 33 | -------------------------------------------------------------------------------- /app/OnyxPenDemo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 16 | 17 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/androidTest/java/com/onyx/daydreamdemo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.onyx.daydreamdemo; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 23 | 24 | assertEquals("com.onyx.daydreamdemo", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /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/java/com/onyx/daydreamdemo/service/MyDreamService.java: -------------------------------------------------------------------------------- 1 | package com.onyx.daydreamdemo.service; 2 | 3 | import android.service.dreams.DreamService; 4 | 5 | import com.onyx.android.sdk.common.request.WakeLockHolder; 6 | import com.onyx.android.sdk.utils.RxTimerUtil; 7 | import com.onyx.daydreamdemo.ImageDayDream; 8 | import com.onyx.daydreamdemo.utils.ReflectUtils; 9 | 10 | import java.lang.reflect.Method; 11 | 12 | public class MyDreamService extends DreamService { 13 | 14 | private static final long DOZE_DELAY_MILLIS = 1200; 15 | private static final long WAKELOCK_DURATION_MILLIS = DOZE_DELAY_MILLIS + 500; 16 | 17 | private RxTimerUtil.TimerObserver startDozingTimer; 18 | private WakeLockHolder wakeLockHolder; 19 | private ImageDayDream dream; 20 | 21 | @Override 22 | public void onCreate() { 23 | super.onCreate(); 24 | 25 | dream = new ImageDayDream(this); 26 | wakeLockHolder = new WakeLockHolder(); 27 | startDozingTimer = new RxTimerUtil.TimerObserver() { 28 | @Override 29 | public void onNext(Long aLong) { 30 | invokeStartDozing(); 31 | } 32 | }; 33 | } 34 | 35 | @Override 36 | public void onAttachedToWindow() { 37 | super.onAttachedToWindow(); 38 | 39 | setInteractive(false); 40 | setFullscreen(true); 41 | 42 | setContentView(dream.getContentViewId()); 43 | } 44 | 45 | @Override 46 | public void onDreamingStarted() { 47 | super.onDreamingStarted(); 48 | 49 | dream.onDreamingStarted(); 50 | delayInvokeStartDozing(); 51 | } 52 | 53 | @Override 54 | public void onDreamingStopped() { 55 | super.onDreamingStopped(); 56 | 57 | dream.onDreamingStopped(); 58 | invokeStopDozing(); 59 | } 60 | 61 | private void delayInvokeStartDozing() { 62 | wakeLockHolder.acquireWakeLock(this, WakeLockHolder.FULL_FLAGS, getClass().getSimpleName(), (int) WAKELOCK_DURATION_MILLIS); 63 | RxTimerUtil.timer(DOZE_DELAY_MILLIS, startDozingTimer); 64 | } 65 | 66 | private void invokeStartDozing() { 67 | Method method = ReflectUtils.getDeclaredMethod(DreamService.class, "startDozing"); 68 | if (method != null) { 69 | ReflectUtils.invokeMethod(method, this); 70 | } 71 | } 72 | 73 | private void invokeStopDozing() { 74 | Method method = ReflectUtils.getDeclaredMethod(DreamService.class, "stopDozing"); 75 | if (method != null) { 76 | ReflectUtils.invokeMethod(method, this); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/java/com/onyx/daydreamdemo/utils/ReflectUtils.java: -------------------------------------------------------------------------------- 1 | package com.onyx.daydreamdemo.utils; 2 | 3 | import java.lang.reflect.Method; 4 | 5 | public class ReflectUtils { 6 | public static Method getDeclaredMethod(Class cls, String name, Class... parameterTypes) { 7 | try { 8 | Method method = cls.getDeclaredMethod(name, parameterTypes); 9 | if (method == null) { 10 | return null; 11 | } 12 | method.setAccessible(true); 13 | return method; 14 | } catch (Throwable tr) { 15 | return null; 16 | } 17 | } 18 | 19 | public static Object invokeMethod(Method method, Object receiver, Object... args) 20 | { 21 | try { 22 | return method.invoke(receiver, args); 23 | } catch (Throwable tr) { 24 | return null; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /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/moreApps/daydreamdemo/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/layout/layout_daydream.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/layout/layout_image_daydream.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/moreApps/daydreamdemo/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/moreApps/daydreamdemo/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/moreApps/daydreamdemo/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/moreApps/daydreamdemo/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/moreApps/daydreamdemo/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/moreApps/daydreamdemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/moreApps/daydreamdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/moreApps/daydreamdemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/moreApps/daydreamdemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/moreApps/daydreamdemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | 7 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DaydreamDemo 3 | 4 | -------------------------------------------------------------------------------- /app/moreApps/daydreamdemo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | mavenCentral() 7 | 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.6.2' 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | maven { url 'http://repo.boox.com/repository/proxy-public/' } 20 | maven { 21 | url "http://repo.boox.com/repository/maven-public/" 22 | } 23 | 24 | google() 25 | mavenCentral() 26 | maven { url "https://jitpack.io" } 27 | } 28 | } 29 | 30 | task clean(type: Delete) { 31 | delete rootProject.buildDir 32 | } 33 | -------------------------------------------------------------------------------- /doc/AppOpenGuide.md: -------------------------------------------------------------------------------- 1 | #### Open with ADB command ```adb shell am start -n ```, here list the component of some apps 2 | |App|component| 3 | |---|---| 4 | |Dictionary|com.onyx.dict/.activity.DictMainActivity| 5 | |Email|com.android.email/.activity.Welcome| 6 | |Calculator|com.onyx.calculator/.Calculator| 7 | |Browser|com.android.browser/.BrowserActivity| 8 | |Recorder|com.android.soundrecorder/.SoundRecorder| 9 | |Calender|com.android.calendar/.AllInOneActivity| 10 | |Clock|com.onyx.deskclock/.deskclock.DeskClock| 11 | |Music|com.onyx.music/.MusicBrowserActivity| 12 | |App Market|com.onyx.appmarket/.activity.AppMarketActivity| 13 | |Floating Button|com.onyx.floatingbutton/.FloatButtonSettingActivity| 14 | #### Exceptions 15 | * Book Shop: `am start -n com.onyx/.main.ui.MainActivity --es "json" "{'action':'OPEN_SHOP'}"` , Intent needs to carry a String whose key is `json` with content `{'action':'OPEN_SHOP'}` 16 | * Note: `am start -n com.onyx/.main.ui.MainActivity --es "json" "{'action':'OPEN_NOTE'}"` , Intent needs to carry a String whose key is `json` with content `{'action':'OPEN_NOTE'}` 17 | > Call this command after entering adb shell mode 18 | -------------------------------------------------------------------------------- /doc/DPI-and-DP-for-each-devices.asciidoc: -------------------------------------------------------------------------------- 1 | # calculation 2 | 3 | resolution width * 160 / dpi == > real and find the closest sw-dp, for example 4 | 1024x758 with 212 dpi returns 758 * 160 / 212 = 572 and use 480 finally. 5 | 6 | # list 7 | 8 | 9 | Resolution DPI real/sw-dp 10 | E43: 800x480 216 355/320 11 | C65-Pearl: 800x600 160 600/570 12 | C65: 1024x758 212 572/570 13 | C67: 1024x758 240 505/500 14 | T68: 1440x1080 265 652/640 15 | M96: 1200x825 160 825/800 16 | I86: 1600x1200 250 768/720 17 | E47: 800x480 240 480/320 18 | Kepler: 1448x1072 300 571.73334/570 19 | Max: 1600x1200 160 1200/1200 20 | PLColor: 640x480 160 480/480 21 | PL107: 1280x960 160 960/960 22 | max2: 2200x1650 212 1245/1200 23 | Note: 1872x1404 24 | 25 | 26 | sw-dp 计算公式: 27 | sw*160/dpi 计算出结果之后,选择一个比这个结果小,而又最接近这个值的dp。 28 | 比如 1280 * 960 根据公司 960 * 160 / 160 = 960 29 | -------------------------------------------------------------------------------- /doc/DeviceEnvironment.md: -------------------------------------------------------------------------------- 1 | Provide access to removable sdcard on the device 2 | 3 | DeviceEnvironment.getRemovableSDCardDirectory() -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /doc/EPD-Touch.md: -------------------------------------------------------------------------------- 1 | **This API add on onyxsdk-base 1.4.3 to use it ,upgrade it** 2 | 3 | [EpdController](./EpdController.md) provides API to enable and disable touch region on screen. 4 | 5 | 6 | ***Get touch function state*** 7 | 8 | ``` 9 | /** 10 | * 11 | * @param context 12 | * @return boolean 13 | * if true touch is disable, otherwise touch is enable 14 | */ 15 | boolean isCTPDisableRegion(Context context) 16 | ``` 17 | 18 | ***Set the region you want to disable touch*** 19 | 20 | there have two method to set regions, we suggested use first method: 21 | ``` 22 | /** 23 | * 24 | * @param context 25 | * @param disableRegions 26 | * the regions that you want to disable touch 27 | */ 28 | void setAppCTPDisableRegion(Context context, Rect[] disableRegions); 29 | ``` 30 | 31 | or use this 32 | 33 | ``` 34 | /** 35 | * 36 | * @param context 37 | * @param disableRegionArray 38 | * a array of rect which four point order by left, top, right, bottom 39 | */ 40 | void setAppCTPDisableRegion(Context context, int[] disableRegionArray) 41 | ``` 42 | 43 | 44 | 45 | ***Set the region you want to enable touch*** 46 | to exclude some region enable touch use this: 47 | ``` 48 | /** 49 | * 50 | * @param context 51 | * @param disableRegions 52 | the regions that you want to disable touch 53 | * @param excludeRegions 54 | * the regions that your want to exclude from disabled touch area 55 | */ 56 | void setAppCTPDisableRegion(Context context, Rect[] disableRegions, Rect[] excludeRegions)` 57 | ``` 58 | 59 | 60 | 61 | ***Reset the touch*** 62 | Reset touch function to default, default status is the screen can be touch. 63 | ``` 64 | /** 65 | * 66 | * @param context 67 | */ 68 | void appResetCTPDisableRegion(Context context) 69 | ``` 70 | -------------------------------------------------------------------------------- /doc/EPD-Update-Mode.md: -------------------------------------------------------------------------------- 1 | ## UpdateOption: 2 | 3 | * NORMAL 4 | 5 | Good display effect, suitable for general text reading. 6 | 7 | * FAST_QUALITY 8 | 9 | Slight ghosting, suitable for quickly skimming through images and text. 10 | 11 | * REGAL 12 | 13 | Minimal ghosting, slightly flickering on the dark backgrounds, suitable for light-colored backgrounds. 14 | 15 | * FAST 16 | 17 | Slightly heavier ghosting, suitable for scrolling images and text. 18 | 19 | * FAST_X 20 | 21 | Heavier loss of details, suitable for viewing webpage and playing videos. 22 | 23 | ## UpdateMode: 24 | 25 | * DU 26 | 27 | black/white screen update 28 | 29 | * DU_QUALITY 30 | 31 | optimized DU mode with dither 32 | 33 | * GU 34 | 35 | 16 level gray partial update 36 | 37 | * GU_FAST 38 | 39 | fast GU update mode, deprecated 40 | 41 | * GC 42 | 16 level gray full screen update 43 | 44 | * GC_4 45 | 46 | 4 level gray full screen update, deprecated 47 | 48 | * ANIMATION 49 | 50 | black/white screen update, faster than DU, but lower quality 51 | 52 | * ANIMATION_QUALITY 53 | 54 | optimized animation mode with dither 55 | 56 | * REGAL 57 | 58 | optimized 16 level partial update mode for text pages 59 | 60 | * REGAL_D 61 | 62 | same as REGAL now -------------------------------------------------------------------------------- /doc/Eink-Develop-Guide.md: -------------------------------------------------------------------------------- 1 | # UI/UX 2 | 3 | ## How to develop Apps for BOOX eink device 4 | 5 | Because of the eink feture, the refresh rate in eink device is much lower than normal LCD tablet, 6 | to ensure App runs smoothly and give users good using experience, we would like to provide following suggestion when develop Apps 7 | 8 | 1. Pls use black and white (16 level gray scale) as the main color of pages; 9 | If need to change the color for state switching, pls try to ensure that the color is in the 256 level gray scale. 10 | 2. Pls don’t add transparent layers on images or texts; 11 | 3. Pls use the page based way to load more contents; 12 | 4. Pls try to avoid animation, such as scrolling/dragging etc. 13 | 5. The font size should not be smaller than 14sp; 14 | If embed fonts are needed, pls use bold or bold as much as possible 15 | 6. Normally, the button icon in the central area should not be smaller than 36dp x 36dp. The button icon in the edge area should not be smaller than 48dp x 48dp. -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | ``` -------------------------------------------------------------------------------- /doc/EpdDeviceManager.md: -------------------------------------------------------------------------------- 1 | Wrapper of [EpdController](./EpdController.md) to provide uniform and simple [EPD Screen Update](./EPD-Screen-Update.md) interface for both RK3026 and IMX6 devices 2 | 3 | You can set partial and full screen update intervals by calling: 4 | 5 | ``` 6 | EpdDeviceManager.setGcInterval(THE_INTERVAL_YOU_WANT_TO_SET); 7 | ``` 8 | 9 | Then update screen with: 10 | 11 | ``` 12 | EpdDeviceManager.applyWithGCInterval(textView, isTextPage); 13 | ``` 14 | 15 | EpdDeviceManager will take care of device type and choose to use normal/regal partial screen update automatically. 16 | 17 | You can also force full screen update by calling: 18 | 19 | ``` 20 | EpdDeviceManager.applyGCUpdate(textView); 21 | ``` 22 | 23 | 24 | Enter/leave fast update mode: 25 | 26 | `EpdDeviceManager.enterAnimationUpdate(true);` 27 | 28 | `EpdDeviceManager.exitAnimationUpdate(true);` 29 | 30 | You can see sample code in [EpdDemoActivity](../app/src/main/java/com/android/onyx/demo/EpdDemoActivity.java) -------------------------------------------------------------------------------- /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) -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /doc/Onyx-Base-SDK.md: -------------------------------------------------------------------------------- 1 | Base SDK for Onyx-Intl Android E-Ink devices 2 | 3 | Latest version is 1.4.3.7, can be referenced with following gradle statement: 4 | ```gradle 5 | compile ('com.onyx.android.sdk:onyxsdk-base:1.4.3.7') 6 | ``` 7 | 8 | Change logs: 9 | * 1.4.3.7 10 | 11 | Add Dict Query API, for more detail to see [DictionaryUtils-API](./DictionaryUtils-API.md) 12 | * 1.4.3.4 13 | 14 | Add method `setWebViewContrastOptimize(WebView webview, boolean enable)` prevent webview enter A2 mode 15 | * 1.3.2 16 | 17 | Small improvements 18 | * 1.3.1 19 | 20 | Add OTAUtil and DeviceInfoUtil for onyxsdk-data ota 21 | * 1.3.0 22 | 23 | Expose public names for internal development convenience, for 3rdparty developers, it's recommended to use APIs inside com.onyx.android.sdk.api package which are more stable. 24 | * 1.2.4 25 | 26 | Small fixes 27 | * 1.2.3 28 | 29 | Add [EpdDeviceManager](./EpdDeviceManager.md) 30 | * 1.2.2 31 | 32 | Add [DeviceEnvironment](./DeviceEnvironment.md) 33 | * 1.2.1 34 | 35 | Add [Scribble API](./Scribble-API.md) to [EpdController](./EpdController.md) 36 | 37 | * 1.2.0 38 | 39 | First public version of SDK -------------------------------------------------------------------------------- /doc/Onyx-Data-SDK.md: -------------------------------------------------------------------------------- 1 | Data SDK for Onyx-Intl Android E-Ink devices 2 | 3 | Latest version is 1.0.1, can be referenced with following gradle statement: 4 | 5 | compile 'com.onyx.android.sdk:onyxsdk-base:1.3.7' 6 | compile 'com.onyx.android.sdk:onyxsdk-data:1.0.1' 7 | 8 | base need dependencies 9 | apt "com.github.Raizlabs.DBFlow:dbflow-processor:$rootProject.dbflowVersion" 10 | compile "com.github.Raizlabs.DBFlow:dbflow-core:$rootProject.dbflowVersion" 11 | compile "com.github.Raizlabs.DBFlow:dbflow:$rootProject.dbflowVersion" 12 | compile "org.apache.commons:commons-collections4:$rootProject.apachecommonsVersion" 13 | compile "com.alibaba:fastjson:$rootProject.fastjsonVersion" 14 | compile "com.squareup.retrofit2:retrofit:$rootProject.retrofit2Version" 15 | compile "com.liulishuo.filedownloader:library:$rootProject.filedownloaderVersion" 16 | compile "com.squareup.okhttp:okhttp-urlconnection:$rootProject.okhttpurlconnectionVersion" 17 | compile "com.aliyun.dpa:oss-android-sdk:$rootProject.aliyunOssSdkVersion" 18 | compile "com.tencent.mm.opensdk:wechat-sdk-android-with-mta:$rootProject.wechatSdkWithMtaVersion" 19 | 20 | Change logs:. 21 | * 1.0.1 22 | Add onyxsdk-data for WechatManager/OssManager/FileDownloader/OTAManager/part Request -------------------------------------------------------------------------------- /doc/Onyx-Scribble-SDK.md: -------------------------------------------------------------------------------- 1 | Scribble SDK for devices with stylus. 2 | 3 | Latest version is 1.0.8, can be referenced with following gradle statement: 4 | 5 | compile 'com.onyx.android.sdk:onyxsdk-scribble:1.0.8' 6 | 7 | For onyxsdk-scribble SDK, dbflow library is inside the jitpack, so you have to add the following statement to your project build.gradle: 8 | ```gradle 9 | maven { url "https://jitpack.io" } 10 | ``` 11 | 12 | `TouchHelper` is the latest api that you can scribble with stylus. You should call it.For more detailed usage, check out it out [here](Scribble-TouchHelper-API.md) 13 | 14 | # Change logs 15 | 16 | ## 1.0.8 17 | 1. Remove `initRawDrawing()` (use `openRawDrawing()` instead): Turn on scribble and initialize resources. 18 | 2. Add `closeRawDrawing()`: Turn off scribble and release resources. Unlock the screen, screen can refresh. 19 | 3. Add `setRawDrawingEnabled(boolean enable)`: Set true, you enter scribble mode, and the screen will not refresh. 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app:OnyxAndroidDemo' 2 | include ':app:OnyxPenDemo' 3 | include ':app:moreApps:daydreamdemo' 4 | --------------------------------------------------------------------------------