java.lang.Object | ||||
↳ | android.view.View | |||
↳ | android.view.ViewGroup | |||
↳ | android.widget.FrameLayout | |||
↳ | com.htc.painting.penmenu.PenMenu |
Provide UI widget to select pen setting for drawing on painting view and to execute functions such as undo, redo, clear, set visible of painting view (through IStrokeNotifyPaintingView interface).
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | CLEAR_ACTION_ID | The ID of action button: Clear All. | |||||||||
int | COLOR_MENU_ID | The ID of menu item: Color. | |||||||||
int | PENSET_ALL | The supported pen set on Pen Menu: All. | |||||||||
int | PENSET_SIMPLE | The supported pen set on Pen Menu: Only simple pen (the default stroke type supported by Android) and eraser pen are supported. | |||||||||
int | PENSET_SINGLE | The supported pen set on Pen Menu: Single pen. | |||||||||
int | REDO_ACTION_ID | The ID of action button: Redo the previous stroke if any. | |||||||||
int | SIZE_MENU_ID | The ID of menu item: Size. | |||||||||
int | STROKE_INVISIBLE | Constants for IPaintingView stroke visibility. | |||||||||
int | STROKE_VISIBLE | Constants for IPaintingView stroke visibility. | |||||||||
int | TYPE_MENU_ID | The ID of menu item: Stroke type. | |||||||||
int | UNDO_ACTION_ID | The ID of action button: Undo the previous stroke if any. | |||||||||
int | VISIBLE_ACTION_ID | The ID of action button: Show/Hide All. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
same as FrameLayout's constructor
| |||||||||||
same as FrameLayout's constructor
| |||||||||||
same as FrameLayout's constructor
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called to let PenMenu retrieve the previous saved state and settings.
| |||||||||||
Called to let PenMenu have chance to save current show/hide state and settings before being killed
so that the state and settings can be restored later.
| |||||||||||
Called to switch the show/hide state of the PenMenu alternately.
| |||||||||||
Force to hide the strokes (lower the opacity to the predefined value) on painting view when the value of forceHide is set to true
or restore the original state of strokes when the value of forceHide is set to false.
| |||||||||||
Receive the key event passed by applications.
| |||||||||||
Hide PenMenu.
| |||||||||||
Callback for invoke on Activity#onOptionsMenuClosed or whatever hide the PenMenu
by previous
onMenuOpened() call. | |||||||||||
Callback for invoke on Activity#onMenuOpened or whatever would overlay with PenMenu
to hide the PenMenu.
| |||||||||||
Restore current pen settings and history pens settings if any.
| |||||||||||
Save current pen settings and history pens settings if any.
| |||||||||||
When the applications implement their own painting view and integrate with Pen Menu with different behaviors,
they can disable action buttons by calling this function.
| |||||||||||
Called to enable/disable the Eraser mode.
| |||||||||||
Used for registering one listener to Pen Menu.
| |||||||||||
Associate HtcPaintingView with PenMenu.
| |||||||||||
When applications implement their own painting view and integrate with HTC Pen Menu with limited pen set,
call this function to grey out the predefined pens enabled on the device.
| |||||||||||
This method is deprecated.
Replaced by
show(boolean, boolean) since HC.
| |||||||||||
Show PenMenu.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
The ID of action button: Clear All. Clear all strokes on the painting view when this action button is tapped.
The ID of menu item: Color. Tap this menu to select the color of current stroke.
The supported pen set on Pen Menu: All. It will enable all pens to users excepts simple pen.
The supported pen set on Pen Menu: Only simple pen (the default stroke type supported by Android) and eraser pen are supported.
The supported pen set on Pen Menu: Single pen. Only support the default stroke type of Android. In this case, the eraser pen is also not supported. The menu item for selecting brush type will be greyed out.
The ID of action button: Redo the previous stroke if any. When there is no stroke to redo on the painting view, this button will be greyed out.
The ID of menu item: Size. Tap this menu to select the size (width) of current stroke.
Constants for IPaintingView stroke visibility. The ID of stroke visibility: STROKE_INVISIBLE. Set stroke to lower opacity value.
Constants for IPaintingView stroke visibility. The ID of stroke visibility: STROKE_VISIBLE. Set stroke to original opacity value.
The ID of menu item: Stroke type. Tap this menu to select pen (stroke) to draw.
The ID of action button: Undo the previous stroke if any. When there is no stroke to undo on the painting view, this button will be greyed out.
The ID of action button: Show/Hide All. Set the opacity of all strokes on the painting view to lower value when hiding them. (The final value is still under discussion and not decided yet). Reset to the original opacity value by tapping this button again.
same as FrameLayout's constructor
same as FrameLayout's constructor
Called to let PenMenu retrieve the previous saved state and settings. PenMenu will restore its state and settings after device orientation is changed.
bundle | Bundle in which to place your saved state. |
---|
Called to let PenMenu have chance to save current show/hide state and settings before being killed so that the state and settings can be restored later. PenMenu will keep its state and setting while device orientation is changed.
bundle | Bundle in which to place your saved state. |
---|
Called to switch the show/hide state of the PenMenu alternately.
Force to hide the strokes (lower the opacity to the predefined value) on painting view when the value of forceHide is set to true or restore the original state of strokes when the value of forceHide is set to false. This function is provided for integrated APPs when users want to interact with the contents behind the painting view. For example, users may press the lower hardware button of Pen to enable Text Selection function. The integrated APPs can call this function to hide on-screen strokes. It will provide a clear view to let users do Text Selection.
forceHide | true to hide the strokes, false to restore the original state of strokes. |
---|
Receive the key event passed by applications. If the Hardware Pen Button is pressed, PenMenu will then switch the show/hide state alternately.
keyCode | the key code. |
---|---|
event | the key event. |
Hide PenMenu. Client app can control whether to play animation by playAnimation parameter. And the turnOffStickyState parameter can control whether the sticky state should be forced to turn off. The sticky state is for controlling the behavior to restore PenMenu's previous show/hide state when it is hidden. If this flag is turned off, the PenMenu couldn't show itself.
playAnimation | true to play hiding animation, false to hide directly without animation. |
---|---|
turnOffStickyState | true to turn off stick state, false to keep sticky state unchanged. |
Callback for invoke on Activity#onOptionsMenuClosed or whatever hide the PenMenu
by previous onMenuOpened()
call. Client app should always call this method on
its Activity#onOptionsMenuClosed.
Note. The method should be called in pair with onMenuOpened()
Callback for invoke on Activity#onMenuOpened or whatever would overlay with PenMenu
to hide the PenMenu. Client app should always call this method on its Activity#onMenuOpened.
Note. The method should be called in pair with onMenuClosed()
Restore current pen settings and history pens settings if any. This function is designed for the feature of global pens settings (share the same preferences between all pen integrated APPs). When the setting, using the same pen settings among all pen integrated APPs, is set to true. The integrated APPs is responsible to call this function before activities are back to foreground. Once this is called, PenMune module will then restore pen settings by using the global preferences. If the setting is set to false, called this function will restore pen settings by using the local preferences. The pen integrated activities should call this method at their Activity#onResume() method.
Save current pen settings and history pens settings if any. This function is designed for the feature of global pens settings (share the same preferences between all pen integrated APPs). When the setting, using the same pen settings among all pen integrated APPs, is set to true. The integrated APPs is responsible to call this function before activities switch to background. Once this is called, PenMune module will then save current pen preferences for the next foreground pen-integrated activity. If the setting is set to false, called this function will save pen settings in the local preference. The pen integrated activities should call this method at their Activity#onPause() method.
When the applications implement their own painting view and integrate with Pen Menu with different behaviors, they can disable action buttons by calling this function. For example, when the customized painting view doesn't support Clear All function, call this function to grey out Clear All button. Simply, pass the identification of action button and its new state.
actionId | the identification of action button to set. |
---|---|
active | the state of this button. True means to enable and False to grey out this button. |
Called to enable/disable the Eraser mode. When pressing the upper buttons on the H/W Pen and the its corresponding function is configured to Eraser, applications can call this function to enable Eraser mode and the size of Eraser mode will be the same as the current size of Eraser Pen. Once the button is released, call this function with false parameter to disable Eraser mode and restore pen to previous setting.
isEraserMode | true to enable eraser mode. false to disable eraser mode. |
---|
Used for registering one listener to Pen Menu. Once registered, when the action buttons on Pen Menu are tapped by pen, the application will receive notification. The current action buttons are listed below.
The application can handle these buttons and override the behavior defined by Htc Painging View.listener | The OnActionPerformListener object to register |
---|
Associate HtcPaintingView with PenMenu. Once the association is created, any user actions made on PenMenu will apply to Painting Engine, including Pen settings (stroke, size and color) and actions (redo, undo, clear all and set ink opacity)
paintingView | the painting view to be associated with PenMenu. |
---|
When applications implement their own painting view and integrate with HTC Pen Menu with limited pen set, call this function to grey out the predefined pens enabled on the device. Currently, only following pen set are supported for Pen Menu.
penSetType | the pen set to be set. |
---|
This method is deprecated.
Replaced by show(boolean, boolean)
since HC.
Called to show PenMenu on the screen. It's equivalent to call show(true, false).
Show PenMenu. Client app can control whether to play animation by playAnimation parameter. And the turnOnStickyState parameter can control whether the sticky state should be forced to turn on. The sticky state is for controlling the behavior to restore PenMenu's previous state when it is hidden. If this flag is turned off, the method has no effect.
playAnimation | playAnimation true to play showing animation, false to show directly without animation. |
---|---|
turnOnStickyState | true to turn on stick state, false to keep sticky state unchanged. |