Skip to main content
Samsung Developer Program

WritingBuddy API Structure

This section introduces the Look S-Pen WritingBuddy API classes, constructors, methods, fields, and their relationships.  

For details, see the online Look API Reference ( http://img-developer.samsung.com/onlinedocs/sms/look/index.html).

For details about integrating the WritingBuddy API, see the Integrating WritingBuddy section.

Samsung Look S-Pen Slook WritingBuddy Classes and Methods.png

SlookWritingBuddy Class

Provides methods for accessing an editor for editing text or drawing images.

Constructors  

SlookWritingBuddy(ViewGroup parentView)

Instantiates an SlookWritingBuddy object to make WritingBuddy text input panel features available for the specified ViewGroup:

parentView     Name of the ViewGroup

When calling this method, a text user-commit listener MUST be set (via setTextWritingListener) to process user-committed text strings.

SlookWritingBuddy(EditText editText)

Instantiates an SlookWritingBuddy object to make WritingBuddy text and image editor panels or only text editor panels available for alternate entry associated with the specified EditText view:

editText     Name of the EditText view 

When calling this method, listeners can be optional or mandatory (via setTextWritingListener and/or setImageWritingListener) in order to control what editor panels are available to users, and to process user-committed text strings and image files:

  • When NO listener is set:
    • Only the text editor panel will be available to the end-user.
    • User-committed text strings will be automatically assigned to the specified EditText view.
  • When ONLY a text listener is set:
    • Only the text editor panel will be available to the end-user.
    • User-committed converted text strings will be processed according to the listener.  
  • When ONLY an image listener is set:
    • BOTH image and text editors panel will be available to the end-user.
    • User-committed image bitmap files will be processed according to the image listener.
    • User-committed text strings will be automatically assigned to the specified EditText view.
  • When BOTH text and image listeners are set:
    • Both text and image editor panels will be available to the end-user.
    • User-committed converted text strings will be processed according to the text listener.  
    • User-committed image bitmap files will be processed according to the image listener.
Methods    

void 

setEditorType(int type)


May or may not be called with
SlookWritingBuddy(ViewGroup)

For text input panels ONLY, specifies the kind of text conversion to be performed:

type

Optional

 

TYPE_EDITOR_NUMBER

 

Numeric text conversion

Handwritten text is converted to a numeric Unicode string (number characters only)

TYPE_EDITOR_TEXT
Default

 

Alphanumeric text conversion

Handwritten text is converted to an alphabetic and/or numeric Unicode string (alphabet and number characters)

NOTE:  In text editor panels (SlookWritingBuddy(EditText)), user handwritten input will always to converted into alphanumeric Unicode characters.

int getEditorType() Returns the current type of text conversion to be performed by the invoked text input panel or text editor panel.

void

setTextWritingListener(
TextWritingListener l)


MUST be called with:
SlookWritingBuddy(ViewGroup)

May or may not be called with:
SlookWritingBuddy(EditText)

Specifies the text user-commit call listener that is to process the Unicode character string generated after the user commits a converted text input via either a text input panel or a text editor panel:

l
("el")
Declared name or specification of the text user-commit call listener

This method is called to use WritingBuddy in a normal Widget and not EditText.

void

setImageWritingListener(
ImageWritingListener l)


May or may not be called with:
SlookWritingBuddy(EditText)

Specifies the user-commit call listener that is to process the image bitmap file generated after the user commits a hand-drawn image input via an image editor panel:

l
("el")
Declared name or specification of the image user-commit call listener 

NOTE:  When called, the user can display the image editor panel by clicking the image editor UI button in the text editor panel.  When NOT called, the user cannot display the image editor panel. 

void

setEnabled(boolean enabled)

Optional

 

Activates or inactivates all WritingBuddy features:

enabled

 

 

Whether or not to activate all WritingBuddy features:

true
Default
Activate WritingBuddy features.
false Inactivate WritingBuddy features, but maintain WritingBuddy objects as specified
(for example, to be enabled later).
boolean isEnabled() Returns the current boolean status of WritingBuddy activation (true) or inactivation (false).
Fields  
TYPE_EDITOR_NUMBER Specifies the numeric text conversion (number characters only)
TYPE_EDITOR_TEXT Specifies the alphanumeric text conversion (alphabet and number characters)

SlookWritingBuddy.TextWritingListener Class

After the user commits converted text in the text input panel or text editor panel, WritingBuddy generates a Unicode text character string and issues an onTextReceived call with the text string the app listener specified in setTextWritingListener() listens for.

Methods    

void

onTextReceived(CharSequence text)

Assigns the specified variable name to the user-committed Unicode text string converted from handwritten input:

text Name of the variable for the alphanumeric or numeric-only (Unicode) character string

Specified in text user-commit listeners to support the listener's processing of the converted text string.

SlookWritingBuddy.ImageWritingListener Class

After the user commits a line drawing in the image editor panel, WritingBuddy uses it to generate a bitmap image file and issues the onImageReceived call with the file to the app listener specified in setImageWritingListener().

Methods    

void

onImageReceived(Bitmap image)

Assigns the specified variable name to the user-committed bitmap image file generated from hand-drawn input:

image Name of the variable for the bitmap image file of the user's hand drawing

Specified in image user-commit listeners to support the listener's processing of the image file.

  • Was this article helpful?