Fix UI
This commit is contained in:
parent
eb3ecabf53
commit
8af6416366
9 changed files with 219 additions and 126 deletions
13
OsmAnd/res/drawable/btn_unstroked.xml
Normal file
13
OsmAnd/res/drawable/btn_unstroked.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:state_pressed="true"><shape android:shape="rectangle">
|
||||||
|
<solid android:color="?attr/active_buttons_and_links_bg_pressed" />
|
||||||
|
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||||
|
</shape></item>
|
||||||
|
<item><shape android:shape="rectangle">
|
||||||
|
<solid android:color="@null" />
|
||||||
|
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||||
|
</shape></item>
|
||||||
|
|
||||||
|
</selector>
|
|
@ -21,11 +21,13 @@
|
||||||
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"
|
||||||
|
android:background="@null">
|
||||||
|
|
||||||
<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:background="?attr/selectableItemBackgroundBorderless"
|
||||||
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>
|
||||||
|
@ -43,18 +45,20 @@
|
||||||
osmand:typeface="@string/font_roboto_medium" />
|
osmand:typeface="@string/font_roboto_medium" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
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">
|
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
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:background="?attr/selectableItemBackground"
|
android:layout_gravity="start"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:duplicateParentState="true"
|
||||||
|
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"
|
||||||
|
@ -77,18 +81,18 @@
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="@dimen/content_padding"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding"
|
||||||
|
android:layout_marginTop="@dimen/content_padding_half"
|
||||||
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
|
android:layout_marginEnd="@dimen/content_padding"
|
||||||
|
android:layout_marginBottom="@dimen/content_padding_half">
|
||||||
|
|
||||||
<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_marginStart="@dimen/content_padding"
|
|
||||||
android:layout_marginLeft="@dimen/content_padding"
|
|
||||||
android:layout_marginTop="@dimen/content_padding_half"
|
|
||||||
android:layout_marginRight="@dimen/content_padding"
|
|
||||||
android:layout_marginEnd="@dimen/content_padding"
|
|
||||||
android:layout_marginBottom="@dimen/content_padding_half"
|
|
||||||
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"
|
||||||
|
|
|
@ -1,31 +1,79 @@
|
||||||
<?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: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:id="@+id/root"
|
android:id="@+id/root"
|
||||||
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/list_background_color">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/action_bar_height"
|
||||||
android:background="?attr/pstsTabBackground">
|
android:background="?attr/pstsTabBackground"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<FrameLayout
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar_back"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="@dimen/action_bar_height"
|
android:layout_height="wrap_content"
|
||||||
app:titleTextColor="?attr/list_background_color" />
|
android:layout_marginStart="@dimen/content_padding_small"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding_small"
|
||||||
|
android:background="@null"
|
||||||
|
android:padding="@dimen/content_padding_half"
|
||||||
|
android:paddingStart="@dimen/content_padding_half"
|
||||||
|
android:paddingEnd="@dimen/content_padding_half">
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:layout_width="@dimen/standard_icon_size"
|
||||||
|
android:layout_height="@dimen/standard_icon_size"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
osmand:srcCompat="@drawable/ic_arrow_back"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/toolbar_title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dialog_button_height"
|
||||||
|
android:layout_marginLeft="@dimen/dialog_button_height"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:textColor="@color/list_background_color_light"
|
||||||
|
android:textSize="@dimen/dialog_header_text_size"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
|
tools:text="Amsterdam" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/toolbar_edit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/content_padding_small"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding_small"
|
||||||
|
android:layout_marginRight="@dimen/content_padding_small"
|
||||||
|
android:layout_marginEnd="@dimen/content_padding_small"
|
||||||
|
android:background="@null"
|
||||||
|
android:padding="@dimen/content_padding_half"
|
||||||
|
android:paddingStart="@dimen/content_padding_half"
|
||||||
|
android:paddingEnd="@dimen/content_padding_half">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:layout_width="@dimen/standard_icon_size"
|
||||||
|
android:layout_height="@dimen/standard_icon_size"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
osmand:srcCompat="@drawable/ic_action_edit_dark"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/activity_background_basic">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll"
|
android:id="@+id/ll"
|
||||||
|
@ -61,33 +109,32 @@
|
||||||
tools:visibility="visible"/>
|
tools:visibility="visible"/>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
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:background="@drawable/rounded_background_3dp">
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
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:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:duplicateParentState="true"
|
||||||
android:padding="@dimen/context_menu_padding_margin_small"
|
android:padding="@dimen/bottom_sheet_content_padding_small"
|
||||||
android:paddingStart="@dimen/context_menu_padding_margin_small"
|
android:paddingStart="@dimen/bottom_sheet_content_padding_small"
|
||||||
android:paddingEnd="@dimen/context_menu_padding_margin_small"
|
android:paddingEnd="@dimen/bottom_sheet_content_padding_small"
|
||||||
android:drawablePadding="@dimen/list_content_padding_large"
|
android:drawablePadding="@dimen/list_content_padding_large"
|
||||||
osmand:drawableLeftCompat="@drawable/ic_action_edit_dark"
|
|
||||||
osmand:drawableStartCompat="@drawable/ic_action_edit_dark"
|
osmand:drawableStartCompat="@drawable/ic_action_edit_dark"
|
||||||
|
osmand:drawableLeftCompat="@drawable/ic_action_edit_dark"
|
||||||
osmand:drawableTint="?attr/active_color_basic"
|
osmand:drawableTint="?attr/active_color_basic"
|
||||||
android:visibility="gone"
|
|
||||||
android:text="@string/shared_string_edit"
|
android:text="@string/shared_string_edit"
|
||||||
android:textColor="?attr/active_color_basic"
|
android:textColor="?attr/active_color_basic"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
android:textSize="@dimen/default_list_text_size"
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
osmand:typeface="@string/font_roboto_medium" />
|
||||||
tools:visibility="visible" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
|
@ -68,19 +68,18 @@
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
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/content_padding_half"
|
||||||
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
|
android:layout_marginLeft="@dimen/content_padding_half">
|
||||||
android:background="@drawable/rounded_background_3dp">
|
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
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_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:duplicateParentState="true"
|
||||||
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"
|
||||||
|
@ -96,19 +95,19 @@
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
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/content_padding_half"
|
||||||
android:layout_marginEnd="@dimen/context_menu_padding_margin_small"
|
android:layout_marginEnd="@dimen/content_padding_half"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end">
|
||||||
android:background="@drawable/rounded_background_3dp">
|
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
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_gravity="start"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:duplicateParentState="true"
|
||||||
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"
|
||||||
|
@ -134,7 +133,6 @@
|
||||||
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:layout_marginTop="@dimen/content_padding"
|
android:layout_marginTop="@dimen/content_padding"
|
||||||
android:background="@drawable/rounded_background_3dp"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
@ -142,7 +140,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:duplicateParentState="true"
|
||||||
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"
|
||||||
|
|
|
@ -142,6 +142,7 @@
|
||||||
<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" />
|
||||||
|
<attr name="active_buttons_and_links_bg_pressed" format="reference" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="PagerSlidingTabStrip">
|
<declare-styleable name="PagerSlidingTabStrip">
|
||||||
|
|
|
@ -249,6 +249,7 @@
|
||||||
<item name="text_input_background">@color/text_input_background_light</item>
|
<item name="text_input_background">@color/text_input_background_light</item>
|
||||||
<item name="image_help_announcement_time">@drawable/img_help_announcement_time_day</item>
|
<item name="image_help_announcement_time">@drawable/img_help_announcement_time_day</item>
|
||||||
<item name="switch_button_active">@color/switch_button_active_light</item>
|
<item name="switch_button_active">@color/switch_button_active_light</item>
|
||||||
|
<item name="active_buttons_and_links_bg_pressed">@color/active_buttons_and_links_bg_pressed_light</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ToolbarStyle" parent="@style/Widget.AppCompat.Toolbar">
|
<style name="ToolbarStyle" parent="@style/Widget.AppCompat.Toolbar">
|
||||||
|
@ -547,6 +548,7 @@
|
||||||
<item name="text_input_background">@color/text_input_background_dark</item>
|
<item name="text_input_background">@color/text_input_background_dark</item>
|
||||||
<item name="image_help_announcement_time">@drawable/img_help_announcement_time_night</item>
|
<item name="image_help_announcement_time">@drawable/img_help_announcement_time_night</item>
|
||||||
<item name="switch_button_active">@color/switch_button_active_dark</item>
|
<item name="switch_button_active">@color/switch_button_active_dark</item>
|
||||||
|
<item name="active_buttons_and_links_bg_pressed">@color/active_buttons_and_links_bg_pressed_dark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="FreeVersionBanner" parent="OsmandDarkTheme">
|
<style name="FreeVersionBanner" parent="OsmandDarkTheme">
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package net.osmand.plus.track;
|
package net.osmand.plus.track;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -8,6 +10,7 @@ import com.squareup.picasso.Callback;
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
import com.squareup.picasso.RequestCreator;
|
import com.squareup.picasso.RequestCreator;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.GPXUtilities;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.PicassoUtils;
|
import net.osmand.PicassoUtils;
|
||||||
|
@ -21,6 +24,7 @@ import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.AppCompatImageView;
|
import androidx.appcompat.widget.AppCompatImageView;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.getMetadataImageLink;
|
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.getMetadataImageLink;
|
||||||
|
|
||||||
|
@ -59,8 +63,9 @@ public class DescriptionCard extends BaseCard {
|
||||||
|
|
||||||
private void showAddBtn() {
|
private void showAddBtn() {
|
||||||
LinearLayout descriptionContainer = view.findViewById(R.id.description_container);
|
LinearLayout descriptionContainer = view.findViewById(R.id.description_container);
|
||||||
FrameLayout addBtn = view.findViewById(R.id.btn_add);
|
View addBtn = view.findViewById(R.id.btn_add);
|
||||||
|
|
||||||
|
setupButton(addBtn);
|
||||||
addBtn.setOnClickListener(new View.OnClickListener() {
|
addBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -81,7 +86,8 @@ public class DescriptionCard extends BaseCard {
|
||||||
TextViewEx tvDescription = view.findViewById(R.id.description);
|
TextViewEx tvDescription = view.findViewById(R.id.description);
|
||||||
tvDescription.setText(getFirstParagraph(descriptionHtml));
|
tvDescription.setText(getFirstParagraph(descriptionHtml));
|
||||||
|
|
||||||
TextViewEx readBtn = view.findViewById(R.id.btn_read_full);
|
View readBtn = view.findViewById(R.id.btn_read_full);
|
||||||
|
setupButton(readBtn);
|
||||||
readBtn.setOnClickListener(new View.OnClickListener() {
|
readBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -89,7 +95,8 @@ public class DescriptionCard extends BaseCard {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
TextViewEx editBtn = view.findViewById(R.id.btn_edit);
|
View editBtn = view.findViewById(R.id.btn_edit);
|
||||||
|
setupButton(editBtn);
|
||||||
editBtn.setOnClickListener(new View.OnClickListener() {
|
editBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -108,6 +115,15 @@ public class DescriptionCard extends BaseCard {
|
||||||
return descriptionHtml;
|
return descriptionHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupButton(View button) {
|
||||||
|
Context ctx = button.getContext();
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
AndroidUtils.setBackground(ctx, button, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||||
|
} else {
|
||||||
|
AndroidUtils.setBackground(button, ContextCompat.getDrawable(ctx, R.drawable.btn_unstroked));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setupImage(final String imageUrl) {
|
private void setupImage(final String imageUrl) {
|
||||||
if (imageUrl == null) {
|
if (imageUrl == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
package net.osmand.plus.track;
|
package net.osmand.plus.track;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -26,6 +31,7 @@ import java.io.File;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
@ -63,7 +69,50 @@ public class GpxEditDescriptionDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
view.findViewById(R.id.btn_save).setOnClickListener(new View.OnClickListener() {
|
setupSaveButton(view);
|
||||||
|
|
||||||
|
Bundle args = getArguments();
|
||||||
|
if (args != null) {
|
||||||
|
htmlCode = args.getString(CONTENT_KEY);
|
||||||
|
if (htmlCode != null) {
|
||||||
|
editableHtml.append(htmlCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
|
Activity ctx = getActivity();
|
||||||
|
int themeId = isNightMode(true) ? R.style.OsmandDarkTheme_DarkActionbar : R.style.OsmandLightTheme_DarkActionbar_LightStatusBar;
|
||||||
|
Dialog dialog = new Dialog(ctx, themeId);
|
||||||
|
Window window = dialog.getWindow();
|
||||||
|
if (window != null) {
|
||||||
|
if (!getSettings().DO_NOT_USE_ANIMATIONS.get()) {
|
||||||
|
window.getAttributes().windowAnimations = R.style.Animations_Alpha;
|
||||||
|
}
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
int statusBarColor = isNightMode(true) ? R.color.activity_background_color_dark : R.color.activity_background_color_light;
|
||||||
|
window.setStatusBarColor(ContextCompat.getColor(ctx, statusBarColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean shouldClose() {
|
||||||
|
Editable editable = editableHtml.getText();
|
||||||
|
if (htmlCode == null || editable == null || editable.toString() == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return htmlCode.equals(editable.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupSaveButton(View view) {
|
||||||
|
View btnSave = view.findViewById(R.id.btn_save);
|
||||||
|
|
||||||
|
btnSave.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Editable editable = editableHtml.getText();
|
Editable editable = editableHtml.getText();
|
||||||
|
@ -73,23 +122,12 @@ public class GpxEditDescriptionDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Bundle args = getArguments();
|
Context ctx = btnSave.getContext();
|
||||||
if (args != null) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
htmlCode = args.getString(CONTENT_KEY);
|
AndroidUtils.setBackground(ctx, btnSave, isNightMode(true), R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||||
if (htmlCode != null) {
|
} else {
|
||||||
editableHtml.setText(htmlCode);
|
AndroidUtils.setBackground(btnSave, ContextCompat.getDrawable(ctx, R.drawable.btn_unstroked));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean shouldClose() {
|
|
||||||
Editable editable = editableHtml.getText();
|
|
||||||
if (htmlCode == null || editable == null || editable.toString() == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return htmlCode.equals(editable.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDismissDialog() {
|
private void showDismissDialog() {
|
||||||
|
|
|
@ -2,19 +2,16 @@ package net.osmand.plus.track;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuInflater;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
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 android.webkit.WebViewClient;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.squareup.picasso.Callback;
|
import com.squareup.picasso.Callback;
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
@ -27,7 +24,6 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
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;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -35,7 +31,6 @@ import net.osmand.util.Algorithms;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.AppCompatImageView;
|
import androidx.appcompat.widget.AppCompatImageView;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
@ -47,7 +42,6 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
private static final String TITLE_KEY = "title_key";
|
private static final String TITLE_KEY = "title_key";
|
||||||
private static final String IMAGE_URL_KEY = "image_url_key";
|
private static final String IMAGE_URL_KEY = "image_url_key";
|
||||||
private static final String CONTENT_KEY = "content_key";
|
private static final String CONTENT_KEY = "content_key";
|
||||||
private static final int EDIT_ID = 1;
|
|
||||||
|
|
||||||
private WebViewEx webView;
|
private WebViewEx webView;
|
||||||
|
|
||||||
|
@ -93,34 +87,6 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
loadWebviewData();
|
loadWebviewData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
|
||||||
if (item.getItemId() == EDIT_ID) {
|
|
||||||
FragmentActivity activity = getActivity();
|
|
||||||
if (activity != null) {
|
|
||||||
GpxEditDescriptionDialogFragment.showInstance(activity, contentHtml, this);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
|
||||||
menu.clear();
|
|
||||||
OsmandApplication app = getMyApplication();
|
|
||||||
int color = AndroidUtils.resolveAttribute(app, R.attr.pstsTextColor);
|
|
||||||
MenuItem menuItem = menu.add(0, EDIT_ID, 0, app.getString(R.string.shared_string_edit));
|
|
||||||
menuItem.setIcon(getIcon(R.drawable.ic_action_edit_dark, color));
|
|
||||||
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
|
||||||
return onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
|
@ -130,29 +96,29 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupToolbar(View view) {
|
private void setupToolbar(View view) {
|
||||||
Toolbar toolbar = view.findViewById(R.id.toolbar);
|
View back = view.findViewById(R.id.toolbar_back);
|
||||||
getMyActivity().setSupportActionBar(toolbar);
|
back.setOnClickListener(new View.OnClickListener() {
|
||||||
setHasOptionsMenu(true);
|
|
||||||
toolbar.setClickable(true);
|
|
||||||
|
|
||||||
Context ctx = getMyActivity();
|
|
||||||
int iconColor = AndroidUtils.resolveAttribute(ctx, R.attr.pstsTextColor);
|
|
||||||
Drawable icBack = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back, iconColor);
|
|
||||||
toolbar.setNavigationIcon(icBack);
|
|
||||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
|
||||||
|
|
||||||
if (!Algorithms.isEmpty(title)) {
|
|
||||||
toolbar.setTitle(title);
|
|
||||||
int titleColor = AndroidUtils.resolveAttribute(ctx, R.attr.pstsTextColor);
|
|
||||||
toolbar.setTitleTextColor(ContextCompat.getColor(ctx, titleColor));
|
|
||||||
}
|
|
||||||
|
|
||||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final View v) {
|
public void onClick(View v) {
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
View edit = view.findViewById(R.id.toolbar_edit);
|
||||||
|
edit.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
FragmentActivity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
GpxEditDescriptionDialogFragment.showInstance(activity, contentHtml, GpxReadDescriptionDialogFragment.this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
TextView toolbarTitle = view.findViewById(R.id.toolbar_title);
|
||||||
|
if (!Algorithms.isEmpty(title)) {
|
||||||
|
toolbarTitle.setText(title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupImage(View view) {
|
private void setupImage(View view) {
|
||||||
|
@ -214,15 +180,23 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
private void loadWebviewData() {
|
private void loadWebviewData() {
|
||||||
String content = contentHtml;
|
String content = contentHtml;
|
||||||
if (content != null) {
|
if (content != null) {
|
||||||
content = isNightMode(false) ? getColoredContent(content) : content;
|
content = isNightMode(true) ? getColoredContent(content) : content;
|
||||||
String encoded = Base64.encodeToString(content.getBytes(), Base64.NO_PADDING);
|
String encoded = Base64.encodeToString(content.getBytes(), Base64.NO_PADDING);
|
||||||
webView.loadData(encoded, "text/html", "base64");
|
webView.loadData(encoded, "text/html", "base64");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDependentViews(final View view) {
|
private void setupDependentViews(final View view) {
|
||||||
TextViewEx readBtn = view.findViewById(R.id.btn_edit);
|
View editBtn = view.findViewById(R.id.btn_edit);
|
||||||
readBtn.setOnClickListener(new View.OnClickListener() {
|
|
||||||
|
Context ctx = editBtn.getContext();
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
AndroidUtils.setBackground(ctx, editBtn, isNightMode(true), R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||||
|
} else {
|
||||||
|
AndroidUtils.setBackground(editBtn, ContextCompat.getDrawable(ctx, R.drawable.btn_unstroked));
|
||||||
|
}
|
||||||
|
|
||||||
|
editBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
FragmentActivity activity = getActivity();
|
FragmentActivity activity = getActivity();
|
||||||
|
@ -232,7 +206,7 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AndroidUiHelper.setVisibility(View.VISIBLE,
|
AndroidUiHelper.setVisibility(View.VISIBLE,
|
||||||
readBtn, view.findViewById(R.id.divider), view.findViewById(R.id.bottom_empty_space));
|
editBtn, view.findViewById(R.id.divider), view.findViewById(R.id.bottom_empty_space));
|
||||||
int backgroundColor = isNightMode(false) ?
|
int backgroundColor = isNightMode(false) ?
|
||||||
R.color.activity_background_color_dark : R.color.activity_background_color_light;
|
R.color.activity_background_color_dark : R.color.activity_background_color_light;
|
||||||
view.findViewById(R.id.root).setBackgroundResource(backgroundColor);
|
view.findViewById(R.id.root).setBackgroundResource(backgroundColor);
|
||||||
|
|
Loading…
Reference in a new issue