The TouchHelper class in onyxsdk-scribble 1.0.8 provides a simplified interface for implementing stylus scribbling on an Android View.
To use it, call setup(view) on a target View and configure your drawing parameters. You can define a specific region for scribbling using setLimitRect and optionally exclude certain areas using a list of Rect objects.
To control the scribbling state:
- Call
openRawDrawing() to initialize resources. - Use
setRawDrawingEnabled(true) to enter scribble mode (the screen will stop refreshing). - Use
setRawDrawingEnabled(false) to pause scribbling. - Call
closeRawDrawing() to fully stop the service, release resources, and unlock the screen for normal refreshing.
touchHelper.setup(view)
.setStrokeWidth(3.0f)
.setUseRawInput(true)
.setLimitRect(limit, exclude)
.openRawDrawing();
// To start scribbling
touchHelper.setRawDrawingEnabled(true);
// To pause scribbling
touchHelper.setRawDrawingEnabled(false);
// To fully stop and release resources
touchHelper.closeRawDrawing();