/**
  * Control whether the list is being displayed. You can make it not displayed if you are waiting
  * for the initial data to show in it. During this time an indeterminant progress indicator will
  * be shown instead.
  *
  * @param shown If true, the list view is shown; if false, the progress indicator. The initial
  *     value is true.
  * @param animate If true, an animation will be used to transition to the new state.
  */
 private void setListShown(boolean shown, boolean animate) {
   ensureList();
   if (mProgressContainer == null) {
     throw new IllegalStateException("Can't be used with a custom content view");
   }
   if (mListShown == shown) {
     return;
   }
   mListShown = shown;
   if (shown) {
     if (animate) {
       mProgressContainer.startAnimation(
           AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out));
       mListContainer.startAnimation(
           AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
     } else {
       mProgressContainer.clearAnimation();
       mListContainer.clearAnimation();
     }
     mProgressContainer.setVisibility(View.GONE);
     mListContainer.setVisibility(View.VISIBLE);
   } else {
     if (animate) {
       mProgressContainer.startAnimation(
           AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
       mListContainer.startAnimation(
           AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out));
     } else {
       mProgressContainer.clearAnimation();
       mListContainer.clearAnimation();
     }
     mProgressContainer.setVisibility(View.VISIBLE);
     mListContainer.setVisibility(View.GONE);
   }
 }
  @Override
  public void onUIPositionChange(
      PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator) {

    final int mOffsetToRefresh = frame.getOffsetToRefresh();
    final int currentPos = ptrIndicator.getCurrentPosY();
    final int lastPos = ptrIndicator.getLastPosY();

    if (currentPos < mOffsetToRefresh && lastPos >= mOffsetToRefresh) {
      if (isUnderTouch && status == PtrFrameLayout.PTR_STATUS_PREPARE) {
        crossRotateLineFromBottomUnderTouch(frame);
        if (mRotateView != null) {
          mRotateView.clearAnimation();
          mRotateView.startAnimation(mReverseFlipAnimation);
        }
      }
    } else if (currentPos > mOffsetToRefresh && lastPos <= mOffsetToRefresh) {
      if (isUnderTouch && status == PtrFrameLayout.PTR_STATUS_PREPARE) {
        crossRotateLineFromTopUnderTouch(frame);
        if (mRotateView != null) {
          mRotateView.clearAnimation();
          mRotateView.startAnimation(mFlipAnimation);
        }
      }
    }
  }
  public void onResume() {
    super.onResume();
    mBackButton.clearAnimation();
    mBottomElements.clearAnimation();

    mBottomElements.setVisibility(View.VISIBLE);
    mTopElements.setVisibility(View.VISIBLE);

    mTopElementSlideInAnim.setAnimationListener(
        new AnimationListener() {

          @Override
          public void onAnimationEnd(Animation arg0) {
            toggleAllButtons(true);
          }

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

          }

          @Override
          public void onAnimationStart(Animation arg0) {
            // TODO Auto-generated method stub

          }
        });

    mBottomElements.startAnimation(mBottomElementSlideInAnim);
    mTopElements.startAnimation(mTopElementSlideInAnim);
  }
 private void setContentShown(boolean shown, boolean animate) {
   ensureContent();
   if (mContentShown == shown) {
     return;
   }
   mContentShown = shown;
   if (shown) {
     if (animate) {
       mProgressContainer.startAnimation(
           AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
       mContentContainer.startAnimation(
           AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
     } else {
       mProgressContainer.clearAnimation();
       mContentContainer.clearAnimation();
     }
     mProgressContainer.setVisibility(View.GONE);
     mContentContainer.setVisibility(View.VISIBLE);
   } else {
     if (animate) {
       mProgressContainer.startAnimation(
           AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
       mContentContainer.startAnimation(
           AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
     } else {
       mProgressContainer.clearAnimation();
       mContentContainer.clearAnimation();
     }
     mProgressContainer.setVisibility(View.VISIBLE);
     mContentContainer.setVisibility(View.GONE);
   }
 }
  @Override
  public void dismiss() {
    Animation anim = AnimationUtils.loadAnimation(context, R.anim.dialog_main_hide_amination);

    anim.setAnimationListener(
        new AnimationListener() {

          @Override
          public void onAnimationStart(Animation animation) {}

          @Override
          public void onAnimationRepeat(Animation animation) {}

          @Override
          public void onAnimationEnd(Animation animation) {
            view.post(
                new Runnable() {
                  @Override
                  public void run() {
                    ColorSelector.super.dismiss();
                  }
                });
          }
        });

    Animation backAnim = AnimationUtils.loadAnimation(context, R.anim.dialog_root_hide_amin);

    view.startAnimation(anim);
    backView.startAnimation(backAnim);
  }
  public void setIsLoading(boolean isLoading) {

    if (isLoading == mLoading || getActivity() == null) {
      return;
    }

    mLoading = isLoading;

    if (isLoading) {
      setListShown(false, true);
      mProgressContainer.startAnimation(
          AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
      mProgressContainer.setVisibility(View.VISIBLE);
    } else {
      Animation fadeOut = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out);
      fadeOut.setAnimationListener(
          new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {}

            @Override
            public void onAnimationEnd(Animation animation) {
              if (mProgressContainer != null) {
                mProgressContainer.setVisibility(View.GONE);
              }
              updateEmpty();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {}
          });
      mProgressContainer.startAnimation(fadeOut);
    }
  }
 public void setListShown(boolean shown, boolean animate) {
   if (mListShown == shown) {
     return;
   }
   mListShown = shown;
   if (shown) {
     if (animate) {
       mProgressContainer.startAnimation(
           AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out));
       mListContainer.startAnimation(
           AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
     }
     mProgressContainer.setVisibility(View.GONE);
     mListContainer.setVisibility(View.VISIBLE);
   } else {
     if (animate) {
       mProgressContainer.startAnimation(
           AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
       mListContainer.startAnimation(
           AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out));
     }
     mProgressContainer.setVisibility(View.VISIBLE);
     mListContainer.setVisibility(View.INVISIBLE);
   }
 }
Exemple #8
0
  private void setListVisibility(boolean visible, boolean animate) {
    if (listVisible == visible) {
      return;
    }

    listVisible = visible;

    if (visible) {
      if (animate) {
        loadingView.startAnimation(
            AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out));
        getListView()
            .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
      } else {
        loadingView.clearAnimation();
        getListView().clearAnimation();
      }
      loadingView.setVisibility(View.GONE);
      getListView().setVisibility(View.VISIBLE);
    } else {
      if (animate) {
        loadingView.startAnimation(
            AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
        getListView()
            .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out));
      } else {
        loadingView.clearAnimation();
        getListView().clearAnimation();
      }
      loadingView.setVisibility(View.VISIBLE);
      getListView().setVisibility(View.GONE);
    }
  }
  private void doDim(boolean fade) {
    View tintView = findViewById(R.id.window_tint);
    if (tintView == null) return;

    Window win = getWindow();
    WindowManager.LayoutParams winParams = win.getAttributes();

    winParams.flags |= (WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
    winParams.flags |= (WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

    // dim the wallpaper somewhat (how much is determined below)
    winParams.flags |= (WindowManager.LayoutParams.FLAG_DIM_BEHIND);

    if (mDimmed) {
      winParams.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
      winParams.dimAmount = DIM_BEHIND_AMOUNT_DIMMED;
      winParams.buttonBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_OFF;

      // show the window tint
      tintView.startAnimation(
          AnimationUtils.loadAnimation(this, fade ? R.anim.dim : R.anim.dim_instant));
    } else {
      winParams.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
      winParams.dimAmount = DIM_BEHIND_AMOUNT_NORMAL;
      winParams.buttonBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE;

      // hide the window tint
      tintView.startAnimation(
          AnimationUtils.loadAnimation(this, fade ? R.anim.undim : R.anim.undim_instant));
    }

    win.setAttributes(winParams);
  }
  private void updateNextPrevControls() {
    boolean showPrev = mCurrentPosition > 0;
    boolean showNext = mCurrentPosition < mAllImages.getCount() - 1;

    boolean prevIsVisible = mPrevImageView.getVisibility() == View.VISIBLE;
    boolean nextIsVisible = mNextImageView.getVisibility() == View.VISIBLE;

    if (showPrev && !prevIsVisible) {
      Animation a = mShowPrevImageViewAnimation;
      a.setDuration(500);
      mPrevImageView.startAnimation(a);
      mPrevImageView.setVisibility(View.VISIBLE);
    } else if (!showPrev && prevIsVisible) {
      Animation a = mHidePrevImageViewAnimation;
      a.setDuration(500);
      mPrevImageView.startAnimation(a);
      mPrevImageView.setVisibility(View.GONE);
    }

    if (showNext && !nextIsVisible) {
      Animation a = mShowNextImageViewAnimation;
      a.setDuration(500);
      mNextImageView.startAnimation(a);
      mNextImageView.setVisibility(View.VISIBLE);
    } else if (!showNext && nextIsVisible) {
      Animation a = mHideNextImageViewAnimation;
      a.setDuration(500);
      mNextImageView.startAnimation(a);
      mNextImageView.setVisibility(View.GONE);
    }
  }
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.box1:
       {
         v.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.view_click));
         startActivity(new Intent(getActivity(), MedicineSchedulesList.class));
         break;
       }
     case R.id.box2:
       {
         v.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.view_click));
         //                open here drug availability screen
         //                startActivity(new Intent(getActivity(), MedicineSchedulesList.class));
         break;
       }
     case R.id.box3:
       {
         v.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.view_click));
         //                open here drug delivery screen
         // startActivity(new Intent(getActivity(), LoginActivity.class));
         break;
       }
     case R.id.box4:
       {
         v.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.view_click));
         startActivity(new Intent(getActivity(), DoctorAppointment.class));
         break;
       }
   }
 }
  protected void transitionIntoActivity(Intent i) {
    mTopElements.clearAnimation();
    mBottomElements.clearAnimation();

    mSlideOutAnim.reset();
    mSlideOutAnim.setAnimationListener(new StartActivityAfterAnimation(i));
    mTopElements.startAnimation(mSlideOutAnim);
    mBottomElements.startAnimation(mSlideOutAnim);
  }
  private void enterAnim() {
    Animation turnOn = AnimationUtils.loadAnimation(getActivity().getBaseContext(), R.anim.fade_in);
    lamp.startAnimation(turnOn);

    Animation in =
        AnimationUtils.loadAnimation(
            getActivity().getBaseContext(), R.anim.popupwindow_slide_in_from_top);
    foldContent.startAnimation(in);
  }
  public static void onCreateMainMenu(Window window, final Activity activity) {
    View head = (View) window.findViewById(R.id.Headliner);
    head.startAnimation(getAnimation(0, -1));

    View leftview = (View) window.findViewById(R.id.MapButton);
    leftview.startAnimation(getAnimation(-1, 0));
    leftview = (View) window.findViewById(R.id.FavoritesButton);
    leftview.startAnimation(getAnimation(-1, 0));

    View rightview = (View) window.findViewById(R.id.SettingsButton);
    rightview.startAnimation(getAnimation(1, 0));
    rightview = (View) window.findViewById(R.id.SearchButton);
    rightview.startAnimation(getAnimation(1, 0));

    final String textVersion =
        Version.getAppVersion(((OsmandApplication) activity.getApplication()));
    final TextView textVersionView = (TextView) window.findViewById(R.id.TextVersion);
    textVersionView.setText(textVersion);
    final SharedPreferences prefs =
        activity
            .getApplicationContext()
            .getSharedPreferences("net.osmand.settings", MODE_WORLD_READABLE);
    textVersionView.setOnClickListener(
        new OnClickListener() {

          int i = 0;

          @Override
          public void onClick(View v) {
            if (i++ > 8) {
              prefs.edit().putBoolean(CONTRIBUTION_VERSION_FLAG, true).commit();
              enableLink(activity, textVersion, textVersionView);
            }
          }
        });
    // only one commit should be with contribution version flag
    //		 prefs.edit().putBoolean(CONTRIBUTION_VERSION_FLAG, true).commit();
    if (prefs.contains(CONTRIBUTION_VERSION_FLAG)) {
      enableLink(activity, textVersion, textVersionView);
    }
    View helpButton = window.findViewById(R.id.HelpButton);
    helpButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            if (TIPS_AND_TRICKS) {
              TipsAndTricksActivity tactivity = new TipsAndTricksActivity(activity);
              Dialog dlg = tactivity.getDialogToShowTips(false, true);
              dlg.show();
            } else {
              final Intent helpIntent = new Intent(activity, HelpActivity.class);
              activity.startActivity(helpIntent);
            }
          }
        });
  }
  public void onClick(View view) {

    if (view == plusButton) {
      // view.startAnimation(animAlpha);
    } else if (view == filterButton) {
      view.startAnimation(animAlpha);
    } else if (view == eventListButton) {
      view.startAnimation(animAlpha);
    }
  }
 /**
  * The first time this is called, we hide the large progress indicator and show the list view,
  * doing fade animations between them.
  */
 void makeListShown() {
   if (!mListShown) {
     mListShown = true;
     mProgressContainer.startAnimation(
         AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
     mProgressContainer.setVisibility(View.GONE);
     mListContainer.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
     mListContainer.setVisibility(View.VISIBLE);
   }
 }
 private void btnClickMore() {
   if (View.VISIBLE == popView.getVisibility()) {
     actionView.setAction(new MoreAction(), ActionView.ROTATE_COUNTER_CLOCKWISE);
     popView.clearAnimation();
     popView.startAnimation(pop_out);
   } else {
     actionView.setAction(new CloseAction(), ActionView.ROTATE_COUNTER_CLOCKWISE);
     popView.clearAnimation();
     popView.startAnimation(pop_in);
   }
 }
 @Override
 public void start() {
   mAnimation.reset();
   mRing.storeOriginals();
   // Already showing some part of the ring
   if (mRing.getEndTrim() != mRing.getStartTrim()) {
     mParent.startAnimation(mFinishAnimation);
   } else {
     mRing.setColorIndex(0);
     mRing.resetOriginals();
     mParent.startAnimation(mAnimation);
   }
 }
 public void slideUpDown(View panel) {
   if (!isPanelShown()) {
     // Show the panel
     Animation bottomUp = AnimationUtils.loadAnimation(this, R.anim.bottom_up);
     hiddenPanel.startAnimation(bottomUp);
     hiddenPanel.setVisibility(View.VISIBLE);
   } else {
     // Hide the Panel
     Animation bottomDown = AnimationUtils.loadAnimation(this, R.anim.bottom_down);
     hiddenPanel.startAnimation(bottomDown);
     hiddenPanel.setVisibility(View.GONE);
   }
 }
 @Override
 public void onScrollChanged(boolean isAtTheEnd) {
   if (isAtTheEnd) {
     if (mLikeView.getVisibility() == View.GONE) {
       mLikeView.setVisibility(View.VISIBLE);
       mLikeView.startAnimation(this.fadeIn);
     }
   } else {
     if (mLikeView.getVisibility() == View.VISIBLE) {
       mLikeView.startAnimation(this.fadeOut);
     }
   }
 }
  private void updateView(boolean isInReject) {
    // view screen changed for rejection

    if (isInReject) {
      mBoxLy.setVisibility(View.GONE);
      mRejectResasonLayout.setVisibility(View.VISIBLE);
      mSendMsgButton.setVisibility(View.VISIBLE);
      mSendMsgButton.setText(R.string.crowd_invitation_reject_button_done);
      mButtonLayout.setVisibility(View.GONE);
      mTitleName.setText(R.string.crowd_invitation_reject_titile);
    } else {
      mTitleName.setText(R.string.crowd_invitation_titile);
      if (vq.getQualState() == VMessageQualification.QualificationState.ACCEPTED) {
        mButtonLayout.setVisibility(View.GONE);
        mNotesLayout.setVisibility(View.VISIBLE);
        mSendMsgButton.setVisibility(View.VISIBLE);
        mNotesTV.setText(R.string.crowd_invitation_accept_notes);
        mAcceptedLy.setVisibility(View.VISIBLE);
      } else if (vq.getQualState() == VMessageQualification.QualificationState.REJECT) {
        mButtonLayout.setVisibility(View.GONE);
        mNotesLayout.setVisibility(View.VISIBLE);
        mSendMsgButton.setVisibility(View.GONE);
        mNotesTV.setText(R.string.crowd_invitation_reject_notes);
        mAcceptedLy.setVisibility(View.GONE);
      } else {
        mSendMsgButton.setVisibility(View.GONE);
        mButtonLayout.setVisibility(View.VISIBLE);
        mAcceptedLy.setVisibility(View.GONE);
      }
      mSendMsgButton.setText(R.string.crowd_invitation_top_bar_right_button);
      mBoxLy.setVisibility(View.VISIBLE);
      mRejectResasonLayout.setVisibility(View.GONE);
    }

    if (isInRejectReasonMode != isInReject) {
      if (isInReject) {
        Animation out = AnimationUtils.loadAnimation(mContext, R.animator.left_in);
        mRejectResasonLayout.startAnimation(out);
        Animation in = AnimationUtils.loadAnimation(mContext, R.animator.left_out);
        mBoxLy.startAnimation(in);
      } else {
        Animation out = AnimationUtils.loadAnimation(mContext, R.animator.right_in);
        mBoxLy.startAnimation(out);
        Animation in = AnimationUtils.loadAnimation(mContext, R.animator.right_out);
        mRejectResasonLayout.startAnimation(in);
      }

      isInRejectReasonMode = isInReject;
    }
  }
  public void resetSecondBottomLayoutWithAnimation() {

    mBackMainView.setVisibility(View.VISIBLE);
    AlphaAnimation backAlphaAnimation = new AlphaAnimation(0f, 1f);
    backAlphaAnimation.setDuration(PGEditConstants.EFFECT_ANIMATION_TIME);
    mBackMainView.startAnimation(backAlphaAnimation);

    AlphaAnimation nameAlphaAnimation = new AlphaAnimation(1f, 0f);
    nameAlphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
    nameAlphaAnimation.setAnimationListener(
        new AnimationAdapter() {
          @Override
          public void onAnimationEnd(Animation animation) {
            mActivity.runOnUiThread(
                new Runnable() {
                  @Override
                  public void run() {
                    if (null != mMenuListener) {
                      mMenuListener.onResetSecondBottomLayoutWithAnimationFinish();
                    }

                    AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
                    alphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
                    mSecondBottomName.startAnimation(alphaAnimation);
                  }
                });
          }
        });
    mSecondBottomName.startAnimation(nameAlphaAnimation);

    AlphaAnimation savePhotoAlphaAnimation = new AlphaAnimation(1f, 0f);
    savePhotoAlphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
    savePhotoAlphaAnimation.setAnimationListener(
        new AnimationAdapter() {
          @Override
          public void onAnimationEnd(Animation animation) {
            mActivity.runOnUiThread(
                new Runnable() {
                  @Override
                  public void run() {

                    AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
                    alphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
                    mSaveEffectView.startAnimation(alphaAnimation);
                  }
                });
          }
        });
    mSaveEffectView.startAnimation(savePhotoAlphaAnimation);
  }
 private void setTrippin(boolean beTrippin) {
   if (beTrippin) {
     mAnimationRunning = true;
     if (mCurrentAnimation == null) {
       mCurrentAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.wobble);
       mView.startAnimation(mCurrentAnimation);
     } else {
       mView.startAnimation(mCurrentAnimation);
     }
   } else {
     mView.clearAnimation();
     mAnimationRunning = false;
   }
 }
  /** Shows the panel data with awesome animations */
  public void showPanel() {

    final Animation showPanelAnim = AnimationUtils.loadAnimation(getContext(), R.anim.push_up_anim);

    Animation fadeInAnim = AnimationUtils.loadAnimation(getContext(), R.anim.fade_in_anim);

    mPanel.setVisibility(View.VISIBLE);
    mActionsPanel.setVisibility(View.VISIBLE);
    mPanel.startAnimation(showPanelAnim);
    mActionsPanel.startAnimation(showPanelAnim);

    mBackground.setVisibility(View.VISIBLE);
    mBackground.startAnimation(fadeInAnim);
  }
  @UiThread
  void verifyValid() {
    try {
      if (!isAdded()) {
        return;
      }
      ((SoliciteActivity) getActivity()).enableNextButton(valid);
      if (!valid && error.getVisibility() != View.VISIBLE) {
        AlphaAnimation anim = new AlphaAnimation(0.0f, 1.0f);
        anim.setDuration(1000);
        anim.setRepeatMode(Animation.REVERSE);
        anim.setAnimationListener(
            new Animation.AnimationListener() {
              @Override
              public void onAnimationStart(Animation animation) {}

              @Override
              public void onAnimationEnd(Animation animation) {
                error.setVisibility(View.VISIBLE);
              }

              @Override
              public void onAnimationRepeat(Animation animation) {}
            });
        error.startAnimation(anim);
      } else if (valid && error.getVisibility() != View.GONE) {
        AlphaAnimation anim = new AlphaAnimation(1.0f, 0.0f);
        anim.setDuration(1000);
        anim.setRepeatMode(Animation.REVERSE);
        anim.setAnimationListener(
            new Animation.AnimationListener() {
              @Override
              public void onAnimationStart(Animation animation) {}

              @Override
              public void onAnimationEnd(Animation animation) {
                error.setVisibility(View.GONE);
              }

              @Override
              public void onAnimationRepeat(Animation animation) {}
            });
        error.startAnimation(anim);
      }
    } catch (Exception e) {
      Log.e("ZUP", e.getMessage(), e);
      Crashlytics.logException(e);
    }
  }
    private void swipeLeft() {
      if (currentPosition < accounts.size() - 1) {
        View currentView = getChildAt(currentPosition);
        Animation fadeInAnimation =
            AnimationUtils.loadAnimation(getContext(), R.anim.slide_left_out);
        currentView.startAnimation(fadeInAnimation);
        currentView.setVisibility(View.GONE);

        View nextView = getChildAt(++currentPosition);
        fadeInAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.slide_left_in);
        nextView.startAnimation(fadeInAnimation);
        nextView.setVisibility(View.VISIBLE);
        fadeInAnimation.setAnimationListener(endAnimationLister);
      }
    }
 @Override
 public void doContentAction(
     GridTabActivity context, Animation animation, ViewFlipper viewFlipper) {
   intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
   View view = context.getLocalActivityManager().startActivity("", intent).getDecorView();
   // 切换activity时显示的动画效果
   if (this.animation != null) {
     view.startAnimation(this.animation);
   } else if (animation != null) {
     view.startAnimation(animation);
   }
   viewFlipper.removeAllViews();
   viewFlipper.addView(view);
   viewFlipper.showNext();
 }
Exemple #28
0
  @Override
  public void onClick(View v) {
    if (v.getId() == R.id.button) {
      if (expand == false) {
        view = mMap.getView();
        ResizeAnimation resizeAnimation = new ResizeAnimation(view, 1000);
        resizeAnimation.setDuration(600);
        view.startAnimation(resizeAnimation);
        expand = true;
      } else {
        ResizeAnimation resizeAnimation = new ResizeAnimation(view, 300);
        resizeAnimation.setDuration(600);
        view.startAnimation(resizeAnimation);
        expand = false;
      }
    } else if (v.getId() == R.id.machines) {
      workers.setText("Workers");
      workersClick = false;
      prepareListMachines();
      listAdapter = new Adapter(this, dataListm, listDataChildm);
      // setting list adapter
      expListView.setAdapter(listAdapter);
      if (machinesClick == false) {
        machines.setText("Refresh");
        workersClick = false;
        engineClick = false;
        machinesClick = true;
      }

    } else if (v.getId() == R.id.workers) {
      machines.setText("Machines");
      machinesClick = false;
      prepareListData();
      listAdapter = new Adapter(this, dataList, listDataChild);
      // setting list adapter
      expListView.setAdapter(listAdapter);
      if (workersClick == false) {
        workers.setText("Refresh");
        machinesClick = false;
        engineClick = false;
        workersClick = true;
      }

    } else if (v.getId() == R.id.engine) {
      Toast.makeText(MapsActivity.this, "jeszcze nie ma", Toast.LENGTH_SHORT).show();
      chart();
    }
  }
  public static void collapse(final View v) {
    final int initialHeight = v.getMeasuredHeight();

    Animation a =
        new Animation() {
          @Override
          protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime == 1) {
              v.setVisibility(View.GONE);
            } else {
              v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime);
              v.requestLayout();
            }
          }

          @Override
          public boolean willChangeBounds() {
            return true;
          }
        };

    // 1dp/ms
    a.setDuration(
        (int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
  }
  public static void expand(final View v) {
    v.measure(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    final int targetHeight = v.getMeasuredHeight();

    v.getLayoutParams().height = 0;
    v.setVisibility(View.VISIBLE);
    Animation a =
        new Animation() {
          @Override
          protected void applyTransformation(float interpolatedTime, Transformation t) {
            v.getLayoutParams().height =
                interpolatedTime == 1
                    ? LayoutParams.WRAP_CONTENT
                    : (int) (targetHeight * interpolatedTime);
            v.requestLayout();
          }

          @Override
          public boolean willChangeBounds() {
            return true;
          }
        };

    // 1dp/ms
    a.setDuration((int) (targetHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
  }