Esempio n. 1
0
  /** setOrientation */
  @Override
  public void setOrientation(int orientation) {
    if (TosGallery.HORIZONTAL == orientation) {
      throw new IllegalArgumentException("The orientation must be VERTICAL");
    }

    super.setOrientation(orientation);
  }
Esempio n. 2
0
  /**
   * Called by draw to draw the child views. This may be overridden by derived classes to gain
   * control just before its children are drawn (but after its own view has been drawn).
   */
  @Override
  protected void dispatchDraw(Canvas canvas) {
    super.dispatchDraw(canvas);

    // After draw child, we do the following things:
    // +1, Draw the center rectangle.
    // +2, Draw the shadows on the top and bottom.

    drawCenterRect(canvas);

    drawShadows(canvas);
  }
Esempio n. 3
0
  /** Call when the ViewGroup is layout. */
  @Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);

    int galleryCenter = getCenterOfGallery();
    View v = this.getChildAt(0);

    int height = (null != v) ? v.getMeasuredHeight() : 50;
    int top = galleryCenter - height / 2;
    int bottom = top + height;

    mSelectorBound.set(getPaddingLeft(), top, getWidth() - getPaddingRight(), bottom);
  }
Esempio n. 4
0
  /** @see com.nj1s.lib.widget.TosGallery#setSelectedPositionInt(int) */
  @Override
  protected void selectionChanged() {
    super.selectionChanged();

    playSoundEffect(SoundEffectConstants.CLICK);
  }