use of android.view.animation.Animation in project wire-android by wireapp.
the class ParticipantBodyFragment method onCreateAnimation.
@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
final Fragment parent = getParentFragment();
// is being removed.
if (!enter && parent != null && parent.isRemoving()) {
// This is a workaround for the bug where child fragments disappear when
// the parent is removed (as all children are first removed from the parent)
// See https://code.google.com/p/android/issues/detail?id=55228
Animation doNothingAnim = new AlphaAnimation(1, 1);
doNothingAnim.setDuration(ViewUtils.getNextAnimationDuration(parent));
return doNothingAnim;
} else {
return super.onCreateAnimation(transit, enter, nextAnim);
}
}
use of android.view.animation.Animation in project HumaneApp by Ganesh1010.
the class LandingPage method onCreate.
/* @Bind(R.id.fragmentLayout)FrameLayout frameLayout;
@Bind(R.id.donarActivity) Button donor;
@Bind(R.id.orgActivity) Button org;
@Bind(R.id.viewLine) View viewLine;*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_landing_page);
// ButterKnife.bind(this);
frameLayout = (FrameLayout) findViewById(R.id.fragmentLayout);
donor = (Button) findViewById(R.id.donarActivity);
org = (Button) findViewById(R.id.orgActivity);
viewLine = findViewById(R.id.viewLine);
SharedPreferences preferences = getSharedPreferences(Connectivity.MyPREFERENCES, Context.MODE_PRIVATE);
Boolean isfirsttme = preferences.getBoolean(Connectivity.Is_First_Time, true);
if (!isfirsttme) {
SharedPreferences.Editor editor = getSharedPreferences(Connectivity.MyPREFERENCES, Context.MODE_PRIVATE).edit();
}
final Animation myAnim = AnimationUtils.loadAnimation(this, R.anim.bounce);
BounceInterpolator interpolator = new BounceInterpolator(0.2, 20);
myAnim.setInterpolator(interpolator);
myAnim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
// LandingPage.this.startActivity(new Intent(LandingPage.this,LoginPageFragment.class));
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
// Use bounce interpolator with amplitude 0.2 and frequency 20
donor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Toast.makeText(LandingPage.this,"Donor Clicked",Toast.LENGTH_LONG).show();
// v.startAnimation(myAnim);
user = "DONOR";
org.setVisibility(View.INVISIBLE);
donor.setVisibility(View.INVISIBLE);
viewLine.setVisibility(View.INVISIBLE);
Bundle bundle = new Bundle();
bundle.putString(USER_KEY_TYPE, USER_TYPE_SELECTION_DONOR);
fragment = new LoginPageFragment();
fragment.setArguments(bundle);
fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(R.id.fragmentLayout, fragment).commit();
Toast.makeText(LandingPage.this, "Donor Clicked", Toast.LENGTH_LONG).show();
}
});
org.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// view.setAnimation(myAnim);
user = "COORDINATOR";
org.setVisibility(View.INVISIBLE);
donor.setVisibility(View.INVISIBLE);
viewLine.setVisibility(View.INVISIBLE);
Bundle bundle = new Bundle();
bundle.putString(USER_KEY_TYPE, USER_TYPE_SELECTION_ORG);
fragment = new LoginPageFragment();
fragment.setArguments(bundle);
fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(R.id.fragmentLayout, fragment).commit();
Toast.makeText(LandingPage.this, "Organisation Clicked", Toast.LENGTH_LONG).show();
}
});
}
use of android.view.animation.Animation in project WaveSwipeRefreshLayout by recruit-lifestyle.
the class MaterialProgressDrawable method setupAnimators.
private void setupAnimators() {
final Ring ring = mRing;
final Animation animation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
if (mFinishing) {
applyFinishTranslation(interpolatedTime, ring);
} else {
// The minProgressArc is calculated from 0 to create an
// angle that
// matches the stroke width.
final float minProgressArc = (float) Math.toRadians(ring.getStrokeWidth() / (2 * Math.PI * ring.getCenterRadius()));
final float startingEndTrim = ring.getStartingEndTrim();
final float startingTrim = ring.getStartingStartTrim();
final float startingRotation = ring.getStartingRotation();
// Offset the minProgressArc to where the endTrim is
// located.
final float minArc = MAX_PROGRESS_ARC - minProgressArc;
final float endTrim = startingEndTrim + (minArc * START_CURVE_INTERPOLATOR.getInterpolation(interpolatedTime));
ring.setEndTrim(endTrim);
final float startTrim = startingTrim + (MAX_PROGRESS_ARC * END_CURVE_INTERPOLATOR.getInterpolation(interpolatedTime));
ring.setStartTrim(startTrim);
final float rotation = startingRotation + (0.25f * interpolatedTime);
ring.setRotation(rotation);
float groupRotation = ((720.0f / NUM_POINTS) * interpolatedTime) + (720.0f * (mRotationCount / NUM_POINTS));
setRotation(groupRotation);
}
}
};
animation.setRepeatCount(Animation.INFINITE);
animation.setRepeatMode(Animation.RESTART);
animation.setInterpolator(LINEAR_INTERPOLATOR);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
mRotationCount = 0;
}
@Override
public void onAnimationEnd(Animation animation) {
// do nothing
}
@Override
public void onAnimationRepeat(Animation animation) {
ring.storeOriginals();
ring.goToNextColor();
ring.setStartTrim(ring.getEndTrim());
if (mFinishing) {
// finished closing the last ring from the swipe gesture; go
// into progress mode
mFinishing = false;
animation.setDuration(ANIMATION_DURATION);
ring.setShowArrow(false);
} else {
mRotationCount = (mRotationCount + 1) % (NUM_POINTS);
}
}
});
mAnimation = animation;
}
use of android.view.animation.Animation in project WaveSwipeRefreshLayout by recruit-lifestyle.
the class MaterialProgressDrawable method isRunning.
@Override
public boolean isRunning() {
final ArrayList<Animation> animators = mAnimators;
final int N = animators.size();
for (int i = 0; i < N; i++) {
final Animation animator = animators.get(i);
if (animator.hasStarted() && !animator.hasEnded()) {
return true;
}
}
return false;
}
use of android.view.animation.Animation in project TwinklingRefreshLayout by lcodecorex.
the class MaterialProgressDrawable method setupAnimators.
private void setupAnimators() {
final Ring ring = mRing;
final Animation animation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
if (mFinishing) {
applyFinishTranslation(interpolatedTime, ring);
} else {
// The minProgressArc is calculated from 0 to create an
// angle that matches the stroke width.
final float minProgressArc = getMinProgressArc(ring);
final float startingEndTrim = ring.getStartingEndTrim();
final float startingTrim = ring.getStartingStartTrim();
final float startingRotation = ring.getStartingRotation();
updateRingColor(interpolatedTime, ring);
// single ring animation
if (interpolatedTime <= START_TRIM_DURATION_OFFSET) {
// scale the interpolatedTime so that the full
// transformation from 0 - 1 takes place in the
// remaining time
final float scaledTime = (interpolatedTime) / (1.0f - START_TRIM_DURATION_OFFSET);
final float startTrim = startingTrim + ((MAX_PROGRESS_ARC - minProgressArc) * MATERIAL_INTERPOLATOR.getInterpolation(scaledTime));
ring.setStartTrim(startTrim);
}
// animation completes
if (interpolatedTime > END_TRIM_START_DELAY_OFFSET) {
// scale the interpolatedTime so that the full
// transformation from 0 - 1 takes place in the
// remaining time
final float minArc = MAX_PROGRESS_ARC - minProgressArc;
float scaledTime = (interpolatedTime - START_TRIM_DURATION_OFFSET) / (1.0f - START_TRIM_DURATION_OFFSET);
final float endTrim = startingEndTrim + (minArc * MATERIAL_INTERPOLATOR.getInterpolation(scaledTime));
ring.setEndTrim(endTrim);
}
final float rotation = startingRotation + (0.25f * interpolatedTime);
ring.setRotation(rotation);
float groupRotation = ((FULL_ROTATION / NUM_POINTS) * interpolatedTime) + (FULL_ROTATION * (mRotationCount / NUM_POINTS));
setRotation(groupRotation);
}
}
};
animation.setRepeatCount(Animation.INFINITE);
animation.setRepeatMode(Animation.RESTART);
animation.setInterpolator(LINEAR_INTERPOLATOR);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
mRotationCount = 0;
}
@Override
public void onAnimationEnd(Animation animation) {
// do nothing
}
@Override
public void onAnimationRepeat(Animation animation) {
ring.storeOriginals();
ring.goToNextColor();
ring.setStartTrim(ring.getEndTrim());
if (mFinishing) {
// finished closing the last ring from the swipe gesture; go
// into progress mode
mFinishing = false;
animation.setDuration(ANIMATION_DURATION);
ring.setShowArrow(false);
} else {
mRotationCount = (mRotationCount + 1) % (NUM_POINTS);
}
}
});
mAnimation = animation;
}
Aggregations