Other Galaxy Note 10.1 model and Pen button support

56 views
Skip to first unread message

Mingfai Ma

unread,
Aug 25, 2012, 3:40:56 PM8/25/12
to quill...@googlegroups.com
hi,

I'm learning Quill's source and try to fix http://code.google.com/p/android-quill/issues/detail?id=43 for my device.

First of all, for the recent Note 10.1 support [1], it added only N8013 and I'm using N8000 that is the same device with 3G. I wonder if it is a good idea to maintain the model number in this way. There could be a lot of different N80XY model that refer to the same Note 10.1 .

For the Pen button eraser support, do you have any idea on what went wrong? In Photoshop, the bottom does work that means we should be able to get the Pen button event and then use to set to the eraser mode. I'll try to figure out anyway.

[1] http://code.google.com/p/android-quill/source/diff?spec=svnb8965e1802769d61c91054a66c1abf49b1f7e6ea&r=b8965e1802769d61c91054a66c1abf49b1f7e6ea&format=side&path=/src/name/vbraun/lib/pen/Hardware.java

regards,
mingfai

Mingfai Ma

unread,
Aug 25, 2012, 4:00:49 PM8/25/12
to quill...@googlegroups.com
hi,

For Samsung's devices, I believe the official way to use the Pen button is to use S Pen SDK [1] that provides the onTouchButtonDown/Up events (on touch when the pen is touched on screen while the button is holding/not-holding), and btw it will also distinguish between pen down and other touch according to the release note. (for now, when i touch the screen with finger, it's still a pen down event in PenEventSamsungNote.

The installation instruction [2] said we have to add a jar and some native library (.so) to the project. It seems those native libraries are for other purposes such as signature recognition, image processing.

would you consider to add those Samsung specific stuff to the project? or should I go for finding other way to capture the pen button event?

regards,
mingfai

[1] http://innovator.samsungmobile.com/cms/cnts/knowledge.detail.view.do?platformId=1&cntsId=11284

[2] See the tutorial pdf at the bottom of [1] link

Mingfai Ma

unread,
Aug 25, 2012, 5:11:50 PM8/25/12
to quill...@googlegroups.com
hi Volker,

i did further testing.

if we use the Samsung native library, maybe the S Pen side button touch event can be detected. But using the Samsung SDK seems to require a lot of Samsung specific API, such as SCanvasView, may that makes the code much harder to maintain.

if we do not use the Samsung native libraries, there is a way to get it work with the Android 4 / API Level 14, onHoverEvent
{code}
@Override
    public boolean onHoverEvent(MotionEvent event) {
        Log.d(TAG,"onHoverEvent()\tisSideButtonPressed: " + SPenLibrary.getEvent(event).isSideButtonPressed()  );
        return super.onHoverEvent(event);
    }
{code}
SPenLibrary is from Samsung's jar and it doesn't require the native .so libraries. I believe we can check the button status in another way without depend to the SPenLibrary util class.

Apparently, when S Pen's side button is pressed, the Samsung devices do not fire a touch event but only fire a hover event. That's why our current implementation cannot catch the side button touch to do erasing.

So, how do you want Quill to handle the side button case?
  1. ignore the request and do not support side button erasing
  2. use Samsung native library and may need a major refactor of the design (that when it is using Samsung device, it needs to create a Samsung SCanvas view)
  3. change the minimum Android API requirement from level 11 to level 14, i.e. no longer support Android 3 and require Android 4.

It seems to me there ain't too many Android 3 phone anyway, and I propose to go for option 3. What do you think?

regards,
mingfai

Volker Braun

unread,
Aug 25, 2012, 5:30:30 PM8/25/12
to quill...@googlegroups.com
Hi Mingfai,

Oh sounds interesting! Thank you for sharing your research. 

Quill targets api level 11 but one can use level 14. Some care needs to be taken in order to not access the new API on older devices. For example, name/vbraun/lib/pen/PenEventICS.java uses the level 14 API.

Best,
Volker

Mingfai

unread,
Aug 26, 2012, 3:25:48 AM8/26/12
to quill...@googlegroups.com
I just learn the @TargetApi(14) usage. thx

To use the onHoverEvent, I modified HandwriterView to use level 14 to capture the event. HandwriterView is shared by all devices. An alternative way may be to use a AbstractFactory pattern that on ICS, it uses an extended HandwriterView that capture the event, i.e.
@TargetApi(14)
public class ICSHandwriterView extends HandwriterView{
 ...
  public boolean onHoverEvent(MotionEvent event) {
  ...

and for sure our PenEvent hierarchy needs to support storing the onHover event. do you have a better way to implement this?

Basically, I only want to make a version of Quill that could use the pen's side button to erase. :-)

regards,
mingfai

Volker Braun

unread,
Sep 7, 2012, 5:07:01 PM9/7/12
to quill...@googlegroups.com
Sorry for the later reply, I was traveling last week. I just pushed one possible version of the button code to the repository. Unless I overlooked something there is no way to track the pen strokes while the button is pressed. For the other devices I use the pen as an eraser while the button is pressed, but of course this requires the x/y coordinates. So all we can do is use it as a switch while it is hovering. Hence the current behavior is to switch to eraser mode if you press the button while hovering. Thats not what I would consider ideal but I'm afraid the best one can do. Do you agree, Mingfai?

Best,
Volker
Reply all
Reply to author
Forward
0 new messages