Exemple #1
0
  /**
   * Constructor allowing orientation override
   *
   * @param context Context
   * @param orientation Layout orientation, can be vartical or horizontal
   */
  public QuickAction(Context context, int orientation) {
    super(context);

    mOrientation = orientation;

    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    if (mOrientation == HORIZONTAL) {
      setRootViewId(R.layout.popup_horizontal);
    } else {
      setRootViewId(R.layout.popup_vertical);
    }

    mAnimStyle = ANIM_AUTO;
    mChildPos = 0;
  }
Exemple #2
0
  /**
   * Constructor.
   *
   * @param context Context
   */
  public QuickAction(Context context) {
    super(context);

    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    mTrackAnim = AnimationUtils.loadAnimation(context, R.anim.rail);

    mTrackAnim.setInterpolator(
        new Interpolator() {
          public float getInterpolation(float t) {
            // Pushes past the target area, then snaps back into place.
            // Equation for graphing: 1.2-((x*1.6)-1.1)^2
            final float inner = (t * 1.55f) - 1.1f;

            return 1.2f - inner * inner;
          }
        });

    setRootViewId(R.layout.quickaction);

    mAnimStyle = ANIM_AUTO;
    mAnimateTrack = true;
    mChildPos = 0;
  }