protected void dispatchDraw(Canvas canvas) { if (AbstractTnGraphics.getInstance() != null) { AbstractTnGraphics.getInstance().setGraphics(canvas); canvas.save(); tnContainer.draw(AbstractTnGraphics.getInstance()); canvas.restore(); } super.dispatchDraw(canvas); }
public Object callUiMethod(int eventMethod, Object[] args) { Object obj = AndroidUiMethodHandler.callUiMethod(tnContainer, this, eventMethod, args); if (!AndroidUiMethodHandler.NO_HANDLED.equals(obj)) return obj; switch (eventMethod) { case TnLinearContainer.METHOD_SCROLLABLE: { this.setScrollContainer(((Boolean) args[0]).booleanValue()); break; } case TnLinearContainer.METHOD_ORIENTATION: { int orientation = HORIZONTAL; if (tnContainer.isVertical()) { orientation = VERTICAL; } this.setOrientation(orientation); break; } case TnLinearContainer.METHOD_SET_PADDING: { if (args != null && args.length > 3) { int left = ((Integer) args[0]).intValue(); int top = ((Integer) args[1]).intValue(); int right = ((Integer) args[2]).intValue(); int bottom = ((Integer) args[3]).intValue(); this.setPadding(left, top, right, bottom); } break; } case TnLinearContainer.METHOD_SET_ANCHOR: { int gravity = Gravity.NO_GRAVITY; int arg = tnContainer.getAnchor(); if ((arg & AbstractTnGraphics.LEFT) != 0) { gravity |= Gravity.LEFT; } if ((arg & AbstractTnGraphics.RIGHT) != 0) { gravity |= Gravity.RIGHT; } if ((arg & AbstractTnGraphics.TOP) != 0) { gravity |= Gravity.TOP; } if ((arg & AbstractTnGraphics.BOTTOM) != 0) { gravity |= Gravity.BOTTOM; } if ((arg & AbstractTnGraphics.HCENTER) != 0) { gravity |= Gravity.CENTER_HORIZONTAL; } if ((arg & AbstractTnGraphics.VCENTER) != 0) { gravity |= Gravity.CENTER_VERTICAL; } this.setGravity(gravity); break; } } return null; }