Home | History | Annotate | Download | only in phototable

Lines Matching defs:photo

347     private double[] getCenter(View photo) {
348 float width = (float) ((Integer) photo.getTag(R.id.photo_width)).intValue();
349 float height = (float) ((Integer) photo.getTag(R.id.photo_height)).intValue();
350 double[] center = { photo.getX() + width / 2f,
351 - (photo.getY() + height / 2f) };
437 for (View photo: mOnTable) {
438 if (photo != getSelection()) {
439 dropOnTable(photo);
465 View photo = inflater.inflate(R.layout.photo, null);
466 ImageView image = (ImageView) photo;
471 photo = null;
481 photo.setTag(R.id.photo_width, Integer.valueOf(photoWidth));
482 photo.setTag(R.id.photo_height, Integer.valueOf(photoHeight));
484 photo.setOnTouchListener(new PhotoTouchListener(table.getContext(),
487 return photo;
519 public void onPostExecute(View photo) {
520 if (photo != null) {
523 PhotoTable.this.addView(photo, new LayoutParams(LayoutParams.WRAP_CONTENT,
525 PhotoTable.this.mOnDeck[mSlot] = photo;
526 float width = (float) ((Integer) photo.getTag(R.id.photo_width)).intValue();
527 float height = (float) ((Integer) photo.getTag(R.id.photo_height)).intValue();
528 photo.setX(mSlot == PREV ? -2 * width : mWidth + 2 * width);
529 photo.setY((mHeight - height) / 2);
530 photo.addOnLayoutChangeListener(new OnLayoutChangeListener() {
539 recycle(photo);
557 log("load a new photo");
565 public void onPostExecute(View photo) {
566 if (photo != null) {
569 table.addView(photo, new LayoutParams(LayoutParams.WRAP_CONTENT,
581 table.throwOnTable(photo);
597 /** Bring a new photo onto the table. */
612 public void fadeOutBackground(final View photo) {
623 bringChildToFront(photo);
633 public void fadeInBackground(final View photo) {
635 mWaitingToJoinBackground.add(photo);
648 bringChildToFront(photo);
663 for(View photo: mWaitingToJoinBackground) {
664 moveToBackground(photo);
669 /** Dispose of the photo gracefully, in case we can see some of it. */
670 public void fadeAway(final View photo, final boolean replace) {
672 mOnTable.remove(photo);
673 exitStageLeft(photo);
674 photo.setOnTouchListener(null);
675 photo.animate().cancel();
676 photo.animate()
683 if (photo == getFocus()) {
686 mStageLeft.removeView(photo);
687 recycle(photo);
696 public void moveToTopOfPile(View photo) {
697 // make this photo the last to be removed.
698 if (isInBackground(photo)) {
699 mBackground.bringChildToFront(photo);
701 bringChildToFront(photo);
704 mOnTable.remove(photo);
705 mOnTable.offer(photo);
708 /** On deck is to the left or right of the selected photo. */
709 private void placeOnDeck(final View photo, final int slot ) {
711 if (mOnDeck[slot] != null && mOnDeck[slot] != photo) {
714 mOnDeck[slot] = photo;
715 float photoWidth = photo.getWidth();
716 float photoHeight = photo.getHeight();
725 photo.animate()
739 public void move(final View photo, float x, float y, float a) {
740 photo.animate().cancel();
741 photo.setAlpha(1f);
742 photo.setX((int) x);
743 photo.setY((int) y);
744 photo.setRotation((int) a);
748 private void throwOnTable(final View photo) {
749 mOnTable.offer(photo);
751 photo.setRotation(mThrowRotation);
752 photo.setX(-mLongSide);
753 photo.setY(-mLongSide);
755 dropOnTable(photo, mThrowInterpolator);
758 public void move(final View photo, float dx, float dy, boolean drop) {
759 if (photo != null) {
760 final float x = photo.getX() + dx;
761 final float y = photo.getY() + dy;
762 photo.setX(x);
763 photo.setY(y);
764 Log.d(TAG, "[" + photo.getX() + ", " + photo.getY() + "] + (" + dx + "," + dy + ")");
765 if (drop && photoOffTable(photo)) {
766 fadeAway(photo, true);
772 public void fling(final View photo) {
775 final float[] a = { photo.getX(), photo.getY() };
789 fling(photo, delta[0], delta[1], duration, true);
793 public void fling(final View photo, float dx, float dy, int duration, boolean spin) {
794 if (photo == getFocus()) {
795 if (moveFocus(photo, 0f) == null) {
796 moveFocus(photo, 180f);
799 moveToForeground(photo);
800 ViewPropertyAnimator animator = photo.animate()
811 if (photoOffTable(photo, (int) dx, (int) dy)) {
816 fadeAway(photo, true);
821 public boolean photoOffTable(final View photo) {
822 return photoOffTable(photo, 0, 0);
825 public boolean photoOffTable(final View photo, final int dx, final int dy) {
827 photo.getHitRect(hit);
834 public void dropOnTable(final View photo) {
835 dropOnTable(photo, mDropInterpolator);
839 public void dropOnTable(final View photo, final Interpolator interpolator) {
849 float x0 = photo.getX();
850 float y0 = photo.getY();
866 photo.animate()
878 mWaitingToJoinBackground.add(photo);
883 private void moveToBackground(View photo) {
884 if (mBackgroudOptimization && !isInBackground(photo)) {
885 removeViewFromParent(photo);
886 mBackground.addView(photo, new LayoutParams(LayoutParams.WRAP_CONTENT,
891 private void exitStageLeft(View photo) {
892 removeViewFromParent(photo);
893 mStageLeft.addView(photo, new LayoutParams(LayoutParams.WRAP_CONTENT,
897 private void removeViewFromParent(View photo) {
898 ViewParent parent = photo.getParent();
900 ((ViewGroup) parent).removeView(photo);
904 private void moveToForeground(View photo) {
905 if (mBackgroudOptimization && isInBackground(photo)) {
906 mBackground.removeView(photo);
907 addView(photo, new LayoutParams(LayoutParams.WRAP_CONTENT,
912 private boolean isInBackground(View photo) {
913 return mBackgroudOptimization && mBackground.indexOfChild(photo) != -1;
924 /** Animate the selected photo to the foreground: zooming in to bring it forward. */
925 private void pickUp(final View photo) {
926 float photoWidth = photo.getWidth();
927 float photoHeight = photo.getHeight();
936 photo.setRotation(wrapAngle(photo.getRotation()));
940 mWaitingToJoinBackground.remove(photo);
941 moveToForeground(photo);
942 photo.animate()
956 log("endtimes: %f", photo.getX());
961 private Bitmap getBitmap(View photo) {
962 if (photo == null) {
965 ImageView image = (ImageView) photo;
977 private void recycle(View photo) {
978 if (photo != null) {
979 removeViewFromParent(photo);
980 mPhotoSource.recycle(getBitmap(photo));
984 public void setHighlight(View photo, boolean highlighted) {
985 ImageView image = (ImageView) photo;