mirror of
https://github.com/moparisthebest/Yaaic
synced 2025-01-09 20:58:02 -05:00
Set font size for conversations in settings (8px - 16px)
This commit is contained in:
parent
6c9094b7e0
commit
aacc0a85c2
25
res/values/arrays.xml
Normal file
25
res/values/arrays.xml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string-array name="fontsize_labels">
|
||||||
|
<item>8px</item>
|
||||||
|
<item>9px</item>
|
||||||
|
<item>10px</item>
|
||||||
|
<item>11px</item>
|
||||||
|
<item>12px</item>
|
||||||
|
<item>13px</item>
|
||||||
|
<item>14px</item>
|
||||||
|
<item>15px</item>
|
||||||
|
<item>16px</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="fontsize_values">
|
||||||
|
<item>8</item>
|
||||||
|
<item>9</item>
|
||||||
|
<item>10</item>
|
||||||
|
<item>11</item>
|
||||||
|
<item>12</item>
|
||||||
|
<item>13</item>
|
||||||
|
<item>14</item>
|
||||||
|
<item>15</item>
|
||||||
|
<item>16</item>
|
||||||
|
</string-array>
|
||||||
|
</resources>
|
@ -17,4 +17,7 @@
|
|||||||
|
|
||||||
<string name="key_quitmessage">quitmessage</string>
|
<string name="key_quitmessage">quitmessage</string>
|
||||||
<string name="default_quitmessage">Yaaic - Yet another Android IRC client - http://www.yaaic.org</string>
|
<string name="default_quitmessage">Yaaic - Yet another Android IRC client - http://www.yaaic.org</string>
|
||||||
|
|
||||||
|
<string name="key_fontsize">fontsize</string>
|
||||||
|
<string name="default_fontsize">11</string>
|
||||||
</resources>
|
</resources>
|
@ -166,4 +166,8 @@
|
|||||||
<string name="settings_quitmessage_desc">Message to show when you disconnect</string>
|
<string name="settings_quitmessage_desc">Message to show when you disconnect</string>
|
||||||
<string name="settings_quitmessage_dialog_title">Quit message</string>
|
<string name="settings_quitmessage_dialog_title">Quit message</string>
|
||||||
<string name="settings_quitmessage_dialog_desc">Message to show when you disconnect:</string>
|
<string name="settings_quitmessage_dialog_desc">Message to show when you disconnect:</string>
|
||||||
|
<string name="settings_fontsize_title">Font size</string>
|
||||||
|
<string name="settings_fontsize_desc">Set the global font size</string>
|
||||||
|
<string name="settings_fontsize_dialog_title">Font size</string>
|
||||||
|
<string name="settings_fontsize_dialog_desc">Choose a font size</string>
|
||||||
</resources>
|
</resources>
|
@ -31,6 +31,14 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/settings_chat">
|
android:title="@string/settings_chat">
|
||||||
|
<ListPreference
|
||||||
|
android:title="@string/settings_fontsize_title"
|
||||||
|
android:summary="@string/settings_fontsize_desc"
|
||||||
|
android:dialogTitle="@string/settings_fontsize_dialog_title"
|
||||||
|
android:entries="@array/fontsize_labels"
|
||||||
|
android:entryValues="@array/fontsize_values"
|
||||||
|
android:key="@string/key_fontsize"
|
||||||
|
android:defaultValue="@string/default_fontsize" />
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:title="@string/settings_icons_title"
|
android:title="@string/settings_icons_title"
|
||||||
android:summary="@string/settings_icons_desc"
|
android:summary="@string/settings_icons_desc"
|
||||||
|
@ -132,10 +132,13 @@ public class Message {
|
|||||||
*/
|
*/
|
||||||
public TextView renderTextView(Context context)
|
public TextView renderTextView(Context context)
|
||||||
{
|
{
|
||||||
|
// XXX: We should not read settings here ALWAYS for EVERY textview
|
||||||
|
Settings settings = new Settings(context);
|
||||||
|
|
||||||
TextView canvas = new TextView(context);
|
TextView canvas = new TextView(context);
|
||||||
|
|
||||||
canvas.setText(this.render(context));
|
canvas.setText(this.render(context));
|
||||||
canvas.setTextSize(11);
|
canvas.setTextSize(settings.getFontSize());
|
||||||
canvas.setTypeface(Typeface.MONOSPACE);
|
canvas.setTypeface(Typeface.MONOSPACE);
|
||||||
canvas.setTextColor(0xffeeeeee);
|
canvas.setTextColor(0xffeeeeee);
|
||||||
|
|
||||||
|
@ -74,7 +74,6 @@ public class Settings
|
|||||||
public boolean showIcons()
|
public boolean showIcons()
|
||||||
{
|
{
|
||||||
return preferences.getBoolean(
|
return preferences.getBoolean(
|
||||||
|
|
||||||
resources.getString(R.string.key_show_icons),
|
resources.getString(R.string.key_show_icons),
|
||||||
Boolean.parseBoolean(resources.getString(R.string.default_show_icons))
|
Boolean.parseBoolean(resources.getString(R.string.default_show_icons))
|
||||||
);
|
);
|
||||||
@ -131,4 +130,17 @@ public class Settings
|
|||||||
resources.getString(R.string.default_quitmessage)
|
resources.getString(R.string.default_quitmessage)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the font size
|
||||||
|
*
|
||||||
|
* @return The font size for conversation messages
|
||||||
|
*/
|
||||||
|
public int getFontSize()
|
||||||
|
{
|
||||||
|
return Integer.parseInt(preferences.getString(
|
||||||
|
resources.getString(R.string.key_fontsize),
|
||||||
|
resources.getString(R.string.default_fontsize)
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user