Merge pull request #4725 from osmandapp/markers_empty_states

Markers empty states
This commit is contained in:
Alexey 2017-11-10 13:47:03 +03:00 committed by GitHub
commit 35d91360f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 1143 additions and 84 deletions

View file

@ -8,23 +8,23 @@
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:layout_marginTop="@dimen/my_places_empty_state_image_margin_top" android:layout_marginTop="@dimen/empty_state_image_margin_top"
android:layout_marginBottom="@dimen/my_places_empty_state_image_margin_bottom" android:layout_marginBottom="@dimen/empty_state_image_margin_bottom"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_marginLeft="@dimen/my_places_empty_state_image_margin_left" android:layout_marginLeft="@dimen/empty_state_image_margin_left"
android:layout_marginStart="@dimen/my_places_empty_state_image_margin_left" android:layout_marginStart="@dimen/empty_state_image_margin_left"
android:id="@+id/empty_state_image_view" android:id="@+id/empty_state_image_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:src="@drawable/ic_empty_state_favorites_night_result"/> tools:src="@drawable/ic_empty_state_favorites_night"/>
<LinearLayout <LinearLayout
android:clipToPadding="false" android:clipToPadding="false"
android:paddingLeft="@dimen/my_places_empty_state_text_button_padding_left" android:paddingLeft="@dimen/empty_state_text_button_padding_left"
android:paddingStart="@dimen/my_places_empty_state_text_button_padding_left" android:paddingStart="@dimen/empty_state_text_button_padding_left"
android:paddingRight="@dimen/my_places_empty_state_text_button_padding_right" android:paddingRight="@dimen/empty_state_text_button_padding_right"
android:paddingEnd="@dimen/my_places_empty_state_text_button_padding_right" android:paddingEnd="@dimen/empty_state_text_button_padding_right"
android:paddingTop="@dimen/my_places_empty_state_text_button_padding_top" android:paddingTop="@dimen/empty_state_text_button_padding_top"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
@ -32,11 +32,11 @@
<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_marginBottom="@dimen/my_places_empty_state_text_interval" android:layout_marginBottom="@dimen/empty_state_text_interval"
android:background="@null" android:background="@null"
android:text="@string/empty_state_favourites" android:text="@string/empty_state_favourites"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/my_places_empty_state_text_size" android:textSize="@dimen/empty_state_text_size"
osmand:typeface="@string/font_roboto_medium"/> osmand:typeface="@string/font_roboto_medium"/>
<TextView <TextView
@ -45,12 +45,12 @@
android:background="@null" android:background="@null"
android:text="@string/empty_state_favourites_desc" android:text="@string/empty_state_favourites_desc"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/my_places_empty_state_text_desc_size"/> android:textSize="@dimen/empty_state_text_desc_size"/>
<Button <Button
android:id="@+id/import_button" android:id="@+id/import_button"
style="@style/DialogActionButton" style="@style/DialogActionButton"
android:layout_marginTop="@dimen/my_places_empty_state_button_margin_top" android:layout_marginTop="@dimen/empty_state_button_margin_top"
android:text="@string/shared_string_import"/> android:text="@string/shared_string_import"/>
</LinearLayout> </LinearLayout>

View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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="horizontal">
<ImageView
android:layout_marginTop="@dimen/empty_state_image_margin_top"
android:layout_marginBottom="@dimen/empty_state_image_margin_bottom"
android:adjustViewBounds="true"
android:layout_marginLeft="@dimen/empty_state_image_margin_left"
android:layout_marginStart="@dimen/empty_state_image_margin_left"
android:id="@+id/empty_state_image_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
tools:src="@drawable/ic_empty_state_marker_list_night"/>
<LinearLayout
android:clipToPadding="false"
android:paddingLeft="@dimen/empty_state_text_button_padding_left"
android:paddingStart="@dimen/empty_state_text_button_padding_left"
android:paddingRight="@dimen/empty_state_text_button_padding_right"
android:paddingEnd="@dimen/empty_state_text_button_padding_right"
android:paddingTop="@dimen/empty_state_text_button_padding_top"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/empty_state_text_interval"
android:background="@null"
android:text="@string/empty_state_markers_active"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/empty_state_text_size"
osmand:typeface="@string/font_roboto_medium"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:text="@string/empty_state_markers_active_desc"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/empty_state_text_desc_size"/>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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="horizontal">
<ImageView
android:layout_marginTop="@dimen/empty_state_image_margin_top"
android:layout_marginBottom="@dimen/empty_state_image_margin_bottom"
android:adjustViewBounds="true"
android:layout_marginLeft="@dimen/empty_state_image_margin_left"
android:layout_marginStart="@dimen/empty_state_image_margin_left"
android:id="@+id/empty_state_image_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
tools:src="@drawable/ic_empty_state_marker_group_night"/>
<LinearLayout
android:clipToPadding="false"
android:paddingLeft="@dimen/empty_state_text_button_padding_left"
android:paddingStart="@dimen/empty_state_text_button_padding_left"
android:paddingRight="@dimen/empty_state_text_button_padding_right"
android:paddingEnd="@dimen/empty_state_text_button_padding_right"
android:paddingTop="@dimen/empty_state_text_button_padding_top"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/empty_state_text_interval"
android:background="@null"
android:text="@string/empty_state_markers_groups"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/empty_state_text_size"
osmand:typeface="@string/font_roboto_medium"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:text="@string/empty_state_markers_groups_desc"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/empty_state_text_desc_size"/>
<Button
android:id="@+id/import_button"
style="@style/DialogActionButton"
android:layout_marginTop="@dimen/empty_state_button_margin_top"
android:text="@string/shared_string_import"/>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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="horizontal">
<ImageView
android:layout_marginTop="@dimen/empty_state_image_margin_top"
android:layout_marginBottom="@dimen/empty_state_image_margin_bottom"
android:adjustViewBounds="true"
android:layout_marginLeft="@dimen/empty_state_image_margin_left"
android:layout_marginStart="@dimen/empty_state_image_margin_left"
android:id="@+id/empty_state_image_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
tools:src="@drawable/ic_empty_state_marker_history_night"/>
<LinearLayout
android:clipToPadding="false"
android:paddingLeft="@dimen/empty_state_text_button_padding_left"
android:paddingStart="@dimen/empty_state_text_button_padding_left"
android:paddingRight="@dimen/empty_state_text_button_padding_right"
android:paddingEnd="@dimen/empty_state_text_button_padding_right"
android:paddingTop="@dimen/empty_state_text_button_padding_top"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/empty_state_text_interval"
android:background="@null"
android:text="@string/empty_state_markers_history"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/empty_state_text_size"
osmand:typeface="@string/font_roboto_medium"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:text="@string/empty_state_markers_history_desc"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/empty_state_text_desc_size"/>
</LinearLayout>
</LinearLayout>

View file

@ -8,23 +8,23 @@
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:layout_marginTop="@dimen/my_places_empty_state_image_margin_top" android:layout_marginTop="@dimen/empty_state_image_margin_top"
android:layout_marginBottom="@dimen/my_places_empty_state_image_margin_bottom" android:layout_marginBottom="@dimen/empty_state_image_margin_bottom"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_marginLeft="@dimen/my_places_empty_state_image_margin_left" android:layout_marginLeft="@dimen/empty_state_image_margin_left"
android:layout_marginStart="@dimen/my_places_empty_state_image_margin_left" android:layout_marginStart="@dimen/empty_state_image_margin_left"
android:id="@+id/empty_state_image_view" android:id="@+id/empty_state_image_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:src="@drawable/ic_empty_state_trip_night_result"/> tools:src="@drawable/ic_empty_state_trip_night"/>
<LinearLayout <LinearLayout
android:clipToPadding="false" android:clipToPadding="false"
android:paddingLeft="@dimen/my_places_empty_state_text_button_padding_left" android:paddingLeft="@dimen/empty_state_text_button_padding_left"
android:paddingStart="@dimen/my_places_empty_state_text_button_padding_left" android:paddingStart="@dimen/empty_state_text_button_padding_left"
android:paddingRight="@dimen/my_places_empty_state_text_button_padding_right" android:paddingRight="@dimen/empty_state_text_button_padding_right"
android:paddingEnd="@dimen/my_places_empty_state_text_button_padding_right" android:paddingEnd="@dimen/empty_state_text_button_padding_right"
android:paddingTop="@dimen/my_places_empty_state_text_button_padding_top" android:paddingTop="@dimen/empty_state_text_button_padding_top"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
@ -32,11 +32,11 @@
<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_marginBottom="@dimen/my_places_empty_state_text_interval" android:layout_marginBottom="@dimen/empty_state_text_interval"
android:background="@null" android:background="@null"
android:text="@string/empty_state_my_tracks" android:text="@string/empty_state_my_tracks"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/my_places_empty_state_text_size" android:textSize="@dimen/empty_state_text_size"
osmand:typeface="@string/font_roboto_medium"/> osmand:typeface="@string/font_roboto_medium"/>
<TextView <TextView
@ -45,12 +45,12 @@
android:background="@null" android:background="@null"
android:text="@string/empty_state_my_tracks_desc" android:text="@string/empty_state_my_tracks_desc"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/my_places_empty_state_text_desc_size"/> android:textSize="@dimen/empty_state_text_desc_size"/>
<Button <Button
android:id="@+id/import_button" android:id="@+id/import_button"
style="@style/DialogActionButton" style="@style/DialogActionButton"
android:layout_marginTop="@dimen/my_places_empty_state_button_margin_top" android:layout_marginTop="@dimen/empty_state_button_margin_top"
android:text="@string/shared_string_import"/> android:text="@string/shared_string_import"/>
</LinearLayout> </LinearLayout>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
tools:text="@string/gpx_track"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_descr_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
tools:text="@string/add_track_to_markers_descr"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>

View file

@ -12,35 +12,35 @@
android:id="@+id/empty_state_image_view" android:id="@+id/empty_state_image_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/my_places_empty_state_image_margin_bottom" android:layout_marginBottom="@dimen/empty_state_image_margin_bottom"
android:layout_marginTop="@dimen/my_places_empty_state_image_margin_top" android:layout_marginTop="@dimen/empty_state_image_margin_top"
tools:src="@drawable/ic_empty_state_favorites_night_result"/> tools:src="@drawable/ic_empty_state_favorites_night"/>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/my_places_empty_state_text_interval" android:layout_marginBottom="@dimen/empty_state_text_interval"
android:background="@null" android:background="@null"
android:text="@string/empty_state_favourites" android:text="@string/empty_state_favourites"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/my_places_empty_state_text_size"/> android:textSize="@dimen/empty_state_text_size"/>
<TextView <TextView
android:gravity="center" android:gravity="center"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@null" android:background="@null"
android:layout_marginLeft="@dimen/my_places_empty_state_text_desc_margin" android:layout_marginLeft="@dimen/empty_state_text_desc_margin"
android:layout_marginRight="@dimen/my_places_empty_state_text_desc_margin" android:layout_marginRight="@dimen/empty_state_text_desc_margin"
android:text="@string/empty_state_favourites_desc" android:text="@string/empty_state_favourites_desc"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/my_places_empty_state_text_desc_size"/> android:textSize="@dimen/empty_state_text_desc_size"/>
<Button <Button
android:id="@+id/import_button" android:id="@+id/import_button"
style="@style/DialogActionButton" style="@style/DialogActionButton"
android:layout_marginTop="@dimen/my_places_empty_state_button_margin_top" android:layout_marginTop="@dimen/empty_state_button_margin_top"
android:text="@string/shared_string_import"/> android:text="@string/shared_string_import"/>
</LinearLayout> </LinearLayout>

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/empty_state_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/empty_state_image_margin_bottom"
android:layout_marginTop="@dimen/empty_state_image_margin_top"
tools:src="@drawable/ic_empty_state_marker_list_night"/>
<net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/empty_state_text_interval"
android:background="@null"
android:text="@string/empty_state_markers_active"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/empty_state_text_size"/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginLeft="@dimen/empty_state_text_desc_margin"
android:layout_marginRight="@dimen/empty_state_text_desc_margin"
android:text="@string/empty_state_markers_active_desc"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/empty_state_text_desc_size"/>
</LinearLayout>

View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/empty_state_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/empty_state_image_margin_bottom"
android:layout_marginTop="@dimen/empty_state_image_margin_top"
tools:src="@drawable/ic_empty_state_marker_group_night"/>
<net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/empty_state_text_interval"
android:background="@null"
android:text="@string/empty_state_markers_groups"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/empty_state_text_size"/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginLeft="@dimen/empty_state_text_desc_margin"
android:layout_marginRight="@dimen/empty_state_text_desc_margin"
android:text="@string/empty_state_markers_groups_desc"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/empty_state_text_desc_size"/>
<Button
android:id="@+id/import_button"
style="@style/DialogActionButton"
android:layout_marginTop="@dimen/empty_state_button_margin_top"
android:text="@string/shared_string_import"/>
</LinearLayout>

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/empty_state_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/empty_state_image_margin_bottom"
android:layout_marginTop="@dimen/empty_state_image_margin_top"
tools:src="@drawable/ic_empty_state_marker_history_night"/>
<net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/empty_state_text_interval"
android:background="@null"
android:text="@string/empty_state_markers_history"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/empty_state_text_size"/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginLeft="@dimen/empty_state_text_desc_margin"
android:layout_marginRight="@dimen/empty_state_text_desc_margin"
android:text="@string/empty_state_markers_history_desc"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/empty_state_text_desc_size"/>
</LinearLayout>

View file

@ -12,18 +12,18 @@
android:id="@+id/empty_state_image_view" android:id="@+id/empty_state_image_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/my_places_empty_state_image_margin_bottom" android:layout_marginBottom="@dimen/empty_state_image_margin_bottom"
android:layout_marginTop="@dimen/my_places_empty_state_image_margin_top" android:layout_marginTop="@dimen/empty_state_image_margin_top"
tools:src="@drawable/ic_empty_state_trip_night_result"/> tools:src="@drawable/ic_empty_state_trip_night"/>
<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_marginBottom="@dimen/my_places_empty_state_text_interval" android:layout_marginBottom="@dimen/empty_state_text_interval"
android:background="@null" android:background="@null"
android:text="@string/empty_state_my_tracks" android:text="@string/empty_state_my_tracks"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/my_places_empty_state_text_size" android:textSize="@dimen/empty_state_text_size"
osmand:typeface="@string/font_roboto_medium"/> osmand:typeface="@string/font_roboto_medium"/>
<TextView <TextView
@ -31,16 +31,16 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@null" android:background="@null"
android:layout_marginLeft="@dimen/my_places_empty_state_text_desc_margin" android:layout_marginLeft="@dimen/empty_state_text_desc_margin"
android:layout_marginRight="@dimen/my_places_empty_state_text_desc_margin" android:layout_marginRight="@dimen/empty_state_text_desc_margin"
android:text="@string/empty_state_my_tracks_desc" android:text="@string/empty_state_my_tracks_desc"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/my_places_empty_state_text_desc_size"/> android:textSize="@dimen/empty_state_text_desc_size"/>
<Button <Button
android:id="@+id/import_button" android:id="@+id/import_button"
style="@style/DialogActionButton" style="@style/DialogActionButton"
android:layout_marginTop="@dimen/my_places_empty_state_button_margin_top" android:layout_marginTop="@dimen/empty_state_button_margin_top"
android:text="@string/shared_string_import"/> android:text="@string/shared_string_import"/>
</LinearLayout> </LinearLayout>

View file

@ -0,0 +1,17 @@
<?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">
<net.osmand.plus.widgets.EmptyStateRecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/map_markers_recycler_view_padding_bottom"
android:clipToPadding="false"/>
<include layout="@layout/empty_state_markers_active"
android:id="@+id/empty_view"/>
</LinearLayout>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<net.osmand.plus.widgets.EmptyStateRecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/fab_recycler_view_padding_bottom"
android:clipToPadding="false"/>
<include layout="@layout/empty_state_markers_groups"
android:id="@+id/empty_view"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/add_group_fab"
android:layout_gravity="bottom|right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_action_plus"
app:backgroundTint="@color/dashboard_blue"
app:fabSize="normal"
app:useCompatPadding="true"/>
</FrameLayout>

View file

@ -0,0 +1,17 @@
<?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">
<net.osmand.plus.widgets.EmptyStateRecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/map_markers_recycler_view_padding_bottom"
android:clipToPadding="false"/>
<include layout="@layout/empty_state_markers_history"
android:id="@+id/empty_view"/>
</LinearLayout>

View file

@ -0,0 +1,37 @@
<?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="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/favourites_group_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small"
android:clipToPadding="false"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/close_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_cancel"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<ScrollView
android:id="@+id/add_markers_group_scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/add_group_title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/add_group"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_descr_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/add_group_descr"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
<LinearLayout
android:id="@+id/favourites_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:gravity="center_vertical">
<ImageView
android:id="@+id/favourites_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_fav_dark"/>
<TextView
android:id="@+id/favourites_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/favourites_group"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/waypoints_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:gravity="center_vertical">
<ImageView
android:id="@+id/waypoints_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_polygom_dark"/>
<TextView
android:id="@+id/waypoints_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/track_waypoints"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/close_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:gravity="center_vertical">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_polygom_dark"/>
<TextView
android:id="@+id/name_text"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
tools:text="Berlin trip"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView
android:layout_marginLeft="@dimen/bottom_sheet_content_margin"
android:layout_marginStart="@dimen/bottom_sheet_content_margin"
android:id="@+id/number_count_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
tools:text="25"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>

View file

@ -5,8 +5,8 @@
<dimen name="splash_screen_logo_top">24dp</dimen> <dimen name="splash_screen_logo_top">24dp</dimen>
<dimen name="splash_screen_text_bottom">48dp</dimen> <dimen name="splash_screen_text_bottom">48dp</dimen>
<dimen name="my_places_empty_state_image_margin_top">39dp</dimen> <dimen name="empty_state_image_margin_top">39dp</dimen>
<dimen name="my_places_empty_state_image_margin_bottom">39dp</dimen> <dimen name="empty_state_image_margin_bottom">39dp</dimen>
<dimen name="measurement_tool_content_padding_medium">14dp</dimen> <dimen name="measurement_tool_content_padding_medium">14dp</dimen>
</resources> </resources>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<dimen name="my_places_empty_state_image_margin_top">59dp</dimen> <dimen name="empty_state_image_margin_top">59dp</dimen>
<dimen name="my_places_empty_state_image_margin_bottom">59dp</dimen> <dimen name="empty_state_image_margin_bottom">59dp</dimen>
<dimen name="measurement_tool_content_padding_medium">21dp</dimen> <dimen name="measurement_tool_content_padding_medium">21dp</dimen>
</resources> </resources>

View file

@ -81,17 +81,17 @@
<dimen name="default_split_segments_data">15sp</dimen> <dimen name="default_split_segments_data">15sp</dimen>
<dimen name="default_split_segments_sub">12sp</dimen> <dimen name="default_split_segments_sub">12sp</dimen>
<dimen name="my_places_empty_state_image_margin_top">63dp</dimen> <dimen name="empty_state_image_margin_top">63dp</dimen>
<dimen name="my_places_empty_state_image_margin_bottom">45dp</dimen> <dimen name="empty_state_image_margin_bottom">45dp</dimen>
<dimen name="my_places_empty_state_text_interval">12dp</dimen> <dimen name="empty_state_text_interval">12dp</dimen>
<dimen name="my_places_empty_state_button_margin_top">30dp</dimen> <dimen name="empty_state_button_margin_top">30dp</dimen>
<dimen name="my_places_empty_state_text_size">20sp</dimen> <dimen name="empty_state_text_size">20sp</dimen>
<dimen name="my_places_empty_state_text_desc_size">18sp</dimen> <dimen name="empty_state_text_desc_size">18sp</dimen>
<dimen name="my_places_empty_state_text_desc_margin">68dp</dimen> <dimen name="empty_state_text_desc_margin">68dp</dimen>
<dimen name="my_places_empty_state_image_margin_left">138dp</dimen> <dimen name="empty_state_image_margin_left">138dp</dimen>
<dimen name="my_places_empty_state_text_button_padding_left">72dp</dimen> <dimen name="empty_state_text_button_padding_left">72dp</dimen>
<dimen name="my_places_empty_state_text_button_padding_right">90dp</dimen> <dimen name="empty_state_text_button_padding_right">90dp</dimen>
<dimen name="my_places_empty_state_text_button_padding_top">96dp</dimen> <dimen name="empty_state_text_button_padding_top">96dp</dimen>
<dimen name="bottom_sheet_cancel_button_height">72dp</dimen> <dimen name="bottom_sheet_cancel_button_height">72dp</dimen>
<dimen name="landscape_bottom_sheet_dialog_fragment_width">540dp</dimen> <dimen name="landscape_bottom_sheet_dialog_fragment_width">540dp</dimen>

View file

@ -144,17 +144,17 @@
<dimen name="splash_screen_logo_top">150dp</dimen> <dimen name="splash_screen_logo_top">150dp</dimen>
<dimen name="splash_screen_text_bottom">128dp</dimen> <dimen name="splash_screen_text_bottom">128dp</dimen>
<dimen name="my_places_empty_state_image_margin_top">42dp</dimen> <dimen name="empty_state_image_margin_top">42dp</dimen>
<dimen name="my_places_empty_state_image_margin_bottom">30dp</dimen> <dimen name="empty_state_image_margin_bottom">30dp</dimen>
<dimen name="my_places_empty_state_text_interval">8dp</dimen> <dimen name="empty_state_text_interval">8dp</dimen>
<dimen name="my_places_empty_state_button_margin_top">20dp</dimen> <dimen name="empty_state_button_margin_top">20dp</dimen>
<dimen name="my_places_empty_state_text_size">18sp</dimen> <dimen name="empty_state_text_size">18sp</dimen>
<dimen name="my_places_empty_state_text_desc_size">16sp</dimen> <dimen name="empty_state_text_desc_size">16sp</dimen>
<dimen name="my_places_empty_state_text_desc_margin">45dp</dimen> <dimen name="empty_state_text_desc_margin">45dp</dimen>
<dimen name="my_places_empty_state_image_margin_left">92dp</dimen> <dimen name="empty_state_image_margin_left">92dp</dimen>
<dimen name="my_places_empty_state_text_button_padding_left">48dp</dimen> <dimen name="empty_state_text_button_padding_left">48dp</dimen>
<dimen name="my_places_empty_state_text_button_padding_right">60dp</dimen> <dimen name="empty_state_text_button_padding_right">60dp</dimen>
<dimen name="my_places_empty_state_text_button_padding_top">64dp</dimen> <dimen name="empty_state_text_button_padding_top">64dp</dimen>
<dimen name="bottom_sheet_cancel_button_height">48dp</dimen> <dimen name="bottom_sheet_cancel_button_height">48dp</dimen>
<dimen name="landscape_bottom_sheet_dialog_fragment_width">360dp</dimen> <dimen name="landscape_bottom_sheet_dialog_fragment_width">360dp</dimen>
@ -198,4 +198,6 @@
<dimen name="shadow_height">5dp</dimen> <dimen name="shadow_height">5dp</dimen>
<dimen name="map_marker_title_height">28dp</dimen> <dimen name="map_marker_title_height">28dp</dimen>
<dimen name="fab_recycler_view_padding_bottom">88dp</dimen>
</resources> </resources>

View file

@ -9,6 +9,18 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
--> -->
<string name="add_track_to_markers_descr">Select track waypoints of which OsmAnd will add to markers</string>
<string name="add_favourites_group_to_markers_descr">Select which favourite group you want to add to markers</string>
<string name="track_waypoints">Track waypoints</string>
<string name="favourites_group">Favourites group</string>
<string name="add_group">Add group</string>
<string name="add_group_descr">You can add group of favourites or track waypoints.</string>
<string name="empty_state_markers_active">Markers on map!</string>
<string name="empty_state_markers_active_desc">Mark places on map by tap.</string>
<string name="empty_state_markers_groups">Import groups</string>
<string name="empty_state_markers_groups_desc">You can import favourite groups or track waypoints as markers.</string>
<string name="empty_state_markers_history">@string/shared_string_history</string>
<string name="empty_state_markers_history_desc">Markers marked as passed will appear on this screen.</string>
<string name="shared_string_two">Two</string> <string name="shared_string_two">Two</string>
<string name="shared_string_one">One</string> <string name="shared_string_one">One</string>
<string name="show_guide_line_descr">A line connecting your location to locations of the active markers will be shown on the map.</string> <string name="show_guide_line_descr">A line connecting your location to locations of the active markers will be shown on the map.</string>

View file

@ -0,0 +1,84 @@
package net.osmand.plus.mapmarkers;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MarkersSyncGroup;
import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.mapmarkers.adapters.FavouritesGroupsAdapter;
import java.util.List;
public class AddFavouritesGroupBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
public final static String TAG = "AddFavouritesGroupBottomSheetDialogFragment";
private AddFavouriteGroupListener listener;
private List<FavoriteGroup> favoriteGroups;
private MapMarkersHelper mapMarkersHelper;
public void setListener(AddFavouriteGroupListener listener) {
this.listener = listener;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
favoriteGroups = getMyApplication().getFavorites().getFavoriteGroups();
mapMarkersHelper = getMyApplication().getMapMarkersHelper();
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_add_favourites_group_bottom_sheet_dialog, container);
final RecyclerView recyclerView = mainView.findViewById(R.id.favourites_group_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
final FavouritesGroupsAdapter adapter = new FavouritesGroupsAdapter(getContext(), favoriteGroups);
adapter.setAdapterListener(new FavouritesGroupsAdapter.FavouritesGroupsAdapterListener() {
@Override
public void onItemClick(View view) {
int position = recyclerView.getChildAdapterPosition(view);
if (position == RecyclerView.NO_POSITION) {
return;
}
FavoriteGroup group = favoriteGroups.get(position - 1);
MarkersSyncGroup markersSyncGroup = new MarkersSyncGroup(group.name, group.name, MarkersSyncGroup.FAVORITES_TYPE, group.color);
mapMarkersHelper.addMarkersSyncGroup(markersSyncGroup);
mapMarkersHelper.syncGroup(markersSyncGroup);
if (listener != null) {
listener.onFavouriteGroupAdded();
}
dismiss();
}
});
recyclerView.setAdapter(adapter);
mainView.findViewById(R.id.close_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
setupHeightAndBackground(mainView, R.id.favourites_group_recycler_view);
return mainView;
}
public interface AddFavouriteGroupListener {
void onFavouriteGroupAdded();
}
}

View file

@ -0,0 +1,75 @@
package net.osmand.plus.mapmarkers;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
public class AddMarkersGroupBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
public final static String TAG = "AddMarkersGroupBottomSheetDialogFragment";
private AddMarkersGroupFragmentListener listener;
public void setListener(AddMarkersGroupFragmentListener listener) {
this.listener = listener;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_add_markers_group_bottom_sheet_dialog, container);
if (nightMode) {
((TextView) mainView.findViewById(R.id.add_group_title)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark));
}
((ImageView) mainView.findViewById(R.id.favourites_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_fav_dark));
((ImageView) mainView.findViewById(R.id.waypoints_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_polygom_dark));
mainView.findViewById(R.id.favourites_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.favouritesOnClick();
}
dismiss();
}
});
mainView.findViewById(R.id.waypoints_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.waypointsOnClick();
}
dismiss();
}
});
mainView.findViewById(R.id.close_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
setupHeightAndBackground(mainView, R.id.add_markers_group_scroll_view);
return mainView;
}
interface AddMarkersGroupFragmentListener {
void favouritesOnClick();
void waypointsOnClick();
}
}

View file

@ -10,6 +10,7 @@ import android.support.v7.widget.helper.ItemTouchHelper;
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.widget.ImageView;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
@ -25,6 +26,7 @@ import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.mapmarkers.adapters.MapMarkersActiveAdapter; import net.osmand.plus.mapmarkers.adapters.MapMarkersActiveAdapter;
import net.osmand.plus.mapmarkers.adapters.MapMarkersActiveAdapter.MapMarkersActiveAdapterListener; import net.osmand.plus.mapmarkers.adapters.MapMarkersActiveAdapter.MapMarkersActiveAdapterListener;
import net.osmand.plus.mapmarkers.adapters.MapMarkersItemTouchHelperCallback; import net.osmand.plus.mapmarkers.adapters.MapMarkersItemTouchHelperCallback;
import net.osmand.plus.widgets.EmptyStateRecyclerView;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassListener, OsmAndLocationListener { public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassListener, OsmAndLocationListener {
@ -38,10 +40,9 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final RecyclerView recyclerView = new RecyclerView(getContext());
final MapActivity mapActivity = (MapActivity) getActivity(); final MapActivity mapActivity = (MapActivity) getActivity();
recyclerView.setPadding(0, 0, 0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom)); final View mainView = inflater.inflate(R.layout.fragment_map_markers_active, container, false);
recyclerView.setClipToPadding(false); final EmptyStateRecyclerView recyclerView = (EmptyStateRecyclerView) mainView.findViewById(R.id.list);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
adapter = new MapMarkersActiveAdapter(mapActivity); adapter = new MapMarkersActiveAdapter(mapActivity);
@ -90,6 +91,11 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
compassUpdateAllowed = false; compassUpdateAllowed = false;
} }
}); });
final View emptyView = mainView.findViewById(R.id.empty_view);
ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view);
emptyImageView.setImageResource(mapActivity.getMyApplication().getSettings().isLightContent() ? R.drawable.ic_empty_state_marker_list_day : R.drawable.ic_empty_state_marker_list_night);
recyclerView.setEmptyView(emptyView);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override @Override
@ -98,7 +104,7 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
compassUpdateAllowed = newState == RecyclerView.SCROLL_STATE_IDLE; compassUpdateAllowed = newState == RecyclerView.SCROLL_STATE_IDLE;
} }
}); });
return recyclerView; return mainView;
} }
@Override @Override

View file

@ -148,6 +148,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
}); });
viewPager = mainView.findViewById(R.id.map_markers_view_pager); viewPager = mainView.findViewById(R.id.map_markers_view_pager);
viewPager.setOffscreenPageLimit(3);
viewPager.setSwipeLocked(true); viewPager.setSwipeLocked(true);
final MapMarkersViewPagerAdapter adapter = new MapMarkersViewPagerAdapter(getChildFragmentManager()); final MapMarkersViewPagerAdapter adapter = new MapMarkersViewPagerAdapter(getChildFragmentManager());
viewPager.setAdapter(adapter); viewPager.setAdapter(adapter);

View file

@ -19,6 +19,7 @@ import android.support.v7.widget.helper.ItemTouchHelper;
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.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.Location; import net.osmand.Location;
@ -34,6 +35,9 @@ import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.dashboard.DashLocationFragment; import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.mapmarkers.adapters.MapMarkerItemViewHolder; import net.osmand.plus.mapmarkers.adapters.MapMarkerItemViewHolder;
import net.osmand.plus.mapmarkers.adapters.MapMarkersGroupsAdapter; import net.osmand.plus.mapmarkers.adapters.MapMarkersGroupsAdapter;
import net.osmand.plus.mapmarkers.AddMarkersGroupBottomSheetDialogFragment.AddMarkersGroupFragmentListener;
import net.osmand.plus.mapmarkers.AddFavouritesGroupBottomSheetDialogFragment.AddFavouriteGroupListener;
import net.osmand.plus.widgets.EmptyStateRecyclerView;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassListener, OsmAndLocationListener { public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassListener, OsmAndLocationListener {
@ -49,15 +53,25 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
private Paint textPaint = new Paint(); private Paint textPaint = new Paint();
private Snackbar snackbar; private Snackbar snackbar;
private boolean compassUpdateAllowed = true; private boolean compassUpdateAllowed = true;
private View mainView;
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final MapActivity mapActivity = (MapActivity) getActivity(); final MapActivity mapActivity = (MapActivity) getActivity();
final boolean night = !mapActivity.getMyApplication().getSettings().isLightContent(); final boolean night = !mapActivity.getMyApplication().getSettings().isLightContent();
final RecyclerView recyclerView = new RecyclerView(getContext()); mainView = inflater.inflate(R.layout.fragment_map_markers_groups, container, false);
recyclerView.setPadding(0, 0, 0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom));
recyclerView.setClipToPadding(false); Fragment addMarkersGroupFragment = getChildFragmentManager().findFragmentByTag(AddMarkersGroupBottomSheetDialogFragment.TAG);
if (addMarkersGroupFragment != null) {
((AddMarkersGroupBottomSheetDialogFragment) addMarkersGroupFragment).setListener(createAddMarkersGroupFragmentListener());
}
Fragment addFavouritesGroupFragment = getChildFragmentManager().findFragmentByTag(AddFavouritesGroupBottomSheetDialogFragment.TAG);
if (addFavouritesGroupFragment != null) {
((AddFavouritesGroupBottomSheetDialogFragment) addFavouritesGroupFragment).setListener(createAddFavouritesGroupListener());
}
final EmptyStateRecyclerView recyclerView = (EmptyStateRecyclerView) mainView.findViewById(R.id.list);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override @Override
@ -222,8 +236,83 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
} }
} }
}); });
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override
public void onChanged() {
changeFabVisibilityIfNeeded();
}
@Override
public void onItemRangeInserted(int positionStart, int itemCount) {
changeFabVisibilityIfNeeded();
}
@Override
public void onItemRangeRemoved(int positionStart, int itemCount) {
changeFabVisibilityIfNeeded();
}
});
final View emptyView = mainView.findViewById(R.id.empty_view);
mainView.findViewById(R.id.import_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
openAddGroupMenu();
}
});
ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view);
emptyImageView.setImageResource(night ? R.drawable.ic_empty_state_marker_group_night : R.drawable.ic_empty_state_marker_group_day);
recyclerView.setEmptyView(emptyView);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
return recyclerView;
mainView.findViewById(R.id.add_group_fab).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
openAddGroupMenu();
}
});
return mainView;
}
private void changeFabVisibilityIfNeeded() {
mainView.findViewById(R.id.add_group_fab).setVisibility(adapter.getItemCount() > 0 ? View.VISIBLE : View.GONE);
}
private void openAddGroupMenu() {
AddMarkersGroupBottomSheetDialogFragment fragment = new AddMarkersGroupBottomSheetDialogFragment();
fragment.setListener(createAddMarkersGroupFragmentListener());
fragment.setUsedOnMap(false);
fragment.show(getChildFragmentManager(), AddMarkersGroupBottomSheetDialogFragment.TAG);
}
private void openAddFavouritesGroupMenu() {
AddFavouritesGroupBottomSheetDialogFragment fragment = new AddFavouritesGroupBottomSheetDialogFragment();
fragment.setListener(createAddFavouritesGroupListener());
fragment.setUsedOnMap(false);
fragment.show(getChildFragmentManager(), AddFavouritesGroupBottomSheetDialogFragment.TAG);
}
private AddFavouriteGroupListener createAddFavouritesGroupListener() {
return new AddFavouriteGroupListener() {
@Override
public void onFavouriteGroupAdded() {
updateAdapter();
}
};
}
private AddMarkersGroupFragmentListener createAddMarkersGroupFragmentListener() {
return new AddMarkersGroupFragmentListener() {
@Override
public void favouritesOnClick() {
openAddFavouritesGroupMenu();
}
@Override
public void waypointsOnClick() {
}
};
} }
void updateAdapter() { void updateAdapter() {

View file

@ -18,6 +18,7 @@ import android.support.v7.widget.helper.ItemTouchHelper;
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.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper;
@ -28,6 +29,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapmarkers.adapters.MapMarkerHeaderViewHolder; import net.osmand.plus.mapmarkers.adapters.MapMarkerHeaderViewHolder;
import net.osmand.plus.mapmarkers.adapters.MapMarkerItemViewHolder; import net.osmand.plus.mapmarkers.adapters.MapMarkerItemViewHolder;
import net.osmand.plus.mapmarkers.adapters.MapMarkersHistoryAdapter; import net.osmand.plus.mapmarkers.adapters.MapMarkersHistoryAdapter;
import net.osmand.plus.widgets.EmptyStateRecyclerView;
public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHelper.MapMarkerChangedListener { public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHelper.MapMarkerChangedListener {
@ -73,9 +75,8 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
((HistoryMarkerMenuBottomSheetDialogFragment) historyMarkerMenuFragment).setListener(createHistoryMarkerMenuListener()); ((HistoryMarkerMenuBottomSheetDialogFragment) historyMarkerMenuFragment).setListener(createHistoryMarkerMenuListener());
} }
final RecyclerView recyclerView = new RecyclerView(getContext()); final View mainView = inflater.inflate(R.layout.fragment_map_markers_history, container, false);
recyclerView.setPadding(0, 0, 0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom)); final EmptyStateRecyclerView recyclerView = (EmptyStateRecyclerView) mainView.findViewById(R.id.list);
recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
@ -203,11 +204,15 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
} }
} }
}); });
final View emptyView = mainView.findViewById(R.id.empty_view);
ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view);
emptyImageView.setImageResource(night ? R.drawable.ic_empty_state_marker_history_night : R.drawable.ic_empty_state_marker_history_day);
recyclerView.setEmptyView(emptyView);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
app.getMapMarkersHelper().addListener(this); app.getMapMarkersHelper().addListener(this);
return recyclerView; return mainView;
} }
void hideSnackbar() { void hideSnackbar() {

View file

@ -0,0 +1,89 @@
package net.osmand.plus.mapmarkers.adapters;
import android.content.Context;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import java.util.List;
public class FavouritesGroupsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final int TYPE_HEADER = 12;
private static final int TYPE_ITEM = 13;
private FavouritesGroupsAdapterListener listener;
private OsmandApplication app;
private List<FavoriteGroup> favoriteGroups;
private IconsCache iconsCache;
public FavouritesGroupsAdapter(Context context, List<FavoriteGroup> favoriteGroups) {
this.app = (OsmandApplication) context.getApplicationContext();
this.favoriteGroups = favoriteGroups;
this.iconsCache = app.getIconsCache();
}
public void setAdapterListener(FavouritesGroupsAdapterListener listener) {
this.listener = listener;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == TYPE_HEADER) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.add_favourites_group_header, parent, false);
return new MapMarkersGroupHeaderViewHolder(view);
} else {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.markers_group_view_holder, parent, false);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.onItemClick(view);
}
}
});
return new MapMarkersGroupViewHolder(view);
}
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (holder instanceof MapMarkersGroupHeaderViewHolder) {
MapMarkersGroupHeaderViewHolder markersGroupHeaderViewHolder = (MapMarkersGroupHeaderViewHolder) holder;
markersGroupHeaderViewHolder.title.setText(app.getText(R.string.favourites_group));
markersGroupHeaderViewHolder.description.setText(app.getText(R.string.add_favourites_group_to_markers_descr));
} else if (holder instanceof MapMarkersGroupViewHolder) {
FavoriteGroup favoriteGroup = getItem(position);
MapMarkersGroupViewHolder markersGroupViewHolder = (MapMarkersGroupViewHolder) holder;
int color = favoriteGroup.color == 0 || favoriteGroup.color == Color.BLACK ? app.getResources().getColor(R.color.color_favorite) : favoriteGroup.color;
markersGroupViewHolder.icon.setImageDrawable(iconsCache.getPaintedIcon(R.drawable.ic_action_folder, color | 0xff000000));
markersGroupViewHolder.name.setText(favoriteGroup.name.length() == 0 ? app.getString(R.string.shared_string_favorites) : favoriteGroup.name);
markersGroupViewHolder.numberCount.setText(String.valueOf(favoriteGroup.points.size()));
}
}
@Override
public int getItemViewType(int position) {
return position == 0 ? TYPE_HEADER : TYPE_ITEM;
}
@Override
public int getItemCount() {
return favoriteGroups.size() + 1;
}
private FavoriteGroup getItem(int position) {
return favoriteGroups.get(position - 1);
}
public interface FavouritesGroupsAdapterListener {
void onItemClick(View view);
}
}

View file

@ -0,0 +1,19 @@
package net.osmand.plus.mapmarkers.adapters;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import net.osmand.plus.R;
public class MapMarkersGroupHeaderViewHolder extends RecyclerView.ViewHolder {
TextView title;
TextView description;
public MapMarkersGroupHeaderViewHolder(View itemView) {
super(itemView);
title = itemView.findViewById(R.id.title);
description = itemView.findViewById(R.id.description);
}
}

View file

@ -0,0 +1,22 @@
package net.osmand.plus.mapmarkers.adapters;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.plus.R;
public class MapMarkersGroupViewHolder extends RecyclerView.ViewHolder {
ImageView icon;
TextView name;
TextView numberCount;
public MapMarkersGroupViewHolder(View itemView) {
super(itemView);
icon = itemView.findViewById(R.id.icon);
name = itemView.findViewById(R.id.name_text);
numberCount = itemView.findViewById(R.id.number_count_text);
}
}

View file

@ -0,0 +1,70 @@
package net.osmand.plus.widgets;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
public class EmptyStateRecyclerView extends RecyclerView {
private View emptyView;
public EmptyStateRecyclerView(Context context) {
super(context);
}
public EmptyStateRecyclerView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public EmptyStateRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
private AdapterDataObserver emptyStateObserver = new AdapterDataObserver() {
@Override
public void onChanged() {
checkIfEmpty();
}
@Override
public void onItemRangeInserted(int positionStart, int itemCount) {
checkIfEmpty();
}
@Override
public void onItemRangeRemoved(int positionStart, int itemCount) {
checkIfEmpty();
}
};
@Override
public void setAdapter(Adapter adapter) {
final Adapter oldAdapter = getAdapter();
if (oldAdapter != null) {
oldAdapter.unregisterAdapterDataObserver(emptyStateObserver);
}
super.setAdapter(adapter);
if (adapter != null) {
adapter.registerAdapterDataObserver(emptyStateObserver);
}
checkIfEmpty();
}
public void setEmptyView(View emptyView) {
this.emptyView = emptyView;
checkIfEmpty();
}
private void checkIfEmpty() {
if (emptyView != null && getAdapter() != null) {
if (getAdapter().getItemCount() == 0) {
setVisibility(View.GONE);
emptyView.setVisibility(View.VISIBLE);
} else {
emptyView.setVisibility(View.GONE);
setVisibility(View.VISIBLE);
}
}
}
}