add a headline text size preference

This commit is contained in:
Andrew Dolgov 2013-05-27 14:37:42 +04:00
parent 5190841ca7
commit 116f9ca8d9
3 changed files with 27 additions and 6 deletions

View File

@ -199,4 +199,5 @@
<string name="prefs_confirm_headlines_catchup">Confirm marking articles as read</string>
<string name="author_formatted">by %1$s</string>
<string name="n_unread_articles">%1$d unread articles</string>
<string name="pref_headline_font_size">Headline text size</string>
</resources>

View File

@ -97,11 +97,18 @@
android:key="oldest_first"
android:summary="@string/requires_api5"
android:title="@string/offline_oldest_first" />
<CheckBoxPreference android:key="headlines_mark_read_scroll"
android:title="@string/pref_headlines_mark_read_scroll"
<CheckBoxPreference
android:defaultValue="false"
android:key="headlines_mark_read_scroll"
android:summary="@string/pref_headlines_mark_read_scroll_long"
android:defaultValue="false"/>
android:title="@string/pref_headlines_mark_read_scroll" />
<ListPreference
android:defaultValue="0"
android:entries="@array/pref_font_size_names"
android:entryValues="@array/pref_font_size_values"
android:key="headlines_font_size"
android:title="@string/pref_headline_font_size" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/reading" >
<ListPreference
@ -129,12 +136,10 @@
android:defaultValue="false"
android:key="full_screen_mode"
android:title="@string/prefs_fullscreen_mode" />
<CheckBoxPreference
android:defaultValue="true"
android:key="confirm_headlines_catchup"
android:title="@string/prefs_confirm_headlines_catchup" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/offline_mode" >
<ListPreference

View File

@ -671,6 +671,21 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (excerpt.length() > 200)
excerpt = excerpt.substring(0, 200) + "...";
int fontSize = -1;
switch (Integer.parseInt(m_prefs.getString("headlines_font_size", "0"))) {
case 0:
fontSize = 13;
break;
case 1:
fontSize = 16;
break;
case 2:
fontSize = 18;
break;
}
te.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
te.setText(excerpt);
}
}