Java Code Examples for android.view.animation.AlphaAnimation#setRepeatMode()
The following examples show how to use
android.view.animation.AlphaAnimation#setRepeatMode() .
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: ViewAnimation.java From geopackage-mapcache-android with MIT License | 6 votes |
/** * Assign a "scale to 120% and back bounce + fade out and in" animation to the given view * @param view the view to animate * @param duration duration of the animation */ public static void setBounceAnimatiom(View view, long duration){ ScaleAnimation grow = new ScaleAnimation(1.0f, 1.2f, 1.0f, 1.2f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); grow.setDuration(duration); ScaleAnimation shrink = new ScaleAnimation(1.0f, 0.8f, 1.0f, 0.8f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); shrink.setDuration(duration); shrink.setStartOffset(duration); // Fade out then repeat to fade back in AlphaAnimation fadeOut = new AlphaAnimation(1.0f, 0.3f); fadeOut.setInterpolator(new DecelerateInterpolator()); //and this fadeOut.setDuration(100); fadeOut.setRepeatMode(Animation.REVERSE); fadeOut.setRepeatCount(1); AnimationSet set = new AnimationSet(false); set.addAnimation(grow); set.addAnimation(shrink); set.addAnimation(fadeOut); view.startAnimation(set); }
Example 2
Source File: ProgressButton.java From progress-button with Apache License 2.0 | 6 votes |
private void configureLoadingDrawables() { int i; Drawable d; for (i=0; i < loadingDrawables.length; i++) { d = loadingDrawables[i]; if (d != null) { d.setBounds( 0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight() ); if ( !(d instanceof Animatable) ) { animation = new AlphaAnimation( 0f, 1f ); animation.setRepeatMode( Animation.RESTART ); animation.setRepeatCount( Animation.INFINITE ); animation.setDuration( 1000 ); animation.setInterpolator( new LinearInterpolator() ); animation.setStartTime( Animation.START_ON_FIRST_FRAME ); } } } transformation = new Transformation(); }
Example 3
Source File: FakeLoadingWithLogoView.java From CommonUtils with Apache License 2.0 | 5 votes |
public void startIndeterminate() { AlphaAnimation animation = new AlphaAnimation(1, 0); animation.setRepeatMode(Animation.REVERSE); animation.setRepeatCount(-1); animation.setInterpolator(new AccelerateInterpolator()); animation.setDuration(1500); startAnimationInternal(animation); }
Example 4
Source File: SimpleChatManager.java From SimpleChatView with Apache License 2.0 | 5 votes |
private void showTipsAnimation(TextView newsView) { AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.1f); alphaAnimation.setDuration(1100); alphaAnimation.setRepeatMode(Animation.RESTART); alphaAnimation.setRepeatCount(Animation.INFINITE); newsView.startAnimation(alphaAnimation); }
Example 5
Source File: CommonViewAnimationActivity.java From Android-Animation-Set with Apache License 2.0 | 5 votes |
private Animation getAlphaAnimation() { AlphaAnimation alphaAnimation = new AlphaAnimation(1f, 0f); alphaAnimation.setDuration(2000); alphaAnimation.setRepeatCount(1); alphaAnimation.setFillAfter(true); alphaAnimation.setFillBefore(false); alphaAnimation.setRepeatMode(Animation.REVERSE); return alphaAnimation; }
Example 6
Source File: HomeScreenDockFragment.java From paper-launcher with MIT License | 5 votes |
public void startIconsEditing() { mDockIconsEditAnimation = new AlphaAnimation(0.4f, 1.0f); mDockIconsEditAnimation.setDuration(260); mDockIconsEditAnimation.setRepeatMode(Animation.REVERSE); mDockIconsEditAnimation.setRepeatCount(Animation.INFINITE); iterateOverDockIcons((dockItem, dockIconColumn) -> { dockItem.setOnClickListener(view -> showSelectAppForIconAtColumn(dockIconColumn)); dockItem.startAnimation(mDockIconsEditAnimation); }); }
Example 7
Source File: AnimationHelper.java From RecordView with Apache License 2.0 | 5 votes |
public void animateSmallMicAlpha() { alphaAnimation = new AlphaAnimation(0.0f, 1.0f); alphaAnimation.setDuration(500); alphaAnimation.setRepeatMode(Animation.REVERSE); alphaAnimation.setRepeatCount(Animation.INFINITE); smallBlinkingMic.startAnimation(alphaAnimation); }
Example 8
Source File: MainActivity.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
public void alphaAnim_java(View view) { // 1.����AlphaAnimation AlphaAnimation animation = new AlphaAnimation(1f, 0f); // ���ó���ʱ�� animation.setDuration(1000); // ����ѭ������ animation.setRepeatCount(AlphaAnimation.INFINITE); // ����ѭ��ģʽ animation.setRepeatMode(AlphaAnimation.REVERSE); // 2.ͨ��View.startAnimation iv_rocket.startAnimation(animation); }
Example 9
Source File: CommonViewAnimationActivity.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
private Animation getAlphaAnimation() { AlphaAnimation alphaAnimation = new AlphaAnimation(1f, 0f); alphaAnimation.setDuration(2000); alphaAnimation.setRepeatCount(1); alphaAnimation.setFillAfter(true); alphaAnimation.setFillBefore(false); alphaAnimation.setRepeatMode(Animation.REVERSE); return alphaAnimation; }
Example 10
Source File: OrdersAdapter.java From Pharmacy-Android with GNU General Public License v3.0 | 5 votes |
private void fadeOnAck(@Order.Status String status, View view) { clearAnimation(view); if (status.equals(ACKNOWLEDGED)) { AlphaAnimation alphaAnimation = new AlphaAnimation(0.3f, 0.9f); alphaAnimation.setDuration(700); alphaAnimation.setRepeatMode(Animation.REVERSE); alphaAnimation.setRepeatCount(Animation.INFINITE); view.setAnimation(alphaAnimation); alphaAnimation.start(); // color animation /* ObjectAnimator slide = ObjectAnimator.ofObject(view, "backgroundColor", new ArgbEvaluator(), ContextCompat.getColor(App.getContext(), R.color.white), ContextCompat.getColor(App.getContext(), R.color.md_deep_orange_50));*/ /* ObjectAnimator slide = ObjectAnimator.ofFloat(view, "alpha", 0.3f, 0.9f); slide.setInterpolator(new AccelerateDecelerateInterpolator()); slide.setDuration(700); slide.setRepeatCount(ValueAnimator.INFINITE); slide.setRepeatMode(ValueAnimator.REVERSE); slide.start();*/ } }
Example 11
Source File: MainActivity.java From Android-Basics-Codes with Artistic License 2.0 | 5 votes |
public void alpha(View v){ //0ȫ����1ȫ���� aa = new AlphaAnimation(0.2f, 1); aa.setDuration(2000); aa.setRepeatCount(1); aa.setRepeatMode(Animation.REVERSE); iv.startAnimation(aa); }
Example 12
Source File: InputBarFragment.java From actor-platform with GNU Affero General Public License v3.0 | 4 votes |
protected void showAudio() { if (Build.VERSION.SDK_INT >= 23) { if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.VIBRATE) != PackageManager.PERMISSION_GRANTED) { requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO, Manifest.permission.VIBRATE}, PERMISSION_REQUEST_RECORD_AUDIO); return; } } if (isAudioVisible) { return; } isAudioVisible = true; hideView(attachButton); hideView(messageEditText); hideView(emojiButton); audioFile = ActorSDK.sharedActor().getMessenger().getInternalTempFile("voice_msg", "opus"); getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); voiceRecordActor.send(new VoiceCaptureActor.Start(audioFile)); slideAudio(0); audioTimer.setText("00:00"); TranslateAnimation animation = new TranslateAnimation(Screen.getWidth(), 0, 0, 0); animation.setDuration(160); audioContainer.clearAnimation(); audioContainer.setAnimation(animation); audioContainer.animate(); audioContainer.setVisibility(View.VISIBLE); AlphaAnimation alphaAnimation = new AlphaAnimation(1f, 0.2f); alphaAnimation.setDuration(800); alphaAnimation.setRepeatMode(AlphaAnimation.REVERSE); alphaAnimation.setRepeatCount(AlphaAnimation.INFINITE); recordPoint.clearAnimation(); recordPoint.setAnimation(alphaAnimation); recordPoint.animate(); }
Example 13
Source File: BluetoothHidEmuActivity.java From BluetoothHidEmu with Apache License 2.0 | 4 votes |
/** * Updates UI * @param state */ private void setStatusIconState(StatusIconStates state) { if (state == mStatusState) { return; } Animation animation = null; switch (state) { case ON: if ((animation = mStatusTextView.getAnimation()) != null) { animation.cancel(); mStatusTextView.setAnimation(null); } mStatusTextView.setTextColor(Color.GREEN); mStatusTextView.setShadowLayer(6, 0f, 0f, Color.BLACK); mStatusTextView.setText(getResources().getString(R.string.msg_status_connected)); if (mUiControls != null) mUiControls.animate(View.VISIBLE); break; case OFF: if ((animation = mStatusTextView.getAnimation()) != null) { animation.cancel(); mStatusTextView.setAnimation(null); } mStatusTextView.setTextColor(Color.RED); mStatusTextView.setShadowLayer(6, 0f, 0f, Color.BLACK); mStatusTextView.setText(getResources().getString(R.string.msg_status_disconnected)); if (mUiControls != null) mUiControls.animate(View.INVISIBLE); break; case INTERMEDIATE: mStatusTextView.setTextColor(0xffffff00); mStatusTextView.setShadowLayer(6, 0f, 0f, Color.BLACK); mStatusTextView.setText(getResources().getString(R.string.msg_status_connecting)); AlphaAnimation alphaAnim = new AlphaAnimation(1, 0.2f); alphaAnim.setDuration(250); alphaAnim.setInterpolator(new DecelerateInterpolator(10f)); alphaAnim.setRepeatCount(Animation.INFINITE); alphaAnim.setRepeatMode(Animation.REVERSE); mStatusTextView.startAnimation(alphaAnim); if (mUiControls != null) mUiControls.animate(View.INVISIBLE); break; } mStatusState = state; }