SuperToasts icon indicating copy to clipboard operation
SuperToasts copied to clipboard

disable auto hide

Open pishguy opened this issue 8 years ago • 5 comments

how can i disable auto hide by duration? i want to hide that after finish some process for example:

toast = SuperActivityToast.create(ActivityRegister.this,
        new SuperToastStyle(),
        SuperToastStyle.TYPE_PROGRESS_BAR, 0)
        .setProgressBarColor(Color.WHITE)
        .setHeight(142)
        .setText(AndroidUtilities.getString(R.string.please_try_again, context))
        .setFrame(SuperToastStyle.FRAME_LOLLIPOP)
        .setColor(PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_INDIGO))
        .setIconPosition(SuperToastStyle.ICONPOSITION_RIGHT)
        .setAnimations(SuperToastStyle.ANIMATIONS_FADE);

toast.show();
//get data from server
toast.hide();

pishguy avatar May 22 '17 16:05 pishguy

step1: add a flag of keeping show in Style Class: public static final int DURATION_MAX=-1; step2: set duration with the flag: toast.setDuration(Style.DURATION_MAX); step3: compare duration with the flag in displaySuperToast() of Toast Class , if matched do nothing before execute sendDelayedMessage():

private void displaySuperToast(SuperToast superToast) { ... if (duration == Style.DURATION_MAX) return; sendDelayedMessage(superToast, Messages.REMOVE_SUPERTOAST, superToast.getDuration() + AnimationUtils.SHOW_DURATION); ... }

ga25 avatar Jul 22 '17 04:07 ga25

@ga25 thanks, let me to test that 👍

pishguy avatar Jul 22 '17 04:07 pishguy

Have you solved that?

ga25 avatar Jul 27 '17 01:07 ga25

@ga25 i'm so sorry sir, i dont have free time now. please let me to test that, thanks

pishguy avatar Jul 27 '17 03:07 pishguy

.setIndeterminate(true) and then .dismiss()

Guiorgy avatar Feb 27 '20 19:02 Guiorgy