Java Code Examples for android.view.animation.Animation#setRepeatCount()
The following examples show how to use
android.view.animation.Animation#setRepeatCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BridgeActivity.java From Android-Bridge-App with MIT License | 6 votes |
private void setupUpdateService() { if (isInternalVersion()) { updateAvailableReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { btnInstallUpdate.setVisibility(View.VISIBLE); Animation mAnimation = new AlphaAnimation(1, 0); mAnimation.setDuration(200); mAnimation.setInterpolator(new LinearInterpolator()); mAnimation.setRepeatCount(Animation.INFINITE); mAnimation.setRepeatMode(Animation.REVERSE); btnInstallUpdate.startAnimation(mAnimation); } }; updateAvailableFilter = new IntentFilter(getResources().getString(R.string.intent_filter_update_available)); bridgeUpdateService = new BridgeUpdateService(); bridgeServiceIntent = new Intent(this, bridgeUpdateService.getClass()); if (!isMyServiceRunning(bridgeUpdateService.getClass())) { startService(bridgeServiceIntent); } } }
Example 2
Source File: FakeLoadingWithLogoView.java From CommonUtils with Apache License 2.0 | 6 votes |
public void animateTo(int duration, float to, @NonNull Interpolator interpolator, boolean repeatInfinite, @Nullable Animation.AnimationListener listener) { float startFrom = percentage; float toGo = to - startFrom; Animation anim = new Animation() { { setInterpolator(interpolator); setDuration(duration); } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { setPercentage(startFrom + interpolatedTime * toGo); } }; if (repeatInfinite) { anim.setRepeatCount(Animation.INFINITE); anim.setRepeatMode(Animation.RESTART); } else { anim.setRepeatCount(0); } anim.setAnimationListener(listener); startAnimationInternal(anim); }
Example 3
Source File: Compass.java From VistArrow with MIT License | 6 votes |
private void adjustArrow() { if (arrowView == null) { Log.i(TAG, "arrow view is not set"); return; } Log.i(TAG, "will set rotation from " + currectAzimuth + " to " + azimuth); Animation an = new RotateAnimation(-currectAzimuth, -azimuth, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); currectAzimuth = azimuth; an.setDuration(500); an.setRepeatCount(0); an.setFillAfter(true); arrowView.startAnimation(an); }
Example 4
Source File: MainActivity.java From privacy-friendly-passwordgenerator with GNU General Public License v3.0 | 6 votes |
public void hints(int position) { Animation anim = new AlphaAnimation(0.0f, 1.0f); if (metadatalist.size() == 0 || position == 0) { initialAlert.setVisibility(View.VISIBLE); anim.setDuration(1500); anim.setStartOffset(20); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(Animation.INFINITE); initialAlert.startAnimation(anim); } else { initialAlert.setVisibility(View.GONE); initialAlert.clearAnimation(); } }
Example 5
Source File: AwesomeTextView.java From Android-Bootstrap with MIT License | 6 votes |
/** * Starts a Flashing Animation on the AwesomeTextView * * @param forever whether the animation should be infinite or play once * @param speed how fast the item should flash */ public void startFlashing(boolean forever, AnimationSpeed speed) { Animation fadeIn = new AlphaAnimation(0, 1); //set up extra variables fadeIn.setDuration(50); fadeIn.setRepeatMode(Animation.REVERSE); //default repeat count is 0, however if user wants, set it up to be infinite fadeIn.setRepeatCount(0); if (forever) { fadeIn.setRepeatCount(Animation.INFINITE); } fadeIn.setStartOffset(speed.getFlashDuration()); startAnimation(fadeIn); }
Example 6
Source File: SunRefreshDrawable.java From CanRefresh with Apache License 2.0 | 5 votes |
private void setupAnimations() { mAnimation = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { setRotate(interpolatedTime); } }; mAnimation.setRepeatCount(Animation.INFINITE); mAnimation.setRepeatMode(Animation.RESTART); mAnimation.setInterpolator(LINEAR_INTERPOLATOR); mAnimation.setDuration(ANIMATION_DURATION); }
Example 7
Source File: UiUtils.java From android-agera with Apache License 2.0 | 5 votes |
/** * Starts an animation that will jank if the UI thread is busy. * @param animView */ static void startAnimation(View animView) { Animation tx = new TranslateAnimation(-350, 350, 0, 0); tx.setDuration(1000); tx.setRepeatCount(Animation.INFINITE); tx.setInterpolator(new AccelerateDecelerateInterpolator()); tx.setRepeatMode(Animation.REVERSE); animView.startAnimation(tx); }
Example 8
Source File: RentalsSunDrawable.java From android-Ultra-Pull-To-Refresh-With-Load-More-master with MIT License | 5 votes |
private void setupAnimations() { mAnimation = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { setRotate(interpolatedTime); } }; mAnimation.setRepeatCount(Animation.INFINITE); mAnimation.setRepeatMode(Animation.RESTART); mAnimation.setInterpolator(LINEAR_INTERPOLATOR); mAnimation.setDuration(ANIMATION_DURATION); }
Example 9
Source File: ResultsActivity.java From Onesearch with MIT License | 5 votes |
private void updateSavedScoreAndRenderViews() { TextView scoreTextView = (TextView) findViewById(R.id.tvScoreResult); scoreTextView.setText(Integer.toString(mScore)); if (mGameMode != null) { SharedPreferences prefs = getSharedPreferences(PREF_NAME, MODE_PRIVATE); int bestScore = prefs.getInt(SCORE_PREFIX + mGameMode.getDifficulty(), 0); mPreviousBestScore = bestScore; if (mScore > bestScore) { SharedPreferences.Editor editor = getSharedPreferences(PREF_NAME, MODE_PRIVATE).edit(); editor.putInt(SCORE_PREFIX + mGameMode.getDifficulty(), mScore); editor.apply(); findViewById(R.id.tvBestScoreResultNotify).setVisibility(View.VISIBLE); Animation anim = new AlphaAnimation(1.0f, 0.0f); anim.setDuration(200); anim.setStartOffset(0); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(6); findViewById(R.id.tvBestScoreResultNotify).startAnimation(anim); ((TextView) findViewById(R.id.tvBestScoreResult)).setText(Integer.toString(mScore)); } else { ((TextView) findViewById(R.id.tvBestScoreResult)).setText(Integer.toString(bestScore)); } } }
Example 10
Source File: AlbumBaseControllerFragment.java From letv with Apache License 2.0 | 5 votes |
protected void startBreath() { if (this.mVideoShotButton != null) { Animation alphaAnimation = new AlphaAnimation(1.0f, 0.0f); alphaAnimation.setDuration(500); alphaAnimation.setInterpolator(new LinearInterpolator()); alphaAnimation.setRepeatCount(-1); alphaAnimation.setRepeatMode(2); this.mVideoShotButton.startAnimation(alphaAnimation); this.mHandler.sendEmptyMessageDelayed(258, 10000); } }
Example 11
Source File: MainNavigationActivity.java From beaconloc with Apache License 2.0 | 5 votes |
public void swappingFloatingScanIcon(boolean isScanning) { if (isScanning) { Animation mAnimation = new AlphaAnimation(1, 0); mAnimation.setDuration(200); mAnimation.setInterpolator(new LinearInterpolator()); mAnimation.setRepeatCount(Animation.INFINITE); mAnimation.setRepeatMode(Animation.REVERSE); fab.startAnimation(mAnimation); } else { fab.clearAnimation(); } }
Example 12
Source File: TokenHolder.java From alpha-wallet-android with MIT License | 5 votes |
private void animateTextWhileWaiting() { emptyTicker(); layoutValueDetails.setVisibility(View.VISIBLE); Animation anim = new AlphaAnimation(0.0f, 1.0f); anim.setDuration(450); anim.setStartOffset(20); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(Animation.INFINITE); text24Hours.startAnimation(anim); textAppreciation.startAnimation(anim); balanceCurrency.startAnimation(anim); }
Example 13
Source File: AnimationFactory.java From PullToRefresh with MIT License | 5 votes |
private void configureAnimation(Animation animation, Interpolator interpolator, int duration, int startOffset, int repeatMode, int repeatCount) { animation.setInterpolator(interpolator); animation.setDuration(duration); animation.setStartOffset(startOffset); animation.setRepeatMode(repeatMode); animation.setRepeatCount(repeatCount); }
Example 14
Source File: CompassActivity.java From Travel-Mate with MIT License | 5 votes |
/** * adjuts arrow * * @param azimuth azimuth */ private void adjustArrow(float azimuth) { Log.d(TAG, "will set rotation from " + mCurrentAzimuth + " to " + azimuth); Animation an = new RotateAnimation(-mCurrentAzimuth, -azimuth, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mCurrentAzimuth = azimuth; an.setDuration(500); an.setRepeatCount(0); an.setFillAfter(true); mArrowView.startAnimation(an); }
Example 15
Source File: SunRefreshView.java From Phoenix with Apache License 2.0 | 5 votes |
private void setupAnimations() { mAnimation = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { setRotate(interpolatedTime); } }; mAnimation.setRepeatCount(Animation.INFINITE); mAnimation.setRepeatMode(Animation.RESTART); mAnimation.setInterpolator(LINEAR_INTERPOLATOR); mAnimation.setDuration(ANIMATION_DURATION); }
Example 16
Source File: HomeFragment.java From easyweather with MIT License | 5 votes |
@Override public void showNoData() { mSwipeLayout.setVisibility(View.GONE); refresh.setVisibility(View.VISIBLE); Animation animation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(1000); animation.setRepeatCount(-1); animation.setInterpolator(new LinearInterpolator()); refresh.startAnimation(animation); mPresenter.doRefreshInNoData(); }
Example 17
Source File: MainActivity.java From Android-Basics-Codes with Artistic License 2.0 | 4 votes |
public void mahang (View view){ AnimationSet set = new AnimationSet(false); TranslateAnimation tras = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 2, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 2); // ������ʾʱ�䳤�� tras.setDuration(2000); // �����ظ����� tras.setRepeatCount(2); // ���ö����ظ���ģʽ tras.setRepeatMode(Animation.REVERSE); RotateAnimation rotate = new RotateAnimation(360, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); // ������ʾʱ�䳤�� rotate.setDuration(2000); // �����ظ����� rotate.setRepeatCount(2); // ���ö����ظ���ģʽ rotate.setRepeatMode(Animation.REVERSE); ScaleAnimation scale = new ScaleAnimation(4f, 0.2f, 4f, 0.2f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); // ������ʾʱ�䳤�� scale.setDuration(2000); // �����ظ����� scale.setRepeatCount(2); // ���ö����ظ���ģʽ scale.setRepeatMode(Animation.REVERSE); Animation alpha = new AlphaAnimation(1f, 0.1f); // ������ʾʱ�䳤�� alpha.setDuration(2000); // �����ظ����� alpha.setRepeatCount(2); // ���ö����ظ���ģʽ alpha.setRepeatMode(Animation.REVERSE); set.addAnimation(tras); set.addAnimation(alpha); set.addAnimation(rotate); set.addAnimation(scale); // ��ImageView�ϲ��Ŷ��� iv.startAnimation(set); }
Example 18
Source File: PartyActivity.java From Musync with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getSupportActionBar().hide(); setContentView(R.layout.activity_party); getWindow().setStatusBarColor(getResources().getColor(android.R.color.white)); Typeface regular = Typeface.createFromAsset(getAssets(), "fonts/product_san_regular.ttf"); Typeface bold = Typeface.createFromAsset(getAssets(),"fonts/product_sans_bold.ttf"); FontChanger fontChanger = new FontChanger(regular); fontChanger.replaceFonts((ViewGroup)this.findViewById(android.R.id.content)); final ImageView cld1 = (ImageView)findViewById(R.id.cld1); final ImageView cld2 = (ImageView)findViewById(R.id.cld2); final ImageView cld3 = (ImageView)findViewById(R.id.cld3); final ImageView cld4 = findViewById(R.id.cld4); sendBTN = findViewById(R.id.sendBTN); messageET = findViewById(R.id.messageET); messageRV = findViewById(R.id.messageRV); messageList = new ArrayList<>(); customListAdapter = new CustomListAdapter(messageList,getApplicationContext()); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext(),LinearLayoutManager.VERTICAL,false); messageRV.setLayoutManager(linearLayoutManager); messageRV.setAdapter(customListAdapter); Bitmap oldSB = ((BitmapDrawable)sendBTN.getDrawable()).getBitmap(); sendBTN.setImageBitmap(addGradient(oldSB)); Bitmap oldCld1= ((BitmapDrawable)cld1.getDrawable()).getBitmap(); Bitmap newCld1 = addGradient(oldCld1); cld1.setImageDrawable(new BitmapDrawable(getResources(),newCld1)); Bitmap oldCld2= ((BitmapDrawable)cld2.getDrawable()).getBitmap(); Bitmap newCld2 = addGradient(oldCld2); cld2.setImageDrawable(new BitmapDrawable(getResources(),newCld2)); Bitmap oldCld3= ((BitmapDrawable)cld3.getDrawable()).getBitmap(); Bitmap newCld3 = addGradient(oldCld3); cld3.setImageDrawable(new BitmapDrawable(getResources(),newCld3)); Bitmap oldCld4= ((BitmapDrawable)cld4.getDrawable()).getBitmap(); Bitmap newCld4 = addGradient(oldCld4); cld4.setImageDrawable(new BitmapDrawable(getResources(),newCld4)); final Animation animSlide1 = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide); animSlide1.setRepeatCount(-1); animSlide1.setRepeatMode(Animation.RESTART); final Animation animSlide2 = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide2); animSlide2.setRepeatCount(-1); animSlide2.setRepeatMode(Animation.RESTART); final Animation animSlide3 = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide3); animSlide3.setRepeatCount(-1); animSlide3.setRepeatMode(Animation.RESTART); final Animation animSlide4 = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide4); animSlide4.setRepeatCount(-1); animSlide4.setRepeatMode(Animation.RESTART); cld1.startAnimation(animSlide1); cld2.startAnimation(animSlide2); cld3.startAnimation(animSlide3); cld4.startAnimation(animSlide4); sendBTN.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(messageET.getText().toString().trim().length()!=0){ send(messageET.getText().toString()); } } }); }
Example 19
Source File: AndroidVsIosHeaderView.java From youqu_master with Apache License 2.0 | 4 votes |
public AndroidVsIosHeaderView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); inflate(context, R.layout.layout_irecyclerview_bat_vs_supper_refresh_header_view, this); ivBatMan = (ImageView) findViewById(R.id.ivBatMan); ivSuperMan = (ImageView) findViewById(R.id.ivSuperMan); ivVs = (ImageView) findViewById(R.id.imageView); PropertyValuesHolder translationX1 = PropertyValuesHolder.ofFloat("translationX",0.0f,100.0f,0.0f); PropertyValuesHolder rotate = PropertyValuesHolder.ofFloat("rotationY",0.0f,380.0f,0.0f); PropertyValuesHolder translationX2 = PropertyValuesHolder.ofFloat("translationX",0.0f,-100.0f,0.0f); ObjectAnimator objectAnimator1 = ObjectAnimator.ofPropertyValuesHolder(ivBatMan, translationX1); objectAnimator1.setRepeatCount(ValueAnimator.INFINITE); objectAnimator1.setRepeatMode(ValueAnimator.INFINITE); ObjectAnimator objectAnimator2 = ObjectAnimator.ofPropertyValuesHolder(ivSuperMan,translationX2); objectAnimator2.setRepeatCount(ValueAnimator.INFINITE); objectAnimator2.setRepeatMode(ValueAnimator.INFINITE); ObjectAnimator objectAnimator3 = ObjectAnimator.ofPropertyValuesHolder(ivVs, rotate); objectAnimator3.setRepeatCount(ValueAnimator.INFINITE); objectAnimator3.setRepeatMode(ValueAnimator.INFINITE); Animation animation =new RotateAnimation(0f,360f, Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF,0.5f); Animation animation1 =new RotateAnimation(0f,-360f, Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF,0.5f); animation.setFillAfter(true); animation.setDuration(2000); animation.setRepeatCount(ValueAnimator.INFINITE); animation.setRepeatMode(ValueAnimator.INFINITE); animation1.setFillAfter(true); animation1.setDuration(2000); animation1.setRepeatCount(ValueAnimator.INFINITE); animation1.setRepeatMode(ValueAnimator.INFINITE); ivBatMan.setAnimation(animation); ivSuperMan.setAnimation(animation1); btnSexAnimatorSet = new AnimatorSet(); btnSexAnimatorSet.playTogether(objectAnimator1, objectAnimator2,objectAnimator3); btnSexAnimatorSet.setDuration(2000); btnSexAnimatorSet.start(); }
Example 20
Source File: MainActivity.java From Android-Basics-Codes with Artistic License 2.0 | 4 votes |
public void mahang (View view){ AnimationSet set = new AnimationSet(false); TranslateAnimation tras = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 2, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 2); // ������ʾʱ�䳤�� tras.setDuration(2000); // �����ظ����� tras.setRepeatCount(2); // ���ö����ظ���ģʽ tras.setRepeatMode(Animation.REVERSE); RotateAnimation rotate = new RotateAnimation(360, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); // ������ʾʱ�䳤�� rotate.setDuration(2000); // �����ظ����� rotate.setRepeatCount(2); // ���ö����ظ���ģʽ rotate.setRepeatMode(Animation.REVERSE); ScaleAnimation scale = new ScaleAnimation(4f, 0.2f, 4f, 0.2f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); // ������ʾʱ�䳤�� scale.setDuration(2000); // �����ظ����� scale.setRepeatCount(2); // ���ö����ظ���ģʽ scale.setRepeatMode(Animation.REVERSE); Animation alpha = new AlphaAnimation(1f, 0.1f); // ������ʾʱ�䳤�� alpha.setDuration(2000); // �����ظ����� alpha.setRepeatCount(2); // ���ö����ظ���ģʽ alpha.setRepeatMode(Animation.REVERSE); set.addAnimation(tras); set.addAnimation(alpha); set.addAnimation(rotate); set.addAnimation(scale); // ��ImageView�ϲ��Ŷ��� iv.startAnimation(set); }