From b249fdbab6a22401b1b00996f8eddf296fb7d07e Mon Sep 17 00:00:00 2001 From: cepprice Date: Tue, 26 Jan 2021 20:09:25 +0500 Subject: [PATCH 1/2] Update UI of Description in Overview Tab in GPX context menu --- .../layout/dialog_edit_gpx_description.xml | 63 +++++--- .../layout/dialog_read_gpx_description.xml | 42 +++-- .../layout/gpx_description_preview_card.xml | 147 ++++++++++++------ .../osmand/plus/track/DescriptionCard.java | 42 ++++- .../GpxEditDescriptionDialogFragment.java | 61 ++++++-- .../GpxReadDescriptionDialogFragment.java | 25 +-- 6 files changed, 262 insertions(+), 118 deletions(-) diff --git a/OsmAnd/res/layout/dialog_edit_gpx_description.xml b/OsmAnd/res/layout/dialog_edit_gpx_description.xml index 52b5f97bdc..1d2428f82b 100644 --- a/OsmAnd/res/layout/dialog_edit_gpx_description.xml +++ b/OsmAnd/res/layout/dialog_edit_gpx_description.xml @@ -42,25 +42,31 @@ android:textSize="@dimen/dialog_header_text_size" osmand:typeface="@string/font_roboto_medium" /> - + android:background="@drawable/btn_border_active"> + + + @@ -69,17 +75,26 @@ android:layout_height="1dp" android:background="?attr/divider_color" /> - + android:layout_height="match_parent"> + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/dialog_read_gpx_description.xml b/OsmAnd/res/layout/dialog_read_gpx_description.xml index f4cf390af5..d065868ab1 100644 --- a/OsmAnd/res/layout/dialog_read_gpx_description.xml +++ b/OsmAnd/res/layout/dialog_read_gpx_description.xml @@ -56,32 +56,40 @@ android:id="@+id/divider" android:layout_width="match_parent" android:layout_height="1dp" - android:background="?attr/divider_color" + android:background="?attr/ctx_menu_info_divider" android:visibility="gone" tools:visibility="visible"/> - + android:background="@drawable/rounded_background_3dp"> + + + + - + android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + + + android:layout_marginStart="@dimen/card_padding" + android:layout_marginLeft="@dimen/card_padding" + android:layout_marginTop="@dimen/content_padding" + android:background="@drawable/rounded_background_3dp" + android:visibility="gone" + tools:visibility="visible"> - - @@ -110,6 +160,7 @@ = 19) { + webView.setLayerType(View.LAYER_TYPE_HARDWARE, null); + } + else { + webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); + } webView.setScrollbarFadingEnabled(true); webView.setVerticalScrollBarEnabled(false); webView.setBackgroundColor(Color.TRANSPARENT); - webView.setLayerType(WebView.LAYER_TYPE_HARDWARE, null); webView.getSettings().setTextZoom((int) (getResources().getConfiguration().fontScale * 100f)); webView.getSettings().setDomStorageEnabled(true); webView.getSettings().setLoadWithOverviewMode(true); From 27dd3423754914ca884140b41fbd4cd3e9960645 Mon Sep 17 00:00:00 2001 From: cepprice Date: Wed, 27 Jan 2021 15:48:10 +0500 Subject: [PATCH 2/2] Small edit and fix --- OsmAnd/src/net/osmand/plus/track/DescriptionCard.java | 5 ++++- .../plus/track/GpxEditDescriptionDialogFragment.java | 7 +------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/track/DescriptionCard.java b/OsmAnd/src/net/osmand/plus/track/DescriptionCard.java index 1280a183ef..8195c8d417 100644 --- a/OsmAnd/src/net/osmand/plus/track/DescriptionCard.java +++ b/OsmAnd/src/net/osmand/plus/track/DescriptionCard.java @@ -50,7 +50,7 @@ public class DescriptionCard extends BaseCard { setupImage(imageUrl); - if (descriptionHtml == null || Algorithms.isEmpty(descriptionHtml.trim())) { + if (Algorithms.isBlank(descriptionHtml)) { showAddBtn(); } else { showDescription(title, imageUrl, descriptionHtml); @@ -73,7 +73,10 @@ public class DescriptionCard extends BaseCard { private void showDescription(final String title, final String imageUrl, final String descriptionHtml) { LinearLayout descriptionContainer = view.findViewById(R.id.description_container); + FrameLayout addBtn = view.findViewById(R.id.btn_add); + AndroidUiHelper.updateVisibility(descriptionContainer, true); + AndroidUiHelper.updateVisibility(addBtn, false); TextViewEx tvDescription = view.findViewById(R.id.description); tvDescription.setText(getFirstParagraph(descriptionHtml)); diff --git a/OsmAnd/src/net/osmand/plus/track/GpxEditDescriptionDialogFragment.java b/OsmAnd/src/net/osmand/plus/track/GpxEditDescriptionDialogFragment.java index d17cd91667..a79a392f8e 100644 --- a/OsmAnd/src/net/osmand/plus/track/GpxEditDescriptionDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/GpxEditDescriptionDialogFragment.java @@ -84,17 +84,12 @@ public class GpxEditDescriptionDialogFragment extends BaseOsmAndDialogFragment { return view; } - - private boolean shouldClose() { Editable editable = editableHtml.getText(); if (htmlCode == null || editable == null || editable.toString() == null) { return true; } - if (htmlCode.equals(editable.toString())) { - return true; - } - return false; + return htmlCode.equals(editable.toString()); } private void showDismissDialog() {