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"?> <?xml version="1.0" encoding="utf-8"?>
<shape <shape
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<corners android:radius="4dp" /> <corners android:radius="4dp" />
<solid android:color="?attr/switch_button_active" /> <solid android:color="?attr/switch_button_active" />
</shape> </shape>

View file

@ -1,85 +1,85 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:background="?attr/card_and_list_background_basic" android:background="?attr/card_and_list_background_basic"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:osmand="http://schemas.android.com/apk/res-auto"> xmlns:osmand="http://schemas.android.com/apk/res-auto">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/action_bar_height" android:layout_height="@dimen/action_bar_height"
android:orientation="horizontal"> android:orientation="horizontal">
<FrameLayout <FrameLayout
android:id="@+id/btn_close" android:id="@+id/btn_close"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/card_padding" android:layout_marginStart="@dimen/card_padding"
android:layout_marginLeft="@dimen/card_padding" android:layout_marginLeft="@dimen/card_padding"
android:padding="@dimen/context_menu_padding_margin_small" android:padding="@dimen/context_menu_padding_margin_small"
android:paddingStart="@dimen/context_menu_padding_margin_small" android:paddingStart="@dimen/context_menu_padding_margin_small"
android:paddingEnd="@dimen/context_menu_padding_margin_small"> android:paddingEnd="@dimen/context_menu_padding_margin_small">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:layout_width="@dimen/favorites_icon_size_small" android:layout_width="@dimen/favorites_icon_size_small"
android:layout_height="@dimen/favorites_icon_size_small" android:layout_height="@dimen/favorites_icon_size_small"
android:tint="?attr/default_icon_color" android:tint="?attr/default_icon_color"
osmand:srcCompat="@drawable/ic_action_close" /> osmand:srcCompat="@drawable/ic_action_close" />
</FrameLayout> </FrameLayout>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/card_content_padding_large" android:layout_marginLeft="@dimen/card_content_padding_large"
android:layout_marginStart="@dimen/card_content_padding_large" android:layout_marginStart="@dimen/card_content_padding_large"
android:layout_weight="1" android:layout_weight="1"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:text="@string/context_menu_edit_descr" android:text="@string/context_menu_edit_descr"
android:textColor="?attr/searchbar_text" android:textColor="?attr/searchbar_text"
android:textSize="@dimen/dialog_header_text_size" android:textSize="@dimen/dialog_header_text_size"
osmand:typeface="@string/font_roboto_medium" /> osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/btn_save" android:id="@+id/btn_save"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/content_padding_half" android:layout_marginRight="@dimen/content_padding_half"
android:layout_marginEnd="@dimen/content_padding_half" android:layout_marginEnd="@dimen/content_padding_half"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="@drawable/btn_border_active" android:background="@drawable/btn_border_active"
android:paddingStart="@dimen/content_padding" android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding" android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half" android:paddingTop="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding" android:paddingRight="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding" android:paddingEnd="@dimen/content_padding"
android:paddingBottom="@dimen/content_padding_half" android:paddingBottom="@dimen/content_padding_half"
android:text="@string/shared_string_save" android:text="@string/shared_string_save"
android:textColor="?attr/active_color_basic" android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" /> osmand:typeface="@string/font_roboto_medium" />
</LinearLayout> </LinearLayout>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?attr/divider_color" /> android:background="?attr/divider_color" />
<net.osmand.plus.widgets.EditTextEx <net.osmand.plus.widgets.EditTextEx
android:id="@+id/description" android:id="@+id/description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding" android:layout_margin="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding" android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding" android:layout_marginRight="@dimen/content_padding"
android:background="?attr/card_and_list_background_basic" android:background="?attr/card_and_list_background_basic"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" 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." /> 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> </LinearLayout>

View file

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

View file

@ -17,93 +17,108 @@
</FrameLayout> </FrameLayout>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding" android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding" android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding_small" android:layout_marginTop="@dimen/content_padding_small"
android:layout_marginRight="@dimen/content_padding" android:layout_marginRight="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding" android:layout_marginEnd="@dimen/content_padding"
android:text="@string/shared_string_description" android:text="@string/shared_string_description"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" /> osmand:typeface="@string/font_roboto_medium" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/main_image" android:id="@+id/main_image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/content_padding_small" android:layout_marginTop="@dimen/content_padding_small"
android:visibility="gone" android:visibility="gone"
android:adjustViewBounds="true" android:adjustViewBounds="true"
tools:visibility="visible" tools:visibility="visible"
tools:src="@drawable/img_help_announcement_time_day"/> tools:src="@drawable/img_help_announcement_time_day"/>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/description" android:id="@+id/description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding" android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding" android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/context_menu_padding_margin_small" android:layout_marginTop="@dimen/context_menu_padding_margin_small"
android:layout_marginRight="@dimen/content_padding" android:layout_marginRight="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding" android:layout_marginEnd="@dimen/content_padding"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
android:lineSpacingMultiplier="1.1" android:lineSpacingMultiplier="1.1"
osmand:typeface="@string/font_roboto_regular" 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."/> 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 <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/context_menu_padding_margin_small" android:layout_marginTop="@dimen/context_menu_padding_margin_small"
android:layout_marginBottom="@dimen/context_menu_padding_margin_small" android:layout_marginBottom="@dimen/context_menu_padding_margin_small"
android:orientation="horizontal"> android:orientation="horizontal">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/btn_read_full" android:id="@+id/btn_read_full"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/context_menu_padding_margin_small" android:layout_marginStart="@dimen/context_menu_padding_margin_small"
android:layout_marginLeft="@dimen/context_menu_padding_margin_small" android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
android:layout_gravity="start" android:layout_gravity="start"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingStart="@dimen/bottom_sheet_content_padding_small" android:paddingStart="@dimen/bottom_sheet_content_padding_small"
android:paddingLeft="@dimen/bottom_sheet_content_padding_small" android:paddingLeft="@dimen/bottom_sheet_content_padding_small"
android:paddingTop="@dimen/bottom_sheet_content_padding_small" android:paddingTop="@dimen/bottom_sheet_content_padding_small"
android:paddingRight="@dimen/bottom_sheet_content_padding_small" android:paddingRight="@dimen/bottom_sheet_content_padding_small"
android:paddingEnd="@dimen/bottom_sheet_content_padding_small" android:paddingEnd="@dimen/bottom_sheet_content_padding_small"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small" android:paddingBottom="@dimen/bottom_sheet_content_padding_small"
android:drawablePadding="@dimen/bottom_sheet_content_padding_small" android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
osmand:drawableStartCompat="@drawable/ic_action_read_article" osmand:drawableStartCompat="@drawable/ic_action_read_article"
osmand:drawableLeftCompat="@drawable/ic_action_read_article" osmand:drawableLeftCompat="@drawable/ic_action_read_article"
osmand:drawableTint="?attr/wikivoyage_active_color" osmand:drawableTint="?attr/wikivoyage_active_color"
android:text="@string/context_menu_read_full" android:text="@string/context_menu_read_full"
android:textColor="?attr/wikivoyage_active_color" android:textColor="?attr/wikivoyage_active_color"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" /> osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/btn_edit" android:id="@+id/btn_edit"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/context_menu_padding_margin_small" android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:layout_marginEnd="@dimen/context_menu_padding_margin_small" android:layout_marginEnd="@dimen/context_menu_padding_margin_small"
android:layout_gravity="end" android:layout_gravity="end"
android:gravity="center_vertical" android:gravity="center_vertical"
android:padding="@dimen/bottom_sheet_content_padding_small" android:padding="@dimen/bottom_sheet_content_padding_small"
android:paddingStart="@dimen/bottom_sheet_content_padding_small" android:paddingStart="@dimen/bottom_sheet_content_padding_small"
android:paddingEnd="@dimen/bottom_sheet_content_padding_small" android:paddingEnd="@dimen/bottom_sheet_content_padding_small"
android:drawablePadding="@dimen/bottom_sheet_content_padding_small" android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
osmand:drawableRightCompat="@drawable/ic_action_edit_dark" osmand:drawableRightCompat="@drawable/ic_action_edit_dark"
osmand:drawableEndCompat="@drawable/ic_action_edit_dark" osmand:drawableEndCompat="@drawable/ic_action_edit_dark"
osmand:drawableTint="?attr/wikivoyage_active_color" osmand:drawableTint="?attr/wikivoyage_active_color"
android:text="@string/shared_string_edit" android:text="@string/shared_string_edit"
android:textColor="?attr/wikivoyage_active_color" android:textColor="?attr/wikivoyage_active_color"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" /> 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> </LinearLayout>

View file

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

View file

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

View file

@ -196,8 +196,4 @@ public class FileUtils {
public interface RenameCallback { public interface RenameCallback {
void renamedTo(File file); 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 { public class DescriptionCard extends BaseCard {
private final GPXFile gpxFile; private final GPXFile gpxFile;
public DescriptionCard(MapActivity mapActivity, GPXFile gpxFile) { public DescriptionCard(MapActivity mapActivity, GPXFile gpxFile) {
super(mapActivity); super(mapActivity);
this.gpxFile = gpxFile; this.gpxFile = gpxFile;
} }
@Override @Override
public int getCardLayoutId() { public int getCardLayoutId() {
return R.layout.gpx_description_preview_card; return R.layout.gpx_description_preview_card;
} }
@Override @Override
protected void updateContent() { protected void updateContent() {
final String title = gpxFile.metadata.getArticleTitle(); if (gpxFile == null || gpxFile.metadata == null || gpxFile.metadata.getDescription() == null) {
final String imageUrl = getMetadataImageLink(gpxFile.metadata); AndroidUiHelper.updateVisibility(view, false);
final String descriptionHtml = gpxFile.metadata.getDescription(); 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); setupImage(imageUrl);
tvDescription.setText(getFirstParagraph(descriptionHtml));
TextViewEx readBtn = view.findViewById(R.id.btn_read_full); TextViewEx tvDescription = view.findViewById(R.id.description);
readBtn.setOnClickListener(new View.OnClickListener() { tvDescription.setText(getFirstParagraph(descriptionHtml));
@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);
}
});
}
@Nullable TextViewEx readBtn = view.findViewById(R.id.btn_read_full);
private String getMetadataImageLink(@NonNull GPXUtilities.Metadata metadata) { readBtn.setOnClickListener(new View.OnClickListener() {
String link = metadata.link; @Override
if (!TextUtils.isEmpty(link)) { public void onClick(View v) {
String lowerCaseLink = link.toLowerCase(); GpxReadDescriptionDialogFragment.showInstance(mapActivity, title, imageUrl, descriptionHtml);
if (lowerCaseLink.contains(".jpg") }
|| lowerCaseLink.contains(".jpeg") });
|| lowerCaseLink.contains(".png") TextViewEx editBtn = view.findViewById(R.id.btn_edit);
|| lowerCaseLink.contains(".bmp") editBtn.setOnClickListener(new View.OnClickListener() {
|| lowerCaseLink.contains(".webp")) { @Override
return link; public void onClick(View v) {
} GpxEditDescriptionDialogFragment.showInstance(mapActivity, descriptionHtml);
} }
return null; });
} }
private String getFirstParagraph(String descriptionHtml) { @Nullable
if (descriptionHtml != null) { private String getMetadataImageLink(@NonNull GPXUtilities.Metadata metadata) {
String firstParagraph = WikiArticleHelper.getPartialContent(descriptionHtml); String link = metadata.link;
if (!TextUtils.isEmpty(firstParagraph)) { if (!TextUtils.isEmpty(link)) {
return firstParagraph; String lowerCaseLink = link.toLowerCase();
} if (lowerCaseLink.contains(".jpg")
} || lowerCaseLink.contains(".jpeg")
return descriptionHtml; || lowerCaseLink.contains(".png")
} || lowerCaseLink.contains(".bmp")
|| lowerCaseLink.contains(".webp")) {
return link;
}
}
return null;
}
private void setupImage(final String imageUrl) { private String getFirstParagraph(String descriptionHtml) {
if (imageUrl == null) { if (descriptionHtml != null) {
return; String firstParagraph = WikiArticleHelper.getPartialContent(descriptionHtml);
} if (!TextUtils.isEmpty(firstParagraph)) {
final PicassoUtils picasso = PicassoUtils.getPicasso(app); return firstParagraph;
RequestCreator rc = Picasso.get().load(imageUrl); }
final AppCompatImageView image = view.findViewById(R.id.main_image); }
rc.into(image, new Callback() { return descriptionHtml;
@Override }
public void onSuccess() {
picasso.setResultLoaded(imageUrl, true);
AndroidUiHelper.updateVisibility(image, true);
}
@Override private void setupImage(final String imageUrl) {
public void onError(Exception e) { if (imageUrl == null) {
picasso.setResultLoaded(imageUrl, false); 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); log.error(errorMessage);
} }
trackMenuFragment.onGpxChanged(); trackMenuFragment.updateContent();
if (readGpxFragment != null) { if (readGpxFragment != null) {
Bundle args = readGpxFragment.getArguments(); Bundle args = readGpxFragment.getArguments();
if (args != null) { if (args != null) {

View file

@ -13,6 +13,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.squareup.picasso.Callback; import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso; import com.squareup.picasso.Picasso;
@ -25,6 +26,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.base.BaseOsmAndDialogFragment; import net.osmand.plus.base.BaseOsmAndDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.widgets.TextViewEx;
import net.osmand.plus.widgets.WebViewEx; import net.osmand.plus.widgets.WebViewEx;
import net.osmand.plus.wikivoyage.WikivoyageUtils; import net.osmand.plus.wikivoyage.WikivoyageUtils;
@ -59,13 +61,6 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
setupImage(view); setupImage(view);
setupWebView(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; 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 = view.findViewById(R.id.content);
webView.setScrollbarFadingEnabled(true); webView.setScrollbarFadingEnabled(true);
webView.setVerticalScrollBarEnabled(false); webView.setVerticalScrollBarEnabled(false);
@ -163,6 +158,13 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
webView.getSettings().setDomStorageEnabled(true); webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH); 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(); 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) { private String getColoredContent(String content) {
return "<body style=\"color:white;\">\n" + return "<body style=\"color:white;\">\n" +
content + content +

View file

@ -20,7 +20,6 @@ import com.google.android.material.bottomnavigation.BottomNavigationView;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.FileUtils; import net.osmand.FileUtils;
import net.osmand.FileUtils.GpxEditedCallback;
import net.osmand.FileUtils.RenameCallback; import net.osmand.FileUtils.RenameCallback;
import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.Track; 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; import static net.osmand.plus.track.OptionsCard.UPLOAD_OSM_BUTTON_INDEX;
public class TrackMenuFragment extends ContextMenuScrollFragment implements CardListener, public class TrackMenuFragment extends ContextMenuScrollFragment implements CardListener,
SegmentActionsListener, RenameCallback, OnTrackFileMoveListener, GpxEditedCallback { SegmentActionsListener, RenameCallback, OnTrackFileMoveListener {
public static final String TAG = TrackMenuFragment.class.getName(); public static final String TAG = TrackMenuFragment.class.getName();
private static final Log log = PlatformUtil.getLog(TrackMenuFragment.class); private static final Log log = PlatformUtil.getLog(TrackMenuFragment.class);
@ -222,10 +221,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
} }
private void updateHeader() { private void updateHeader() {
ViewGroup headerContainer = (ViewGroup) routeMenuTopShadowAll;
if (descriptionCard != null && descriptionCard.getView() != null) {
headerContainer.removeView(descriptionCard.getView());
}
if (menuType == TrackMenuType.OPTIONS) { if (menuType == TrackMenuType.OPTIONS) {
headerTitle.setText(menuType.titleId); headerTitle.setText(menuType.titleId);
AndroidUiHelper.updateVisibility(headerIcon, false); AndroidUiHelper.updateVisibility(headerIcon, false);
@ -233,17 +228,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
String fileName = Algorithms.getFileWithoutDirs(getGpx().path); String fileName = Algorithms.getFileWithoutDirs(getGpx().path);
headerTitle.setText(GpxUiHelper.getGpxTitle(fileName)); headerTitle.setText(GpxUiHelper.getGpxTitle(fileName));
AndroidUiHelper.updateVisibility(headerIcon, true); 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() { private void setupCards() {
@ -275,23 +260,21 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
optionsCard.setListener(this); optionsCard.setListener(this);
cardsContainer.addView(optionsCard.build(mapActivity)); 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 @Override
protected void calculateLayout(View view, boolean initLayout) { protected void calculateLayout(View view, boolean initLayout) {
menuTitleHeight = routeMenuTopShadowAll.getHeight() menuTitleHeight = routeMenuTopShadowAll.getHeight()
@ -623,6 +606,9 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
if (optionsCard != null) { if (optionsCard != null) {
optionsCard.updateContent(); optionsCard.updateContent();
} }
if (descriptionCard != null) {
descriptionCard.updateContent();
}
setupCards(); 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) { public static boolean showInstance(@NonNull MapActivity mapActivity, String path, boolean showCurrentTrack) {
try { try {
Bundle args = new Bundle(); Bundle args = new Bundle();