Ejemplo n.º 1
0
  private void initPositions() {
    // we always animate to this position, might as well save it.
    // TODO shouldnt be capitalized.
    X_ORIGINAL_POSITION = mContext.getWallpaperDesiredMinimumWidth() / 10;
    Y_ORIGINAL_POSITION = (int) mHudView.getTopOfHud() + 25;

    // set width
    width = mContext.getWallpaperDesiredMinimumWidth() - 50;
    RECT_LENGTH = X_ORIGINAL_POSITION + width;
    RECT_WIDTH = Y_ORIGINAL_POSITION + height;
    locationRect = new Rect(X_ORIGINAL_POSITION, Y_ORIGINAL_POSITION, RECT_LENGTH, RECT_WIDTH);
    xText = X_ORIGINAL_POSITION;

    // set threshold
    EVENT_BACKWARD_THRESHOLD = (int) (mContext.getWallpaperDesiredMinimumWidth() * .1); // 1/20
  }
    /**
     * 指定されたアプリ一覧を提供する {@link AppsAdapter} を構築します。
     *
     * @param appContext アプリケーションコンテキスト。 コンストラクタ内でのみ使用し、参照は保持しません。
     * @param apps 表示するアプリケーションのリスト。 渡されたリストは、アダプター内で保持します。以降呼び出し側で変更しないことを前提にしています。
     */
    public AppsAdapter(Context appContext, List<AppInfo> apps) {
      apps_ = apps;
      inflater_ = (LayoutInflater) appContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

      // 画面サイズを取得
      final int iconSize =
          getIconSize(
              appContext.getWallpaperDesiredMinimumWidth(),
              appContext.getWallpaperDesiredMinimumHeight());
      params_ = new LinearLayout.LayoutParams(iconSize, iconSize);
    }
Ejemplo n.º 3
0
  /**
   * @param nextForwardEvent - tell us if we are going forward with next event, or backwards with
   *     previous event.
   */
  private void animateChangeInEvent(final boolean nextForwardEvent) {
    // set these based on the user's gesture
    float destination = 0;
    float from = 0;
    int duration = 500;

    // get next Event and moving the view from right to left.
    if (nextForwardEvent) {
      destination = X_ORIGINAL_POSITION;
      from = mContext.getWallpaperDesiredMinimumWidth();
    }
    // get previous Event and move the view from left to right.
    else {
      from = -500;
      destination = X_ORIGINAL_POSITION;
    }

    isAnimating = true;
    animateEventChange(from, destination, duration, nextForwardEvent);
  }