Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-08-17 18:57:02 +02:00
commit 62621c78f6
196 changed files with 5556 additions and 1111 deletions

View file

@ -8,7 +8,6 @@ apply plugin: 'com.android.application'
// APP_EDITION - date stamp of builds
// APP_FEATURES - features +play_market +gps_status -parking_plugin -blackberry -free_version -amazon
// 1. To be done Filter fonts
// <unzip src="OsmAndCore_android.aar" dest=".">
// <patternset>
@ -39,7 +38,7 @@ android {
}
defaultConfig {
minSdkVersion 9
minSdkVersion 14
targetSdkVersion 21
versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode
@ -301,7 +300,9 @@ repositories {
dependencies {
compile project(path: ":OsmAnd-java", configuration: "android")
compile project(":eclipse-compile:appcompat")
compile project(":eclipse-compile:design")
compile project(":cardview")
// compile project(":recyclerview")
compile fileTree(
dir: "libs",
include: ["*.jar"],
@ -311,11 +312,12 @@ dependencies {
"OsmAndCore_android.jar",
"OsmAndCore_wrapper.jar"])
// compile "com.github.ksoichiro:android-observablescrollview:1.5.0"
// compile "com.android.support:appcompat-v7:21.0.3"
// compile "com.android.support:appcompat-v7:22.2.1"
// compile "com.github.shell-software:fab:1.0.5"
legacyCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar"
qtcoredebugCompile "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
qtcoredebugCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
qtcoreCompile "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
qtcoreCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
// compile 'com.android.support:design:22.2.1'
}

View file

@ -13,3 +13,4 @@ split.density=false
target=android-21
dex.force.jumbo=true
android.library.reference.1=../eclipse-compile/appcompat
android.library.reference.2=../eclipse-compile/design

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

BIN
OsmAnd/res/drawable-xxhdpi/map_target_point.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" >
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<Switch
android:id="@+id/check_item"
@ -13,4 +10,4 @@
android:focusable="false"
android:gravity="center_vertical"/>
</RelativeLayout>
</merge>

View file

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/bg_first_usage"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/color_transparent"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:layout_gravity="center_horizontal">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name_osmand"
android:textColor="@color/color_white"
android:textSize="@dimen/first_usage_title_text_size"
android:textStyle="bold"
osmand:typeface="@string/font_roboto_regular"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-thin"
android:text="@string/offline_maps_and_navigation"
android:textColor="@color/color_white"
android:textSize="@dimen/first_usage_title_text_size"
android:layout_marginBottom="27dp"/>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Download map"
android:textColor="@color/color_white"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"/>
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="280dp"
android:layout_height="48dp"
android:layout_gravity="center"
osmand:cardCornerRadius="2dp">
<EditText
android:id="@+id/searchEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="12dp"
android:background="@null"
android:drawableLeft="@drawable/ic_action_search_dark"
android:drawablePadding="12dp"
android:gravity="center_vertical"
android:hint="Enter country name"
android:textSize="@dimen/default_list_text_size"/>
</android.support.v7.widget.CardView>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<Button
android:id="@+id/skip_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_skip"
android:textColor="@color/dashboard_general_button_text_light"/>
</LinearLayout>
</FrameLayout>

View file

@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBox
android:id="@+id/check_item"
@ -16,4 +13,4 @@
android:focusable="false"
android:gravity="center_vertical" />
</RelativeLayout>
</merge>

View file

@ -0,0 +1,94 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_card"
android:layout_marginTop="@dimen/dash_margin"
android:layout_marginBottom="@dimen/dash_margin"
android:layout_marginLeft="@dimen/dash_margin_h"
android:layout_marginRight="@dimen/dash_margin_h"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Options"
android:textColor="?android:textColorPrimary"
android:textSize="20sp"
android:paddingBottom="10dp"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:paddingTop="8dp"
osmand:typeface="@string/font_roboto_medium"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="@dimen/list_header_height"
android:orientation="horizontal">
<net.osmand.plus.widgets.TextViewEx
style="@style/DashboardSubHeader"
android:text="Remove permanently"
osmand:typeface="@string/font_roboto_medium"/>
<include
layout="@layout/check_item_rel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="@dimen/list_header_height"
android:orientation="horizontal">
<net.osmand.plus.widgets.TextViewEx
style="@style/DashboardSubHeader"
android:text="# of rows"
osmand:typeface="@string/font_roboto_medium"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/numbers_from_1_to_10">
</Spinner>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="@dimen/list_header_height"
android:orientation="horizontal">
<Button
android:id="@+id/positive_button"
style="@style/DashboardGeneralButton"
android:layout_width="0dp"
android:gravity="center"
android:layout_weight="1"
android:text="@string/shared_string_ok"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="?attr/dashboard_divider"/>
<Button
android:id="@+id/negative_button"
style="@style/DashboardGeneralButton"
android:layout_width="0dp"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="UNDO" />
</LinearLayout>
</LinearLayout>

View file

@ -1,7 +1,6 @@
<?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"
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_card"

View file

@ -1,109 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<net.osmand.plus.dashboard.NotifyingScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/main_scroll"
android:background="?attr/expandable_list_background">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<fragment
android:id="@+id/mapFragment"
android:layout_marginRight="-3dp"
android:layout_marginLeft="-3dp"
android:layout_marginTop="-3dp"
android:name="net.osmand.plus.dashboard.DashMapFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout android:id="@+id/fragments"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="-40dp"
android:padding="@dimen/dashPadding" >
<LinearLayout android:id="@+id/content"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<!--<fragment-->
<!--xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--android:id="@+id/ParkingFragment"-->
<!--android:name="net.osmand.plus.dashboard.DashParkingFragment"-->
<!--android:layout_marginTop="@dimen/dashCardMargin"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"/>-->
<fragment
android:id="@+id/SearchFragment"
android:name="net.osmand.plus.dashboard.DashSearchFragment"
android:layout_marginTop="@dimen/dashCardMargin"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<fragment
android:id="@+id/RecentsFragment"
android:name="net.osmand.plus.dashboard.DashRecentsFragment"
android:layout_marginTop="@dimen/dashCardMargin"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<fragment
android:id="@+id/FavoritesFragment"
android:name="net.osmand.plus.dashboard.DashFavoritesFragment"
android:layout_marginTop="@dimen/dashCardMargin"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<fragment
android:id="@+id/NotesFragment"
android:name="net.osmand.plus.audionotes.DashAudioVideoNotesFragment"
android:layout_marginTop="@dimen/dashCardMargin"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/TracksFragment"
android:name="net.osmand.plus.monitoring.DashTrackFragment"
android:layout_marginTop="@dimen/dashCardMargin"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<!--<fragment-->
<!--xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--android:name="net.osmand.plus.dashboard.DashDownloadMapsFragment"-->
<!--android:layout_marginTop="@dimen/dashCardMargin"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"/>-->
<fragment
android:id="@+id/UpdateFragment"
android:name="net.osmand.plus.dashboard.DashUpdatesFragment"
android:layout_marginTop="@dimen/dashCardMargin"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<fragment
android:id="@+id/PluginFragment"
android:name="net.osmand.plus.dashboard.DashPluginsFragment"
android:layout_marginTop="@dimen/dashCardMargin"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<!--To make sure that floating button is always visible-->
<View android:layout_width="match_parent"
android:layout_height="@dimen/dashFABMargin"
android:orientation="vertical"/>
</LinearLayout>
</net.osmand.plus.dashboard.NotifyingScrollView>

View file

@ -0,0 +1,27 @@
<?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="@dimen/list_header_height"
android:paddingLeft="@dimen/dialog_content_margin"
android:paddingRight="@dimen/dialog_content_margin"
android:orientation="horizontal">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/text"
style="@style/DashboardSubHeader"
android:layout_marginLeft="0dp"
android:textColor="@color/dashboard_black"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="@string/lorem_ipsum"/>
<include
layout="@layout/check_item_rel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"/>
</LinearLayout>

View file

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/bg_first_usage"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/color_transparent"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:paddingTop="@dimen/first_usage_title_margin"
android:layout_gravity="center_horizontal">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name_osmand"
android:textColor="@color/color_white"
android:textSize="@dimen/first_usage_title_text_size"
android:textStyle="bold"
osmand:typeface="@string/font_roboto_regular"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-thin"
android:text="@string/offline_maps_and_navigation"
android:textColor="@color/color_white"
android:textSize="@dimen/first_usage_title_text_size"/>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Download map"
android:textColor="@color/color_white"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"/>
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="280dp"
android:layout_height="48dp"
android:layout_gravity="center"
osmand:cardCornerRadius="2dp">
<EditText
android:id="@+id/searchEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="12dp"
android:background="@null"
android:drawableLeft="@drawable/ic_action_search_dark"
android:drawablePadding="12dp"
android:gravity="center_vertical"
android:hint="Enter country name"
android:textSize="@dimen/default_list_text_size"/>
</android.support.v7.widget.CardView>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<Button
android:id="@+id/skip_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_skip"
android:textColor="@color/dashboard_general_button_text_light"/>
</LinearLayout>
</FrameLayout>

View file

@ -0,0 +1,91 @@
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="net.osmand.plus.osmedit.EditPoiFragment">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/OsmandLightTheme.DarkActionbar">
<!-- TODO change theme -->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashboard_map_toolbar"
app:contentInsetLeft="72dp"
app:contentInsetStart="72dp"
app:layout_scrollFlags="scroll"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="72dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Name"
android:text="@string/lorem_ipsum"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="72dp"
app:layout_scrollFlags="scroll">
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_weight="1">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableRight="@drawable/ic_action_arrow_drop_down"
android:hint="POI Type"
android:text="@string/lorem_ipsum"/>
</android.support.design.widget.TextInputLayout>
<ImageButton
android:id="@+id/onlineDocumentationButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="bottom"
android:background="@null"
android:src="@drawable/ic_action_help"/>
</LinearLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_white"
app:tabIndicatorColor="@color/osmand_orange"
app:tabSelectedTextColor="@color/osmand_orange"
app:tabTextColor="@android:color/darker_gray"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dashboard_background">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/editTagsList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:saveEnabled="false"/>
<include layout="@layout/poi_tag_list_item"/>
<Button
android:id="@+id/addTagButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add tag"/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Added tags"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/added_tags_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>

View file

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dashboard_background">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/openHoursTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:text="Open hours"
android:textColor="@color/color_black"/>
<TextView
android:id="@+id/contactInfoTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/openHoursTextView"
android:layout_marginLeft="16dp"
android:text="Contact info"
android:textColor="@color/color_black"/>
<ImageView
android:id="@+id/streetImageView"
style="@style/edit_poi_imageview_style"
android:layout_below="@id/contactInfoTextView"
tools:src="@drawable/ic_action_street_name"/>
<EditText
android:id="@+id/streetEditText"
style="@style/create_poi_text_field"
android:layout_below="@id/contactInfoTextView"
android:hint="Street"
android:inputType="text"/>
<ImageView
android:id="@+id/houseNumberImageView"
style="@style/edit_poi_imageview_style"
android:layout_below="@id/streetEditText"
tools:src="@drawable/ic_action_building_number"/>
<EditText
android:id="@+id/houseNumberEditText"
style="@style/create_poi_text_field"
android:layout_below="@id/streetEditText"
android:hint="35"
android:inputType="text"/>
<ImageView
android:id="@+id/phoneImageView"
style="@style/edit_poi_imageview_style"
android:layout_below="@id/houseNumberEditText"
tools:src="@drawable/ic_action_call_dark"/>
<EditText
android:id="@+id/phoneEditText"
style="@style/create_poi_text_field"
android:layout_below="@id/houseNumberEditText"
android:hint="Phone"
android:inputType="phone"/>
<ImageView
android:id="@+id/webSiteImageView"
style="@style/edit_poi_imageview_style"
android:layout_below="@id/phoneEditText"
tools:src="@drawable/ic_world_globe_dark"/>
<EditText
android:id="@+id/webSiteEditText"
style="@style/create_poi_text_field"
android:layout_below="@id/phoneEditText"
android:hint="Web site"
android:inputType="textUri"/>
<ImageView
android:id="@+id/descriptionImageView"
style="@style/edit_poi_imageview_style"
android:layout_below="@id/webSiteEditText"
tools:src="@drawable/ic_action_description"/>
<EditText
android:id="@+id/descriptionEditText"
style="@style/create_poi_text_field"
android:layout_width="match_parent"
android:layout_below="@id/webSiteEditText"
android:hint="Description"
android:inputType="textMultiLine"/>
<View
android:id="@+id/buttonDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/descriptionEditText"
android:background="@color/divider_color"/>
<Button
android:id="@+id/saveButton"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/buttonDivider"
tools:text="Save"
android:textColor="@color/dashboard_general_button_text_light"/>
<Button
android:id="@+id/cancelButton"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/buttonDivider"
android:layout_toLeftOf="@id/saveButton"
android:text="Cancel"
android:textColor="@color/dashboard_general_button_text_light"/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>

View file

@ -47,4 +47,9 @@
android:layout_height="match_parent"
layout="@layout/dashboard_over_map" />
<FrameLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>

View file

@ -0,0 +1,56 @@
<?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:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="@+id/tagEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Tag"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="@+id/valueEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Value"/>
</android.support.design.widget.TextInputLayout>
<ImageButton
android:id="@+id/deleteItemImageButton"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="bottom"
android:src="@drawable/ic_action_close_dark"/>
</LinearLayout>
<View
android:id="@+id/buttonDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/descriptionEditText"
android:background="@color/divider_color"/>
</LinearLayout>

View file

@ -520,7 +520,7 @@
<string name="fast_route_mode">Vinnigste roete</string>
<string name="fast_route_mode_descr">"Skakel aan om vinnigste roete te bereken of skakel af vir kortste roete " </string>
<string name="tiles_to_download_estimated_size">Teen vergroting {0} laai {1} teëls af ({2} MB)</string>
<string name="context_menu_item_download_map">laai kaart af</string>
<string name="shared_string_download_map">laai kaart af</string>
<string name="select_max_zoom_preload_area">Kies maksimum vergroting om vooraf te laai</string>
<string name="maps_could_not_be_downloaded">Hierdie kaart kan nie afgelaai word nie</string>
<string name="continuous_rendering">deurlopende lewering</string>

View file

@ -1901,7 +1901,7 @@ OsmAnd هو المصدر المفتوح و التي يجري تطويرها بن
<string name="daynight_mode_night">ليل</string>
<string name="daynight_mode_auto">الشروق/الغروب</string>
<string name="daynight_mode_sensor">مستشعر الضوء</string>
<string name="context_menu_item_download_map">تحميل الخريطة</string>
<string name="shared_string_download_map">تحميل الخريطة</string>
<string name="select_max_zoom_preload_area">حدد أقصى تقريب للتحميل المسبق</string>
<string name="maps_could_not_be_downloaded">لم يمكن تحميل هذه الخريطة</string>
<string name="download_type_to_filter">اكتب للتصفية</string>

View file

@ -1445,7 +1445,7 @@
<string name="fast_route_mode">Najchutčejšy šliach</string>
<string name="fast_route_mode_descr">"Paznačyć kab raźlіčvać najchutčejšy šliach, cі źniać paznaku dlia najkaraciejšaha šliachu "</string>
<string name="tiles_to_download_estimated_size">Na maštabie {0} zahruzіć {1} frahmientaŭ ({2} MB)</string>
<string name="context_menu_item_download_map">Spampavać mapu</string>
<string name="shared_string_download_map">Spampavać mapu</string>
<string name="select_max_zoom_preload_area">Vybierycie maksіmaĺnaje pavielіčeńnie dlia papiaredniaj zahruzkі</string>
<string name="maps_could_not_be_downloaded">Hetaja mapa nie moža być zahružana</string>
<string name="continuous_rendering">Biespierapynnaja admalioŭka</string>

View file

@ -916,7 +916,7 @@
<string name="fast_route_mode">Найхутчэйшы шлях</string>
<string name="fast_route_mode_descr">Пазначыць каб разьлічваць найхутчэйшы шлях, ці зьняць пазнаку для найкарацейшага шляху </string>
<string name="tiles_to_download_estimated_size">На маштабе {0} сьцягнуць {1} фрагмэнтаў ({2} МБ)</string>
<string name="context_menu_item_download_map">Сьцягнуць мапу</string>
<string name="shared_string_download_map">Сьцягнуць мапу</string>
<string name="select_max_zoom_preload_area">Выберыце максімальнае павелічэньне для папярэдняй загрузкі</string>
<string name="maps_could_not_be_downloaded">Гэтую мапу нельга сьцягнуць</string>
<string name="continuous_rendering">Бесперапынная адмалёўка</string>

View file

@ -1171,7 +1171,7 @@ OsmAnd е с отворен код и активно да се развива.
<string name="fast_route_mode">Най-бърз маршрут</string>
<string name="fast_route_mode_descr">Отметнете за изчисляване на най-бърз маршрут. Ако няма отметка се изчислява най-къс маршрут. </string>
<string name="tiles_to_download_estimated_size">При мащаб {0} свалете {1} плочки ({2} MB)</string>
<string name="context_menu_item_download_map">Сваляне на карта</string>
<string name="shared_string_download_map">Сваляне на карта</string>
<string name="select_max_zoom_preload_area">Изберете максималният мащаб</string>
<string name="maps_could_not_be_downloaded">Тази карта не може да бъде свалена</string>
<string name="continuous_rendering">Непрекъснато изчертаване</string>

View file

@ -516,7 +516,7 @@
<string name="shared_string_select_all">Selecciona-ho tot</string>
<string name="fast_route_mode">La ruta més ràpida</string>
<string name="fast_route_mode_descr">Activeu per calcular la ruta més ràpida o desactiveu per calcular la més curta </string>
<string name="context_menu_item_download_map">Baixa el mapa</string>
<string name="shared_string_download_map">Baixa el mapa</string>
<string name="tiles_to_download_estimated_size">Per al nivell de zoom {0} es baixaran {1} tessel·les ({2} MB)</string>
<string name="shared_string_ok">D\'acord</string>
<string name="shared_string_no_thanks">No, gràcies</string>

View file

@ -459,7 +459,7 @@
<string name="fast_route_mode">Nejrychlejší trasa</string>
<string name="fast_route_mode_descr">Zapněte pro výpočet nejrychlejší trasy, vypněte, pokud chcete hledat tu nejkratší </string>
<string name="tiles_to_download_estimated_size">Pro zvětšení {0} je třeba stáhnout {1} mapových dlaždic, celkem {2} MB</string>
<string name="context_menu_item_download_map">Stáhnout mapu</string>
<string name="shared_string_download_map">Stáhnout mapu</string>
<string name="select_max_zoom_preload_area">Vyberte maximální zvětšení stahovaných map</string>
<string name="maps_could_not_be_downloaded">Tuto mapu nelze stáhnout</string>
<string name="continuous_rendering">Průběžné vykreslování</string>

View file

@ -844,7 +844,7 @@
<string name="fast_route_mode">Hurtigste rute</string>
<string name="fast_route_mode_descr">Aktiver for at beregne den hurtigste rute. Deaktiver for at beregne korteste rute </string>
<string name="tiles_to_download_estimated_size">Ved zoom {0} hent {1} kortfliser ({2} MB)</string>
<string name="context_menu_item_download_map">Hent kort</string>
<string name="shared_string_download_map">Hent kort</string>
<string name="select_max_zoom_preload_area">Vælg maksimal zoom der skal indlæses på forhånd</string>
<string name="maps_could_not_be_downloaded">Kortet kunne ikke hentes</string>
<string name="continuous_rendering">Kontinuerlig kortoptegning</string>

View file

@ -823,7 +823,7 @@
<string name="fast_route_mode">Schnellste Route</string>
<string name="fast_route_mode_descr">Auswählen für schnellste oder deaktivieren für kürzeste Route</string>
<string name="tiles_to_download_estimated_size">Bei Zoomlevel {0} lade {1} Kacheln\n ({2} MB)</string>
<string name="context_menu_item_download_map">Karte herunterladen</string>
<string name="shared_string_download_map">Karte herunterladen</string>
<string name="select_max_zoom_preload_area">Wähle maximale zu ladende Vergrößerung</string>
<string name="maps_could_not_be_downloaded">Diese Karte konnte nicht geladen werden</string>
<string name="continuous_rendering">Kontin. Kartenaufbau</string>

View file

@ -686,7 +686,7 @@
<string name="fast_route_mode">Ταχύτερη διαδρομή</string>
<string name="fast_route_mode_descr">Ενεργοποίηση για υπολογισμό ταχύτερης διαδρομής ή για απενεργοποίηση συντομότερης διαδρομής </string>
<string name="tiles_to_download_estimated_size">Στη κλίμακα {0} λήψη {1} πλακίδια ({2} MB)</string>
<string name="context_menu_item_download_map">Λήψη χάρτη</string>
<string name="shared_string_download_map">Λήψη χάρτη</string>
<string name="select_max_zoom_preload_area">Επιλέξτε τη μέγιστη μεγέθυνση για προφόρτωση</string>
<string name="maps_could_not_be_downloaded">Αυτός ο χάρτης δεν μπορεί να ληφθεί</string>
<string name="continuous_rendering">Συνεχής απεικόνιση</string>

View file

@ -1613,7 +1613,7 @@
<string name="fast_route_mode">Ruta más rápida</string>
<string name="fast_route_mode_descr">"Active para calcular la ruta más rápida o desactive para la más corta "</string>
<string name="tiles_to_download_estimated_size">En la ampliación {0}, descarga {1} teselas ({2} MB)</string>
<string name="context_menu_item_download_map">Descargar mapa</string>
<string name="shared_string_download_map">Descargar mapa</string>
<string name="select_max_zoom_preload_area">Elige la ampliación máxima para precargar</string>
<string name="maps_could_not_be_downloaded">No se pudo descargar el mapa</string>
<string name="continuous_rendering">Visualización continua</string>

View file

@ -406,7 +406,7 @@
<string name="fast_route_mode">Ruta más rápida</string>
<string name="fast_route_mode_descr">"Habilitar para calcular la ruta más rápida o deshabilitar para la ruta más corta "</string>
<string name="tiles_to_download_estimated_size">En acercamiento {0} descarga {1} teselas ({2} MB)</string>
<string name="context_menu_item_download_map">Descargar mapa</string>
<string name="shared_string_download_map">Descargar mapa</string>
<string name="select_max_zoom_preload_area">Seleccione el acercamiento máximo para precargar</string>
<string name="maps_could_not_be_downloaded">Este mapa no se pudo descargar</string>
<string name="continuous_rendering">Visualización continua</string>

View file

@ -814,7 +814,7 @@
<string name="fast_route_mode">Biderik azkarrena</string>
<string name="fast_route_mode_descr">Gaitu biderik azkarrenarentzat edo ezgaitu biderik motzenarentzat</string>
<string name="tiles_to_download_estimated_size">{0} zoomean deskargatu {1} tesela ({2} MB)</string>
<string name="context_menu_item_download_map">Mapa deskargatu</string>
<string name="shared_string_download_map">Mapa deskargatu</string>
<string name="select_max_zoom_preload_area">Aukeratu aurrekargatzeko gehienezko zooma</string>
<string name="maps_could_not_be_downloaded">Mapa ezin izan da deskargatu</string>
<string name="continuous_rendering">Etengabeko errenderizazioa</string>

View file

@ -657,7 +657,7 @@
<string name="shared_string_select_all">انتخاب همه</string>
<string name="fast_route_mode">سریعترین مسیر</string>
<string name="fast_route_mode_descr">فعال کنید تا مسیر سریعتر محاسبه شود یا غیرفعال کنید تا مسیر کوتاهتر محاسبه شود </string>
<string name="context_menu_item_download_map">دانلود نقشه</string>
<string name="shared_string_download_map">دانلود نقشه</string>
<string name="select_max_zoom_preload_area">انتخاب حداکثر میزان بزرگنمایی برای پیش فرض</string>
<string name="show_point_options">استفاده از مکان به عنوان…</string>

View file

@ -234,7 +234,7 @@
<string name="shared_string_select_all">Valitse kaikki</string>
<string name="shared_string_refresh">Päivitä</string>
<string name="fast_route_mode">Nopein reitti</string>
<string name="context_menu_item_download_map">Lataa kartta</string>
<string name="shared_string_download_map">Lataa kartta</string>
<string name="context_menu_item_search_transport">Etsi kulkuneuvoa</string>

View file

@ -399,7 +399,7 @@
<string name="fast_route_mode">Itinéraire le plus rapide</string>
<string name="fast_route_mode_descr">"Activer pour calculer l\'itinéraire le plus rapide et désactiver pour calculer l\'itinéraire le plus court "</string>
<string name="tiles_to_download_estimated_size">Le zoom {0} télécharge {1} carreaux ({2} Mb )</string>
<string name="context_menu_item_download_map">Télécharger la carte</string>
<string name="shared_string_download_map">Télécharger la carte</string>
<string name="select_max_zoom_preload_area">Sélectionnez le zoom maximum pour précharger la zone visible</string>
<string name="maps_could_not_be_downloaded">Impossible de télécharger cette carte</string>
<string name="continuous_rendering">Affichage continu</string>

View file

@ -1339,7 +1339,7 @@
<string name="fast_route_mode">Itinerario máis rápido</string>
<string name="fast_route_mode_descr">"Active isto para calcular a ruta máis rápida ou desactíveo para a máis curta "</string>
<string name="tiles_to_download_estimated_size">Na ampliación {0} descargar {1} teselas ({2} MB)</string>
<string name="context_menu_item_download_map">Descargar mapa</string>
<string name="shared_string_download_map">Descargar mapa</string>
<string name="select_max_zoom_preload_area">Seleccionar a ampliaciń máxima que pré-cargar</string>
<string name="maps_could_not_be_downloaded">Non foi posíbel descargar este mapa</string>
<string name="continuous_rendering">Renderizado continuo</string>

View file

@ -713,7 +713,7 @@
<string name="fast_route_mode">המסלול המהיר ביותר</string>
<string name="fast_route_mode_descr">"יש להפעיל כדי לחשב את המסלול המהיר ביותר או לנטרל כדי לקבל את המסלול הקצר ביותר "</string>
<string name="tiles_to_download_estimated_size">ברמת תקריב {0} יש להוריד {1} אריחים ({2} מ״ב)</string>
<string name="context_menu_item_download_map">הורדת המפה</string>
<string name="shared_string_download_map">הורדת המפה</string>
<string name="select_max_zoom_preload_area">יש לבחור את רמת התקריב המרבית כדי לטעון מראש</string>
<string name="maps_could_not_be_downloaded">לא ניתן להוריד מפה זאת</string>
<string name="continuous_rendering">עיבוד תמונה רציף</string>

View file

@ -511,7 +511,7 @@
<string name="use_high_res_maps">Zaslon visoke razlučivosti</string>
<string name="phone">Telefon</string>
<string name="download_type_to_filter">upišite za filtriranje</string>
<string name="context_menu_item_download_map">Preuzmi kartu</string>
<string name="shared_string_download_map">Preuzmi kartu</string>
<string name="maps_could_not_be_downloaded">Ova karta se ne može preuzeti</string>
<string name="daynight">Dnevni/noćni način rada</string>
<string name="daynight_descr">Odaberite pravilo za izmjenu između dnevnog i noćnog načina rada</string>

View file

@ -454,7 +454,7 @@
<string name="fast_route_mode">Leggyorsabb útvonal</string>
<string name="fast_route_mode_descr">Leggyorsabb útvonal kiszámításának engedélyezése, vagy tiltása a legrövidebb útért </string>
<string name="tiles_to_download_estimated_size">{0} nagyításnál {1} képkocka letöltése ({2} Mb )</string>
<string name="context_menu_item_download_map">Térkép letöltése</string>
<string name="shared_string_download_map">Térkép letöltése</string>
<string name="select_max_zoom_preload_area">Maximális nagyítás kiválasztása a látható terület előtöltéséhez</string>
<string name="maps_could_not_be_downloaded">Ezt a térképet nem lehet letölteni</string>
<string name="continuous_rendering">Folyamatos megjelenítés</string>

View file

@ -381,7 +381,7 @@
<string name="fast_route_mode">Percorso più veloce</string>
<string name="fast_route_mode_descr">Abilita per calcolare il percorso più veloce o disabilita per il percorso più corto </string>
<string name="tiles_to_download_estimated_size">Per lo zoom {0} scarica {1} tasselli ({2} MB)</string>
<string name="context_menu_item_download_map">Download mappa</string>
<string name="shared_string_download_map">Download mappa</string>
<string name="select_max_zoom_preload_area">Seleziona lo zoom massimo da precaricare</string>
<string name="maps_could_not_be_downloaded">Non è stato possibile scaricare questa mappa</string>
<string name="continuous_rendering">Disegno continuo</string>

View file

@ -218,7 +218,7 @@ MB)をダウンロードしますか?</string>
<string name="fast_route_mode_descr">"有効化なら目的地までの最速ルートで計算、無効化なら最短ルートで計算 "</string>
<string name="tiles_to_download_estimated_size">ズームレベル {0}で
{1} 件のタイル({2} MB)をダウンロード</string>
<string name="context_menu_item_download_map">マップをダウンロード</string>
<string name="shared_string_download_map">マップをダウンロード</string>
<string name="select_max_zoom_preload_area">プリロードする最大ズームを選択</string>
<string name="maps_could_not_be_downloaded">このマップはダウンロードできませんでした</string>

View file

@ -455,7 +455,7 @@
<string name="fast_route_mode">უსწრაფესი გზა</string>
<string name="fast_route_mode_descr">"ჩართეთ უსწრაფესი გზის დასათვლელად ან გამორთეთ უმოკლესისათვის "</string>
<string name="tiles_to_download_estimated_size">გადიდებისას {0} გადმოსაწერია {1} ნაწილი ({2} MB)</string>
<string name="context_menu_item_download_map">რუკის გადმოწერა</string>
<string name="shared_string_download_map">რუკის გადმოწერა</string>
<string name="select_max_zoom_preload_area">აირჩიეთ მაქსიმალური გადიდება ჩასატვირთად</string>
<string name="maps_could_not_be_downloaded">რუკის გადმოწერა შეუძლებელია</string>
<string name="continuous_rendering">გაგრძელებადი რენდერი</string>

View file

@ -490,7 +490,7 @@
<string name="fast_route_mode">가장 빠른 경로</string>
<string name="fast_route_mode_descr">"가장 빠른 경로를 활성화하거나 or 가장 짧은 경로를 비활성화합니다 "</string>
<string name="tiles_to_download_estimated_size">줌에서 {0} 다운로드 {1} 타일 ({2} MB)</string>
<string name="context_menu_item_download_map">맵 다운로드</string>
<string name="shared_string_download_map">맵 다운로드</string>
<string name="select_max_zoom_preload_area">가시 영역을 미리 로드하기 위한 최대 줌 선택</string>
<string name="maps_could_not_be_downloaded">맵을 다운로드할 수 없습니다</string>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="first_usage_title_margin">50dp</dimen>
<dimen name="first_usage_title_text_size">30sp</dimen>
</resources>

View file

@ -595,7 +595,7 @@
<string name="fast_route_mode">Greičiausias maršrutas</string>
<string name="fast_route_mode_descr">Įjunkite, kad būtų skaičiuojamas greičiausias maršrutas. Priešingu atveju bus skaičiuojamas trumpiausias maršrutas </string>
<string name="tiles_to_download_estimated_size">Esant {0} dydžiui parsiųsti {1} žemėlapio lakštus ({2} MB)</string>
<string name="context_menu_item_download_map">Parsiųsti žemėlapį</string>
<string name="shared_string_download_map">Parsiųsti žemėlapį</string>
<string name="select_max_zoom_preload_area">Pasirinkite didžiausią dydį, kurį parsiųsti</string>
<string name="maps_could_not_be_downloaded">Šio žemėlapio parsiųsti nepavyko</string>
<string name="continuous_rendering">Nenutrūkstamas vaizdavimas</string>

View file

@ -447,7 +447,7 @@
<string name="fast_route_mode">Ātrākais maršruts</string>
<string name="fast_route_mode_descr">Iespējot, lai rēķinātu ātrāko maršrutu vai atspējot, lai rēķinātu īsāko maršrutu </string>
<string name="tiles_to_download_estimated_size">Palielinājumam {0} lejupielādēt {1} attēlus ({2} MB)</string>
<string name="context_menu_item_download_map">Lejupielādēt karti</string>
<string name="shared_string_download_map">Lejupielādēt karti</string>
<string name="select_max_zoom_preload_area">Izvēlēties maksimālo palielinājumu pirmsielādei</string>
<string name="maps_could_not_be_downloaded">Karti nevar lejupielādēt</string>
<string name="continuous_rendering">Nepārtrauktā renderēšana</string>

View file

@ -173,7 +173,7 @@
<string name="shared_string_select_all">सर्व निवडा</string>
<string name="fast_route_mode">वेगवान रस्ता</string>
<string name="fast_route_mode_descr">निवडा सर्वात वेगवान रस्त्यासाठी किंवा निवड काढा सर्वात जवळच्या रस्त्यासाठी </string>
<string name="context_menu_item_download_map">नकाशा डाउनलोड करा</string>
<string name="shared_string_download_map">नकाशा डाउनलोड करा</string>
<string name="poi_context_menu_website">पिओआय वेबसाइट दाखवा</string>
<string name="poi_context_menu_call">पिओआय फोन दाखवा</string>
<string name="website">वेबसाइट</string>

View file

@ -402,7 +402,7 @@
<string name="fast_route_mode">Raskeste rute</string>
<string name="fast_route_mode_descr">Aktiver for å beregne raskeste rute eller deaktiver for korteste rute </string>
<string name="tiles_to_download_estimated_size">Ved zoom {0} last ned {1} fliser ({2} MB)</string>
<string name="context_menu_item_download_map">Last ned kart</string>
<string name="shared_string_download_map">Last ned kart</string>
<string name="renderers">Vektor-opptegning</string>
<string name="renderers_descr">Velg utseende på opptegningen</string>
<string name="website">Nettsted</string>

View file

@ -476,7 +476,7 @@
<string name="fast_route_mode">Snelste route</string>
<string name="fast_route_mode_descr">Activeer voor de snelste route of deactiveer voor de kortste route </string>
<string name="tiles_to_download_estimated_size">Op zoom {0} omvat de download {1} kaartsegmenten ({2} MB)</string>
<string name="context_menu_item_download_map">Download kaart</string>
<string name="shared_string_download_map">Download kaart</string>
<string name="select_max_zoom_preload_area">Kies maximum zoom om vooraf te laden</string>
<string name="maps_could_not_be_downloaded">Kaarten konden niet worden gedownload</string>
<string name="continuous_rendering">Continue kaartgeneratie</string>

View file

@ -301,7 +301,7 @@
<string name="fast_route_mode">Najszybsza trasa</string>
<string name="fast_route_mode_descr">"Wyznacza najszybszą trasę zamiast najkrótszej "</string>
<string name="tiles_to_download_estimated_size">Na poziomie {0} pobrano {1} kafelków ({2} MB)</string>
<string name="context_menu_item_download_map">Pobierz mapę</string>
<string name="shared_string_download_map">Pobierz mapę</string>
<string name="select_max_zoom_preload_area">Wybierz maksymalne przybliżenie do pobrania</string>
<string name="maps_could_not_be_downloaded">Nie udało się pobrać tej mapy</string>
<string name="continuous_rendering">Rysowanie ciągłe</string>

View file

@ -1416,7 +1416,7 @@
<string name="fast_route_mode">Rota mais rápida</string>
<string name="fast_route_mode_descr">"Ative para calcular a rota mais rápida ou desative para calcular a rota mais curta "</string>
<string name="tiles_to_download_estimated_size">No zoom {0}: baixar {1} imagens ({2} MB)</string>
<string name="context_menu_item_download_map">Baixar mapa</string>
<string name="shared_string_download_map">Baixar mapa</string>
<string name="select_max_zoom_preload_area">Selecionar zoom máximo para pré-carregar</string>
<string name="maps_could_not_be_downloaded">Não é possível baixar este mapa</string>
<string name="continuous_rendering">Renderização contínua</string>

View file

@ -65,7 +65,7 @@
<string name="fast_route_mode">Caminho mais rápido</string>
<string name="fast_route_mode_descr">Ative para calcular a rota mais rápida ou desative para calcular a rota mais curta </string>
<string name="tiles_to_download_estimated_size">Zoom {0}: baixar {1} imagens ({2} MB )</string>
<string name="context_menu_item_download_map">Baixar mapa</string>
<string name="shared_string_download_map">Baixar mapa</string>
<string name="select_max_zoom_preload_area">Zoom máximo para baixar</string>
<string name="maps_could_not_be_downloaded">Não é possível fazer o download deste mapa</string>
<string name="continuous_rendering">Processamento contínuo</string>

View file

@ -738,7 +738,7 @@
<string name="fast_route_mode">Cea mai rapidă rută</string>
<string name="fast_route_mode_descr">Activați pentru a calcula ruta cea mai rapidă sau dezactivați pentru ruta cea mai scurtă </string>
<string name="tiles_to_download_estimated_size">La nivelul de zoom {0} se descarcă {1} porțiuni ({2} MB)</string>
<string name="context_menu_item_download_map">Descarcă harta</string>
<string name="shared_string_download_map">Descarcă harta</string>
<string name="select_max_zoom_preload_area">Selectați nivelul de zoom maxim pentru pre-încărcare</string>
<string name="maps_could_not_be_downloaded">Harta nu s-a putut descărca</string>
<string name="continuous_rendering">Randare continuă</string>

View file

@ -501,7 +501,7 @@
<string name="fast_route_mode">Скоростной маршрут</string>
<string name="fast_route_mode_descr">Расчёт скоростного маршрута вместо кратчайшего </string>
<string name="tiles_to_download_estimated_size">На масштабе {0} загрузить {1} тайлов ({2} Mb )</string>
<string name="context_menu_item_download_map">Загрузить карту</string>
<string name="shared_string_download_map">Загрузить карту</string>
<string name="select_max_zoom_preload_area">Выберите максимальный масштаб для загрузки видимой области</string>
<string name="maps_could_not_be_downloaded">Выбранная карта не может быть загружена</string>
<string name="continuous_rendering">Непрерывный рендеринг</string>

View file

@ -1313,7 +1313,7 @@
<string name="shared_string_select_all">Ischerta totu</string>
<string name="fast_route_mode">Àndala prus lestra</string>
<string name="tiles_to_download_estimated_size">Pro su zoom {0} iscàrriga {1} tasseddos ({2} MB)</string>
<string name="context_menu_item_download_map">Iscàrriga mapa</string>
<string name="shared_string_download_map">Iscàrriga mapa</string>
<string name="maps_could_not_be_downloaded">No est istadu possìbile iscarrigare custa mapa</string>
<string name="show_point_options">Imprea sa positzione …</string>
<string name="renderer_load_sucess">Disinnu carrigadu</string>

View file

@ -571,7 +571,7 @@
<string name="fast_route_mode">Najrýchlejšia trasa</string>
<string name="fast_route_mode_descr">Zapnite na výpočet najrýchlejšej trasy alebo vypnite pre najkratšiu trasu </string>
<string name="tiles_to_download_estimated_size">Pri priblížení {0} sa stiahne {1} dlaždíc ({2} Mb )</string>
<string name="context_menu_item_download_map">Stiahnuť mapu</string>
<string name="shared_string_download_map">Stiahnuť mapu</string>
<string name="select_max_zoom_preload_area">Vybrať max. priblíženie viditeľnej oblasti na načítanie</string>
<string name="maps_could_not_be_downloaded">Táto mapa sa nedá stiahnuť</string>
<string name="continuous_rendering">Postupné vykresľovanie</string>

View file

@ -825,7 +825,7 @@
<string name="shared_string_select_all">Izberi vse</string>
<string name="shared_string_refresh">Osveži</string>
<string name="tiles_to_download_estimated_size">Pri povečavi {0} prejmi {1} ploščic ({2} MB)</string>
<string name="context_menu_item_download_map">Prejem zemljevida</string>
<string name="shared_string_download_map">Prejem zemljevida</string>
<string name="select_max_zoom_preload_area">Izberite največjo povečavo za predhodno nalaganje</string>
<string name="maps_could_not_be_downloaded">Tega zemljevida ni mogoče prejeti</string>
<string name="continuous_rendering">Stalno izrisovanje</string>

View file

@ -643,7 +643,7 @@
<string name="fast_route_mode">Snabbaste vägen</string>
<string name="fast_route_mode_descr">Aktivera för att beräkna den snabbaste vägen eller inaktivera för den kortaste vägen </string>
<string name="tiles_to_download_estimated_size">Vid zoom {0} hämta {1} kartbitar ({2} MB)</string>
<string name="context_menu_item_download_map">Ladda ner karta</string>
<string name="shared_string_download_map">Ladda ner karta</string>
<string name="poi_filter_sightseeing">Sevärdheter</string>
<string name="index_settings">Hantera kartfiler</string>
<string name="tip_day_night_mode_t_v2">"Kartans utseende kan för vissa vektorkartor ändras mellan dag (ljusare) och natt (mörkare).

View file

@ -393,7 +393,7 @@
<string name="shared_string_select_all">Hepsini seç</string>
<string name="shared_string_refresh">Yenile</string>
<string name="fast_route_mode">En hızlı rota</string>
<string name="context_menu_item_download_map">Haritayı indir</string>
<string name="shared_string_download_map">Haritayı indir</string>
<string name="maps_could_not_be_downloaded">Bu harita indirilemedi</string>
<string name="phone">Telefon</string>
<string name="use_high_res_maps">Yüksek çözünürlüklü ekran</string>

View file

@ -520,7 +520,7 @@
<string name="fast_route_mode">Найшвидший маршрут</string>
<string name="fast_route_mode_descr">Надавати перевагу найшвидшому маршруту перед найкоротшим </string>
<string name="tiles_to_download_estimated_size">На масштабі{0} завантажувати {1} тайли ({2} MB)</string>
<string name="context_menu_item_download_map">Завантажити мапу</string>
<string name="shared_string_download_map">Завантажити мапу</string>
<string name="select_max_zoom_preload_area">Вибрати максимальний масштаб для завантаження</string>
<string name="maps_could_not_be_downloaded">Дана мапа не може бути завантажена</string>
<string name="continuous_rendering">Безперервний рендеринг</string>

View file

@ -287,7 +287,7 @@ Translator: Le Viet Thanh; email: lethanhx2k@gmail.com --><resources>
<string name="fast_route_mode">Nhanh nhất</string>
<string name="fast_route_mode_descr">Bật/tắt tính năng tìm đường đi nhanh nhất</string>
<string name="tiles_to_download_estimated_size">Tại mức zoom {0} tải về {1} tiles ({2} MB)</string>
<string name="context_menu_item_download_map">Tải bản đồ</string>
<string name="shared_string_download_map">Tải bản đồ</string>
<string name="select_max_zoom_preload_area">Lựa chọn Zoom lớn nhất để tải lại</string>
<string name="maps_could_not_be_downloaded">Bản đồ này không tải được</string>

View file

@ -766,7 +766,7 @@
<string name="shared_string_select_all">全部选中</string>
<string name="fast_route_mode">最快路线</string>
<string name="fast_route_mode_descr">打开则规划最快路线,关闭则计算最短路线 </string>
<string name="context_menu_item_download_map">下载地图</string>
<string name="shared_string_download_map">下载地图</string>
<string name="maps_could_not_be_downloaded">此地图无法下载</string>
<string name="rendering_exception">渲染选中区域时发生错误</string>
<string name="show_point_options">使用位置 …</string>

View file

@ -628,7 +628,7 @@
<string name="fast_route_mode">最快路線</string>
<string name="fast_route_mode_descr">啟用為預估最快的路線而停用則為最短的路線 </string>
<string name="tiles_to_download_estimated_size">在縮放第{0}級別,下載{1}張地圖圖磚({2} MB)</string>
<string name="context_menu_item_download_map">下載地圖</string>
<string name="shared_string_download_map">下載地圖</string>
<string name="select_max_zoom_preload_area">選擇要預載的最大縮放級別</string>
<string name="maps_could_not_be_downloaded">此地圖無法下載</string>
<string name="continuous_rendering">連續繪製</string>

View file

@ -151,4 +151,7 @@
<color name="spinner_list_background_light">#eeeeee</color>
<color name="spinner_list_background_dark">#303030</color>
<color name="inactive_iteme_orange">#ffc87f</color>
<color name="osmand_orange_dark">#e68200</color>
<color name="divider_color">#ccc</color>
</resources>

View file

@ -3,4 +3,6 @@
<dimen name="app_defaultsize_h">400dip</dimen>
<dimen name="app_minimumsize_w">400dip</dimen>
<dimen name="app_minimumsize_h">200dip</dimen>
<dimen name="first_usage_title_margin">87dp</dimen>
<dimen name="first_usage_title_text_size">35sp</dimen>
</resources>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="numbers_from_1_to_10">
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
</string-array>
</resources>

View file

@ -1905,7 +1905,7 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="fast_route_mode">Fastest route</string>
<string name="fast_route_mode_descr">Enable to calculate fastest route or disable for shortest route </string>
<string name="tiles_to_download_estimated_size">At zoom {0} download {1} tiles ({2} MB)</string>
<string name="context_menu_item_download_map">Download map</string>
<string name="shared_string_download_map">Download map</string>
<string name="select_max_zoom_preload_area">Select maximum zoom to preload</string>
<string name="maps_could_not_be_downloaded">This map could not be downloaded</string>
<string name="continuous_rendering">Continuous rendering</string>
@ -2230,4 +2230,10 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="successfully_uploaded_pattern">Successfully uploaded {0}/{1}</string>
<string name="try_again">Try again</string>
<string name="error_message_pattern">Error: {0}</string>
<string name="dahboard_options_dialog_title">Dashboard options</string>
<string name="shared_string_card_was_hidden">Card was hidden</string>
<string name="shared_string_undo">UNDO</string>
<string name="shared_string_skip">Skip</string>
<string name="app_name_osmand">OsmAnd</string>
<string name="offline_maps_and_navigation"><![CDATA[Offline Maps\n& Navigation]]></string>
</resources>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Dialog_Fullscreen" parent="android:Theme">
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
@ -74,18 +75,29 @@
<item name="switch_ex_background">@drawable/switch_ex_background_light</item>
<item name="switch_ex_text_color">@color/switch_ex_button_text_light</item>
<item name="bg_plugin_logo_disabled">@drawable/bg_plugin_logo_disabled_light</item>
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_light</item>
<item name="expandable_list_item_background">@drawable/expandable_list_item_background_light</item>
<item name="plugin_details_install_header_bg">
@color/plugin_details_install_header_bg_light
</item>
<item name="expandable_list_item_background">
@drawable/expandable_list_item_background_light
</item>
<item name="expandable_list_background">@color/list_item_light</item>
<item name="size_progress_bar">@drawable/size_progressbar_light</item>
<item name="dash_parking_bg">@drawable/dash_parking_light</item>
<item name="osmo_header_background">@color/osmo_header_light</item>
<item name="dashboard_subheader_text_color">@color/dashboard_subheader_text_light</item>
<item name="dashboard_general_button_text_color">@color/dashboard_general_button_text_light</item>
<item name="dashboard_general_button_text_color">
@color/dashboard_general_button_text_light
</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/check_light</item>
<item name="android:textColorPrimary">@color/color_black</item>
<item name="spinnerItemTextColor">@color/color_black</item>
<item name="spinnerListBackground">@color/spinner_list_background_light</item>
<item name="colorButtonNormal">@color/color_white</item>
<item name="colorPrimary">@color/osmand_orange</item>
<item name="colorPrimaryDark">@color/osmand_orange_dark</item>
<!--<item name="colorAccent">@color/</item>-->
<item name="android:actionModeBackground">@color/actionbar_light_color</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
@ -114,25 +126,29 @@
<item name="switch_ex_background">@drawable/switch_ex_background_dark</item>
<item name="switch_ex_text_color">@color/switch_ex_button_text_dark</item>
<item name="bg_plugin_logo_disabled">@drawable/bg_plugin_logo_disabled_dark</item>
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_dark</item>
<item name="expandable_list_item_background">@drawable/expandable_list_item_background_dark</item>
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_dark
</item>
<item name="expandable_list_item_background">
@drawable/expandable_list_item_background_dark
</item>
<item name="expandable_list_background">@color/list_item_dark</item>
<item name="size_progress_bar">@drawable/size_progressbar_dark</item>
<item name="dash_parking_bg">@drawable/dash_parking_dark</item>
<item name="osmo_header_background">@color/osmo_header_dark</item>
<item name="dashboard_subheader_text_color">@color/dashboard_subheader_text_dark</item>
<item name="dashboard_general_button_text_color">@color/dashboard_general_button_text_dark</item>
<item name="dashboard_general_button_text_color">@color/dashboard_general_button_text_dark
</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/check_dark</item>
<item name="android:textColorPrimary">@color/color_white</item>
<item name="spinnerItemTextColor">@color/color_white</item>
<item name="spinnerListBackground">@color/spinner_list_background_dark</item>
<item name="colorButtonNormal">@color/color_white</item>
<item name="android:actionModeBackground">@color/actionbar_dark_color</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarDark</item>
</style>
<!-- Standard action bar override -->
<style name="Widget.Styled.ActionBarDark" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">@color/actionbar_dark_color</item>
@ -164,10 +180,17 @@
<item name="android:textColor">@color/color_white</item>
</style>
<style name="OsmandLightTheme.DarkActionbar">
<item name="android:textColorPrimary">@color/color_white</item>
<item name="android:textColorSecondary">@color/inactive_iteme_orange</item>
<item name="android:textColorHint">@color/inactive_iteme_orange</item>
<!--<item name="actionMenuTextColor">@color/color_white</item>-->
</style>
<!-- Dialog popup -->
<style name="Animations" />
<style name="Animations"/>
<!-- PopDownMenu -->
<style name="Animations.PopDownMenu" />
<style name="Animations.PopDownMenu"/>
<style name="Animations.PopDownMenu.Left">
<item name="@android:windowEnterAnimation">@anim/grow_from_topleft_to_bottomright</item>
@ -185,7 +208,7 @@
</style>
<!-- PopUpMenu -->
<style name="Animations.PopUpMenu" />
<style name="Animations.PopUpMenu"/>
<style name="Animations.PopUpMenu.Left">
<item name="@android:windowEnterAnimation">@anim/grow_from_bottomleft_to_topright</item>
@ -202,5 +225,19 @@
<item name="@android:windowExitAnimation">@anim/shrink_from_top</item>
</style>
<style name="create_poi_text_field">
<item name="android:layout_marginTop">8dp</item>
<item name="android:layout_marginRight">16dp</item>
<item name="android:layout_marginLeft">72dp</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
</style>
<style name="edit_poi_imageview_style">
<item name="android:layout_marginTop">16dp</item>
<item name="android:layout_marginLeft">16dp</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
</resources>

View file

@ -0,0 +1,74 @@
package net.osmand.plus;
import android.annotation.TargetApi;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.download.DownloadActivity;
public class FirstUsageFragment extends Fragment {
public static final String TAG = "FirstUsageFragment";
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.first_usage_fragment, container, false);
final EditText editText = (EditText) view.findViewById(R.id.searchEditText);
Drawable searchIcon = ((MapActivity) getActivity()).getMyApplication().getIconsCache()
.getContentIcon(R.drawable.ic_action_search_dark);
editText.setCompoundDrawablesWithIntrinsicBounds(searchIcon, null, null, null);
Button skipButton = (Button) view.findViewById(R.id.skip_button);
skipButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().getSupportFragmentManager().beginTransaction()
.remove(FirstUsageFragment.this).commit();
}
});
editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
getActivity().getSupportFragmentManager().beginTransaction()
.remove(FirstUsageFragment.this).commit();
final Intent intent = new Intent(getActivity(), DownloadActivity.class);
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
getActivity().startActivity(intent);
}
}
});
return view;
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public void onResume() {
super.onResume();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getActivity().getWindow(); // in Activity's onCreate() for instance
w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
@Override
public void onPause() {
super.onPause();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getActivity().getWindow(); // in Activity's onCreate() for instance
w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
}

View file

@ -1,10 +1,6 @@
package net.osmand.plus;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibleToast;
import net.osmand.plus.osmo.OsMoPlugin;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
@ -27,14 +23,22 @@ import android.support.v7.app.NotificationCompat;
import android.util.Log;
import android.widget.Toast;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibleToast;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.osmo.OsMoPlugin;
public class NavigationService extends Service implements LocationListener {
public static class NavigationServiceBinder extends Binder {
}
// global id don't conflict with others
private final static int NOTIFICATION_SERVICE_ID = 5;
public final static String OSMAND_STOP_SERVICE_ACTION = "OSMAND_STOP_SERVICE_ACTION"; //$NON-NLS-1$
public final static String OSMAND_SAVE_SERVICE_ACTION = "OSMAND_SAVE_SERVICE_ACTION";
public static int USED_BY_NAVIGATION = 1;
public static int USED_BY_GPX = 2;
public static int USED_BY_LIVE = 4;
@ -54,6 +58,7 @@ public class NavigationService extends Service implements LocationListener {
private static WakeLock lockStatic;
private PendingIntent pendingIntent;
private BroadcastReceiver broadcastReceiver;
private BroadcastReceiver saveBroadcastReceiver;
private int usedBy = 0;
private OsmAndLocationProvider locationProvider;
@ -95,7 +100,7 @@ public class NavigationService extends Service implements LocationListener {
}
public void stopIfNeeded(Context ctx, int usageIntent) {
if((usedBy & usageIntent) > 0) {
if ((usedBy & usageIntent) > 0) {
usedBy -= usageIntent;
}
@ -141,7 +146,7 @@ public class NavigationService extends Service implements LocationListener {
app.setNavigationService(this);
// requesting
if(isContinuous()){
if (isContinuous()) {
// request location updates
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
try {
@ -168,12 +173,12 @@ public class NavigationService extends Service implements LocationListener {
broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if(settings.SAVE_GLOBAL_TRACK_TO_GPX.get()) {
if (settings.SAVE_GLOBAL_TRACK_TO_GPX.get()) {
settings.SAVE_GLOBAL_TRACK_TO_GPX.set(false);
}
OsMoPlugin plugin = OsmandPlugin.getEnabledPlugin(OsMoPlugin.class);
if(plugin != null) {
if(plugin.getTracker().isEnabledTracker()) {
if (plugin != null) {
if (plugin.getTracker().isEnabledTracker()) {
plugin.getTracker().disableTracker();
}
}
@ -182,9 +187,15 @@ public class NavigationService extends Service implements LocationListener {
};
registerReceiver(broadcastReceiver, new IntentFilter(OSMAND_STOP_SERVICE_ACTION));
Intent notificationIntent = new Intent(OSMAND_STOP_SERVICE_ACTION);
saveBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
final OsmandMonitoringPlugin plugin = OsmandPlugin
.getEnabledPlugin(OsmandMonitoringPlugin.class);
plugin.saveCurrentTrack();
}
};
registerReceiver(saveBroadcastReceiver, new IntentFilter(OSMAND_SAVE_SERVICE_ACTION));
//Show currently active wake-up interval
int soi = settings.SERVICE_OFF_INTERVAL.get();
@ -192,11 +203,10 @@ public class NavigationService extends Service implements LocationListener {
if (soi == 0) {
nt = nt + getString(R.string.int_continuosly);
} else if (soi <= 90000) {
nt = nt + Integer.toString(soi/1000) + " " + getString(R.string.int_seconds);
nt = nt + Integer.toString(soi / 1000) + " " + getString(R.string.int_seconds);
} else {
nt = nt + Integer.toString(soi/1000/60) + " " + getString(R.string.int_min);
nt = nt + Integer.toString(soi / 1000 / 60) + " " + getString(R.string.int_min);
}
PendingIntent broadcast = PendingIntent.getBroadcast(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
// Notification notification = new Notification(R.drawable.bgs_icon, "", //$NON-NLS-1$
// System.currentTimeMillis());
//
@ -205,12 +215,28 @@ public class NavigationService extends Service implements LocationListener {
// notification.flags = Notification.FLAG_NO_CLEAR;
// startForeground(NOTIFICATION_SERVICE_ID, notification);
final Builder noti = new NotificationCompat.Builder(
String stop = getResources().getString(R.string.shared_string_control_stop);
Intent stopIntent = new Intent(OSMAND_STOP_SERVICE_ACTION);
PendingIntent stopPendingIntent = PendingIntent.getBroadcast(this, 0, stopIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
String pause = getResources().getString(R.string.shared_string_save);
Intent saveIntent = new Intent(OSMAND_SAVE_SERVICE_ACTION);
PendingIntent savePendingIntent = PendingIntent.getBroadcast(this, 0, saveIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
Intent contentIntent = new Intent(this, MapActivity.class);
PendingIntent contentPendingIntent = PendingIntent.getActivity(this, 0, contentIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
final Builder notificationBuilder = new NotificationCompat.Builder(
this).setContentTitle(Version.getAppName(cl))
.setContentText(getString(R.string.osmand_service)).setSmallIcon(R.drawable.bgs_icon)
.setContentText(getString(R.string.osmand_service))
.setSmallIcon(R.drawable.bgs_icon)
// .setLargeIcon(Helpers.getBitmap(R.drawable.mirakel, getBaseContext()))
.setContentIntent(broadcast).setOngoing(true);
startForeground(NOTIFICATION_SERVICE_ID, noti.build());
.setContentIntent(contentPendingIntent)
.setOngoing(true)
.addAction(R.drawable.ic_action_rec_stop, stop, stopPendingIntent)
.addAction(R.drawable.ic_action_save, pause, savePendingIntent);
startForeground(NOTIFICATION_SERVICE_ID, notificationBuilder.build());
}
@Override
@ -219,7 +245,7 @@ public class NavigationService extends Service implements LocationListener {
// initializing variables
}
private boolean isContinuous(){
private boolean isContinuous() {
return serviceOffInterval == 0;
}
@ -227,7 +253,7 @@ public class NavigationService extends Service implements LocationListener {
@Override
public void onDestroy() {
super.onDestroy();
((OsmandApplication)getApplication()).setNavigationService(null);
((OsmandApplication) getApplication()).setNavigationService(null);
usedBy = 0;
// remove updates
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
@ -253,15 +279,19 @@ public class NavigationService extends Service implements LocationListener {
unregisterReceiver(broadcastReceiver);
broadcastReceiver = null;
}
if (saveBroadcastReceiver != null) {
unregisterReceiver(saveBroadcastReceiver);
saveBroadcastReceiver = null;
}
stopForeground(Boolean.TRUE);
}
@Override
public void onLocationChanged(Location l) {
if(l != null && !settings.MAP_ACTIVITY_ENABLED.get()){
net.osmand.Location location = OsmAndLocationProvider.convertLocation(l,(OsmandApplication) getApplication());
if(!isContinuous()){
if (l != null && !settings.MAP_ACTIVITY_ENABLED.get()) {
net.osmand.Location location = OsmAndLocationProvider.convertLocation(l, (OsmandApplication) getApplication());
if (!isContinuous()) {
// unregister listener and wait next time
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
locationManager.removeUpdates(this);
@ -281,13 +311,11 @@ public class NavigationService extends Service implements LocationListener {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@ -305,6 +333,4 @@ public class NavigationService extends Service implements LocationListener {
NavigationService.this.stopSelf();
}
}
}

View file

@ -1,12 +1,30 @@
package net.osmand.plus.activities;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.NotificationCompat.Builder;
import android.support.v7.app.NotificationCompat;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewStub;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.Location;
import net.osmand.StateChangedListener;
@ -26,6 +44,7 @@ import net.osmand.plus.AppInitializer.AppInitializeListener;
import net.osmand.plus.AppInitializer.InitEvents;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.BusyIndicator;
import net.osmand.plus.FirstUsageFragment;
import net.osmand.plus.OsmAndConstants;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
@ -53,31 +72,14 @@ import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.corenative.NativeCoreContext;
import net.osmand.render.RenderingRulesStorage;
import net.osmand.util.Algorithms;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.NotificationCompat.Builder;
import android.support.v7.app.NotificationCompat;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewStub;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class MapActivity extends AccessibleActivity {
@ -210,6 +212,12 @@ public class MapActivity extends AccessibleActivity {
System.err.println("OnCreate for MapActivity took " + (System.currentTimeMillis() - tm) + " ms");
}
mapView.refreshMap(true);
if(getMyApplication().getAppInitializer().isFirstTime(this)) {
getSupportFragmentManager().beginTransaction()
.add(R.id.fragmentContainer, new FirstUsageFragment(),
FirstUsageFragment.TAG).commit();
}
}
private void checkAppInitialization() {

View file

@ -1,33 +1,6 @@
package net.osmand.plus.activities;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.access.AccessibleToast;
import net.osmand.osm.io.NetworkUtils;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.DrivingRegion;
import net.osmand.plus.OsmandSettings.MetricsConstants;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.dashboard.DashChooseAppDirFragment;
import net.osmand.plus.dashboard.DashChooseAppDirFragment.ChooseAppDirFragment;
import net.osmand.plus.dashboard.DashChooseAppDirFragment.MoveFilesToDifferentDirectory;
import net.osmand.plus.dialogs.ConfigureMapMenu;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.plus.render.NativeOsmandLibrary;
import net.osmand.plus.voice.CommandPlayer;
import net.osmand.render.RenderingRulesStorage;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
@ -52,6 +25,34 @@ import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Toast;
import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.access.AccessibleToast;
import net.osmand.osm.io.NetworkUtils;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.DrivingRegion;
import net.osmand.plus.OsmandSettings.MetricsConstants;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.dashboard.DashChooseAppDirFragment;
import net.osmand.plus.dashboard.DashChooseAppDirFragment.ChooseAppDirFragment;
import net.osmand.plus.dashboard.DashChooseAppDirFragment.MoveFilesToDifferentDirectory;
import net.osmand.plus.dialogs.ConfigureMapMenu;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.plus.render.NativeOsmandLibrary;
import net.osmand.plus.voice.CommandPlayer;
import net.osmand.render.RenderingRulesStorage;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
public class SettingsGeneralActivity extends SettingsBaseActivity {
@ -339,7 +340,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
private void showAppDirDialogV19() {
Builder bld = new AlertDialog.Builder(this);
ChooseAppDirFragment frg = new DashChooseAppDirFragment.ChooseAppDirFragment(this, (Dialog) null);
bld.setView(frg.initView(getLayoutInflater(), null));
bld.setView(frg.initView(getLayoutInflater(), null, null));
AlertDialog dlg = bld.show();
frg.setDialog(dlg);
}

View file

@ -7,6 +7,7 @@ import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -215,6 +216,7 @@ public class GeoIntentActivity extends OsmandListActivity {
* @return
*/
private MyService extract(final Uri uri) {
Log.v(this.getClass().toString(), "extract(" + "uri=" + uri + ")");
GeoPointParserUtil.GeoParsedPoint p = GeoPointParserUtil.parse(uri.toString());
if (p.isGeoPoint()) {
if (p.getLabel() != null) {

View file

@ -1,14 +1,5 @@
package net.osmand.plus.audionotes;
import java.util.ArrayList;
import java.util.List;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
@ -19,6 +10,16 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Denis
* on 15.12.2014.
@ -30,7 +31,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
AudioVideoNotesPlugin plugin;
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
((TextView) view.findViewById(R.id.fav_text)).setText(R.string.map_widget_av_notes);

View file

@ -1,22 +1,37 @@
package net.osmand.plus.dashboard;
import net.osmand.plus.OsmAndAppCustomization;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.activities.MapActivity;
import android.app.Activity;
import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import net.osmand.plus.OsmAndAppCustomization;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.widgets.InterceptorFrameLayout;
import net.osmand.plus.widgets.tools.SwipeDismissTouchListener;
/**
* Created by Denis on 24.11.2014.
*/
public abstract class DashBaseFragment extends Fragment {
protected DashboardOnMap dashboard;
public OsmandApplication getMyApplication(){
if (getActivity() == null){
public interface DismissListener {
void onDismiss();
}
public OsmandApplication getMyApplication() {
if (getActivity() == null) {
return null;
}
return (OsmandApplication) getActivity().getApplication();
@ -25,13 +40,71 @@ public abstract class DashBaseFragment extends Fragment {
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if(activity instanceof MapActivity) {
if (activity instanceof MapActivity) {
dashboard = ((MapActivity) activity).getDashboard();
dashboard.onAttach(this);
}
}
public abstract void onOpenDash() ;
@Nullable
@Override
final public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View childView = initView(inflater, container, savedInstanceState);
FrameLayout.LayoutParams layoutParams =
new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
InterceptorFrameLayout frameLayout = new InterceptorFrameLayout(getActivity());
frameLayout.setLayoutParams(layoutParams);
FrameLayout.LayoutParams childLayoutParams =
new FrameLayout.LayoutParams(
(ViewGroup.MarginLayoutParams) childView.getLayoutParams());
frameLayout.addView(childView, childLayoutParams);
if (isDismissAllowed()) {
SwipeDismissTouchListener listener = new SwipeDismissTouchListener(childView, null,
new SwipeDismissTouchListener.DismissCallbacks() {
@Override
public boolean canDismiss(Object token) {
return true;
}
@Override
public void onDismiss(View view, Object token, boolean isSwipeRight) {
if (isSwipeRight) {
getDismissCallback().onDismiss();
}
}
});
frameLayout.setOnTouchListener(listener);
frameLayout.setListener(listener);
if (getDismissCallback() == null) {
defaultDismissListener = new DefaultDismissListener(getParentView(), dashboard, getTag(),
childView);
}
}
return frameLayout;
}
public abstract View initView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState);
public DismissListener getDismissCallback() {
return defaultDismissListener;
}
public boolean isDismissAllowed() {
return true;
}
@Override
public boolean getUserVisibleHint() {
return super.getUserVisibleHint();
}
public abstract void onOpenDash();
public void onCloseDash() {
}
@ -51,7 +124,7 @@ public abstract class DashBaseFragment extends Fragment {
public final void onResume() {
// use on open update
super.onResume();
if(dashboard != null && dashboard.isVisible() && getView() != null) {
if (dashboard != null && dashboard.isVisible() && getView() != null) {
onOpenDash();
}
}
@ -63,7 +136,7 @@ public abstract class DashBaseFragment extends Fragment {
@Override
public void onDetach() {
super.onDetach();
if(dashboard != null) {
if (dashboard != null) {
dashboard.onDetach(this);
dashboard = null;
}
@ -78,4 +151,46 @@ public abstract class DashBaseFragment extends Fragment {
activity.startActivity(favorites);
}
protected View getParentView() {
return dashboard.getParentView();
}
private DismissListener defaultDismissListener;
public static class DefaultDismissListener implements DismissListener {
private View parentView;
private DashboardOnMap dashboardOnMap;
private String fragmentTag;
private View fragmentView;
public DefaultDismissListener(View parentView, DashboardOnMap dashboardOnMap,
String fragmentTag, View fragmentView) {
this.parentView = parentView;
this.dashboardOnMap = dashboardOnMap;
this.fragmentTag = fragmentTag;
this.fragmentView = fragmentView;
}
@Override
public void onDismiss() {
dashboardOnMap.blacklistFragmentByTag(fragmentTag);
ViewCompat.setTranslationX(fragmentView, 0);
ViewCompat.setAlpha(fragmentView, 1);
Snackbar.make(parentView, dashboardOnMap.getMyApplication().getResources()
.getString(R.string.shared_string_card_was_hidden), Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
@Override
public void onClick(View view) {
DefaultDismissListener.this.onUndo();
}
})
.show();
}
public void onUndo() {
dashboardOnMap.unblacklistFragmentClass(fragmentTag);
ViewCompat.setTranslationX(fragmentView, 0);
ViewCompat.setAlpha(fragmentView, 1);
}
}
}

View file

@ -1,26 +1,5 @@
package net.osmand.plus.dashboard;
import gnu.trove.list.array.TIntArrayList;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import net.osmand.IndexConstants;
import net.osmand.ValueHolder;
import net.osmand.access.AccessibleToast;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.ProgressImplementation;
import net.osmand.plus.R;
import net.osmand.util.Algorithms;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
@ -45,8 +24,28 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
/**
*/
import net.osmand.IndexConstants;
import net.osmand.ValueHolder;
import net.osmand.access.AccessibleToast;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.ProgressImplementation;
import net.osmand.plus.R;
import net.osmand.util.Algorithms;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import gnu.trove.list.array.TIntArrayList;
public class DashChooseAppDirFragment extends DashBaseFragment {
public static final String TAG = "DASH_CHOOSE_APP_DIR_FRAGMENT";
@ -63,21 +62,11 @@ public class DashChooseAppDirFragment extends DashBaseFragment {
public void onOpenDash() {
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return fragment.initView(inflater, container);
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return fragment.initView(inflater, container, savedInstanceState);
}
public static boolean isDashNeeded(OsmandSettings settings) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return false;
}
return !settings.isExternalStorageDirectorySpecifiedV19();
}
public static class ChooseAppDirFragment {
public static final int VERSION_DEFAULTLOCATION_CHANGED = 19;
private TextView locationPath;
@ -124,8 +113,6 @@ public class DashChooseAppDirFragment extends DashBaseFragment {
locationPath.setText(R.string.storage_directory_multiuser);
} else if (type == OsmandSettings.EXTERNAL_STORAGE_TYPE_SPECIFIED) {
locationPath.setText(R.string.storage_directory_manual);
} else if (type == OsmandSettings.EXTERNAL_STORAGE_TYPE_SPECIFIED) {
locationPath.setText(R.string.storage_directory_manual);
}
locationDesc.setText(selectedFile.getAbsolutePath() + " \u2022 " + getFreeSpace(selectedFile));
boolean copyFiles = !currentAppFile.getAbsolutePath().equals(selectedFile.getAbsolutePath()) && !mapsCopied;
@ -156,7 +143,8 @@ public class DashChooseAppDirFragment extends DashBaseFragment {
copyMapsBtn.setVisibility(copyFiles ? View.VISIBLE : View.GONE);
}
public View initView(LayoutInflater inflater, ViewGroup container) {
public View initView(LayoutInflater inflater, ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dash_storage_type_fragment, container, false);
settings = getMyApplication().getSettings();
locationPath = (TextView) view.findViewById(R.id.location_path);

View file

@ -1,13 +1,5 @@
package net.osmand.plus.dashboard;
import java.io.File;
import java.text.MessageFormat;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.activities.OsmandActionBarActivity;
import net.osmand.plus.helpers.FontCache;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@ -15,6 +7,8 @@ import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.view.ViewCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -22,6 +16,16 @@ import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.activities.OsmandActionBarActivity;
import net.osmand.plus.helpers.FontCache;
import java.io.File;
import java.text.MessageFormat;
/**
* Created by Denis
* on 02.12.14.
@ -30,8 +34,10 @@ public class DashErrorFragment extends DashBaseFragment {
public static final String TAG = "DASH_ERROR_FRAGMENT";
private DismissListener dismissCallback;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_error_fragment, container, false);
String msg = MessageFormat.format(getString(R.string.previous_run_crashed), OsmandApplication.EXCEPTION_PATH);
Typeface typeface = FontCache.getRobotoMedium(getActivity());
@ -46,7 +52,7 @@ public class DashErrorFragment extends DashBaseFragment {
@Override
public void onClick(View view) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "crash@osmand.net" }); //$NON-NLS-1$
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"crash@osmand.net"}); //$NON-NLS-1$
File file = getMyApplication().getAppPath(OsmandApplication.EXCEPTION_PATH);
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
intent.setType("vnd.android.cursor.dir/email"); //$NON-NLS-1$
@ -66,6 +72,7 @@ public class DashErrorFragment extends DashBaseFragment {
text.append("\nApk Version : ").append(info.versionName).append(" ").append(info.versionCode); //$NON-NLS-1$ //$NON-NLS-2$
}
} catch (PackageManager.NameNotFoundException e) {
PlatformUtil.getLog(DashErrorFragment.class).error("", e);
}
intent.putExtra(Intent.EXTRA_TEXT, text.toString());
startActivity(Intent.createChooser(intent, getString(R.string.send_report)));
@ -84,10 +91,53 @@ public class DashErrorFragment extends DashBaseFragment {
}
}
});
dismissCallback = new ErrorDismissListener(getParentView(), dashboard, TAG, view);
return view;
}
@Override
public void onOpenDash() {
}
@Override
public DismissListener getDismissCallback() {
return dismissCallback;
}
private static class ErrorDismissListener implements DismissListener {
private View parentView;
private DashboardOnMap dashboardOnMap;
private String fragmentTag;
private View fragmentView;
public ErrorDismissListener(View parentView, DashboardOnMap dashboardOnMap,
String fragmentTag, View fragmentView) {
this.parentView = parentView;
this.dashboardOnMap = dashboardOnMap;
this.fragmentTag = fragmentTag;
this.fragmentView = fragmentView;
}
@Override
public void onDismiss() {
dashboardOnMap.hideFragmentByTag(fragmentTag);
ViewCompat.setTranslationX(fragmentView, 0);
ViewCompat.setAlpha(fragmentView, 1);
Snackbar.make(parentView, dashboardOnMap.getMyApplication().getResources()
.getString(R.string.shared_string_card_was_hidden), Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
@Override
public void onClick(View view) {
ErrorDismissListener.this.onUndo();
}
})
.show();
}
public void onUndo() {
dashboardOnMap.unhideFragmentByTag(fragmentTag);
ViewCompat.setTranslationX(fragmentView, 0);
ViewCompat.setAlpha(fragmentView, 1);
}
}
}

View file

@ -1,9 +1,14 @@
package net.osmand.plus.dashboard;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
@ -15,15 +20,11 @@ import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.util.MapUtils;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* Created by Denis
@ -34,7 +35,7 @@ public class DashFavoritesFragment extends DashLocationFragment {
List<FavouritePoint> points = new ArrayList<FavouritePoint>();
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
@Override

View file

@ -13,7 +13,6 @@ import android.widget.TextView;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.download.DownloadActivity;
/**
@ -31,7 +30,7 @@ public class DashFirstTimeFragment extends DashBaseFragment {
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_first_time, container, false);
view.findViewById(R.id.select_region).setOnClickListener(new View.OnClickListener() {

View file

@ -1,13 +1,5 @@
package net.osmand.plus.dashboard;
import java.util.ArrayList;
import java.util.List;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.ShowRouteInfoActivity;
import net.osmand.plus.routing.RoutingHelper;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
@ -21,14 +13,18 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.ShowRouteInfoActivity;
import net.osmand.plus.routing.RoutingHelper;
/**
*/
public class DashNavigationFragment extends DashBaseFragment {
public static final String TAG = "DASH_NAVIGATION_FRAGMENT";
List<TargetPoint> points = new ArrayList<TargetPoint>();
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
((TextView) view.findViewById(R.id.fav_text)).setText(R.string.current_route);
((TextView)view.findViewById(R.id.show_all)).setText(R.string.info_button);

View file

@ -1,14 +1,5 @@
package net.osmand.plus.dashboard;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.PluginActivity;
import net.osmand.plus.development.OsmandDevelopmentPlugin;
import android.content.Intent;
import android.content.res.TypedArray;
import android.net.Uri;
@ -23,6 +14,16 @@ import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.PluginActivity;
import net.osmand.plus.development.OsmandDevelopmentPlugin;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/**
* Created by Denis
* on 21.11.2014.
@ -55,7 +56,7 @@ public class DashPluginsFragment extends DashBaseFragment {
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dash_common_fragment, container, false);
TextView header = ((TextView) view.findViewById(R.id.fav_text));
header.setText(R.string.prefs_plugins);
@ -84,7 +85,7 @@ public class DashPluginsFragment extends DashBaseFragment {
private void addPluginsToLimit(Iterator<OsmandPlugin> it, int l) {
while(plugins.size() < l && it.hasNext()) {
while (plugins.size() < l && it.hasNext()) {
OsmandPlugin plugin = it.next();
if (plugin instanceof OsmandDevelopmentPlugin) {
continue;
@ -123,7 +124,7 @@ public class DashPluginsFragment extends DashBaseFragment {
logoView.setBackgroundResource(R.drawable.bg_plugin_logo_enabled);
} else {
TypedArray attributes = getActivity().getTheme().obtainStyledAttributes(
new int[] { R.attr.bg_plugin_logo_disabled });
new int[]{R.attr.bg_plugin_logo_disabled});
logoView.setBackgroundDrawable(attributes.getDrawable(0));
attributes.recycle();
}

View file

@ -14,26 +14,27 @@ import android.widget.TextView;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import java.util.Calendar;
/**
*/
public class DashRateUsFragment extends DashBaseFragment {
public static final String TAG = "DASH_RATE_US_FRAGMENT";
// TODO move to resources
public static final String EMAIL = "support@osmand.net";
// Imported in shouldShow method
private static OsmandSettings settings;
private FragmentState state = FragmentState.INITIAL_STATE;
private RateUsDismissListener mRateUsDismissListener;
@Override
public void onOpenDash() {
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_rate_us_fragment, container, false);
TextView header = (TextView) view.findViewById(R.id.header);
TextView subheader = (TextView) view.findViewById(R.id.subheader);
@ -43,6 +44,7 @@ public class DashRateUsFragment extends DashBaseFragment {
new PositiveButtonListener(header, subheader, positiveButton, negativeButton));
negativeButton.setOnClickListener(
new NegativeButtonListener(header, subheader, positiveButton, negativeButton));
mRateUsDismissListener = new RateUsDismissListener(dashboard, settings);
return view;
}
@ -61,8 +63,7 @@ public class DashRateUsFragment extends DashBaseFragment {
int bannerFreeRuns = 0;
Log.v(TAG, "state=" + state + "; lastDisplayTimeInMillis=" + lastDisplayTimeInMillis
+ "; numberOfApplicationRuns=" + numberOfApplicationRuns);
boolean toReturn = false;
switch (state) {
case LIKED:
@ -95,10 +96,12 @@ public class DashRateUsFragment extends DashBaseFragment {
// Initial state now
modifiedTime.add(Calendar.HOUR, -72);
bannerFreeRuns = 3;
if (modifiedTime.after(lastDisplayTime) && numberOfApplicationRuns >= bannerFreeRuns) {
return true;
return modifiedTime.after(lastDisplayTime) && numberOfApplicationRuns >= bannerFreeRuns;
}
return false;
@Override
public DismissListener getDismissCallback() {
return mRateUsDismissListener;
}
public class PositiveButtonListener implements View.OnClickListener {
@ -207,4 +210,29 @@ public class DashRateUsFragment extends DashBaseFragment {
DISLIKED_WITH_MESSAGE,
DISLIKED_WITHOUT_MESSAGE
}
public static class RateUsShouldShow extends DashboardOnMap.SettingsShouldShow {
@Override
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
return DashRateUsFragment.shouldShow(settings)
&& super.shouldShow(settings, activity, tag);
}
}
private static class RateUsDismissListener implements DismissListener {
private DashboardOnMap dashboardOnMap;
private OsmandSettings settings;
public RateUsDismissListener(DashboardOnMap dashboardOnMap, OsmandSettings settings) {
this.dashboardOnMap = dashboardOnMap;
this.settings = settings;
}
@Override
public void onDismiss() {
settings.RATE_US_STATE.set(RateUsState.IGNORED);
settings.NUMBER_OF_APPLICATION_STARTS.set(0);
settings.LAST_DISPLAY_TIME.set(System.currentTimeMillis());
dashboardOnMap.refreshDashboardFragments();
}
}
}

View file

@ -1,7 +1,15 @@
package net.osmand.plus.dashboard;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.osmand.data.LatLon;
import net.osmand.plus.OsmAndAppCustomization;
@ -11,22 +19,11 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.activities.search.SearchHistoryFragment;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.helpers.SearchHistoryHelper;
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
import net.osmand.util.Algorithms;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Denis on 24.11.2014.
@ -38,7 +35,7 @@ public class DashRecentsFragment extends DashLocationFragment {
List<HistoryEntry> points = new ArrayList<HistoryEntry>();
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
((TextView)view.findViewById(R.id.fav_text)).setText(R.string.shared_string_history);
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
@ -113,6 +110,4 @@ public class DashRecentsFragment extends DashLocationFragment {
}
this.distances = distances;
}
}

View file

@ -26,7 +26,7 @@ public class DashSearchFragment extends DashBaseFragment {
public static final String TAG = "DASH_SEARCH_FRAGMENT";
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_search_fragment, container, false);
setupButtons(view);
Typeface typeface = FontCache.getRobotoMedium(getActivity());

View file

@ -1,17 +1,5 @@
package net.osmand.plus.dashboard;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import net.osmand.plus.R;
import net.osmand.plus.base.BasicProgressAsyncTask;
import net.osmand.plus.download.BaseDownloadActivity;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.helpers.DatabaseHelper;
import net.osmand.plus.helpers.FontCache;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.AsyncTask;
@ -27,6 +15,19 @@ import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import net.osmand.plus.R;
import net.osmand.plus.base.BasicProgressAsyncTask;
import net.osmand.plus.download.BaseDownloadActivity;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.helpers.DatabaseHelper;
import net.osmand.plus.helpers.FontCache;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* Created by Denis on 21.11.2014.
*/
@ -42,7 +43,7 @@ public class DashUpdatesFragment extends DashBaseFragment {
private ImageButton cancelButton;
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_updates_fragment, container, false);
Typeface typeface = FontCache.getRobotoMedium(getActivity());
((TextView) view.findViewById(R.id.header)).setTypeface(typeface);

View file

@ -1,20 +1,5 @@
package net.osmand.plus.dashboard;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.WaypointDialogHelper;
import net.osmand.plus.helpers.WaypointHelper;
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
@ -31,6 +16,22 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.WaypointDialogHelper;
import net.osmand.plus.helpers.WaypointHelper;
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
*/
public class DashWaypointsFragment extends DashLocationFragment {
@ -39,7 +40,7 @@ public class DashWaypointsFragment extends DashLocationFragment {
private static boolean SHOW_ALL;
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
((TextView) view.findViewById(R.id.fav_text)).setText(getString(R.string.waypoints));
@ -265,6 +266,4 @@ public class DashWaypointsFragment extends DashLocationFragment {
});
optionsMenu.show();
}
}

View file

@ -1,8 +1,6 @@
package net.osmand.plus.dashboard;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
@ -12,6 +10,7 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.animation.Animation;
@ -42,10 +41,14 @@ import net.osmand.plus.ContextMenuAdapter.OnRowItemClick;
import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.IntermediatePointsDialog;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.audionotes.DashAudioVideoNotesFragment;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.dashboard.tools.DashboardSettingsDialogFragment;
import net.osmand.plus.dashboard.tools.TransactionBuilder;
import net.osmand.plus.development.DashSimulateFragment;
import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.dialogs.ConfigureMapMenu;
@ -71,8 +74,36 @@ import java.util.List;
*/
public class DashboardOnMap implements ObservableScrollViewCallbacks {
private static final String TAG = "DashboardOnMap";
public static boolean staticVisible = false;
public static DashboardType staticVisibleType = DashboardType.DASHBOARD;
public static final String SHOULD_SHOW = "should_show";
private static final DashFragmentData.ShouldShowFunction rateUsShouldShow = new DashRateUsFragment.RateUsShouldShow();
private static final DefaultShouldShow defaultShouldShow = new DefaultShouldShow();
private static final DefaultShouldShow errorShouldShow = new ErrorShouldShow();
private static final DashFragmentData.ShouldShowFunction firstTimeShouldShow = new FirstTimeShouldShow();
private static final DefaultShouldShow simulateShouldShow = new SimulateShouldShow();
private static final DashFragmentData.ShouldShowFunction chooseAppDirShouldShow = new ChooseAppDirShouldShow();
private static final DashFragmentData[] fragmentsData = new DashFragmentData[]{
new DashFragmentData(DashRateUsFragment.TAG, DashRateUsFragment.class, "Rate us", rateUsShouldShow, true),
new DashFragmentData(DashFirstTimeFragment.TAG, DashFirstTimeFragment.class, "First time", firstTimeShouldShow, true),
new DashFragmentData(DashChooseAppDirFragment.TAG, DashChooseAppDirFragment.class, "Choose app dir", chooseAppDirShouldShow, true),
new DashFragmentData(DashErrorFragment.TAG, DashErrorFragment.class, "Error", errorShouldShow, true),
new DashFragmentData(DashNavigationFragment.TAG, DashNavigationFragment.class, "Navigation", defaultShouldShow),
new DashFragmentData(DashParkingFragment.TAG, DashParkingFragment.class, "Parking", defaultShouldShow),
new DashFragmentData(DashWaypointsFragment.TAG, DashWaypointsFragment.class, "Waypoints", defaultShouldShow),
new DashFragmentData(DashSearchFragment.TAG, DashSearchFragment.class, "Search", defaultShouldShow),
new DashFragmentData(DashRecentsFragment.TAG, DashRecentsFragment.class, "Recent places", defaultShouldShow),
new DashFragmentData(DashFavoritesFragment.TAG, DashFavoritesFragment.class, "Favourites", defaultShouldShow),
new DashFragmentData(DashAudioVideoNotesFragment.TAG, DashAudioVideoNotesFragment.class, "Notes", defaultShouldShow),
new DashFragmentData(DashTrackFragment.TAG, DashTrackFragment.class, "Track", defaultShouldShow),
new DashFragmentData(DashOsMoFragment.TAG, DashOsMoFragment.class, "OsMo", defaultShouldShow),
new DashFragmentData(DashOsmEditsFragment.TAG, DashOsmEditsFragment.class, "OsmEdits", defaultShouldShow),
new DashFragmentData(DashPluginsFragment.TAG, DashPluginsFragment.class, "Plugins", defaultShouldShow),
new DashFragmentData(DashSimulateFragment.TAG, DashSimulateFragment.class, "Simulate", simulateShouldShow),
};
private MapActivity mapActivity;
private ImageView actionButton;
@ -86,7 +117,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
private DashboardType visibleType;
private DashboardType previousVisibleType;
private boolean landscape;
private List<WeakReference<DashBaseFragment>> fragList = new LinkedList<WeakReference<DashBaseFragment>>();
private List<WeakReference<DashBaseFragment>> fragList = new LinkedList<>();
private net.osmand.Location myLocation;
private LatLon mapViewLocation;
private float heading;
@ -104,7 +135,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
int baseColor;
private WaypointDialogHelper waypointDialogHelper;
private final int[] running = new int[] { -1 };
private final int[] running = new int[]{-1};
private List<LocationPointWrapper> deletedPoints = new ArrayList<LocationPointWrapper>();
private Drawable gradientToolbar;
@ -118,7 +149,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
DASHBOARD
}
public DashboardOnMap(MapActivity ma) {
this.mapActivity = ma;
}
@ -167,6 +197,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
private void updateListBackgroundHeight() {
if (listBackgroundView == null || listBackgroundView.getHeight() > 0) {
return;
}
@ -186,17 +217,16 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
}
}
private void updateToolbarActions() {
TextView tv = (TextView) dashboardView.findViewById(R.id.toolbar_text);
tv.setText("");
boolean waypointsVisible = visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT;
boolean waypointsEdit = visibleType == DashboardType.WAYPOINTS_EDIT;
if (waypointsVisible || waypointsEdit){
if (waypointsVisible || waypointsEdit) {
tv.setText(R.string.waypoints);
} else if(visibleType == DashboardType.CONFIGURE_MAP){
} else if (visibleType == DashboardType.CONFIGURE_MAP) {
tv.setText(R.string.configure_map);
} else if(visibleType == DashboardType.CONFIGURE_SCREEN){
} else if (visibleType == DashboardType.CONFIGURE_SCREEN) {
tv.setText(R.string.layer_map_appearance);
}
ImageView edit = (ImageView) dashboardView.findViewById(R.id.toolbar_edit);
@ -207,8 +237,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
ok.setVisibility(View.GONE);
ImageView flat = (ImageView) dashboardView.findViewById(R.id.toolbar_flat);
flat.setVisibility(View.GONE);
ImageView settings = (ImageView) dashboardView.findViewById(R.id.toolbar_settings);
settings.setVisibility(View.GONE);
ImageView settingsButton = (ImageView) dashboardView.findViewById(R.id.toolbar_settings);
settingsButton.setVisibility(View.GONE);
ImageView configureScreen = (ImageView) dashboardView.findViewById(R.id.toolbar_configure_screen);
configureScreen.setVisibility(View.GONE);
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
@ -216,7 +246,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
lst.setVisibility(View.GONE);
ImageView back = (ImageView) dashboardView.findViewById(R.id.toolbar_back);
back.setImageDrawable(
((OsmandApplication)getMyApplication()).getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));
getMyApplication().getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));
back.setOnClickListener(new View.OnClickListener() {
@Override
@ -260,7 +290,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
});
}
}
if(waypointsEdit) {
if (waypointsEdit) {
ok.setVisibility(View.VISIBLE);
ok.setOnClickListener(new View.OnClickListener() {
@ -281,16 +311,13 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
});
settings.setVisibility(View.VISIBLE);
settings.setOnClickListener(new View.OnClickListener() {
settingsButton.setVisibility(View.VISIBLE);
settingsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Class<? extends Activity> sta = mapActivity.getMyApplication().getAppCustomization()
.getSettingsActivity();
hideDashboard(false);
mapActivity.startActivity(new Intent(mapActivity, sta));
new DashboardSettingsDialogFragment().show(
mapActivity.getSupportFragmentManager(), "dashboard_settings");
}
});
lst.setVisibility(View.VISIBLE);
@ -318,7 +345,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
int btnSize = (int) mapActivity.getResources().getDimension(R.dimen.map_button_size);
int topPad = (int) mapActivity.getResources().getDimension(R.dimen.dashboard_map_top_padding);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
btnSize,btnSize
btnSize, btnSize
);
int marginRight = btnSize / 4;
params.setMargins(0, landscape ? 0 : topPad - 2 * btnSize,
@ -349,7 +376,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
}
public static int convertPixelsToDp(float dp, Context context){
public static int convertPixelsToDp(float dp, Context context) {
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
return Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT));
}
@ -400,12 +427,12 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
setDashboardVisibility(visible, type, this.visible ? visibleType : null, animation);
}
public void refreshDashboardFragments(){
public void refreshDashboardFragments() {
addOrUpdateDashboardFragments();
}
public void setDashboardVisibility(boolean visible, DashboardType type, DashboardType prevItem, boolean animation) {
if(visible == this.visible && type == visibleType) {
if (visible == this.visible && type == visibleType) {
return;
}
this.previousVisibleType = prevItem;
@ -421,7 +448,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
myLocation = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
mapActivity.getMapViewTrackingUtilities().setDashboard(this);
dashboardView.setVisibility(View.VISIBLE);
if(isActionButtonVisible()) {
if (isActionButtonVisible()) {
actionButton.setVisibility(View.VISIBLE);
} else {
hideActionButton();
@ -429,7 +456,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
updateDownloadBtn();
View listViewLayout = dashboardView.findViewById(R.id.dash_list_view_layout);
ScrollView scrollView = (ScrollView) dashboardView.findViewById(R.id.main_scroll);
if(visibleType == DashboardType.DASHBOARD) {
if (visibleType == DashboardType.DASHBOARD) {
addOrUpdateDashboardFragments();
scrollView.setVisibility(View.VISIBLE);
scrollView.scrollTo(0, 0);
@ -439,9 +466,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
scrollView.setVisibility(View.GONE);
listViewLayout.setVisibility(View.VISIBLE);
if (listView instanceof ObservableListView) {
onScrollChanged(((ObservableListView) listView).getScrollY(), false, false);
onScrollChanged(listView.getScrollY(), false, false);
}
if(refresh) {
if (refresh) {
refreshContent(false);
} else {
updateListAdapter();
@ -488,9 +515,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
} else {
if (DashboardType.CONFIGURE_SCREEN == visibleType) {
cm = mapActivity.getMapLayers().getMapWidgetRegistry().getViewConfigureMenuAdapter(mapActivity);
} else if(DashboardType.CONFIGURE_MAP == visibleType) {
} else if (DashboardType.CONFIGURE_MAP == visibleType) {
cm = new ConfigureMapMenu().createListAdapter(mapActivity);
} else if(DashboardType.LIST_MENU == visibleType) {
} else if (DashboardType.LIST_MENU == visibleType) {
cm = mapActivity.getMapActions().createMainOptionsMenu();
}
if (cm != null) {
@ -507,7 +534,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
}
public void refreshContent(boolean force) {
if(visibleType == DashboardType.WAYPOINTS || force) {
if (visibleType == DashboardType.WAYPOINTS || force) {
updateListAdapter();
} else {
listAdapter.notifyDataSetChanged();
@ -522,9 +549,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
@Override
public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
OnContextMenuClick click = cm.getClickAdapter(which);
if(click instanceof OnRowItemClick) {
if (click instanceof OnRowItemClick) {
boolean cl = ((OnRowItemClick) click).onRowItemClick(listAdapter, view, cm.getElementId(which), which);
if(cl) {
if (cl) {
hideDashboard();
}
} else if (click != null) {
@ -573,7 +600,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
hideDashboard(false);
final Intent intent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getDownloadIndexActivity());
intent.putExtra(DownloadActivity.FILTER_KEY, f.toString());
intent.putExtra(DownloadActivity.FILTER_KEY, f);
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
mapActivity.startActivity(intent);
}
@ -586,7 +613,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
@Override
public void run() {
if(isVisible()) {
if (isVisible()) {
updateDownloadBtn();
}
}
@ -596,7 +623,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
public void navigationAction() {
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
if(!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
mapActivity.getMapActions().enterRoutePlanningMode(null, null, false);
} else {
mapActivity.getRoutingHelper().setRoutePlanningMode(true);
@ -622,7 +649,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
}
private void hide(View view, boolean animation) {
if(!animation) {
if (!animation) {
dashboardView.setVisibility(View.GONE);
} else {
TranslateAnimation animate = new TranslateAnimation(0, -mapActivity.findViewById(R.id.MapHudButtonsOverlay)
@ -653,63 +680,11 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
private void addOrUpdateDashboardFragments() {
boolean firstTime = getMyApplication().getAppInitializer().isFirstTime(mapActivity);
// boolean showCards = mapActivity.getMyApplication().getSettings().USE_DASHBOARD_INSTEAD_OF_DRAWER.get();
boolean showCards = !firstTime;
FragmentManager manager = mapActivity.getSupportFragmentManager();
FragmentTransaction fragmentTransaction = manager.beginTransaction();
showFragment(manager, fragmentTransaction, DashRateUsFragment.TAG, DashRateUsFragment.class,
DashRateUsFragment.shouldShow(getMyApplication().getSettings()));
showFragment(manager, fragmentTransaction, DashFirstTimeFragment.TAG, DashFirstTimeFragment.class, firstTime);
showFragment(manager, fragmentTransaction, DashChooseAppDirFragment.TAG, DashChooseAppDirFragment.class,
DashChooseAppDirFragment.isDashNeeded(getMyApplication().getSettings()));
showFragment(manager, fragmentTransaction, DashErrorFragment.TAG, DashErrorFragment.class,
mapActivity.getMyApplication().getAppInitializer().checkPreviousRunsForExceptions(mapActivity) && showCards);
showFragment(manager, fragmentTransaction, DashNavigationFragment.TAG, DashNavigationFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashParkingFragment.TAG, DashParkingFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashWaypointsFragment.TAG, DashWaypointsFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashSearchFragment.TAG, DashSearchFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashRecentsFragment.TAG, DashRecentsFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashFavoritesFragment.TAG, DashFavoritesFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashAudioVideoNotesFragment.TAG, DashAudioVideoNotesFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashTrackFragment.TAG, DashTrackFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashOsMoFragment.TAG, DashOsMoFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashOsmEditsFragment.TAG, DashOsmEditsFragment.class, showCards);
// showFragment(manager, fragmentTransaction, DashUpdatesFragment.TAG, DashUpdatesFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashPluginsFragment.TAG, DashPluginsFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashSimulateFragment.TAG, DashSimulateFragment.class,
OsmandPlugin.getEnabledPlugin(OsmandDevelopmentPlugin.class) != null && showCards);
fragmentTransaction.commit();
}
private <T extends Fragment> void showFragment(FragmentManager manager, FragmentTransaction fragmentTransaction,
String tag, Class<T> cl, boolean cond) {
try {
Fragment frag = manager.findFragmentByTag(tag);
if (manager.findFragmentByTag(tag) == null ) {
if(cond) {
T ni = cl.newInstance();
fragmentTransaction.add(R.id.content, ni, tag);
}
} else {
if(!cond) {
fragmentTransaction.remove(manager.findFragmentByTag(tag));
} else if(frag instanceof DashBaseFragment){
if(((DashBaseFragment) frag).getView() != null) {
((DashBaseFragment) frag).onOpenDash();
}
}
}
} catch (Exception e) {
getMyApplication().showToastMessage("Error showing dashboard " + tag);
e.printStackTrace();
}
Log.v(TAG, "addOrUpdateDashboardFragments(" + ")");
OsmandSettings settings = getMyApplication().getSettings();
TransactionBuilder builder =
new TransactionBuilder(mapActivity.getSupportFragmentManager(), settings, mapActivity);
builder.addFragmentsData(fragmentsData).getFragmentTransaction().commit();
}
public boolean isVisible() {
@ -718,18 +693,18 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
public void onDetach(DashBaseFragment dashBaseFragment) {
Iterator<WeakReference<DashBaseFragment>> it = fragList.iterator();
while(it.hasNext()) {
while (it.hasNext()) {
WeakReference<DashBaseFragment> wr = it.next();
if(wr.get() == dashBaseFragment) {
if (wr.get() == dashBaseFragment) {
it.remove();
}
}
}
public void updateLocation(final boolean centerChanged, final boolean locationChanged, final boolean compassChanged){
if(inLocationUpdate) {
return ;
public void updateLocation(final boolean centerChanged, final boolean locationChanged, final boolean compassChanged) {
if (inLocationUpdate) {
return;
}
inLocationUpdate = true;
mapActivity.runOnUiThread(new Runnable() {
@ -738,7 +713,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
inLocationUpdate = false;
for (WeakReference<DashBaseFragment> df : fragList) {
if (df.get() instanceof DashLocationFragment) {
((DashLocationFragment)df.get()).updateLocation(centerChanged, locationChanged, compassChanged);
((DashLocationFragment) df.get()).updateLocation(centerChanged, locationChanged, compassChanged);
}
}
}
@ -757,7 +732,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
}
public void onAttach(DashBaseFragment dashBaseFragment) {
fragList.add(new WeakReference<DashBaseFragment>(dashBaseFragment));
fragList.add(new WeakReference<>(dashBaseFragment));
}
public void requestLayout() {
@ -784,7 +759,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
private void backPressed() {
if(previousVisibleType != visibleType && previousVisibleType != null) {
if (previousVisibleType != visibleType && previousVisibleType != null) {
visibleType = null;
setDashboardVisibility(true, previousVisibleType);
} else {
@ -797,7 +772,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
// Translate list background
if (portrait) {
if(listBackgroundView != null) {
if (listBackgroundView != null) {
setTranslationY(listBackgroundView, Math.max(0, -scrollY + mFlexibleSpaceImageHeight));
}
}
@ -849,9 +824,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
gradientToolbar.setAlpha((int) ((1 - t) * 255));
setAlpha(dashboardView, (int) (t * 128), 0);
if (t < 1) {
((Toolbar) dashboardView.findViewById(R.id.toolbar)).setBackgroundDrawable(gradientToolbar);
dashboardView.findViewById(R.id.toolbar).setBackgroundDrawable(gradientToolbar);
} else {
((Toolbar) dashboardView.findViewById(R.id.toolbar)).setBackgroundColor(0xff000000 | baseColor);
dashboardView.findViewById(R.id.toolbar).setBackgroundColor(0xff000000 | baseColor);
}
}
}
@ -861,7 +836,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
this.listAdapterOnClickListener = listener;
if (this.listView != null) {
listView.setAdapter(listAdapter);
if(!portrait) {
if (!portrait) {
listView.setOnItemClickListener(this.listAdapterOnClickListener);
} else if (this.listAdapterOnClickListener != null) {
listView.setOnItemClickListener(new OnItemClickListener() {
@ -894,7 +869,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// v.setAlpha(alpha/255.f);
// } else {
int colr = (((int) alpha ) << 24) | clr;
int colr = (((int) alpha) << 24) | clr;
v.setBackgroundColor(colr);
// }
}
@ -920,16 +895,95 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
public <T extends DashBaseFragment> T getFragmentByClass(Class<T> class1) {
for(WeakReference<DashBaseFragment> f: fragList) {
for (WeakReference<DashBaseFragment> f : fragList) {
DashBaseFragment b = f.get();
if(b != null && !b.isDetached() && class1.isInstance(b)) {
if (b != null && !b.isDetached() && class1.isInstance(b)) {
return (T) b;
}
}
return null;
}
public void blacklistFragmentByTag(String tag) {
hideFragmentByTag(tag);
getMyApplication().getSettings().registerBooleanPreference(SHOULD_SHOW + tag, true)
.makeGlobal().set(false);
}
public void hideFragmentByTag(String tag) {
FragmentManager manager = mapActivity.getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
Fragment frag = manager.findFragmentByTag(tag);
transaction.hide(frag).commit();
}
public void unblacklistFragmentClass(String tag) {
unhideFragmentByTag(tag);
getMyApplication().getSettings().registerBooleanPreference(SHOULD_SHOW + tag, true)
.makeGlobal().set(true);
}
public void unhideFragmentByTag(String tag) {
FragmentManager manager = mapActivity.getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
Fragment frag = manager.findFragmentByTag(tag);
transaction.show(frag).commit();
}
View getParentView() {
return dashboardView;
}
public DashFragmentData[] getFragmentsData() {
return fragmentsData;
}
public static class SettingsShouldShow implements DashFragmentData.ShouldShowFunction {
@Override
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
return settings.registerBooleanPreference(SHOULD_SHOW + tag, true)
.makeGlobal().get();
}
}
public static class DefaultShouldShow extends SettingsShouldShow {
@Override
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
return !activity.getMyApplication().getAppInitializer().isFirstTime(activity)
&& super.shouldShow(settings, activity, tag);
}
}
private static class ErrorShouldShow extends DefaultShouldShow {
@Override
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
return super.shouldShow(settings, activity, tag) && activity.getMyApplication()
.getAppInitializer().checkPreviousRunsForExceptions(activity);
}
}
private static class FirstTimeShouldShow extends SettingsShouldShow {
@Override
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
return activity.getMyApplication().getAppInitializer().isFirstTime(activity)
&& super.shouldShow(settings, activity, tag);
}
}
private static class SimulateShouldShow extends DefaultShouldShow {
@Override
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
return super.shouldShow(settings, activity, tag)
&& OsmandPlugin.getEnabledPlugin(OsmandDevelopmentPlugin.class) != null;
}
}
private static class ChooseAppDirShouldShow extends SettingsShouldShow {
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return false;
}
return !settings.isExternalStorageDirectorySpecifiedV19()
&& super.shouldShow(settings, activity, tag);
}
}
}

View file

@ -1,45 +0,0 @@
package net.osmand.plus.dashboard;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;
/**
* @author Cyril Mottier
*/
public class NotifyingScrollView extends ScrollView {
/**
* @author Cyril Mottier
*/
public interface OnScrollChangedListener {
void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt);
}
private OnScrollChangedListener mOnScrollChangedListener;
public NotifyingScrollView(Context context) {
super(context);
}
public NotifyingScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NotifyingScrollView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if (mOnScrollChangedListener != null) {
mOnScrollChangedListener.onScrollChanged(this, l, t, oldl, oldt);
}
}
public void setOnScrollChangedListener(OnScrollChangedListener listener) {
mOnScrollChangedListener = listener;
}
}

View file

@ -0,0 +1,36 @@
package net.osmand.plus.dashboard.tools;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment;
public final class DashFragmentData {
public final String tag;
public final Class<? extends DashBaseFragment> fragmentClass;
public final String title;
public final ShouldShowFunction shouldShowFunction;
public final boolean customDeletionLogic;
public DashFragmentData(String tag, Class<? extends DashBaseFragment> fragmentClass,
String title, ShouldShowFunction shouldShowFunction,
boolean customDeletionLogic) {
this.tag = tag;
this.fragmentClass = fragmentClass;
this.title = title;
this.shouldShowFunction = shouldShowFunction;
this.customDeletionLogic = customDeletionLogic;
}
public DashFragmentData(String tag, Class<? extends DashBaseFragment> fragmentClass,
String title, ShouldShowFunction shouldShowFunction) {
this.tag = tag;
this.fragmentClass = fragmentClass;
this.title = title;
this.shouldShowFunction = shouldShowFunction;
customDeletionLogic = false;
}
public interface ShouldShowFunction {
boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag);
}
}

View file

@ -0,0 +1,138 @@
package net.osmand.plus.dashboard.tools;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.TextView;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashboardOnMap;
import java.util.ArrayList;
public class DashboardSettingsDialogFragment extends DialogFragment {
private static final String CHECKED_ITEMS = "checked_items";
private MapActivity mapActivity;
private DashFragmentData[] fragmentsData;
private DashFragmentAdapter adapter;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
mapActivity = (MapActivity) activity;
ArrayList<DashFragmentData> fragmentsList = new ArrayList<>();
for(DashFragmentData fragmentData : mapActivity.getDashboard().getFragmentsData()) {
if (!fragmentData.customDeletionLogic) fragmentsList.add(fragmentData);
}
fragmentsData = fragmentsList.toArray(new DashFragmentData[fragmentsList.size()]);
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
if (savedInstanceState != null && savedInstanceState.containsKey(CHECKED_ITEMS)) {
adapter = new DashFragmentAdapter(getActivity(), fragmentsData,
savedInstanceState.getBooleanArray(CHECKED_ITEMS));
} else {
adapter = new DashFragmentAdapter(getActivity(), fragmentsData,
settings);
}
builder.setTitle(R.string.dahboard_options_dialog_title)
.setAdapter(adapter, null)
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int type) {
boolean[] shouldShow = adapter.getCheckedItems();
for (int i = 0; i < shouldShow.length; i++) {
settings.registerBooleanPreference(
DashboardOnMap.SHOULD_SHOW + fragmentsData[i].tag, true)
.makeGlobal().set(shouldShow[i]);
}
mapActivity.getDashboard().refreshDashboardFragments();
}
})
.setNegativeButton(R.string.shared_string_cancel, null);
return builder.create();
}
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putBooleanArray(CHECKED_ITEMS, adapter.getCheckedItems());
super.onSaveInstanceState(outState);
}
private static class DashFragmentAdapter extends ArrayAdapter<DashFragmentData> {
private final boolean[] checkedItems;
public DashFragmentAdapter(Context context, DashFragmentData[] objects, boolean[] checkedItems) {
super(context, 0, objects);
this.checkedItems = checkedItems;
}
public DashFragmentAdapter(Context context, DashFragmentData[] objects, OsmandSettings settings) {
super(context, 0, objects);
checkedItems = new boolean[objects.length];
for (int i = 0; i < objects.length; i++) {
checkedItems[i] = settings.registerBooleanPreference(
DashboardOnMap.SHOULD_SHOW + objects[i].tag, true).makeGlobal().get();
}
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
DashFragmentData dashFragmentData = getItem(position);
DashViewHolder viewHolder;
if (convertView == null) {
viewHolder = new DashViewHolder();
convertView = LayoutInflater.from(getContext()).inflate(
R.layout.dashboard_settings_dialog_item, parent, false);
viewHolder.textView = (TextView) convertView.findViewById(R.id.text);
viewHolder.compoundButton = (CompoundButton) convertView.findViewById(R.id.check_item);
viewHolder.compoundButton.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
DashViewHolder localViewHolder = (DashViewHolder) compoundButton.getTag();
checkedItems[localViewHolder.position] = b;
localViewHolder.textView.setTextColor(
checkedItems[localViewHolder.position] ? 0xFF212121
: 0xFF8c8c8c);
}
});
} else {
viewHolder = (DashViewHolder) convertView.getTag();
}
viewHolder.position = position;
viewHolder.compoundButton.setTag(viewHolder);
viewHolder.compoundButton.setChecked(checkedItems[position]);
viewHolder.textView.setText(dashFragmentData.title);
viewHolder.textView.setTextColor(checkedItems[position] ? 0xFF212121 : 0xFF8c8c8c);
convertView.setTag(viewHolder);
return convertView;
}
public boolean[] getCheckedItems() {
return checkedItems;
}
private class DashViewHolder {
TextView textView;
CompoundButton compoundButton;
int position;
}
}
}

View file

@ -0,0 +1,74 @@
package net.osmand.plus.dashboard.tools;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by GaidamakUA on 8/6/15.
*/
public final class TransactionBuilder {
private static final String TAG = "TransactionBuilder";
private FragmentManager manager;
private List<DashFragmentData> fragments = new ArrayList<>();
private OsmandSettings settings;
private MapActivity mapActivity;
public TransactionBuilder(FragmentManager manager, OsmandSettings settings,
MapActivity mapActivity) {
this.manager = manager;
this.settings = settings;
this.mapActivity = mapActivity;
}
public TransactionBuilder addFragmentsData(DashFragmentData... dashFragmentsData) {
fragments.addAll(Arrays.asList(dashFragmentsData));
return this;
}
public FragmentTransaction getFragmentTransaction() {
Log.v(TAG, "getFragmentTransaction(" + ")");
FragmentTransaction fragmentTransaction = manager.beginTransaction();
for (DashFragmentData dashFragmentData : fragments) {
DashBaseFragment fragment =
(DashBaseFragment) manager.findFragmentByTag(dashFragmentData.tag);
if (manager.findFragmentByTag(dashFragmentData.tag) == null) {
if (dashFragmentData.shouldShowFunction.shouldShow(settings, mapActivity, dashFragmentData.tag)) {
DashBaseFragment newInstance = null;
try {
newInstance = dashFragmentData.fragmentClass.newInstance();
// XXX hardcoded value
fragmentTransaction.add(R.id.content, newInstance, dashFragmentData.tag);
} catch (InstantiationException e) {
Log.v(TAG, "");
mapActivity.getMyApplication()
.showToastMessage("Error showing dashboard " + dashFragmentData.tag);
} catch (IllegalAccessException e) {
Log.v(TAG, "");
mapActivity.getMyApplication()
.showToastMessage("Error showing dashboard " + dashFragmentData.tag);
}
}
} else {
if (!dashFragmentData.shouldShowFunction.shouldShow(settings, mapActivity, dashFragmentData.tag)) {
fragmentTransaction.remove(manager.findFragmentByTag(dashFragmentData.tag));
} else if (fragment.getView() != null) {
if (fragment.isHidden()) {
fragmentTransaction.show(fragment);
}
fragment.onOpenDash();
}
}
}
return fragmentTransaction;
}
}

View file

@ -1,11 +1,5 @@
package net.osmand.plus.development;
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment;
import net.osmand.plus.helpers.FontCache;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
@ -17,8 +11,11 @@ import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
/**
*/
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment;
public class DashSimulateFragment extends DashBaseFragment {
public static final String TAG = "DASH_SIMULATE_FRAGMENT";
@ -36,7 +33,7 @@ public class DashSimulateFragment extends DashBaseFragment {
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
TextView header = (TextView) view.findViewById(R.id.fav_text);
header.setText(R.string.simulate_your_location);
@ -62,5 +59,4 @@ public class DashSimulateFragment extends DashBaseFragment {
return view;
}
}

View file

@ -1,15 +1,23 @@
package net.osmand.plus.monitoring;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.IndexConstants;
import net.osmand.access.AccessibleToast;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.OsmAndAppCustomization;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
@ -17,23 +25,13 @@ import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.myplaces.AvailableGPXFragment;
import net.osmand.plus.myplaces.FavoritesActivity;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Denis
@ -46,7 +44,7 @@ public class DashTrackFragment extends DashBaseFragment {
private boolean updateEnable;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
TextView header = (TextView) view.findViewById(R.id.fav_text);
header.setText(R.string.shared_string_my_tracks);

View file

@ -1,47 +1,5 @@
package net.osmand.plus.myplaces;
import java.io.File;
import java.text.Collator;
import java.text.DateFormat;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import net.osmand.IndexConstants;
import net.osmand.access.AccessibleToast;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.GPXUtilities.GPXTrackAnalysis;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.OsmandActionBarActivity;
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
import net.osmand.plus.activities.OsmandExpandableListFragment;
import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.activities.TrackActivity;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.download.LocalIndexesFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.osmedit.OsmEditingPlugin;
import net.osmand.util.Algorithms;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
@ -75,6 +33,49 @@ import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.IndexConstants;
import net.osmand.access.AccessibleToast;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.GPXUtilities.GPXTrackAnalysis;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.OsmandActionBarActivity;
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
import net.osmand.plus.activities.OsmandExpandableListFragment;
import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.activities.TrackActivity;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.download.LocalIndexesFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.osmedit.OsmEditingPlugin;
import net.osmand.util.Algorithms;
import java.io.File;
import java.text.Collator;
import java.text.DateFormat;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
public class AvailableGPXFragment extends OsmandExpandableListFragment {
public static final int SEARCH_ID = -1;
@ -115,7 +116,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
public void run() {
if (getView() != null && updateEnable) {
updateCurrentTrack(getView(), getActivity(), app);
if(selectedGpxHelper.getSelectedCurrentRecordingTrack() != null) {
if (selectedGpxHelper.getSelectedCurrentRecordingTrack() != null) {
allGpxAdapter.notifyDataSetChanged();
}
startHandler();
@ -159,7 +160,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
}
updateCurrentTrack(getView(), getActivity(), app);
final CheckBox checkbox = (CheckBox) getView().findViewById(R.id.check_local_index);
checkbox.setVisibility(selectionMode && showOnMapMode? View.VISIBLE : View.GONE);
checkbox.setVisibility(selectionMode && showOnMapMode ? View.VISIBLE : View.GONE);
if (selectionMode && showOnMapMode) {
checkbox.setChecked(selectedItems.contains(currentRecording));
checkbox.setOnClickListener(new View.OnClickListener() {
@ -187,7 +188,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
}
final boolean isRecording = app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get();
ImageButton stop = ((ImageButton) v.findViewById(R.id.stop));
if(isRecording) {
if (isRecording) {
stop.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_action_rec_stop));
} else {
stop.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_rec_start, R.color.recording_color));
@ -210,16 +211,10 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Runnable run = new Runnable() {
@Override
public void run() {
final OsmandMonitoringPlugin plugin = OsmandPlugin
.getEnabledPlugin(OsmandMonitoringPlugin.class);
plugin.saveCurrentTrack();
}
};
run.run();
}
});
if (sth.getPoints() > 0 || sth.getDistance() > 0) {
save.setVisibility(View.VISIBLE);
@ -269,7 +264,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
public static void openTrack(Activity a, final File f) {
Intent newIntent = new Intent(a, ((OsmandApplication) a.getApplication()).getAppCustomization().getTrackActivity());
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
if(f == null) {
if (f == null) {
newIntent.putExtra(TrackActivity.CURRENT_RECORDING, true);
} else {
newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, f.getAbsolutePath());
@ -682,7 +677,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
public GpxIndexesAdapter(Context ctx) {
warningColor = ctx.getResources().getColor(R.color.color_warning);
TypedArray ta = ctx.getTheme().obtainStyledAttributes(new int[] { android.R.attr.textColorPrimary });
TypedArray ta = ctx.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
defaultColor = ta.getColor(0, ctx.getResources().getColor(R.color.color_unknown));
ta.recycle();
}
@ -818,7 +813,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
final boolean isChecked;
if(child.currentlyRecordingTrack) {
if (child.currentlyRecordingTrack) {
isChecked = selectedGpxHelper.getSelectedCurrentRecordingTrack() != null;
} else {
final SelectedGpxFile selectedGpxFile = selectedGpxHelper.getSelectedFileByName(child.getFileName());
@ -896,7 +891,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
@Override
public String getGroup(int groupPosition) {
if(isSelectedGroup(groupPosition)) {
if (isSelectedGroup(groupPosition)) {
return app.getString(R.string.shared_string_selected);
}
return category.get(getGroupPosition(groupPosition));
@ -1085,7 +1080,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
protected String doInBackground(GpxInfo... params) {
for (GpxInfo info : params) {
if (!isCancelled()) {
if(!info.currentlyRecordingTrack) {
if (!info.currentlyRecordingTrack) {
info.setGpx(GPXUtilities.loadGPXFile(app, info.file));
}
publishProgress(info);
@ -1183,7 +1178,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
if (!selectionMode) {
Intent newIntent = new Intent(getActivity(), getMyApplication().getAppCustomization().getTrackActivity());
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
if(item.currentlyRecordingTrack) {
if (item.currentlyRecordingTrack) {
newIntent.putExtra(TrackActivity.CURRENT_RECORDING, true);
} else {
newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, item.file.getAbsolutePath());
@ -1314,7 +1309,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
String size = "";
if (child.getSize() >= 0) {
if (child.getSize() > 100) {
size = formatMb.format(new Object[] { (float) child.getSize() / (1 << 10) });
size = formatMb.format(new Object[]{(float) child.getSize() / (1 << 10)});
} else {
size = child.getSize() + " kB";
}

View file

@ -0,0 +1,160 @@
package net.osmand.plus.osmedit;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import net.osmand.plus.R;
import net.osmand.plus.osmedit.EditPoiFragment.Tag;
public class AdvancedDataFragment extends Fragment {
private static final String TAG = "AdvancedDataFragment";
private TagAdapterLinearLayoutHack mAdapter;
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_edit_poi_advanced, container, false);
final EditText tagEditText = (EditText) view.findViewById(R.id.tagEditText);
final EditText valueEditText = (EditText) view.findViewById(R.id.valueEditText);
ImageButton deleteItemImageButton =
(ImageButton) view.findViewById(R.id.deleteItemImageButton);
deleteItemImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tagEditText.setText(null);
tagEditText.clearFocus();
valueEditText.setText(null);
valueEditText.clearFocus();
}
});
LinearLayout editTagsLineaLayout =
(LinearLayout) view.findViewById(R.id.editTagsList);
Log.v(TAG, "arguments=" + savedInstanceState + "; ll=" + editTagsLineaLayout);
Log.v(TAG, "not restored");
mAdapter = new TagAdapterLinearLayoutHack(editTagsLineaLayout, getData());
// setListViewHeightBasedOnChildren(editTagsLineaLayout);
Button addTagButton = (Button) view.findViewById(R.id.addTagButton);
addTagButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String tag = String.valueOf(tagEditText.getText());
String value = String.valueOf(valueEditText.getText());
if (!TextUtils.isEmpty(tag) && !TextUtils.isEmpty(value)) {
mAdapter.addTag(new Tag(tag, value));
// setListViewHeightBasedOnChildren(editTagsLineaLayout);
tagEditText.setText(null);
tagEditText.clearFocus();
valueEditText.setText(null);
valueEditText.clearFocus();
}
}
});
return view;
}
@Override
public void onResume() {
super.onResume();
// TODO read more about lifecycle
mAdapter.updateViews();
getEditPoiFragment().addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int i, float v, int i1) {
}
@Override
public void onPageSelected(int i) {
if (i == 1) mAdapter.updateViews();
}
@Override
public void onPageScrollStateChanged(int i) {
}
});
}
@Override
public void onSaveInstanceState(Bundle outState) {
Log.v(TAG, "onSaveInstanceState(" + "outState=" + outState + ")");
super.onSaveInstanceState(outState);
}
public static class TagAdapterLinearLayoutHack {
private final LinearLayout linearLayout;
private final EditPoiFragment.EditPoiData editPoiData;
public TagAdapterLinearLayoutHack(LinearLayout linearLayout,
EditPoiFragment.EditPoiData editPoiData) {
this.linearLayout = linearLayout;
this.editPoiData = editPoiData;
}
public void addTag(Tag tag) {
View view = getView(tag);
editPoiData.tags.add(tag);
EditText valueEditText = (EditText) view.findViewById(R.id.valueEditText);
Log.v(TAG, "valueEditText text=" + valueEditText.getText());
linearLayout.addView(view);
}
public void updateViews() {
linearLayout.removeAllViews();
Log.v(TAG, "editPoiData.tags=" + editPoiData.tags);
for (Tag tag : editPoiData.tags) {
Log.v(TAG, "tag=" + tag);
View view = getView(tag);
EditText valueEditText = (EditText) view.findViewById(R.id.valueEditText);
Log.v(TAG, "valueEditText text=" + valueEditText.getText());
linearLayout.addView(view);
}
}
private View getView(final Tag tag) {
Log.v(TAG, "getView(" + "tag=" + tag + ")");
final View convertView = LayoutInflater.from(linearLayout.getContext())
.inflate(R.layout.poi_tag_list_item, null, false);
EditText tagEditText = (EditText) convertView.findViewById(R.id.tagEditText);
EditText valueEditText = (EditText) convertView.findViewById(R.id.valueEditText);
ImageButton deleteItemImageButton =
(ImageButton) convertView.findViewById(R.id.deleteItemImageButton);
tagEditText.setText(tag.tag);
valueEditText.setText(tag.value);
deleteItemImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
linearLayout.removeView((View) v.getParent());
editPoiData.tags.remove(tag);
}
});
Log.v(TAG, "convertView=" + convertView);
return convertView;
}
}
private EditPoiFragment getEditPoiFragment() {
return (EditPoiFragment) getParentFragment();
}
private EditPoiFragment.EditPoiData getData() {
return getEditPoiFragment().getEditPoiData();
}
}

View file

@ -33,7 +33,7 @@ public class DashOsmEditsFragment extends DashBaseFragment {
OsmEditingPlugin plugin;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
plugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);

View file

@ -0,0 +1,221 @@
package net.osmand.plus.osmedit;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import net.osmand.data.Amenity;
import net.osmand.osm.edit.Node;
import net.osmand.plus.R;
import java.io.Serializable;
import java.util.LinkedHashSet;
public class EditPoiFragment extends Fragment {
public static final String TAG = "EditPoiFragment";
private static final String KEY_AMENITY_NODE = "amenity_node";
private static final String KEY_AMENITY = "amenity";
private static final String TAGS_LIST = "tags_list";
private final EditPoiData editPoiData = new EditPoiData();
private ViewPager viewPager;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
// poiTypes = ((OsmandApplication) activity.getApplication()).getPoiTypes();
// allTranslatedSubTypes = poiTypes.getAllTranslatedNames();
// OsmandSettings settings = ((OsmandApplication) activity.getApplication()).getSettings();
// editPoiData.isLocalEdit = true;
// if (settings.OFFLINE_EDITION.get() || !settings.isInternetConnectionAvailable(true)) {
// openstreetmapUtil = new OpenstreetmapLocalUtil(plugin, activity);
// openstreetmapUtilToLoad = openstreetmapUtil;
// } else if(!settings.isInternetConnectionAvailable(true)) {
// openstreetmapUtil = new OpenstreetmapLocalUtil(plugin, activity);
// openstreetmapUtilToLoad = new OpenstreetmapRemoteUtil(activity);
// } else {
// editPoiData.isLocalEdit = false;
// openstreetmapUtil = new OpenstreetmapRemoteUtil(activity);
// openstreetmapUtilToLoad = openstreetmapUtil;
// }
// editPoiData.node = (Node) getArguments().getSerializable(KEY_AMENITY_NODE);
// editPoiData.tags = new LinkedHashSet<>();
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (savedInstanceState != null) {
editPoiData.tags = (LinkedHashSet<Tag>) savedInstanceState.getSerializable(TAGS_LIST);
} else {
editPoiData.tags = new LinkedHashSet<>();
}
View view = inflater.inflate(R.layout.fragment_edit_poi, container, false);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setTitle(R.string.poi_create_title);
toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
fragmentManager.beginTransaction().remove(EditPoiFragment.this).commit();
fragmentManager.popBackStack();
}
});
viewPager = (ViewPager) view.findViewById(R.id.viewpager);
MyAdapter pagerAdapter = new MyAdapter(getChildFragmentManager());
viewPager.setAdapter(pagerAdapter);
final TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tab_layout);
tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
// Hack due to bug in design support library v22.2.1
// https://code.google.com/p/android/issues/detail?id=180462
// TODO remove in new version
if (ViewCompat.isLaidOut(tabLayout)) {
tabLayout.setupWithViewPager(viewPager);
} else {
tabLayout.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
tabLayout.setupWithViewPager(viewPager);
tabLayout.removeOnLayoutChangeListener(this);
}
});
}
ImageButton onlineDocumentationButton =
(ImageButton) view.findViewById(R.id.onlineDocumentationButton);
onlineDocumentationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("https://wiki.openstreetmap.org/wiki/Map_Features")));
}
});
return view;
}
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putSerializable(TAGS_LIST, editPoiData.tags);
super.onSaveInstanceState(outState);
}
public void addOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
viewPager.addOnPageChangeListener(listener);
}
public EditPoiFragment createInstance(Node node, Amenity amenity) {
EditPoiFragment editPoiFragment = new EditPoiFragment();
Bundle args = new Bundle();
args.putSerializable(KEY_AMENITY_NODE, node);
args.putSerializable(KEY_AMENITY, amenity);
editPoiFragment.setArguments(args);
return editPoiFragment;
}
public EditPoiData getEditPoiData() {
return editPoiData;
}
public void send() {
// TODO implement saving
}
public static class MyAdapter extends FragmentPagerAdapter {
public MyAdapter(FragmentManager fm) {
super(fm);
}
@Override
public int getCount() {
return 2;
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return new NormalDataFragment();
case 1:
return new AdvancedDataFragment();
}
throw new IllegalArgumentException("Unexpected position");
}
@Override
public CharSequence getPageTitle(int position) {
// TODO replace with string resources
switch (position) {
case 0:
return "Normal";
case 1:
return "Advanced";
}
throw new IllegalArgumentException("Unexpected position");
}
}
public static class EditPoiData {
// public boolean isLocalEdit;
// public Node node;
public LinkedHashSet<Tag> tags;
}
public static class Tag implements Serializable {
public String tag;
public String value;
public Tag(String tag, String value) {
this.tag = tag;
this.value = value;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tag tag1 = (Tag) o;
return tag.equals(tag1.tag);
}
@Override
public int hashCode() {
return tag.hashCode();
}
@Override
public String toString() {
return "Tag{" +
"tag='" + tag + '\'' +
", value='" + value + '\'' +
'}';
}
}
}

View file

@ -0,0 +1,101 @@
package net.osmand.plus.osmedit;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.plus.IconsCache;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.osmedit.EditPoiFragment.Tag;
public class NormalDataFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
IconsCache iconsCache = ((MapActivity) getActivity()).getMyApplication().getIconsCache();
View view = inflater.inflate(R.layout.fragment_edit_poi_normal, container, false);
ImageView streetImageView = (ImageView) view.findViewById(R.id.streetImageView);
streetImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_street_name));
ImageView houseNumberImageView = (ImageView) view.findViewById(R.id.houseNumberImageView);
houseNumberImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_building_number));
ImageView phoneImageView = (ImageView) view.findViewById(R.id.phoneImageView);
phoneImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_call_dark));
ImageView webSiteImageView = (ImageView) view.findViewById(R.id.webSiteImageView);
webSiteImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_world_globe_dark));
ImageView descriptionImageView = (ImageView) view.findViewById(R.id.descriptionImageView);
descriptionImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_description));
// TODO replace with constants
final TextView streetEditText = (TextView) view.findViewById(R.id.streetEditText);
streetEditText.setOnFocusChangeListener(new MyOnFocusChangeListener(getData(), "addr:street"));
final TextView houseNumberEditText = (TextView) view.findViewById(R.id.houseNumberEditText);
houseNumberEditText.setOnFocusChangeListener(new MyOnFocusChangeListener(getData(), "addr:housenumber"));
final TextView phoneEditText = (TextView) view.findViewById(R.id.phoneEditText);
phoneEditText.setOnFocusChangeListener(new MyOnFocusChangeListener(getData(), "phone"));
final TextView webSiteEditText = (TextView) view.findViewById(R.id.webSiteEditText);
webSiteEditText.setOnFocusChangeListener(new MyOnFocusChangeListener(getData(), "website"));
final TextView descriptionEditText = (TextView) view.findViewById(R.id.descriptionEditText);
descriptionEditText.setOnFocusChangeListener(new MyOnFocusChangeListener(getData(), "description"));
Button saveButton = (Button) view.findViewById(R.id.saveButton);
int saveButtonTextId = //getData().isLocalEdit ? R.string.shared_string_save :
R.string.default_buttons_commit;
saveButton.setText(saveButtonTextId);
saveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getEditPoiFragment().send();
}
});
Button cancelButton = (Button) view.findViewById(R.id.cancelButton);
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
Fragment editPoiFragment = getParentFragment();
fragmentManager.beginTransaction().remove(editPoiFragment).commit();
fragmentManager.popBackStack();
}
});
return view;
}
private EditPoiFragment getEditPoiFragment() {
return (EditPoiFragment) getParentFragment();
}
private EditPoiFragment.EditPoiData getData() {
return getEditPoiFragment().getEditPoiData();
}
private static class MyOnFocusChangeListener implements View.OnFocusChangeListener {
private EditPoiFragment.EditPoiData data;
private String tagName;
public MyOnFocusChangeListener(EditPoiFragment.EditPoiData data, String tagName) {
this.data = data;
this.tagName = tagName;
}
@Override
public void onFocusChange(View v, boolean hasFocus) {
String string = ((EditText) v).getText().toString();
if (!TextUtils.isEmpty(string)) {
Tag tag = new Tag(tagName, string);
data.tags.remove(tag);
data.tags.add(tag);
}
}
}
}

View file

@ -3,6 +3,7 @@ package net.osmand.plus.osmedit;
import android.content.Context;
import android.util.Xml;
import android.widget.Toast;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibleToast;
import net.osmand.data.Amenity;

View file

@ -1,10 +1,5 @@
package net.osmand.plus.osmedit;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URLEncoder;
import net.osmand.PlatformUtil;
import net.osmand.osm.io.Base64;
import net.osmand.osm.io.NetworkUtils;
@ -16,6 +11,11 @@ import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URLEncoder;
public class OsmBugsRemoteUtil implements OsmBugsUtil {
private static final Log log = PlatformUtil.getLog(OsmBugsRemoteUtil.class);

View file

@ -1,6 +1,19 @@
package net.osmand.plus.osmedit;
import java.util.List;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import net.osmand.access.AccessibleToast;
import net.osmand.data.Amenity;
@ -19,28 +32,16 @@ import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.util.Algorithms;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import java.util.List;
public class OsmEditingPlugin extends OsmandPlugin {
private static final String ID = "osm.editing";
private OsmandSettings settings;
private OsmandApplication app;
OpenstreetmapsDbHelper dbpoi ;
OsmBugsDbHelper dbbug ;
OpenstreetmapsDbHelper dbpoi;
OsmBugsDbHelper dbbug;
@Override
public String getId() {
@ -48,14 +49,14 @@ public class OsmEditingPlugin extends OsmandPlugin {
}
public OpenstreetmapsDbHelper getDBPOI() {
if(dbpoi == null) {
if (dbpoi == null) {
dbpoi = new OpenstreetmapsDbHelper(app);
}
return dbpoi;
}
public OsmBugsDbHelper getDBBug() {
if(dbbug == null) {
if (dbbug == null) {
dbbug = new OsmBugsDbHelper(app);
}
return dbbug;
@ -87,30 +88,30 @@ public class OsmEditingPlugin extends OsmandPlugin {
}
}
} else {
if(osmBugsLayer != null) {
if (osmBugsLayer != null) {
mapView.removeLayer(osmBugsLayer);
}
if(osmEditsLayer != null) {
if (osmEditsLayer != null) {
mapView.removeLayer(osmEditsLayer);
}
}
}
@Override
public void registerLayers(MapActivity activity){
public void registerLayers(MapActivity activity) {
osmBugsLayer = new OsmBugsLayer(activity, this);
osmEditsLayer = new OsmEditsLayer(activity, this);
}
public OsmEditsLayer getOsmEditsLayer(MapActivity activity){
if(osmEditsLayer == null) {
public OsmEditsLayer getOsmEditsLayer(MapActivity activity) {
if (osmEditsLayer == null) {
registerLayers(activity);
}
return osmEditsLayer;
}
public OsmBugsLayer getBugsLayer(MapActivity activity) {
if(osmBugsLayer == null) {
if (osmBugsLayer == null) {
registerLayers(activity);
}
return osmBugsLayer;
@ -144,9 +145,13 @@ public class OsmEditingPlugin extends OsmandPlugin {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
if (resId == R.string.context_menu_item_create_poi) {
getPoiActions(mapActivity).showCreateDialog(latitude, longitude);
//getPoiActions(mapActivity).showCreateDialog(latitude, longitude);
mapActivity.getSupportFragmentManager().beginTransaction()
.add(R.id.fragmentContainer, new EditPoiFragment(), EditPoiFragment.TAG)
.addToBackStack(null)
.commit();
} else if (resId == R.string.context_menu_item_open_bug) {
if(osmBugsLayer == null) {
if (osmBugsLayer == null) {
registerLayers(mapActivity);
}
osmBugsLayer.openBug(latitude, longitude);
@ -158,7 +163,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
return true;
}
};
if(selectedObj instanceof Amenity) {
if (selectedObj instanceof Amenity) {
adapter.item(R.string.poi_context_menu_modify).iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg();
adapter.item(R.string.poi_context_menu_delete).iconColor(R.drawable.ic_action_delete_dark).listen(listener).position(2).reg();
} else {
@ -169,7 +174,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
@Override
public void addMyPlacesTab(FavoritesActivity favoritesActivity, List<TabActivity.TabItem> mTabs, Intent intent) {
if (getDBPOI().getOpenstreetmapPoints().size() > 0 || getDBBug().getOsmbugsPoints().size() > 0){
if (getDBPOI().getOpenstreetmapPoints().size() > 0 || getDBBug().getOsmbugsPoints().size() > 0) {
mTabs.add(favoritesActivity.getTabIndicator(R.string.osm_edits, OsmEditsFragment.class));
if (intent != null && "OSM".equals(intent.getStringExtra("TAB"))) {
app.getSettings().FAVORITES_TAB.set(R.string.osm_edits);
@ -241,7 +246,6 @@ public class OsmEditingPlugin extends OsmandPlugin {
}
public enum UploadVisibility implements IEnumWithResource {
Public(R.string.gpxup_public),
Identifiable(R.string.gpxup_identifiable),
@ -252,32 +256,34 @@ public class OsmEditingPlugin extends OsmandPlugin {
private UploadVisibility(int resourceId) {
this.resourceId = resourceId;
}
public String asURLparam() {
return name().toLowerCase();
}
@Override
public int stringResource() {
return resourceId;
}
}
public boolean sendGPXFiles(final Activity la, AvailableGPXFragment f, final GpxInfo... info){
public boolean sendGPXFiles(final Activity la, AvailableGPXFragment f, final GpxInfo... info) {
String name = settings.USER_NAME.get();
String pwd = settings.USER_PASSWORD.get();
if(Algorithms.isEmpty(name) || Algorithms.isEmpty(pwd)){
if (Algorithms.isEmpty(name) || Algorithms.isEmpty(pwd)) {
AccessibleToast.makeText(la, R.string.validate_gpx_upload_name_pwd, Toast.LENGTH_LONG).show();
return false;
}
Builder bldr = new AlertDialog.Builder(la);
LayoutInflater inflater = (LayoutInflater)la.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LayoutInflater inflater = (LayoutInflater) la.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View view = inflater.inflate(R.layout.send_gpx_osm, null);
final EditText descr = (EditText) view.findViewById(R.id.memory_size);
if(info.length > 0 && info[0].getFileName() != null) {
if (info.length > 0 && info[0].getFileName() != null) {
int dt = info[0].getFileName().indexOf('.');
descr.setText(info[0].getFileName().substring(0, dt));
}
final EditText tags = (EditText) view.findViewById(R.id.TagsText);
final Spinner visibility = ((Spinner)view.findViewById(R.id.Visibility));
final Spinner visibility = ((Spinner) view.findViewById(R.id.Visibility));
EnumAdapter<UploadVisibility> adapter = new EnumAdapter<UploadVisibility>(la, android.R.layout.simple_spinner_item, UploadVisibility.values());
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
visibility.setAdapter(adapter);
@ -314,7 +320,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
return R.drawable.osm_editing;
}
public static String getEditName(OsmPoint point){
public static String getEditName(OsmPoint point) {
String prefix = getPrefix(point);
if (point.getGroup() == OsmPoint.Group.POI) {
return prefix + " (" + ((OpenstreetmapPoint) point).getSubtype() + ") " + ((OpenstreetmapPoint) point).getName();

View file

@ -48,6 +48,30 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.osmand.access.AccessibleToast;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.ProgressImplementation;
import net.osmand.plus.R;
import net.osmand.plus.activities.ActionBarProgressActivity;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.OsmAndListFragment;
import net.osmand.plus.activities.OsmandActionBarActivity;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.myplaces.FavoritesActivity;
import org.xmlpull.v1.XmlSerializer;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* Created by Denis
* on 06.03.2015.

Some files were not shown because too many files have changed in this diff Show more