/* Get duration and add one second to compensate for show/hide animations */ private long getDuration(SuperToast superToast) { long duration = superToast.getDuration(); duration += 1000; return duration; }
/* Displays a SuperToast */ private void displaySuperToast(SuperToast superToast) { if (superToast.isShowing()) { /* If the SuperToast is already showing do not show again */ return; } final WindowManager windowManager = superToast.getWindowManager(); final View toastView = superToast.getView(); final WindowManager.LayoutParams params = superToast.getWindowManagerParams(); if (windowManager != null) { windowManager.addView(toastView, params); } sendMessageDelayed(superToast, Messages.REMOVE_SUPERTOAST, superToast.getDuration() + 500); }