Small edit

This commit is contained in:
cepprice 2021-01-24 22:32:49 +05:00
parent 904c34e39c
commit 1ac271acea
11 changed files with 389 additions and 367 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="?attr/switch_button_active" />
<corners android:radius="4dp" />
<solid android:color="?attr/switch_button_active" />
</shape>

View file

@ -1,85 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="?attr/card_and_list_background_basic"
xmlns:tools="http://schemas.android.com/tools"
xmlns:osmand="http://schemas.android.com/apk/res-auto">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="?attr/card_and_list_background_basic"
xmlns:tools="http://schemas.android.com/tools"
xmlns:osmand="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/action_bar_height"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/action_bar_height"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/btn_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/card_padding"
android:layout_marginLeft="@dimen/card_padding"
android:padding="@dimen/context_menu_padding_margin_small"
android:paddingStart="@dimen/context_menu_padding_margin_small"
android:paddingEnd="@dimen/context_menu_padding_margin_small">
<FrameLayout
android:id="@+id/btn_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/card_padding"
android:layout_marginLeft="@dimen/card_padding"
android:padding="@dimen/context_menu_padding_margin_small"
android:paddingStart="@dimen/context_menu_padding_margin_small"
android:paddingEnd="@dimen/context_menu_padding_margin_small">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="@dimen/favorites_icon_size_small"
android:layout_height="@dimen/favorites_icon_size_small"
android:tint="?attr/default_icon_color"
osmand:srcCompat="@drawable/ic_action_close" />
</FrameLayout>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="@dimen/favorites_icon_size_small"
android:layout_height="@dimen/favorites_icon_size_small"
android:tint="?attr/default_icon_color"
osmand:srcCompat="@drawable/ic_action_close" />
</FrameLayout>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/card_content_padding_large"
android:layout_marginStart="@dimen/card_content_padding_large"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="@string/context_menu_edit_descr"
android:textColor="?attr/searchbar_text"
android:textSize="@dimen/dialog_header_text_size"
osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/card_content_padding_large"
android:layout_marginStart="@dimen/card_content_padding_large"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="@string/context_menu_edit_descr"
android:textColor="?attr/searchbar_text"
android:textSize="@dimen/dialog_header_text_size"
osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/btn_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/content_padding_half"
android:layout_marginEnd="@dimen/content_padding_half"
android:layout_gravity="center_vertical"
android:background="@drawable/btn_border_active"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingBottom="@dimen/content_padding_half"
android:text="@string/shared_string_save"
android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/btn_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/content_padding_half"
android:layout_marginEnd="@dimen/content_padding_half"
android:layout_gravity="center_vertical"
android:background="@drawable/btn_border_active"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingBottom="@dimen/content_padding_half"
android:text="@string/shared_string_save"
android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/divider_color" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/divider_color" />
<net.osmand.plus.widgets.EditTextEx
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:background="?attr/card_and_list_background_basic"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Amsterdam is the Netherlands' capital and financial, cultural and creative centre with more than 850,000 inhabitants. Amsterdam is known for the canals that criss-cross the city, its impressive architecture and more than 1,500 bridges. The city has a heritage dating back to the Dutch Golden Age in the 17th century as well as a diverse art scene and a bustling nightlife." />
<net.osmand.plus.widgets.EditTextEx
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:background="?attr/card_and_list_background_basic"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Amsterdam is the Netherlands' capital and financial, cultural and creative centre with more than 850,000 inhabitants. Amsterdam is known for the canals that criss-cross the city, its impressive architecture and more than 1,500 bridges. The city has a heritage dating back to the Dutch Golden Age in the 17th century as well as a diverse art scene and a bustling nightlife." />
</LinearLayout>

View file

@ -1,95 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="?attr/activity_background_basic">
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="?attr/list_background_color">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/pstsTabBackground">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/pstsTabBackground">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/action_bar_height"
app:titleTextColor="?attr/list_background_color" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/action_bar_height"
app:titleTextColor="?attr/list_background_color" />
</com.google.android.material.appbar.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="?attr/list_background_color">
<LinearLayout
android:id="@+id/ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="?attr/list_background_color">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/main_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:adjustViewBounds="true"
tools:visibility="visible"
tools:src="@drawable/img_help_announcement_time_day"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/main_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:adjustViewBounds="true"
tools:visibility="visible"
tools:src="@drawable/img_help_announcement_time_day"/>
<net.osmand.plus.widgets.WebViewEx
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:background="@color/color_transparent" />
<net.osmand.plus.widgets.WebViewEx
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:background="@color/color_transparent" />
<View
android:id="@+id/divider1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/divider_color" />
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/divider_color"
android:visibility="gone"
tools:visibility="visible"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/btn_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginTop="@dimen/context_menu_padding_margin_small"
android:layout_marginBottom="@dimen/context_menu_padding_margin_small"
android:gravity="center_vertical"
android:padding="@dimen/context_menu_padding_margin_small"
android:paddingStart="@dimen/context_menu_padding_margin_small"
android:paddingEnd="@dimen/context_menu_padding_margin_small"
android:drawablePadding="@dimen/list_content_padding_large"
osmand:drawableLeftCompat="@drawable/ic_action_edit_dark"
osmand:drawableStartCompat="@drawable/ic_action_edit_dark"
osmand:drawableTint="?attr/active_color_basic"
android:text="@string/shared_string_edit"
android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/btn_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginTop="@dimen/context_menu_padding_margin_small"
android:layout_marginBottom="@dimen/context_menu_padding_margin_small"
android:gravity="center_vertical"
android:padding="@dimen/context_menu_padding_margin_small"
android:paddingStart="@dimen/context_menu_padding_margin_small"
android:paddingEnd="@dimen/context_menu_padding_margin_small"
android:drawablePadding="@dimen/list_content_padding_large"
osmand:drawableLeftCompat="@drawable/ic_action_edit_dark"
osmand:drawableStartCompat="@drawable/ic_action_edit_dark"
osmand:drawableTint="?attr/active_color_basic"
android:visibility="gone"
android:text="@string/shared_string_edit"
android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:visibility="visible" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/divider_color" />
<FrameLayout
android:id="@+id/bottom_empty_space"
android:layout_width="match_parent"
android:layout_height="@dimen/card_row_min_height"
android:foreground="@drawable/bg_contextmenu_shadow"
android:foregroundGravity="top|fill_horizontal"
android:visibility="gone"
tools:visibility="visible">
<View
android:layout_width="match_parent"
android:layout_height="@dimen/card_row_min_height"
android:background="?attr/activity_background_basic"/>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/activity_background_basic" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</ScrollView>
</LinearLayout>

View file

@ -17,93 +17,108 @@
</FrameLayout>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding_small"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:text="@string/shared_string_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding_small"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:text="@string/shared_string_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/main_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/content_padding_small"
android:visibility="gone"
android:adjustViewBounds="true"
tools:visibility="visible"
tools:src="@drawable/img_help_announcement_time_day"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/main_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/content_padding_small"
android:visibility="gone"
android:adjustViewBounds="true"
tools:visibility="visible"
tools:src="@drawable/img_help_announcement_time_day"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/context_menu_padding_margin_small"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
android:lineSpacingMultiplier="1.1"
osmand:typeface="@string/font_roboto_regular"
tools:text="Amsterdam is the Netherlands' capital and financial, cultural and creative centre with more than 850,000 inhabitants. Amsterdam is known for the canals that criss-cross the city, its impressive architecture and more than 1,500 bridges. The city has a heritage dating back to the Dutch Golden Age in the 17th century as well as a diverse art scene and a bustling nightlife."/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/context_menu_padding_margin_small"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
android:lineSpacingMultiplier="1.1"
osmand:typeface="@string/font_roboto_regular"
tools:text="Amsterdam is the Netherlands' capital and financial, cultural and creative centre with more than 850,000 inhabitants. Amsterdam is known for the canals that criss-cross the city, its impressive architecture and more than 1,500 bridges. The city has a heritage dating back to the Dutch Golden Age in the 17th century as well as a diverse art scene and a bustling nightlife."/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/context_menu_padding_margin_small"
android:layout_marginBottom="@dimen/context_menu_padding_margin_small"
android:orientation="horizontal">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/context_menu_padding_margin_small"
android:layout_marginBottom="@dimen/context_menu_padding_margin_small"
android:orientation="horizontal">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/btn_read_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/context_menu_padding_margin_small"
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
android:layout_gravity="start"
android:gravity="center_vertical"
android:paddingStart="@dimen/bottom_sheet_content_padding_small"
android:paddingLeft="@dimen/bottom_sheet_content_padding_small"
android:paddingTop="@dimen/bottom_sheet_content_padding_small"
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
android:paddingEnd="@dimen/bottom_sheet_content_padding_small"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small"
android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
osmand:drawableStartCompat="@drawable/ic_action_read_article"
osmand:drawableLeftCompat="@drawable/ic_action_read_article"
osmand:drawableTint="?attr/wikivoyage_active_color"
android:text="@string/context_menu_read_full"
android:textColor="?attr/wikivoyage_active_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/btn_read_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/context_menu_padding_margin_small"
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
android:layout_gravity="start"
android:gravity="center_vertical"
android:paddingStart="@dimen/bottom_sheet_content_padding_small"
android:paddingLeft="@dimen/bottom_sheet_content_padding_small"
android:paddingTop="@dimen/bottom_sheet_content_padding_small"
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
android:paddingEnd="@dimen/bottom_sheet_content_padding_small"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small"
android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
osmand:drawableStartCompat="@drawable/ic_action_read_article"
osmand:drawableLeftCompat="@drawable/ic_action_read_article"
osmand:drawableTint="?attr/wikivoyage_active_color"
android:text="@string/context_menu_read_full"
android:textColor="?attr/wikivoyage_active_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/btn_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:layout_marginEnd="@dimen/context_menu_padding_margin_small"
android:layout_gravity="end"
android:gravity="center_vertical"
android:padding="@dimen/bottom_sheet_content_padding_small"
android:paddingStart="@dimen/bottom_sheet_content_padding_small"
android:paddingEnd="@dimen/bottom_sheet_content_padding_small"
android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
osmand:drawableRightCompat="@drawable/ic_action_edit_dark"
osmand:drawableEndCompat="@drawable/ic_action_edit_dark"
osmand:drawableTint="?attr/wikivoyage_active_color"
android:text="@string/shared_string_edit"
android:textColor="?attr/wikivoyage_active_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/btn_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:layout_marginEnd="@dimen/context_menu_padding_margin_small"
android:layout_gravity="end"
android:gravity="center_vertical"
android:padding="@dimen/bottom_sheet_content_padding_small"
android:paddingStart="@dimen/bottom_sheet_content_padding_small"
android:paddingEnd="@dimen/bottom_sheet_content_padding_small"
android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
osmand:drawableRightCompat="@drawable/ic_action_edit_dark"
osmand:drawableEndCompat="@drawable/ic_action_edit_dark"
osmand:drawableTint="?attr/wikivoyage_active_color"
android:text="@string/shared_string_edit"
android:textColor="?attr/wikivoyage_active_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:minHeight="@dimen/card_row_min_height"
android:layout_weight="1"
android:foreground="@drawable/bg_contextmenu_shadow"
android:foregroundGravity="top|fill_horizontal">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/activity_background_basic" />
</FrameLayout>
</FrameLayout>
</LinearLayout>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/action_edit"
android:icon="@drawable/ic_action_edit_dark"
osmand:showAsAction="always"
android:title="@string/shared_string_edit"/>
xmlns:osmand="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/action_edit"
android:icon="@drawable/ic_action_edit_dark"
osmand:showAsAction="always"
android:title="@string/shared_string_edit"/>
</menu>

View file

@ -141,7 +141,7 @@
<attr name="bg_dash_line" format="reference"/>
<attr name="text_input_background" format="reference"/>
<attr name="image_help_announcement_time" format="reference"/>
<attr name="switch_button_active" format="reference" />
<attr name="switch_button_active" format="reference" />
</declare-styleable>
<declare-styleable name="PagerSlidingTabStrip">

View file

@ -196,8 +196,4 @@ public class FileUtils {
public interface RenameCallback {
void renamedTo(File file);
}
public interface GpxEditedCallback {
void onGpxChanged();
}
}

View file

@ -23,90 +23,95 @@ import androidx.appcompat.widget.AppCompatImageView;
public class DescriptionCard extends BaseCard {
private final GPXFile gpxFile;
private final GPXFile gpxFile;
public DescriptionCard(MapActivity mapActivity, GPXFile gpxFile) {
super(mapActivity);
this.gpxFile = gpxFile;
}
public DescriptionCard(MapActivity mapActivity, GPXFile gpxFile) {
super(mapActivity);
this.gpxFile = gpxFile;
}
@Override
public int getCardLayoutId() {
return R.layout.gpx_description_preview_card;
}
@Override
public int getCardLayoutId() {
return R.layout.gpx_description_preview_card;
}
@Override
protected void updateContent() {
final String title = gpxFile.metadata.getArticleTitle();
final String imageUrl = getMetadataImageLink(gpxFile.metadata);
final String descriptionHtml = gpxFile.metadata.getDescription();
@Override
protected void updateContent() {
if (gpxFile == null || gpxFile.metadata == null || gpxFile.metadata.getDescription() == null) {
AndroidUiHelper.updateVisibility(view, false);
return;
}
setupImage(imageUrl);
final String title = gpxFile.metadata.getArticleTitle();
final String imageUrl = getMetadataImageLink(gpxFile.metadata);
final String descriptionHtml = gpxFile.metadata.getDescription();
TextViewEx tvDescription = view.findViewById(R.id.description);
tvDescription.setText(getFirstParagraph(descriptionHtml));
setupImage(imageUrl);
TextViewEx readBtn = view.findViewById(R.id.btn_read_full);
readBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GpxReadDescriptionDialogFragment.showInstance(mapActivity, title, imageUrl, descriptionHtml);
}
});
TextViewEx editBtn = view.findViewById(R.id.btn_edit);
editBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GpxEditDescriptionDialogFragment.showInstance(mapActivity, descriptionHtml);
}
});
}
TextViewEx tvDescription = view.findViewById(R.id.description);
tvDescription.setText(getFirstParagraph(descriptionHtml));
@Nullable
private String getMetadataImageLink(@NonNull GPXUtilities.Metadata metadata) {
String link = metadata.link;
if (!TextUtils.isEmpty(link)) {
String lowerCaseLink = link.toLowerCase();
if (lowerCaseLink.contains(".jpg")
|| lowerCaseLink.contains(".jpeg")
|| lowerCaseLink.contains(".png")
|| lowerCaseLink.contains(".bmp")
|| lowerCaseLink.contains(".webp")) {
return link;
}
}
return null;
}
TextViewEx readBtn = view.findViewById(R.id.btn_read_full);
readBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GpxReadDescriptionDialogFragment.showInstance(mapActivity, title, imageUrl, descriptionHtml);
}
});
TextViewEx editBtn = view.findViewById(R.id.btn_edit);
editBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GpxEditDescriptionDialogFragment.showInstance(mapActivity, descriptionHtml);
}
});
}
private String getFirstParagraph(String descriptionHtml) {
if (descriptionHtml != null) {
String firstParagraph = WikiArticleHelper.getPartialContent(descriptionHtml);
if (!TextUtils.isEmpty(firstParagraph)) {
return firstParagraph;
}
}
return descriptionHtml;
}
@Nullable
private String getMetadataImageLink(@NonNull GPXUtilities.Metadata metadata) {
String link = metadata.link;
if (!TextUtils.isEmpty(link)) {
String lowerCaseLink = link.toLowerCase();
if (lowerCaseLink.contains(".jpg")
|| lowerCaseLink.contains(".jpeg")
|| lowerCaseLink.contains(".png")
|| lowerCaseLink.contains(".bmp")
|| lowerCaseLink.contains(".webp")) {
return link;
}
}
return null;
}
private void setupImage(final String imageUrl) {
if (imageUrl == null) {
return;
}
final PicassoUtils picasso = PicassoUtils.getPicasso(app);
RequestCreator rc = Picasso.get().load(imageUrl);
final AppCompatImageView image = view.findViewById(R.id.main_image);
rc.into(image, new Callback() {
@Override
public void onSuccess() {
picasso.setResultLoaded(imageUrl, true);
AndroidUiHelper.updateVisibility(image, true);
}
private String getFirstParagraph(String descriptionHtml) {
if (descriptionHtml != null) {
String firstParagraph = WikiArticleHelper.getPartialContent(descriptionHtml);
if (!TextUtils.isEmpty(firstParagraph)) {
return firstParagraph;
}
}
return descriptionHtml;
}
@Override
public void onError(Exception e) {
picasso.setResultLoaded(imageUrl, false);
}
});
}
private void setupImage(final String imageUrl) {
if (imageUrl == null) {
return;
}
final PicassoUtils picasso = PicassoUtils.getPicasso(app);
RequestCreator rc = Picasso.get().load(imageUrl);
final AppCompatImageView image = view.findViewById(R.id.main_image);
rc.into(image, new Callback() {
@Override
public void onSuccess() {
picasso.setResultLoaded(imageUrl, true);
AndroidUiHelper.updateVisibility(image, true);
}
@Override
public void onError(Exception e) {
picasso.setResultLoaded(imageUrl, false);
}
});
}
}

View file

@ -94,7 +94,7 @@ public class GpxEditDescriptionDialogFragment extends BaseOsmAndDialogFragment {
log.error(errorMessage);
}
trackMenuFragment.onGpxChanged();
trackMenuFragment.updateContent();
if (readGpxFragment != null) {
Bundle args = readGpxFragment.getArguments();
if (args != null) {

View file

@ -13,6 +13,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
@ -25,6 +26,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.base.BaseOsmAndDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.widgets.TextViewEx;
import net.osmand.plus.widgets.WebViewEx;
import net.osmand.plus.wikivoyage.WikivoyageUtils;
@ -59,13 +61,6 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
setupImage(view);
setupWebView(view);
view.findViewById(R.id.btn_edit).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GpxEditDescriptionDialogFragment.showInstance(getMyActivity(), getArgument(CONTENT_KEY));
}
});
return view;
}
@ -153,7 +148,7 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
});
}
private void setupWebView(View view) {
private void setupWebView(final View view) {
webView = view.findViewById(R.id.content);
webView.setScrollbarFadingEnabled(true);
webView.setVerticalScrollBarEnabled(false);
@ -163,6 +158,13 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageCommitVisible(WebView webView, String url) {
super.onPageCommitVisible(webView, url);
setupDependentViews(view);
}
});
loadWebviewData();
}
@ -175,6 +177,21 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
}
}
private void setupDependentViews(final View view) {
TextViewEx readBtn = view.findViewById(R.id.btn_edit);
readBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GpxEditDescriptionDialogFragment.showInstance(getMyActivity(), getArgument(CONTENT_KEY));
}
});
AndroidUiHelper.setVisibility(View.VISIBLE,
readBtn, view.findViewById(R.id.divider), view.findViewById(R.id.bottom_empty_space));
int backgroundColor = isNightMode(false) ?
R.color.activity_background_color_dark : R.color.activity_background_color_light;
view.findViewById(R.id.root).setBackgroundResource(backgroundColor);
}
private String getColoredContent(String content) {
return "<body style=\"color:white;\">\n" +
content +

View file

@ -20,7 +20,6 @@ import com.google.android.material.bottomnavigation.BottomNavigationView;
import net.osmand.AndroidUtils;
import net.osmand.FileUtils;
import net.osmand.FileUtils.GpxEditedCallback;
import net.osmand.FileUtils.RenameCallback;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.Track;
@ -97,7 +96,7 @@ import static net.osmand.plus.track.OptionsCard.SHOW_ON_MAP_BUTTON_INDEX;
import static net.osmand.plus.track.OptionsCard.UPLOAD_OSM_BUTTON_INDEX;
public class TrackMenuFragment extends ContextMenuScrollFragment implements CardListener,
SegmentActionsListener, RenameCallback, OnTrackFileMoveListener, GpxEditedCallback {
SegmentActionsListener, RenameCallback, OnTrackFileMoveListener {
public static final String TAG = TrackMenuFragment.class.getName();
private static final Log log = PlatformUtil.getLog(TrackMenuFragment.class);
@ -222,10 +221,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
}
private void updateHeader() {
ViewGroup headerContainer = (ViewGroup) routeMenuTopShadowAll;
if (descriptionCard != null && descriptionCard.getView() != null) {
headerContainer.removeView(descriptionCard.getView());
}
if (menuType == TrackMenuType.OPTIONS) {
headerTitle.setText(menuType.titleId);
AndroidUiHelper.updateVisibility(headerIcon, false);
@ -233,17 +228,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
String fileName = Algorithms.getFileWithoutDirs(getGpx().path);
headerTitle.setText(GpxUiHelper.getGpxTitle(fileName));
AndroidUiHelper.updateVisibility(headerIcon, true);
if (menuType == TrackMenuType.OVERVIEW) {
fillOverviewTab(headerContainer);
}
}
runLayoutListener();
headerContainer.post(new Runnable() {
@Override
public void run() {
openMenuScreen(menuType == TrackMenuType.OVERVIEW ? MenuState.HEADER_ONLY : MenuState.HALF_SCREEN, false);
}
});
}
private void setupCards() {
@ -275,23 +260,21 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
optionsCard.setListener(this);
cardsContainer.addView(optionsCard.build(mapActivity));
}
} else if (menuType == TrackMenuType.OVERVIEW) {
if (descriptionCard != null && descriptionCard.getView() != null) {
ViewGroup parent = ((ViewGroup) descriptionCard.getView().getParent());
if (parent != null) {
cardsContainer.removeView(descriptionCard.getView());
}
cardsContainer.addView(descriptionCard.getView());
} else {
descriptionCard = new DescriptionCard(getMapActivity(), displayHelper.getGpx());
cardsContainer.addView(descriptionCard.build(mapActivity));
}
}
}
}
private void fillOverviewTab(ViewGroup headerContainer) {
if (descriptionCard != null && descriptionCard.getView() != null) {
ViewGroup parent = ((ViewGroup) descriptionCard.getView().getParent());
if (parent != null) {
parent.removeView(descriptionCard.getView());
}
headerContainer.addView(descriptionCard.getView());
} else {
descriptionCard = new DescriptionCard(getMapActivity(), displayHelper.getGpx());
headerContainer.addView(descriptionCard.build(getMapActivity()));
}
}
@Override
protected void calculateLayout(View view, boolean initLayout) {
menuTitleHeight = routeMenuTopShadowAll.getHeight()
@ -623,6 +606,9 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
if (optionsCard != null) {
optionsCard.updateContent();
}
if (descriptionCard != null) {
descriptionCard.updateContent();
}
setupCards();
}
@ -814,13 +800,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
}
}
@Override
public void onGpxChanged() {
if (descriptionCard != null) {
descriptionCard.update();
}
}
public static boolean showInstance(@NonNull MapActivity mapActivity, String path, boolean showCurrentTrack) {
try {
Bundle args = new Bundle();