List of usage examples for android.view.animation Animation Animation
public Animation()
From source file:chinanurse.cn.nurse.list.WaveSwipeRefreshLayout.java
/** * @param listener {@link Animation.AnimationListener} */// w ww .java 2s.c o m private void startScaleDownAnimation(Animation.AnimationListener listener) { Animation scaleDownAnimation = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { mCircleView.scaleWithKeepingAspectRatio(1 - interpolatedTime); } }; scaleDownAnimation.setDuration(SCALE_DOWN_DURATION); mCircleView.setAnimationListener(listener); mCircleView.clearAnimation(); mCircleView.startAnimation(scaleDownAnimation); }
From source file:com.hp.hoopeasy.widget.swipeRefresh.SwipeRefreshLayout.java
private Animation startAlphaAnimation(final int startingAlpha, final int endingAlpha) { // Pre API 11, alpha is used in place of scale. Don't also use it to // type the trigger point. if (mScale && isAlphaUsedForScale()) { return null; }/*from w ww . ja v a 2s . com*/ Animation alpha = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { mProgress.setAlpha((int) (startingAlpha + ((endingAlpha - startingAlpha) * interpolatedTime))); } }; alpha.setDuration(ALPHA_ANIMATION_DURATION); // Clear out the previous animation listeners. mCircleView.setAnimationListener(null); mCircleView.clearAnimation(); mCircleView.startAnimation(alpha); return alpha; }
From source file:org.alex.refreshlayout.RefreshLayout.java
private void startScaleUpAnimation(AnimationListener listener) { circleView.setVisibility(View.VISIBLE); if (android.os.Build.VERSION.SDK_INT >= 11) { // Pre API 11, alpha is used in place of scale up to show the // progress circle appearing. // Don't adjust the alpha during appearance otherwise. progress.setAlpha(MAX_ALPHA);// w w w .j a va 2 s. c o m } scaleAnimation = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { setAnimationProgress(interpolatedTime); } }; postDelayed(new Runnable() { @Override public void run() { } }, mMediumAnimationDuration); scaleAnimation.setDuration(mMediumAnimationDuration); if (listener != null) { circleView.setAnimationListener(listener); } circleView.clearAnimation(); circleView.startAnimation(scaleAnimation); }
From source file:com.kectech.android.wyslink.thirdparty.SwipeRefreshLayout.java
private Animation startAlphaAnimation(final int startingAlpha, final int endingAlpha) { // Pre API 11, alpha is used in place of scale. Don't also use it to // tab_main_show the trigger point. if (mScale && isAlphaUsedForScale()) { return null; }//from w w w .ja v a 2s . c om Animation alpha = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { mProgress.setAlpha((int) (startingAlpha + ((endingAlpha - startingAlpha) * interpolatedTime))); } }; alpha.setDuration(ALPHA_ANIMATION_DURATION); // Clear out the previous animation listeners. mCircleView.setAnimationListener(null); mCircleView.clearAnimation(); mCircleView.startAnimation(alpha); return alpha; }
From source file:org.alex.swiperefreshlayout.SwipeRefreshLayout.java
private void startScaleUpAnimation(AnimationListener listener) { circleView.setVisibility(View.VISIBLE); if (android.os.Build.VERSION.SDK_INT >= 11) { // Pre API 11, alpha is used in place of scale up to show the // progress circle appearing. // Don't adjust the alpha during appearance otherwise. progress.setAlpha(MAX_ALPHA);// w w w . ja v a 2 s.c om } scaleAnimation = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { setAnimationProgress(interpolatedTime); } }; scaleAnimation.setDuration(mMediumAnimationDuration); if (listener != null) { circleView.setAnimationListener(listener); } circleView.clearAnimation(); circleView.startAnimation(scaleAnimation); }
From source file:com.hengye.swiperefresh.SwipeRefreshCustomLayout.java
private Animation startAlphaAnimation(final float startingAlpha, final float endingAlpha) { // Pre API 11, alpha is used in place of scale. Don't also use it to // show the trigger point. if (mScale && isAlphaUsedForScale()) { return null; }//from w w w.j av a 2 s . co m Animation alpha = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { mLoadingView.setAlpha(startingAlpha + ((endingAlpha - startingAlpha) * interpolatedTime)); mLoadingView.invalidate(); } }; alpha.setDuration(ALPHA_ANIMATION_DURATION); // Clear out the previous animation listeners. mLoadingView.setAnimationListener(null); mLoadingView.clearAnimation(); mLoadingView.startAnimation(alpha); return alpha; }
From source file:bhav.swipeaction.SwipeAction.java
private Animation startAlphaAnimation(final int startingAlpha, final int endingAlpha) { // Pre API 11, alpha is used in place of scale. Don't also use it to // show the trigger point. if (mScale) { return null; }/*from ww w . j a v a2 s. c o m*/ Animation alpha = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { // icon // .setAlpha((int) (startingAlpha + ((endingAlpha - startingAlpha) // * interpolatedTime))); } }; alpha.setDuration(ALPHA_ANIMATION_DURATION); // Clear out the previous animation listeners. mCircleView.setAnimationListener(null); mCircleView.clearAnimation(); mCircleView.startAnimation(alpha); return alpha; }
From source file:cw.kop.autobackground.sources.SourceInfoFragment.java
private void saveSource() { final Intent sourceIntent = new Intent(); String title = sourceTitle.getText().toString(); String data = sourceData.getText().toString(); if (type.equals(AppSettings.FOLDER)) { data = folderData;//from ww w .j a va 2 s .c o m } if (title.equals("")) { Toast.makeText(appContext, "Title cannot be empty", Toast.LENGTH_SHORT).show(); return; } if (data.equals("")) { Toast.makeText(appContext, "Data cannot be empty", Toast.LENGTH_SHORT).show(); return; } int num = 0; try { num = Integer.parseInt(sourceNum.getText().toString()); } catch (NumberFormatException e) { num = 1; } switch (type) { case AppSettings.WEBSITE: if (!data.contains("http")) { data = "http://" + data; } break; } if (sourcePosition == -1) { if (FileHandler.isDownloading) { Toast.makeText(appContext, "Cannot add source while downloading", Toast.LENGTH_SHORT).show(); return; } sourceIntent.setAction(SourceListFragment.ADD_ENTRY); } else { if (!getArguments().getString("title").equals(title)) { FileHandler.renameFolder(getArguments().getString("title"), title); } if (FileHandler.isDownloading) { Toast.makeText(appContext, "Cannot edit while downloading", Toast.LENGTH_SHORT).show(); return; } sourceIntent.setAction(SourceListFragment.SET_ENTRY); } sourceIntent.putExtra("type", type); sourceIntent.putExtra("title", sourceTitle.getText().toString()); sourceIntent.putExtra("data", data); sourceIntent.putExtra("num", num); sourceIntent.putExtra("position", sourcePosition); sourceIntent.putExtra("use", sourceUse.isChecked()); sourceIntent.putExtra("preview", ((CustomSwitchPreference) findPreference("source_show_preview")).isChecked()); sourceIntent.putExtra("use_time", timePref.isChecked()); sourceIntent.putExtra("time", String.format("%02d:%02d - %02d:%02d", startHour, startMinute, endHour, endMinute)); try { InputMethodManager im = (InputMethodManager) appContext.getSystemService(Context.INPUT_METHOD_SERVICE); im.hideSoftInputFromWindow(getView().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } catch (Exception e) { e.printStackTrace(); } final int screenHeight = getResources().getDisplayMetrics().heightPixels; final View fragmentView = getView(); if (fragmentView != null) { final float viewStartY = getView().getY(); Animation animation = new Animation() { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { fragmentView.setY((screenHeight - viewStartY) * interpolatedTime + viewStartY); } @Override public boolean willChangeBounds() { return true; } }; animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { LocalBroadcastManager.getInstance(appContext).sendBroadcast(sourceIntent); getFragmentManager().popBackStack(); } @Override public void onAnimationRepeat(Animation animation) { } }); animation.setDuration(SLIDE_EXIT_TIME); getView().startAnimation(animation); } else { LocalBroadcastManager.getInstance(appContext).sendBroadcast(sourceIntent); } }
From source file:com.harry.refresh.SwipyRefreshLayout.java
private Animation startAlphaAnimation(final int startingAlpha, final int endingAlpha) { // Pre API 11, alpha is used in place of scale. Don't also use it to // show the trigger point. if (mScale && isAlphaUsedForScale()) { return null; }/*ww w . j ava 2 s . c om*/ Animation alpha = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { mProgress .setAlpha((int) (startingAlpha + ((endingAlpha - startingAlpha) * interpolatedTime))); } }; alpha.setDuration(ALPHA_ANIMATION_DURATION); // Clear out the previous animation listeners. mCircleView.setAnimationListener(null); mCircleView.clearAnimation(); mCircleView.startAnimation(alpha); return alpha; }
From source file:org.alex.refreshlayout.RefreshLayout.java
protected void startScaleDownAnimation(AnimationListener listener, final boolean refreshing) { scaleDownAnimation = new Animation() { @Override// w w w .j a v a2 s .c o m public void applyTransformation(float interpolatedTime, Transformation t) { setAnimationProgress(1 - interpolatedTime); } }; scaleDownAnimation.setAnimationListener(new SimpleAnimationListener() { @Override public void onAnimationEnd(Animation animation) { super.onAnimationEnd(animation); RefreshLayout.this.refreshing = refreshing; } }); scaleDownAnimation.setDuration(SCALE_DOWN_DURATION); circleView.setAnimationListener(listener); circleView.clearAnimation(); circleView.startAnimation(scaleDownAnimation); }