Android Question XUI Custom MsgBox Class - Please Provide Your Feedback

Harris

Expert
Licensed User
Longtime User
Do you dis-like the stock MsgBox(2) dialog as much as I ?
It is small, hard to read, hard to select the tiny buttons, etc...


This project attempts to create a custom msgbox class that uses XUI standards - along with Wait For to eliminate the dreaded "DoEvents" that other offerings used (prior to Wait For) to simulate the modal effect.

All text in the dialog (labels and buttons) scales to fit any device density (or at least I hope).
Try in Portrait and Landscape mode...

I have tested it on a 8 inch Samsung tablet (low density - 1) and a LG G3 phone (high density - 4).
Hopefully this will work on B4i as well... Could you test for me?

The class is well commented. Can you smart people proof it / comment on / fix it where you see fit?

When bullet proof - I shall use it in my productions and post it as a code snippet / additional class...

The current custom msgbox dialog I use is problematic - since I suspect it uses "DoEvents" (can't tell - it's a lib).

This is based on many examples I found here on the forum. You guys rock!


Note: None of the apps I create use standard Android text size (and other small things). Only our kids can read and react to this (so I feel). All is enlarged so we (us old folks - my target) can use the app effectively. More work - Yes - but a better app in the end.

Thanks all.

Phone view:
msgb.png


Tablet view:
tablet.png
 

Attachments

  • b4a_xMsgbx.zip
    10.6 KB · Views: 549
  • b4j_xmsgbx.zip
    5.7 KB · Views: 295
Last edited:

Harris

Expert
Licensed User
Longtime User
All things are quite big
Yes, that's by design. For my old eyes and that of my users as well. Anyone can adjust these sizes if they please..

[Use a better name, like xMsgBox, where x means XUI]
You have a very good point - like klaus's xCustom_(stuff he does).

Do you speak B4i ?

I believe you shall see some of your own code buried in there (SetTextSize - respecting padding - for Buttons mostly (left and right I added) )?

Thanks for your feedback. Most helpful.
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Unfortunately I could not test it on an iOS
I have an account - but I have never done this... I am afraid - I am all alone... :eek:

I want to create a cross platform B4A and B4i app and this is just the start. All the stuff I currently use in my Android apps should port to iOS when I learn how to use effectively. XUI should help - so I read... so I hope...
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
Sorry, but I have bad news.
The Class doesn’t work with B4J nor with B4i, see below.

I had a look at your project.

Some comments :

1. I set the latest Android version in the ManifestEditor.
This is only for Android.

2. I removed the Phone libray, which is not used.
This is only for Android.

3. The Class doesn’t work with B4J nor with B4i.

3a. The getPadding property exist only in B4A, this will need conditional compilation.
You don’t need a JavaObject anymore for padding, Labels and Buttons have a Padding property.
From the help :
Label.Padding
Property
Readable As Int()
Writeable As Int()
Gets or sets the view's padding (distance between border and content).
The data is stored in a 4 element array with the following values: left, top, right and bottom.
Make sure to use 'dip' units when setting the padding.
Example: Button1.Padding = Array As Int (30dip, 10dip, 10dip, 10dip)


3b. StateListDrawable does exist only in B4A.

3c. In the MsgBoxC you use Activity as a parameter, Activity does exist only in B4A.

3d. For views and other objects like Font or Bitmap, you should use B4X objects, what you partly did.
In B4J the Bitmap object doesn’t exist it’s called Image, you should use B4XBitmap.
For Fonts, you should use B4XFont.

3e. Etc

To make the class B4X XUI cross platform compatible it needs some work.

One suggestion, use B4J and look at the errors showing the differences.
 
Last edited:
Upvote 0

Harris

Expert
Licensed User
Longtime User
One suggestion, use B4J and look at the errors showing the differences.
Yes, I remember you and Erel suggesting to start with B4J and work one's way to other platforms from there... All the code was Android pieces that I cobbled together and added xui to it.

Sorry, but I have bad news.
Not so bad but rather Very Good Advice!
Thanks for examining. I shall work on it and re-submit.
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
I suggest you to work on it.
Why B4J, it's easier, you need no device.
I could have a deeper look at it, but not this weekend, I have my granddaughter at home.

No problem klaus, I appreciate your advice and direction.

I am taking examples from the xCustomListView which shows how to xui properly.
Next version should be 99% correct - for all platforms. We shall see...
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You could also have a look at the xChart class.
Erel has added a very useful feature.
You can have three IDEs open, one for each B4X product, and when you modify the class module in one of the IDEs it is automatically updated in the other IDEs. The class file is at one place and referenced with a relative link in the other projects.
 
Last edited:
Upvote 0

udg

Expert
Licensed User
Longtime User
Hi @Harris
as an exercise I did something similar about the ToastMessage a few days ago. It started long ago as a way to have a simpe ToastMessageShow for B4J and ended up as an XUI/B4X class recently. Just for fun and as a learning tool.
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Ok, uploaded 2 projects in first post - one for B4A and B4J. B4i is work in progress... (not even touched...)

Both use the xMsgbx class (same in each project).

Lot's of conditional compile directives to make work on both.
I have found it is easier creating B4A B4XViews since more options exist to create what one wants.
CSSUtils is needed in B4J. I guess that's what it there for - style your controls.

The examples I found/provided helped in creating this - and still much to learn. The "Wait For" in this class seems to need some fixing...

This xMsgbx class is more for B4A/B4i - since your desktop can deal with standard message dialogues just fine.

Thanks
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I have found it is easier creating B4A B4XViews since more options exist to create what one wants.
Whereever you can, use B4A B4XViews, this could be useful even for single platform applications.
 
Last edited:
Upvote 0
Top