Java Code Examples for android.view.animation.AlphaAnimation#setInterpolator()

The following examples show how to use android.view.animation.AlphaAnimation#setInterpolator() . 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: BottomRedPointView.java    From letv with Apache License 2.0 6 votes vote down vote up
private void init(Context context, View target) {
    this.context = context;
    this.target = target;
    fadeIn = new AlphaAnimation(0.0f, 1.0f);
    fadeIn.setInterpolator(new DecelerateInterpolator());
    fadeIn.setDuration(200);
    fadeOut = new AlphaAnimation(1.0f, 0.0f);
    fadeOut.setInterpolator(new AccelerateInterpolator());
    fadeOut.setDuration(200);
    this.isShown = false;
    if (this.target != null) {
        applyTo(this.target);
    } else {
        show();
    }
}
 
Example 2
Source File: MainActivity.java    From ExpressHelper with GNU General Public License v3.0 6 votes vote down vote up
public void closeCompanyList() {
	mSearchBox.hideCircularly(this);

	AlphaAnimation anim = new AlphaAnimation(1f, 0f);
	anim.setInterpolator(new DecelerateInterpolator());
	anim.setFillAfter(true);
	anim.setDuration(250);
	mCompanyListPageBackground.startAnimation(anim);
	mCompanyList.startAnimation(anim);

	new Handler().postDelayed(new Runnable() {
		@Override
		public void run() {
			runOnUiThread(new Runnable() {
				@Override
				public void run() {
					mCompanyListPage.setVisibility(View.GONE);
				}
			});
		}
	}, 250);
}
 
Example 3
Source File: BadgeView.java    From umeng_community_android with MIT License 5 votes vote down vote up
private void init(Context context, View target, int tabIndex) {

        this.context = context;
        this.target = target;
        this.targetTabIndex = tabIndex;

        // apply defaults
        badgePosition = DEFAULT_POSITION;
        badgeMarginH = DeviceUtils.dp2px(getContext(), DEFAULT_MARGIN_DIP);
        badgeMarginV = badgeMarginH;
        badgeColor = DEFAULT_BADGE_COLOR;

        setTypeface(Typeface.DEFAULT_BOLD);
        int paddingPixels = DeviceUtils.dp2px(getContext(), DEFAULT_LR_PADDING_DIP);
        setPadding(paddingPixels, 0, paddingPixels, 0);
        setTextColor(DEFAULT_TEXT_COLOR);

        fadeIn = new AlphaAnimation(0, 1);
        fadeIn.setInterpolator(new DecelerateInterpolator());
        fadeIn.setDuration(200);

        fadeOut = new AlphaAnimation(1, 0);
        fadeOut.setInterpolator(new AccelerateInterpolator());
        fadeOut.setDuration(200);

        isShown = false;

        if (this.target != null) {
            applyTo(this.target);
        } else {
            show();
        }

    }
 
Example 4
Source File: FadeInBitmapDisplayer.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void animate(View imageView, int durationMillis) {
    if (imageView != null) {
        AlphaAnimation fadeImage = new AlphaAnimation(0.0f, 1.0f);
        fadeImage.setDuration((long) durationMillis);
        fadeImage.setInterpolator(new DecelerateInterpolator());
        imageView.startAnimation(fadeImage);
    }
}
 
Example 5
Source File: ViewAnimationUtil.java    From SimpleProject with MIT License 5 votes vote down vote up
public static void alpha(View view, float fromAlpha, float toAlpha, int duration, Interpolator interpolator) {
	AlphaAnimation animation = new AlphaAnimation(fromAlpha, toAlpha);
	animation.setDuration(duration);
	animation.setFillAfter(true);
	animation.setInterpolator(interpolator);
	view.startAnimation(animation);
}
 
Example 6
Source File: FadeInBitmapDisplayer.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
/**
 * fade-in(显示) 效果动画
 * Animates {@link ImageView} with "fade-in" effect
 *
 * @param imageView      {@link ImageView} which display image in
 * @param durationMillis The length of the animation in milliseconds
 */
public static void animate(View imageView, int durationMillis) {
	if (imageView != null) {
		AlphaAnimation fadeImage = new AlphaAnimation(0, 1);
		fadeImage.setDuration(durationMillis);
		fadeImage.setInterpolator(new DecelerateInterpolator());
		imageView.startAnimation(fadeImage);
	}
}
 
Example 7
Source File: BadgeView.java    From RefreshActionItem with Apache License 2.0 5 votes vote down vote up
private void init(Context context, View target, int tabIndex) {
	
	this.context = context;
	this.target = target;
	this.targetTabIndex = tabIndex;
	
	// apply defaults
	badgePosition = DEFAULT_POSITION;
	badgeMarginH = dipToPixels(DEFAULT_MARGIN_DIP);
	badgeMarginV = badgeMarginH;
	badgeColor = DEFAULT_BADGE_COLOR;
	
	setTypeface(Typeface.DEFAULT_BOLD);
	int paddingPixels = dipToPixels(DEFAULT_LR_PADDING_DIP);
	setPadding(paddingPixels, 0, paddingPixels, 0);
	setTextColor(DEFAULT_TEXT_COLOR);
	
	fadeIn = new AlphaAnimation(0, 1);
	fadeIn.setInterpolator(new DecelerateInterpolator());
	fadeIn.setDuration(200);

	fadeOut = new AlphaAnimation(1, 0);
	fadeOut.setInterpolator(new AccelerateInterpolator());
	fadeOut.setDuration(200);
	
	isShown = false;
	
	if (this.target != null) {
		applyTo(this.target);
	} else {
		show();
	}
	
}
 
Example 8
Source File: BootstrapAlert.java    From Android-Bootstrap with MIT License 5 votes vote down vote up
private void setupAnimations() {
    fadeInAnimation = new AlphaAnimation(0.0f, 1.0f);
    fadeInAnimation.setDuration(300);
    fadeInAnimation.setInterpolator(new AccelerateInterpolator());
    fadeInAnimation.setAnimationListener(this);

    fadeOutAnimation = new AlphaAnimation(1.0f, 0.0f);
    fadeOutAnimation.setDuration(300);
    fadeOutAnimation.setInterpolator(new AccelerateInterpolator());
    fadeOutAnimation.setAnimationListener(this);
}
 
Example 9
Source File: DSListView.java    From direct-select-android with MIT License 5 votes vote down vote up
private void showListView() {
    if (animationInProgress || scrollInProgress || listViewIsShown) return;
    listView.setEnabled(true);
    animationInProgress = true;

    this.setVisibility(View.VISIBLE);
    this.bringToFront();
    this.readyToHide = false;

    // Scale picker box if animations enabled
    if (selectorAnimationsEnabled && null != this.pickerBox) {
        ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 1f + scaleFactorDelta, 1f, 1f + scaleFactorDelta,
                Animation.RELATIVE_TO_SELF, selectorAnimationCenterPivot ? 0.5f : 0f, Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setInterpolator(new AccelerateInterpolator());
        scaleAnimation.setDuration(100);
        scaleAnimation.setFillAfter(true);
        this.pickerBox.getCellRoot().startAnimation(scaleAnimation);
    }

    // Show picker view animation
    AlphaAnimation showAnimation = new AlphaAnimation(0f, 1f);
    showAnimation.setDuration(200);
    showAnimation.setInterpolator(new AccelerateInterpolator());
    showAnimation.setAnimationListener(new AnimationListenerAdapter() {
        @Override
        public void onAnimationEnd(Animation animation) {
            animationInProgress = false;
            listViewIsShown = true;
            hideListView();
        }
    });

    this.startAnimation(showAnimation);
}
 
Example 10
Source File: CircleFadeInBitmapDisplayer.java    From Android-Application-ZJB with Apache License 2.0 5 votes vote down vote up
public static void animate(View imageView, int durationMillis) {
	if (imageView != null) {
		AlphaAnimation fadeImage = new AlphaAnimation(0.0F, 1.0F);
		fadeImage.setDuration((long) durationMillis);
		fadeImage.setInterpolator(new DecelerateInterpolator());
		imageView.startAnimation(fadeImage);
	}

}
 
Example 11
Source File: FadeInImageDisplayer.java    From sketch with Apache License 2.0 5 votes vote down vote up
@Override
public void display(@NonNull SketchView sketchView, @NonNull Drawable newDrawable) {
    AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setInterpolator(new DecelerateInterpolator());
    animation.setDuration(duration);
    sketchView.clearAnimation();
    sketchView.setImageDrawable(newDrawable);
    sketchView.startAnimation(animation);
}
 
Example 12
Source File: FakeLoadingWithLogoView.java    From CommonUtils with Apache License 2.0 5 votes vote down vote up
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 13
Source File: BadgeView.java    From tysq-android with GNU General Public License v3.0 5 votes vote down vote up
private void init(Context context, View target, int tabIndex) {

        this.context = context;
        this.target = target;
        this.targetTabIndex = tabIndex;

        // apply defaults
        badgePosition = DEFAULT_POSITION;
        badgeMarginH = dipToPixels(DEFAULT_MARGIN_DIP);
        badgeMarginV = badgeMarginH;
        badgeColor = DEFAULT_BADGE_COLOR;

        setTypeface(Typeface.DEFAULT_BOLD);
        int paddingPixels = dipToPixels(DEFAULT_LR_PADDING_DIP);
        setPadding(paddingPixels, 0, paddingPixels, 0);
        setTextColor(DEFAULT_TEXT_COLOR);
        setTextSize(DEFAULT_TEXT_SIZE);

        fadeIn = new AlphaAnimation(0, 1);
        fadeIn.setInterpolator(new DecelerateInterpolator());
        fadeIn.setDuration(200);

        fadeOut = new AlphaAnimation(1, 0);
        fadeOut.setInterpolator(new AccelerateInterpolator());
        fadeOut.setDuration(200);

        isShown = false;

        if (this.target != null) {
            applyTo(this.target);
        } else {
            show();
        }

    }
 
Example 14
Source File: AlbumsAdapter.java    From IdealMedia with Apache License 2.0 5 votes vote down vote up
public AlbumsAdapter(Activity activity, ArrayList<Track> data){
    this.data = data;
    this.activity = activity;

    listAq = new AQuery(activity);

    fadeIn = new AlphaAnimation(0, 1);
    fadeIn.setDuration(100);
    fadeIn.setInterpolator(new DecelerateInterpolator());
}
 
Example 15
Source File: FadeInBitmapDisplayer.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
/**
 * Animates {@link ImageView} with "fade-in" effect
 *
 * @param imageView      {@link ImageView} which display image in
 * @param durationMillis The length of the animation in milliseconds
 */
public static void animate(View imageView, int durationMillis) {
	if (imageView != null) {
		AlphaAnimation fadeImage = new AlphaAnimation(0, 1);
		fadeImage.setDuration(durationMillis);
		fadeImage.setInterpolator(new DecelerateInterpolator());
		imageView.startAnimation(fadeImage);
	}
}
 
Example 16
Source File: BadgeView.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
private void init(Context context, View target, int tabIndex) {

    this.context = context;
    this.target = target;
    this.targetTabIndex = tabIndex;

    // apply defaults
    badgePosition = DEFAULT_POSITION;
    badgeMarginH = dipToPixels(DEFAULT_MARGIN_DIP);
    badgeMarginV = badgeMarginH / 2; //vertical margin was overwritting tab text
    badgeColor = DEFAULT_BADGE_COLOR;

    setTypeface(Typeface.DEFAULT_BOLD);
    int paddingPixels = dipToPixels(DEFAULT_LR_PADDING_DIP);
    setPadding(paddingPixels, 0, paddingPixels, 0);
    setTextColor(DEFAULT_TEXT_COLOR);

    fadeIn = new AlphaAnimation(0, 1);
    fadeIn.setInterpolator(new DecelerateInterpolator());
    fadeIn.setDuration(200);

    fadeOut = new AlphaAnimation(1, 0);
    fadeOut.setInterpolator(new AccelerateInterpolator());
    fadeOut.setDuration(200);

    isShown = false;

    if (this.target != null) {
      applyTo(this.target);
    } else {
      show();
    }
  }
 
Example 17
Source File: EqualizerFragment.java    From Jockey with Apache License 2.0 4 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View layout = inflater.inflate(R.layout.fragment_equalizer, container, false);
    presetSpinnerPrefix = layout.findViewById(R.id.eq_preset_prefix);
    presetSpinner = layout.findViewById(R.id.eq_preset_spinner);

    Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
    if (toolbar != null) {
        equalizerToggle = new SwitchCompat(getActivity());
        equalizerToggle.setOnCheckedChangeListener(this);

        Toolbar.LayoutParams params = new Toolbar.LayoutParams(
                ActionBar.LayoutParams.WRAP_CONTENT,
                ActionBar.LayoutParams.WRAP_CONTENT,
                Gravity.END);
        int padding = (int) (16 * getResources().getDisplayMetrics().density);
        params.setMargins(padding, 0, padding, 0);

        toolbar.addView(equalizerToggle, params);

        AlphaAnimation anim = new AlphaAnimation(0f, 1.0f);
        anim.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
        anim.setInterpolator(getContext(), android.R.anim.decelerate_interpolator);
        equalizerToggle.startAnimation(anim);
    }

    LinearLayout equalizerPanel = layout.findViewById(R.id.equalizer_panel);

    equalizer = generateEqualizerConfig();
    int bandCount = (equalizer != null) ? equalizer.getNumberOfBands() : 0;

    sliders = new EqualizerFrame[bandCount];

    PresetAdapter presetAdapter = new PresetAdapter(getActivity(), equalizer, sliders);
    presetSpinner.setAdapter(presetAdapter);
    presetSpinner.setSelection(mPrefStore.getEqualizerPresetId() + 1);
    presetSpinner.setOnItemSelectedListener(presetAdapter);

    for (short i = 0; i < bandCount; i++) {
        inflater.inflate(R.layout.instance_eq_slider, equalizerPanel, true);
        sliders[i] = new EqualizerFrame(equalizerPanel.getChildAt(i), equalizer,
                i, presetSpinner);
    }

    setEqualizerEnabled(mPrefStore.getEqualizerEnabled());

    // If this device already has an application that can handle equalizers system-wide, inform
    // the user of possible issues by using Jockey's built-in equalizer
    if (Util.getSystemEqIntent(getActivity()) != null) {
        ((TextView) layout.findViewById(R.id.equalizer_notes))
                .setText(R.string.equalizer_conflict_note);
    }

    return layout;
}
 
Example 18
Source File: Fade.java    From KSnack with Apache License 2.0 4 votes vote down vote up
public static Animation getAnimation(){
    animation = new AlphaAnimation(1, 0);
    animation.setDuration(DEFAULT_ANIM_TIME);
    animation.setInterpolator(new AccelerateInterpolator());
    return animation;
}
 
Example 19
Source File: FragmentManager.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
static Animation makeFadeAnimation(Context context, float start, float end) {
    AlphaAnimation anim = new AlphaAnimation(start, end);
    anim.setInterpolator(DECELERATE_CUBIC);
    anim.setDuration(ANIM_DUR);
    return anim;
}
 
Example 20
Source File: Fade.java    From mobile-sdk-android with Apache License 2.0 4 votes vote down vote up
private void setOutAnimation(Interpolator interpolator, long duration) {
    outAnimation = new AlphaAnimation(1f, 0f);
    outAnimation.setDuration(duration);
    outAnimation.setInterpolator(interpolator);
}