shapes){
27 | this.shapes.addAll(shapes);
28 | return this;
29 | }
30 |
31 | @Override
32 | public void execute(PenManager penManager) throws Exception {
33 | penManager.activeRenderMode(InteractiveMode.SCRIBBLE);
34 | penManager.getDrawShape().addAll(shapes);
35 | penManager.renderToBitmap(shapes);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/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/request/BaseRequest.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.sdk.rx.RxRequest;
7 |
8 | public abstract class BaseRequest extends RxRequest {
9 | private volatile PenManager penManager;
10 | private volatile boolean renderToScreen = true;
11 | private volatile boolean pauseRawDrawingRender = true;
12 | private volatile boolean pauseRawInputReader = true;
13 |
14 | public BaseRequest(@NonNull PenManager penManager) {
15 | this.penManager = penManager;
16 | }
17 |
18 | public boolean isRenderToScreen() {
19 | return renderToScreen;
20 | }
21 |
22 | public boolean isPauseRawDrawingRender() {
23 | return pauseRawDrawingRender;
24 | }
25 |
26 | public boolean isPauseRawInputReader() {
27 | return pauseRawInputReader;
28 | }
29 |
30 | public BaseRequest setRenderToScreen(boolean renderToScreen) {
31 | this.renderToScreen = renderToScreen;
32 | return this;
33 | }
34 |
35 | public BaseRequest setPauseRawInputReader(boolean pauseRawInputReader) {
36 | this.pauseRawInputReader = pauseRawInputReader;
37 | return this;
38 | }
39 |
40 | public BaseRequest setPauseRawDrawingRender(boolean pauseRawDrawingRender) {
41 | this.pauseRawDrawingRender = pauseRawDrawingRender;
42 | return this;
43 | }
44 |
45 | public BaseRequest setPauseRawDraw(boolean pauseRawDrawing) {
46 | this.pauseRawDrawingRender = pauseRawDrawing;
47 | this.pauseRawInputReader = pauseRawDrawing;
48 | return this;
49 | }
50 |
51 | public PenManager getPenManager() {
52 | return penManager;
53 | }
54 |
55 | @Override
56 | public void execute() throws Exception {
57 | beforeExecute(getPenManager());
58 | execute(getPenManager());
59 | afterExecute(getPenManager());
60 | }
61 |
62 | public abstract void execute(PenManager penManager) throws Exception;
63 |
64 | private void beforeExecute(PenManager penManager) {
65 | if (isPauseRawDrawingRender() && isPauseRawInputReader()) {
66 | penManager.setRawDrawingEnabled(false);
67 | return;
68 | }
69 | if (isPauseRawDrawingRender()) {
70 | penManager.setRawDrawingRenderEnabled(false);
71 | }
72 | if (isPauseRawInputReader()) {
73 | penManager.setRawInputReaderEnable(false);
74 | }
75 | }
76 |
77 | private void afterExecute(PenManager noteManager) {
78 | if (isRenderToScreen()) {
79 | noteManager.renderToScreen();
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/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/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/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/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/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/StrokeStyleChangeRequest.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.ShapeFactory;
7 |
8 | public class StrokeStyleChangeRequest extends BaseRequest {
9 | private int shapeType;
10 | private int texture;
11 |
12 | public StrokeStyleChangeRequest(@NonNull PenManager penManager) {
13 | super(penManager);
14 | }
15 |
16 | public StrokeStyleChangeRequest setShapeType(int shapeType) {
17 | this.shapeType = shapeType;
18 | return this;
19 | }
20 |
21 | public StrokeStyleChangeRequest setTexture(int texture) {
22 | this.texture = texture;
23 | return this;
24 | }
25 |
26 | @Override
27 | public void execute(PenManager penManager) throws Exception {
28 | getPenManager().setStrokeStyle(ShapeFactory.getStrokeStyle(shapeType, texture));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/scribble/request/PartialRefreshRequest.java:
--------------------------------------------------------------------------------
1 | package com.onyx.android.eink.pen.demo.scribble.request;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Canvas;
6 | import android.graphics.Rect;
7 | import android.graphics.RectF;
8 | import android.view.SurfaceView;
9 |
10 | import com.onyx.android.eink.pen.demo.util.RendererUtils;
11 | import com.onyx.android.sdk.api.device.epd.EpdController;
12 | import com.onyx.android.sdk.api.device.epd.UpdateMode;
13 | import com.onyx.android.sdk.rx.RxRequest;
14 | import com.onyx.android.sdk.utils.RectUtils;
15 |
16 | public class PartialRefreshRequest extends RxRequest {
17 | private RectF refreshRect;
18 | private SurfaceView surfaceView;
19 | private Bitmap bitmap;
20 |
21 | public PartialRefreshRequest(Context context, SurfaceView surfaceView, RectF refreshRect) {
22 | setContext(context);
23 | this.surfaceView = surfaceView;
24 | this.refreshRect = refreshRect;
25 | }
26 |
27 | public PartialRefreshRequest setBitmap(Bitmap bitmap) {
28 | this.bitmap = bitmap;
29 | return this;
30 | }
31 |
32 | @Override
33 | public void execute() throws Exception {
34 | renderToScreen(surfaceView, bitmap);
35 | }
36 |
37 | private void renderToScreen(SurfaceView surfaceView, Bitmap bitmap) {
38 | if (surfaceView == null) {
39 | return;
40 | }
41 | Rect renderRect = RectUtils.toRect(refreshRect);
42 | Rect viewRect = RendererUtils.checkSurfaceView(surfaceView);
43 | EpdController.setViewDefaultUpdateMode(surfaceView, UpdateMode.HAND_WRITING_REPAINT_MODE);
44 | Canvas canvas = surfaceView.getHolder().lockCanvas(renderRect);
45 | if (canvas == null) {
46 | return;
47 | }
48 | try {
49 | canvas.clipRect(renderRect);
50 | RendererUtils.renderBackground(canvas, viewRect);
51 | drawRendererContent(bitmap, canvas);
52 | } catch (Exception e) {
53 | e.printStackTrace();
54 | } finally {
55 | surfaceView.getHolder().unlockCanvasAndPost(canvas);
56 | EpdController.resetViewUpdateMode(surfaceView);
57 | }
58 | }
59 |
60 | private void drawRendererContent(Bitmap bitmap, Canvas canvas) {
61 | Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
62 | canvas.drawBitmap(bitmap, rect, rect, null);
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/scribble/request/RendererToScreenRequest.java:
--------------------------------------------------------------------------------
1 | package com.onyx.android.eink.pen.demo.scribble.request;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Canvas;
5 | import android.graphics.Rect;
6 | import android.view.SurfaceView;
7 |
8 | import com.onyx.android.eink.pen.demo.util.RendererUtils;
9 | import com.onyx.android.sdk.api.device.epd.EpdController;
10 | import com.onyx.android.sdk.api.device.epd.UpdateMode;
11 | import com.onyx.android.sdk.rx.RxRequest;
12 |
13 | public class RendererToScreenRequest extends RxRequest {
14 | private SurfaceView surfaceView;
15 | private Bitmap bitmap;
16 |
17 | public RendererToScreenRequest(SurfaceView surfaceView, Bitmap bitmap) {
18 | this.surfaceView = surfaceView;
19 | this.bitmap = bitmap;
20 | }
21 |
22 | @Override
23 | public void execute() throws Exception {
24 | renderToScreen(surfaceView, bitmap);
25 | }
26 |
27 | private void renderToScreen(SurfaceView surfaceView, Bitmap bitmap) {
28 | if (surfaceView == null) {
29 | return;
30 | }
31 | Rect viewRect = RendererUtils.checkSurfaceView(surfaceView);
32 | EpdController.setViewDefaultUpdateMode(surfaceView, UpdateMode.HAND_WRITING_REPAINT_MODE);
33 | Canvas canvas = surfaceView.getHolder().lockCanvas();
34 | if (canvas == null) {
35 | return;
36 | }
37 | try {
38 | RendererUtils.renderBackground(canvas, viewRect);
39 | drawRendererContent(bitmap, canvas);
40 | } catch (Exception e) {
41 | e.printStackTrace();
42 | } finally {
43 | surfaceView.getHolder().unlockCanvasAndPost(canvas);
44 | EpdController.resetViewUpdateMode(surfaceView);
45 | }
46 | }
47 |
48 |
49 | private void drawRendererContent(Bitmap bitmap, Canvas canvas) {
50 | Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
51 | canvas.drawBitmap(bitmap, rect, rect, null);
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/scribble/ui/ScribbleDemoActivity.java:
--------------------------------------------------------------------------------
1 | package com.onyx.android.eink.pen.demo.scribble.ui;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 |
9 | import androidx.databinding.DataBindingUtil;
10 |
11 | import com.onyx.android.eink.pen.demo.R;
12 | import com.onyx.android.eink.pen.demo.databinding.ActivitySribbleDemoBinding;
13 |
14 | /**
15 | * Created by seeksky on 2018/4/26.
16 | */
17 |
18 | public class ScribbleDemoActivity extends AppCompatActivity {
19 | private ActivitySribbleDemoBinding binding;
20 |
21 | @Override
22 | protected void onCreate(@Nullable Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | binding = DataBindingUtil.setContentView(this, R.layout.activity_sribble_demo);
25 | binding.setActivitySribble(this);
26 | }
27 |
28 | public void button_scribble_touch_helper(View view) {
29 | go(ScribbleTouchHelperDemoActivity.class);
30 | }
31 |
32 | public void button_surfaceview_stylus_scribble(View view) {
33 | go(ScribbleTouchHelperDemoActivity.class);
34 | }
35 |
36 | public void button_webview_stylus_scribble(View view) {
37 | go(ScribbleWebViewDemoActivity.class);
38 | }
39 |
40 | public void button_move_erase_scribble(View view) {
41 | go(ScribbleMoveEraserDemoActivity.class);
42 | }
43 |
44 | public void button_multiple_scribble(View view) {
45 | go(ScribbleMultipleScribbleViewActivity.class);
46 | }
47 |
48 | public void button_pen_up_refresh(View view) {
49 | go(ScribblePenUpRefreshDemoActivity.class);
50 | }
51 |
52 | public void button_epd_controller(View view) {
53 | go(ScribbleEpdControllerDemoActivity.class);
54 | }
55 |
56 | public void gotoScribbleFingerTouchDemo(View view) {
57 | go(ScribbleFingerTouchDemoActivity.class);
58 | }
59 |
60 | private void go(Class> activityClass) {
61 | startActivity(new Intent(this, activityClass));
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/scribble/util/TouchUtils.java:
--------------------------------------------------------------------------------
1 | package com.onyx.android.eink.pen.demo.scribble.util;
2 |
3 | import android.content.Context;
4 | import android.graphics.Rect;
5 |
6 | import com.onyx.android.sdk.api.device.epd.EpdController;
7 |
8 | /**
9 | *
10 | * author : lxw
11 | * time : 2018/7/27 17:03
12 | * desc :
13 | *
14 | */
15 | public class TouchUtils {
16 |
17 | public static void disableFingerTouch(Context context) {
18 | int width = context.getResources().getDisplayMetrics().widthPixels;
19 | int height = context.getResources().getDisplayMetrics().heightPixels;
20 | Rect rect = new Rect(0, 0, width, height);
21 | Rect[] arrayRect =new Rect[]{rect};
22 | EpdController.setAppCTPDisableRegion(context, arrayRect);
23 | }
24 |
25 | public static void enableFingerTouch(Context context) {
26 | EpdController.appResetCTPDisableRegion(context);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/shape/BrushScribbleShape.java:
--------------------------------------------------------------------------------
1 | package com.onyx.android.eink.pen.demo.shape;
2 |
3 | import com.onyx.android.eink.pen.demo.helper.RendererHelper;
4 | import com.onyx.android.sdk.api.device.epd.EpdController;
5 | import com.onyx.android.sdk.data.note.TouchPoint;
6 | import com.onyx.android.sdk.pen.NeoFountainPen;
7 | import com.onyx.android.sdk.pen.PenUtils;
8 | import com.onyx.android.sdk.utils.NumberUtils;
9 |
10 | import java.util.List;
11 |
12 | public class BrushScribbleShape extends Shape {
13 |
14 | @Override
15 | public void render(RendererHelper.RenderContext renderContext) {
16 | List points = touchPointList.getPoints();
17 | applyStrokeStyle(renderContext);
18 | List brushPoints = NeoFountainPen.computeStrokePoints(points,
19 | NumberUtils.FLOAT_ONE, strokeWidth, EpdController.getMaxTouchPressure());
20 | PenUtils.drawStrokeByPointSize(renderContext.canvas, renderContext.paint, brushPoints, isTransparent());
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/shape/CharcoalScribbleShape.java:
--------------------------------------------------------------------------------
1 | package com.onyx.android.eink.pen.demo.shape;
2 |
3 | import com.onyx.android.eink.pen.demo.data.ShapeFactory;
4 | import com.onyx.android.eink.pen.demo.helper.RendererHelper;
5 | import com.onyx.android.eink.pen.demo.util.RendererUtils;
6 | import com.onyx.android.sdk.data.PenConstant;
7 | import com.onyx.android.sdk.data.note.ShapeCreateArgs;
8 | import com.onyx.android.sdk.data.note.TouchPoint;
9 | import com.onyx.android.sdk.pen.NeoCharcoalPenV2;
10 | import com.onyx.android.sdk.pen.PenRenderArgs;
11 |
12 | import java.util.List;
13 |
14 | public class CharcoalScribbleShape extends Shape {
15 |
16 | @Override
17 | public void render(RendererHelper.RenderContext renderContext) {
18 | List points = touchPointList.getPoints();
19 | applyStrokeStyle(renderContext);
20 |
21 | PenRenderArgs renderArgs = new PenRenderArgs()
22 | .setCreateArgs(new ShapeCreateArgs())
23 | .setCanvas(renderContext.canvas)
24 | .setPenType(ShapeFactory.getCharcoalPenType(texture))
25 | .setColor(strokeColor)
26 | .setErase(isTransparent())
27 | .setPaint(renderContext.paint)
28 | .setScreenMatrix(RendererUtils.getPointMatrix(renderContext));
29 | if (strokeWidth <= PenConstant.CHARCOAL_SHAPE_DRAW_NORMAL_SCALE_WIDTH_THRESHOLD) {
30 | renderArgs.setStrokeWidth(strokeWidth)
31 | .setPoints(points);
32 | NeoCharcoalPenV2.drawNormalStroke(renderArgs);
33 | } else {
34 | renderArgs.setStrokeWidth(strokeWidth)
35 | .setPoints(points)
36 | .setRenderMatrix(RendererUtils.getPointMatrix(renderContext));
37 | NeoCharcoalPenV2.drawBigStroke(renderArgs);
38 | }
39 |
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/shape/MarkerScribbleShape.java:
--------------------------------------------------------------------------------
1 | package com.onyx.android.eink.pen.demo.shape;
2 |
3 | import com.onyx.android.eink.pen.demo.helper.RendererHelper;
4 | import com.onyx.android.sdk.api.device.epd.EpdController;
5 | import com.onyx.android.sdk.data.note.TouchPoint;
6 | import com.onyx.android.sdk.pen.NeoMarkerPen;
7 |
8 | import java.util.List;
9 |
10 | public class MarkerScribbleShape extends Shape {
11 |
12 | @Override
13 | public void render(RendererHelper.RenderContext renderContext) {
14 | List points = touchPointList.getPoints();
15 | applyStrokeStyle(renderContext);
16 | List markerPoints = NeoMarkerPen.computeStrokePoints(points, strokeWidth,
17 | EpdController.getMaxTouchPressure());
18 | NeoMarkerPen.drawStroke(renderContext.canvas, renderContext.paint, markerPoints, strokeWidth, isTransparent());
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/shape/NewBrushScribbleShape.java:
--------------------------------------------------------------------------------
1 | package com.onyx.android.eink.pen.demo.shape;
2 |
3 | import com.onyx.android.eink.pen.demo.helper.RendererHelper;
4 | import com.onyx.android.sdk.api.device.epd.EpdController;
5 | import com.onyx.android.sdk.data.note.TouchPoint;
6 | import com.onyx.android.sdk.pen.NeoBrushPen;
7 | import com.onyx.android.sdk.pen.PenUtils;
8 |
9 | import java.util.List;
10 |
11 | public class NewBrushScribbleShape extends Shape {
12 |
13 | @Override
14 | public void render(RendererHelper.RenderContext renderContext) {
15 | List points = touchPointList.getPoints();
16 | applyStrokeStyle(renderContext);
17 |
18 | List NeoBrushPoints = NeoBrushPen.computeStrokePoints(points,
19 | strokeWidth, EpdController.getMaxTouchPressure());
20 | PenUtils.drawStrokeByPointSize(renderContext.canvas, renderContext.paint, NeoBrushPoints, isTransparent());
21 |
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/java/com/onyx/android/eink/pen/demo/shape/NormalPencilShape.java:
--------------------------------------------------------------------------------
1 | package com.onyx.android.eink.pen.demo.shape;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.Paint;
5 | import android.graphics.Path;
6 | import android.graphics.PointF;
7 |
8 | import com.onyx.android.eink.pen.demo.helper.RendererHelper;
9 | import com.onyx.android.sdk.data.note.TouchPoint;
10 |
11 | import java.util.List;
12 |
13 | public class NormalPencilShape extends Shape {
14 |
15 | @Override
16 | public void render(RendererHelper.RenderContext renderContext) {
17 | List points = touchPointList.getPoints();
18 | applyStrokeStyle(renderContext);
19 | Canvas canvas = renderContext.canvas;
20 | Paint paint = renderContext.paint;
21 | Path path = new Path();
22 | PointF prePoint = new PointF(points.get(0).x, points.get(0).y);
23 | path.moveTo(prePoint.x, prePoint.y);
24 | for (TouchPoint point : points) {
25 | path.quadTo(prePoint.x, prePoint.y, point.x, point.y);
26 | prePoint.x = point.x;
27 | prePoint.y = point.y;
28 | }
29 | canvas.drawPath(path, paint);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/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/ui/popup/BasePopup.java:
--------------------------------------------------------------------------------
1 | package com.onyx.android.eink.pen.demo.ui.popup;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.widget.PopupWindow;
6 |
7 | import com.onyx.android.eink.pen.demo.action.PopupChangeAction;
8 |
9 | public class BasePopup extends PopupWindow {
10 | protected Context context;
11 |
12 | public BasePopup(Context context) {
13 | super(context);
14 | this.context = context;
15 | }
16 |
17 | @Override
18 | public void showAsDropDown(View anchor, int xoff, int yoff, int gravity) {
19 | onPopupWindowChange(true);
20 | super.showAsDropDown(anchor, xoff, yoff, gravity);
21 | }
22 |
23 | @Override
24 | public void dismiss() {
25 | super.dismiss();
26 | onPopupWindowChange(false);
27 | }
28 |
29 | private void onPopupWindowChange(boolean show) {
30 | new PopupChangeAction(show).execute();
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/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/util/ShapeUtils.java:
--------------------------------------------------------------------------------
1 | package com.onyx.android.eink.pen.demo.util;
2 |
3 | import android.graphics.RectF;
4 |
5 | import com.onyx.android.eink.pen.demo.PenBundle;
6 | import com.onyx.android.eink.pen.demo.data.ShapeFactory;
7 | import com.onyx.android.eink.pen.demo.shape.Shape;
8 | import com.onyx.android.sdk.data.note.TouchPoint;
9 | import com.onyx.android.sdk.pen.data.TouchPointList;
10 |
11 | import java.util.List;
12 |
13 | public class ShapeUtils {
14 |
15 | public static Shape createShape(PenBundle penBundle, int shapeType, TouchPointList pointList) {
16 | Shape shape = ShapeFactory.createShape(shapeType)
17 | .setTouchPointList(pointList)
18 | .setStrokeColor(penBundle.getCurrentStrokeColor())
19 | .setStrokeWidth(penBundle.getCurrentStrokeWidth());
20 | if (shapeType == ShapeFactory.SHAPE_CHARCOAL_SCRIBBLE) {
21 | shape.setTexture(penBundle.getCurrentTexture());
22 | }
23 | shape.updateShapeRect();
24 | return shape;
25 | }
26 |
27 | public static RectF getBoundingRect(final TouchPointList touchPointList) {
28 | RectF boundingRect = null;
29 | List list = touchPointList.getPoints();
30 | for(TouchPoint touchPoint: list) {
31 | if (boundingRect == null) {
32 | boundingRect = new RectF(touchPoint.x, touchPoint.y, touchPoint.x, touchPoint.y);
33 | } else {
34 | boundingRect.union(touchPoint.x, touchPoint.y);
35 | }
36 | }
37 | return boundingRect;
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/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/res/drawable/border_black_2dp.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/drawable/ic_charcoal_pen.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/drawable/ic_marker_pen.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/drawable/ic_pen_fountain.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_pen_soft.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/drawable/ic_width_minus_circle.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/res/drawable/scribble_back_ground_grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/OnyxPenDemo/src/main/res/drawable/scribble_back_ground_grid.png
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
14 |
15 |
20 |
21 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/layout/activity_scribble_epd_controller_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
16 |
17 |
22 |
27 |
32 |
37 |
42 |
43 |
44 |
45 |
51 |
52 |
59 |
60 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/layout/activity_scribble_move_erase_stylus_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
11 |
20 |
21 |
27 |
28 |
34 |
35 |
41 |
42 |
43 |
44 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/layout/activity_scribble_webview_stylus_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
19 |
20 |
25 |
26 |
31 |
32 |
33 |
34 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/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/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/OnyxPenDemo/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/OnyxPenDemo/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/OnyxPenDemo/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/OnyxPenDemo/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/OnyxPenDemo/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/OnyxPenDemo/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/OnyxPenDemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/OnyxPenDemo/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/OnyxPenDemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/OnyxPenDemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyx-intl/OnyxAndroidDemo/3290434f0edba751ec907d777fe95208378ae752/app/OnyxPenDemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/OnyxPenDemo/src/main/res/raw/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
26 |
27 |
28 |
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 |
--------------------------------------------------------------------------------