Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
bc12af36e7
21 changed files with 801 additions and 395 deletions
12
OsmAnd/res/drawable/bg_bottom_menu_dark.xml
Normal file
12
OsmAnd/res/drawable/bg_bottom_menu_dark.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<nine-patch android:src="@drawable/bg_contextmenu_shadow_top_light" />
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<solid
|
||||
android:color="@color/bg_color_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
12
OsmAnd/res/drawable/bg_bottom_menu_light.xml
Normal file
12
OsmAnd/res/drawable/bg_bottom_menu_light.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<nine-patch android:src="@drawable/bg_contextmenu_shadow_top_light" />
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<solid
|
||||
android:color="@color/bg_color_light" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
12
OsmAnd/res/drawable/bg_left_menu_dark.xml
Normal file
12
OsmAnd/res/drawable/bg_left_menu_dark.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<nine-patch android:src="@drawable/bg_contextmenu_shadow_right_light" />
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<solid
|
||||
android:color="@color/bg_color_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
12
OsmAnd/res/drawable/bg_left_menu_light.xml
Normal file
12
OsmAnd/res/drawable/bg_left_menu_light.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<nine-patch android:src="@drawable/bg_contextmenu_shadow_right_light" />
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<solid
|
||||
android:color="@color/bg_color_light" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
256
OsmAnd/res/layout-land/point_editor_fragment.xml
Normal file
256
OsmAnd/res/layout-land/point_editor_fragment.xml
Normal file
|
@ -0,0 +1,256 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/point_edit_layout"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||
android:background="?attr/pstsTabBackground"
|
||||
android:minHeight="@dimen/dashboard_map_toolbar"
|
||||
android:theme="?attr/toolbar_theme"
|
||||
app:contentInsetLeft="72dp"
|
||||
app:contentInsetStart="72dp">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/delete_button"
|
||||
android:layout_width="?attr/actionBarSize"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@drawable/ic_action_delete_dark"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/save_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:background="@android:color/transparent"
|
||||
android:text="@string/shared_string_save"/>
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/title_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_point_editor_view"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_caption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="Point info"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_replace"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:textColor="?attr/contextMenuButtonColor"
|
||||
android:text="@string/update_existing"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/name_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_building_number"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name_caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:text="@string/favourites_edit_dialog_name"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/name_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColorHint="?android:textColorSecondary"
|
||||
android:inputType="text"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/category_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_building_number"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/category_caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:text="@string/favourites_edit_dialog_name"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
<net.osmand.plus.widgets.AutoCompleteTextViewEx
|
||||
android:id="@+id/category_edit"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginLeft="8dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/description_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_note_dark"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/description_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:maxLines="8"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColorHint="?android:textColorSecondary"
|
||||
android:inputType="textMultiLine"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
52
OsmAnd/res/layout-land/share_menu_fragment.xml
Normal file
52
OsmAnd/res/layout-land/share_menu_fragment.xml
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout android:id="@+id/share_fragment_layout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/left_menu_view_bg">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_caption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/send_location_way_choose_title"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/list"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</ListView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -71,7 +71,7 @@
|
|||
android:background="?android:selectableItemBackground"
|
||||
android:textColor="?attr/contextMenuButtonColor"
|
||||
android:text="@string/update_existing"
|
||||
android:visibility="visible"/>
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -1,246 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/point_edit_layout"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||
android:background="?attr/pstsTabBackground"
|
||||
android:minHeight="@dimen/dashboard_map_toolbar"
|
||||
android:theme="?attr/toolbar_theme"
|
||||
app:contentInsetLeft="72dp"
|
||||
app:contentInsetStart="72dp">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/delete_button"
|
||||
android:layout_width="?attr/actionBarSize"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@drawable/ic_action_delete_dark"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/save_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:background="@android:color/transparent"
|
||||
android:text="@string/shared_string_save"/>
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/title_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_point_editor_view"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="Point info"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/name_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_building_number"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name_caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:text="@string/favourites_edit_dialog_name"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/name_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColorHint="?android:textColorSecondary"
|
||||
android:inputType="text"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/category_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_building_number"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/category_caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:text="@string/favourites_edit_dialog_name"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
<net.osmand.plus.widgets.AutoCompleteTextViewEx
|
||||
android:id="@+id/category_edit"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginLeft="8dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/description_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_note_dark"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/description_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:maxLines="8"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColorHint="?android:textColorSecondary"
|
||||
android:inputType="textMultiLine"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
37
OsmAnd/res/layout/share_list_item.xml
Normal file
37
OsmAnd/res/layout/share_list_item.xml
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?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="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/expandable_list_item_background"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/list_content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/favorites_icon_right_margin"
|
||||
android:layout_marginTop="@dimen/favorites_icon_top_margin"
|
||||
android:focusable="false"
|
||||
android:src="@drawable/ic_action_note_dark"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="Message"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
53
OsmAnd/res/layout/share_menu_fragment.xml
Normal file
53
OsmAnd/res/layout/share_menu_fragment.xml
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout android:id="@+id/share_fragment_layout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/bottom_menu_view_bg"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_caption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/send_location_way_choose_title"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/list"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</ListView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -14,6 +14,8 @@
|
|||
<attr name="bg_map_context_menu" format="reference" />
|
||||
<attr name="bg_point_editor_view" format="reference" />
|
||||
<attr name="ctx_menu_info_view_bg" format="reference" />
|
||||
<attr name="bottom_menu_view_bg" format="reference" />
|
||||
<attr name="left_menu_view_bg" format="reference" />
|
||||
|
||||
<attr name="dashboard_divider" format="reference" />
|
||||
<attr name="dashboard_button" format="reference" />
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
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
|
||||
-->
|
||||
<string name="share_clipboard">Clipboard</string>
|
||||
<string name="share_geo">geo:</string>
|
||||
<string name="share_qr_code">QR-Code</string>
|
||||
<string name="favorite_category_dublicate_message">Specified category name already exists. Please define other name.</string>
|
||||
<string name="favorite_category_name">Category name</string>
|
||||
<string name="favorite_category_add_new_title">Add new category</string>
|
||||
|
|
|
@ -67,6 +67,8 @@
|
|||
<item name="bg_color">@color/bg_color_light</item>
|
||||
<item name="bg_card">@drawable/bg_card_light</item>
|
||||
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_light</item>
|
||||
<item name="bottom_menu_view_bg">@drawable/bg_bottom_menu_light</item>
|
||||
<item name="left_menu_view_bg">@drawable/bg_left_menu_light</item>
|
||||
<item name="bg_point_editor_view">@drawable/bg_point_editor_view_light</item>
|
||||
<item name="dashboard_divider">@color/dashboard_divider_light</item>
|
||||
<item name="divider_color">@color/divider_color</item>
|
||||
|
@ -158,6 +160,8 @@
|
|||
<item name="bg_color">@color/bg_color_dark</item>
|
||||
<item name="bg_card">@drawable/bg_card_dark</item>
|
||||
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_dark</item>
|
||||
<item name="bottom_menu_view_bg">@drawable/bg_bottom_menu_dark</item>
|
||||
<item name="left_menu_view_bg">@drawable/bg_left_menu_dark</item>
|
||||
<item name="bg_point_editor_view">@drawable/bg_point_editor_view_dark</item>
|
||||
<item name="dashboard_divider">@color/dashboard_divider_dark</item>
|
||||
<item name="divider_color">@color/dashboard_divider_dark</item>
|
||||
|
|
|
@ -1,10 +1,25 @@
|
|||
package net.osmand.plus.activities;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.londatiga.android.ActionItem;
|
||||
import net.londatiga.android.QuickAction;
|
||||
|
@ -31,7 +46,6 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.activities.actions.OsmAndDialogs;
|
||||
import net.osmand.plus.activities.actions.ShareLocation;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||
|
@ -44,26 +58,11 @@ import net.osmand.util.MapUtils;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import java.io.File;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class MapActivityActions implements DialogProvider {
|
||||
private static final Log LOG = PlatformUtil.getLog(MapActivityActions.class);
|
||||
|
@ -92,11 +91,6 @@ public class MapActivityActions implements DialogProvider {
|
|||
routingHelper = mapActivity.getMyApplication().getRoutingHelper();
|
||||
}
|
||||
|
||||
public void shareLocation(double latitude, double longitude) {
|
||||
enhance(dialogBundle, latitude, longitude, mapActivity.getMapView().getZoom());
|
||||
new ShareLocation(mapActivity).run();
|
||||
}
|
||||
|
||||
public void showNavigationContextMenuPoint(final double latitude, final double longitude) {
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(mapActivity);
|
||||
|
||||
|
|
|
@ -1,104 +0,0 @@
|
|||
package net.osmand.plus.activities.actions;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.MapActivityActions;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class ShareLocation extends OsmAndAction {
|
||||
|
||||
public ShareLocation(MapActivity mapActivity) {
|
||||
super(mapActivity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDialogID() {
|
||||
return OsmAndDialogs.DIALOG_SHARE_LOCATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
super.showDialog();
|
||||
}
|
||||
|
||||
public Dialog createDialog(Activity activity, final Bundle args) {
|
||||
mapActivity = (MapActivity) activity;
|
||||
AlertDialog.Builder builder = new Builder(mapActivity);
|
||||
builder.setTitle(R.string.send_location_way_choose_title);
|
||||
// "Email", "SMS",
|
||||
builder.setItems(new String[]{
|
||||
activity.getString(R.string.shared_string_message), "Clipboard", "geo:", "QR-Code"
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final double latitude = args.getDouble(MapActivityActions.KEY_LATITUDE);
|
||||
final double longitude = args.getDouble(MapActivityActions.KEY_LONGITUDE);
|
||||
final int zoom = args.getInt(MapActivityActions.KEY_ZOOM);
|
||||
try {
|
||||
final String geoUrl = MapUtils.buildGeoUrl(latitude, longitude, zoom);
|
||||
// TODO change this to HTTPS once it is setup!
|
||||
final String httpUrl = "http://osmand.net/go?lat=" + ((float) latitude) + "&lon=" + ((float) longitude) + "&z=" + zoom;
|
||||
String sms = mapActivity.getString(R.string.send_location_sms_pattern, geoUrl, httpUrl);
|
||||
if (which == 0) {
|
||||
sendMessage(sms);
|
||||
// } else if (which == 1) {
|
||||
// sendEmail(httpUrl, geoUrl);
|
||||
// } else if (which == 2) {
|
||||
// sendSms(sms);
|
||||
} else if (which == 1) {
|
||||
sendToClipboard(sms);
|
||||
} else if (which == 2) {
|
||||
sendGeoActivity(geoUrl);
|
||||
} else if (which == 3) {
|
||||
sendQRCode(latitude, longitude);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
Toast.makeText(mapActivity, R.string.shared_string_io_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
private void sendMessage(String sms) {
|
||||
ShareDialog.sendMessage(mapActivity, sms);
|
||||
}
|
||||
|
||||
|
||||
private void sendEmail(final String httpUrl, final String geoUrl) {
|
||||
String email = mapActivity.getString(R.string.send_location_email_pattern, httpUrl, geoUrl);
|
||||
ShareDialog.sendEmail(mapActivity, email, getString(R.string.send_location));
|
||||
}
|
||||
|
||||
private void sendSms(String sms) {
|
||||
ShareDialog.sendSms(mapActivity, sms);
|
||||
}
|
||||
|
||||
private void sendToClipboard(String sms) {
|
||||
ShareDialog.sendToClipboard(mapActivity, sms);
|
||||
|
||||
}
|
||||
|
||||
private void sendGeoActivity(final String geoUrl) {
|
||||
Intent mapIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoUrl));
|
||||
mapActivity.startActivity(mapIntent);
|
||||
}
|
||||
|
||||
private void sendQRCode(final double latitude, final double longitude) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putFloat("LAT", (float) latitude);
|
||||
bundle.putFloat("LONG", (float) longitude);
|
||||
ShareDialog.sendQRCode(mapActivity, "LOCATION_TYPE", bundle, null);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -23,6 +23,7 @@ import net.osmand.plus.mapcontextmenu.details.FavouritePointMenuController;
|
|||
import net.osmand.plus.mapcontextmenu.details.HistoryMenuController;
|
||||
import net.osmand.plus.mapcontextmenu.details.MenuController;
|
||||
import net.osmand.plus.mapcontextmenu.details.PointDescriptionMenuController;
|
||||
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.views.ContextMenuLayer;
|
||||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
|
@ -397,7 +398,7 @@ public class MapContextMenu {
|
|||
}
|
||||
|
||||
public void buttonSharePressed() {
|
||||
mapActivity.getMapActions().shareLocation(latLon.getLatitude(), latLon.getLongitude());
|
||||
ShareMenu.show(latLon, pointDescription, mapActivity);
|
||||
}
|
||||
|
||||
public void buttonMorePressed() {
|
||||
|
|
|
@ -27,7 +27,6 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.QuadPoint;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
|
@ -40,8 +39,6 @@ import net.osmand.plus.mapcontextmenu.details.MenuController;
|
|||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||
import static net.osmand.plus.mapcontextmenu.details.MenuBuilder.SHADOW_HEIGHT_BOTTOM_DP;
|
||||
import static net.osmand.plus.mapcontextmenu.details.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
|
||||
|
@ -50,7 +47,6 @@ import static net.osmand.plus.mapcontextmenu.details.MenuBuilder.SHADOW_HEIGHT_T
|
|||
public class MapContextMenuFragment extends Fragment {
|
||||
|
||||
public static final String TAG = "MapContextMenuFragment";
|
||||
private static final Log LOG = PlatformUtil.getLog(MapContextMenuFragment.class);
|
||||
|
||||
public static final float FAB_PADDING_TOP_DP = 4f;
|
||||
public static final float MARKER_PADDING_DP = 20f;
|
||||
|
@ -62,6 +58,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
MapContextMenu menu;
|
||||
|
||||
private int menuTopViewHeight;
|
||||
private int menuTopShadowHeight;
|
||||
private int menuTopShadowAllHeight;
|
||||
private int menuTitleHeight;
|
||||
|
@ -319,7 +316,6 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
// FAB
|
||||
fabView = (ImageView)view.findViewById(R.id.context_menu_fab_view);
|
||||
fabView.setImageDrawable(iconsCache.getIcon(menu.getFabIconId()));
|
||||
fabView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -438,11 +434,17 @@ public class MapContextMenuFragment extends Fragment {
|
|||
@Override
|
||||
public void onGlobalLayout() {
|
||||
|
||||
int newMenuTopViewHeight = view.findViewById(R.id.context_menu_top_view).getHeight();
|
||||
menuTopShadowHeight = view.findViewById(R.id.context_menu_top_shadow).getHeight();
|
||||
menuTopShadowAllHeight = view.findViewById(R.id.context_menu_top_shadow_all).getHeight();
|
||||
menuFullHeight = view.findViewById(R.id.context_menu_main).getHeight();
|
||||
|
||||
menuTitleHeight = menuTopShadowHeight + menuTopShadowAllHeight;
|
||||
int dy = 0;
|
||||
if (!menu.isLandscapeLayout() && menuTopViewHeight != 0) {
|
||||
dy = newMenuTopViewHeight - menuTopViewHeight;
|
||||
}
|
||||
menuTopViewHeight = newMenuTopViewHeight;
|
||||
menuTitleHeight = menuTopShadowHeight + menuTopShadowAllHeight + dy;
|
||||
menuBottomViewHeight = view.findViewById(R.id.context_menu_bottom_view).getHeight();
|
||||
|
||||
recalculateFullHeightMax();
|
||||
|
@ -605,6 +607,11 @@ public class MapContextMenuFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (map.getLatitude() == latlon.getLatitude() && map.getLongitude() == latlon.getLongitude()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (animated) {
|
||||
showOnMap(latlon, false, true);
|
||||
} else {
|
||||
|
|
|
@ -12,6 +12,8 @@ import net.osmand.plus.helpers.AndroidUiHelper;
|
|||
|
||||
public abstract class MenuController {
|
||||
|
||||
public final static float LANDSCAPE_WIDTH_DP = 350f;
|
||||
|
||||
public class MenuState {
|
||||
public static final int HEADER_ONLY = 1;
|
||||
public static final int HALF_SCREEN = 2;
|
||||
|
@ -60,7 +62,7 @@ public abstract class MenuController {
|
|||
}
|
||||
|
||||
public float getLandscapeWidthDp() {
|
||||
return 350f;
|
||||
return LANDSCAPE_WIDTH_DP;
|
||||
}
|
||||
|
||||
public int getSupportedMenuStates() {
|
||||
|
|
|
@ -66,11 +66,8 @@ public abstract class PointEditorFragment extends Fragment {
|
|||
|
||||
getActivity().findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
|
||||
|
||||
if (getEditor().isLandscapeLayout()) {
|
||||
view = inflater.inflate(R.layout.point_editor_fragment_land, container, false);
|
||||
} else {
|
||||
view = inflater.inflate(R.layout.point_editor_fragment, container, false);
|
||||
}
|
||||
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
toolbar.setTitle(getToolbarTitle());
|
||||
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));
|
||||
|
|
168
OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java
Normal file
168
OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java
Normal file
|
@ -0,0 +1,168 @@
|
|||
package net.osmand.plus.mapcontextmenu.other;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.MapActivityActions;
|
||||
import net.osmand.plus.activities.actions.ShareDialog;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.mapcontextmenu.details.MenuController;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ShareMenu {
|
||||
|
||||
private final MapActivity mapActivity;
|
||||
|
||||
private LatLon latLon;
|
||||
private PointDescription pointDescription;
|
||||
private boolean portraitMode;
|
||||
private boolean largeDevice;
|
||||
|
||||
private static final String KEY_SHARE_MENU_LATLON = "key_share_menu_latlon";
|
||||
private static final String KEY_SHARE_MENU_POINT_DESC = "key_share_menu_point_desc";
|
||||
|
||||
public enum ShareItem {
|
||||
MESSAGE(R.drawable.ic_action_aircraft, R.string.shared_string_message),
|
||||
CLIPBOARD(R.drawable.ic_action_aircraft, R.string.share_clipboard),
|
||||
GEO(R.drawable.ic_action_aircraft, R.string.share_geo),
|
||||
QR_CODE(R.drawable.ic_action_aircraft, R.string.share_qr_code);
|
||||
|
||||
final int iconResourceId;
|
||||
final int titleResourceId;
|
||||
|
||||
ShareItem(int iconResourceId, int titleResourceId) {
|
||||
this.iconResourceId = iconResourceId;
|
||||
this.titleResourceId = titleResourceId;
|
||||
}
|
||||
|
||||
public int getIconResourceId() {
|
||||
return iconResourceId;
|
||||
}
|
||||
|
||||
public int getTitleResourceId() {
|
||||
return titleResourceId;
|
||||
}
|
||||
}
|
||||
|
||||
private ShareMenu(MapActivity mapActivity) {
|
||||
this.mapActivity = mapActivity;
|
||||
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||
largeDevice = AndroidUiHelper.isXLargeDevice(mapActivity);
|
||||
}
|
||||
|
||||
public List<ShareItem> getItems() {
|
||||
List<ShareItem> list = new LinkedList<>();
|
||||
list.add(ShareItem.MESSAGE);
|
||||
list.add(ShareItem.CLIPBOARD);
|
||||
list.add(ShareItem.GEO);
|
||||
list.add(ShareItem.QR_CODE);
|
||||
return list;
|
||||
}
|
||||
|
||||
public boolean isLandscapeLayout() {
|
||||
return !portraitMode && !largeDevice;
|
||||
}
|
||||
|
||||
public int getSlideInAnimation() {
|
||||
if (isLandscapeLayout()) {
|
||||
return R.anim.slide_in_left;
|
||||
} else {
|
||||
return R.anim.slide_in_bottom;
|
||||
}
|
||||
}
|
||||
|
||||
public int getSlideOutAnimation() {
|
||||
if (isLandscapeLayout()) {
|
||||
return R.anim.slide_out_left;
|
||||
} else {
|
||||
return R.anim.slide_out_bottom;
|
||||
}
|
||||
}
|
||||
|
||||
public MapActivity getMapActivity() {
|
||||
return mapActivity;
|
||||
}
|
||||
|
||||
public LatLon getLatLon() {
|
||||
return latLon;
|
||||
}
|
||||
|
||||
public PointDescription getPointDescription() {
|
||||
return pointDescription;
|
||||
}
|
||||
|
||||
public static void show(LatLon latLon, PointDescription pointDescription, MapActivity mapActivity) {
|
||||
|
||||
ShareMenu menu = new ShareMenu(mapActivity);
|
||||
|
||||
if (pointDescription == null) {
|
||||
menu.pointDescription = new PointDescription(latLon.getLatitude(), latLon.getLongitude());
|
||||
} else {
|
||||
menu.pointDescription = pointDescription;
|
||||
}
|
||||
|
||||
menu.latLon = latLon;
|
||||
|
||||
ShareMenuFragment.showInstance(menu);
|
||||
}
|
||||
|
||||
public void share(ShareItem item) {
|
||||
final int zoom = mapActivity.getMapView().getZoom();
|
||||
final String geoUrl = MapUtils.buildGeoUrl(latLon.getLatitude(), latLon.getLongitude(), zoom);
|
||||
final String httpUrl = "http://osmand.net/go?lat=" + ((float) latLon.getLatitude())
|
||||
+ "&lon=" + ((float) latLon.getLongitude()) + "&z=" + zoom;
|
||||
String sms = mapActivity.getString(R.string.send_location_sms_pattern, geoUrl, httpUrl);
|
||||
switch (item) {
|
||||
case MESSAGE:
|
||||
ShareDialog.sendMessage(mapActivity, sms);
|
||||
break;
|
||||
case CLIPBOARD:
|
||||
ShareDialog.sendToClipboard(mapActivity, sms);
|
||||
break;
|
||||
case GEO:
|
||||
Intent mapIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoUrl));
|
||||
mapActivity.startActivity(mapIntent);
|
||||
break;
|
||||
case QR_CODE:
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putFloat("LAT", (float) latLon.getLatitude());
|
||||
bundle.putFloat("LONG", (float) latLon.getLongitude());
|
||||
ShareDialog.sendQRCode(mapActivity, "LOCATION_TYPE", bundle, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public float getLandscapeWidthDp() {
|
||||
return MenuController.LANDSCAPE_WIDTH_DP;
|
||||
}
|
||||
|
||||
public void saveMenu(Bundle bundle) {
|
||||
bundle.putSerializable(KEY_SHARE_MENU_LATLON, latLon);
|
||||
bundle.putSerializable(KEY_SHARE_MENU_POINT_DESC, pointDescription);
|
||||
}
|
||||
|
||||
public static ShareMenu restoreMenu(Bundle bundle, MapActivity mapActivity) {
|
||||
|
||||
ShareMenu menu = new ShareMenu(mapActivity);
|
||||
|
||||
Object pDescObj = bundle.getSerializable(KEY_SHARE_MENU_POINT_DESC);
|
||||
if (pDescObj != null) {
|
||||
menu.pointDescription = (PointDescription) pDescObj;
|
||||
}
|
||||
Object latLonObj = bundle.getSerializable(KEY_SHARE_MENU_LATLON);
|
||||
if (latLonObj != null) {
|
||||
menu.latLon = (LatLon) latLonObj;
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
package net.osmand.plus.mapcontextmenu.other;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.other.ShareMenu.ShareItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||
|
||||
|
||||
public class ShareMenuFragment extends Fragment implements OnItemClickListener {
|
||||
public static final String TAG = "ShareMenuFragment";
|
||||
|
||||
private ArrayAdapter<ShareItem> listAdapter;
|
||||
private ShareMenu menu;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (savedInstanceState != null && getActivity() instanceof MapActivity) {
|
||||
menu = ShareMenu.restoreMenu(savedInstanceState, (MapActivity) getActivity());
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.share_menu_fragment, container, false);
|
||||
|
||||
ListView listView = (ListView) view.findViewById(R.id.list);
|
||||
listAdapter = createAdapter();
|
||||
listView.setAdapter(listAdapter);
|
||||
listView.setOnItemClickListener(this);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
menu.getMapActivity().getContextMenu().setBaseFragmentVisibility(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
menu.getMapActivity().getContextMenu().setBaseFragmentVisibility(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
menu.saveMenu(outState);
|
||||
}
|
||||
|
||||
public static void showInstance(ShareMenu menu) {
|
||||
int slideInAnim = menu.getSlideInAnimation();
|
||||
int slideOutAnim = menu.getSlideOutAnimation();
|
||||
|
||||
ShareMenuFragment fragment = new ShareMenuFragment();
|
||||
fragment.menu = menu;
|
||||
menu.getMapActivity().getSupportFragmentManager().beginTransaction()
|
||||
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
|
||||
.add(R.id.fragmentContainer, fragment, TAG)
|
||||
.addToBackStack(TAG).commit();
|
||||
}
|
||||
|
||||
private ArrayAdapter<ShareItem> createAdapter() {
|
||||
final List<ShareItem> items = menu.getItems();
|
||||
return new ArrayAdapter<ShareItem>(menu.getMapActivity(), R.layout.share_list_item, items) {
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
View v = convertView;
|
||||
if (v == null) {
|
||||
v = menu.getMapActivity().getLayoutInflater().inflate(R.layout.share_list_item, null);
|
||||
}
|
||||
final ShareItem item = getItem(position);
|
||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||
icon.setImageDrawable(menu.getMapActivity().getMyApplication()
|
||||
.getIconsCache().getContentIcon(item.getIconResourceId()));
|
||||
TextView name = (TextView) v.findViewById(R.id.name);
|
||||
name.setText(getContext().getText(item.getTitleResourceId()));
|
||||
return v;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
menu.share(listAdapter.getItem(position));
|
||||
dismissMenu();
|
||||
}
|
||||
|
||||
public void dismissMenu() {
|
||||
if (menu.getMapActivity().getContextMenu().isVisible()) {
|
||||
menu.getMapActivity().getContextMenu().hide();
|
||||
} else {
|
||||
menu.getMapActivity().getSupportFragmentManager().popBackStack();
|
||||
}
|
||||
}
|
||||
|
||||
private int dpToPx(float dp) {
|
||||
Resources r = getActivity().getResources();
|
||||
return (int) TypedValue.applyDimension(
|
||||
COMPLEX_UNIT_DIP,
|
||||
dp,
|
||||
r.getDisplayMetrics()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue