Comment #6 on issue 269 by
arvid...@gmail.com: Add more realistic default
Here is a very simple patch I made to add a default font size option. The
patch does not try to default to a good font size on first run yet. The
only thing it adds is an option that allows you to change the default font
size for new hosts (without this patch it is hard-coded at 10 pt).
I will look into how to change the default font size based on the DPI
later, the issue is that as far as I understand from the API docs you
should use getWindowManager().getDefaultDisplay().getMetrics(metrics).
However getWindowManager() is found in the Activity class, and thus can't
be reached from the service that would need it (given the current
architecture of ConnectBot). I guess the reason for this is that the device
DPI could change. For example what if an user connects a phone or tablet
(with HDMI out) to a TV? I can't test this scenario (I lack the cables for
it) but presumably Android would re-initialize the activity (as it does
when you rotate the device for example). Thus I suspect that the only way
to correctly handle device DPI is to let the activity inform the
TerminalBridge about the screen DPI when it opens the TerminalBridge
(assuming such a re-initialisation of the activity would cause it to
re-open the TerminalBridge).
A potential issue with this patch is translation. I don't know how
translated strings work on android: Does it default to the string in
res/values/strings.xml if it can't find a translated version of that
string? If so it should work (though not be translated) I guess.
I have tested the change on my Samsung Galaxy S3 (I9300) and in the
emulator instances that I have around for my own projects (API levels 8 and
15) and it seems to work fine.
Attachments:
default-fontsize-setting.diff 3.2 KB