Code Monkey home page Code Monkey logo

onyxandroiddemo's People

Contributors

asampal avatar dutou-x avatar edward259 avatar joycode avatar lizhilun993 avatar onyx-chenhj avatar onyx-hehai avatar onyx-wang avatar violinconcerto avatar wangsuicheng avatar xiaomingz avatar zengzhu avatar zhangxin0830 avatar zzzzwb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

onyxandroiddemo's Issues

Null SurfaceView

Hello,
Since the demos are not working, I tried to implement the scribble_touch_helper_stylus_demo on my own, but I keep getting the following error.

Caused by: java.lang.IllegalArgumentException: hostView should not be null!
Here is a copy of my main activity which is mostly just copied from the sample...

package com.r2.myscribbledemo;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

//Onyx Imports

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.Rect;
import android.util.Log;
import android.view.SurfaceView;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.RadioButton;

import com.r2.myscribbledemo.TouchUtils;
import com.r2.myscribbledemo.R;
import com.onyx.android.sdk.api.device.epd.EpdController;
import com.onyx.android.sdk.pen.BrushRender;
import com.onyx.android.sdk.pen.RawInputCallback;
import com.onyx.android.sdk.pen.TouchHelper;
import com.onyx.android.sdk.pen.data.TouchPoint;
import com.onyx.android.sdk.pen.data.TouchPointList;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnCheckedChanged;
import butterknife.OnClick;

public class MainActivity extends AppCompatActivity {

    //Setup variables and constants
    private static final String TAG = MainActivity.class.getSimpleName();
    /** skip point count*/
    private static final int INTERVAL = 10;

    @Bind(R.id.button_pen)
    Button buttonPen;
    @Bind(R.id.button_eraser)
    Button buttonEraser;
    @Bind(R.id.surfaceview)
    SurfaceView surfaceView;
    @Bind(R.id.cb_render)
    CheckBox cbRender;
    @Bind(R.id.rb_brush)
    RadioButton rbBrush;
    @Bind(R.id.rb_pencil)
    RadioButton rbPencil;

    private TouchHelper touchHelper;

    private Paint paint = new Paint();
    private TouchPoint startPoint;
    private int countRec = 0;

    private Bitmap bitmap;
    private Canvas canvas;

    private final float STROKE_WIDTH = 3.0f;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pen_stylus_touch_helper);

        ButterKnife.bind(this);
        initPaint();
        initSurfaceView();
    }

    @Override
    protected void onResume() {
        touchHelper.setRawDrawingEnabled(true);
        super.onResume();
    }

    @Override
    protected void onPause() {
        touchHelper.setRawDrawingEnabled(false);
        super.onPause();
    }

    @Override
    protected void onDestroy() {
        touchHelper.closeRawDrawing();
        if (bitmap !=null) {
            bitmap.recycle();
            bitmap = null;
        }
        super.onDestroy();
    }

    private void initPaint(){
        paint.setAntiAlias(true);
        paint.setStyle(Paint.Style.STROKE);
        paint.setColor(Color.BLACK);
        paint.setStrokeWidth(STROKE_WIDTH);
    }

    private void initSurfaceView() {
        touchHelper = TouchHelper.create(surfaceView, callback);

        surfaceView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
            @Override
            public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int
                    oldRight, int oldBottom) {
                if (cleanSurfaceView()){
                    surfaceView.removeOnLayoutChangeListener(this);
                }
                List<Rect> exclude = new ArrayList<>();
                exclude.add(getRelativeRect(surfaceView, buttonEraser));
                exclude.add(getRelativeRect(surfaceView, buttonPen));
                exclude.add(getRelativeRect(surfaceView, cbRender));
                exclude.add(getRelativeRect(surfaceView, rbBrush));
                exclude.add(getRelativeRect(surfaceView, rbPencil));

                Rect limit = new Rect();
                surfaceView.getLocalVisibleRect(limit);
                touchHelper.setStrokeWidth(STROKE_WIDTH)
                        .setLimitRect(limit, exclude)
                        .openRawDrawing();
                touchHelper.setStrokeStyle(TouchHelper.STROKE_STYLE_BRUSH);
            }
        });
    }

    @OnClick(R.id.button_pen)
    public void onPenClick() {
        touchHelper.setRawDrawingEnabled(true);
        onRenderEnableClick();
    }

    @OnClick(R.id.button_eraser)
    public void onEraserClick() {
        touchHelper.setRawDrawingEnabled(false);
        if (bitmap !=null) {
            bitmap.recycle();
            bitmap = null;
        }
        cleanSurfaceView();
    }

    @OnCheckedChanged(R.id.cb_render)
    public void onRenderEnableClick() {
        touchHelper.setRawDrawingRenderEnabled(cbRender.isChecked());
        if (bitmap !=null) {
            bitmap.recycle();
            bitmap = null;
        }
        Log.d(TAG,"onRenderEnableClick setRawDrawingRenderEnabled =  " + cbRender.isChecked());
    }

    @OnClick({R.id.rb_brush, R.id.rb_pencil})
    public void onRadioButtonClicked(RadioButton radioButton) {

        boolean checked = radioButton.isChecked();
        Log.d(TAG, radioButton.toString());
        switch (radioButton.getId()) {
            case R.id.rb_brush:
                if (checked) {
                    touchHelper.setStrokeStyle(TouchHelper.STROKE_STYLE_BRUSH);
                    Log.d(TAG, "STROKE_STYLE_BRUSH");
                }
                break;
            case R.id.rb_pencil:
                if (checked) {
                    touchHelper.setStrokeStyle(TouchHelper.STROKE_STYLE_PENCIL);
                    Log.d(TAG, "STROKE_STYLE_PENCIL");
                }
                break;
        }
        // refresh ui
        onEraserClick();
        onPenClick();
    }

    public Rect getRelativeRect(final View parentView, final View childView) {
        int [] parent = new int[2];
        int [] child = new int[2];
        parentView.getLocationOnScreen(parent);
        childView.getLocationOnScreen(child);
        Rect rect = new Rect();
        childView.getLocalVisibleRect(rect);
        rect.offset(child[0] - parent[0], child[1] - parent[1]);
        return rect;
    }

    private boolean cleanSurfaceView() {
        if (surfaceView.getHolder() == null) {
            return false;
        }
        Canvas canvas = surfaceView.getHolder().lockCanvas();
        if (canvas == null) {
            return false;
        }
        canvas.drawColor(Color.WHITE);
        surfaceView.getHolder().unlockCanvasAndPost(canvas);
        return true;
    }

    private void drawRect(TouchPoint endPoint){
        Canvas canvas = surfaceView.getHolder().lockCanvas();
        if (canvas == null ) {
            return;
        }

        if (startPoint == null || endPoint == null) {
            surfaceView.getHolder().unlockCanvasAndPost(canvas);
            return;
        }

        canvas.drawColor(Color.WHITE);
        canvas.drawRect(startPoint.getX(), startPoint.getY(), endPoint.getX(), endPoint.getY(), paint);
        Log.d(TAG,"drawRect ");
        surfaceView.getHolder().unlockCanvasAndPost(canvas);
    }

    private RawInputCallback callback = new RawInputCallback() {

        @Override
        public void onBeginRawDrawing(boolean b, TouchPoint touchPoint) {
            Log.d(TAG, "onBeginRawDrawing");
            startPoint = touchPoint;
            Log.d(TAG,touchPoint.getX() +", " +touchPoint.getY());
            countRec = 0;
            TouchUtils.disableFingerTouch(getApplicationContext());
        }

        @Override
        public void onEndRawDrawing(boolean b, TouchPoint touchPoint) {
            Log.d(TAG, "onEndRawDrawing###");
            if (!cbRender.isChecked()){
                drawRect(touchPoint);
            }
            Log.d(TAG,touchPoint.getX() +", " +touchPoint.getY());
            TouchUtils.enableFingerTouch(getApplicationContext());
        }

        @Override
        public void onRawDrawingTouchPointMoveReceived(TouchPoint touchPoint) {
            Log.d(TAG, "onRawDrawingTouchPointMoveReceived");
            Log.d(TAG,touchPoint.getX() +", " +touchPoint.getY());
            countRec++;
            countRec = countRec % INTERVAL;
            Log.d(TAG,"countRec = " + countRec);
        }

        @Override
        public void onRawDrawingTouchPointListReceived(TouchPointList touchPointList) {
            Log.d(TAG, "onRawDrawingTouchPointListReceived");
            drawScribbleToBitmap(touchPointList.getPoints());
        }

        @Override
        public void onBeginRawErasing(boolean b, TouchPoint touchPoint) {
            Log.d(TAG, "onBeginRawErasing");
        }

        @Override
        public void onEndRawErasing(boolean b, TouchPoint touchPoint) {
            Log.d(TAG, "onEndRawErasing");
        }

        @Override
        public void onRawErasingTouchPointMoveReceived(TouchPoint touchPoint) {
            Log.d(TAG, "onRawErasingTouchPointMoveReceived");
        }

        @Override
        public void onRawErasingTouchPointListReceived(TouchPointList touchPointList) {
            Log.d(TAG, "onRawErasingTouchPointListReceived");
        }
    };

    private void drawScribbleToBitmap(List<TouchPoint> list) {
        if (!cbRender.isChecked()) {
            return;
        }
        if (bitmap == null) {
            bitmap = Bitmap.createBitmap(surfaceView.getWidth(), surfaceView.getHeight(), Bitmap.Config.ARGB_8888);
            canvas = new Canvas(bitmap);
        }

        if (rbBrush.isChecked()) {
            float maxPressure = EpdController.getMaxTouchPressure();
            BrushRender.drawStroke(canvas, paint, list, STROKE_WIDTH, maxPressure);
        }

        if (rbPencil.isChecked()) {
            Path path = new Path();
            PointF prePoint = new PointF(list.get(0).x, list.get(0).y);
            path.moveTo(prePoint.x, prePoint.y);
            for (TouchPoint point : list) {
                path.quadTo(prePoint.x, prePoint.y, point.x, point.y);
                prePoint.x = point.x;
                prePoint.y = point.y;
            }
            canvas.drawPath(path, paint);
        }
    }

    private void drawBitmapToSurface() {
        if (!cbRender.isChecked()) {
            return;
        }
        if (bitmap == null) {
            return;
        }
        Canvas lockCanvas= surfaceView.getHolder().lockCanvas();
        if (lockCanvas == null) {
            return;
        }
        lockCanvas.drawColor(Color.WHITE);
        lockCanvas.drawBitmap(bitmap, 0f, 0f, paint);
        surfaceView.getHolder().unlockCanvasAndPost(lockCanvas);
        // refresh ui
        touchHelper.setRawDrawingEnabled(false);
        touchHelper.setRawDrawingEnabled(true);
        if (!cbRender.isChecked()) {
            touchHelper.setRawDrawingRenderEnabled(false);
        }
    }
}

Storing Path objects

Hi theam,

This is not your problem. It is mine. But I think you know the best answer for this ...

I want to store my raw drawings to firebase database. I save them as list of TouchPoints. But then there are a lot of drawings on a single page it becomes to heavy to store them. What's the best format to store the touchpoints to disk or cloud?

一张页面,包含多个可书写Surfaceview的情况下,如何单独保存绘制path到bitmap的问题

如题,一个页面,包含了多个可以写的surfaceview,在onRawDrawingTouchPointListReceived回调后,使用drawPath绘制,发现path无法绘制到bitmap上。保存的bitmap为空背景,绘制的bitmap代码如下:

paint.setAntiAlias(true);
paint.setStyle(Paint.Style.STROKE);
paint.setColor(Color.BLACK);
paint.setStrokeWidth(STROKE_WIDTH);
if (bitmap == null) {
bitmap = Bitmap.createBitmap(surfaceView.getWidth(), surfaceView.getHeight(), Bitmap.Config.ARGB_8888);
canvas = new Canvas(bitmap);
}
Path path = new Path();
PointF prePoint = new PointF(list.get(0).x, list.get(0).y);
path.moveTo(prePoint.x, prePoint.y);
for (TouchPoint point : list) {
path.quadTo(prePoint.x, prePoint.y, point.x, point.y);
prePoint.x = point.x;
prePoint.y = point.y;
}
canvas.drawPath(path, paint);

Refresh on floating apps

Hi team.

I have a problem with the Nav button (and any other floating app) when I'm in raw drawing enabled mode. The button doesn't recieve events and I need to toggle the raw drawing so I can use the Nav button. Same thing happens with the sample app. I can see that in the Notes app this problem is fixed. The raw drawing toggles is turned off when I click the nav button and turned on when I start scribing again. But how do I detect if the Nav button is clicked when I'm still in raw drawing mode is a mystery so far.

Seems that you don't support this project anymore. Where else I can find help?

Support for new color boox devices

I don't think this SDK works on the latest color device? My app that depends on it seems to not work on those (like the note air 3 c). Any plan to support them ?

Cheers

java.lang.ClassNotFoundException: android.onyx.utils.FontsUtils

The Demo runs fine for me, but in Logcat, I can see this error in several places. It seems something doesn't work out in the background and a dependency is missing:

2022-07-01 20:50:38.862 6138-6138/com.android.onyx.demo E/ReflectUtil: java.lang.ClassNotFoundException: android.onyx.utils.FontsUtils
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:453)
        at java.lang.Class.forName(Class.java:378)
        at com.onyx.android.sdk.utils.ReflectUtil.classForName(SourceFile:1)
        at com.onyx.android.sdk.device.SDMDevice.createDevice(SourceFile:262)
        at com.onyx.android.sdk.device.Device.detectDevice(SourceFile:24)
        at com.onyx.android.sdk.device.Device.<clinit>(SourceFile:2)
        at com.onyx.android.sdk.device.Device.currentDevice(SourceFile:1)
        at com.onyx.android.sdk.api.device.epd.EpdController.enablePost(SourceFile:1)
        at com.android.onyx.demo.MainActivity.onCreate(MainActivity.java:24)
        at android.app.Activity.performCreate(Activity.java:7136)
        at android.app.Activity.performCreate(Activity.java:7127)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3068)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1825)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6797)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "android.onyx.utils.FontsUtils" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.android.onyx.demo-DC1kf7OOLCsmlMPgx60wMg==/base.apk"],nativeLibraryDirectories=[/data/app/com.android.onyx.demo-DC1kf7OOLCsmlMPgx60wMg==/lib/arm, /data/app/com.android.onyx.demo-DC1kf7OOLCsmlMPgx60wMg==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:453) 
        at java.lang.Class.forName(Class.java:378) 
        at com.onyx.android.sdk.utils.ReflectUtil.classForName(SourceFile:1) 
        at com.onyx.android.sdk.device.SDMDevice.createDevice(SourceFile:262) 
        at com.onyx.android.sdk.device.Device.detectDevice(SourceFile:24) 
        at com.onyx.android.sdk.device.Device.<clinit>(SourceFile:2) 
        at com.onyx.android.sdk.device.Device.currentDevice(SourceFile:1) 
        at com.onyx.android.sdk.api.device.epd.EpdController.enablePost(SourceFile:1) 
        at com.android.onyx.demo.MainActivity.onCreate(MainActivity.java:24) 
        at android.app.Activity.performCreate(Activity.java:7136) 
        at android.app.Activity.performCreate(Activity.java:7127) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3068) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1825) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6797) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 

RawInputCallback's methods never called

When launching the tutorial app, navigating to Scribble Demo -> Scribble Touch Helper Demo and then drawing on the screen, netiher of the RawInputCallback's methods (defined here) get invoked.

Inside the app I'm building I experience a similar problem: can't get the raw inputs from the stylus. How can I be notified of these events?

SDK Examples require update

Hello there.
If you still support this, you shall update examples. The Gradle plugin is outdated, java 1.8 is required. It just doesn't feel good.

Inconsistent coordinates of touch point when scrolling

Hi

I have a view inside a scroll view. When the view is scrolled down sometimes I get the Y coordinates absolute, sometimes relative to the visible rectangle of the view. Take a look at the code below. When I detect a touch with the finger I call setRawDrawingEnabled twice to enable interactions with the fingers. In that case I get the Y coordinate of the touch point inside onBeginRawDrawing relative to the visible rect. If I call only touchHelper.setRawDrawingEnabled(false) and then enable raw drawing trough a button in the UI then I get the Y coordinate of the touch point inside onBeginRawDrawing in absolute coordinates (relative to the visible rect + the scroll)

 GestureDetector.SimpleOnGestureListener() {
    override fun onDown(e: MotionEvent): Boolean {
        if (e.getToolType(0) == MotionEvent.TOOL_TYPE_FINGER &&
            touchHelper.isRawDrawingInputEnabled) {

            touchHelper.setRawDrawingEnabled(false)
            touchHelper.setRawDrawingEnabled(true)
        }
        return super.onDown(e)
    }
}
...
        override fun onBeginRawDrawing(p0: Boolean, touchPoint: TouchPoint) {
            Log.d(javaClass.name, touchPoint.toString())
            TouchUtils.disableFingerTouch(context)
        }

The behaviour in the case when setRawDrawingEnabled is called twice is inconsistent and depends somehow on the way the view is scrolled.

Any ideas how to workaround it? Both getting consistent coordinates or another way of enabling finger actions when the raw input is on work.

Thank you!

Can't disable "finger touches" using EpdController

There is TouchUtils class in the demo app which, supposedly, disables finger touches using EpdController API:

public class TouchUtils {

    public static void disableFingerTouch(Context context) {
        boolean canFingerTouch = EpdController.isCTPPowerOn();
        if (canFingerTouch) {
            int width = context.getResources().getDisplayMetrics().widthPixels;
            int height = context.getResources().getDisplayMetrics().heightPixels;
            Rect rect = new Rect(0, 0, width, height);
            Rect[] arrayRect =new Rect[]{rect};
            EpdController.setAppCTPDisableRegion(context, arrayRect);
        }
    }

    public static void enableFingerTouch(Context context) {
        boolean canFingerTouch = !EpdController.isCTPPowerOn();
        if (!canFingerTouch) {
            EpdController.appResetCTPDisableRegion(context);
        }
    }
}

I tried to use the same approach in my app and it didn't work. Furthermore, I removed the calls to the aforementioned methods from your demo app and its behavior didn't change at all. So, it looks like these calls do nothing.

How can I disable "finger touches" programatically?

reflect bootstrap failed

W/ReflectUtil: java.lang.NoSuchFieldException: EINK_ONYX_AUTO_MASK
at java.lang.Class.getField(Class.java:1604)
at com.onyx.android.sdk.utils.ReflectUtil.getStaticIntFieldSafely(SourceFile:1)
at com.onyx.android.sdk.utils.ReflectUtil.getStaticIntFieldSafely(SourceFile:20)
at com.onyx.android.sdk.device.SDMDevice.createDevice(SourceFile:7)
at com.onyx.android.sdk.device.Device.detectDevice(SourceFile:24)
at com.onyx.android.sdk.device.Device.(SourceFile:2)
at com.onyx.android.sdk.device.Device.currentDevice(SourceFile:1)
at com.onyx.android.sdk.api.device.epd.EpdController.enablePost(SourceFile:1)
at com.android.onyx.demo.MainActivity.onCreate(MainActivity.java:25)
at android.app.Activity.performCreate(Activity.java:8064)
at android.app.Activity.performCreate(Activity.java:8048)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1310)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3638)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2093)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7778)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
W/droid.onyx.dem: Accessing hidden field Landroid/onyx/ViewUpdateHelper;->EINK_ONYX_GC_MASK:I (blacklist, reflection, denied)
W/ReflectUtil: java.lang.NoSuchFieldException: EINK_ONYX_GC_MASK
at java.lang.Class.getField(Class.java:1604)
at com.onyx.android.sdk.utils.ReflectUtil.getStaticIntFieldSafely(SourceFile:1)
at com.onyx.android.sdk.utils.ReflectUtil.getStaticIntFieldSafely(SourceFile:20)
at com.onyx.android.sdk.device.SDMDevice.createDevice(SourceFile:8)
at com.onyx.android.sdk.device.Device.detectDevice(SourceFile:24)
at com.onyx.android.sdk.device.Device.(SourceFile:2)
at com.onyx.android.sdk.device.Device.currentDevice(SourceFile:1)
at com.onyx.android.sdk.api.device.epd.EpdController.enablePost(SourceFile:1)
at com.android.onyx.demo.MainActivity.onCreate(MainActivity.java:25)
at android.app.Activity.performCreate(Activity.java:8064)
at android.app.Activity.performCreate(Activity.java:8048)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1310)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3638)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2093)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7778)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
W/droid.onyx.dem: Accessing hidden field Landroid/onyx/ViewUpdateHelper;->EINK_AUTO_MODE_REGIONAL:I (blacklist, reflection, denied)
W/ReflectUtil: java.lang.NoSuchFieldException: EINK_AUTO_MODE_REGIONAL
at java.lang.Class.getField(Class.java:1604)
at com.onyx.android.sdk.utils.ReflectUtil.getStaticIntFieldSafely(SourceFile:1)
at com.onyx.android.sdk.utils.ReflectUtil.getStaticIntFieldSafely(SourceFile:20)
at com.onyx.android.sdk.device.SDMDevice.createDevice(SourceFile:9)
at com.onyx.android.sdk.device.Device.detectDevice(SourceFile:24)
at com.onyx.android.sdk.device.Device.(SourceFile:2)
at com.onyx.android.sdk.device.Device.currentDevice(SourceFile:1)
at com.onyx.android.sdk.api.device.epd.EpdController.enablePost(SourceFile:1)
at com.android.onyx.demo.MainActivity.onCreate(MainActivity.java:25)
at android.app.Activity.performCreate(Activity.java:8064)
at android.app.Activity.performCreate(Activity.java:8048)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1310)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3638)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2093)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7778)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
W/droid.onyx.dem: Accessing hidden field Landroid/onyx/ViewUpdateHelper;->EINK_WAIT_MODE_NOWAIT:I (blacklist, reflection, denied)
W/ReflectUtil: java.lang.NoSuchFieldException: EINK_WAIT_MODE_NOWAIT
at java.lang.Class.getField(Class.java:1604)
at com.onyx.android.sdk.utils.ReflectUtil.getStaticIntFieldSafely(SourceFile:1)
at com.onyx.android.sdk.utils.ReflectUtil.getStaticIntFieldSafely(SourceFile:20)
at com.onyx.android.sdk.device.SDMDevice.createDevice(SourceFile:10)
at com.onyx.android.sdk.device.Device.detectDevice(SourceFile:24)
at com.onyx.android.sdk.device.Device.(SourceFile:2)
at com.onyx.android.sdk.device.Device.currentDevice(SourceFile:1)
at com.onyx.android.sdk.api.device.epd.EpdController.enablePost(SourceFile:1)
at com.android.onyx.demo.MainActivity.onCreate(MainActivity.java:25)
at android.app.Activity.performCreate(Activity.java:8064)
at android.app.Activity.performCreate(Activity.java:8048)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1310)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3638)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2093)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7778)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
W/droid.onyx.dem: Accessing hidden field Landroid/onyx/ViewUpdateHelper;->EINK_WAVEFORM_MODE_ANIM:I (blacklist, reflection, denied)

Broken API for Note Air 2 / Note 5?

Hi! I wrote Gentle Glow https://github.com/calin-darie/gentle-glow-onyx-boox to control the frontlight on Boox devices. A user has wrote me this week telling me Gentle Glow doesn't work on his new Note 5.

FrontlightController.hasCTMBrightness seems to be returning false on Note 5.

Here are the library verrsions I'm currently using:

    implementation('com.onyx.android.sdk:onyxsdk-base:1.5.8')
    implementation('com.onyx.android.sdk:onyxsdk-device:1.1.8')

The device & base libraries haven't been updated since Frebruary.
Is there any other documentation?
Is there any workaround I can use to offer people Gentle Glow until you push out a new version of the library?

I know the devices where this library is working the frontlight is controlled by these global settings:
warm & cold brightness:

content://settings/system/screen_cold_brightness
content://settings/system/screen_warm_brightness

warm & cold on / off:

content://settings/system/cold_brightness_state_key
content://settings/system/warm_brightness_state_key

Did these settings change? Would it be enough to set similar settings directly from Gentle Glow, at least as a temporary workaround?

Prevent screen updates

Hi, while developing my application, I get double screen updates. First one is requested by user, the second one is done by system. Any way to prevent this?

Can't prevent automatic screen updates via EpdDeviceManager

Here's what I do:

  1. Create a simple WebView and point it to https://time.is/
  2. Call EpdDeviceManager.setUpdateMode(webView, UpdateMode.None);

But the clock is still running and refreshing the screen constantly. How can I prevent this?
My guess is that the WebView calls a system drawing method that overrides the update mode. But I can't be sure.

Examples not Opening

Hello,
I was able to build and install the OnyxDemo app on my Nova Pro, but none of the samples actually load. I am getting no errors in logcat, but the main window does not change. I am probably missing something, but what?

I am attempting to make a sortable note view app to create a gradebook for my classroom this year.

`EpdDeviceManager.enterAnimationUpdate` doesn't work on poke 4 light device

Hello. I'm optimising my app for onyx devices.

I try to use functions EpdDeviceManager.enterAnimationUpdate(true) and EpdDeviceManager.exitAnimationUpdate(true) to enable fast update mode while scrolling the list in RecyclerView.

This feature perfectly works on devices "Faust 5" and "Kon Tiki 2", but doesn't work on "Poke 4 light".

I use sdk com.onyx.android.sdk:onyxsdk-device:1.2.21.

Can provide more information if you need.

NewShapeModel

Hi,

I'm trying to extend the NoteDemoActivity, list the notes (it is working) but I cannot query pages and shapes.

This is working as documented:
noteProvider = RemoteNoteProvider()
val notes = noteProvider.loadAllNoteList()
notes.stream().forEach {
Timber.i("%s (%s %s): %s [%d]", it.uniqueId, it.isLibrary, it.parentUniqueId, it.title, it.subDocCount)
}

But, I cannot load any shape based on any document unique id:
val newShapeModels = NewShapeDataProvider.loadShapeList("07ec191c-18ee-4d8a-9516-56b3a59448b3")
Timber.i("ShapeModels: %d", newShapeModels.size)

I always get zero result:
ShapeModels: 0

Do you have any example about pages and shapes?

Min SDK version and certificate issue

Hello,
I am having difficulty building an app for my NOVA Pro.
I downloaded the sample, and Android studio is giving two errors..

  1. In the build target window of the Android Studio Toolbar, I am seeing the following error...
    !(minSDK(API 26)>deviceSDK(API 23)) but we cannot upgrade the Nova pro SDK. Is it no longer supported at all?

  2. Perhaps related, I cannot launch the sample app. Here is the error...

Installation did not succeed.
The application could not be installed: INSTALL_PARSE_FAILED_NO_CERTIFICATES

List of apks:
[0] '...\AndroidStudioProjects\OnyxAndroidDemo-master\OnyxAndroidDemo-master\moreApps\daydreamdemo\build\outputs\apk\debug\daydreamdemo-debug.apk'
APK signature verification failed.
Retry

I am not getting any better error messages. This is my first time building for the Nova, but I have created numerous Android apps.

Edit... This issue only affects the Daydream demo which must not be supported on the note pro.

Could not resolve com.onyx.android.sdk:onyxsdk-device:1.2.25

Can't receive libraries from Boox. For now working only JCenter until [1.1.8]
Same problem with the other groups

image

Top level config

buildscript {
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath "com.google.dagger:hilt-android-gradle-plugin:$hiltAndroid"
        classpath "com.google.firebase:firebase-crashlytics-gradle:2.9.9"
        classpath 'com.android.tools.build:gradle:7.4.2'
        classpath "com.google.gms:google-services:4.3.15"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.firebase:perf-plugin:1.4.2'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url 'https://android-sdk.is.com/' }
        maven { url 'https://artifact.bytedance.com/repository/pangle' }
        maven { url "https://jitpack.io" }
        maven {
            url "http://repo.boox.com/repository/maven-public/"
            allowInsecureProtocol = true
        }
    }
}

Module config

plugins {
    id 'com.android.library'
    id 'kotlin-android'
}

repositories {
    jcenter()
    maven { url "https://jitpack.io" }
    maven {
        url "http://repo.boox.com/repository/maven-public/"
        allowInsecureProtocol = true
    }
}

android {
    compileSdkVersion 33

    defaultConfig {
        minSdkVersion 23
    }

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
    namespace 'com.kursx.smartbook.onyx.impl'
}

dependencies {
    implementation project(":onyx-api")


    implementation('com.onyx.android.sdk:onyxsdk-device:1.2.25')
}

Can't clear the "residual" artifacts from the screen using EpdController

When navigating between screens in the app, there are "residual" artifacts from the previous screens that remain visible. They look like pale shadows. I noticed the same artifacts when using Onyx demo app.
Inside your tutorial app, if I go to Epd Demo screen and click on "Full Update", the screen refreshes and the artifacts from previous screens are deleted. Inside the code, I traced the execution path to this code inside EpdDemoActivity:

        } else if (v.equals(button_screen_refresh)) {
            updateTextView();
            EpdController.repaintEveryThing(UpdateMode.GC);
        }

So, I thought that a call to EpdController.repaintEveryThing(UpdateMode.GC) should do the trick in my app as well, but it wasn't the case. As far as I can see, this call has no effect at all.

I'm not sure how come the same API call works in one app, but doesn't work in another. I use exactly the same versions of SDKs:


    // Onyx SDKs
    implementation('com.onyx.android.sdk:onyxsdk-device:1.2.5')
    implementation('com.onyx.android.sdk:onyxsdk-pen:1.3.1')

So, how do I repaint the screen and remove "residual" artifacts in my app?

Creating a new note via an intent and in a certain folder

Hello

Looking at NoteDemoActivity.java#L117, I figured how to create a new note via the "com.onyx.android.note.note.ui.ScribbleActivity" intent.

I also guessed that I can set the title of the note by including a json string like {“Title“: “hello world“} as extra data.

Does anybody know what key should I use to specify the folder that the note should be created in?

Many thanks,
Berkan

Color selection on Nova 3 Color

Hi,

I am able to run the androidDemo successfully. I tried changing pen color by editing code "paint.setColor(Color.RED)" in initPaint() but no effect. Tried Normal mode and A2 mode. Request to guide how to change pen color.
Thanks.

Compilation errors

I'm attempting to compile this project using Gradle 7.3.3, but it always fails with this error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Failed to calculate the value of task ':app:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
   > Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, /home/blackdoctor/Development/gentle-glow-onyx-boox/app/build/generated/ap_generated_sources/debug/out))) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@e2dea31) before task ':app:compileDebugJavaWithJavac' has completed is not supported

Does someone who has successfully built this project have any advice? I'd like to try tinkering with Onyx boox projects, but this compile error occurs with all of them. Surely it's my setup that's the issue, but I don't know how to fix it.

从ReaderDemoActivity启动阅读器报错

java.lang.SecurityException: Permission Denial: starting Intent ... from ProcessRecord ... not exported from uid 10074

新系统改了吗?启动Activity不是com.onyx.kreader.ui.ReaderTab1Activity了吗?

How to turn Boox into single-use device (kiosk)?

We need to ship Boox devices (specifically Max Lumi 2) to end users with our application preinstalled as "kiosk" (aka. single-use device, dedicated device, etc.). The app must start the moment the tablet boots up and remain the only application that users can interract with. Navigation and status bars should be disabled and there should be no way to exit our application.

There is a feature in Android called Lock Task Mode, which turns Activities into "kiosk" screens. To use this API from within third-party app, that app must be set as "device owner", through either ADB or some remote configuration.

In addition, I know that some OEMs of "specialized" devices also implement their own mechanisms of various complexity, starting with simple SDK calls, all the way to complete EMM solutions with remote activation through web dashboard.

So, my questions are:

  1. Do Boox devices (specifically Max Lumi 2) support "device owner" and "lock task" features? Are there any differences from standard APIs?

  2. Is there any other custom solution available?

Note and Library app

Is there any information available on where the notes are saved? I would like to access them with a 3rd-party sync app. Also can these be exported to .pdf file via script?

onyxsdk-base could not determine dependecies

Hello,

I'm trying to use onyxsdk-pen, which uses onyxsdk-base

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not find pub.devrel:easypermissions:0.2.1.
     Required by:
         project :app > com.onyx.android.sdk:onyxsdk-base:1.6.19
   > Could not find com.tencent:mmkv:1.0.19.
     Required by:
         project :app > com.onyx.android.sdk:onyxsdk-base:1.6.19

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.