Comments (4)
I'll include this in the next release
from pleasewait.
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.
Thanks for your suggestion. I'll definitely test it out because I don't have an idea either.
from pleasewait.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pleasewait.