Fix night colors and webview text size

This commit is contained in:
Alex Sytnyk 2018-06-11 13:18:21 +03:00
parent 91cd5f4b42
commit 386d71ff0b
4 changed files with 7 additions and 1 deletions

View file

@ -7,9 +7,9 @@
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/background_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/wikivoyage_card_bg_color"
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small" android:paddingBottom="@dimen/bottom_sheet_content_padding_small"
android:paddingTop="@dimen/content_padding"> android:paddingTop="@dimen/content_padding">

View file

@ -8,6 +8,7 @@
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <FrameLayout
android:id="@+id/background_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/wikivoyage_card_bg_color"> android:background="?attr/wikivoyage_card_bg_color">

View file

@ -48,6 +48,7 @@ public class GpxDescriptionDialogFragment extends BaseOsmAndDialogFragment {
WebView webView = new WebView(ctx); WebView webView = new WebView(ctx);
webView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); webView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
webView.getSettings().setTextZoom((int) (getResources().getConfiguration().fontScale * 100f));
Bundle args = getArguments(); Bundle args = getArguments();
if (args != null) { if (args != null) {
String content = args.getString(CONTENT_KEY); String content = args.getString(CONTENT_KEY);

View file

@ -483,6 +483,8 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
private View createTravelArticleCard(final Context context, @NonNull final TravelArticle article) { private View createTravelArticleCard(final Context context, @NonNull final TravelArticle article) {
View card = LayoutInflater.from(context).inflate(R.layout.wikivoyage_article_card, null); View card = LayoutInflater.from(context).inflate(R.layout.wikivoyage_article_card, null);
card.findViewById(R.id.background_view).setBackgroundColor(ContextCompat.getColor(context,
app.getSettings().isLightContent() ? R.color.list_item_light : R.color.list_item_dark));
((TextView) card.findViewById(R.id.title)).setText(article.getTitle()); ((TextView) card.findViewById(R.id.title)).setText(article.getTitle());
((TextView) card.findViewById(R.id.content)).setText(WikiArticleHelper.getPartialContent(article.getContent())); ((TextView) card.findViewById(R.id.content)).setText(WikiArticleHelper.getPartialContent(article.getContent()));
((TextView) card.findViewById(R.id.part_of)).setText(article.getGeoDescription()); ((TextView) card.findViewById(R.id.part_of)).setText(article.getGeoDescription());
@ -527,6 +529,8 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
String desc = Html.fromHtml(descHtml).toString().trim(); String desc = Html.fromHtml(descHtml).toString().trim();
if (!TextUtils.isEmpty(desc)) { if (!TextUtils.isEmpty(desc)) {
View card = LayoutInflater.from(context).inflate(R.layout.gpx_description_card, null); View card = LayoutInflater.from(context).inflate(R.layout.gpx_description_card, null);
card.findViewById(R.id.background_view).setBackgroundColor(ContextCompat.getColor(context,
app.getSettings().isLightContent() ? R.color.list_item_light : R.color.list_item_dark));
((TextView) card.findViewById(R.id.description)).setText(desc); ((TextView) card.findViewById(R.id.description)).setText(desc);
TextView readBtn = (TextView) card.findViewById(R.id.read_button); TextView readBtn = (TextView) card.findViewById(R.id.read_button);
readBtn.setCompoundDrawablesWithIntrinsicBounds(getReadIcon(), null, null, null); readBtn.setCompoundDrawablesWithIntrinsicBounds(getReadIcon(), null, null, null);