public void error() { if (!mInflated) { mToastCanceled = true; return; } mView.error(); slideUp(); }
public void success() { if (!mInflated) { mToastCanceled = true; return; } mView.success(); slideUp(); }
private void slideUp() { ViewPropertyAnimator.animate(mView) .setStartDelay(1000) .alpha(0f) .translationY(-mView.getHeight() + mTranslationY) .setInterpolator(new AccelerateInterpolator()) .setDuration(300) .start(); }
public LoadToast show() { if (!mInflated) { mShowCalled = true; return this; } mView.show(); ViewHelper.setTranslationX(mView, (mParentView.getWidth() - mView.getWidth()) / 2); ViewHelper.setAlpha(mView, 0f); ViewHelper.setTranslationY(mView, -mView.getHeight() + mTranslationY); // mView.setVisibility(View.VISIBLE); ViewPropertyAnimator.animate(mView) .alpha(1f) .translationY(25 + mTranslationY) .setInterpolator(new DecelerateInterpolator()) .setDuration(300) .setStartDelay(0) .start(); return this; }
public LoadToast setProgressColor(int color) { mView.setProgressColor(color); return this; }
public LoadToast setBackgroundColor(int color) { mView.setBackgroundColor(color); return this; }
public LoadToast setTextColor(int color) { mView.setTextColor(color); return this; }
public LoadToast setText(String message) { mText = message; mView.setText(mText); return this; }