Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

disable auto hide #112

Open
pishguy opened this issue May 22, 2017 · 5 comments
Open

disable auto hide #112

pishguy opened this issue May 22, 2017 · 5 comments

Comments

@pishguy
Copy link

pishguy commented May 22, 2017

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();
@ga25
Copy link

ga25 commented Jul 22, 2017

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);
...
}

@pishguy
Copy link
Author

pishguy commented Jul 22, 2017

@ga25 thanks, let me to test that 👍

@ga25
Copy link

ga25 commented Jul 27, 2017

Have you solved that?

@pishguy
Copy link
Author

pishguy commented Jul 27, 2017

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

@Guiorgy
Copy link

Guiorgy commented Feb 27, 2020

.setIndeterminate(true)
and then
.dismiss()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants