B4A Library Dialogs library

Status
Not open for further replies.
This library contains several modal, that is blocking, dialogs by which the user can enter data. Presently they are an InputDialog for numbers and text, a TimeDialog for times and and a DateDialog for dates.

Note that modal dialogs can close unexpectedly and not return to your code if the Activity needs to close, most likely because the user rotated the device. There is a brief discussion of this in the overall library help in the xml. This can also occur with the Basic4android modal dialogs InputList, InputMultiList, Msgbox and Msgbox2 whose modal mechanism is used by the dialogs in this library.

Edit : - Version 1.1 posted with minor bug fix. See post #6 for details.

Edit : - Version 1.2 posted with Color dialogs. See post #16 for details.

Edit : - Version 1.3 posted with bug fix. See post #19 for details.

Edit : - Version 1.4 posted with a Number dialog. See post #20 for details.

Edit : - Version 1.5 posted with some enhancements. See post #28 for details.

Edit : - Version 1.6 posted with a File Dialog. See post #30 for details.

Edit : - Version 1.7 posted with a minor UI change. See post #33 for details.

Edit : - Version 1.8 posted with a Custom dialog. See post #37 for details.

Edit : - Version 1.9 posted with a bug fix. See post #42 for details.

Edit : - Version 2.0 posted with a bug fix. See post #48 for details.

Edit : - Version 2.1 posted with a second Custom dialog. See post #68 for details.

Edit : - Version 2.2 posted. See post #75 for details.

Edit : - Version 2.3 posted. See post #90 for details.

Edit : - Version 2.4 posted. See post #135 for details.

Edit : - Version 2.5 posted. See post #148 for details.

Edit : - Version 2.6 posted. See post #155 for details.

Edit : - Version 2.7 posted. See post #168 for details.

Edit : - Version 2.8 posted. See post #206 for details.

Edit :- Version 2.91 posted by Mildev. See post #317 for details. His version 2.91 is based on my unpublished v2.9 which set the text box in FileDialog to SingleLine mode.

Edit : - Version 2.92 posted. See post #341 for details.

Edit (Erel): Version 3.00 posted. Developers using B4A v6.80+ should use this version.

V4.01 is released with several improvements: https://www.b4x.com/android/forum/t...-dialogs-and-async-methods.80204/#post-507930

B4A version | Dialogs library version
------------------------------------
7.0+ 4+
6.8 3.00
<6.8 2.92
 

Attachments

  • Dialogs2.92.zip
    59.4 KB · Views: 12,978
  • Dialogs3.00.zip
    48.9 KB · Views: 2,937
  • Dialogs4.01.zip
    72.2 KB · Views: 9,528
Last edited by a moderator:

ivan.tellez

Active Member
Licensed User
Longtime User
Wow, great job, really useful.

I just want to contribute with some suggestions..

On the Input box
  • wen it opens, the edit has the focus, but the keyboard dont appear until you click the edit, it shoud appear when the dialog opens.
  • will be useful having a "MaxLenght" property
  • Stetic: I think it will look better if you add a little space between the edit and the area of the buttons.

Thanks :)
 

fabio.guerrazzi

Member
Licensed User
Longtime User
Help

Core 3.80
Dialogs 2.92

Compiling log below:

Parsing code. 0.00
Compiling code. 0.30
Compiling layouts code. 0.00
Generating R file. 0.02
Compiling generated Java code. 0.78
Convert byte code - optimized dex. 0.57
Packaging files. 0.11
Copying libraries resources Error
Impossibile trovare il file 'C:\0\MyExamle\Objects\bin\temp.ap_.521.tmp'.


If I remove the reference to Dialogs lib everything work fine
Thank you for answers
 

fabio.guerrazzi

Member
Licensed User
Longtime User
No, thanks but saddly it doesnt solve the problem.
I've 2 windows pc where I'm used to code.

a notebook Win8 64 and emulator
another one tower pc with Win7 64 and Samsung S2 throught wireless.

on Win7 works all fine, on Win8 only if I disable and comment Dialogs references

on Win8 "Test Compilation" ends succesfully

I re-copied Dialogs.jar and xml to \libraries assuming that files might have been corrupted.. no way

any other clue?
 

Douglas Farias

Expert
Licensed User
Longtime User
@agraham
hi man can you add the options on filedialog?
-Change Text Colors
-Change BGColors
-Change (..) to any other string (Back) for exemple
-Remove ↓Files ↓

BUG:
-in the Holo.Light theme the text is white and the bg is white too *-* cant see files to click

thx
 

mat2175

Member
Licensed User
Longtime User
I totally agree. The filedialog would be more user friendly if these options were added.
Please update the library @agraham

Thanks :)
 
Last edited:

Touch

Active Member
Licensed User
Longtime User
Hi agraham,
I use the Theme: Theme.Holo.Light
B4X:
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light")
I insert in my app your library for use FileDialog, but the file selection window displays the text color as the background color.
It is possible change the text color?
 

Informatix

Expert
Licensed User
Longtime User
Hi agraham,
I use the Theme: Theme.Holo.Light
B4X:
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light")
I insert in my app your library for use FileDialog, but the file selection window displays the text color as the background color.
It is possible change the text color?
There's a file explorer class that can replace this file dialog, if needed. And starting from September, the donationware version will be free.
 

Gary Milne

Active Member
Licensed User
Longtime User
Hi, I tried using the Color Picker Demo project (in Landscape mode) and on my Nexus 5 (4.4.4) the bottom part of the color bars is truncated and I can only see Red and part of the Green and then the buttons appear as normal. #SupportedOrientations: unspecified so I assumed it was intended to work on both. My Nexus 7 works fine.

P.S. I like the HSV dialog, I think it's the simplest for users to pick a color from (when you want a range). I think a nice addition would be the ability to specify the input parameters in RGB and have the dialog convert that to HSV (for the purpose of showing an existing color). B4A is predominantly weighted towards RGB and having to work with multiple color conversions is a pain.

Good work.
 

warwound

Expert
Licensed User
Longtime User
@agraham

Would you be prepared to let me have the source code for the Dialogs library so that i can attempt to fix the problem with the FileDialog file list text and background colors?

Thanks.

Martin.
 

warwound

Expert
Licensed User
Longtime User
Thanks to @agraham for letting me have the Dialogs library source.

Here is Dialogs version 2.93, i have added a new method to the FileDialog:

GetSingleLineLayout As SingleLineLayout
Gets the SingleLineLayout that will be used to populate the files list.
The SingleLineLayout defines the appearance and layout of the file list items.
See the ListView documentation for info about using the SingleLineLayout.


The ListView documentation can be found here: https://www.b4x.com/android/forum/threads/listview-tutorial.6537/.
Read the section Customizing each type in post #1 of that thread for more info.

This update will be useful to those that use a theme such as Holo.Light.
Without this update the items in the files list will have a light background color and a light text color, making it next to impossible to read the item text.
Look at the attached 'before' and 'after' screenshots.
These are both taken from a project where the application theme is Holo.Light.

Usage of the new method is simple, just get the SingleLineLayout from the FilesDialog and set background and/or text color so that your file list items are readable:

B4X:
Sub btnFile_Click
	Dim FileDialog1 As FileDialog
	FileDialog1.FastScroll = True
	FileDialog1.FilePath = File.DirRootExternal
	FileDialog1.KeyboardPopUp=False
	FileDialog1.ShowOnlyFolders = True
	
	'	set the file list style
	FileDialog1.GetSingleLineLayout.Label.TextColor=Colors.Black
	
	Dim Icon As Bitmap
	Icon.Initialize(File.DirAssets, "android48.png")
	Dim Action As Int = FileDialog1.Show("Select backup location:", "OK", "Cancel", "", Icon)
	
	Select Action
		Case DialogResponse.CANCEL
			ToastMessageShow("Backup cancelled", True)
		Case DialogResponse.POSITIVE
			ToastMessageShow("Backup to: "&FileDialog1.FilePath, True)
	End Select
End Sub

I've attached library version 2.93 to this post, if agraham wants to add it to post #1 in this thread then i'll remove it from this post to keep the thread tidy.
Also attached in the source code for version 2.93.

Martin.
 

Attachments

  • holo-light-before.png
    holo-light-before.png
    46.3 KB · Views: 325
  • holo-light-after.png
    holo-light-after.png
    60.4 KB · Views: 352
  • Dialogs_library_2.93.zip
    49.1 KB · Views: 340
  • InputDialog(source-2.93).zip
    11.5 KB · Views: 283

warwound

Expert
Licensed User
Longtime User
Oooops....

I forgot to mention in my previous post that when the FileDialog ShowOnlyFolders property is set to True, the EditText used for file name input is hidden.

Martin.
 

deantangNYP

Active Member
Licensed User
Longtime User
May i know if its possible to do auto file filtering?
Example: if user input "xyz" into the edit box on the FileDialog, only filenames with "xyz" will appear.
Please help. thanks.
 
Status
Not open for further replies.
Top