Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void showCustomToast_main(String message, long duration)
- {
- final TextView toastText = customCardView.findViewById(R.id.toast_text);
- toastText.setText(message);
- customCardView.setVisibility(View.VISIBLE);
- ObjectAnimator fadeOut = ObjectAnimator.ofFloat(customCardView, "alpha", 1f, 0f);
- fadeOut.setDuration(duration);
- fadeOut.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- customCardView.setVisibility(View.GONE);
- }
- });
- fadeOut.start();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement