Giter Site home page Giter Site logo

Comments (4)

tashilapathum avatar tashilapathum commented on June 16, 2024

I'll include this in the next release

from pleasewait.

bubbleguuum avatar bubbleguuum commented on June 16, 2024

Thank you for your response.

I tested a modified version (converted to Java) to be able to override onCancel() using an anonymous class (example in first post).
However it does not work because DialogFragment#show(FragmentManager manager, String tag) fails with:

java.lang.IllegalStateException: Fragment null must be a public static class to be properly recreated from instance state.

It doesn't like an anonymous PleaseWaitDialog instance.

A solution to this issue would be to add this function to set a cancel listener (and not declare the class open as it cannot not work):

 public void setOnCancelListener(DialogInterface.OnCancelListener listener) {
      onCancelListener = listener;
   }

And add this override to onCancel() in PleaseWaitDialog :

 @Override
   public void onCancel(@NonNull DialogInterface dialog) {
      super.onCancel(dialog);
      if(onCancelListener != null) {
         onCancelListener.onCancel(dialog);
      }
   }

Same thing could be done for the dismiss listener.

from pleasewait.

tashilapathum avatar tashilapathum commented on June 16, 2024

Thanks for your suggestion. I'll definitely test it out because I don't have an idea either.

from pleasewait.

tashilapathum avatar tashilapathum commented on June 16, 2024

I looked this up and found that it's not recommended to use inner classes for Fragments as it may cause a memory leak. I'll add some listeners later but for now I've made PleaseWaitDialog class open so you can subclass it for your purpose.

from pleasewait.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.