I put this in one of my apps and it seems work pretty well as a Menu addition.
in the Activity_Create
Activity.AddMenuItem("Device Font Size", "font_changer")
Then I added 2 subs, the first pops a msgbox for the user to choose the device type
Sub font_changer_Click
myFont = "14"
Dim res As Int
res = Msgbox2("Select Your Type of Device"&CRLF&"If you are not sure, Choose Cancel", "Choose Your Device Type", "Phone","Cancel", "Tablet", Null)
If res = DialogResponse.POSITIVE Then
myFont = "14"
Else If res = DialogResponse.NEGATIVE Then
myFont = "24"
Else If res = DialogResponse.CANCEL Then
myFont = IXStorage.GetSetting("safeFont")
End If
CallSubDelayed(Me, "saveMysettings")
CallSubDelayed(Me, "changeMyFont")'puts it in queue as a message, implemented at resume
End Sub
The second runs through all of the elements and forces the chosen font size.
Sub changeMyFont
Dim thefont As String
thefont = IXStorage.GetSetting("safeFont")
'must run this or casting error in java runtime - Invalid Double
If IsNumber(thefont) Then 'handles the casting, thanks Erel!
'Log("IsNumber: " &thefont)
myFont = thefont
Else
myFont = 14
End If
'centerPanel
L1.TextSize = myFont
L2.TextSize = myFont
L3.TextSize = myFont
L4.TextSize = myFont
L5.TextSize = myFont
L8.TextSize = myFont
paidmiles.TextSize = myFont
offeredrate.TextSize = myFont
fuelcost.TextSize = myFont
deadhead.TextSize = myFont
moneyoffered.TextSize = myFont
efcost.TextSize = myFont
'cpanel
Label4.TextSize = myFont
Label3.TextSize = myFont
myrate.TextSize = myFont
mpg.TextSize = myFont
'exPanel
L6.TextSize = myFont
L7.TextSize = myFont
exprate.TextSize = myFont
exprice.TextSize = myFont
diffbyrate.TextSize = myFont
diffmoney.TextSize = myFont
'wifPanel
whatifBtn.TextSize = myFont
wiftotal.TextSize = myFont
testrate.TextSize = myFont
L11.TextSize = myFont
L10.TextSize = myFont
'calc and reset
rstBtn.TextSize = myFont
calcBtn.TextSize = myFont
'wizpnl
titlelbl.TextSize = myFont
sqrbottom.TextSize = myFont
wtext.TextSize = myFont
'help and quit???
hlpBtn.TextSize = myFont
quitApp.TextSize = myFont
End Sub
I suppose I could have cut out some of the parts for the posting here, but...I even left my comments.
It uses a stored value that is kept in a settings file. There are many other ways to do this I'm sure, and I would expect others to chime in
It allows you to code the monster once, and let the user decide. I chose 2 font sizes for mine, one is default, and the other was 24.
It's a nice feature to add, and it makes your app something that says to the user "Hey, they thought this through".
If this helps in any way, then that's awesome!
Thanks for your earlier reply,
Coroner