B4A Library [Lib] BetterDialogs

I tried to improve the most useful dialogs of the Dialogs library. In my version, HTML tags are interpreted (even in the text of buttons), the InputBox uses a Masked EditText and has more options, you can check if the input is valid before closing the dialog, and the CustomDialog is fully customizable. I also solved an issue with the virtual keyboard.

MsgBox (under Gingerbread and JellyBean):

msgbox.png


InputBox (under Gingerbread and JellyBean):

inputbox.png


CustomDialog (under Gingerbread and JellyBean):

cd1.jpg


Another CustomDialog (under Gingerbread and JellyBean):

cd2.png


v1.1:
- I added a CloseDialog function;
- I added a margin parameter to the custom dialog.

v1.2:
- I fixed a bug in InputBox when there's a default value;
- I added the BackKeyPressed event for custom dialogs.

v1.3:
- I added a PasswordMode option to the InputBox;
- I added a CancelOnTouchOutside option.

v1.4:
- I added a CursorPosition option to the InputBox.

v2.0:
- I moved the CustomDialog parameters to the BD_CustomDlgParams class.
- I added two new parameters: Duration and DialogGravity.
- I removed the Margin parameter and added the MarginHeight parameter (to be used when Gravity is set to TOP).
- The BodyWidth and BodyHeight parameters defines now accurately the size of the dialog body.

v2.1:
- I added a "closing" event raised just before a custom dialog is dismissed. You can cancel the closure by returning False.

v2.11:
- I added the "DlgResponse" parameter to the Closing event.

This library does not work with Android versions < 2.
It requires another library: Masked EditText
 

Attachments

  • BetterDialogs v2.11.zip
    55.6 KB · Views: 2,369
  • Java source - BetterDialogs.zip
    8.5 KB · Views: 749
Last edited:

PSEAD

Member
Licensed User
Longtime User
The CustomDialog has "Duration". If possible, please to add this to the InputBox too.
 

ilan

Expert
Licensed User
Longtime User
I have lost the enthusiasm to continue and I would like to devote my little free time to my loved ones. On the other hand, the future of B4X is in cross-platform views and my total lack of interest in iOS does not push me in this direction.

:(:(:(

I cannot imagine b4x.com without you and your great libs and help.
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
I have lost the enthusiasm to continue and I would like to devote my little free time to my loved ones. On the other hand, the future of B4X is in cross-platform views and my total lack of interest in iOS does not push me in this direction.
Surely you made a decision like this by pondering carefully.
Spending more time with loved ones is certainly more important.

Thank you for the libraries, suggestions, methods, code and knowledge that you have shared with us over the years. It has been appreciated and I am sure they will be useful in the future for the professionalism you have.

Thank you also for warning us, some have disappeared and we do not even know what happened to them. Even if it is not a obligation to give explanations, over time you learn to know and become a second family that is added to the real that we have next to us.

I wish you a bright future
 

Informatix

Expert
Licensed User
Longtime User
Surely you made a decision like this by pondering carefully.
Spending more time with loved ones is certainly more important.

Thank you for the libraries, suggestions, methods, code and knowledge that you have shared with us over the years. It has been appreciated and I am sure they will be useful in the future for the professionalism you have.

Thank you also for warning us, some have disappeared and we do not even know what happened to them. Even if it is not a obligation to give explanations, over time you learn to know and become a second family that is added to the real that we have next to us.

I wish you a bright future
Thank you very much. I will never be very far away as I will continue to maintain libraries such as ULV.
 

incendio

Well-Known Member
Licensed User
Longtime User
Thank you for your contribution.

Most of my UI, use your library / class (ULV, floating windows & class action bar)

Hope everything well for you.
 

Pantelis

Member
Licensed User
Longtime User
Of course the newer is better.
But it doesn't work at all on my system.
Thank you any way.
 

Star-Dust

Expert
Licensed User
Longtime User

Pantelis

Member
Licensed User
Longtime User
And the old version was working? On which system?
My version of B4A is 2.71 and the first version of your library it publised in same year.
I don't know if older versions realy work. I didn't tried.
Using the current version, when i add this signle line to a new project

Dim DB as BetterDialogs

gives me this error:

The application B4A has stopped unexpectedly. Please try again.

LogCat connected to: emulator-5554
main_globals (java line: 329)


java.lang.NoClassDefFoundError: flm.b4a.betterdialogs.BetterDialogs


at b4a.example.main._globals(main.java:329)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at b4a.example.main.initializeGlobals(main.java:230)
at b4a.example.main.afterFirstLayout(main.java:86)
at b4a.example.main.access$100(main.java:16)
at b4a.example.main$WaitForLayout.run(main.java:74)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)


at dalvik.system.NativeStart.main(Native Method)
 

Informatix

Expert
Licensed User
Longtime User
My version of B4A is 2.71 and the first version of your library it publised in same year.
I don't know if older versions realy work. I didn't tried.
Using the current version, when i add this signle line to a new project

Dim DB as BetterDialogs

gives me this error:

The application B4A has stopped unexpectedly. Please try again.

LogCat connected to: emulator-5554
main_globals (java line: 329)


java.lang.NoClassDefFoundError: flm.b4a.betterdialogs.BetterDialogs


at b4a.example.main._globals(main.java:329)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at b4a.example.main.initializeGlobals(main.java:230)
at b4a.example.main.afterFirstLayout(main.java:86)
at b4a.example.main.access$100(main.java:16)
at b4a.example.main$WaitForLayout.run(main.java:74)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)


at dalvik.system.NativeStart.main(Native Method)
You should consider upgrading B4A to the latest version. It's the only thing that will solve your issue.
 
Top