use of android.view.animation.TranslateAnimation in project Crouton by keyboardsurfer.
the class DefaultAnimationsBuilder method buildDefaultSlideOutUpAnimation.
/**
* @param croutonView
* The croutonView which gets animated.
*
* @return The default Animation for a hiding {@link Crouton}.
*/
static Animation buildDefaultSlideOutUpAnimation(View croutonView) {
if (!areLastMeasuredOutAnimationHeightAndCurrentEqual(croutonView) || (null == slideOutUpAnimation)) {
slideOutUpAnimation = new TranslateAnimation(// X: from, to
0, // X: from, to
0, // Y: from, to
0, // Y: from, to
-croutonView.getMeasuredHeight());
slideOutUpAnimation.setDuration(DURATION);
setLastOutAnimationHeight(croutonView.getMeasuredHeight());
}
return slideOutUpAnimation;
}
use of android.view.animation.TranslateAnimation in project SnackBar by MrEngineer13.
the class SnackContainer method init.
private void init() {
mInAnimationSet = new AnimationSet(false);
TranslateAnimation mSlideInAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 1.0f, TranslateAnimation.RELATIVE_TO_SELF, 0.0f);
AlphaAnimation mFadeInAnimation = new AlphaAnimation(0.0f, 1.0f);
mInAnimationSet.addAnimation(mSlideInAnimation);
mInAnimationSet.addAnimation(mFadeInAnimation);
mOutAnimationSet = new AnimationSet(false);
TranslateAnimation mSlideOutAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 1.0f);
AlphaAnimation mFadeOutAnimation = new AlphaAnimation(1.0f, 0.0f);
mOutAnimationSet.addAnimation(mSlideOutAnimation);
mOutAnimationSet.addAnimation(mFadeOutAnimation);
mOutAnimationSet.setDuration(ANIMATION_DURATION);
mOutAnimationSet.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
removeAllViews();
if (!mSnacks.isEmpty()) {
sendOnHide(mSnacks.poll());
}
if (!isEmpty()) {
showSnack(mSnacks.peek());
} else {
setVisibility(View.GONE);
}
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
use of android.view.animation.TranslateAnimation in project actor-platform by actorapp.
the class AttachFragment method hide.
@Override
public void hide() {
if (root != null && root.getVisibility() == View.VISIBLE) {
onHidden();
fastAttachAdapter.clearSelected();
messenger().getGalleryScannerActor().send(new GalleryScannerActor.Hide());
fastShare.scrollToPosition(0);
hideView(root);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP && !isFastShareFullScreen) {
View internal = fastShare;
int cx = internal.getWidth() - Screen.dp(56 + 56);
int cy = internal.getHeight() - Screen.dp(56 / 2);
float finalRadius = (float) Math.hypot(cx, cy);
Animator anim = ViewAnimationUtils.createCircularReveal(internal, cx, cy, finalRadius, 0);
anim.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
internal.setAlpha(1);
}
@Override
public void onAnimationEnd(Animator animator) {
internal.setAlpha(0);
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
anim.setDuration(200);
anim.start();
} else {
TranslateAnimation animation = new TranslateAnimation(0, 0, 0, root.getHeight());
animation.setInterpolator(MaterialInterpolator.getInstance());
animation.setDuration(250);
fastShare.startAnimation(animation);
bottomBackground.startAnimation(animation);
}
}
}
use of android.view.animation.TranslateAnimation in project actor-platform by actorapp.
the class InputBarFragment method hideAudio.
protected void hideAudio(boolean cancel) {
if (!isAudioVisible) {
return;
}
isAudioVisible = false;
showView(attachButton);
showView(messageEditText);
showView(emojiButton);
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
voiceRecordActor.send(new VoiceCaptureActor.Stop(cancel));
TranslateAnimation animation = new TranslateAnimation(0, Screen.getWidth(), 0, 0);
animation.setDuration(160);
audioContainer.clearAnimation();
audioContainer.setAnimation(animation);
audioContainer.animate();
audioContainer.setVisibility(View.GONE);
messageEditText.requestFocus();
}
use of android.view.animation.TranslateAnimation in project actor-platform by actorapp.
the class InputBarFragment method showAudio.
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();
}
Aggregations