App

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
mhr.appandroid.views.imagepresentationview.LayerView Class Reference
Inheritance diagram for mhr.appandroid.views.imagepresentationview.LayerView:

## Classes
interface | OnLayerViewEventListener
enum | SelectedState

## Public Member Functions
void | setLayerViewEventListener (OnLayerViewEventListener listener)
void | setState (SelectedState state)
SelectedState | getState ()
Rect | getLayerPreviewRect ()
Rect | getMaskPreviewRect ()
| LayerView (Context context)
| LayerView (Context context, AttributeSet attrs)
| LayerView (Context context, AttributeSet attrs, int defStyle)
void | presentLayer (LayerPDInfo info)
void | onCheckedChanged (CompoundButton buttonView, boolean isChecked)
void | onClick (View v)
boolean | onLongClick (View v)
boolean | onDragEvent (DragEvent event)
boolean | onMenuItemClick (MenuItem item)

## Protected Member Functions
void | init ()

## Protected Attributes
LayerType | layerType
int | layerId
SelectedState | state
ImageView | layerThumbIV
ImageView | maskThumbIV
SimpleBitmapView | layerPreviewSBV
SimpleBitmapView | maskPreviewSBV
CheckBox | layerVisibleChB
CheckBox | maskActiveChB
View | layerPreviewCheckedV
View | layerMaskPreviewCheckedV
View | LayerViewOverlay
ImageView | moveLayerIcoIV
PopupMenu | handlePopup
PopupMenu | layerPopup
PopupMenu | maskPopup
int | checkedColor
int | uncheckedColor
OnLayerViewEventListener | listener = null

## Detailed Description

Definition at line 32 of file LayerView.java.

## Constructor & Destructor Documentation

mhr.appandroid.views.imagepresentationview.LayerView.LayerView | ( | Context | context | ) |
| inline

Definition at line 86 of file LayerView.java.

{
super(context);
init();
}

mhr.appandroid.views.imagepresentationview.LayerView.LayerView | ( | Context | context,
|  | AttributeSet | attrs
| ) |  |
| inline

Definition at line 91 of file LayerView.java.

{
super(context, attrs);
init();
}

mhr.appandroid.views.imagepresentationview.LayerView.LayerView | ( | Context | context,
|  | AttributeSet | attrs,
|  | int | defStyle
| ) |  |
| inline

Definition at line 96 of file LayerView.java.

{
super(context, attrs, defStyle);
init();
}

## Member Function Documentation

Rect mhr.appandroid.views.imagepresentationview.LayerView.getLayerPreviewRect | ( |  | ) |
| inline

Definition at line 75 of file LayerView.java.

{
return layerPreviewSBV.getDstRect();
}

Rect mhr.appandroid.views.imagepresentationview.LayerView.getMaskPreviewRect | ( |  | ) |
| inline

Definition at line 81 of file LayerView.java.

{
return maskPreviewSBV.getDstRect();
}

SelectedState mhr.appandroid.views.imagepresentationview.LayerView.getState | ( |  | ) |
| inline

Definition at line 69 of file LayerView.java.

{
return state;
}

void mhr.appandroid.views.imagepresentationview.LayerView.init | ( |  | ) |
| inlineprotected

Definition at line 162 of file LayerView.java.

{
try {
((Activity) getContext()).getLayoutInflater().inflate(R.layout.view_layer, this, true);
} catch (ClassCastException exc) {
// Tento kod probehne, pokud je poroblem s pretypovanim, napriklad pro nahled v Eclipse
TextView tv = new TextView(getContext());
tv.setText("Prewiew not available, requires Activity to be Context.");
addView(tv);
return;
}
layerThumbIV = (ImageView) findViewById(R.id.LayerThumb);
maskThumbIV = (ImageView) findViewById(R.id.LayerMaskThumb);
layerPreviewSBV = (SimpleBitmapView) findViewById(R.id.LayerPreview);
maskPreviewSBV = (SimpleBitmapView) findViewById(R.id.LayerMaskPreview);
layerVisibleChB = (CheckBox) findViewById(R.id.LayerVisibleChckB);
maskActiveChB = (CheckBox) findViewById(R.id.MaskAppliedChckB);
layerPreviewCheckedV = findViewById(R.id.LayerPreviewChecked);
layerMaskPreviewCheckedV = findViewById(R.id.LayerMaskPreviewChecked);
moveLayerIcoIV = (ImageView) findViewById(R.id.MoveLayerIco);
LayerViewOverlay = findViewById(R.id.LayerViewOverlay);
layerPreviewCheckedV.setOnClickListener(this);
layerPreviewCheckedV.setOnLongClickListener(this);
layerMaskPreviewCheckedV.setOnClickListener(this);
layerMaskPreviewCheckedV.setOnLongClickListener(this);
moveLayerIcoIV.setOnClickListener(this);
moveLayerIcoIV.setOnLongClickListener(this);
layerVisibleChB.setOnCheckedChangeListener(this);
maskActiveChB.setOnCheckedChangeListener(this);
maskPreviewSBV.getBitmapBackground().setShader(new BitmapShader(BitmapFactory.decodeResource(getResources(), R.drawable.checkboard), TileMode.REPEAT, TileMode.REPEAT));
layerPreviewSBV.getBitmapBackground().setShader(new BitmapShader(BitmapFactory.decodeResource(getResources(), R.drawable.checkboard), TileMode.REPEAT, TileMode.REPEAT));
layerPreviewSBV.setBitmapForeground(null);
uncheckedColor = 0x00000000;
checkedColor = getResources().getColor(R.color.SelectedToolBackground);
setState(SelectedState.SELECTED_NONE);
layerType = null;
layerId = -1;
handlePopup = new PopupMenu(getContext(), this);
handlePopup.inflate(R.menu.view_layer_view);
handlePopup.setOnMenuItemClickListener(this);
layerPopup = new PopupMenu(getContext(), this);
layerPopup.inflate(R.menu.view_layer_view_layer);
layerPopup.setOnMenuItemClickListener(this);
maskPopup = new PopupMenu(getContext(), this);
maskPopup.inflate(R.menu.view_layer_view_mask);
maskPopup.setOnMenuItemClickListener(this);
}

void mhr.appandroid.views.imagepresentationview.LayerView.onCheckedChanged | ( | CompoundButton | buttonView,
|  | boolean | isChecked
| ) |  |
| inline

Definition at line 222 of file LayerView.java.

{
if (buttonView == layerVisibleChB) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_VISIBILITY_CHANGED, layerId, isChecked));
}
} else if (buttonView == maskActiveChB) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_MASK_ACTIVE_CHANGED, layerId, isChecked));
}
}
}

void mhr.appandroid.views.imagepresentationview.LayerView.onClick | ( | View | v | ) |
| inline

Definition at line 235 of file LayerView.java.

{
if (v == layerPreviewCheckedV) {
if (state != SelectedState.SELECTED_LAYER) {
setState(SelectedState.SELECTED_LAYER);
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_SELECTED, layerId));
}
}
} else if (v == layerMaskPreviewCheckedV) {
if (state != SelectedState.SELECTED_MASK) {
setState(SelectedState.SELECTED_MASK);
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_MASK_SELECTED, layerId));
}
}
} else if (v == moveLayerIcoIV) {
handlePopup.show();
}
}

boolean mhr.appandroid.views.imagepresentationview.LayerView.onDragEvent | ( | DragEvent | event | ) |
| inline

Definition at line 276 of file LayerView.java.

{
if (event.getAction() == DragEvent.ACTION_DRAG_ENDED) {
LayerViewOverlay.setVisibility(GONE);
return true;
}
return false; // Dost podezrely vyznam
}

boolean mhr.appandroid.views.imagepresentationview.LayerView.onLongClick | ( | View | v | ) |
| inline

Definition at line 256 of file LayerView.java.

{
if (v == moveLayerIcoIV) {
ClipData data = ClipData.newPlainText("LayerId", Integer.toString(layerId));
DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(this);
startDrag(data, shadowBuilder, this, 0);
LayerViewOverlay.setVisibility(VISIBLE);
return true;
} else if (v == layerPreviewCheckedV) {
layerPopup.show();
return true;
} else if (v == layerMaskPreviewCheckedV) {
maskPopup.show();
return true;
} else {
return true;
}
}

boolean mhr.appandroid.views.imagepresentationview.LayerView.onMenuItemClick | ( | MenuItem | item | ) |
| inline

Definition at line 285 of file LayerView.java.

{
final int id = item.getItemId();
if (id == R.id.LayerPopUpDelete) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_DELETED, layerId));
}
} else if (id == R.id.LayerPopUpDuplicate) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_DUPLICATED, layerId));
}
} else if (id == R.id.LayerPopUpCopyLayerBitmap) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_COPY_BITMAP, layerId));
}
} else if (id == R.id.LayerPopUpPasteLayerBitmap) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_PASTE_BITMAP, layerId));
}
} else if (id == R.id.LayerPopUpClearLayerBitmap) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_CLEAR_BITMAP, layerId));
}
} else if (id == R.id.LayerPopUpAddLayerBitmap) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_ADD_BITMAP, layerId));
}
} else if (id == R.id.LayerPopUpRemoveLayerBitmap) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_REMOVE_BITMAP, layerId));
}
} else if (id == R.id.LayerPopUpBlendLayerBitmap) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_BLEND_BITMAP, layerId));
}
} else if (id == R.id.LayerPopUpCopyMaskBitmap) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_MASK_COPY_BITMAP, layerId));
}
} else if (id == R.id.LayerPopUpPasteMaskBitmap) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_MASK_PASTE_BITMAP, layerId));
}
} else if (id == R.id.LayerPopUpClearMaskBitmap) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_MASK_CLEAR_BITMAP, layerId));
}
} else if (id == R.id.LayerPopUpFillMaskBitmap) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_MASK_FILL_BITMAP, layerId));
}
} else if (id == R.id.LayerPopUpInvertMaskBitmap) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_MASK_INVERT_BITMAP, layerId));
}
} else if (id == R.id.LayerPopUpAddMaskBitmap) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_MASK_ADD_BITMAP, layerId));
}
} else if (id == R.id.LayerPopUpRemoveMaskBitmap) {
if (listener != null) {
listener.onLayerViewEvent(this, new ImagePresentationEvent(EventType.LAYER_MASK_REMOVE_BITMAP, layerId));
}
}
return true;
}

void mhr.appandroid.views.imagepresentationview.LayerView.presentLayer | ( | LayerPDInfo | info | ) |
| inline

Definition at line 103 of file LayerView.java.

{
if (layerId == info.id && !info.isChanged) {
return;
}
layerId = info.id;
layerType = info.type;
layerVisibleChB.setChecked(info.visible);
maskActiveChB.setChecked(info.maskActive);
if (info.getMaskThumb(false) != null) {
maskPreviewSBV.setBitmap(((APDBitmap) info.getMaskThumb(false)).getBitmap());
maskPreviewSBV.setVisibility(VISIBLE);
maskThumbIV.setVisibility(INVISIBLE);
} else {
maskPreviewSBV.setVisibility(INVISIBLE);
maskThumbIV.setVisibility(VISIBLE);
}
switch (layerType) {
case LAYER_RASTER:
layerPreviewSBV.setBitmap(((APDBitmap) info.getLayerThumb(false)).getBitmap());
layerPreviewSBV.setVisibility(VISIBLE);
layerThumbIV.setVisibility(INVISIBLE);
break;
default:
break;
}
info.isChanged = false;
}

void mhr.appandroid.views.imagepresentationview.LayerView.setLayerViewEventListener | ( | OnLayerViewEventListener | listener | ) |
| inline

Definition at line 47 of file LayerView.java.

{
this.listener = listener;
}

void mhr.appandroid.views.imagepresentationview.LayerView.setState | ( | SelectedState | state | ) |
| inline

Definition at line 51 of file LayerView.java.

{
this.state = state;
switch (state) {
case SELECTED_LAYER:
layerPreviewCheckedV.setBackgroundColor(checkedColor);
layerMaskPreviewCheckedV.setBackgroundColor(uncheckedColor);
break;
case SELECTED_MASK:
layerPreviewCheckedV.setBackgroundColor(uncheckedColor);
layerMaskPreviewCheckedV.setBackgroundColor(checkedColor);
break;
case SELECTED_NONE:
layerPreviewCheckedV.setBackgroundColor(uncheckedColor);
layerMaskPreviewCheckedV.setBackgroundColor(uncheckedColor);
break;
}
}

## Member Data Documentation

int mhr.appandroid.views.imagepresentationview.LayerView.checkedColor
| protected

Definition at line 154 of file LayerView.java.

PopupMenu mhr.appandroid.views.imagepresentationview.LayerView.handlePopup
| protected

Definition at line 150 of file LayerView.java.

int mhr.appandroid.views.imagepresentationview.LayerView.layerId
| protected

Definition at line 136 of file LayerView.java.

View mhr.appandroid.views.imagepresentationview.LayerView.layerMaskPreviewCheckedV
| protected

Definition at line 146 of file LayerView.java.

PopupMenu mhr.appandroid.views.imagepresentationview.LayerView.layerPopup
| protected

Definition at line 151 of file LayerView.java.

View mhr.appandroid.views.imagepresentationview.LayerView.layerPreviewCheckedV
| protected

Definition at line 145 of file LayerView.java.

SimpleBitmapView mhr.appandroid.views.imagepresentationview.LayerView.layerPreviewSBV
| protected

Definition at line 141 of file LayerView.java.

ImageView mhr.appandroid.views.imagepresentationview.LayerView.layerThumbIV
| protected

Definition at line 139 of file LayerView.java.

LayerType mhr.appandroid.views.imagepresentationview.LayerView.layerType
| protected

Definition at line 135 of file LayerView.java.

View mhr.appandroid.views.imagepresentationview.LayerView.LayerViewOverlay
| protected

Definition at line 147 of file LayerView.java.

CheckBox mhr.appandroid.views.imagepresentationview.LayerView.layerVisibleChB
| protected

Definition at line 143 of file LayerView.java.

OnLayerViewEventListener mhr.appandroid.views.imagepresentationview.LayerView.listener = null
| protected

Definition at line 157 of file LayerView.java.

CheckBox mhr.appandroid.views.imagepresentationview.LayerView.maskActiveChB
| protected

Definition at line 144 of file LayerView.java.

PopupMenu mhr.appandroid.views.imagepresentationview.LayerView.maskPopup
| protected

Definition at line 152 of file LayerView.java.

SimpleBitmapView mhr.appandroid.views.imagepresentationview.LayerView.maskPreviewSBV
| protected

Definition at line 142 of file LayerView.java.

ImageView mhr.appandroid.views.imagepresentationview.LayerView.maskThumbIV
| protected

Definition at line 140 of file LayerView.java.

ImageView mhr.appandroid.views.imagepresentationview.LayerView.moveLayerIcoIV
| protected

Definition at line 148 of file LayerView.java.

SelectedState mhr.appandroid.views.imagepresentationview.LayerView.state
| protected

Definition at line 137 of file LayerView.java.

int mhr.appandroid.views.imagepresentationview.LayerView.uncheckedColor
| protected

Definition at line 155 of file LayerView.java.

The documentation for this class was generated from the following file:

- /home/xxx/eclipse_workspaces/app/appandroid/src/mhr/appandroid/views/imagepresentationview/LayerView.java