Exemplo n.º 1
0
    @Override
    public void onPostExecute(View photo) {
      if (photo != null && !mFinished) {
        final PhotoTable table = PhotoTable.this;

        table.addView(
            photo, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        if (table.hasSelection()) {
          for (int slot = 0; slot < mOnDeck.length; slot++) {
            if (mOnDeck[slot] != null) {
              table.moveToTopOfPile(mOnDeck[slot]);
            }
          }
          table.moveToTopOfPile(table.getSelection());
        }

        log("drop it");
        table.throwOnTable(photo);

        if (mOnTable.size() > mTableCapacity) {
          int targetSize = Math.max(0, mOnTable.size() - mRedealCount);
          while (mOnTable.size() > targetSize) {
            fadeAway(mOnTable.poll(), false);
          }
        }

        if (table.mOnTable.size() < table.mTableCapacity) {
          table.scheduleNext(table.mFastDropPeriod);
        }
      }
    }
Exemplo n.º 2
0
 /** Schedule the first launch. Idempotent. */
 public void start() {
   if (!mStarted) {
     log("kick it");
     mStarted = true;
     scheduleNext(0);
   }
 }