XtraViews

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
Started an emulator in AVD and the sample works fine.

upload_2014-7-16_23-35-22.png
 

Thraka

Member
Licensed User
Longtime User
Both, that sample app you made for me where you took a screenshot of it working, and my app. Both give me the same white dialog that I showed in a screenshot. :)
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
Then something is seriously wrong in your setup. I tested the sample app in 3 different emulators and 4 devices.

This is a 100% identical AVD setup with yours running the sample app. And it works.

upload_2014-7-17_1-31-12.png
 

Thraka

Member
Licensed User
Longtime User
It seems the controls are actually being hidden behind the title! If I give it space inside the panel, it shows. As you can see, the top is being cut off.

screenshot_24.png
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
It is because the height of your layout panel is too big. Just resize it to make it smaller. Btw, the current DialogView (version 1.3) has support for different layouts per orientation:

B4X:
Dialog.LoadLayoutMultiple("Dialog1_Portrait", "Dialog1_Landscape", "Dialog1").ShowOk("title","done")
 

MaFu

Well-Known Member
Licensed User
Longtime User
It is because the height of your layout panel is too big. Just resize it to make it smaller. Btw, the current DialogView (version 1.3) has support for different layouts per orientation:

B4X:
Dialog.LoadLayoutMultiple("Dialog1_Portrait", "Dialog1_Landscape", "Dialog1").ShowOk("title","done")
Great. I will test it tomorrow.
 

Thraka

Member
Licensed User
Longtime User
Thanks. I'm new to this stuff. :)

How would I choose something to maximize height or width? When I try to anchor the panel to the top and bottom, the dialog is basically at 0 height and nothing is seen.
 
Last edited:

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
@MaFu: There is an android design issue. After orientation change, your activity will be recreated so there will be an inconsistency with a dialog that was opened from a previous activity. So, I decided to silently dismiss the dialog on orientation change. Since you will save the app state, you can invoke your dialog open function after state restore.

Also, DialogView follows the functionality of the standard msgbox that will be dismissed as well on orientation change.
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
@Thraka: The DialogView is not aware of the layout parent of your dialog contents. It only knows about the panel container. Do not set anchors on the container panel. I may add maxheight, maxwidth options in the DialogView in the next version.
 

MaFu

Well-Known Member
Licensed User
Longtime User
@MaFu: There is an android design issue. After orientation change, your activity will be recreated so there will be an inconsistency with a dialog that was opened from a previous activity. So, I decided to silently dismiss the dialog on orientation change. Since you will save the app state, you can invoke your dialog open function after state restore.

Also, DialogView follows the functionality of the standard msgbox that will be dismissed as well on orientation change.
OK.
I was a little bit irritated because the last version respawns automatically on rotation. But it's no problem.
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
Coming up in the next version: full customization of the default system elements such as the title and the buttons (positive, negative, neutral or all of them [default]) with elegance and the less possible code possible :D

upload_2014-7-17_14-4-30.png


upload_2014-7-17_14-15-57.png
 
Last edited:

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
Version 1.32 is live. Get it from the initial post.

Complete customization of the default message box without layout files.

Check sample4 for the full source code


B4X:
'Configure the dialog title
Dim TitleBackground As ColorDrawable : TitleBackground.Initialize(Colors.Gray, 0)
Dialog.Options.Title.Set(Typeface.CreateNew(Typeface.SANS_SERIF, Typeface.STYLE_BOLD_ITALIC), Colors.Blue, 25, Gravity.CENTER, TitleBackground, Colors.Red)
B4X:
'Configure the message content
Dim MessageBackground As ColorDrawable : MessageBackground.Initialize(Colors.Magenta, 0)
Dialog.Options.Message.Set(Typeface.CreateNew(Typeface.SANS_SERIF, Typeface.STYLE_BOLD_ITALIC), Colors.Blue, 25, Gravity.CENTER, MessageBackground)
B4X:
'Configure the dialog buttons
Dim ButtonBackground As StateListDrawable : ButtonBackground.Initialize
Dim ButtonBackgroundNormal As ColorDrawable : ButtonBackgroundNormal.Initialize(Colors.Yellow, 0)
Dim ButtonBackgroundPressed As ColorDrawable : ButtonBackgroundPressed.Initialize(Colors.Cyan, 0)
ButtonBackground.AddState(ButtonBackground.State_Pressed, ButtonBackgroundPressed)
ButtonBackground.AddCatchAllState(ButtonBackgroundNormal)

Dim ButtonStyle1, ButtonStyle2, ButtonStyle3  As DialogViewButtonStyle

ButtonStyle1.Set(Typeface.CreateNew(Typeface.SANS_SERIF, Typeface.STYLE_NORMAL), Colors.Blue, 14, Gravity.LEFT + Gravity.BOTTOM, ButtonBackground)
ButtonStyle2.Set(Typeface.CreateNew(Typeface.SANS_SERIF, Typeface.STYLE_BOLD), Colors.Red, 14, Gravity.LEFT + Gravity.Top, ButtonBackground)
ButtonStyle3.Set(Typeface.CreateNew(Typeface.SANS_SERIF, Typeface.STYLE_BOLD_ITALIC), Colors.Black, 24, Gravity.CENTER, ButtonBackground)

'Dialog.Options.Buttons.Default.Style = ButtonStyle1 <= apply the style to all buttons
Dialog.Options.Buttons.Positive.Style = ButtonStyle1
Dialog.Options.Buttons.Neutral.Style = ButtonStyle2
Dialog.Options.Buttons.Negative.Style = ButtonStyle3

'Or set the style in one line
'Dialog.Options.Buttons.Default.Style.Set(Typeface.CreateNew(Typeface.SANS_SERIF, Typeface.STYLE_NORMAL), Colors.Blue, 14, Gravity.LEFT + Gravity.BOTTOM, ButtonBackground)
B4X:
'Show the dialog
Dialog.Msgbox("title", "this is a standard message dialog", "yes", "no", "cancel", LoadBitmap(File.DirAssets, "icon1.png"))

upload_2014-7-17_20-5-10.png
 
Top