Compare commits
105 commits
Author | SHA1 | Date | |
---|---|---|---|
|
e7b7a98266 | ||
|
1a9df71765 | ||
|
bda783d934 | ||
|
dcccb2af9f | ||
|
f1b34ceca5 | ||
|
111b1d8296 | ||
|
ff8448753d | ||
|
42823b7baf | ||
|
8c9eb7cb55 | ||
|
f2b037d3c2 | ||
|
8e300271a2 | ||
|
7f9c8f6149 | ||
|
316007b68f | ||
|
09df271ee2 | ||
|
03c54f27d4 | ||
|
c8a57806ad | ||
|
bbdafed84b | ||
|
b2662ed3cc | ||
|
afcdb30234 | ||
|
46dd3a9160 | ||
|
c43537b131 | ||
|
dbf5a2cf00 | ||
|
377456b909 | ||
|
7576fbc7ca | ||
|
565c9ede3c | ||
|
bb0594e3eb | ||
|
64870b1638 | ||
|
7fa889b06f | ||
|
40b9ef6071 | ||
|
4e6a8f0e61 | ||
|
5f07cd9638 | ||
|
48e3798dde | ||
|
7dd7087698 | ||
|
1b32bbcd7e | ||
|
39ae8c80b2 | ||
|
511401047f | ||
|
5590efdfae | ||
|
398d1b4f70 | ||
|
3eb8e9d561 | ||
|
f8a81a1b1f | ||
|
ccee8b3e36 | ||
|
2e4163cf7c | ||
|
8ff0d9d58d | ||
|
451ebba12e | ||
|
2624ecaef0 | ||
|
f7f0b98b32 | ||
|
eb3fc0ad3d | ||
|
6631b5744f | ||
|
11246e3d3d | ||
|
6c7bc7d4f7 | ||
|
ffaa88f1b4 | ||
|
728c53cc69 | ||
|
26d58d894e | ||
|
e54028e818 | ||
|
1dffa85992 | ||
|
fe17991d70 | ||
|
92d5ced23c | ||
|
dcb50e7cfc | ||
|
fbab53ae7d | ||
|
57eae66adf | ||
|
db404f8c53 | ||
|
4a12f2ac23 | ||
|
4f08959f7e | ||
|
f949b7cd23 | ||
|
3b6b695ae2 | ||
|
f92eee8ebf | ||
|
3d3694bec0 | ||
|
2007f093f6 | ||
|
b3ddc95545 | ||
|
d64e3bbf2f | ||
|
0f617217c7 | ||
|
12c49c7f15 | ||
|
cbedf9c58a | ||
|
42c0766f6d | ||
|
b4490665dd | ||
|
680379d98a | ||
|
a9f412fbeb | ||
|
1b4833043b | ||
|
46f6b796a6 | ||
|
579a22bfc4 | ||
|
3b21c41372 | ||
|
3d4f0d7119 | ||
|
ec614dbb53 | ||
|
ca4732b752 | ||
|
6728d20a05 | ||
|
6c20a7741e | ||
|
072e120337 | ||
|
d111833cce | ||
|
b3675f21b1 | ||
|
7e4d664cab | ||
|
9a5b2255bc | ||
|
76287aa78c | ||
|
2bcf634962 | ||
|
cf6bcde867 | ||
|
da7871dfca | ||
|
058b5ade68 | ||
|
df4d926b38 | ||
|
cd4eca222e | ||
|
a92f8b5db5 | ||
|
a13085c06c | ||
|
24d41d69aa | ||
|
bed581b245 | ||
|
3565cc8d44 | ||
|
07844c49e5 | ||
|
14d2f96776 |
70 changed files with 1167 additions and 688 deletions
|
@ -188,12 +188,17 @@ public class Postcode {
|
||||||
if (isCountryKnown(country)) {
|
if (isCountryKnown(country)) {
|
||||||
String replacement = rules.get(country).get(1);
|
String replacement = rules.get(country).get(1);
|
||||||
Matcher matcher = getMatcher(postcode, country);
|
Matcher matcher = getMatcher(postcode, country);
|
||||||
result = matcher.replaceAll(replacement);
|
if (matcher != null) {
|
||||||
if (!result.equals(postcode)) {
|
String res = matcher.replaceAll(replacement);
|
||||||
log.info("Normalize " + country + "'s postcode: " + postcode + " -> " + result);
|
if (res != null) {
|
||||||
}
|
result = res.replaceAll("null", "");
|
||||||
if (!matcher.matches()) {
|
if (!result.equals(postcode)) {
|
||||||
log.info("Not matches " + country + "'s postcode regex: " + postcode);
|
log.info("Normalize " + country + "'s postcode: " + postcode + " -> " + result);
|
||||||
|
}
|
||||||
|
if (!matcher.matches()) {
|
||||||
|
log.info("Not matches " + country + "'s postcode regex: " + postcode);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
48
OsmAnd/res/layout/mapillary_no_internet.xml
Normal file
48
OsmAnd/res/layout/mapillary_no_internet.xml
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/bg_color"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/wifiOff"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:src="@drawable/ic_action_wifi_off"/>
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:background="@null"
|
||||||
|
android:text="@string/no_inet_connection"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="24dp"
|
||||||
|
android:background="@null"
|
||||||
|
android:text="@string/mappilary_no_internet_desc"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:textSize="@dimen/default_desc_text_size"/>
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/retry_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:text="@string/retry"
|
||||||
|
android:textColor="?attr/color_dialog_buttons"
|
||||||
|
android:textSize="@dimen/default_sub_text_size"
|
||||||
|
osmand:textAllCapsCompat="true"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -3,45 +3,56 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:id="@+id/imageView"
|
android:id="@+id/staticImageViewLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:scaleType="centerCrop"/>
|
|
||||||
|
|
||||||
<ProgressBar
|
<ImageView
|
||||||
android:id="@+id/progressBar"
|
android:id="@+id/imageView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:paddingTop="16dp"
|
|
||||||
android:paddingBottom="16dp"
|
|
||||||
android:background="@android:color/transparent">
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/leftArrowButton"
|
|
||||||
android:layout_width="44dp"
|
|
||||||
android:layout_height="44dp"
|
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
|
||||||
android:src="@drawable/ic_arrow_back"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"/>
|
android:scaleType="centerCrop"/>
|
||||||
|
|
||||||
<ImageButton
|
<ProgressBar
|
||||||
android:id="@+id/rightArrowButton"
|
android:id="@+id/progressBar"
|
||||||
android:layout_width="44dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="44dp"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:layout_gravity="center"/>
|
||||||
android:src="@drawable/ic_arrow_forward"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:background="@android:color/transparent">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/leftArrowButton"
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:src="@drawable/ic_arrow_back"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/rightArrowButton"
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:src="@drawable/ic_arrow_forward"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<include layout="@layout/mapillary_no_internet"
|
||||||
|
android:id="@+id/mapillaryNoInternetLayout"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
18
OsmAnd/res/layout/mapillary_web_view.xml
Normal file
18
OsmAnd/res/layout/mapillary_web_view.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:id="@+id/webView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
</WebView>
|
||||||
|
|
||||||
|
<include layout="@layout/mapillary_no_internet"
|
||||||
|
android:id="@+id/mapillaryNoInternetLayout"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
|
@ -4,22 +4,63 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/spinnerListBackground"
|
android:background="?attr/ctx_menu_info_view_bg"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.design.widget.AppBarLayout
|
||||||
android:id="@+id/custom_toolbar"
|
android:id="@+id/appbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/dashboard_map_toolbar"
|
android:layout_height="wrap_content">
|
||||||
android:background="?attr/actionModeBackground"/>
|
|
||||||
|
<android.support.v7.widget.Toolbar
|
||||||
|
android:id="@+id/custom_toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dashboard_map_toolbar"/>
|
||||||
|
|
||||||
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/top_divider"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/appbar"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="4dp"/>
|
||||||
|
|
||||||
|
<include layout="@layout/card_top_divider"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/recycler_view"
|
android:id="@+id/recycler_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/custom_toolbar"
|
android:layout_below="@id/top_divider"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"/>
|
||||||
android:paddingTop="16dp"/>
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/bottomShadowView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/recycler_view"
|
||||||
|
android:background="?attr/ctx_menu_info_view_bg"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:src="@drawable/bg_shadow_list_bottom"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/bottomMarginView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="16dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
<android.support.design.widget.FloatingActionButton
|
||||||
android:id="@+id/fabButton"
|
android:id="@+id/fabButton"
|
||||||
|
|
|
@ -469,7 +469,7 @@
|
||||||
<string name="av_photo_play_sound_descr">فعّل هذا في حال رغبتك بسماع نغمة التقاط الصّور</string>
|
<string name="av_photo_play_sound_descr">فعّل هذا في حال رغبتك بسماع نغمة التقاط الصّور</string>
|
||||||
<string name="edit_tilesource_elliptic_tile">نموذج مركتور البيضوي</string>
|
<string name="edit_tilesource_elliptic_tile">نموذج مركتور البيضوي</string>
|
||||||
|
|
||||||
<string name="route_descr_lat_lon">خط عرض %1$.f3، خط طول %2$.f3</string>
|
<string name="route_descr_lat_lon">خط عرض %1$.3f، خط طول %2$.3f</string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2656,4 +2656,6 @@
|
||||||
<string name="quick_action_btn_tutorial_title">Change button position</string>
|
<string name="quick_action_btn_tutorial_title">Change button position</string>
|
||||||
<string name="quick_action_btn_tutorial_descr">Long tap and drag the button to change its position on the screen</string>
|
<string name="quick_action_btn_tutorial_descr">Long tap and drag the button to change its position on the screen</string>
|
||||||
<string name="shared_string_action_name">Action name</string>
|
<string name="shared_string_action_name">Action name</string>
|
||||||
|
<string name="mappilary_no_internet_desc">You need internet to view photos from Mapillary</string>
|
||||||
|
<string name="retry">Retry</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -3,7 +3,6 @@ package net.osmand;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
@ -14,163 +13,150 @@ import android.widget.ImageView;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.inapp.InAppHelper;
|
|
||||||
|
|
||||||
public class SecondSplashScreenFragment extends Fragment {
|
public class SecondSplashScreenFragment extends Fragment {
|
||||||
public static final String TAG = "SecondSplashScreenFragment";
|
public static final String TAG = "SecondSplashScreenFragment";
|
||||||
public static boolean SHOW = true;
|
public static boolean SHOW = true;
|
||||||
private static final int SECOND_SPLASH_TIME_OUT = 8000;
|
public static boolean VISIBLE = false;
|
||||||
private boolean started = false;
|
|
||||||
private FragmentActivity activity;
|
|
||||||
private OsmandApplication app;
|
|
||||||
|
|
||||||
public OsmandApplication getMyApplication() {
|
public OsmandApplication getMyApplication() {
|
||||||
return ((OsmandApplication) activity.getApplication());
|
return ((OsmandApplication) getActivity().getApplication());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasNavBar() {
|
public MapActivity getMapActivity() {
|
||||||
int id = getResources().getIdentifier("config_showNavigationBar", "bool", "android");
|
return (MapActivity) getActivity();
|
||||||
if (id > 0)
|
}
|
||||||
return getResources().getBoolean(id);
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getStatusBarHeight() {
|
private boolean hasNavBar() {
|
||||||
int statusBarHeight = 0;
|
int id = getResources().getIdentifier("config_showNavigationBar", "bool", "android");
|
||||||
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
if (id > 0) {
|
||||||
if (resourceId > 0) {
|
return getResources().getBoolean(id);
|
||||||
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
|
} else {
|
||||||
}
|
return false;
|
||||||
return statusBarHeight;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getNavigationBarHeight() {
|
private int getStatusBarHeight() {
|
||||||
if (!hasNavBar())
|
int statusBarHeight = 0;
|
||||||
return 0;
|
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||||
int orientation = getResources().getConfiguration().orientation;
|
if (resourceId > 0) {
|
||||||
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
|
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
|
||||||
if (isSmartphone && Configuration.ORIENTATION_LANDSCAPE == orientation)
|
}
|
||||||
return 0;
|
return statusBarHeight;
|
||||||
int id = getResources().getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_height_landscape", "dimen", "android");
|
}
|
||||||
if (id > 0)
|
|
||||||
return getResources().getDimensionPixelSize(id);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getNavigationBarWidth() {
|
private int getNavigationBarHeight() {
|
||||||
if (!hasNavBar())
|
if (!hasNavBar())
|
||||||
return 0;
|
return 0;
|
||||||
int orientation = getResources().getConfiguration().orientation;
|
int orientation = getResources().getConfiguration().orientation;
|
||||||
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
|
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
|
||||||
if (orientation == Configuration.ORIENTATION_LANDSCAPE && isSmartphone) {
|
if (isSmartphone && Configuration.ORIENTATION_LANDSCAPE == orientation)
|
||||||
int id = getResources().getIdentifier("navigation_bar_width", "dimen", "android");
|
return 0;
|
||||||
if (id > 0)
|
int id = getResources().getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_height_landscape", "dimen", "android");
|
||||||
return getResources().getDimensionPixelSize(id);
|
if (id > 0)
|
||||||
}
|
return getResources().getDimensionPixelSize(id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
private int getNavigationBarWidth() {
|
||||||
@Override
|
if (!hasNavBar())
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
return 0;
|
||||||
activity = getActivity();
|
int orientation = getResources().getConfiguration().orientation;
|
||||||
app = getMyApplication();
|
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
|
||||||
|
if (orientation == Configuration.ORIENTATION_LANDSCAPE && isSmartphone) {
|
||||||
|
int id = getResources().getIdentifier("navigation_bar_width", "dimen", "android");
|
||||||
|
if (id > 0)
|
||||||
|
return getResources().getDimensionPixelSize(id);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
RelativeLayout view = new RelativeLayout(activity);
|
@Nullable
|
||||||
view.setOnClickListener(null);
|
@Override
|
||||||
view.setBackgroundColor(getResources().getColor(R.color.map_background_color_light));
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
OsmandApplication app = getMyApplication();
|
||||||
|
OsmandSettings settings = app.getSettings();
|
||||||
|
FragmentActivity activity = getActivity();
|
||||||
|
|
||||||
ImageView logo = new ImageView(getContext());
|
RelativeLayout view = new RelativeLayout(activity);
|
||||||
if (Version.isFreeVersion(app)) {
|
view.setOnClickListener(null);
|
||||||
logo.setImageDrawable(getResources().getDrawable(R.drawable.ic_logo_splash_osmand));
|
view.setBackgroundColor(getResources().getColor(R.color.map_background_color_light));
|
||||||
} else if (Version.isPaidVersion(app) || Version.isDeveloperVersion(app)) {
|
|
||||||
logo.setImageDrawable(getResources().getDrawable(R.drawable.ic_logo_splash_osmand_plus));
|
|
||||||
}
|
|
||||||
RelativeLayout.LayoutParams logoLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
|
||||||
logoLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
|
|
||||||
logoLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
|
|
||||||
ImageView text = new ImageView(activity);
|
|
||||||
if (Version.isFreeVersion(app)) {
|
|
||||||
if ((InAppHelper.isSubscribedToLiveUpdates() && InAppHelper.isFullVersionPurchased()) || InAppHelper.isSubscribedToLiveUpdates()) {
|
|
||||||
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_osmlive));
|
|
||||||
} else if (InAppHelper.isFullVersionPurchased()) {
|
|
||||||
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_inapp));
|
|
||||||
} else {
|
|
||||||
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand));
|
|
||||||
}
|
|
||||||
} else if (Version.isPaidVersion(app) || Version.isDeveloperVersion(app)) {
|
|
||||||
if (InAppHelper.isSubscribedToLiveUpdates()) {
|
|
||||||
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_plus_osmlive));
|
|
||||||
} else {
|
|
||||||
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_plus));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
|
||||||
textLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
|
|
||||||
textLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
|
|
||||||
int defaultLogoMarginTop = (int) getResources().getDimension(R.dimen.splash_screen_logo_top);
|
|
||||||
int logoMarginTop = defaultLogoMarginTop - getStatusBarHeight();
|
|
||||||
int logoPaddingLeft = 0;
|
|
||||||
int logoPaddingRight = 0;
|
|
||||||
int defaultTextMarginBottom = (int) getResources().getDimension(R.dimen.splash_screen_text_bottom);
|
|
||||||
int textMarginBottom = defaultTextMarginBottom - getNavigationBarHeight();
|
|
||||||
int textPaddingLeft = 0;
|
|
||||||
int textPaddingRight = 0;
|
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N_MR1) {
|
|
||||||
if (AndroidUiHelper.getScreenOrientation(activity) == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
|
|
||||||
logoPaddingLeft = getNavigationBarWidth();
|
|
||||||
textPaddingLeft = getNavigationBarWidth();
|
|
||||||
} else if (AndroidUiHelper.getScreenOrientation(activity) == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) {
|
|
||||||
logoPaddingRight = getNavigationBarWidth();
|
|
||||||
textPaddingRight = getNavigationBarWidth();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logoPaddingLeft = getNavigationBarWidth();
|
|
||||||
textPaddingLeft = getNavigationBarWidth();
|
|
||||||
}
|
|
||||||
logoLayoutParams.setMargins(0, logoMarginTop, 0, 0);
|
|
||||||
logo.setPadding(logoPaddingLeft, 0, logoPaddingRight, 0);
|
|
||||||
logo.setLayoutParams(logoLayoutParams);
|
|
||||||
view.addView(logo);
|
|
||||||
textLayoutParams.setMargins(0, 0, 0, textMarginBottom);
|
|
||||||
text.setPadding(textPaddingLeft, 0, textPaddingRight, 0);
|
|
||||||
text.setLayoutParams(textLayoutParams);
|
|
||||||
view.addView(text);
|
|
||||||
|
|
||||||
return view;
|
ImageView logo = new ImageView(getContext());
|
||||||
}
|
if (Version.isFreeVersion(app)) {
|
||||||
|
logo.setImageDrawable(getResources().getDrawable(R.drawable.ic_logo_splash_osmand));
|
||||||
|
} else if (Version.isPaidVersion(app) || Version.isDeveloperVersion(app)) {
|
||||||
|
logo.setImageDrawable(getResources().getDrawable(R.drawable.ic_logo_splash_osmand_plus));
|
||||||
|
}
|
||||||
|
RelativeLayout.LayoutParams logoLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
||||||
|
logoLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
|
||||||
|
logoLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
|
||||||
|
ImageView text = new ImageView(activity);
|
||||||
|
if (Version.isFreeVersion(app)) {
|
||||||
|
if (settings.LIVE_UPDATES_PURCHASED.get()) {
|
||||||
|
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_osmlive));
|
||||||
|
} else if (settings.FULL_VERSION_PURCHASED.get()) {
|
||||||
|
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_inapp));
|
||||||
|
} else {
|
||||||
|
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand));
|
||||||
|
}
|
||||||
|
} else if (Version.isPaidVersion(app) || Version.isDeveloperVersion(app)) {
|
||||||
|
if (settings.LIVE_UPDATES_PURCHASED.get()) {
|
||||||
|
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_plus_osmlive));
|
||||||
|
} else {
|
||||||
|
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_plus));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
||||||
|
textLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
|
||||||
|
textLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
|
||||||
|
int defaultLogoMarginTop = (int) getResources().getDimension(R.dimen.splash_screen_logo_top);
|
||||||
|
int logoMarginTop = defaultLogoMarginTop - getStatusBarHeight();
|
||||||
|
int logoPaddingLeft = 0;
|
||||||
|
int logoPaddingRight = 0;
|
||||||
|
int defaultTextMarginBottom = (int) getResources().getDimension(R.dimen.splash_screen_text_bottom);
|
||||||
|
int textMarginBottom = defaultTextMarginBottom - getNavigationBarHeight();
|
||||||
|
int textPaddingLeft = 0;
|
||||||
|
int textPaddingRight = 0;
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N_MR1) {
|
||||||
|
int screenOrientation = AndroidUiHelper.getScreenOrientation(activity);
|
||||||
|
if (screenOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
|
||||||
|
logoPaddingLeft = getNavigationBarWidth();
|
||||||
|
textPaddingLeft = getNavigationBarWidth();
|
||||||
|
} else if (screenOrientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) {
|
||||||
|
logoPaddingRight = getNavigationBarWidth();
|
||||||
|
textPaddingRight = getNavigationBarWidth();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logoPaddingLeft = getNavigationBarWidth();
|
||||||
|
textPaddingLeft = getNavigationBarWidth();
|
||||||
|
}
|
||||||
|
logoLayoutParams.setMargins(0, logoMarginTop, 0, 0);
|
||||||
|
logo.setPadding(logoPaddingLeft, 0, logoPaddingRight, 0);
|
||||||
|
logo.setLayoutParams(logoLayoutParams);
|
||||||
|
view.addView(logo);
|
||||||
|
textLayoutParams.setMargins(0, 0, 0, textMarginBottom);
|
||||||
|
text.setPadding(textPaddingLeft, 0, textPaddingRight, 0);
|
||||||
|
text.setLayoutParams(textLayoutParams);
|
||||||
|
view.addView(text);
|
||||||
|
|
||||||
@Override
|
return view;
|
||||||
public void onResume() {
|
}
|
||||||
super.onResume();
|
|
||||||
if (activity instanceof MapActivity) {
|
|
||||||
((MapActivity) activity).disableDrawer();
|
|
||||||
}
|
|
||||||
if (!started) {
|
|
||||||
started = true;
|
|
||||||
SecondSplashScreenFragment.SHOW = false;
|
|
||||||
new Handler().postDelayed(new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void onResume() {
|
||||||
if (activity instanceof MapActivity && !((MapActivity) activity).isActivityDestroyed()) {
|
super.onResume();
|
||||||
((MapActivity)activity).dismissSecondSplashScreen();
|
getMapActivity().disableDrawer();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}, SECOND_SPLASH_TIME_OUT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
if (activity instanceof MapActivity) {
|
getMapActivity().enableDrawer();
|
||||||
((MapActivity) activity).enableDrawer();
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import java.util.List;
|
||||||
public class GPXDatabase {
|
public class GPXDatabase {
|
||||||
|
|
||||||
private static final String DB_NAME = "gpx_database";
|
private static final String DB_NAME = "gpx_database";
|
||||||
private static final int DB_VERSION = 4;
|
private static final int DB_VERSION = 5;
|
||||||
private static final String GPX_TABLE_NAME = "gpxTable";
|
private static final String GPX_TABLE_NAME = "gpxTable";
|
||||||
private static final String GPX_COL_NAME = "fileName";
|
private static final String GPX_COL_NAME = "fileName";
|
||||||
private static final String GPX_COL_DIR = "fileDir";
|
private static final String GPX_COL_DIR = "fileDir";
|
||||||
|
@ -183,11 +183,43 @@ public class GPXDatabase {
|
||||||
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_SPLIT_TYPE + " int");
|
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_SPLIT_TYPE + " int");
|
||||||
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_SPLIT_INTERVAL + " double");
|
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_SPLIT_INTERVAL + " double");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldVersion < 3) {
|
if (oldVersion < 5) {
|
||||||
List<GpxDataItem> items = getItems();
|
boolean colorColumnExists = false;
|
||||||
for (GpxDataItem item : items) {
|
boolean fileLastModifiedTimeColumnExists = false;
|
||||||
updateLastModifiedTime(item);
|
boolean splitTypeColumnExists = false;
|
||||||
|
boolean splitIntervalColumnExists = false;
|
||||||
|
SQLiteCursor cursor = db.rawQuery("PRAGMA table_info(" + GPX_TABLE_NAME + ")", null);
|
||||||
|
if (cursor.moveToFirst()) {
|
||||||
|
do {
|
||||||
|
String columnName = cursor.getString(1);
|
||||||
|
if (!colorColumnExists && columnName.equals(GPX_COL_COLOR)) {
|
||||||
|
colorColumnExists = true;
|
||||||
|
} else if (!fileLastModifiedTimeColumnExists && columnName.equals(GPX_COL_FILE_LAST_MODIFIED_TIME)) {
|
||||||
|
fileLastModifiedTimeColumnExists = true;
|
||||||
|
} else if (!splitTypeColumnExists && columnName.equals(GPX_COL_SPLIT_TYPE)) {
|
||||||
|
splitTypeColumnExists = true;
|
||||||
|
} else if (!splitIntervalColumnExists && columnName.equals(GPX_COL_SPLIT_INTERVAL)) {
|
||||||
|
splitIntervalColumnExists = true;
|
||||||
|
}
|
||||||
|
} while (cursor.moveToNext());
|
||||||
|
}
|
||||||
|
cursor.close();
|
||||||
|
if (!colorColumnExists) {
|
||||||
|
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_COLOR + " TEXT");
|
||||||
|
}
|
||||||
|
if (!fileLastModifiedTimeColumnExists) {
|
||||||
|
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_FILE_LAST_MODIFIED_TIME + " long");
|
||||||
|
List<GpxDataItem> items = getItems();
|
||||||
|
for (GpxDataItem item : items) {
|
||||||
|
updateLastModifiedTime(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!splitTypeColumnExists) {
|
||||||
|
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_SPLIT_TYPE + " int");
|
||||||
|
}
|
||||||
|
if (!splitIntervalColumnExists) {
|
||||||
|
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_SPLIT_INTERVAL + " double");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -528,10 +528,9 @@ public class GpxSelectionHelper {
|
||||||
public void processPoints() {
|
public void processPoints() {
|
||||||
update();
|
update();
|
||||||
this.processedPointsToDisplay = gpxFile.proccessPoints();
|
this.processedPointsToDisplay = gpxFile.proccessPoints();
|
||||||
List<TrkSegment> processedRoutePointsToDisplay = gpxFile.processRoutePoints();
|
if (this.processedPointsToDisplay.isEmpty()) {
|
||||||
if (!processedRoutePointsToDisplay.isEmpty()) {
|
this.processedPointsToDisplay = gpxFile.processRoutePoints();
|
||||||
this.processedPointsToDisplay.addAll(processedRoutePointsToDisplay);
|
routePoints = !this.processedPointsToDisplay.isEmpty();
|
||||||
routePoints = !processedRoutePointsToDisplay.isEmpty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -499,8 +499,8 @@ public class OsmAndLocationProvider implements SensorEventListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private float calcGeoMagneticCorrection(float val) {
|
private float calcGeoMagneticCorrection(float val) {
|
||||||
if (previousCorrectionValue == 360 && getLastKnownLocation() != null) {
|
net.osmand.Location l = getLastKnownLocation();
|
||||||
net.osmand.Location l = getLastKnownLocation();
|
if (previousCorrectionValue == 360 && l != null) {
|
||||||
GeomagneticField gf = new GeomagneticField((float) l.getLatitude(), (float) l.getLongitude(), (float) l.getAltitude(),
|
GeomagneticField gf = new GeomagneticField((float) l.getLatitude(), (float) l.getLongitude(), (float) l.getAltitude(),
|
||||||
System.currentTimeMillis());
|
System.currentTimeMillis());
|
||||||
previousCorrectionValue = gf.getDeclination();
|
previousCorrectionValue = gf.getDeclination();
|
||||||
|
|
|
@ -157,6 +157,7 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
externalStorageDirectoryReadOnly = true;
|
externalStorageDirectoryReadOnly = true;
|
||||||
externalStorageDirectory = osmandSettings.getInternalAppPath();
|
externalStorageDirectory = osmandSettings.getInternalAppPath();
|
||||||
}
|
}
|
||||||
|
osmandSettings.USE_MAP_MARKERS.set(true);
|
||||||
|
|
||||||
checkPreferredLocale();
|
checkPreferredLocale();
|
||||||
appInitializer.onCreateApplication();
|
appInitializer.onCreateApplication();
|
||||||
|
@ -435,6 +436,12 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
builder.setNeutralButton(R.string.shared_string_do_not_use, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
osmandSettings.VOICE_PROVIDER.set(OsmandSettings.VOICE_PROVIDER_NOT_USE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
builder.setView(view);
|
builder.setView(view);
|
||||||
builder.show();
|
builder.show();
|
||||||
|
|
|
@ -178,7 +178,7 @@ public abstract class OsmandPlugin {
|
||||||
allPlugins.add(srtm);
|
allPlugins.add(srtm);
|
||||||
} else {
|
} else {
|
||||||
if (marketEnabled) {
|
if (marketEnabled) {
|
||||||
srtm.setInstallURL(Version.marketPrefix(app) + id);
|
srtm.setInstallURL(Version.getUrlWithUtmRef(app, id));
|
||||||
allPlugins.add(srtm);
|
allPlugins.add(srtm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -926,6 +926,8 @@ public class OsmandSettings {
|
||||||
public static final String BILLING_USER_DONATION_WORLD_PARAMETER = "";
|
public static final String BILLING_USER_DONATION_WORLD_PARAMETER = "";
|
||||||
public static final String BILLING_USER_DONATION_NONE_PARAMETER = "none";
|
public static final String BILLING_USER_DONATION_NONE_PARAMETER = "none";
|
||||||
|
|
||||||
|
public final OsmandPreference<Boolean> INAPPS_READ = new BooleanPreference("inapps_read", false).makeGlobal();
|
||||||
|
|
||||||
public final OsmandPreference<String> BILLING_USER_ID = new StringPreference("billing_user_id", "").makeGlobal();
|
public final OsmandPreference<String> BILLING_USER_ID = new StringPreference("billing_user_id", "").makeGlobal();
|
||||||
public final OsmandPreference<String> BILLING_USER_TOKEN = new StringPreference("billing_user_token", "").makeGlobal();
|
public final OsmandPreference<String> BILLING_USER_TOKEN = new StringPreference("billing_user_token", "").makeGlobal();
|
||||||
public final OsmandPreference<String> BILLING_USER_NAME = new StringPreference("billing_user_name", "").makeGlobal();
|
public final OsmandPreference<String> BILLING_USER_NAME = new StringPreference("billing_user_name", "").makeGlobal();
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class Version {
|
||||||
private final static String FREE_VERSION_NAME = "net.osmand";
|
private final static String FREE_VERSION_NAME = "net.osmand";
|
||||||
private final static String FREE_DEV_VERSION_NAME = "net.osmand.dev";
|
private final static String FREE_DEV_VERSION_NAME = "net.osmand.dev";
|
||||||
private final static String SHERPAFY_VERSION_NAME = "net.osmand.sherpafy";
|
private final static String SHERPAFY_VERSION_NAME = "net.osmand.sherpafy";
|
||||||
|
private final static String UTM_REF = "&referrer=utm_source%3Dosmand";
|
||||||
|
|
||||||
public static boolean isGpsStatusEnabled(OsmandApplication ctx) {
|
public static boolean isGpsStatusEnabled(OsmandApplication ctx) {
|
||||||
return isGooglePlayEnabled(ctx) && !isBlackberry(ctx);
|
return isGooglePlayEnabled(ctx) && !isBlackberry(ctx);
|
||||||
|
@ -31,10 +31,14 @@ public class Version {
|
||||||
if (isAmazonEnabled(ctx)) {
|
if (isAmazonEnabled(ctx)) {
|
||||||
return "amzn://apps/android?p=";
|
return "amzn://apps/android?p=";
|
||||||
} else if (isGooglePlayEnabled(ctx)) {
|
} else if (isGooglePlayEnabled(ctx)) {
|
||||||
return "market://search?q=pname:";
|
return "market://details?id=";
|
||||||
}
|
}
|
||||||
return "https://osmand.net/apps?id=";
|
return "https://osmand.net/apps?id=";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getUrlWithUtmRef(OsmandApplication ctx, String appName) {
|
||||||
|
return marketPrefix(ctx) + appName + UTM_REF;
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean isAmazonEnabled(OsmandApplication ctx) {
|
private static boolean isAmazonEnabled(OsmandApplication ctx) {
|
||||||
return ctx.getString(R.string.versionFeatures).contains("+amazon");
|
return ctx.getString(R.string.versionFeatures).contains("+amazon");
|
||||||
|
|
|
@ -295,7 +295,9 @@ public class ContributionVersionActivity extends OsmandListActivity {
|
||||||
this.activity.runOnUiThread(new Runnable() {
|
this.activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
activity.endThreadOperation(operationId, e);
|
if (activity != null) {
|
||||||
|
activity.endThreadOperation(operationId, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.ActivityInfo;
|
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
@ -25,6 +24,7 @@ import android.support.v4.app.ActivityCompat;
|
||||||
import android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback;
|
import android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
@ -90,6 +90,7 @@ import net.osmand.plus.helpers.WakeLockHelper;
|
||||||
import net.osmand.plus.inapp.InAppHelper;
|
import net.osmand.plus.inapp.InAppHelper;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenuFragment;
|
import net.osmand.plus.mapcontextmenu.MapContextMenuFragment;
|
||||||
|
import net.osmand.plus.mapcontextmenu.builders.cards.dialogs.ContextMenuCardDialogFragment;
|
||||||
import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
|
import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenuFragment;
|
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenuFragment;
|
||||||
|
@ -110,6 +111,7 @@ import net.osmand.plus.views.OsmAndMapLayersView;
|
||||||
import net.osmand.plus.views.OsmAndMapSurfaceView;
|
import net.osmand.plus.views.OsmAndMapSurfaceView;
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
import net.osmand.plus.views.OsmandMapTileView.OnDrawMapListener;
|
||||||
import net.osmand.plus.views.corenative.NativeCoreContext;
|
import net.osmand.plus.views.corenative.NativeCoreContext;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
||||||
|
@ -132,7 +134,7 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class MapActivity extends OsmandActionBarActivity implements DownloadEvents,
|
public class MapActivity extends OsmandActionBarActivity implements DownloadEvents,
|
||||||
OnRequestPermissionsResultCallback, IRouteInformationListener,
|
OnRequestPermissionsResultCallback, IRouteInformationListener,
|
||||||
MapMarkerChangedListener, OnDismissDialogFragmentListener {
|
MapMarkerChangedListener, OnDismissDialogFragmentListener, OnDrawMapListener {
|
||||||
public static final String INTENT_KEY_PARENT_MAP_ACTIVITY = "intent_parent_map_activity_key";
|
public static final String INTENT_KEY_PARENT_MAP_ACTIVITY = "intent_parent_map_activity_key";
|
||||||
|
|
||||||
private static final int SHOW_POSITION_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 1;
|
private static final int SHOW_POSITION_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 1;
|
||||||
|
@ -140,6 +142,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
private static final int LONG_KEYPRESS_DELAY = 500;
|
private static final int LONG_KEYPRESS_DELAY = 500;
|
||||||
private static final int ZOOM_LABEL_DISPLAY = 16;
|
private static final int ZOOM_LABEL_DISPLAY = 16;
|
||||||
private static final int MIN_ZOOM_LABEL_DISPLAY = 12;
|
private static final int MIN_ZOOM_LABEL_DISPLAY = 12;
|
||||||
|
private static final int SECOND_SPLASH_TIME_OUT = 8000;
|
||||||
|
|
||||||
private static final Log LOG = PlatformUtil.getLog(MapActivity.class);
|
private static final Log LOG = PlatformUtil.getLog(MapActivity.class);
|
||||||
|
|
||||||
|
@ -188,8 +191,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
|
|
||||||
private boolean mIsDestroyed = false;
|
private boolean mIsDestroyed = false;
|
||||||
private InAppHelper inAppHelper;
|
private InAppHelper inAppHelper;
|
||||||
|
private Timer splashScreenTimer;
|
||||||
private SecondSplashScreenFragment secondSplashScreenFragment;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -496,6 +498,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mapContextMenu.isVisible() && mapContextMenu.isClosable()) {
|
||||||
|
mapContextMenu.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (prevActivityIntent != null && getSupportFragmentManager().getBackStackEntryCount() == 0) {
|
if (prevActivityIntent != null && getSupportFragmentManager().getBackStackEntryCount() == 0) {
|
||||||
prevActivityIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
prevActivityIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
LatLon loc = getMapLocation();
|
LatLon loc = getMapLocation();
|
||||||
|
@ -693,25 +699,67 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
new XMasDialogFragment().show(getSupportFragmentManager(), XMasDialogFragment.TAG);
|
new XMasDialogFragment().show(getSupportFragmentManager(), XMasDialogFragment.TAG);
|
||||||
}
|
}
|
||||||
FirstUsageWelcomeFragment.SHOW = false;
|
FirstUsageWelcomeFragment.SHOW = false;
|
||||||
|
|
||||||
if (SecondSplashScreenFragment.SHOW) {
|
if (SecondSplashScreenFragment.SHOW) {
|
||||||
secondSplashScreenFragment = new SecondSplashScreenFragment();
|
SecondSplashScreenFragment.SHOW = false;
|
||||||
getSupportFragmentManager().beginTransaction().add(R.id.fragmentContainer, secondSplashScreenFragment, SecondSplashScreenFragment.TAG).commitAllowingStateLoss();
|
SecondSplashScreenFragment.VISIBLE = true;
|
||||||
|
getSupportFragmentManager()
|
||||||
|
.beginTransaction()
|
||||||
|
.add(R.id.fragmentContainer, new SecondSplashScreenFragment(), SecondSplashScreenFragment.TAG)
|
||||||
|
.commitAllowingStateLoss();
|
||||||
|
mapView.setOnDrawMapListener(this);
|
||||||
|
splashScreenTimer = new Timer();
|
||||||
|
splashScreenTimer.schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
dismissSecondSplashScreen();
|
||||||
|
}
|
||||||
|
}, SECOND_SPLASH_TIME_OUT);
|
||||||
} else {
|
} else {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
if (SecondSplashScreenFragment.VISIBLE) {
|
||||||
|
dismissSecondSplashScreen();
|
||||||
|
}
|
||||||
|
//setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
||||||
if (settings.MAP_SCREEN_ORIENTATION.get() != getRequestedOrientation()) {
|
if (settings.MAP_SCREEN_ORIENTATION.get() != getRequestedOrientation()) {
|
||||||
setRequestedOrientation(settings.MAP_SCREEN_ORIENTATION.get());
|
setRequestedOrientation(settings.MAP_SCREEN_ORIENTATION.get());
|
||||||
// can't return from this method we are not sure if activity will be recreated or not
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dismissSecondSplashScreen() {
|
private void dismissSecondSplashScreen() {
|
||||||
SecondSplashScreenFragment.SHOW = false;
|
if (SecondSplashScreenFragment.VISIBLE) {
|
||||||
getSupportFragmentManager().beginTransaction().remove(secondSplashScreenFragment).commitAllowingStateLoss();
|
SecondSplashScreenFragment.VISIBLE = false;
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
SecondSplashScreenFragment.SHOW = false;
|
||||||
if (app.getSettings().MAP_SCREEN_ORIENTATION.get() != getRequestedOrientation()) {
|
Fragment fragment = getSupportFragmentManager().findFragmentByTag(SecondSplashScreenFragment.TAG);
|
||||||
setRequestedOrientation(app.getSettings().MAP_SCREEN_ORIENTATION.get());
|
if (fragment != null) {
|
||||||
// can't return from this method we are not sure if activity will be recreated or not
|
getSupportFragmentManager().beginTransaction().remove(fragment).commitAllowingStateLoss();
|
||||||
|
}
|
||||||
|
//setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
||||||
|
if (app.getSettings().MAP_SCREEN_ORIENTATION.get() != getRequestedOrientation()) {
|
||||||
|
setRequestedOrientation(app.getSettings().MAP_SCREEN_ORIENTATION.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDrawOverMap() {
|
||||||
|
mapView.setOnDrawMapListener(null);
|
||||||
|
cancelSplashScreenTimer();
|
||||||
|
dismissSecondSplashScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancelSplashScreenTimer() {
|
||||||
|
if (splashScreenTimer != null) {
|
||||||
|
splashScreenTimer.cancel();
|
||||||
|
splashScreenTimer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dismissCardDialog() {
|
||||||
|
try {
|
||||||
|
getSupportFragmentManager().popBackStack(ContextMenuCardDialogFragment.TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1037,6 +1085,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
|
mapView.setOnDrawMapListener(null);
|
||||||
|
cancelSplashScreenTimer();
|
||||||
app.getMapMarkersHelper().removeListener(this);
|
app.getMapMarkersHelper().removeListener(this);
|
||||||
app.getRoutingHelper().removeListener(this);
|
app.getRoutingHelper().removeListener(this);
|
||||||
app.getDownloadThread().resetUiActivity(this);
|
app.getDownloadThread().resetUiActivity(this);
|
||||||
|
|
|
@ -921,6 +921,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
menuItemsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
menuItemsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
mapActivity.dismissCardDialog();
|
||||||
ContextMenuItem item = contextMenuAdapter.getItem(position);
|
ContextMenuItem item = contextMenuAdapter.getItem(position);
|
||||||
ContextMenuAdapter.ItemClickListener click = item.getItemClickListener();
|
ContextMenuAdapter.ItemClickListener click = item.getItemClickListener();
|
||||||
if (click != null && click.onContextMenuClick(simpleListAdapter, item.getTitleId(),
|
if (click != null && click.onContextMenuClick(simpleListAdapter, item.getTitleId(),
|
||||||
|
|
|
@ -76,7 +76,54 @@ public class TrackActivity extends TabActivity {
|
||||||
actionBar.setElevation(0);
|
actionBar.setElevation(0);
|
||||||
}
|
}
|
||||||
setContentView(R.layout.tab_content);
|
setContentView(R.layout.tab_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setGpxDataItem(GpxDataItem gpxDataItem) {
|
||||||
|
this.gpxDataItem = gpxDataItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setGpx(GPXFile result) {
|
||||||
|
this.gpxFile = result;
|
||||||
|
if (file == null) {
|
||||||
|
this.gpxFile = getMyApplication().getSavingTrackHelper().getCurrentGpx();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GpxDisplayGroup> getGpxFile(boolean useDisplayGroups) {
|
||||||
|
if (gpxFile == null) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
if (gpxFile.modifiedTime != modifiedTime) {
|
||||||
|
modifiedTime = gpxFile.modifiedTime;
|
||||||
|
GpxSelectionHelper selectedGpxHelper = ((OsmandApplication) getApplication()).getSelectedGpxHelper();
|
||||||
|
displayGroups = selectedGpxHelper.collectDisplayGroups(gpxFile);
|
||||||
|
originalGroups.clear();
|
||||||
|
for (GpxDisplayGroup g : displayGroups) {
|
||||||
|
originalGroups.add(g.cloneInstance());
|
||||||
|
}
|
||||||
|
if (file != null) {
|
||||||
|
SelectedGpxFile sf = selectedGpxHelper.getSelectedFileByPath(gpxFile.path);
|
||||||
|
if (sf != null && file != null && sf.getDisplayGroups() != null) {
|
||||||
|
displayGroups = sf.getDisplayGroups();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (useDisplayGroups) {
|
||||||
|
return displayGroups;
|
||||||
|
} else {
|
||||||
|
return originalGroups;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttachFragment(Fragment fragment) {
|
||||||
|
fragList.add(new WeakReference<>(fragment));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
stopped = false;
|
||||||
slidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs);
|
slidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs);
|
||||||
if (slidingTabLayout != null) {
|
if (slidingTabLayout != null) {
|
||||||
slidingTabLayout.setShouldExpand(true);
|
slidingTabLayout.setShouldExpand(true);
|
||||||
|
@ -151,53 +198,6 @@ public class TrackActivity extends TabActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setGpxDataItem(GpxDataItem gpxDataItem) {
|
|
||||||
this.gpxDataItem = gpxDataItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setGpx(GPXFile result) {
|
|
||||||
this.gpxFile = result;
|
|
||||||
if (file == null) {
|
|
||||||
this.gpxFile = getMyApplication().getSavingTrackHelper().getCurrentGpx();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<GpxDisplayGroup> getGpxFile(boolean useDisplayGroups) {
|
|
||||||
if (gpxFile == null) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
if (gpxFile.modifiedTime != modifiedTime) {
|
|
||||||
modifiedTime = gpxFile.modifiedTime;
|
|
||||||
GpxSelectionHelper selectedGpxHelper = ((OsmandApplication) getApplication()).getSelectedGpxHelper();
|
|
||||||
displayGroups = selectedGpxHelper.collectDisplayGroups(gpxFile);
|
|
||||||
originalGroups.clear();
|
|
||||||
for (GpxDisplayGroup g : displayGroups) {
|
|
||||||
originalGroups.add(g.cloneInstance());
|
|
||||||
}
|
|
||||||
if (file != null) {
|
|
||||||
SelectedGpxFile sf = selectedGpxHelper.getSelectedFileByPath(gpxFile.path);
|
|
||||||
if (sf != null && file != null && sf.getDisplayGroups() != null) {
|
|
||||||
displayGroups = sf.getDisplayGroups();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (useDisplayGroups) {
|
|
||||||
return displayGroups;
|
|
||||||
} else {
|
|
||||||
return originalGroups;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAttachFragment(Fragment fragment) {
|
|
||||||
fragList.add(new WeakReference<>(fragment));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
}
|
|
||||||
|
|
||||||
public OsmandApplication getMyApplication() {
|
public OsmandApplication getMyApplication() {
|
||||||
return (OsmandApplication) getApplication();
|
return (OsmandApplication) getApplication();
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,8 +198,7 @@ public class ShareDialog {
|
||||||
builder.setPositiveButton(activity.getString(R.string.shared_string_yes), new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(activity.getString(R.string.shared_string_yes), new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.marketPrefix((OsmandApplication) activity.getApplication())
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.getUrlWithUtmRef((OsmandApplication) activity.getApplication(), ZXING_BARCODE_SCANNER_COMPONENT)));
|
||||||
+ ZXING_BARCODE_SCANNER_COMPONENT));
|
|
||||||
try {
|
try {
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
|
|
|
@ -26,7 +26,6 @@ import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
|
||||||
|
|
||||||
public class StartGPSStatus extends OsmAndAction {
|
public class StartGPSStatus extends OsmAndAction {
|
||||||
|
|
||||||
|
@ -178,7 +177,7 @@ public class StartGPSStatus extends OsmAndAction {
|
||||||
builder.setPositiveButton(mapActivity.getString(R.string.shared_string_yes), new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(mapActivity.getString(R.string.shared_string_yes), new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.marketPrefix(getMyApplication()) + g.appName));
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.getUrlWithUtmRef(getMyApplication(), g.appName)));
|
||||||
try {
|
try {
|
||||||
mapActivity.startActivity(intent);
|
mapActivity.startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
|
|
|
@ -862,14 +862,16 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initRecMenu(AVActionType actionType, double lat, double lon) {
|
private void initRecMenu(AVActionType actionType, double lat, double lon) {
|
||||||
currentRecording = new CurrentRecording(actionType);
|
if (mapActivity != null) {
|
||||||
if (actionType == AVActionType.REC_PHOTO) {
|
currentRecording = new CurrentRecording(actionType);
|
||||||
recordingMenu = new AudioVideoNoteRecordingMenuFullScreen(this, lat, lon);
|
if (actionType == AVActionType.REC_PHOTO) {
|
||||||
} else {
|
recordingMenu = new AudioVideoNoteRecordingMenuFullScreen(this, lat, lon);
|
||||||
recordingMenu = new AudioVideoNoteRecordingMenu(this, lat, lon);
|
} else {
|
||||||
|
recordingMenu = new AudioVideoNoteRecordingMenu(this, lat, lon);
|
||||||
|
}
|
||||||
|
recordingDone = false;
|
||||||
|
lockScreenOrientation();
|
||||||
}
|
}
|
||||||
recordingDone = false;
|
|
||||||
lockScreenOrientation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordVideo(final double lat, final double lon, final MapActivity mapActivity) {
|
public void recordVideo(final double lat, final double lon, final MapActivity mapActivity) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.osmand.plus.base;
|
package net.osmand.plus.base;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.support.v4.util.Pair;
|
import android.support.v4.util.Pair;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
||||||
|
@ -150,28 +151,45 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
||||||
return movingToMyLocation;
|
return movingToMyLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void detectDrivingRegion(final LatLon latLon) {
|
||||||
|
|
||||||
|
new AsyncTask<LatLon, Void, BinaryMapDataObject>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BinaryMapDataObject doInBackground(LatLon... latLons) {
|
||||||
|
try {
|
||||||
|
if (latLons != null && latLons.length > 0) {
|
||||||
|
return app.getRegions().findBinaryMapDataObject(latLons[0]);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(BinaryMapDataObject o) {
|
||||||
|
if (o != null) {
|
||||||
|
String fullName = app.getRegions().getFullName(o);
|
||||||
|
WorldRegion worldRegion = app.getRegions().getRegionData(fullName);
|
||||||
|
if (worldRegion != null) {
|
||||||
|
app.setupDrivingRegion(worldRegion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, latLon);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLocation(Location location) {
|
public void updateLocation(Location location) {
|
||||||
myLocation = location;
|
myLocation = location;
|
||||||
showViewAngle = false;
|
showViewAngle = false;
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
locationProvider = location.getProvider();
|
locationProvider = location.getProvider();
|
||||||
if (settings.DRIVING_REGION_AUTOMATIC.get() && !drivingRegionUpdated) {
|
if (settings.DRIVING_REGION_AUTOMATIC.get() && !drivingRegionUpdated && !app.isApplicationInitializing()) {
|
||||||
try {
|
drivingRegionUpdated = true;
|
||||||
BinaryMapDataObject o = app.getRegions().findBinaryMapDataObject(
|
detectDrivingRegion(new LatLon(location.getLatitude(), location.getLongitude()));
|
||||||
new LatLon(location.getLatitude(), location.getLongitude()));
|
|
||||||
if (o != null) {
|
|
||||||
String fullName = app.getRegions().getFullName(o);
|
|
||||||
WorldRegion worldRegion = app.getRegions().getRegionData(fullName);
|
|
||||||
if (worldRegion != null) {
|
|
||||||
app.setupDrivingRegion(worldRegion);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
drivingRegionUpdated = true;
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mapView != null) {
|
if (mapView != null) {
|
||||||
|
@ -339,8 +357,8 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
||||||
OsmAndLocationProvider locationProvider = app.getLocationProvider();
|
OsmAndLocationProvider locationProvider = app.getLocationProvider();
|
||||||
if (!isMapLinkedToLocation()) {
|
if (!isMapLinkedToLocation()) {
|
||||||
setMapLinkedToLocation(true);
|
setMapLinkedToLocation(true);
|
||||||
if (locationProvider.getLastKnownLocation() != null) {
|
net.osmand.Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
||||||
net.osmand.Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
if (lastKnownLocation != null) {
|
||||||
AnimateDraggingMapThread thread = mapView.getAnimatedDraggingThread();
|
AnimateDraggingMapThread thread = mapView.getAnimatedDraggingThread();
|
||||||
int fZoom = mapView.getZoom() < zoom ? zoom : mapView.getZoom();
|
int fZoom = mapView.getZoom() < zoom ? zoom : mapView.getZoom();
|
||||||
movingToMyLocation = true;
|
movingToMyLocation = true;
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class DashRateUsFragment extends DashBaseFragment {
|
||||||
return;
|
return;
|
||||||
case USER_LIKES_APP:
|
case USER_LIKES_APP:
|
||||||
settings.RATE_US_STATE.set(RateUsBottomSheetDialog.RateUsState.LIKED);
|
settings.RATE_US_STATE.set(RateUsBottomSheetDialog.RateUsState.LIKED);
|
||||||
Uri uri = Uri.parse(Version.marketPrefix(getMyApplication()) + getActivity().getPackageName());
|
Uri uri = Uri.parse(Version.getUrlWithUtmRef(getMyApplication(), getActivity().getPackageName()));
|
||||||
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
|
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
startActivity(goToMarket);
|
startActivity(goToMarket);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -793,8 +793,10 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
if (swipeDismissListener != null) {
|
if (swipeDismissListener != null) {
|
||||||
swipeDismissListener.discardUndo();
|
swipeDismissListener.discardUndo();
|
||||||
}
|
}
|
||||||
|
removeMapillaryFiltersFragment();
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
mapActivity.dismissCardDialog();
|
||||||
mapActivity.getContextMenu().hideMenues();
|
mapActivity.getContextMenu().hideMenues();
|
||||||
mapViewLocation = mapActivity.getMapLocation();
|
mapViewLocation = mapActivity.getMapLocation();
|
||||||
mapRotation = mapActivity.getMapRotate();
|
mapRotation = mapActivity.getMapRotate();
|
||||||
|
@ -818,7 +820,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
View listViewLayout = dashboardView.findViewById(R.id.dash_list_view_layout);
|
View listViewLayout = dashboardView.findViewById(R.id.dash_list_view_layout);
|
||||||
ScrollView scrollView = (ScrollView) dashboardView.findViewById(R.id.main_scroll);
|
ScrollView scrollView = (ScrollView) dashboardView.findViewById(R.id.main_scroll);
|
||||||
if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.MAPILLARY) {
|
if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.MAPILLARY) {
|
||||||
removeMapillaryFiltersFragment();
|
|
||||||
if (visibleType == DashboardType.DASHBOARD) {
|
if (visibleType == DashboardType.DASHBOARD) {
|
||||||
addOrUpdateDashboardFragments();
|
addOrUpdateDashboardFragments();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class RateUsBottomSheetDialog extends BottomSheetDialogFragment {
|
||||||
return;
|
return;
|
||||||
case USER_LIKES_APP:
|
case USER_LIKES_APP:
|
||||||
settings.RATE_US_STATE.set(RateUsBottomSheetDialog.RateUsState.LIKED);
|
settings.RATE_US_STATE.set(RateUsBottomSheetDialog.RateUsState.LIKED);
|
||||||
Uri uri = Uri.parse(Version.marketPrefix(getMyApplication()) + getActivity().getPackageName());
|
Uri uri = Uri.parse(Version.getUrlWithUtmRef(getMyApplication(), getActivity().getPackageName()));
|
||||||
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
|
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
startActivity(goToMarket);
|
startActivity(goToMarket);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -248,7 +248,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
|
||||||
} else {
|
} else {
|
||||||
app.logEvent(this, "paid_version_redirect");
|
app.logEvent(this, "paid_version_redirect");
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW,
|
Intent intent = new Intent(Intent.ACTION_VIEW,
|
||||||
Uri.parse(Version.marketPrefix(app) + "net.osmand.plus"));
|
Uri.parse(Version.getUrlWithUtmRef(app, "net.osmand.plus")));
|
||||||
try {
|
try {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
|
|
|
@ -381,7 +381,7 @@ public class DownloadIndexesThread {
|
||||||
builder.setPositiveButton(R.string.button_upgrade_osmandplus, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.button_upgrade_osmandplus, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:net.osmand.plus"));
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.getUrlWithUtmRef(app, "net.osmand.plus")));
|
||||||
try {
|
try {
|
||||||
ctx.startActivity(intent);
|
ctx.startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
|
|
|
@ -224,8 +224,7 @@ public class DownloadValidationManager {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW,
|
Intent intent = new Intent(Intent.ACTION_VIEW,
|
||||||
Uri.parse(Version.marketPrefix(getMyApplication())
|
Uri.parse(Version.getUrlWithUtmRef(getMyApplication(), "net.osmand.plus")));
|
||||||
+ "net.osmand.plus"));
|
|
||||||
try {
|
try {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import net.osmand.IProgress;
|
||||||
import net.osmand.plus.OnDismissDialogFragmentListener;
|
import net.osmand.plus.OnDismissDialogFragmentListener;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
@ -24,6 +25,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.base.BottomSheetDialogFragment;
|
import net.osmand.plus.base.BottomSheetDialogFragment;
|
||||||
import net.osmand.plus.dashboard.DashChooseAppDirFragment;
|
import net.osmand.plus.dashboard.DashChooseAppDirFragment;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
|
import net.osmand.plus.download.DownloadIndexesThread;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -196,11 +198,22 @@ public class DataStoragePlaceDialogFragment extends BottomSheetDialogFragment {
|
||||||
return sz;
|
return sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkAssets() {
|
||||||
|
getMyApplication().getResourceManager().checkAssets(IProgress.EMPTY_PROGRESS, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateDownloadIndexes() {
|
||||||
|
DownloadIndexesThread downloadIndexesThread = getMyApplication().getDownloadThread();
|
||||||
|
downloadIndexesThread.runReloadIndexFilesSilent();
|
||||||
|
}
|
||||||
|
|
||||||
private View.OnClickListener deviceMemoryOnClickListener =
|
private View.OnClickListener deviceMemoryOnClickListener =
|
||||||
new View.OnClickListener() {
|
new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
saveFilesLocation(deviceStorageType, deviceStorage, getActivity());
|
saveFilesLocation(deviceStorageType, deviceStorage, getActivity());
|
||||||
|
checkAssets();
|
||||||
|
updateDownloadIndexes();
|
||||||
isInterestedInFirstTime = false;
|
isInterestedInFirstTime = false;
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
@ -211,6 +224,8 @@ public class DataStoragePlaceDialogFragment extends BottomSheetDialogFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
saveFilesLocation(sharedStorageType, sharedStorage, getActivity());
|
saveFilesLocation(sharedStorageType, sharedStorage, getActivity());
|
||||||
|
checkAssets();
|
||||||
|
updateDownloadIndexes();
|
||||||
isInterestedInFirstTime = false;
|
isInterestedInFirstTime = false;
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
@ -221,6 +236,8 @@ public class DataStoragePlaceDialogFragment extends BottomSheetDialogFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
boolean res = saveFilesLocation(cardStorageType, cardStorage, getActivity());
|
boolean res = saveFilesLocation(cardStorageType, cardStorage, getActivity());
|
||||||
|
checkAssets();
|
||||||
|
updateDownloadIndexes();
|
||||||
isInterestedInFirstTime = false;
|
isInterestedInFirstTime = false;
|
||||||
if (res) {
|
if (res) {
|
||||||
dismiss();
|
dismiss();
|
||||||
|
|
|
@ -43,16 +43,17 @@ public class DiscountHelper {
|
||||||
|
|
||||||
|
|
||||||
public static void checkAndDisplay(final MapActivity mapActivity) {
|
public static void checkAndDisplay(final MapActivity mapActivity) {
|
||||||
if (mapActivity.getMyApplication().getSettings().DO_NOT_SHOW_STARTUP_MESSAGES.get()) {
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
|
OsmandSettings settings = app.getSettings();
|
||||||
|
if (settings.DO_NOT_SHOW_STARTUP_MESSAGES.get() || !settings.INAPPS_READ.get()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mBannerVisible) {
|
if (mBannerVisible) {
|
||||||
showDiscountBanner(mapActivity, mTitle, mDescription, mIcon, mUrl);
|
showDiscountBanner(mapActivity, mTitle, mDescription, mIcon, mUrl);
|
||||||
}
|
}
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
|
||||||
if (System.currentTimeMillis() - mLastCheckTime < 1000 * 60 * 60 * 24
|
if (System.currentTimeMillis() - mLastCheckTime < 1000 * 60 * 60 * 24
|
||||||
|| !app.getSettings().isInternetConnectionAvailable()
|
|| !settings.isInternetConnectionAvailable()
|
||||||
|| app.getSettings().NO_DISCOUNT_INFO.get()) {
|
|| settings.NO_DISCOUNT_INFO.get()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mLastCheckTime = System.currentTimeMillis();
|
mLastCheckTime = System.currentTimeMillis();
|
||||||
|
@ -146,7 +147,7 @@ public class DiscountHelper {
|
||||||
int i = url.indexOf("osmand-market-app:");
|
int i = url.indexOf("osmand-market-app:");
|
||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
String appName = url.substring(i + 18);
|
String appName = url.substring(i + 18);
|
||||||
return Version.marketPrefix(app) + appName;
|
return Version.getUrlWithUtmRef(app, appName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
|
|
|
@ -73,9 +73,17 @@ public class GpxImportHelper {
|
||||||
public boolean handleGpxImport(final Uri contentUri, final boolean useImportDir) {
|
public boolean handleGpxImport(final Uri contentUri, final boolean useImportDir) {
|
||||||
final String name = getNameFromContentUri(contentUri);
|
final String name = getNameFromContentUri(contentUri);
|
||||||
final boolean isOsmandSubdir = isSubDirectory(app.getAppPath(IndexConstants.GPX_INDEX_DIR), new File(contentUri.getPath()));
|
final boolean isOsmandSubdir = isSubDirectory(app.getAppPath(IndexConstants.GPX_INDEX_DIR), new File(contentUri.getPath()));
|
||||||
if (!isOsmandSubdir && name != null && name.endsWith(GPX_SUFFIX)) {
|
if (!isOsmandSubdir && name != null) {
|
||||||
handleGpxImport(contentUri, name, true, useImportDir);
|
if (name.endsWith(GPX_SUFFIX)) {
|
||||||
return true;
|
handleGpxImport(contentUri, name, true, useImportDir);
|
||||||
|
return true;
|
||||||
|
} else if (name.endsWith(KML_SUFFIX)) {
|
||||||
|
handleKmlImport(contentUri, name, true, useImportDir);
|
||||||
|
return true;
|
||||||
|
} else if (name.endsWith(KMZ_SUFFIX)) {
|
||||||
|
handleKmzImport(contentUri, name, true, useImportDir);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,9 +80,7 @@ import net.osmand.plus.activities.SettingsActivity;
|
||||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||||
import net.osmand.plus.dialogs.ConfigureMapMenu.AppearanceListItem;
|
import net.osmand.plus.dialogs.ConfigureMapMenu.AppearanceListItem;
|
||||||
import net.osmand.plus.dialogs.ConfigureMapMenu.GpxAppearanceAdapter;
|
import net.osmand.plus.dialogs.ConfigureMapMenu.GpxAppearanceAdapter;
|
||||||
import net.osmand.plus.download.ui.LocalIndexesFragment;
|
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
|
||||||
import net.osmand.render.RenderingRuleProperty;
|
import net.osmand.render.RenderingRuleProperty;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -107,8 +105,8 @@ import static net.osmand.plus.OsmAndFormatter.METERS_IN_ONE_NAUTICALMILE;
|
||||||
import static net.osmand.plus.OsmAndFormatter.YARDS_IN_ONE_METER;
|
import static net.osmand.plus.OsmAndFormatter.YARDS_IN_ONE_METER;
|
||||||
import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_COLOR_ATTR;
|
import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_COLOR_ATTR;
|
||||||
import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_WIDTH_ATTR;
|
import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_WIDTH_ATTR;
|
||||||
import static net.osmand.plus.download.DownloadActivity.formatMb;
|
|
||||||
import static net.osmand.plus.download.DownloadActivity.formatKb;
|
import static net.osmand.plus.download.DownloadActivity.formatKb;
|
||||||
|
import static net.osmand.plus.download.DownloadActivity.formatMb;
|
||||||
|
|
||||||
public class GpxUiHelper {
|
public class GpxUiHelper {
|
||||||
|
|
||||||
|
@ -1416,7 +1414,7 @@ public class GpxUiHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (values == null) {
|
if (values == null || values.size() == 0) {
|
||||||
if (useRightAxis) {
|
if (useRightAxis) {
|
||||||
yAxis.setEnabled(false);
|
yAxis.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,9 +363,11 @@ public class InAppHelper {
|
||||||
mFullVersionPrice = fullPriceDetails.getPrice();
|
mFullVersionPrice = fullPriceDetails.getPrice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OsmandSettings settings = ctx.getSettings();
|
||||||
|
settings.INAPPS_READ.set(true);
|
||||||
|
|
||||||
boolean needSendToken = false;
|
boolean needSendToken = false;
|
||||||
if (!isDeveloperVersion && liveUpdatesPurchase != null) {
|
if (!isDeveloperVersion && liveUpdatesPurchase != null) {
|
||||||
OsmandSettings settings = ctx.getSettings();
|
|
||||||
if ((Algorithms.isEmpty(settings.BILLING_USER_ID.get()) || Algorithms.isEmpty(settings.BILLING_USER_TOKEN.get()))
|
if ((Algorithms.isEmpty(settings.BILLING_USER_ID.get()) || Algorithms.isEmpty(settings.BILLING_USER_TOKEN.get()))
|
||||||
&& !Algorithms.isEmpty(liveUpdatesPurchase.getDeveloperPayload())) {
|
&& !Algorithms.isEmpty(liveUpdatesPurchase.getDeveloperPayload())) {
|
||||||
String payload = liveUpdatesPurchase.getDeveloperPayload();
|
String payload = liveUpdatesPurchase.getDeveloperPayload();
|
||||||
|
|
|
@ -240,8 +240,10 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyLiveUpdatesChanged() {
|
public void notifyLiveUpdatesChanged() {
|
||||||
if (adapter != null && getMyApplication() != null && getActivity() != null) {
|
if (getActivity() != null) {
|
||||||
adapter.notifyLiveUpdatesChanged();
|
if (adapter != null && getMyApplication() != null) {
|
||||||
|
adapter.notifyLiveUpdatesChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,6 +305,9 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
appModeChanged = false;
|
appModeChanged = false;
|
||||||
|
|
||||||
if (needAcquireMenuController) {
|
if (needAcquireMenuController) {
|
||||||
|
if (menuController != null) {
|
||||||
|
menuController.setMapContextMenu(null);
|
||||||
|
}
|
||||||
if (!acquireMenuController(restorePrevious)) {
|
if (!acquireMenuController(restorePrevious)) {
|
||||||
active = false;
|
active = false;
|
||||||
clearSelectedObject(object);
|
clearSelectedObject(object);
|
||||||
|
@ -376,8 +379,9 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
|
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
|
||||||
init(latLon, pointDescription, object, true, false);
|
init(latLon, pointDescription, object, true, false);
|
||||||
if (fragmentRef != null) {
|
if (fragmentRef != null) {
|
||||||
fragmentRef.get().rebuildMenu();
|
fragmentRef.get().rebuildMenu(centerMarker);
|
||||||
}
|
}
|
||||||
|
centerMarker = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showOrUpdate(LatLon latLon, PointDescription pointDescription, Object object) {
|
public void showOrUpdate(LatLon latLon, PointDescription pointDescription, Object object) {
|
||||||
|
@ -526,6 +530,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
}
|
}
|
||||||
menuController = MenuController.getMenuController(mapActivity, latLon, pointDescription, object, MenuType.STANDARD);
|
menuController = MenuController.getMenuController(mapActivity, latLon, pointDescription, object, MenuType.STANDARD);
|
||||||
if (menuController.setActive(true)) {
|
if (menuController.setActive(true)) {
|
||||||
|
menuController.setMapContextMenu(this);
|
||||||
if (menuData != null && (object != menuData.getObject())
|
if (menuData != null && (object != menuData.getObject())
|
||||||
&& (menuController.hasBackAction() || menuData.hasBackAction())) {
|
&& (menuController.hasBackAction() || menuData.hasBackAction())) {
|
||||||
historyStack.add(menuData);
|
historyStack.add(menuData);
|
||||||
|
@ -598,17 +603,24 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
|
|
||||||
public void onSingleTapOnMap() {
|
public void onSingleTapOnMap() {
|
||||||
if (menuController == null || !menuController.handleSingleTapOnMap()) {
|
if (menuController == null || !menuController.handleSingleTapOnMap()) {
|
||||||
hide();
|
if (menuController != null && !menuController.isClosable()) {
|
||||||
if (mapActivity.getMapLayers().getMapQuickActionLayer().isLayerOn())
|
hide();
|
||||||
|
} else {
|
||||||
|
updateMapCenter(null);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
if (mapActivity.getMapLayers().getMapQuickActionLayer().isLayerOn()) {
|
||||||
mapActivity.getMapLayers().getMapQuickActionLayer().refreshLayer();
|
mapActivity.getMapLayers().getMapQuickActionLayer().refreshLayer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSearchAddressDone() {
|
public void onSearchAddressDone() {
|
||||||
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
|
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
|
||||||
if (fragmentRef != null)
|
if (fragmentRef != null) {
|
||||||
fragmentRef.get().refreshTitle();
|
fragmentRef.get().refreshTitle();
|
||||||
|
}
|
||||||
|
|
||||||
if (searchDoneAction != null) {
|
if (searchDoneAction != null) {
|
||||||
if (searchDoneAction.dlg != null) {
|
if (searchDoneAction.dlg != null) {
|
||||||
|
@ -980,6 +992,10 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
return menuController == null || menuController.fabVisible();
|
return menuController == null || menuController.fabVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isClosable() {
|
||||||
|
return menuController == null || menuController.isClosable();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean buttonsVisible() {
|
public boolean buttonsVisible() {
|
||||||
return menuController == null || menuController.buttonsVisible();
|
return menuController == null || menuController.buttonsVisible();
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,12 +67,6 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
ImageView fabView;
|
ImageView fabView;
|
||||||
|
|
||||||
private MapContextMenu menu;
|
private MapContextMenu menu;
|
||||||
private TitleButtonController leftTitleButtonController;
|
|
||||||
private TitleButtonController rightTitleButtonController;
|
|
||||||
private TitleButtonController topRightTitleButtonController;
|
|
||||||
private TitleButtonController leftDownloadButtonController;
|
|
||||||
private TitleButtonController rightDownloadButtonController;
|
|
||||||
private TitleProgressController titleProgressController;
|
|
||||||
|
|
||||||
private int menuTopViewHeight;
|
private int menuTopViewHeight;
|
||||||
private int menuTopShadowHeight;
|
private int menuTopShadowHeight;
|
||||||
|
@ -107,6 +101,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
private float skipHalfScreenStateLimit;
|
private float skipHalfScreenStateLimit;
|
||||||
|
|
||||||
private int screenOrientation;
|
private int screenOrientation;
|
||||||
|
private boolean created;
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
@Override
|
@Override
|
||||||
|
@ -130,14 +125,6 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
nightMode = menu.isNightMode();
|
nightMode = menu.isNightMode();
|
||||||
mainView = view.findViewById(R.id.context_menu_main);
|
mainView = view.findViewById(R.id.context_menu_main);
|
||||||
|
|
||||||
leftTitleButtonController = menu.getLeftTitleButtonController();
|
|
||||||
rightTitleButtonController = menu.getRightTitleButtonController();
|
|
||||||
topRightTitleButtonController = menu.getTopRightTitleButtonController();
|
|
||||||
|
|
||||||
leftDownloadButtonController = menu.getLeftDownloadButtonController();
|
|
||||||
rightDownloadButtonController = menu.getRightDownloadButtonController();
|
|
||||||
titleProgressController = menu.getTitleProgressController();
|
|
||||||
|
|
||||||
map = getMapActivity().getMapView();
|
map = getMapActivity().getMapView();
|
||||||
RotatedTileBox box = map.getCurrentRotatedTileBox().copy();
|
RotatedTileBox box = map.getCurrentRotatedTileBox().copy();
|
||||||
customMapCenter = menu.getMapCenter() != null;
|
customMapCenter = menu.getMapCenter() != null;
|
||||||
|
@ -162,71 +149,77 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
// Left title button
|
// Left title button
|
||||||
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
|
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
|
||||||
if (leftTitleButtonController != null) {
|
leftTitleButton.setOnClickListener(new View.OnClickListener() {
|
||||||
leftTitleButton.setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public void onClick(View v) {
|
||||||
public void onClick(View v) {
|
TitleButtonController leftTitleButtonController = menu.getLeftTitleButtonController();
|
||||||
|
if (leftTitleButtonController != null) {
|
||||||
leftTitleButtonController.buttonPressed();
|
leftTitleButtonController.buttonPressed();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// Right title button
|
// Right title button
|
||||||
final Button rightTitleButton = (Button) view.findViewById(R.id.title_button_right);
|
final Button rightTitleButton = (Button) view.findViewById(R.id.title_button_right);
|
||||||
if (rightTitleButtonController != null) {
|
rightTitleButton.setOnClickListener(new View.OnClickListener() {
|
||||||
rightTitleButton.setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public void onClick(View v) {
|
||||||
public void onClick(View v) {
|
TitleButtonController rightTitleButtonController = menu.getRightTitleButtonController();
|
||||||
|
if (rightTitleButtonController != null) {
|
||||||
rightTitleButtonController.buttonPressed();
|
rightTitleButtonController.buttonPressed();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// Left download button
|
// Left download button
|
||||||
final Button leftDownloadButton = (Button) view.findViewById(R.id.download_button_left);
|
final Button leftDownloadButton = (Button) view.findViewById(R.id.download_button_left);
|
||||||
if (leftDownloadButtonController != null) {
|
leftDownloadButton.setOnClickListener(new View.OnClickListener() {
|
||||||
leftDownloadButton.setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public void onClick(View v) {
|
||||||
public void onClick(View v) {
|
TitleButtonController leftDownloadButtonController = menu.getLeftDownloadButtonController();
|
||||||
|
if (leftDownloadButtonController != null) {
|
||||||
leftDownloadButtonController.buttonPressed();
|
leftDownloadButtonController.buttonPressed();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// Right download button
|
// Right download button
|
||||||
final Button rightDownloadButton = (Button) view.findViewById(R.id.download_button_right);
|
final Button rightDownloadButton = (Button) view.findViewById(R.id.download_button_right);
|
||||||
if (rightDownloadButtonController != null) {
|
rightDownloadButton.setOnClickListener(new View.OnClickListener() {
|
||||||
rightDownloadButton.setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public void onClick(View v) {
|
||||||
public void onClick(View v) {
|
TitleButtonController rightDownloadButtonController = menu.getRightDownloadButtonController();
|
||||||
|
if (rightDownloadButtonController != null) {
|
||||||
rightDownloadButtonController.buttonPressed();
|
rightDownloadButtonController.buttonPressed();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// Top Right title button
|
// Top Right title button
|
||||||
final Button topRightTitleButton = (Button) view.findViewById(R.id.title_button_top_right);
|
final Button topRightTitleButton = (Button) view.findViewById(R.id.title_button_top_right);
|
||||||
if (topRightTitleButtonController != null) {
|
topRightTitleButton.setOnClickListener(new View.OnClickListener() {
|
||||||
topRightTitleButton.setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public void onClick(View v) {
|
||||||
public void onClick(View v) {
|
TitleButtonController topRightTitleButtonController = menu.getTopRightTitleButtonController();
|
||||||
|
if (topRightTitleButtonController != null) {
|
||||||
topRightTitleButtonController.buttonPressed();
|
topRightTitleButtonController.buttonPressed();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// Progress bar
|
// Progress bar
|
||||||
if (titleProgressController != null) {
|
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
|
||||||
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
|
progressButton.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_remove_dark,
|
||||||
progressButton.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_remove_dark,
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
progressButton.setOnClickListener(new View.OnClickListener() {
|
||||||
progressButton.setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public void onClick(View v) {
|
||||||
public void onClick(View v) {
|
TitleProgressController titleProgressController = menu.getTitleProgressController();
|
||||||
|
if (titleProgressController != null) {
|
||||||
titleProgressController.buttonPressed();
|
titleProgressController.buttonPressed();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
menu.updateData();
|
menu.updateData();
|
||||||
updateButtonsAndProgress();
|
updateButtonsAndProgress();
|
||||||
|
@ -471,6 +464,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
//getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(false);
|
//getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(false);
|
||||||
|
|
||||||
|
created = true;
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,6 +577,13 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
private void updateButtonsAndProgress() {
|
private void updateButtonsAndProgress() {
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
|
TitleButtonController leftTitleButtonController = menu.getLeftTitleButtonController();
|
||||||
|
TitleButtonController rightTitleButtonController = menu.getRightTitleButtonController();
|
||||||
|
TitleButtonController topRightTitleButtonController = menu.getTopRightTitleButtonController();
|
||||||
|
TitleButtonController leftDownloadButtonController = menu.getLeftDownloadButtonController();
|
||||||
|
TitleButtonController rightDownloadButtonController = menu.getRightDownloadButtonController();
|
||||||
|
TitleProgressController titleProgressController = menu.getTitleProgressController();
|
||||||
|
|
||||||
// Title buttons
|
// Title buttons
|
||||||
boolean showTitleButtonsContainer = (leftTitleButtonController != null || rightTitleButtonController != null);
|
boolean showTitleButtonsContainer = (leftTitleButtonController != null || rightTitleButtonController != null);
|
||||||
final View titleButtonsContainer = view.findViewById(R.id.title_button_container);
|
final View titleButtonsContainer = view.findViewById(R.id.title_button_container);
|
||||||
|
@ -791,7 +792,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
menu.setMapZoom(0);
|
menu.setMapZoom(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebuildMenu() {
|
public void rebuildMenu(boolean centered) {
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
if (app != null && view != null) {
|
if (app != null && view != null) {
|
||||||
IconsCache iconsCache = app.getIconsCache();
|
IconsCache iconsCache = app.getIconsCache();
|
||||||
|
@ -806,6 +807,10 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
bottomLayout.removeAllViews();
|
bottomLayout.removeAllViews();
|
||||||
buildBottomView();
|
buildBottomView();
|
||||||
|
|
||||||
|
if (centered) {
|
||||||
|
this.initLayout = true;
|
||||||
|
this.centered = true;
|
||||||
|
}
|
||||||
runLayoutListener();
|
runLayoutListener();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -848,15 +853,42 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
line2LineHeight = line2.getLineHeight();
|
line2LineHeight = line2.getLineHeight();
|
||||||
line2MeasuredHeight = line2.getMeasuredHeight();
|
line2MeasuredHeight = line2.getMeasuredHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int dp16 = dpToPx(16f);
|
||||||
|
int titleButtonHeight = 0;
|
||||||
|
View titleButtonContainer = view.findViewById(R.id.title_button_container);
|
||||||
|
if (titleButtonContainer.getVisibility() == View.VISIBLE) {
|
||||||
|
titleButtonHeight = titleButtonContainer.getMeasuredHeight() - dp16;
|
||||||
|
if (titleButtonHeight < 0) {
|
||||||
|
titleButtonHeight = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int downloadButtonsHeight = 0;
|
||||||
|
View downloadButtonsContainer = view.findViewById(R.id.download_buttons_container);
|
||||||
|
if (downloadButtonsContainer.getVisibility() == View.VISIBLE) {
|
||||||
|
downloadButtonsHeight = downloadButtonsContainer.getMeasuredHeight() - dp16;
|
||||||
|
if (downloadButtonsHeight < 0) {
|
||||||
|
downloadButtonsHeight = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int titleProgressHeight = 0;
|
||||||
|
View titleProgressContainer = view.findViewById(R.id.title_progress_container);
|
||||||
|
if (titleProgressContainer.getVisibility() == View.VISIBLE) {
|
||||||
|
titleProgressHeight = titleProgressContainer.getMeasuredHeight() - dp16;
|
||||||
|
if (titleProgressHeight < 0) {
|
||||||
|
titleProgressHeight = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (menuTopViewHeight != 0) {
|
if (menuTopViewHeight != 0) {
|
||||||
int titleHeight = line1.getLineCount() * line1.getLineHeight() + line2LineCount * line2LineHeight + menuTitleTopBottomPadding;
|
int titleHeight = line1.getLineCount() * line1.getLineHeight() + line2LineCount * line2LineHeight + menuTitleTopBottomPadding;
|
||||||
if (titleHeight < line1.getMeasuredHeight() + line2MeasuredHeight) {
|
if (titleHeight < line1.getMeasuredHeight() + line2MeasuredHeight) {
|
||||||
titleHeight = line1.getMeasuredHeight() + line2MeasuredHeight;
|
titleHeight = line1.getMeasuredHeight() + line2MeasuredHeight;
|
||||||
}
|
}
|
||||||
newMenuTopViewHeight = menuTopViewHeightExcludingTitle + titleHeight;
|
newMenuTopViewHeight = menuTopViewHeightExcludingTitle + titleHeight + titleButtonHeight + downloadButtonsHeight + titleProgressHeight;
|
||||||
dy = Math.max(0, newMenuTopViewHeight - menuTopViewHeight - (newMenuTopShadowAllHeight - menuTopShadowAllHeight));
|
dy = Math.max(0, newMenuTopViewHeight - menuTopViewHeight - (newMenuTopShadowAllHeight - menuTopShadowAllHeight));
|
||||||
} else {
|
} else {
|
||||||
menuTopViewHeightExcludingTitle = newMenuTopViewHeight - line1.getMeasuredHeight() - line2MeasuredHeight;
|
menuTopViewHeightExcludingTitle = newMenuTopViewHeight - line1.getMeasuredHeight() - line2MeasuredHeight - titleButtonHeight - downloadButtonsHeight - titleProgressHeight;
|
||||||
menuTitleTopBottomPadding = (line1.getMeasuredHeight() - line1.getLineCount() * line1.getLineHeight())
|
menuTitleTopBottomPadding = (line1.getMeasuredHeight() - line1.getLineCount() * line1.getLineHeight())
|
||||||
+ (line2MeasuredHeight - line2LineCount * line2LineHeight);
|
+ (line2MeasuredHeight - line2LineCount * line2LineHeight);
|
||||||
}
|
}
|
||||||
|
@ -980,8 +1012,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
if (app != null && view != null) {
|
if (app != null && view != null) {
|
||||||
View compassView = view.findViewById(R.id.compass_layout);
|
View compassView = view.findViewById(R.id.compass_layout);
|
||||||
Location ll = app.getLocationProvider().getLastKnownLocation();
|
Location ll = app.getLocationProvider().getLastKnownLocation();
|
||||||
boolean gpsFixed = ll != null && System.currentTimeMillis() - ll.getTime() < 1000 * 60 * 60 * 20;
|
if (ll != null && menu.displayDistanceDirection() && menu.getCurrentMenuState() != MenuState.FULL_SCREEN) {
|
||||||
if (gpsFixed && menu.displayDistanceDirection() && menu.getCurrentMenuState() != MenuState.FULL_SCREEN) {
|
|
||||||
updateDistanceDirection();
|
updateDistanceDirection();
|
||||||
compassView.setVisibility(View.VISIBLE);
|
compassView.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1101,8 +1132,13 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
RotatedTileBox box = map.getCurrentRotatedTileBox().copy();
|
RotatedTileBox box = map.getCurrentRotatedTileBox().copy();
|
||||||
box.setCenterLocation(0.5f, map.getMapPosition() == OsmandSettings.BOTTOM_CONSTANT ? 0.15f : 0.5f);
|
box.setCenterLocation(0.5f, map.getMapPosition() == OsmandSettings.BOTTOM_CONSTANT ? 0.15f : 0.5f);
|
||||||
box.setZoom(zoom);
|
box.setZoom(zoom);
|
||||||
int markerMapCenterX = (int) box.getPixXFromLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
|
boolean hasMapCenter = mapCenter != null;
|
||||||
int markerMapCenterY = (int) box.getPixYFromLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
|
int markerMapCenterX = 0;
|
||||||
|
int markerMapCenterY = 0;
|
||||||
|
if (hasMapCenter) {
|
||||||
|
markerMapCenterX = (int) box.getPixXFromLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
|
||||||
|
markerMapCenterY = (int) box.getPixYFromLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
|
||||||
|
}
|
||||||
float cpyOrig = box.getCenterPixelPoint().y;
|
float cpyOrig = box.getCenterPixelPoint().y;
|
||||||
|
|
||||||
box.setCenterLocation(0.5f, 0.5f);
|
box.setCenterLocation(0.5f, 0.5f);
|
||||||
|
@ -1119,7 +1155,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
float origMarkerY = this.origMarkerY + cpyDelta;
|
float origMarkerY = this.origMarkerY + cpyDelta;
|
||||||
|
|
||||||
LatLon latlon;
|
LatLon latlon;
|
||||||
if (center) {
|
if (center || !hasMapCenter) {
|
||||||
latlon = reqMarkerLocation;
|
latlon = reqMarkerLocation;
|
||||||
} else {
|
} else {
|
||||||
latlon = box.getLatLonFromPixel(markerMapCenterX, markerMapCenterY);
|
latlon = box.getLatLonFromPixel(markerMapCenterX, markerMapCenterY);
|
||||||
|
@ -1252,7 +1288,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
public void downloadHasFinished() {
|
public void downloadHasFinished() {
|
||||||
updateOnDownload();
|
updateOnDownload();
|
||||||
if (menu != null && menu.isVisible() && menu.isMapDownloaded()) {
|
if (menu != null && menu.isVisible() && menu.isMapDownloaded()) {
|
||||||
rebuildMenu();
|
rebuildMenu(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1269,9 +1305,11 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateMenu() {
|
public void updateMenu() {
|
||||||
menu.updateData();
|
if (created) {
|
||||||
updateButtonsAndProgress();
|
menu.updateData();
|
||||||
runLayoutListener();
|
updateButtonsAndProgress();
|
||||||
|
runLayoutListener();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private MapActivity getMapActivity() {
|
private MapActivity getMapActivity() {
|
||||||
|
|
|
@ -45,6 +45,7 @@ import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask
|
||||||
import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask.GetImageCardsListener;
|
import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask.GetImageCardsListener;
|
||||||
import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard;
|
import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -68,6 +69,7 @@ public class MenuBuilder {
|
||||||
private LatLon latLon;
|
private LatLon latLon;
|
||||||
private boolean hidden;
|
private boolean hidden;
|
||||||
private boolean showNearestWiki = false;
|
private boolean showNearestWiki = false;
|
||||||
|
private boolean showOnlinePhotos = true;
|
||||||
protected List<Amenity> nearestWiki = new ArrayList<>();
|
protected List<Amenity> nearestWiki = new ArrayList<>();
|
||||||
private List<OsmandPlugin> menuPlugins = new ArrayList<>();
|
private List<OsmandPlugin> menuPlugins = new ArrayList<>();
|
||||||
private CardsRowBuilder onlinePhotoCardsRow;
|
private CardsRowBuilder onlinePhotoCardsRow;
|
||||||
|
@ -206,6 +208,14 @@ public class MenuBuilder {
|
||||||
this.showNearestWiki = showNearestWiki;
|
this.showNearestWiki = showNearestWiki;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isShowOnlinePhotos() {
|
||||||
|
return showOnlinePhotos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShowOnlinePhotos(boolean showOnlinePhotos) {
|
||||||
|
this.showOnlinePhotos = showOnlinePhotos;
|
||||||
|
}
|
||||||
|
|
||||||
public void setShowNearestWiki(boolean showNearestWiki, long objectId) {
|
public void setShowNearestWiki(boolean showNearestWiki, long objectId) {
|
||||||
this.objectId = objectId;
|
this.objectId = objectId;
|
||||||
this.showNearestWiki = showNearestWiki;
|
this.showNearestWiki = showNearestWiki;
|
||||||
|
@ -227,7 +237,9 @@ public class MenuBuilder {
|
||||||
buildPlainMenuItems(view);
|
buildPlainMenuItems(view);
|
||||||
}
|
}
|
||||||
buildInternal(view);
|
buildInternal(view);
|
||||||
buildNearestPhotosRow(view);
|
if (showOnlinePhotos) {
|
||||||
|
buildNearestPhotosRow(view);
|
||||||
|
}
|
||||||
buildPluginRows(view);
|
buildPluginRows(view);
|
||||||
buildAfter(view);
|
buildAfter(view);
|
||||||
}
|
}
|
||||||
|
@ -648,6 +660,10 @@ public class MenuBuilder {
|
||||||
|
|
||||||
protected boolean processNearstWiki() {
|
protected boolean processNearstWiki() {
|
||||||
if (showNearestWiki && latLon != null) {
|
if (showNearestWiki && latLon != null) {
|
||||||
|
String preferredLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
|
||||||
|
if (Algorithms.isEmpty(preferredLang)) {
|
||||||
|
preferredLang = app.getLanguage();
|
||||||
|
}
|
||||||
QuadRect rect = MapUtils.calculateLatLonBbox(
|
QuadRect rect = MapUtils.calculateLatLonBbox(
|
||||||
latLon.getLatitude(), latLon.getLongitude(), 250);
|
latLon.getLatitude(), latLon.getLongitude(), 250);
|
||||||
nearestWiki = app.getResourceManager().searchAmenities(
|
nearestWiki = app.getResourceManager().searchAmenities(
|
||||||
|
@ -673,12 +689,14 @@ public class MenuBuilder {
|
||||||
});
|
});
|
||||||
Long id = objectId;
|
Long id = objectId;
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
|
List<Amenity> wikiList = new ArrayList<>();
|
||||||
for (Amenity wiki : nearestWiki) {
|
for (Amenity wiki : nearestWiki) {
|
||||||
if (wiki.getId().equals(id)) {
|
String lng = wiki.getContentLanguage("content", preferredLang, "en");
|
||||||
nearestWiki.remove(wiki);
|
if (wiki.getId().equals(id) || (!lng.equals("en") && !lng.equals(preferredLang))) {
|
||||||
break;
|
wikiList.add(wiki);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
nearestWiki.removeAll(wikiList);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.osmand.plus.mapcontextmenu;
|
package net.osmand.plus.mapcontextmenu;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
@ -86,6 +87,7 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
MULTI_LINE
|
MULTI_LINE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected MapContextMenu mapContextMenu;
|
||||||
protected MenuBuilder builder;
|
protected MenuBuilder builder;
|
||||||
private int currentMenuState;
|
private int currentMenuState;
|
||||||
private MenuType menuType = MenuType.STANDARD;
|
private MenuType menuType = MenuType.STANDARD;
|
||||||
|
@ -117,6 +119,10 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
this.builder.setLight(isLight());
|
this.builder.setLight(isLight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMapContextMenu(MapContextMenu mapContextMenu) {
|
||||||
|
this.mapContextMenu = mapContextMenu;
|
||||||
|
}
|
||||||
|
|
||||||
public void build(View rootView) {
|
public void build(View rootView) {
|
||||||
for (OsmandPlugin plugin : OsmandPlugin.getEnabledPlugins()) {
|
for (OsmandPlugin plugin : OsmandPlugin.getEnabledPlugins()) {
|
||||||
if (plugin.isMenuControllerSupported(this.getClass())) {
|
if (plugin.isMenuControllerSupported(this.getClass())) {
|
||||||
|
@ -342,6 +348,10 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isClosable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean needStreetName() {
|
public boolean needStreetName() {
|
||||||
return !displayDistanceDirection();
|
return !displayDistanceDirection();
|
||||||
}
|
}
|
||||||
|
@ -531,114 +541,137 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildMapDownloadButton(LatLon latLon) {
|
public void buildMapDownloadButton(final LatLon latLon) {
|
||||||
int point31x = MapUtils.get31TileNumberX(latLon.getLongitude());
|
new AsyncTask<Void, Void, BinaryMapDataObject>() {
|
||||||
int point31y = MapUtils.get31TileNumberY(latLon.getLatitude());
|
|
||||||
|
|
||||||
ResourceManager rm = getMapActivity().getMyApplication().getResourceManager();
|
ResourceManager rm;
|
||||||
OsmandRegions osmandRegions = rm.getOsmandRegions();
|
OsmandRegions osmandRegions;
|
||||||
|
|
||||||
List<BinaryMapDataObject> mapDataObjects = null;
|
|
||||||
try {
|
|
||||||
mapDataObjects = osmandRegions.queryBbox(point31x, point31x, point31y, point31y);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mapDataObjects != null) {
|
|
||||||
Iterator<BinaryMapDataObject> it = mapDataObjects.iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
BinaryMapDataObject o = it.next();
|
|
||||||
if (o.getTypes() != null) {
|
|
||||||
boolean isRegion = true;
|
|
||||||
for (int i = 0; i < o.getTypes().length; i++) {
|
|
||||||
TagValuePair tp = o.getMapIndex().decodeType(o.getTypes()[i]);
|
|
||||||
if ("boundary".equals(tp.value)) {
|
|
||||||
isRegion = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isRegion || !osmandRegions.contain(o, point31x, point31y)) {
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String selectedFullName = "";
|
String selectedFullName = "";
|
||||||
double smallestArea = -1;
|
|
||||||
downloadMapDataObject = null;
|
@Override
|
||||||
for (BinaryMapDataObject o : mapDataObjects) {
|
protected void onPreExecute() {
|
||||||
String downloadName = osmandRegions.getDownloadName(o);
|
rm = getMapActivity().getMyApplication().getResourceManager();
|
||||||
if (!Algorithms.isEmpty(downloadName)) {
|
osmandRegions = rm.getOsmandRegions();
|
||||||
boolean downloaded = checkIfObjectDownloaded(rm, downloadName);
|
}
|
||||||
if (downloaded) {
|
|
||||||
downloadMapDataObject = null;
|
@Override
|
||||||
break;
|
protected BinaryMapDataObject doInBackground(Void... voids) {
|
||||||
} else {
|
|
||||||
String fullName = osmandRegions.getFullName(o);
|
int point31x = MapUtils.get31TileNumberX(latLon.getLongitude());
|
||||||
WorldRegion region = osmandRegions.getRegionData(fullName);
|
int point31y = MapUtils.get31TileNumberY(latLon.getLatitude());
|
||||||
if (region != null && region.isRegionMapDownload()) {
|
|
||||||
double area = OsmandRegions.getArea(o);
|
List<BinaryMapDataObject> mapDataObjects = null;
|
||||||
if (smallestArea == -1) {
|
try {
|
||||||
smallestArea = area;
|
mapDataObjects = osmandRegions.queryBbox(point31x, point31x, point31y, point31y);
|
||||||
selectedFullName = fullName;
|
} catch (IOException e) {
|
||||||
downloadMapDataObject = o;
|
e.printStackTrace();
|
||||||
} else if (area < smallestArea) {
|
}
|
||||||
smallestArea = area;
|
|
||||||
selectedFullName = fullName;
|
BinaryMapDataObject binaryMapDataObject = null;
|
||||||
downloadMapDataObject = o;
|
if (mapDataObjects != null) {
|
||||||
|
Iterator<BinaryMapDataObject> it = mapDataObjects.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
BinaryMapDataObject o = it.next();
|
||||||
|
if (o.getTypes() != null) {
|
||||||
|
boolean isRegion = true;
|
||||||
|
for (int i = 0; i < o.getTypes().length; i++) {
|
||||||
|
TagValuePair tp = o.getMapIndex().decodeType(o.getTypes()[i]);
|
||||||
|
if ("boundary".equals(tp.value)) {
|
||||||
|
isRegion = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isRegion || !osmandRegions.contain(o, point31x, point31y)) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double smallestArea = -1;
|
||||||
|
for (BinaryMapDataObject o : mapDataObjects) {
|
||||||
|
String downloadName = osmandRegions.getDownloadName(o);
|
||||||
|
if (!Algorithms.isEmpty(downloadName)) {
|
||||||
|
boolean downloaded = checkIfObjectDownloaded(rm, downloadName);
|
||||||
|
if (downloaded) {
|
||||||
|
binaryMapDataObject = null;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
String fullName = osmandRegions.getFullName(o);
|
||||||
|
WorldRegion region = osmandRegions.getRegionData(fullName);
|
||||||
|
if (region != null && region.isRegionMapDownload()) {
|
||||||
|
double area = OsmandRegions.getArea(o);
|
||||||
|
if (smallestArea == -1) {
|
||||||
|
smallestArea = area;
|
||||||
|
selectedFullName = fullName;
|
||||||
|
binaryMapDataObject = o;
|
||||||
|
} else if (area < smallestArea) {
|
||||||
|
smallestArea = area;
|
||||||
|
selectedFullName = fullName;
|
||||||
|
binaryMapDataObject = o;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return binaryMapDataObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
downloaded = downloadMapDataObject == null;
|
@Override
|
||||||
if (!downloaded) {
|
protected void onPostExecute(BinaryMapDataObject binaryMapDataObject) {
|
||||||
downloadThread = getMapActivity().getMyApplication().getDownloadThread();
|
downloadMapDataObject = binaryMapDataObject;
|
||||||
downloadRegion = osmandRegions.getRegionData(selectedFullName);
|
downloaded = downloadMapDataObject == null;
|
||||||
if (downloadRegion != null && downloadRegion.isRegionMapDownload()) {
|
if (!downloaded) {
|
||||||
List<IndexItem> indexItems = downloadThread.getIndexes().getIndexItems(downloadRegion);
|
downloadThread = getMapActivity().getMyApplication().getDownloadThread();
|
||||||
for (IndexItem item : indexItems) {
|
downloadRegion = osmandRegions.getRegionData(selectedFullName);
|
||||||
if (item.getType() == DownloadActivityType.NORMAL_FILE
|
if (downloadRegion != null && downloadRegion.isRegionMapDownload()) {
|
||||||
&& (item.isDownloaded() || downloadThread.isDownloading(item))) {
|
List<IndexItem> indexItems = downloadThread.getIndexes().getIndexItems(downloadRegion);
|
||||||
indexItem = item;
|
for (IndexItem item : indexItems) {
|
||||||
}
|
if (item.getType() == DownloadActivityType.NORMAL_FILE
|
||||||
}
|
&& (item.isDownloaded() || downloadThread.isDownloading(item))) {
|
||||||
}
|
indexItem = item;
|
||||||
|
|
||||||
leftDownloadButtonController = new TitleButtonController() {
|
|
||||||
@Override
|
|
||||||
public void buttonPressed() {
|
|
||||||
if (indexItem != null) {
|
|
||||||
if (indexItem.getType() == DownloadActivityType.NORMAL_FILE) {
|
|
||||||
new DownloadValidationManager(getMapActivity().getMyApplication())
|
|
||||||
.startDownload(getMapActivity(), indexItem);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
leftDownloadButtonController.caption =
|
|
||||||
downloadRegion != null ? downloadRegion.getLocaleName() : getMapActivity().getString(R.string.shared_string_download);
|
|
||||||
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
|
||||||
|
|
||||||
titleProgressController = new TitleProgressController() {
|
leftDownloadButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
public void buttonPressed() {
|
public void buttonPressed() {
|
||||||
if (indexItem != null) {
|
if (indexItem != null) {
|
||||||
downloadThread.cancelDownload(indexItem);
|
if (indexItem.getType() == DownloadActivityType.NORMAL_FILE) {
|
||||||
|
new DownloadValidationManager(getMapActivity().getMyApplication())
|
||||||
|
.startDownload(getMapActivity(), indexItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
leftDownloadButtonController.caption =
|
||||||
|
downloadRegion != null ? downloadRegion.getLocaleName() : getMapActivity().getString(R.string.shared_string_download);
|
||||||
|
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
||||||
|
|
||||||
|
titleProgressController = new TitleProgressController() {
|
||||||
|
@Override
|
||||||
|
public void buttonPressed() {
|
||||||
|
if (indexItem != null) {
|
||||||
|
downloadThread.cancelDownload(indexItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!downloadThread.getIndexes().isDownloadedFromInternet) {
|
||||||
|
if (getMapActivity().getMyApplication().getSettings().isInternetConnectionAvailable()) {
|
||||||
|
downloadThread.runReloadIndexFiles();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if (!downloadThread.getIndexes().isDownloadedFromInternet) {
|
if (mapContextMenu != null) {
|
||||||
if (getMapActivity().getMyApplication().getSettings().isInternetConnectionAvailable()) {
|
mapContextMenu.updateMenuUI();
|
||||||
downloadThread.runReloadIndexFiles();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateData();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkIfObjectDownloaded(ResourceManager rm, String downloadName) {
|
private boolean checkIfObjectDownloaded(ResourceManager rm, String downloadName) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class ContextMenuCardDialogFragment extends Fragment {
|
||||||
fragment.dialog = menu;
|
fragment.dialog = menu;
|
||||||
menu.getMapActivity().getSupportFragmentManager().beginTransaction()
|
menu.getMapActivity().getSupportFragmentManager().beginTransaction()
|
||||||
.replace(R.id.topFragmentContainer, fragment, TAG)
|
.replace(R.id.topFragmentContainer, fragment, TAG)
|
||||||
.addToBackStack(TAG).commit();
|
.addToBackStack(TAG).commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dismiss() {
|
public void dismiss() {
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class TransportRouteController extends MenuController {
|
||||||
final TransportStopRoute transportRoute) {
|
final TransportStopRoute transportRoute) {
|
||||||
super(new MenuBuilder(mapActivity), pointDescription, mapActivity);
|
super(new MenuBuilder(mapActivity), pointDescription, mapActivity);
|
||||||
this.transportRoute = transportRoute;
|
this.transportRoute = transportRoute;
|
||||||
|
builder.setShowOnlinePhotos(false);
|
||||||
toolbarController = new ContextMenuToolbarController(this);
|
toolbarController = new ContextMenuToolbarController(this);
|
||||||
toolbarController.setTitle(getNameStr());
|
toolbarController.setTitle(getNameStr());
|
||||||
toolbarController.setOnBackButtonClickListener(new OnClickListener() {
|
toolbarController.setOnBackButtonClickListener(new OnClickListener() {
|
||||||
|
@ -83,6 +84,10 @@ public class TransportRouteController extends MenuController {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isClosable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean buttonsVisible() {
|
public boolean buttonsVisible() {
|
||||||
|
@ -96,7 +101,13 @@ public class TransportRouteController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTypeStr() {
|
public String getTypeStr() {
|
||||||
return getPointDescription().getTypeName();
|
if (transportRoute.refStop != null) {
|
||||||
|
return transportRoute.refStop.getName();
|
||||||
|
} else if (transportRoute.stop != null) {
|
||||||
|
return transportRoute.stop.getName();
|
||||||
|
} else {
|
||||||
|
return getPointDescription().getTypeName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -154,14 +165,22 @@ public class TransportRouteController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View arg0) {
|
public void onClick(View arg0) {
|
||||||
MapContextMenu menu = getMapActivity().getContextMenu();
|
if (mapContextMenu != null) {
|
||||||
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_STOP,
|
transportRoute.stop = stop;
|
||||||
getMapActivity().getString(R.string.transport_Stop), name);
|
transportRoute.refStop = stop;
|
||||||
resetRoute();
|
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_ROUTE,
|
||||||
menu.show(stop.getLocation(), pd, stop);
|
transportRoute.getDescription(getMapActivity().getMyApplication(), false));
|
||||||
WeakReference<MapContextMenuFragment> rr = menu.findMenuFragment();
|
|
||||||
if (rr != null && rr.get() != null) {
|
LatLon stopLocation = stop.getLocation();
|
||||||
rr.get().centerMarkerLocation();
|
if (mapContextMenu.isVisible()) {
|
||||||
|
mapContextMenu.updateMapCenter(stopLocation);
|
||||||
|
} else {
|
||||||
|
mapContextMenu.setMapCenter(stopLocation);
|
||||||
|
mapContextMenu.setMapPosition(getMapActivity().getMapView().getMapPosition());
|
||||||
|
}
|
||||||
|
mapContextMenu.setCenterMarker(true);
|
||||||
|
mapContextMenu.setMapZoom(15);
|
||||||
|
mapContextMenu.showOrUpdate(stopLocation, pd, transportRoute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -305,7 +305,8 @@ public class TrackDetailsMenu {
|
||||||
|
|
||||||
if (trackChartPoints == null) {
|
if (trackChartPoints == null) {
|
||||||
trackChartPoints = new TrackChartPoints();
|
trackChartPoints = new TrackChartPoints();
|
||||||
int segmentColor = getTrackSegment(chart).getColor(0);
|
TrkSegment segment = getTrackSegment(chart);
|
||||||
|
int segmentColor = segment != null ? segment.getColor(0) : 0;
|
||||||
trackChartPoints.setSegmentColor(segmentColor);
|
trackChartPoints.setSegmentColor(segmentColor);
|
||||||
trackChartPoints.setGpx(getGpxItem().group.getGpx());
|
trackChartPoints.setGpx(getGpxItem().group.getGpx());
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
|
||||||
final Drawable drawable = getIcon(toggleIconId, toggleIconColorId);
|
final Drawable drawable = getIcon(toggleIconId, toggleIconColorId);
|
||||||
((AppCompatImageView) toggleRow.findViewById(R.id.toggle_row_icon)).setImageDrawable(drawable);
|
((AppCompatImageView) toggleRow.findViewById(R.id.toggle_row_icon)).setImageDrawable(drawable);
|
||||||
final CompoundButton toggle = (CompoundButton) toggleRow.findViewById(R.id.toggle_row_toggle);
|
final CompoundButton toggle = (CompoundButton) toggleRow.findViewById(R.id.toggle_row_toggle);
|
||||||
|
toggle.setOnCheckedChangeListener(null);
|
||||||
toggle.setChecked(selected);
|
toggle.setChecked(selected);
|
||||||
toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,7 +15,10 @@ import android.view.ViewGroup;
|
||||||
import android.webkit.ConsoleMessage;
|
import android.webkit.ConsoleMessage;
|
||||||
import android.webkit.JavascriptInterface;
|
import android.webkit.JavascriptInterface;
|
||||||
import android.webkit.WebChromeClient;
|
import android.webkit.WebChromeClient;
|
||||||
|
import android.webkit.WebResourceError;
|
||||||
|
import android.webkit.WebResourceRequest;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -33,6 +36,7 @@ import net.osmand.data.QuadRect;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.map.ITileSource;
|
||||||
import net.osmand.map.TileSourceManager;
|
import net.osmand.map.TileSourceManager;
|
||||||
|
import net.osmand.plus.IconsCache;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||||
|
@ -78,15 +82,18 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
||||||
private double ca = Double.NaN;
|
private double ca = Double.NaN;
|
||||||
|
|
||||||
private View staticImageView;
|
private View staticImageView;
|
||||||
|
private View noInternetView;
|
||||||
private List<Pair<QuadPointDouble, GeometryTile>> tiles = new ArrayList<>();
|
private List<Pair<QuadPointDouble, GeometryTile>> tiles = new ArrayList<>();
|
||||||
private double fetchedTileLat = Double.NaN;
|
private double fetchedTileLat = Double.NaN;
|
||||||
private double fetchedTileLon = Double.NaN;
|
private double fetchedTileLon = Double.NaN;
|
||||||
private List<MapillaryImage> sequenceImages = new ArrayList<>();
|
private List<MapillaryImage> sequenceImages = new ArrayList<>();
|
||||||
private AtomicInteger downloadRequestNumber = new AtomicInteger();
|
private AtomicInteger downloadRequestNumber = new AtomicInteger();
|
||||||
|
private IconsCache ic;
|
||||||
|
|
||||||
public MapillaryImageDialog(@NonNull MapActivity mapActivity, @NonNull Bundle bundle) {
|
public MapillaryImageDialog(@NonNull MapActivity mapActivity, @NonNull Bundle bundle) {
|
||||||
super(mapActivity, CardDialogType.MAPILLARY);
|
super(mapActivity, CardDialogType.MAPILLARY);
|
||||||
restoreFields(bundle);
|
restoreFields(bundle);
|
||||||
|
this.ic = mapActivity.getMyApplication().getIconsCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapillaryImageDialog(MapActivity mapActivity, String key, String sKey, String imageUrl,
|
public MapillaryImageDialog(MapActivity mapActivity, String key, String sKey, String imageUrl,
|
||||||
|
@ -100,6 +107,7 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
||||||
this.viewerUrl = viewerUrl;
|
this.viewerUrl = viewerUrl;
|
||||||
this.latLon = latLon;
|
this.latLon = latLon;
|
||||||
this.ca = ca;
|
this.ca = ca;
|
||||||
|
this.ic = mapActivity.getMyApplication().getIconsCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
|
@ -208,17 +216,27 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint({"SetJavaScriptEnabled", "AddJavascriptInterface"})
|
@SuppressLint({"SetJavaScriptEnabled", "AddJavascriptInterface"})
|
||||||
private WebView getWebView() {
|
private View getWebView() {
|
||||||
final WebView webView = new WebView(getMapActivity());
|
View view = getMapActivity().getLayoutInflater().inflate(R.layout.mapillary_web_view, null);
|
||||||
|
final WebView webView = view.findViewById(R.id.webView);
|
||||||
webView.setBackgroundColor(Color.argb(1, 0, 0, 0));
|
webView.setBackgroundColor(Color.argb(1, 0, 0, 0));
|
||||||
|
final View noInternetView = view.findViewById(R.id.mapillaryNoInternetLayout);
|
||||||
|
((ImageView) noInternetView.findViewById(R.id.wifiOff)).setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_wifi_off));
|
||||||
//webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
|
//webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
|
||||||
webView.setScrollContainer(false);
|
view.setScrollContainer(false);
|
||||||
webView.getSettings().setJavaScriptEnabled(true);
|
webView.getSettings().setJavaScriptEnabled(true);
|
||||||
webView.addJavascriptInterface(new MapillaryWebAppInterface(), "Android");
|
webView.addJavascriptInterface(new MapillaryWebAppInterface(), "Android");
|
||||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||||
isPortrait() ? ViewGroup.LayoutParams.MATCH_PARENT : AndroidUtils.dpToPx(getMapActivity(), 360f),
|
isPortrait() ? ViewGroup.LayoutParams.MATCH_PARENT : AndroidUtils.dpToPx(getMapActivity(), 360f),
|
||||||
isPortrait() ? AndroidUtils.dpToPx(getMapActivity(), 270f) : ViewGroup.LayoutParams.MATCH_PARENT);
|
isPortrait() ? AndroidUtils.dpToPx(getMapActivity(), 270f) : ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
webView.setLayoutParams(lp);
|
view.setLayoutParams(lp);
|
||||||
|
webView.setWebViewClient(new WebViewClient() {
|
||||||
|
@Override
|
||||||
|
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
|
||||||
|
webView.loadUrl("about:blank");
|
||||||
|
noInternetView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
});
|
||||||
webView.setWebChromeClient(new WebChromeClient() {
|
webView.setWebChromeClient(new WebChromeClient() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
|
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
|
||||||
|
@ -229,8 +247,15 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
noInternetView.findViewById(R.id.retry_button).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
noInternetView.setVisibility(View.GONE);
|
||||||
|
webView.loadUrl(viewerUrl);
|
||||||
|
}
|
||||||
|
});
|
||||||
webView.loadUrl(viewerUrl);
|
webView.loadUrl(viewerUrl);
|
||||||
return webView;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MapillaryWebAppInterface {
|
private class MapillaryWebAppInterface {
|
||||||
|
@ -273,14 +298,24 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
staticImageView = view;
|
staticImageView = view.findViewById(R.id.staticImageViewLayout);
|
||||||
|
|
||||||
|
noInternetView = view.findViewById(R.id.mapillaryNoInternetLayout);
|
||||||
|
((ImageView) noInternetView.findViewById(R.id.wifiOff)).setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_wifi_off));
|
||||||
|
noInternetView.findViewById(R.id.retry_button).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
MenuBuilder.execute(new DownloadImageTask(staticImageView, downloadRequestNumber.incrementAndGet(), downloadRequestNumber));
|
||||||
|
fetchSequence();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (!Algorithms.isEmpty(imageUrl)) {
|
if (!Algorithms.isEmpty(imageUrl)) {
|
||||||
MenuBuilder.execute(new DownloadImageTask(staticImageView, downloadRequestNumber.incrementAndGet(), downloadRequestNumber));
|
MenuBuilder.execute(new DownloadImageTask(staticImageView, downloadRequestNumber.incrementAndGet(), downloadRequestNumber));
|
||||||
fetchSequence();
|
fetchSequence();
|
||||||
}
|
}
|
||||||
updateArrowButtons();
|
updateArrowButtons();
|
||||||
return staticImageView;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchSequence() {
|
private void fetchSequence() {
|
||||||
|
@ -493,6 +528,8 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
|
noInternetView.setVisibility(View.GONE);
|
||||||
|
staticImageView.setVisibility(View.VISIBLE);
|
||||||
if (progressBar != null) {
|
if (progressBar != null) {
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -518,8 +555,14 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
||||||
if (progressBar != null) {
|
if (progressBar != null) {
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
if (bitmap != null && imageView != null) {
|
if (imageView != null) {
|
||||||
imageView.setImageDrawable(new BitmapDrawable(getMapActivity().getResources(), bitmap));
|
if (bitmap != null) {
|
||||||
|
imageView.setImageDrawable(new BitmapDrawable(getMapActivity().getResources(), bitmap));
|
||||||
|
} else {
|
||||||
|
imageView.setImageDrawable(null);
|
||||||
|
staticImageView.setVisibility(View.GONE);
|
||||||
|
noInternetView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class MapillaryInstallDialogFragment extends DialogFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
MapillaryPlugin.installMapillary(mapActivity.getMyApplication());
|
MapillaryPlugin.installMapillary(mapActivity, mapActivity.getMyApplication());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.mapillary;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -23,6 +24,7 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.MapActivityLayers;
|
import net.osmand.plus.activities.MapActivityLayers;
|
||||||
import net.osmand.plus.base.BottomSheetDialogFragment;
|
import net.osmand.plus.base.BottomSheetDialogFragment;
|
||||||
|
@ -34,6 +36,7 @@ import net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo;
|
||||||
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -235,8 +238,9 @@ public class MapillaryPlugin extends OsmandPlugin {
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean installMapillary(OsmandApplication app) {
|
public static boolean installMapillary(Activity activity, OsmandApplication app) {
|
||||||
boolean success = execInstall(app, "market://search?q=pname:" + MAPILLARY_PACKAGE_ID);
|
app.logEvent(activity, "install_mapillary");
|
||||||
|
boolean success = execInstall(app, Version.getUrlWithUtmRef(app, MAPILLARY_PACKAGE_ID));
|
||||||
if (!success) {
|
if (!success) {
|
||||||
success = execInstall(app, "https://play.google.com/store/apps/details?id=" + MAPILLARY_PACKAGE_ID);
|
success = execInstall(app, "https://play.google.com/store/apps/details?id=" + MAPILLARY_PACKAGE_ID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class DashTrackFragment extends DashBaseFragment {
|
||||||
info.subfolder = "";
|
info.subfolder = "";
|
||||||
info.file = f;
|
info.file = f;
|
||||||
View v = inflater.inflate(R.layout.dash_gpx_track_item, null, false);
|
View v = inflater.inflate(R.layout.dash_gpx_track_item, null, false);
|
||||||
AvailableGPXFragment.udpateGpxInfoView(v, info, app, true);
|
AvailableGPXFragment.updateGpxInfoView(v, info, app, true);
|
||||||
|
|
||||||
v.setOnClickListener(new View.OnClickListener() {
|
v.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -257,7 +257,7 @@ public class DashTrackFragment extends DashBaseFragment {
|
||||||
AvailableGPXFragment.GpxInfo info = new AvailableGPXFragment.GpxInfo();
|
AvailableGPXFragment.GpxInfo info = new AvailableGPXFragment.GpxInfo();
|
||||||
info.subfolder = "";
|
info.subfolder = "";
|
||||||
info.file = f;
|
info.file = f;
|
||||||
AvailableGPXFragment.udpateGpxInfoView(pView, info, app, true);
|
AvailableGPXFragment.updateGpxInfoView(pView, info, app, true);
|
||||||
updateShowOnMap(app, f, v, showOnMap);
|
updateShowOnMap(app, f, v, showOnMap);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -187,7 +187,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
allGpxAdapter.notifyDataSetChanged();
|
allGpxAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
asyncProcessor = new ProcessGpxTask();
|
asyncProcessor = new ProcessGpxTask();
|
||||||
asyncProcessor.execute();
|
asyncProcessor.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
updateCurrentTrack();
|
updateCurrentTrack();
|
||||||
|
|
||||||
|
@ -1048,7 +1048,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
v = inflater.inflate(R.layout.dash_gpx_track_item, parent, false);
|
v = inflater.inflate(R.layout.dash_gpx_track_item, parent, false);
|
||||||
}
|
}
|
||||||
udpateGpxInfoView(v, child, app, false);
|
updateGpxInfoView(v, child, app, false);
|
||||||
|
|
||||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||||
ImageButton options = (ImageButton) v.findViewById(R.id.options);
|
ImageButton options = (ImageButton) v.findViewById(R.id.options);
|
||||||
|
@ -1314,10 +1314,12 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
}
|
}
|
||||||
if (gpxItem.analysis.hasSpeedData) {
|
if (gpxItem.analysis.hasSpeedData) {
|
||||||
list.add(GPXDataSetType.SPEED);
|
list.add(GPXDataSetType.SPEED);
|
||||||
} else {
|
} else if (gpxItem.analysis.hasElevationData) {
|
||||||
list.add(GPXDataSetType.SLOPE);
|
list.add(GPXDataSetType.SLOPE);
|
||||||
}
|
}
|
||||||
gpxItem.chartTypes = list.toArray(new GPXDataSetType[list.size()]);
|
if (list.size() > 0) {
|
||||||
|
gpxItem.chartTypes = list.toArray(new GPXDataSetType[list.size()]);
|
||||||
|
}
|
||||||
if (gpxItem.group.getGpx() != null) {
|
if (gpxItem.group.getGpx() != null) {
|
||||||
gpxItem.wasHidden = app.getSelectedGpxHelper().getSelectedFileByPath(gpxInfo.file.getAbsolutePath()) == null;
|
gpxItem.wasHidden = app.getSelectedGpxHelper().getSelectedFileByPath(gpxInfo.file.getAbsolutePath()) == null;
|
||||||
app.getSelectedGpxHelper().setGpxFileToDisplay(gpxItem.group.getGpx());
|
app.getSelectedGpxHelper().setGpxFileToDisplay(gpxItem.group.getGpx());
|
||||||
|
@ -1752,7 +1754,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void udpateGpxInfoView(View v, GpxInfo child, OsmandApplication app, boolean isDashItem) {
|
public static void updateGpxInfoView(View v, GpxInfo child, OsmandApplication app, boolean isDashItem) {
|
||||||
TextView viewName = ((TextView) v.findViewById(R.id.name));
|
TextView viewName = ((TextView) v.findViewById(R.id.name));
|
||||||
if (!isDashItem) {
|
if (!isDashItem) {
|
||||||
v.findViewById(R.id.divider_list).setVisibility(View.VISIBLE);
|
v.findViewById(R.id.divider_list).setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -322,29 +322,28 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<GpxDisplayGroup> filterGroups(boolean useDisplayGroups) {
|
private List<GpxDisplayGroup> filterGroups(boolean useDisplayGroups) {
|
||||||
if (getTrackActivity() == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(useDisplayGroups);
|
|
||||||
List<GpxDisplayGroup> groups = new ArrayList<>();
|
List<GpxDisplayGroup> groups = new ArrayList<>();
|
||||||
for (GpxDisplayGroup group : result) {
|
if (getTrackActivity() != null) {
|
||||||
boolean add = hasFilterType(group.getType());
|
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(useDisplayGroups);
|
||||||
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
|
for (GpxDisplayGroup group : result) {
|
||||||
Iterator<GpxDisplayItem> item = group.getModifiableList().iterator();
|
boolean add = hasFilterType(group.getType());
|
||||||
while (item.hasNext()) {
|
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
|
||||||
GpxDisplayItem it2 = item.next();
|
Iterator<GpxDisplayItem> item = group.getModifiableList().iterator();
|
||||||
if (it2.analysis != null && it2.analysis.totalDistance < 100) {
|
while (item.hasNext()) {
|
||||||
item.remove();
|
GpxDisplayItem it2 = item.next();
|
||||||
|
if (it2.analysis != null && it2.analysis.totalDistance < 100) {
|
||||||
|
item.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (group.getModifiableList().isEmpty()) {
|
||||||
|
add = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (group.getModifiableList().isEmpty()) {
|
if (add) {
|
||||||
add = false;
|
groups.add(group);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (add) {
|
|
||||||
groups.add(group);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return groups;
|
return groups;
|
||||||
}
|
}
|
||||||
|
@ -577,7 +576,12 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
||||||
|
|
||||||
String maxSpeed = OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app);
|
String maxSpeed = OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app);
|
||||||
String minSpeed = OsmAndFormatter.getFormattedSpeed(analysis.minSpeed, app);
|
String minSpeed = OsmAndFormatter.getFormattedSpeed(analysis.minSpeed, app);
|
||||||
String maxMinSpeed = maxSpeed.substring(0, maxSpeed.indexOf(" ")).concat("/").concat(minSpeed);
|
String maxMinSpeed;
|
||||||
|
if (maxSpeed.contains(" ")) {
|
||||||
|
maxMinSpeed = maxSpeed.substring(0, maxSpeed.indexOf(" ")).concat("/").concat(minSpeed);
|
||||||
|
} else {
|
||||||
|
maxMinSpeed = maxSpeed.substring(0, maxSpeed.indexOf("-")).concat("/").concat(minSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
if (minMaxSpeedLayoutWidth == 0) {
|
if (minMaxSpeedLayoutWidth == 0) {
|
||||||
DisplayMetrics metrics = new DisplayMetrics();
|
DisplayMetrics metrics = new DisplayMetrics();
|
||||||
|
@ -592,7 +596,7 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
||||||
minMaxSpeedPaint.getTextBounds(maxMinSpeed, 0, maxMinSpeed.length(), minMaxSpeedTextBounds);
|
minMaxSpeedPaint.getTextBounds(maxMinSpeed, 0, maxMinSpeed.length(), minMaxSpeedTextBounds);
|
||||||
int minMaxStringWidth = minMaxSpeedTextBounds.width();
|
int minMaxStringWidth = minMaxSpeedTextBounds.width();
|
||||||
|
|
||||||
if (minSpeed.substring(0, minSpeed.indexOf(" ")).equals("0") || minSpeed.substring(0, minSpeed.indexOf(" ")).equals("0.0")) {
|
if (analysis.minSpeed == 0) {
|
||||||
(convertView.findViewById(R.id.max_speed_value))
|
(convertView.findViewById(R.id.max_speed_value))
|
||||||
.setVisibility(View.VISIBLE);
|
.setVisibility(View.VISIBLE);
|
||||||
(convertView.findViewById(R.id.min_speed_value))
|
(convertView.findViewById(R.id.min_speed_value))
|
||||||
|
@ -657,9 +661,6 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
||||||
}
|
}
|
||||||
if (mSelectedGpxFile != null) {
|
if (mSelectedGpxFile != null) {
|
||||||
List<GpxDisplayGroup> groups = getDisplayGroups();
|
List<GpxDisplayGroup> groups = getDisplayGroups();
|
||||||
if (groups == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mSelectedGpxFile.setDisplayGroups(groups);
|
mSelectedGpxFile.setDisplayGroups(groups);
|
||||||
}
|
}
|
||||||
updateContent();
|
updateContent();
|
||||||
|
|
|
@ -121,16 +121,16 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrackActivity getMyActivity() {
|
public TrackActivity getTrackActivity() {
|
||||||
return (TrackActivity) getActivity();
|
return (TrackActivity) getActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
private GPXFile getGpx() {
|
private GPXFile getGpx() {
|
||||||
return getMyActivity().getGpx();
|
return getTrackActivity().getGpx();
|
||||||
}
|
}
|
||||||
|
|
||||||
private GpxDataItem getGpxDataItem() {
|
private GpxDataItem getGpxDataItem() {
|
||||||
return getMyActivity().getGpxDataItem();
|
return getTrackActivity().getGpxDataItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void expandAllGroups() {
|
private void expandAllGroups() {
|
||||||
|
@ -160,26 +160,28 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<GpxDisplayGroup> filterGroups() {
|
private List<GpxDisplayGroup> filterGroups() {
|
||||||
List<GpxDisplayGroup> result = getMyActivity().getGpxFile(false);
|
|
||||||
List<GpxDisplayGroup> groups = new ArrayList<>();
|
List<GpxDisplayGroup> groups = new ArrayList<>();
|
||||||
for (GpxDisplayGroup group : result) {
|
if (getTrackActivity() != null) {
|
||||||
boolean add = hasFilterType(group.getType());
|
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(false);
|
||||||
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
|
for (GpxDisplayGroup group : result) {
|
||||||
Iterator<GpxDisplayItem> item = group.getModifiableList().iterator();
|
boolean add = hasFilterType(group.getType());
|
||||||
while (item.hasNext()) {
|
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
|
||||||
GpxDisplayItem it2 = item.next();
|
Iterator<GpxDisplayItem> item = group.getModifiableList().iterator();
|
||||||
if (it2.analysis != null && it2.analysis.totalDistance < 100) {
|
while (item.hasNext()) {
|
||||||
item.remove();
|
GpxDisplayItem it2 = item.next();
|
||||||
|
if (it2.analysis != null && it2.analysis.totalDistance < 100) {
|
||||||
|
item.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (group.getModifiableList().isEmpty()) {
|
||||||
|
add = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (group.getModifiableList().isEmpty()) {
|
if (add) {
|
||||||
add = false;
|
groups.add(group);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (add) {
|
|
||||||
groups.add(group);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return groups;
|
return groups;
|
||||||
}
|
}
|
||||||
|
@ -537,8 +539,8 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
|
|
||||||
private void selectFavoritesImpl() {
|
private void selectFavoritesImpl() {
|
||||||
if (!selectedItems.isEmpty()) {
|
if (!selectedItems.isEmpty()) {
|
||||||
AlertDialog.Builder b = new AlertDialog.Builder(getMyActivity());
|
AlertDialog.Builder b = new AlertDialog.Builder(getTrackActivity());
|
||||||
final EditText editText = new EditText(getMyActivity());
|
final EditText editText = new EditText(getTrackActivity());
|
||||||
String name = selectedItems.iterator().next().group.getName();
|
String name = selectedItems.iterator().next().group.getName();
|
||||||
if(name.indexOf('\n') > 0) {
|
if(name.indexOf('\n') > 0) {
|
||||||
name = name.substring(0, name.indexOf('\n'));
|
name = name.substring(0, name.indexOf('\n'));
|
||||||
|
@ -818,7 +820,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
groupColor = gpxItem.locationStart.getColor(groupColor);
|
groupColor = gpxItem.locationStart.getColor(groupColor);
|
||||||
}
|
}
|
||||||
if (groupColor == 0) {
|
if (groupColor == 0) {
|
||||||
groupColor = getMyActivity().getResources().getColor(R.color.gpx_color_point);
|
groupColor = getTrackActivity().getResources().getColor(R.color.gpx_color_point);
|
||||||
}
|
}
|
||||||
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(), groupColor, false));
|
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(), groupColor, false));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -236,7 +236,11 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private GPXFile getGpx() {
|
private GPXFile getGpx() {
|
||||||
return getTrackActivity().getGpx();
|
TrackActivity activity = getTrackActivity();
|
||||||
|
if (activity == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return activity.getGpx();
|
||||||
}
|
}
|
||||||
|
|
||||||
private GpxDataItem getGpxDataItem() {
|
private GpxDataItem getGpxDataItem() {
|
||||||
|
@ -278,14 +282,24 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
||||||
imageView.setOnClickListener(new View.OnClickListener() {
|
imageView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
WptPt pointToShow = getGpx() != null ? getGpx().findPointToShow() : null;
|
GpxDataItem gpxDataItem = getGpxDataItem();
|
||||||
|
GPXFile gpx = getGpx();
|
||||||
|
WptPt pointToShow = gpx != null ? gpx.findPointToShow() : null;
|
||||||
if (pointToShow != null) {
|
if (pointToShow != null) {
|
||||||
LatLon location = new LatLon(pointToShow.getLatitude(),
|
LatLon location = new LatLon(pointToShow.getLatitude(),
|
||||||
pointToShow.getLongitude());
|
pointToShow.getLongitude());
|
||||||
final OsmandSettings settings = app.getSettings();
|
final OsmandSettings settings = app.getSettings();
|
||||||
|
String trackName = "";
|
||||||
|
if (gpx.showCurrentTrack) {
|
||||||
|
trackName = getString(R.string.shared_string_currently_recording_track);
|
||||||
|
} else if (gpxDataItem != null) {
|
||||||
|
trackName = gpxDataItem.getFile().getName();
|
||||||
|
} else {
|
||||||
|
trackName = gpx.path;
|
||||||
|
}
|
||||||
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
|
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
|
||||||
settings.getLastKnownMapZoom(),
|
settings.getLastKnownMapZoom(),
|
||||||
new PointDescription(PointDescription.POINT_TYPE_WPT, getGpxDataItem().getFile().getName()),
|
new PointDescription(PointDescription.POINT_TYPE_WPT, trackName),
|
||||||
false,
|
false,
|
||||||
getRect()
|
getRect()
|
||||||
);
|
);
|
||||||
|
@ -710,29 +724,28 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<GpxDisplayGroup> filterGroups(boolean useDisplayGroups) {
|
private List<GpxDisplayGroup> filterGroups(boolean useDisplayGroups) {
|
||||||
if (getTrackActivity() == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(useDisplayGroups);
|
|
||||||
List<GpxDisplayGroup> groups = new ArrayList<>();
|
List<GpxDisplayGroup> groups = new ArrayList<>();
|
||||||
for (GpxDisplayGroup group : result) {
|
if (getTrackActivity() != null) {
|
||||||
boolean add = hasFilterType(group.getType());
|
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(useDisplayGroups);
|
||||||
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
|
for (GpxDisplayGroup group : result) {
|
||||||
Iterator<GpxDisplayItem> item = group.getModifiableList().iterator();
|
boolean add = hasFilterType(group.getType());
|
||||||
while (item.hasNext()) {
|
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
|
||||||
GpxDisplayItem it2 = item.next();
|
Iterator<GpxDisplayItem> item = group.getModifiableList().iterator();
|
||||||
if (it2.analysis != null && it2.analysis.totalDistance < 100) {
|
while (item.hasNext()) {
|
||||||
item.remove();
|
GpxDisplayItem it2 = item.next();
|
||||||
|
if (it2.analysis != null && it2.analysis.totalDistance < 100) {
|
||||||
|
item.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (group.getModifiableList().isEmpty()) {
|
||||||
|
add = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (group.getModifiableList().isEmpty()) {
|
if (add) {
|
||||||
add = false;
|
groups.add(group);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (add) {
|
|
||||||
groups.add(group);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return groups;
|
return groups;
|
||||||
}
|
}
|
||||||
|
@ -746,7 +759,9 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
||||||
}
|
}
|
||||||
adapter.setNotifyOnChange(true);
|
adapter.setNotifyOnChange(true);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
updateHeader();
|
if (getActivity() != null) {
|
||||||
|
updateHeader();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<GpxDisplayItem> flatten(List<GpxDisplayGroup> groups) {
|
protected List<GpxDisplayItem> flatten(List<GpxDisplayGroup> groups) {
|
||||||
|
@ -1541,9 +1556,6 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
||||||
}
|
}
|
||||||
if (mSelectedGpxFile != null) {
|
if (mSelectedGpxFile != null) {
|
||||||
List<GpxDisplayGroup> groups = getDisplayGroups();
|
List<GpxDisplayGroup> groups = getDisplayGroups();
|
||||||
if (groups == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mSelectedGpxFile.setDisplayGroups(groups);
|
mSelectedGpxFile.setDisplayGroups(groups);
|
||||||
}
|
}
|
||||||
if (mFragment.isVisible()) {
|
if (mFragment.isVisible()) {
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class UploadOpenstreetmapPointAsyncTask
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Map<OsmPoint, String> loadErrorsMap) {
|
protected void onPostExecute(Map<OsmPoint, String> loadErrorsMap) {
|
||||||
if (progress != null) {
|
if (progress != null) {
|
||||||
progress.dismiss();
|
progress.dismissAllowingStateLoss();
|
||||||
}
|
}
|
||||||
listener.uploadEnded(loadErrorsMap);
|
listener.uploadEnded(loadErrorsMap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,9 @@ public class SendPoiDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
private String createDefaultChangeSet() {
|
private String createDefaultChangeSet() {
|
||||||
Map<String, PoiType> allTranslatedSubTypes = getMyApplication().getPoiTypes().getAllTranslatedNames(true);
|
Map<String, PoiType> allTranslatedSubTypes = getMyApplication().getPoiTypes().getAllTranslatedNames(true);
|
||||||
|
if (allTranslatedSubTypes == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
Map<String, Integer> addGroup = new HashMap<>();
|
Map<String, Integer> addGroup = new HashMap<>();
|
||||||
Map<String, Integer> editGroup = new HashMap<>();
|
Map<String, Integer> editGroup = new HashMap<>();
|
||||||
Map<String, Integer> deleteGroup = new HashMap<>();
|
Map<String, Integer> deleteGroup = new HashMap<>();
|
||||||
|
@ -146,6 +149,9 @@ public class SendPoiDialogFragment extends DialogFragment {
|
||||||
if (p.getGroup() == OsmPoint.Group.POI) {
|
if (p.getGroup() == OsmPoint.Group.POI) {
|
||||||
OsmPoint.Action action = p.getAction();
|
OsmPoint.Action action = p.getAction();
|
||||||
String type = ((OpenstreetmapPoint) p).getEntity().getTag(EditPoiData.POI_TYPE_TAG);
|
String type = ((OpenstreetmapPoint) p).getEntity().getTag(EditPoiData.POI_TYPE_TAG);
|
||||||
|
if (type == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
PoiType localizedPoiType = allTranslatedSubTypes.get(type.toLowerCase().trim());
|
PoiType localizedPoiType = allTranslatedSubTypes.get(type.toLowerCase().trim());
|
||||||
if (localizedPoiType != null) {
|
if (localizedPoiType != null) {
|
||||||
type = Algorithms.capitalizeFirstLetter(localizedPoiType.getKeyName().replace('_', ' '));
|
type = Algorithms.capitalizeFirstLetter(localizedPoiType.getKeyName().replace('_', ' '));
|
||||||
|
@ -178,7 +184,6 @@ public class SendPoiDialogFragment extends DialogFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int modifiedItemsOutOfLimit = 0;
|
int modifiedItemsOutOfLimit = 0;
|
||||||
boolean stringModifiedIfExceeded = false;
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
String action;
|
String action;
|
||||||
Map<String, Integer> group;
|
Map<String, Integer> group;
|
||||||
|
@ -205,37 +210,27 @@ public class SendPoiDialogFragment extends DialogFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!group.isEmpty()) {
|
if (!group.isEmpty()) {
|
||||||
if (modifiedItemsOutOfLimit == 0) {
|
|
||||||
comment = comment.concat(action).concat(" ");
|
|
||||||
}
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
for (Map.Entry<String, Integer> entry : group.entrySet()) {
|
for (Map.Entry<String, Integer> entry : group.entrySet()) {
|
||||||
String type = entry.getKey();
|
String type = entry.getKey();
|
||||||
int quantity = entry.getValue();
|
int quantity = entry.getValue();
|
||||||
if (comment.length() > 200) {
|
if (comment.length() > 200) {
|
||||||
modifiedItemsOutOfLimit += quantity;
|
modifiedItemsOutOfLimit += quantity;
|
||||||
if (!stringModifiedIfExceeded) {
|
|
||||||
if (pos == 0) {
|
|
||||||
comment = comment.substring(0, comment.length() - action.length() - 3).concat("; ");
|
|
||||||
} else {
|
|
||||||
comment = comment.substring(0, comment.length() - 2).concat("; ");
|
|
||||||
}
|
|
||||||
stringModifiedIfExceeded = true;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
comment = comment.concat(quantity == 1 ? "" : quantity + " ").concat(type + ", ");
|
if (pos == 0) {
|
||||||
|
comment = comment.concat(comment.length() == 0 ? "" : "; ").concat(action).concat(" ").concat(quantity == 1 ? "" : quantity + "").concat(type);
|
||||||
|
} else {
|
||||||
|
comment = comment.concat(", ").concat(quantity == 1 ? "" : quantity + "").concat(type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
if (modifiedItemsOutOfLimit == 0) {
|
|
||||||
comment = comment.substring(0, comment.length() - 2).concat("; ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (modifiedItemsOutOfLimit != 0) {
|
if (modifiedItemsOutOfLimit != 0) {
|
||||||
comment = comment.concat(modifiedItemsOutOfLimit + " ").concat(getString(R.string.items_modified)).concat(".");
|
comment = comment.concat("; ").concat(modifiedItemsOutOfLimit + " ").concat(getString(R.string.items_modified)).concat(".");
|
||||||
} else if (!comment.equals("")){
|
} else if (!comment.equals("")){
|
||||||
comment = comment.substring(0, comment.length() - 2).concat(".");
|
comment = comment.concat(".");
|
||||||
}
|
}
|
||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PoiUIFilter> getTopDefinedPoiFilters() {
|
public List<PoiUIFilter> getTopDefinedPoiFilters() {
|
||||||
// if (cacheTopStandardFilters == null) {
|
if (cacheTopStandardFilters == null) {
|
||||||
List<PoiUIFilter> top = new ArrayList<PoiUIFilter>();
|
List<PoiUIFilter> top = new ArrayList<PoiUIFilter>();
|
||||||
// user defined
|
// user defined
|
||||||
top.addAll(getUserDefinedPoiFilters());
|
top.addAll(getUserDefinedPoiFilters());
|
||||||
|
@ -209,7 +209,7 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
Collections.sort(top);
|
Collections.sort(top);
|
||||||
cacheTopStandardFilters = top;
|
cacheTopStandardFilters = top;
|
||||||
// }
|
}
|
||||||
List<PoiUIFilter> result = new ArrayList<PoiUIFilter>();
|
List<PoiUIFilter> result = new ArrayList<PoiUIFilter>();
|
||||||
result.addAll(cacheTopStandardFilters);
|
result.addAll(cacheTopStandardFilters);
|
||||||
result.add(getShowAllPOIFilter());
|
result.add(getShowAllPOIFilter());
|
||||||
|
|
|
@ -578,10 +578,19 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
||||||
|
|
||||||
private void putAllAcceptedTypes(Map<PoiCategory, LinkedHashSet<String>> types) {
|
private void putAllAcceptedTypes(Map<PoiCategory, LinkedHashSet<String>> types) {
|
||||||
for (PoiCategory category : types.keySet()) {
|
for (PoiCategory category : types.keySet()) {
|
||||||
|
LinkedHashSet<String> typesSet = types.get(category);
|
||||||
if (acceptedTypes.containsKey(category)) {
|
if (acceptedTypes.containsKey(category)) {
|
||||||
acceptedTypes.get(category).addAll(types.get(category));
|
if (acceptedTypes.get(category) != null && typesSet != null) {
|
||||||
|
acceptedTypes.get(category).addAll(typesSet);
|
||||||
|
} else {
|
||||||
|
acceptedTypes.put(category, null);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
acceptedTypes.put(category, types.get(category));
|
if (typesSet != null) {
|
||||||
|
acceptedTypes.put(category, new LinkedHashSet<>(typesSet));
|
||||||
|
} else {
|
||||||
|
acceptedTypes.put(category, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -350,7 +350,7 @@ public class ResourceManager {
|
||||||
public List<String> reloadIndexesOnStart(AppInitializer progress, List<String> warnings){
|
public List<String> reloadIndexesOnStart(AppInitializer progress, List<String> warnings){
|
||||||
close();
|
close();
|
||||||
// check we have some assets to copy to sdcard
|
// check we have some assets to copy to sdcard
|
||||||
warnings.addAll(checkAssets(progress));
|
warnings.addAll(checkAssets(progress, false));
|
||||||
progress.notifyEvent(InitEvents.ASSETS_COPIED);
|
progress.notifyEvent(InitEvents.ASSETS_COPIED);
|
||||||
reloadIndexes(progress, warnings);
|
reloadIndexes(progress, warnings);
|
||||||
progress.notifyEvent(InitEvents.MAPS_INITIALIZED);
|
progress.notifyEvent(InitEvents.MAPS_INITIALIZED);
|
||||||
|
@ -414,9 +414,9 @@ public class ResourceManager {
|
||||||
return warnings;
|
return warnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> checkAssets(IProgress progress) {
|
public List<String> checkAssets(IProgress progress, boolean forceUpdate) {
|
||||||
String fv = Version.getFullVersion(context);
|
String fv = Version.getFullVersion(context);
|
||||||
if (!fv.equalsIgnoreCase(context.getSettings().PREVIOUS_INSTALLED_VERSION.get())) {
|
if (!fv.equalsIgnoreCase(context.getSettings().PREVIOUS_INSTALLED_VERSION.get()) || forceUpdate) {
|
||||||
File applicationDataDir = context.getAppPath(null);
|
File applicationDataDir = context.getAppPath(null);
|
||||||
applicationDataDir.mkdirs();
|
applicationDataDir.mkdirs();
|
||||||
if (applicationDataDir.canWrite()) {
|
if (applicationDataDir.canWrite()) {
|
||||||
|
@ -424,7 +424,7 @@ public class ResourceManager {
|
||||||
progress.startTask(context.getString(R.string.installing_new_resources), -1);
|
progress.startTask(context.getString(R.string.installing_new_resources), -1);
|
||||||
AssetManager assetManager = context.getAssets();
|
AssetManager assetManager = context.getAssets();
|
||||||
boolean isFirstInstall = context.getSettings().PREVIOUS_INSTALLED_VERSION.get().equals("");
|
boolean isFirstInstall = context.getSettings().PREVIOUS_INSTALLED_VERSION.get().equals("");
|
||||||
unpackBundledAssets(assetManager, applicationDataDir, progress, isFirstInstall);
|
unpackBundledAssets(assetManager, applicationDataDir, progress, isFirstInstall || forceUpdate);
|
||||||
context.getSettings().PREVIOUS_INSTALLED_VERSION.set(fv);
|
context.getSettings().PREVIOUS_INSTALLED_VERSION.set(fv);
|
||||||
copyRegionsBoundaries();
|
copyRegionsBoundaries();
|
||||||
// see Issue #3381
|
// see Issue #3381
|
||||||
|
|
|
@ -484,16 +484,10 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
renderedObjects = nativeLib.searchRenderedObjectsFromContext(rc, (int) (point.x - x), (int) (point.y - y));
|
renderedObjects = nativeLib.searchRenderedObjectsFromContext(rc, (int) (point.x - x), (int) (point.y - y));
|
||||||
}
|
}
|
||||||
if (renderedObjects != null) {
|
if (renderedObjects != null) {
|
||||||
// double tx = c.first/ (rc->tileDivisor);
|
|
||||||
// double ty = c.second / (rc->tileDivisor);
|
|
||||||
// float dTileX = tx - rc->getLeft();
|
|
||||||
// float dTileY = ty - rc->getTop();
|
|
||||||
// rc->calcX = rc->cosRotateTileSize * dTileX - rc->sinRotateTileSize * dTileY;
|
|
||||||
// rc->calcY = rc->sinRotateTileSize * dTileX + rc->cosRotateTileSize * dTileY;
|
|
||||||
int TILE_SIZE = 256;
|
int TILE_SIZE = 256;
|
||||||
double cosRotateTileSize = Math.cos(Math.toRadians(rc.rotate)) * TILE_SIZE;
|
double cosRotateTileSize = Math.cos(Math.toRadians(rc.rotate)) * TILE_SIZE;
|
||||||
double sinRotateTileSize = Math.sin(Math.toRadians(rc.rotate)) * TILE_SIZE;
|
double sinRotateTileSize = Math.sin(Math.toRadians(rc.rotate)) * TILE_SIZE;
|
||||||
for(RenderedObject r : renderedObjects) {
|
for (RenderedObject r : renderedObjects) {
|
||||||
double cx = r.getBbox().centerX();
|
double cx = r.getBbox().centerX();
|
||||||
double cy = r.getBbox().centerY();
|
double cy = r.getBbox().centerY();
|
||||||
double dTileX = (cx * cosRotateTileSize + cy * sinRotateTileSize) / (TILE_SIZE * TILE_SIZE);
|
double dTileX = (cx * cosRotateTileSize + cy * sinRotateTileSize) / (TILE_SIZE * TILE_SIZE);
|
||||||
|
@ -544,16 +538,15 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
if (selectedObjects.size() == 1) {
|
if (selectedObjects.size() == 1) {
|
||||||
Object selectedObj = selectedObjects.keySet().iterator().next();
|
Object selectedObj = selectedObjects.keySet().iterator().next();
|
||||||
LatLon latLon = null;
|
LatLon latLon = objectLatLon;
|
||||||
PointDescription pointDescription = null;
|
PointDescription pointDescription = null;
|
||||||
final IContextMenuProvider provider = selectedObjects.get(selectedObj);
|
final IContextMenuProvider provider = selectedObjects.get(selectedObj);
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
latLon = provider.getObjectLocation(selectedObj);
|
if (latLon == null) {
|
||||||
|
latLon = provider.getObjectLocation(selectedObj);
|
||||||
|
}
|
||||||
pointDescription = provider.getObjectName(selectedObj);
|
pointDescription = provider.getObjectName(selectedObj);
|
||||||
}
|
}
|
||||||
if (latLon == null) {
|
|
||||||
latLon = objectLatLon;
|
|
||||||
}
|
|
||||||
if (latLon == null) {
|
if (latLon == null) {
|
||||||
latLon = getLatLon(point, tileBox);
|
latLon = getLatLon(point, tileBox);
|
||||||
}
|
}
|
||||||
|
@ -763,7 +756,12 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
if (movementListener.onTouchEvent(event)) {
|
if (movementListener.onTouchEvent(event)) {
|
||||||
if (menu.isVisible()) {
|
if (menu.isVisible()) {
|
||||||
menu.hide();
|
if (!menu.isClosable()) {
|
||||||
|
menu.hide();
|
||||||
|
} else {
|
||||||
|
menu.updateMapCenter(null);
|
||||||
|
menu.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (multiSelectionMenu.isVisible()) {
|
if (multiSelectionMenu.isVisible()) {
|
||||||
multiSelectionMenu.hide();
|
multiSelectionMenu.hide();
|
||||||
|
|
|
@ -278,22 +278,22 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
// request to load
|
// request to load
|
||||||
for (SelectedGpxFile g : selectedGPXFiles) {
|
for (SelectedGpxFile g : selectedGPXFiles) {
|
||||||
List<GpxDisplayGroup> groups = g.getDisplayGroups();
|
List<GpxDisplayGroup> groups = g.getDisplayGroups();
|
||||||
if (groups != null) {
|
if (groups != null && !groups.isEmpty()) {
|
||||||
for (GpxDisplayGroup group : groups) {
|
GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path));
|
||||||
GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path));
|
int color = gpxDataItem.getColor();
|
||||||
int color = gpxDataItem.getColor();
|
if (color == 0) {
|
||||||
if (color == 0) {
|
color = g.getModifiableGpxFile().getColor(0);
|
||||||
color = g.getModifiableGpxFile().getColor(0);
|
|
||||||
}
|
|
||||||
if (color == 0) {
|
|
||||||
color = cachedColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
paintInnerRect.setColor(color);
|
|
||||||
paintInnerRect.setAlpha(179);
|
|
||||||
List<GpxDisplayItem> items = group.getModifiableList();
|
|
||||||
drawSplitItems(canvas, tileBox, items, settings);
|
|
||||||
}
|
}
|
||||||
|
if (color == 0) {
|
||||||
|
color = cachedColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
paintInnerRect.setColor(color);
|
||||||
|
paintInnerRect.setAlpha(179);
|
||||||
|
|
||||||
|
List<GpxDisplayItem> items = groups.get(0).getModifiableList();
|
||||||
|
|
||||||
|
drawSplitItems(canvas, tileBox, items, settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import android.widget.SeekBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.Location;
|
||||||
import net.osmand.core.android.MapRendererContext;
|
import net.osmand.core.android.MapRendererContext;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
|
@ -273,6 +274,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
search.setOnClickListener(new View.OnClickListener() {
|
search.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
mapActivity.dismissCardDialog();
|
||||||
mapActivity.showQuickSearch(ShowQuickSearchMode.NEW_IF_EXPIRED, false);
|
mapActivity.showQuickSearch(ShowQuickSearchMode.NEW_IF_EXPIRED, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -423,6 +425,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
routePlanButton.setOnClickListener(new View.OnClickListener() {
|
routePlanButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
mapActivity.dismissCardDialog();
|
||||||
doRoute(false);
|
doRoute(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -792,8 +795,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMyLocation(RoutingHelper rh, boolean dialogOpened) {
|
private void updateMyLocation(RoutingHelper rh, boolean dialogOpened) {
|
||||||
boolean enabled = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation() != null &&
|
Location lastKnownLocation = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||||
!isLocationOutdated(mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation());
|
boolean enabled = lastKnownLocation != null && !isLocationOutdated(lastKnownLocation);
|
||||||
boolean tracked = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
|
boolean tracked = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
|
||||||
|
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
|
|
|
@ -80,8 +80,10 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
quickActionButton.setOnClickListener(new View.OnClickListener() {
|
quickActionButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (!showTutorialIfNeeded())
|
mapActivity.dismissCardDialog();
|
||||||
|
if (!showTutorialIfNeeded()) {
|
||||||
setLayerState(!isWidgetVisible());
|
setLayerState(!isWidgetVisible());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ import android.view.WindowManager;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.SecondSplashScreenFragment;
|
|
||||||
import net.osmand.access.AccessibilityActionsProvider;
|
import net.osmand.access.AccessibilityActionsProvider;
|
||||||
import net.osmand.core.android.MapRendererView;
|
import net.osmand.core.android.MapRendererView;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
@ -109,6 +108,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
||||||
public boolean onPressEvent(PointF point);
|
public boolean onPressEvent(PointF point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface OnDrawMapListener {
|
||||||
|
public void onDrawOverMap();
|
||||||
|
}
|
||||||
|
|
||||||
public int getDefaultColor() {
|
public int getDefaultColor() {
|
||||||
return defaultColor;
|
return defaultColor;
|
||||||
}
|
}
|
||||||
|
@ -142,6 +145,8 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
||||||
|
|
||||||
private Map<OsmandMapLayer, Float> zOrders = new HashMap<OsmandMapLayer, Float>();
|
private Map<OsmandMapLayer, Float> zOrders = new HashMap<OsmandMapLayer, Float>();
|
||||||
|
|
||||||
|
private OnDrawMapListener onDrawMapListener;
|
||||||
|
|
||||||
// UI Part
|
// UI Part
|
||||||
// handler to refresh map (in ui thread - ui thread is not necessary, but msg queue is required).
|
// handler to refresh map (in ui thread - ui thread is not necessary, but msg queue is required).
|
||||||
protected Handler handler;
|
protected Handler handler;
|
||||||
|
@ -448,6 +453,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
||||||
return locationListener;
|
return locationListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOnDrawMapListener(OnDrawMapListener onDrawMapListener) {
|
||||||
|
this.onDrawMapListener = onDrawMapListener;
|
||||||
|
}
|
||||||
|
|
||||||
// ////////////////////////////// DRAWING MAP PART /////////////////////////////////////////////
|
// ////////////////////////////// DRAWING MAP PART /////////////////////////////////////////////
|
||||||
public BaseMapLayer getMainLayer() {
|
public BaseMapLayer getMainLayer() {
|
||||||
return mainLayer;
|
return mainLayer;
|
||||||
|
@ -663,10 +672,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activity instanceof MapActivity && !((MapActivity) activity).isActivityDestroyed() &&
|
if (onDrawMapListener != null) {
|
||||||
((MapActivity) activity).getSupportFragmentManager().findFragmentByTag(SecondSplashScreenFragment.TAG) != null) {
|
onDrawMapListener.onDrawOverMap();
|
||||||
((MapActivity) activity).dismissSecondSplashScreen();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < layers.size(); i++) {
|
for (int i = 0; i < layers.size(); i++) {
|
||||||
try {
|
try {
|
||||||
OsmandMapLayer layer = layers.get(i);
|
OsmandMapLayer layer = layers.get(i);
|
||||||
|
|
|
@ -86,9 +86,9 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
||||||
}
|
}
|
||||||
// draw
|
// draw
|
||||||
boolean nm = nightMode != null && nightMode.isNightMode();
|
boolean nm = nightMode != null && nightMode.isNightMode();
|
||||||
updateIcons(view.getSettings().getApplicationMode(), nm,
|
|
||||||
isLocationOutdated(locationProvider.getLastKnownLocation()));
|
|
||||||
Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
||||||
|
updateIcons(view.getSettings().getApplicationMode(), nm,
|
||||||
|
isLocationOutdated(lastKnownLocation));
|
||||||
if(lastKnownLocation == null || view == null){
|
if(lastKnownLocation == null || view == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.Path;
|
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
@ -19,14 +18,13 @@ import net.osmand.data.QuadPoint;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.RulerMode;
|
import net.osmand.plus.OsmandSettings.RulerMode;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import gnu.trove.list.array.TIntArrayList;
|
|
||||||
|
|
||||||
public class RulerControlLayer extends OsmandMapLayer {
|
public class RulerControlLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
private static final long DRAW_TIME = 2000;
|
private static final long DRAW_TIME = 2000;
|
||||||
|
@ -49,14 +47,13 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
private int acceptableTouchRadius;
|
private int acceptableTouchRadius;
|
||||||
|
|
||||||
private QuadPoint cacheCenter;
|
private QuadPoint cacheCenter;
|
||||||
|
private float cacheMapDensity;
|
||||||
|
private OsmandSettings.OsmandPreference<Float> mapDensity;
|
||||||
private int cacheIntZoom;
|
private int cacheIntZoom;
|
||||||
private double cacheTileX;
|
private double cacheTileX;
|
||||||
private double cacheTileY;
|
private double cacheTileY;
|
||||||
private long cacheMultiTouchEndTime;
|
private long cacheMultiTouchEndTime;
|
||||||
private ArrayList<String> cacheDistances;
|
private ArrayList<String> cacheDistances;
|
||||||
private Path distancePath;
|
|
||||||
private TIntArrayList tx;
|
|
||||||
private TIntArrayList ty;
|
|
||||||
private LatLon touchPointLatLon;
|
private LatLon touchPointLatLon;
|
||||||
private PointF touchPoint;
|
private PointF touchPoint;
|
||||||
private long touchStartTime;
|
private long touchStartTime;
|
||||||
|
@ -93,13 +90,12 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
public void initLayer(final OsmandMapTileView view) {
|
public void initLayer(final OsmandMapTileView view) {
|
||||||
app = mapActivity.getMyApplication();
|
app = mapActivity.getMyApplication();
|
||||||
this.view = view;
|
this.view = view;
|
||||||
|
mapDensity = mapActivity.getMyApplication().getSettings().MAP_DENSITY;
|
||||||
|
cacheMapDensity = mapDensity.get();
|
||||||
cacheDistances = new ArrayList<>();
|
cacheDistances = new ArrayList<>();
|
||||||
cacheCenter = new QuadPoint();
|
cacheCenter = new QuadPoint();
|
||||||
maxRadiusInDp = mapActivity.getResources().getDimensionPixelSize(R.dimen.map_ruler_width);
|
maxRadiusInDp = mapActivity.getResources().getDimensionPixelSize(R.dimen.map_ruler_width);
|
||||||
rightWidgetsPanel = mapActivity.findViewById(R.id.map_right_widgets_panel);
|
rightWidgetsPanel = mapActivity.findViewById(R.id.map_right_widgets_panel);
|
||||||
distancePath = new Path();
|
|
||||||
tx = new TIntArrayList();
|
|
||||||
ty = new TIntArrayList();
|
|
||||||
touchPoint = new PointF();
|
touchPoint = new PointF();
|
||||||
acceptableTouchRadius = mapActivity.getResources().getDimensionPixelSize(R.dimen.acceptable_touch_radius);
|
acceptableTouchRadius = mapActivity.getResources().getDimensionPixelSize(R.dimen.acceptable_touch_radius);
|
||||||
|
|
||||||
|
@ -156,7 +152,7 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
if (d > acceptableTouchRadius) {
|
if (d > acceptableTouchRadius) {
|
||||||
touchOutside = true;
|
touchOutside = true;
|
||||||
}
|
}
|
||||||
} else if (event.getAction() == MotionEvent.ACTION_UP) {
|
} else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||||
touched = false;
|
touched = false;
|
||||||
touchEndTime = System.currentTimeMillis();
|
touchEndTime = System.currentTimeMillis();
|
||||||
refreshMapDelayed();
|
refreshMapDelayed();
|
||||||
|
@ -205,8 +201,8 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
drawCenterIcon(canvas, tb, center, settings.isNightMode(), mode);
|
drawCenterIcon(canvas, tb, center, settings.isNightMode(), mode);
|
||||||
Location currentLoc = app.getLocationProvider().getLastKnownLocation();
|
Location currentLoc = app.getLocationProvider().getLastKnownLocation();
|
||||||
if (showDistBetweenFingerAndLocation && currentLoc != null) {
|
if (showDistBetweenFingerAndLocation && currentLoc != null) {
|
||||||
float x = tb.getPixXFromLonNoRot(touchPointLatLon.getLongitude());
|
float x = tb.getPixXFromLatLon(touchPointLatLon.getLatitude(), touchPointLatLon.getLongitude());
|
||||||
float y = tb.getPixYFromLatNoRot(touchPointLatLon.getLatitude());
|
float y = tb.getPixYFromLatLon(touchPointLatLon.getLatitude(), touchPointLatLon.getLongitude());
|
||||||
drawDistBetweenFingerAndLocation(canvas, tb, x, y, currentLoc, settings.isNightMode());
|
drawDistBetweenFingerAndLocation(canvas, tb, x, y, currentLoc, settings.isNightMode());
|
||||||
} else if (showTwoFingersDistance) {
|
} else if (showTwoFingersDistance) {
|
||||||
LatLon firstTouchPoint = view.getFirstTouchPointLatLon();
|
LatLon firstTouchPoint = view.getFirstTouchPointLatLon();
|
||||||
|
@ -272,21 +268,31 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
private void drawDistBetweenFingerAndLocation(Canvas canvas, RotatedTileBox tb, float x, float y,
|
private void drawDistBetweenFingerAndLocation(Canvas canvas, RotatedTileBox tb, float x, float y,
|
||||||
Location currentLoc, boolean nightMode) {
|
Location currentLoc, boolean nightMode) {
|
||||||
int currX = tb.getPixXFromLonNoRot(currentLoc.getLongitude());
|
int currX = (int) tb.getPixXFromLatLon(currentLoc.getLatitude(), currentLoc.getLongitude());
|
||||||
int currY = tb.getPixYFromLatNoRot(currentLoc.getLatitude());
|
int currY = (int) tb.getPixYFromLatLon(currentLoc.getLatitude(), currentLoc.getLongitude());
|
||||||
distancePath.reset();
|
int width = tb.getPixWidth();
|
||||||
tx.clear();
|
int height = tb.getPixHeight();
|
||||||
ty.clear();
|
|
||||||
|
|
||||||
tx.add(currX);
|
if (currX < 0 || currY < 0 || currX > width || currY > height) {
|
||||||
ty.add(currY);
|
float xNew = (currX + x) / 2;
|
||||||
tx.add((int) x);
|
float yNew = (currY + y) / 2;
|
||||||
ty.add((int) y);
|
|
||||||
|
|
||||||
calculatePath(tb, tx, ty, distancePath);
|
while (true) {
|
||||||
canvas.drawPath(distancePath, lineAttrs.paint);
|
if (xNew < 0 || yNew < 0 || xNew > width || yNew > height) {
|
||||||
// canvas.drawLine(currX, currY, x, y, lineAttrs.paint);
|
currX = (int) xNew;
|
||||||
|
currY = (int) yNew;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
xNew = (xNew + x) / 2;
|
||||||
|
yNew = (yNew + y) / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.rotate(-tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||||
|
canvas.drawLine(currX, currY, x, y, lineAttrs.paint);
|
||||||
drawFingerTouchIcon(canvas, x, y, nightMode);
|
drawFingerTouchIcon(canvas, x, y, nightMode);
|
||||||
|
canvas.rotate(tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateData(RotatedTileBox tb, QuadPoint center) {
|
private void updateData(RotatedTileBox tb, QuadPoint center) {
|
||||||
|
@ -297,12 +303,13 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean move = tb.getZoom() != cacheIntZoom || Math.abs(tb.getCenterTileX() - cacheTileX) > 1 ||
|
boolean move = tb.getZoom() != cacheIntZoom || Math.abs(tb.getCenterTileX() - cacheTileX) > 1 ||
|
||||||
Math.abs(tb.getCenterTileY() - cacheTileY) > 1;
|
Math.abs(tb.getCenterTileY() - cacheTileY) > 1 || mapDensity.get() != cacheMapDensity;
|
||||||
|
|
||||||
if (!tb.isZoomAnimated() && move) {
|
if (!tb.isZoomAnimated() && move) {
|
||||||
cacheIntZoom = tb.getZoom();
|
cacheIntZoom = tb.getZoom();
|
||||||
cacheTileX = tb.getCenterTileX();
|
cacheTileX = tb.getCenterTileX();
|
||||||
cacheTileY = tb.getCenterTileY();
|
cacheTileY = tb.getCenterTileY();
|
||||||
|
cacheMapDensity = mapDensity.get();
|
||||||
cacheDistances.clear();
|
cacheDistances.clear();
|
||||||
updateDistance(tb);
|
updateDistance(tb);
|
||||||
}
|
}
|
||||||
|
|
|
@ -580,14 +580,18 @@ public class MapInfoWidgetsFactory {
|
||||||
titleView.setSingleLine(false);
|
titleView.setSingleLine(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controller.closeBtnVisible && closeButton.getVisibility() == View.GONE) {
|
if (controller.closeBtnVisible) {
|
||||||
closeButton.setVisibility(View.VISIBLE);
|
if (closeButton.getVisibility() == View.GONE) {
|
||||||
} else {
|
closeButton.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
} else if (closeButton.getVisibility() == View.VISIBLE) {
|
||||||
closeButton.setVisibility(View.GONE);
|
closeButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
if (controller.refreshBtnVisible && refreshButton.getVisibility() == View.GONE) {
|
if (controller.refreshBtnVisible) {
|
||||||
refreshButton.setVisibility(View.VISIBLE);
|
if (refreshButton.getVisibility() == View.GONE) {
|
||||||
} else {
|
refreshButton.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
} else if (refreshButton.getVisibility() == View.VISIBLE) {
|
||||||
refreshButton.setVisibility(View.GONE);
|
refreshButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -714,18 +718,20 @@ public class MapInfoWidgetsFactory {
|
||||||
settings.SHOW_STREET_NAME.get()) {
|
settings.SHOW_STREET_NAME.get()) {
|
||||||
RouteDataObject rt = locationProvider.getLastKnownRouteSegment();
|
RouteDataObject rt = locationProvider.getLastKnownRouteSegment();
|
||||||
if (rt != null) {
|
if (rt != null) {
|
||||||
|
Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
||||||
text = RoutingHelper.formatStreetName(
|
text = RoutingHelper.formatStreetName(
|
||||||
rt.getName(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get()),
|
rt.getName(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get()),
|
||||||
rt.getRef(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get(), rt.bearingVsRouteDirection(locationProvider.getLastKnownLocation())),
|
rt.getRef(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get(), rt.bearingVsRouteDirection(lastKnownLocation)),
|
||||||
rt.getDestinationName(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get(), rt.bearingVsRouteDirection(locationProvider.getLastKnownLocation())),
|
rt.getDestinationName(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get(), rt.bearingVsRouteDirection(lastKnownLocation)),
|
||||||
"»");
|
"»");
|
||||||
}
|
}
|
||||||
if (text == null) {
|
if (text == null) {
|
||||||
text = "";
|
text = "";
|
||||||
} else {
|
} else {
|
||||||
if(!Algorithms.isEmpty(text) && locationProvider.getLastKnownLocation() != null) {
|
Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
||||||
|
if(!Algorithms.isEmpty(text) && lastKnownLocation != null) {
|
||||||
double dist =
|
double dist =
|
||||||
CurrentPositionHelper.getOrthogonalDistance(rt, locationProvider.getLastKnownLocation());
|
CurrentPositionHelper.getOrthogonalDistance(rt, lastKnownLocation);
|
||||||
if(dist < 50) {
|
if(dist < 50) {
|
||||||
showMarker = true;
|
showMarker = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1048,6 +1048,8 @@ public class RouteInfoWidgetsFactory {
|
||||||
private MapActivity ma;
|
private MapActivity ma;
|
||||||
private String cacheRulerText;
|
private String cacheRulerText;
|
||||||
private int maxWidth;
|
private int maxWidth;
|
||||||
|
private float cacheMapDensity;
|
||||||
|
private OsmandSettings.OsmandPreference<Float> mapDensity;
|
||||||
private int cacheRulerZoom;
|
private int cacheRulerZoom;
|
||||||
private double cacheRulerTileX;
|
private double cacheRulerTileX;
|
||||||
private double cacheRulerTileY;
|
private double cacheRulerTileY;
|
||||||
|
@ -1061,6 +1063,8 @@ public class RouteInfoWidgetsFactory {
|
||||||
textShadow = (TextView) ma.findViewById(R.id.map_ruler_text_shadow);
|
textShadow = (TextView) ma.findViewById(R.id.map_ruler_text_shadow);
|
||||||
maxWidth = ma.getResources().getDimensionPixelSize(R.dimen.map_ruler_width);
|
maxWidth = ma.getResources().getDimensionPixelSize(R.dimen.map_ruler_width);
|
||||||
orientationPortrait = AndroidUiHelper.isOrientationPortrait(ma);
|
orientationPortrait = AndroidUiHelper.isOrientationPortrait(ma);
|
||||||
|
mapDensity = ma.getMyApplication().getSettings().MAP_DENSITY;
|
||||||
|
cacheMapDensity = mapDensity.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTextSize(boolean isNight, int textColor, int textShadowColor, int shadowRadius) {
|
public void updateTextSize(boolean isNight, int textColor, int textShadowColor, int shadowRadius) {
|
||||||
|
@ -1077,10 +1081,12 @@ public class RouteInfoWidgetsFactory {
|
||||||
} else if (!orientationPortrait && ma.getRoutingHelper().isRoutePlanningMode()) {
|
} else if (!orientationPortrait && ma.getRoutingHelper().isRoutePlanningMode()) {
|
||||||
visible = false;
|
visible = false;
|
||||||
} else if (!tb.isZoomAnimated() && (tb.getZoom() != cacheRulerZoom || Math.abs(tb.getCenterTileX() - cacheRulerTileX) > 1 || Math
|
} else if (!tb.isZoomAnimated() && (tb.getZoom() != cacheRulerZoom || Math.abs(tb.getCenterTileX() - cacheRulerTileX) > 1 || Math
|
||||||
.abs(tb.getCenterTileY() - cacheRulerTileY) > 1) && tb.getPixWidth() > 0 && maxWidth > 0) {
|
.abs(tb.getCenterTileY() - cacheRulerTileY) > 1 || mapDensity.get() != cacheMapDensity) &&
|
||||||
|
tb.getPixWidth() > 0 && maxWidth > 0) {
|
||||||
cacheRulerZoom = tb.getZoom();
|
cacheRulerZoom = tb.getZoom();
|
||||||
cacheRulerTileX = tb.getCenterTileX();
|
cacheRulerTileX = tb.getCenterTileX();
|
||||||
cacheRulerTileY = tb.getCenterTileY();
|
cacheRulerTileY = tb.getCenterTileY();
|
||||||
|
cacheMapDensity = mapDensity.get();
|
||||||
final double dist = tb.getDistance(0, tb.getPixHeight() / 2, tb.getPixWidth(), tb.getPixHeight() / 2);
|
final double dist = tb.getDistance(0, tb.getPixHeight() / 2, tb.getPixWidth(), tb.getPixHeight() / 2);
|
||||||
double pixDensity = tb.getPixWidth() / dist;
|
double pixDensity = tb.getPixWidth() / dist;
|
||||||
double roundedDist = OsmAndFormatter.calculateRoundedDist(maxWidth /
|
double roundedDist = OsmAndFormatter.calculateRoundedDist(maxWidth /
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class InstallOsmandAppDialog extends AppCompatDialogFragment {
|
||||||
view.findViewById(R.id.install_osmand_btn).setOnClickListener(new View.OnClickListener() {
|
view.findViewById(R.id.install_osmand_btn).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
boolean success = execOsmAndInstall("market://search?q=pname:");
|
boolean success = execOsmAndInstall("market://details?id=");
|
||||||
if (!success) {
|
if (!success) {
|
||||||
success = execOsmAndInstall("https://play.google.com/store/apps/details?id=");
|
success = execOsmAndInstall("https://play.google.com/store/apps/details?id=");
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class NauticalActivity extends Activity {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
String appName = OSMAND_COMPONENT;
|
String appName = OSMAND_COMPONENT;
|
||||||
logEvent(NauticalActivity.this, "open_play_store_" + appName);
|
logEvent(NauticalActivity.this, "open_play_store_" + appName);
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:" + appName));
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appName));
|
||||||
try {
|
try {
|
||||||
//stopService(intent);
|
//stopService(intent);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class ParkingPluginActivity extends Activity {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
String appName = OSMAND_COMPONENT;
|
String appName = OSMAND_COMPONENT;
|
||||||
logEvent(ParkingPluginActivity.this, "open_play_store_" + appName);
|
logEvent(ParkingPluginActivity.this, "open_play_store_" + appName);
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:" + appName));
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appName));
|
||||||
try {
|
try {
|
||||||
//stopService(intent);
|
//stopService(intent);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class SRTMPluginActivity extends Activity {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
String appName = OSMAND_COMPONENT;
|
String appName = OSMAND_COMPONENT;
|
||||||
logEvent(SRTMPluginActivity.this, "open_play_store_" + appName);
|
logEvent(SRTMPluginActivity.this, "open_play_store_" + appName);
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:" + appName));
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appName));
|
||||||
try {
|
try {
|
||||||
//stopService(intent);
|
//stopService(intent);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class SkiMapsActivity extends Activity {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
String appName = OSMAND_COMPONENT;
|
String appName = OSMAND_COMPONENT;
|
||||||
logEvent(SkiMapsActivity.this, "open_play_store_" + appName);
|
logEvent(SkiMapsActivity.this, "open_play_store_" + appName);
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:" + appName));
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appName));
|
||||||
try {
|
try {
|
||||||
//stopService(intent);
|
//stopService(intent);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
Loading…
Reference in a new issue