add option to justify/left-align article text

This commit is contained in:
Andrew Dolgov 2012-03-21 09:18:20 +03:00
parent 267ce734c1
commit 9a1dbdc74f
4 changed files with 16 additions and 6 deletions

View File

@ -132,4 +132,5 @@
<string name="attachments_prompt">Select attachment</string>
<string name="attachment_view">View</string>
<string name="attachment_copy">Copy URL</string>
<string name="justify_article_text">Justify article text</string>
</resources>

View File

@ -97,6 +97,11 @@
android:defaultValue="false"
android:key="tablet_article_swipe"
android:title="@string/tablet_article_swipe" />
<CheckBoxPreference
android:defaultValue="true"
android:key="justify_article_text"
android:title="@string/justify_article_text" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/offline_mode" >

View File

@ -163,15 +163,17 @@ public class ArticleFragment extends Fragment {
articleContent = doc.toString();
}
String align = m_prefs.getBoolean("justify_article_text", true) ? "text-align : justify;" : "";
switch (Integer.parseInt(m_prefs.getString("font_size", "0"))) {
case 0:
cssOverride += "body { text-align : justify; font-size : 14px; } ";
cssOverride += "body { "+align+" font-size : 14px; } ";
break;
case 1:
cssOverride += "body { text-align : justify; font-size : 18px; } ";
cssOverride += "body { "+align+" font-size : 18px; } ";
break;
case 2:
cssOverride += "body { text-align : justify; font-size : 21px; } ";
cssOverride += "body { "+align+" font-size : 21px; } ";
break;
}

View File

@ -167,15 +167,17 @@ public class OfflineArticleFragment extends Fragment {
view.findViewById(R.id.attachments_holder).setVisibility(View.GONE);
String align = m_prefs.getBoolean("justify_article_text", true) ? "text-align : justified" : "";
switch (Integer.parseInt(m_prefs.getString("font_size", "0"))) {
case 0:
cssOverride += "body { text-align : justify; font-size : 14px; } ";
cssOverride += "body { "+align+"; font-size : 14px; } ";
break;
case 1:
cssOverride += "body { text-align : justify; font-size : 18px; } ";
cssOverride += "body { "+align+"; font-size : 18px; } ";
break;
case 2:
cssOverride += "body { text-align : justify; font-size : 21px; } ";
cssOverride += "body { "+align+"; font-size : 21px; } ";
break;
}