Beispiel #1
0
 @Override
 public void onAnimationEnd(Animation animation) {
   // Animation ended
   if (animation.toString().equals(animZoomIn.toString())) {
     blanket.setVisibility(View.VISIBLE);
     onPage = false;
     logo_img.setVisibility(View.GONE);
     // View view = findViewById(R.id.mainView);
     // view.setBackgroundColor(Color.parseColor("#905778db"));
     Intent intent = new Intent(getApplicationContext(), SpeakActivity.class);
     startActivityForResult(intent, 2);
   }
 }
Beispiel #2
0
  public void OnMove(int x, int y) {
    int TempPosition = pointToPosition(x, y);
    int sOffsetY = specialItemY == -1 ? y - mLastY : y - specialItemY - halfItemWidth;
    int lOffsetY = leftBtmItemY == -1 ? y - mLastY : y - leftBtmItemY - halfItemWidth;
    if (TempPosition != AdapterView.INVALID_POSITION && TempPosition != dragPosition) {
      dropPosition = TempPosition;
    } else if (specialPosition != -1
        && dragPosition == specialPosition
        && sOffsetY >= halfItemWidth) {
      dropPosition = (itemTotalCount - 1);
    } else if (leftBottomPosition != -1
        && dragPosition == leftBottomPosition
        && lOffsetY >= halfItemWidth) {
      dropPosition = (itemTotalCount - 1);
    }
    if (dragPosition != startPosition) dragPosition = startPosition;
    int MoveNum = dropPosition - dragPosition;
    if (dragPosition != startPosition && dragPosition == dropPosition) MoveNum = 0;
    if (MoveNum != 0) {
      int itemMoveNum = Math.abs(MoveNum);
      float Xoffset, Yoffset;
      for (int i = 0; i < itemMoveNum; i++) {
        if (MoveNum > 0) {
          holdPosition = dragPosition + 1;
          Xoffset = (dragPosition / nColumns == holdPosition / nColumns) ? (-1) : (nColumns - 1);
          Yoffset = (dragPosition / nColumns == holdPosition / nColumns) ? 0 : (-1);
        } else {
          holdPosition = dragPosition - 1;
          Xoffset = (dragPosition / nColumns == holdPosition / nColumns) ? 1 : (-(nColumns - 1));
          Yoffset = (dragPosition / nColumns == holdPosition / nColumns) ? 0 : 1;
        }
        ViewGroup moveView = (ViewGroup) getChildAt(holdPosition);
        Animation animation = getMoveAnimation(Xoffset, Yoffset);
        moveView.startAnimation(animation);
        dragPosition = holdPosition;
        if (dragPosition == dropPosition) LastAnimationID = animation.toString();
        final DateAdapter adapter = (DateAdapter) this.getAdapter();
        animation.setAnimationListener(
            new Animation.AnimationListener() {

              @Override
              public void onAnimationStart(Animation animation) {
                // TODO Auto-generated method stub
                isMoving = true;
              }

              @Override
              public void onAnimationRepeat(Animation animation) {
                // TODO Auto-generated method stub

              }

              @Override
              public void onAnimationEnd(Animation animation) {
                // TODO Auto-generated method stub
                String animaionID = animation.toString();
                if (animaionID.equalsIgnoreCase(LastAnimationID)) {
                  adapter.exchange(startPosition, dropPosition);
                  startPosition = dropPosition;
                  isMoving = false;
                }
              }
            });
      }
    }
  }