Fixing text sizes on Android.

This commit is contained in:
Samuel Clay 2013-07-23 20:37:50 -07:00
parent b3eb49128b
commit 04d698342e
8 changed files with 29 additions and 17 deletions

View file

@ -2,12 +2,23 @@ body {
background-color: #FFF;
overflow: hidden;
line-height: 1.5em;
margin: 0;
width: 100%;
max-width: 100%;
}
p, div {
.NB-story {
max-width: 100%;
overflow: hidden;
margin: 0;
}
p, div, table {
line-height: 1.5em;
margin: 0px 0px 20px 0;
clear: both;
max-width: 100% !important;
overflow: hidden;
}
div + p {
@ -20,6 +31,7 @@ img {
img, video, embed, object, iframe, div {
max-width: 95% !important;
width: auto;
height: auto !important;
}

View file

@ -31,9 +31,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/item_background"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="4dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="12dp"
android:scrollbars="none" />
<include

View file

@ -25,7 +25,7 @@
android:layout_width="17dp"
android:layout_height="17dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="12dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="5dp"
android:contentDescription="@string/description_row_folder_icon" />
@ -54,9 +54,9 @@
android:id="@+id/reading_item_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginRight="16dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginLeft="16dp"
android:layout_below="@id/item_feed_border"
android:textColor="@color/story_title_unread"
android:textSize="16sp" />
@ -67,7 +67,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/reading_item_title"
android:layout_alignLeft="@id/reading_item_title"
android:layout_marginRight="10dp"
android:layout_marginRight="12dp"
android:layout_marginTop="8dp"
android:textColor="@color/half_darkgray"
android:textSize="12sp" />

View file

@ -21,7 +21,7 @@
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="12dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="5dp"
android:textColor="@color/midgray"
android:textSize="11sp"
@ -38,7 +38,7 @@
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="12dp"
android:layout_marginRight="16dp"
android:textColor="@color/midgray"
android:textSize="11sp"
android:textStyle="bold"

View file

@ -83,7 +83,7 @@
android:textSize="13dp"
android:textStyle="bold"
android:shadowColor="@color/white"
android:shadowDy="2"
android:shadowDy="1"
android:shadowRadius="1"
android:maxLines="1"
android:ellipsize="end"/>

View file

@ -289,13 +289,13 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
float currentSize = preferences.getFloat(PrefConstants.PREFERENCE_TEXT_SIZE, 0.5f);
StringBuilder builder = new StringBuilder();
builder.append("<html><head><meta name=\"viewport\" content=\"width=device-width; initial-scale=0.75; maximum-scale=0.75; minimum-scale=0.75; user-scalable=0;\" />");
builder.append("<html><head><meta name=\"viewport\" content=\"width=device-width; initial-scale=1; maximum-scale=1; minimum-scale=1; user-scalable=0; target-densityDpi=medium-dpi\" />");
builder.append("<style style=\"text/css\">");
builder.append(String.format("body { font-size: %s em; } ", Float.toString(currentSize + AppConstants.FONT_SIZE_LOWER_BOUND)));
builder.append("</style>");
builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"reading.css\" /></head><body>");
builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"reading.css\" /></head><body><div class=\"NB-story\">");
builder.append(story.content);
builder.append("</body></html>");
builder.append("</div></body></html>");
web.loadDataWithBaseURL("file:///android_asset/", builder.toString(), "text/html", "UTF-8", null);
}

View file

@ -17,8 +17,8 @@ public class AppConstants {
public static final String FOLDER_PRE = "folder_collapsed";
public static final String NEWSBLUR_URL = "http://www.newsblur.com";
public static final float FONT_SIZE_LOWER_BOUND = 1.0f;
public static final float FONT_SIZE_INCREMENT_FACTOR = 5;
public static final float FONT_SIZE_LOWER_BOUND = 0.7f;
public static final float FONT_SIZE_INCREMENT_FACTOR = 8;
// the name to give the "root" folder in the local DB since the API does not assign it one.
// this name should be unique and such that it will sort to the beginning of a list, ideally.

View file

@ -29,7 +29,7 @@ public class NewsblurWebview extends WebView {
getSettings().setAppCachePath("/data/data/com.newsblur/cache");
getSettings().setAllowFileAccess(true);
getSettings().setAppCacheEnabled(true);
this.setScrollBarStyle(SCROLLBARS_INSIDE_OVERLAY);
}