use of android.view.animation.Animation in project weex-example by KalicyZhou.
the class SplashActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
View textView = findViewById(R.id.fullscreen_content);
ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
AnimationSet animationSet = new AnimationSet(false);
animationSet.addAnimation(scaleAnimation);
animationSet.setDuration(1000);
animationSet.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
startMainActivity();
finish();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
textView.startAnimation(animationSet);
}
use of android.view.animation.Animation in project SectionCursorAdapter by twotoasters.
the class ToastersAdapter method switchWithoutAnimation.
private void switchWithoutAnimation(ViewSwitcher switcher) {
if (switcher.getDisplayedChild() != 0) {
Animation in = switcher.getInAnimation();
Animation out = switcher.getOutAnimation();
switcher.setInAnimation(null);
switcher.setOutAnimation(null);
switcher.setDisplayedChild(0);
switcher.setInAnimation(in);
switcher.setOutAnimation(out);
}
;
}
use of android.view.animation.Animation in project Lightning-Browser by anthonycr.
the class BrowserActivity method hideActionBar.
/**
* Hide the ActionBar using an animation if we are in full-screen
* mode. This method also re-parents the ActionBar if its parent is
* incorrect so that the animation can happen correctly.
*/
@Override
public void hideActionBar() {
if (mFullScreen) {
if (mToolbarLayout == null || mBrowserFrame == null)
return;
final int height = mToolbarLayout.getHeight();
if (mToolbarLayout.getTranslationY() > -0.01f) {
Animation show = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
float trans = interpolatedTime * height;
mToolbarLayout.setTranslationY(-trans);
setWebViewTranslation(height - trans);
}
};
show.setDuration(250);
show.setInterpolator(new BezierDecelerateInterpolator());
mBrowserFrame.startAnimation(show);
}
}
}
use of android.view.animation.Animation in project Lightning-Browser by anthonycr.
the class BrowserActivity method changeToolbarBackground.
/**
* Animates the color of the toolbar from one color to another. Optionally animates
* the color of the tab background, for use when the tabs are displayed on the top
* of the screen.
*
* @param favicon the Bitmap to extract the color from
* @param tabBackground the optional LinearLayout to color
*/
@Override
public void changeToolbarBackground(@NonNull Bitmap favicon, @Nullable final Drawable tabBackground) {
final int defaultColor = ContextCompat.getColor(this, R.color.primary_color);
if (mCurrentUiColor == Color.BLACK) {
mCurrentUiColor = defaultColor;
}
Palette.from(favicon).generate(new Palette.PaletteAsyncListener() {
@Override
public void onGenerated(Palette palette) {
// OR with opaque black to remove transparency glitches
int color = 0xff000000 | palette.getVibrantColor(defaultColor);
// Lighten up the dark color if it is
final int finalColor;
// too dark
if (!mShowTabsInDrawer || Utils.isColorTooDark(color)) {
finalColor = Utils.mixTwoColors(defaultColor, color, 0.25f);
} else {
finalColor = color;
}
final Window window = getWindow();
if (!mShowTabsInDrawer) {
window.setBackgroundDrawable(new ColorDrawable(Color.BLACK));
}
final int startSearchColor = getSearchBarColor(mCurrentUiColor, defaultColor);
final int finalSearchColor = getSearchBarColor(finalColor, defaultColor);
Animation animation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
final int color = DrawableUtils.mixColor(interpolatedTime, mCurrentUiColor, finalColor);
if (mShowTabsInDrawer) {
mBackground.setColor(color);
Handlers.MAIN.post(new Runnable() {
@Override
public void run() {
window.setBackgroundDrawable(mBackground);
}
});
} else if (tabBackground != null) {
tabBackground.setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
mCurrentUiColor = color;
mToolbarLayout.setBackgroundColor(color);
mSearchBackground.getBackground().setColorFilter(DrawableUtils.mixColor(interpolatedTime, startSearchColor, finalSearchColor), PorterDuff.Mode.SRC_IN);
}
};
animation.setDuration(300);
mToolbarLayout.startAnimation(animation);
}
});
}
use of android.view.animation.Animation in project wire-android by wireapp.
the class PendingConnectRequestFragment method onCreateAnimation.
//////////////////////////////////////////////////////////////////////////////////////////
//
// Lifecycle
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
Animation animation = super.onCreateAnimation(transit, enter, nextAnim);
if (getControllerFactory().getConversationScreenController().getPopoverLaunchMode() != DialogLaunchMode.AVATAR && getControllerFactory().getConversationScreenController().getPopoverLaunchMode() != DialogLaunchMode.COMMON_USER) {
// No animation when request is shown in conversation list
IConnectStore.UserRequester userRequester = IConnectStore.UserRequester.valueOf(getArguments().getString(ARGUMENT_USER_REQUESTER));
if (userRequester != IConnectStore.UserRequester.CONVERSATION || isBelowUserProfile) {
int centerX = ViewUtils.getOrientationIndependentDisplayWidth(getActivity()) / 2;
int centerY = ViewUtils.getOrientationIndependentDisplayHeight(getActivity()) / 2;
int duration;
int delay = 0;
if (isBelowUserProfile) {
if (LayoutSpec.isTablet(getActivity())) {
animation = new ProfileTabletAnimation(enter, getResources().getInteger(R.integer.framework_animation_duration_long), -getResources().getDimensionPixelSize(R.dimen.participant_dialog__initial_width));
} else {
if (enter) {
isBelowUserProfile = false;
duration = getResources().getInteger(R.integer.reopen_profile_source__animation_duration);
delay = getResources().getInteger(R.integer.reopen_profile_source__delay);
} else {
duration = getResources().getInteger(R.integer.reopen_profile_source__animation_duration);
}
animation = new ProfileSourceAnimation(enter, duration, delay, centerX, centerY);
}
} else if (nextAnim != 0) {
if (LayoutSpec.isTablet(getActivity())) {
animation = new ProfileTabletAnimation(enter, getResources().getInteger(R.integer.framework_animation_duration_long), getResources().getDimensionPixelSize(R.dimen.participant_dialog__initial_width));
} else {
if (enter) {
duration = getResources().getInteger(R.integer.open_profile__animation_duration);
delay = getResources().getInteger(R.integer.open_profile__delay);
} else {
duration = getResources().getInteger(R.integer.close_profile__animation_duration);
}
animation = new ProfileAnimation(enter, duration, delay, centerX, centerY);
}
}
}
}
return animation;
}
Aggregations