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)) {
|
||||
String replacement = rules.get(country).get(1);
|
||||
Matcher matcher = getMatcher(postcode, country);
|
||||
result = matcher.replaceAll(replacement);
|
||||
if (!result.equals(postcode)) {
|
||||
log.info("Normalize " + country + "'s postcode: " + postcode + " -> " + result);
|
||||
}
|
||||
if (!matcher.matches()) {
|
||||
log.info("Not matches " + country + "'s postcode regex: " + postcode);
|
||||
if (matcher != null) {
|
||||
String res = matcher.replaceAll(replacement);
|
||||
if (res != null) {
|
||||
result = res.replaceAll("null", "");
|
||||
if (!result.equals(postcode)) {
|
||||
log.info("Normalize " + country + "'s postcode: " + postcode + " -> " + result);
|
||||
}
|
||||
if (!matcher.matches()) {
|
||||
log.info("Not matches " + country + "'s postcode regex: " + postcode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
<FrameLayout
|
||||
android:id="@+id/staticImageViewLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"/>
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
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"
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/rightArrowButton"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_arrow_forward"/>
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
</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>
|
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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/spinnerListBackground"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/custom_toolbar"
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||
android:background="?attr/actionModeBackground"/>
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<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:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/custom_toolbar"
|
||||
android:clipToPadding="false"
|
||||
android:paddingTop="16dp"/>
|
||||
android:layout_below="@id/top_divider"
|
||||
android:clipToPadding="false"/>
|
||||
|
||||
<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:id="@+id/fabButton"
|
||||
|
|
|
@ -469,7 +469,7 @@
|
|||
<string name="av_photo_play_sound_descr">فعّل هذا في حال رغبتك بسماع نغمة التقاط الصّور</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_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="mappilary_no_internet_desc">You need internet to view photos from Mapillary</string>
|
||||
<string name="retry">Retry</string>
|
||||
</resources>
|
||||
|
|
|
@ -3,7 +3,6 @@ package net.osmand;
|
|||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
@ -14,163 +13,150 @@ import android.widget.ImageView;
|
|||
import android.widget.RelativeLayout;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.inapp.InAppHelper;
|
||||
|
||||
public class SecondSplashScreenFragment extends Fragment {
|
||||
public static final String TAG = "SecondSplashScreenFragment";
|
||||
public static boolean SHOW = true;
|
||||
private static final int SECOND_SPLASH_TIME_OUT = 8000;
|
||||
private boolean started = false;
|
||||
private FragmentActivity activity;
|
||||
private OsmandApplication app;
|
||||
public static final String TAG = "SecondSplashScreenFragment";
|
||||
public static boolean SHOW = true;
|
||||
public static boolean VISIBLE = false;
|
||||
|
||||
public OsmandApplication getMyApplication() {
|
||||
return ((OsmandApplication) activity.getApplication());
|
||||
}
|
||||
public OsmandApplication getMyApplication() {
|
||||
return ((OsmandApplication) getActivity().getApplication());
|
||||
}
|
||||
|
||||
private boolean hasNavBar() {
|
||||
int id = getResources().getIdentifier("config_showNavigationBar", "bool", "android");
|
||||
if (id > 0)
|
||||
return getResources().getBoolean(id);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public MapActivity getMapActivity() {
|
||||
return (MapActivity) getActivity();
|
||||
}
|
||||
|
||||
private int getStatusBarHeight() {
|
||||
int statusBarHeight = 0;
|
||||
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (resourceId > 0) {
|
||||
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
|
||||
}
|
||||
return statusBarHeight;
|
||||
}
|
||||
private boolean hasNavBar() {
|
||||
int id = getResources().getIdentifier("config_showNavigationBar", "bool", "android");
|
||||
if (id > 0) {
|
||||
return getResources().getBoolean(id);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private int getNavigationBarHeight() {
|
||||
if (!hasNavBar())
|
||||
return 0;
|
||||
int orientation = getResources().getConfiguration().orientation;
|
||||
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
|
||||
if (isSmartphone && Configuration.ORIENTATION_LANDSCAPE == orientation)
|
||||
return 0;
|
||||
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 getStatusBarHeight() {
|
||||
int statusBarHeight = 0;
|
||||
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (resourceId > 0) {
|
||||
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
|
||||
}
|
||||
return statusBarHeight;
|
||||
}
|
||||
|
||||
private int getNavigationBarWidth() {
|
||||
if (!hasNavBar())
|
||||
return 0;
|
||||
int orientation = getResources().getConfiguration().orientation;
|
||||
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;
|
||||
}
|
||||
private int getNavigationBarHeight() {
|
||||
if (!hasNavBar())
|
||||
return 0;
|
||||
int orientation = getResources().getConfiguration().orientation;
|
||||
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
|
||||
if (isSmartphone && Configuration.ORIENTATION_LANDSCAPE == orientation)
|
||||
return 0;
|
||||
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;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
activity = getActivity();
|
||||
app = getMyApplication();
|
||||
private int getNavigationBarWidth() {
|
||||
if (!hasNavBar())
|
||||
return 0;
|
||||
int orientation = getResources().getConfiguration().orientation;
|
||||
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);
|
||||
view.setOnClickListener(null);
|
||||
view.setBackgroundColor(getResources().getColor(R.color.map_background_color_light));
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
OsmandSettings settings = app.getSettings();
|
||||
FragmentActivity activity = getActivity();
|
||||
|
||||
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 ((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);
|
||||
RelativeLayout view = new RelativeLayout(activity);
|
||||
view.setOnClickListener(null);
|
||||
view.setBackgroundColor(getResources().getColor(R.color.map_background_color_light));
|
||||
|
||||
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
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (activity instanceof MapActivity) {
|
||||
((MapActivity) activity).disableDrawer();
|
||||
}
|
||||
if (!started) {
|
||||
started = true;
|
||||
SecondSplashScreenFragment.SHOW = false;
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (activity instanceof MapActivity && !((MapActivity) activity).isActivityDestroyed()) {
|
||||
((MapActivity)activity).dismissSecondSplashScreen();
|
||||
}
|
||||
}
|
||||
}, SECOND_SPLASH_TIME_OUT);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getMapActivity().disableDrawer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
if (activity instanceof MapActivity) {
|
||||
((MapActivity) activity).enableDrawer();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
getMapActivity().enableDrawer();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||
public class GPXDatabase {
|
||||
|
||||
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_COL_NAME = "fileName";
|
||||
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_INTERVAL + " double");
|
||||
}
|
||||
|
||||
if (oldVersion < 3) {
|
||||
List<GpxDataItem> items = getItems();
|
||||
for (GpxDataItem item : items) {
|
||||
updateLastModifiedTime(item);
|
||||
|
||||
if (oldVersion < 5) {
|
||||
boolean colorColumnExists = false;
|
||||
boolean fileLastModifiedTimeColumnExists = false;
|
||||
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() {
|
||||
update();
|
||||
this.processedPointsToDisplay = gpxFile.proccessPoints();
|
||||
List<TrkSegment> processedRoutePointsToDisplay = gpxFile.processRoutePoints();
|
||||
if (!processedRoutePointsToDisplay.isEmpty()) {
|
||||
this.processedPointsToDisplay.addAll(processedRoutePointsToDisplay);
|
||||
routePoints = !processedRoutePointsToDisplay.isEmpty();
|
||||
if (this.processedPointsToDisplay.isEmpty()) {
|
||||
this.processedPointsToDisplay = gpxFile.processRoutePoints();
|
||||
routePoints = !this.processedPointsToDisplay.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -499,8 +499,8 @@ public class OsmAndLocationProvider implements SensorEventListener {
|
|||
}
|
||||
|
||||
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(),
|
||||
System.currentTimeMillis());
|
||||
previousCorrectionValue = gf.getDeclination();
|
||||
|
|
|
@ -157,6 +157,7 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
externalStorageDirectoryReadOnly = true;
|
||||
externalStorageDirectory = osmandSettings.getInternalAppPath();
|
||||
}
|
||||
osmandSettings.USE_MAP_MARKERS.set(true);
|
||||
|
||||
checkPreferredLocale();
|
||||
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.show();
|
||||
|
|
|
@ -178,7 +178,7 @@ public abstract class OsmandPlugin {
|
|||
allPlugins.add(srtm);
|
||||
} else {
|
||||
if (marketEnabled) {
|
||||
srtm.setInstallURL(Version.marketPrefix(app) + id);
|
||||
srtm.setInstallURL(Version.getUrlWithUtmRef(app, id));
|
||||
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_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_TOKEN = new StringPreference("billing_user_token", "").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_DEV_VERSION_NAME = "net.osmand.dev";
|
||||
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) {
|
||||
return isGooglePlayEnabled(ctx) && !isBlackberry(ctx);
|
||||
|
@ -31,10 +31,14 @@ public class Version {
|
|||
if (isAmazonEnabled(ctx)) {
|
||||
return "amzn://apps/android?p=";
|
||||
} else if (isGooglePlayEnabled(ctx)) {
|
||||
return "market://search?q=pname:";
|
||||
return "market://details?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) {
|
||||
return ctx.getString(R.string.versionFeatures).contains("+amazon");
|
||||
|
|
|
@ -295,7 +295,9 @@ public class ContributionVersionActivity extends OsmandListActivity {
|
|||
this.activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
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.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.media.AudioManager;
|
||||
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.DialogFragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.DisplayMetrics;
|
||||
|
@ -90,6 +90,7 @@ import net.osmand.plus.helpers.WakeLockHelper;
|
|||
import net.osmand.plus.inapp.InAppHelper;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
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.MapRouteInfoMenu;
|
||||
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.OsmandMapLayer;
|
||||
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.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
||||
|
@ -132,7 +134,7 @@ import java.util.regex.Pattern;
|
|||
|
||||
public class MapActivity extends OsmandActionBarActivity implements DownloadEvents,
|
||||
OnRequestPermissionsResultCallback, IRouteInformationListener,
|
||||
MapMarkerChangedListener, OnDismissDialogFragmentListener {
|
||||
MapMarkerChangedListener, OnDismissDialogFragmentListener, OnDrawMapListener {
|
||||
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;
|
||||
|
@ -140,6 +142,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
private static final int LONG_KEYPRESS_DELAY = 500;
|
||||
private static final int ZOOM_LABEL_DISPLAY = 16;
|
||||
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);
|
||||
|
||||
|
@ -188,8 +191,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
|
||||
private boolean mIsDestroyed = false;
|
||||
private InAppHelper inAppHelper;
|
||||
|
||||
private SecondSplashScreenFragment secondSplashScreenFragment;
|
||||
private Timer splashScreenTimer;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -496,6 +498,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (mapContextMenu.isVisible() && mapContextMenu.isClosable()) {
|
||||
mapContextMenu.close();
|
||||
return;
|
||||
}
|
||||
if (prevActivityIntent != null && getSupportFragmentManager().getBackStackEntryCount() == 0) {
|
||||
prevActivityIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
LatLon loc = getMapLocation();
|
||||
|
@ -693,25 +699,67 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
new XMasDialogFragment().show(getSupportFragmentManager(), XMasDialogFragment.TAG);
|
||||
}
|
||||
FirstUsageWelcomeFragment.SHOW = false;
|
||||
|
||||
if (SecondSplashScreenFragment.SHOW) {
|
||||
secondSplashScreenFragment = new SecondSplashScreenFragment();
|
||||
getSupportFragmentManager().beginTransaction().add(R.id.fragmentContainer, secondSplashScreenFragment, SecondSplashScreenFragment.TAG).commitAllowingStateLoss();
|
||||
SecondSplashScreenFragment.SHOW = false;
|
||||
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 {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
||||
if (SecondSplashScreenFragment.VISIBLE) {
|
||||
dismissSecondSplashScreen();
|
||||
}
|
||||
//setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
||||
if (settings.MAP_SCREEN_ORIENTATION.get() != getRequestedOrientation()) {
|
||||
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() {
|
||||
SecondSplashScreenFragment.SHOW = false;
|
||||
getSupportFragmentManager().beginTransaction().remove(secondSplashScreenFragment).commitAllowingStateLoss();
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
||||
if (app.getSettings().MAP_SCREEN_ORIENTATION.get() != getRequestedOrientation()) {
|
||||
setRequestedOrientation(app.getSettings().MAP_SCREEN_ORIENTATION.get());
|
||||
// can't return from this method we are not sure if activity will be recreated or not
|
||||
private void dismissSecondSplashScreen() {
|
||||
if (SecondSplashScreenFragment.VISIBLE) {
|
||||
SecondSplashScreenFragment.VISIBLE = false;
|
||||
SecondSplashScreenFragment.SHOW = false;
|
||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag(SecondSplashScreenFragment.TAG);
|
||||
if (fragment != null) {
|
||||
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
|
||||
protected void onPause() {
|
||||
mapView.setOnDrawMapListener(null);
|
||||
cancelSplashScreenTimer();
|
||||
app.getMapMarkersHelper().removeListener(this);
|
||||
app.getRoutingHelper().removeListener(this);
|
||||
app.getDownloadThread().resetUiActivity(this);
|
||||
|
|
|
@ -921,6 +921,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
menuItemsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
mapActivity.dismissCardDialog();
|
||||
ContextMenuItem item = contextMenuAdapter.getItem(position);
|
||||
ContextMenuAdapter.ItemClickListener click = item.getItemClickListener();
|
||||
if (click != null && click.onContextMenuClick(simpleListAdapter, item.getTitleId(),
|
||||
|
|
|
@ -76,7 +76,54 @@ public class TrackActivity extends TabActivity {
|
|||
actionBar.setElevation(0);
|
||||
}
|
||||
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);
|
||||
if (slidingTabLayout != null) {
|
||||
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() {
|
||||
return (OsmandApplication) getApplication();
|
||||
}
|
||||
|
|
|
@ -198,8 +198,7 @@ public class ShareDialog {
|
|||
builder.setPositiveButton(activity.getString(R.string.shared_string_yes), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.marketPrefix((OsmandApplication) activity.getApplication())
|
||||
+ ZXING_BARCODE_SCANNER_COMPONENT));
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.getUrlWithUtmRef((OsmandApplication) activity.getApplication(), ZXING_BARCODE_SCANNER_COMPONENT)));
|
||||
try {
|
||||
activity.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
|
|
@ -26,7 +26,6 @@ import net.osmand.AndroidUtils;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
|
||||
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() {
|
||||
@Override
|
||||
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 {
|
||||
mapActivity.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
|
|
@ -862,14 +862,16 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
}
|
||||
|
||||
private void initRecMenu(AVActionType actionType, double lat, double lon) {
|
||||
currentRecording = new CurrentRecording(actionType);
|
||||
if (actionType == AVActionType.REC_PHOTO) {
|
||||
recordingMenu = new AudioVideoNoteRecordingMenuFullScreen(this, lat, lon);
|
||||
} else {
|
||||
recordingMenu = new AudioVideoNoteRecordingMenu(this, lat, lon);
|
||||
if (mapActivity != null) {
|
||||
currentRecording = new CurrentRecording(actionType);
|
||||
if (actionType == AVActionType.REC_PHOTO) {
|
||||
recordingMenu = new AudioVideoNoteRecordingMenuFullScreen(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) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.base;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v4.util.Pair;
|
||||
import android.view.WindowManager;
|
||||
|
||||
|
@ -150,28 +151,45 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
|||
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
|
||||
public void updateLocation(Location location) {
|
||||
myLocation = location;
|
||||
showViewAngle = false;
|
||||
if (location != null) {
|
||||
locationProvider = location.getProvider();
|
||||
if (settings.DRIVING_REGION_AUTOMATIC.get() && !drivingRegionUpdated) {
|
||||
try {
|
||||
BinaryMapDataObject o = app.getRegions().findBinaryMapDataObject(
|
||||
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 (settings.DRIVING_REGION_AUTOMATIC.get() && !drivingRegionUpdated && !app.isApplicationInitializing()) {
|
||||
drivingRegionUpdated = true;
|
||||
detectDrivingRegion(new LatLon(location.getLatitude(), location.getLongitude()));
|
||||
}
|
||||
}
|
||||
if (mapView != null) {
|
||||
|
@ -339,8 +357,8 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
|||
OsmAndLocationProvider locationProvider = app.getLocationProvider();
|
||||
if (!isMapLinkedToLocation()) {
|
||||
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();
|
||||
int fZoom = mapView.getZoom() < zoom ? zoom : mapView.getZoom();
|
||||
movingToMyLocation = true;
|
||||
|
|
|
@ -86,7 +86,7 @@ public class DashRateUsFragment extends DashBaseFragment {
|
|||
return;
|
||||
case USER_LIKES_APP:
|
||||
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);
|
||||
startActivity(goToMarket);
|
||||
break;
|
||||
|
|
|
@ -793,8 +793,10 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
if (swipeDismissListener != null) {
|
||||
swipeDismissListener.discardUndo();
|
||||
}
|
||||
removeMapillaryFiltersFragment();
|
||||
|
||||
if (visible) {
|
||||
mapActivity.dismissCardDialog();
|
||||
mapActivity.getContextMenu().hideMenues();
|
||||
mapViewLocation = mapActivity.getMapLocation();
|
||||
mapRotation = mapActivity.getMapRotate();
|
||||
|
@ -818,7 +820,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
View listViewLayout = dashboardView.findViewById(R.id.dash_list_view_layout);
|
||||
ScrollView scrollView = (ScrollView) dashboardView.findViewById(R.id.main_scroll);
|
||||
if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.MAPILLARY) {
|
||||
removeMapillaryFiltersFragment();
|
||||
if (visibleType == DashboardType.DASHBOARD) {
|
||||
addOrUpdateDashboardFragments();
|
||||
} else {
|
||||
|
|
|
@ -115,7 +115,7 @@ public class RateUsBottomSheetDialog extends BottomSheetDialogFragment {
|
|||
return;
|
||||
case USER_LIKES_APP:
|
||||
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);
|
||||
startActivity(goToMarket);
|
||||
break;
|
||||
|
|
|
@ -248,7 +248,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
|
|||
} else {
|
||||
app.logEvent(this, "paid_version_redirect");
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW,
|
||||
Uri.parse(Version.marketPrefix(app) + "net.osmand.plus"));
|
||||
Uri.parse(Version.getUrlWithUtmRef(app, "net.osmand.plus")));
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
|
|
@ -381,7 +381,7 @@ public class DownloadIndexesThread {
|
|||
builder.setPositiveButton(R.string.button_upgrade_osmandplus, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
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 {
|
||||
ctx.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
|
|
@ -224,8 +224,7 @@ public class DownloadValidationManager {
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW,
|
||||
Uri.parse(Version.marketPrefix(getMyApplication())
|
||||
+ "net.osmand.plus"));
|
||||
Uri.parse(Version.getUrlWithUtmRef(getMyApplication(), "net.osmand.plus")));
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
|
|
@ -17,6 +17,7 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.plus.OnDismissDialogFragmentListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -24,6 +25,7 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.base.BottomSheetDialogFragment;
|
||||
import net.osmand.plus.dashboard.DashChooseAppDirFragment;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadIndexesThread;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
@ -196,11 +198,22 @@ public class DataStoragePlaceDialogFragment extends BottomSheetDialogFragment {
|
|||
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 =
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
saveFilesLocation(deviceStorageType, deviceStorage, getActivity());
|
||||
checkAssets();
|
||||
updateDownloadIndexes();
|
||||
isInterestedInFirstTime = false;
|
||||
dismiss();
|
||||
}
|
||||
|
@ -211,6 +224,8 @@ public class DataStoragePlaceDialogFragment extends BottomSheetDialogFragment {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
saveFilesLocation(sharedStorageType, sharedStorage, getActivity());
|
||||
checkAssets();
|
||||
updateDownloadIndexes();
|
||||
isInterestedInFirstTime = false;
|
||||
dismiss();
|
||||
}
|
||||
|
@ -221,6 +236,8 @@ public class DataStoragePlaceDialogFragment extends BottomSheetDialogFragment {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean res = saveFilesLocation(cardStorageType, cardStorage, getActivity());
|
||||
checkAssets();
|
||||
updateDownloadIndexes();
|
||||
isInterestedInFirstTime = false;
|
||||
if (res) {
|
||||
dismiss();
|
||||
|
|
|
@ -43,16 +43,17 @@ public class DiscountHelper {
|
|||
|
||||
|
||||
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;
|
||||
}
|
||||
if (mBannerVisible) {
|
||||
showDiscountBanner(mapActivity, mTitle, mDescription, mIcon, mUrl);
|
||||
}
|
||||
OsmandApplication app = mapActivity.getMyApplication();
|
||||
if (System.currentTimeMillis() - mLastCheckTime < 1000 * 60 * 60 * 24
|
||||
|| !app.getSettings().isInternetConnectionAvailable()
|
||||
|| app.getSettings().NO_DISCOUNT_INFO.get()) {
|
||||
|| !settings.isInternetConnectionAvailable()
|
||||
|| settings.NO_DISCOUNT_INFO.get()) {
|
||||
return;
|
||||
}
|
||||
mLastCheckTime = System.currentTimeMillis();
|
||||
|
@ -146,7 +147,7 @@ public class DiscountHelper {
|
|||
int i = url.indexOf("osmand-market-app:");
|
||||
if (i != -1) {
|
||||
String appName = url.substring(i + 18);
|
||||
return Version.marketPrefix(app) + appName;
|
||||
return Version.getUrlWithUtmRef(app, appName);
|
||||
}
|
||||
}
|
||||
return url;
|
||||
|
|
|
@ -73,9 +73,17 @@ public class GpxImportHelper {
|
|||
public boolean handleGpxImport(final Uri contentUri, final boolean useImportDir) {
|
||||
final String name = getNameFromContentUri(contentUri);
|
||||
final boolean isOsmandSubdir = isSubDirectory(app.getAppPath(IndexConstants.GPX_INDEX_DIR), new File(contentUri.getPath()));
|
||||
if (!isOsmandSubdir && name != null && name.endsWith(GPX_SUFFIX)) {
|
||||
handleGpxImport(contentUri, name, true, useImportDir);
|
||||
return true;
|
||||
if (!isOsmandSubdir && name != null) {
|
||||
if (name.endsWith(GPX_SUFFIX)) {
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -80,9 +80,7 @@ import net.osmand.plus.activities.SettingsActivity;
|
|||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||
import net.osmand.plus.dialogs.ConfigureMapMenu.AppearanceListItem;
|
||||
import net.osmand.plus.dialogs.ConfigureMapMenu.GpxAppearanceAdapter;
|
||||
import net.osmand.plus.download.ui.LocalIndexesFragment;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
||||
import net.osmand.render.RenderingRuleProperty;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
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.dialogs.ConfigureMapMenu.CURRENT_TRACK_COLOR_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.formatMb;
|
||||
|
||||
public class GpxUiHelper {
|
||||
|
||||
|
@ -1416,7 +1414,7 @@ public class GpxUiHelper {
|
|||
}
|
||||
}
|
||||
|
||||
if (values == null) {
|
||||
if (values == null || values.size() == 0) {
|
||||
if (useRightAxis) {
|
||||
yAxis.setEnabled(false);
|
||||
}
|
||||
|
|
|
@ -363,9 +363,11 @@ public class InAppHelper {
|
|||
mFullVersionPrice = fullPriceDetails.getPrice();
|
||||
}
|
||||
|
||||
OsmandSettings settings = ctx.getSettings();
|
||||
settings.INAPPS_READ.set(true);
|
||||
|
||||
boolean needSendToken = false;
|
||||
if (!isDeveloperVersion && liveUpdatesPurchase != null) {
|
||||
OsmandSettings settings = ctx.getSettings();
|
||||
if ((Algorithms.isEmpty(settings.BILLING_USER_ID.get()) || Algorithms.isEmpty(settings.BILLING_USER_TOKEN.get()))
|
||||
&& !Algorithms.isEmpty(liveUpdatesPurchase.getDeveloperPayload())) {
|
||||
String payload = liveUpdatesPurchase.getDeveloperPayload();
|
||||
|
|
|
@ -240,8 +240,10 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
|||
}
|
||||
|
||||
public void notifyLiveUpdatesChanged() {
|
||||
if (adapter != null && getMyApplication() != null && getActivity() != null) {
|
||||
adapter.notifyLiveUpdatesChanged();
|
||||
if (getActivity() != null) {
|
||||
if (adapter != null && getMyApplication() != null) {
|
||||
adapter.notifyLiveUpdatesChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -305,6 +305,9 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
appModeChanged = false;
|
||||
|
||||
if (needAcquireMenuController) {
|
||||
if (menuController != null) {
|
||||
menuController.setMapContextMenu(null);
|
||||
}
|
||||
if (!acquireMenuController(restorePrevious)) {
|
||||
active = false;
|
||||
clearSelectedObject(object);
|
||||
|
@ -376,8 +379,9 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
|
||||
init(latLon, pointDescription, object, true, false);
|
||||
if (fragmentRef != null) {
|
||||
fragmentRef.get().rebuildMenu();
|
||||
fragmentRef.get().rebuildMenu(centerMarker);
|
||||
}
|
||||
centerMarker = false;
|
||||
}
|
||||
|
||||
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);
|
||||
if (menuController.setActive(true)) {
|
||||
menuController.setMapContextMenu(this);
|
||||
if (menuData != null && (object != menuData.getObject())
|
||||
&& (menuController.hasBackAction() || menuData.hasBackAction())) {
|
||||
historyStack.add(menuData);
|
||||
|
@ -598,17 +603,24 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
|
||||
public void onSingleTapOnMap() {
|
||||
if (menuController == null || !menuController.handleSingleTapOnMap()) {
|
||||
hide();
|
||||
if (mapActivity.getMapLayers().getMapQuickActionLayer().isLayerOn())
|
||||
if (menuController != null && !menuController.isClosable()) {
|
||||
hide();
|
||||
} else {
|
||||
updateMapCenter(null);
|
||||
close();
|
||||
}
|
||||
if (mapActivity.getMapLayers().getMapQuickActionLayer().isLayerOn()) {
|
||||
mapActivity.getMapLayers().getMapQuickActionLayer().refreshLayer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSearchAddressDone() {
|
||||
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
|
||||
if (fragmentRef != null)
|
||||
if (fragmentRef != null) {
|
||||
fragmentRef.get().refreshTitle();
|
||||
}
|
||||
|
||||
if (searchDoneAction != null) {
|
||||
if (searchDoneAction.dlg != null) {
|
||||
|
@ -980,6 +992,10 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
return menuController == null || menuController.fabVisible();
|
||||
}
|
||||
|
||||
public boolean isClosable() {
|
||||
return menuController == null || menuController.isClosable();
|
||||
}
|
||||
|
||||
public boolean buttonsVisible() {
|
||||
return menuController == null || menuController.buttonsVisible();
|
||||
}
|
||||
|
|
|
@ -67,12 +67,6 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
ImageView fabView;
|
||||
|
||||
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 menuTopShadowHeight;
|
||||
|
@ -107,6 +101,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
private float skipHalfScreenStateLimit;
|
||||
|
||||
private int screenOrientation;
|
||||
private boolean created;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
@Override
|
||||
|
@ -130,14 +125,6 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
nightMode = menu.isNightMode();
|
||||
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();
|
||||
RotatedTileBox box = map.getCurrentRotatedTileBox().copy();
|
||||
customMapCenter = menu.getMapCenter() != null;
|
||||
|
@ -162,71 +149,77 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
|
||||
// Left title button
|
||||
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
|
||||
if (leftTitleButtonController != null) {
|
||||
leftTitleButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
leftTitleButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TitleButtonController leftTitleButtonController = menu.getLeftTitleButtonController();
|
||||
if (leftTitleButtonController != null) {
|
||||
leftTitleButtonController.buttonPressed();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Right title button
|
||||
final Button rightTitleButton = (Button) view.findViewById(R.id.title_button_right);
|
||||
if (rightTitleButtonController != null) {
|
||||
rightTitleButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
rightTitleButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TitleButtonController rightTitleButtonController = menu.getRightTitleButtonController();
|
||||
if (rightTitleButtonController != null) {
|
||||
rightTitleButtonController.buttonPressed();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Left download button
|
||||
final Button leftDownloadButton = (Button) view.findViewById(R.id.download_button_left);
|
||||
if (leftDownloadButtonController != null) {
|
||||
leftDownloadButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
leftDownloadButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TitleButtonController leftDownloadButtonController = menu.getLeftDownloadButtonController();
|
||||
if (leftDownloadButtonController != null) {
|
||||
leftDownloadButtonController.buttonPressed();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Right download button
|
||||
final Button rightDownloadButton = (Button) view.findViewById(R.id.download_button_right);
|
||||
if (rightDownloadButtonController != null) {
|
||||
rightDownloadButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
rightDownloadButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TitleButtonController rightDownloadButtonController = menu.getRightDownloadButtonController();
|
||||
if (rightDownloadButtonController != null) {
|
||||
rightDownloadButtonController.buttonPressed();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Top Right title button
|
||||
final Button topRightTitleButton = (Button) view.findViewById(R.id.title_button_top_right);
|
||||
if (topRightTitleButtonController != null) {
|
||||
topRightTitleButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
topRightTitleButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TitleButtonController topRightTitleButtonController = menu.getTopRightTitleButtonController();
|
||||
if (topRightTitleButtonController != null) {
|
||||
topRightTitleButtonController.buttonPressed();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Progress bar
|
||||
if (titleProgressController != null) {
|
||||
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
|
||||
progressButton.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_remove_dark,
|
||||
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||
progressButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
|
||||
progressButton.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_remove_dark,
|
||||
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||
progressButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TitleProgressController titleProgressController = menu.getTitleProgressController();
|
||||
if (titleProgressController != null) {
|
||||
titleProgressController.buttonPressed();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
menu.updateData();
|
||||
updateButtonsAndProgress();
|
||||
|
@ -471,6 +464,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
|
||||
//getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(false);
|
||||
|
||||
created = true;
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -583,6 +577,13 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
|
||||
private void updateButtonsAndProgress() {
|
||||
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
|
||||
boolean showTitleButtonsContainer = (leftTitleButtonController != null || rightTitleButtonController != null);
|
||||
final View titleButtonsContainer = view.findViewById(R.id.title_button_container);
|
||||
|
@ -791,7 +792,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
menu.setMapZoom(0);
|
||||
}
|
||||
|
||||
public void rebuildMenu() {
|
||||
public void rebuildMenu(boolean centered) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app != null && view != null) {
|
||||
IconsCache iconsCache = app.getIconsCache();
|
||||
|
@ -806,6 +807,10 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
bottomLayout.removeAllViews();
|
||||
buildBottomView();
|
||||
|
||||
if (centered) {
|
||||
this.initLayout = true;
|
||||
this.centered = true;
|
||||
}
|
||||
runLayoutListener();
|
||||
}
|
||||
}
|
||||
|
@ -848,15 +853,42 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
line2LineHeight = line2.getLineHeight();
|
||||
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) {
|
||||
int titleHeight = line1.getLineCount() * line1.getLineHeight() + line2LineCount * line2LineHeight + menuTitleTopBottomPadding;
|
||||
if (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));
|
||||
} else {
|
||||
menuTopViewHeightExcludingTitle = newMenuTopViewHeight - line1.getMeasuredHeight() - line2MeasuredHeight;
|
||||
menuTopViewHeightExcludingTitle = newMenuTopViewHeight - line1.getMeasuredHeight() - line2MeasuredHeight - titleButtonHeight - downloadButtonsHeight - titleProgressHeight;
|
||||
menuTitleTopBottomPadding = (line1.getMeasuredHeight() - line1.getLineCount() * line1.getLineHeight())
|
||||
+ (line2MeasuredHeight - line2LineCount * line2LineHeight);
|
||||
}
|
||||
|
@ -980,8 +1012,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
if (app != null && view != null) {
|
||||
View compassView = view.findViewById(R.id.compass_layout);
|
||||
Location ll = app.getLocationProvider().getLastKnownLocation();
|
||||
boolean gpsFixed = ll != null && System.currentTimeMillis() - ll.getTime() < 1000 * 60 * 60 * 20;
|
||||
if (gpsFixed && menu.displayDistanceDirection() && menu.getCurrentMenuState() != MenuState.FULL_SCREEN) {
|
||||
if (ll != null && menu.displayDistanceDirection() && menu.getCurrentMenuState() != MenuState.FULL_SCREEN) {
|
||||
updateDistanceDirection();
|
||||
compassView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
@ -1101,8 +1132,13 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
RotatedTileBox box = map.getCurrentRotatedTileBox().copy();
|
||||
box.setCenterLocation(0.5f, map.getMapPosition() == OsmandSettings.BOTTOM_CONSTANT ? 0.15f : 0.5f);
|
||||
box.setZoom(zoom);
|
||||
int markerMapCenterX = (int) box.getPixXFromLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
|
||||
int markerMapCenterY = (int) box.getPixYFromLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
|
||||
boolean hasMapCenter = mapCenter != null;
|
||||
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;
|
||||
|
||||
box.setCenterLocation(0.5f, 0.5f);
|
||||
|
@ -1119,7 +1155,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
float origMarkerY = this.origMarkerY + cpyDelta;
|
||||
|
||||
LatLon latlon;
|
||||
if (center) {
|
||||
if (center || !hasMapCenter) {
|
||||
latlon = reqMarkerLocation;
|
||||
} else {
|
||||
latlon = box.getLatLonFromPixel(markerMapCenterX, markerMapCenterY);
|
||||
|
@ -1252,7 +1288,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
public void downloadHasFinished() {
|
||||
updateOnDownload();
|
||||
if (menu != null && menu.isVisible() && menu.isMapDownloaded()) {
|
||||
rebuildMenu();
|
||||
rebuildMenu(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1269,9 +1305,11 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
}
|
||||
|
||||
public void updateMenu() {
|
||||
menu.updateData();
|
||||
updateButtonsAndProgress();
|
||||
runLayoutListener();
|
||||
if (created) {
|
||||
menu.updateData();
|
||||
updateButtonsAndProgress();
|
||||
runLayoutListener();
|
||||
}
|
||||
}
|
||||
|
||||
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.NoImagesCard;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -68,6 +69,7 @@ public class MenuBuilder {
|
|||
private LatLon latLon;
|
||||
private boolean hidden;
|
||||
private boolean showNearestWiki = false;
|
||||
private boolean showOnlinePhotos = true;
|
||||
protected List<Amenity> nearestWiki = new ArrayList<>();
|
||||
private List<OsmandPlugin> menuPlugins = new ArrayList<>();
|
||||
private CardsRowBuilder onlinePhotoCardsRow;
|
||||
|
@ -206,6 +208,14 @@ public class MenuBuilder {
|
|||
this.showNearestWiki = showNearestWiki;
|
||||
}
|
||||
|
||||
public boolean isShowOnlinePhotos() {
|
||||
return showOnlinePhotos;
|
||||
}
|
||||
|
||||
public void setShowOnlinePhotos(boolean showOnlinePhotos) {
|
||||
this.showOnlinePhotos = showOnlinePhotos;
|
||||
}
|
||||
|
||||
public void setShowNearestWiki(boolean showNearestWiki, long objectId) {
|
||||
this.objectId = objectId;
|
||||
this.showNearestWiki = showNearestWiki;
|
||||
|
@ -227,7 +237,9 @@ public class MenuBuilder {
|
|||
buildPlainMenuItems(view);
|
||||
}
|
||||
buildInternal(view);
|
||||
buildNearestPhotosRow(view);
|
||||
if (showOnlinePhotos) {
|
||||
buildNearestPhotosRow(view);
|
||||
}
|
||||
buildPluginRows(view);
|
||||
buildAfter(view);
|
||||
}
|
||||
|
@ -648,6 +660,10 @@ public class MenuBuilder {
|
|||
|
||||
protected boolean processNearstWiki() {
|
||||
if (showNearestWiki && latLon != null) {
|
||||
String preferredLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
|
||||
if (Algorithms.isEmpty(preferredLang)) {
|
||||
preferredLang = app.getLanguage();
|
||||
}
|
||||
QuadRect rect = MapUtils.calculateLatLonBbox(
|
||||
latLon.getLatitude(), latLon.getLongitude(), 250);
|
||||
nearestWiki = app.getResourceManager().searchAmenities(
|
||||
|
@ -673,12 +689,14 @@ public class MenuBuilder {
|
|||
});
|
||||
Long id = objectId;
|
||||
if (id != 0) {
|
||||
List<Amenity> wikiList = new ArrayList<>();
|
||||
for (Amenity wiki : nearestWiki) {
|
||||
if (wiki.getId().equals(id)) {
|
||||
nearestWiki.remove(wiki);
|
||||
break;
|
||||
String lng = wiki.getContentLanguage("content", preferredLang, "en");
|
||||
if (wiki.getId().equals(id) || (!lng.equals("en") && !lng.equals(preferredLang))) {
|
||||
wikiList.add(wiki);
|
||||
}
|
||||
}
|
||||
nearestWiki.removeAll(wikiList);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.mapcontextmenu;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -86,6 +87,7 @@ public abstract class MenuController extends BaseMenuController {
|
|||
MULTI_LINE
|
||||
}
|
||||
|
||||
protected MapContextMenu mapContextMenu;
|
||||
protected MenuBuilder builder;
|
||||
private int currentMenuState;
|
||||
private MenuType menuType = MenuType.STANDARD;
|
||||
|
@ -117,6 +119,10 @@ public abstract class MenuController extends BaseMenuController {
|
|||
this.builder.setLight(isLight());
|
||||
}
|
||||
|
||||
public void setMapContextMenu(MapContextMenu mapContextMenu) {
|
||||
this.mapContextMenu = mapContextMenu;
|
||||
}
|
||||
|
||||
public void build(View rootView) {
|
||||
for (OsmandPlugin plugin : OsmandPlugin.getEnabledPlugins()) {
|
||||
if (plugin.isMenuControllerSupported(this.getClass())) {
|
||||
|
@ -342,6 +348,10 @@ public abstract class MenuController extends BaseMenuController {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isClosable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean needStreetName() {
|
||||
return !displayDistanceDirection();
|
||||
}
|
||||
|
@ -531,114 +541,137 @@ public abstract class MenuController extends BaseMenuController {
|
|||
}
|
||||
}
|
||||
|
||||
public void buildMapDownloadButton(LatLon latLon) {
|
||||
int point31x = MapUtils.get31TileNumberX(latLon.getLongitude());
|
||||
int point31y = MapUtils.get31TileNumberY(latLon.getLatitude());
|
||||
public void buildMapDownloadButton(final LatLon latLon) {
|
||||
new AsyncTask<Void, Void, BinaryMapDataObject>() {
|
||||
|
||||
ResourceManager rm = getMapActivity().getMyApplication().getResourceManager();
|
||||
OsmandRegions osmandRegions = rm.getOsmandRegions();
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
ResourceManager rm;
|
||||
OsmandRegions osmandRegions;
|
||||
String selectedFullName = "";
|
||||
double smallestArea = -1;
|
||||
downloadMapDataObject = null;
|
||||
for (BinaryMapDataObject o : mapDataObjects) {
|
||||
String downloadName = osmandRegions.getDownloadName(o);
|
||||
if (!Algorithms.isEmpty(downloadName)) {
|
||||
boolean downloaded = checkIfObjectDownloaded(rm, downloadName);
|
||||
if (downloaded) {
|
||||
downloadMapDataObject = 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;
|
||||
downloadMapDataObject = o;
|
||||
} else if (area < smallestArea) {
|
||||
smallestArea = area;
|
||||
selectedFullName = fullName;
|
||||
downloadMapDataObject = o;
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
rm = getMapActivity().getMyApplication().getResourceManager();
|
||||
osmandRegions = rm.getOsmandRegions();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BinaryMapDataObject doInBackground(Void... voids) {
|
||||
|
||||
int point31x = MapUtils.get31TileNumberX(latLon.getLongitude());
|
||||
int point31y = MapUtils.get31TileNumberY(latLon.getLatitude());
|
||||
|
||||
List<BinaryMapDataObject> mapDataObjects = null;
|
||||
try {
|
||||
mapDataObjects = osmandRegions.queryBbox(point31x, point31x, point31y, point31y);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
BinaryMapDataObject binaryMapDataObject = null;
|
||||
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;
|
||||
if (!downloaded) {
|
||||
downloadThread = getMapActivity().getMyApplication().getDownloadThread();
|
||||
downloadRegion = osmandRegions.getRegionData(selectedFullName);
|
||||
if (downloadRegion != null && downloadRegion.isRegionMapDownload()) {
|
||||
List<IndexItem> indexItems = downloadThread.getIndexes().getIndexItems(downloadRegion);
|
||||
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);
|
||||
@Override
|
||||
protected void onPostExecute(BinaryMapDataObject binaryMapDataObject) {
|
||||
downloadMapDataObject = binaryMapDataObject;
|
||||
downloaded = downloadMapDataObject == null;
|
||||
if (!downloaded) {
|
||||
downloadThread = getMapActivity().getMyApplication().getDownloadThread();
|
||||
downloadRegion = osmandRegions.getRegionData(selectedFullName);
|
||||
if (downloadRegion != null && downloadRegion.isRegionMapDownload()) {
|
||||
List<IndexItem> indexItems = downloadThread.getIndexes().getIndexItems(downloadRegion);
|
||||
for (IndexItem item : indexItems) {
|
||||
if (item.getType() == DownloadActivityType.NORMAL_FILE
|
||||
&& (item.isDownloaded() || downloadThread.isDownloading(item))) {
|
||||
indexItem = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
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);
|
||||
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() {
|
||||
@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 (getMapActivity().getMyApplication().getSettings().isInternetConnectionAvailable()) {
|
||||
downloadThread.runReloadIndexFiles();
|
||||
if (mapContextMenu != null) {
|
||||
mapContextMenu.updateMenuUI();
|
||||
}
|
||||
}
|
||||
|
||||
updateData();
|
||||
}
|
||||
}
|
||||
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
}
|
||||
|
||||
private boolean checkIfObjectDownloaded(ResourceManager rm, String downloadName) {
|
||||
|
|
|
@ -109,7 +109,7 @@ public class ContextMenuCardDialogFragment extends Fragment {
|
|||
fragment.dialog = menu;
|
||||
menu.getMapActivity().getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.topFragmentContainer, fragment, TAG)
|
||||
.addToBackStack(TAG).commit();
|
||||
.addToBackStack(TAG).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
|
|
|
@ -27,6 +27,7 @@ public class TransportRouteController extends MenuController {
|
|||
final TransportStopRoute transportRoute) {
|
||||
super(new MenuBuilder(mapActivity), pointDescription, mapActivity);
|
||||
this.transportRoute = transportRoute;
|
||||
builder.setShowOnlinePhotos(false);
|
||||
toolbarController = new ContextMenuToolbarController(this);
|
||||
toolbarController.setTitle(getNameStr());
|
||||
toolbarController.setOnBackButtonClickListener(new OnClickListener() {
|
||||
|
@ -83,6 +84,10 @@ public class TransportRouteController extends MenuController {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClosable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buttonsVisible() {
|
||||
|
@ -96,7 +101,13 @@ public class TransportRouteController extends MenuController {
|
|||
|
||||
@Override
|
||||
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
|
||||
|
@ -154,14 +165,22 @@ public class TransportRouteController extends MenuController {
|
|||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
MapContextMenu menu = getMapActivity().getContextMenu();
|
||||
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_STOP,
|
||||
getMapActivity().getString(R.string.transport_Stop), name);
|
||||
resetRoute();
|
||||
menu.show(stop.getLocation(), pd, stop);
|
||||
WeakReference<MapContextMenuFragment> rr = menu.findMenuFragment();
|
||||
if (rr != null && rr.get() != null) {
|
||||
rr.get().centerMarkerLocation();
|
||||
if (mapContextMenu != null) {
|
||||
transportRoute.stop = stop;
|
||||
transportRoute.refStop = stop;
|
||||
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_ROUTE,
|
||||
transportRoute.getDescription(getMapActivity().getMyApplication(), false));
|
||||
|
||||
LatLon stopLocation = stop.getLocation();
|
||||
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) {
|
||||
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.setGpx(getGpxItem().group.getGpx());
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
|
|||
final Drawable drawable = getIcon(toggleIconId, toggleIconColorId);
|
||||
((AppCompatImageView) toggleRow.findViewById(R.id.toggle_row_icon)).setImageDrawable(drawable);
|
||||
final CompoundButton toggle = (CompoundButton) toggleRow.findViewById(R.id.toggle_row_toggle);
|
||||
toggle.setOnCheckedChangeListener(null);
|
||||
toggle.setChecked(selected);
|
||||
toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
|
|
|
@ -15,7 +15,10 @@ import android.view.ViewGroup;
|
|||
import android.webkit.ConsoleMessage;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebResourceError;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
@ -33,6 +36,7 @@ import net.osmand.data.QuadRect;
|
|||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.map.TileSourceManager;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||
|
@ -78,15 +82,18 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
|||
private double ca = Double.NaN;
|
||||
|
||||
private View staticImageView;
|
||||
private View noInternetView;
|
||||
private List<Pair<QuadPointDouble, GeometryTile>> tiles = new ArrayList<>();
|
||||
private double fetchedTileLat = Double.NaN;
|
||||
private double fetchedTileLon = Double.NaN;
|
||||
private List<MapillaryImage> sequenceImages = new ArrayList<>();
|
||||
private AtomicInteger downloadRequestNumber = new AtomicInteger();
|
||||
private IconsCache ic;
|
||||
|
||||
public MapillaryImageDialog(@NonNull MapActivity mapActivity, @NonNull Bundle bundle) {
|
||||
super(mapActivity, CardDialogType.MAPILLARY);
|
||||
restoreFields(bundle);
|
||||
this.ic = mapActivity.getMyApplication().getIconsCache();
|
||||
}
|
||||
|
||||
public MapillaryImageDialog(MapActivity mapActivity, String key, String sKey, String imageUrl,
|
||||
|
@ -100,6 +107,7 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
|||
this.viewerUrl = viewerUrl;
|
||||
this.latLon = latLon;
|
||||
this.ca = ca;
|
||||
this.ic = mapActivity.getMyApplication().getIconsCache();
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
|
@ -208,17 +216,27 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
|||
|
||||
|
||||
@SuppressLint({"SetJavaScriptEnabled", "AddJavascriptInterface"})
|
||||
private WebView getWebView() {
|
||||
final WebView webView = new WebView(getMapActivity());
|
||||
private View getWebView() {
|
||||
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));
|
||||
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.setScrollContainer(false);
|
||||
view.setScrollContainer(false);
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
webView.addJavascriptInterface(new MapillaryWebAppInterface(), "Android");
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||
isPortrait() ? ViewGroup.LayoutParams.MATCH_PARENT : AndroidUtils.dpToPx(getMapActivity(), 360f),
|
||||
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() {
|
||||
@Override
|
||||
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
|
||||
|
@ -229,8 +247,15 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
|||
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);
|
||||
return webView;
|
||||
return view;
|
||||
}
|
||||
|
||||
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)) {
|
||||
MenuBuilder.execute(new DownloadImageTask(staticImageView, downloadRequestNumber.incrementAndGet(), downloadRequestNumber));
|
||||
fetchSequence();
|
||||
}
|
||||
updateArrowButtons();
|
||||
return staticImageView;
|
||||
return view;
|
||||
}
|
||||
|
||||
private void fetchSequence() {
|
||||
|
@ -493,6 +528,8 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
|||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
noInternetView.setVisibility(View.GONE);
|
||||
staticImageView.setVisibility(View.VISIBLE);
|
||||
if (progressBar != null) {
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
@ -518,8 +555,14 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
|||
if (progressBar != null) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
if (bitmap != null && imageView != null) {
|
||||
imageView.setImageDrawable(new BitmapDrawable(getMapActivity().getResources(), bitmap));
|
||||
if (imageView != null) {
|
||||
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
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
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.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
@ -23,6 +24,7 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.MapActivityLayers;
|
||||
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.util.Algorithms;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -235,8 +238,9 @@ public class MapillaryPlugin extends OsmandPlugin {
|
|||
return success;
|
||||
}
|
||||
|
||||
public static boolean installMapillary(OsmandApplication app) {
|
||||
boolean success = execInstall(app, "market://search?q=pname:" + MAPILLARY_PACKAGE_ID);
|
||||
public static boolean installMapillary(Activity activity, OsmandApplication app) {
|
||||
app.logEvent(activity, "install_mapillary");
|
||||
boolean success = execInstall(app, Version.getUrlWithUtmRef(app, MAPILLARY_PACKAGE_ID));
|
||||
if (!success) {
|
||||
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.file = f;
|
||||
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() {
|
||||
@Override
|
||||
|
@ -257,7 +257,7 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
AvailableGPXFragment.GpxInfo info = new AvailableGPXFragment.GpxInfo();
|
||||
info.subfolder = "";
|
||||
info.file = f;
|
||||
AvailableGPXFragment.udpateGpxInfoView(pView, info, app, true);
|
||||
AvailableGPXFragment.updateGpxInfoView(pView, info, app, true);
|
||||
updateShowOnMap(app, f, v, showOnMap);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -187,7 +187,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
asyncProcessor = new ProcessGpxTask();
|
||||
asyncProcessor.execute();
|
||||
asyncProcessor.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
updateCurrentTrack();
|
||||
|
||||
|
@ -1048,7 +1048,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
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);
|
||||
ImageButton options = (ImageButton) v.findViewById(R.id.options);
|
||||
|
@ -1314,10 +1314,12 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
if (gpxItem.analysis.hasSpeedData) {
|
||||
list.add(GPXDataSetType.SPEED);
|
||||
} else {
|
||||
} else if (gpxItem.analysis.hasElevationData) {
|
||||
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) {
|
||||
gpxItem.wasHidden = app.getSelectedGpxHelper().getSelectedFileByPath(gpxInfo.file.getAbsolutePath()) == null;
|
||||
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));
|
||||
if (!isDashItem) {
|
||||
v.findViewById(R.id.divider_list).setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -322,29 +322,28 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
private List<GpxDisplayGroup> filterGroups(boolean useDisplayGroups) {
|
||||
if (getTrackActivity() == null) {
|
||||
return null;
|
||||
}
|
||||
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(useDisplayGroups);
|
||||
List<GpxDisplayGroup> groups = new ArrayList<>();
|
||||
for (GpxDisplayGroup group : result) {
|
||||
boolean add = hasFilterType(group.getType());
|
||||
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
|
||||
Iterator<GpxDisplayItem> item = group.getModifiableList().iterator();
|
||||
while (item.hasNext()) {
|
||||
GpxDisplayItem it2 = item.next();
|
||||
if (it2.analysis != null && it2.analysis.totalDistance < 100) {
|
||||
item.remove();
|
||||
if (getTrackActivity() != null) {
|
||||
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(useDisplayGroups);
|
||||
for (GpxDisplayGroup group : result) {
|
||||
boolean add = hasFilterType(group.getType());
|
||||
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
|
||||
Iterator<GpxDisplayItem> item = group.getModifiableList().iterator();
|
||||
while (item.hasNext()) {
|
||||
GpxDisplayItem it2 = item.next();
|
||||
if (it2.analysis != null && it2.analysis.totalDistance < 100) {
|
||||
item.remove();
|
||||
}
|
||||
}
|
||||
if (group.getModifiableList().isEmpty()) {
|
||||
add = false;
|
||||
}
|
||||
}
|
||||
if (group.getModifiableList().isEmpty()) {
|
||||
add = false;
|
||||
if (add) {
|
||||
groups.add(group);
|
||||
}
|
||||
}
|
||||
if (add) {
|
||||
groups.add(group);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
@ -577,7 +576,12 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
|
||||
String maxSpeed = OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, 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) {
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
|
@ -592,7 +596,7 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
minMaxSpeedPaint.getTextBounds(maxMinSpeed, 0, maxMinSpeed.length(), minMaxSpeedTextBounds);
|
||||
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))
|
||||
.setVisibility(View.VISIBLE);
|
||||
(convertView.findViewById(R.id.min_speed_value))
|
||||
|
@ -657,9 +661,6 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
if (mSelectedGpxFile != null) {
|
||||
List<GpxDisplayGroup> groups = getDisplayGroups();
|
||||
if (groups == null) {
|
||||
return;
|
||||
}
|
||||
mSelectedGpxFile.setDisplayGroups(groups);
|
||||
}
|
||||
updateContent();
|
||||
|
|
|
@ -121,16 +121,16 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
public TrackActivity getMyActivity() {
|
||||
public TrackActivity getTrackActivity() {
|
||||
return (TrackActivity) getActivity();
|
||||
}
|
||||
|
||||
private GPXFile getGpx() {
|
||||
return getMyActivity().getGpx();
|
||||
return getTrackActivity().getGpx();
|
||||
}
|
||||
|
||||
private GpxDataItem getGpxDataItem() {
|
||||
return getMyActivity().getGpxDataItem();
|
||||
return getTrackActivity().getGpxDataItem();
|
||||
}
|
||||
|
||||
private void expandAllGroups() {
|
||||
|
@ -160,26 +160,28 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
|
||||
private List<GpxDisplayGroup> filterGroups() {
|
||||
List<GpxDisplayGroup> result = getMyActivity().getGpxFile(false);
|
||||
List<GpxDisplayGroup> groups = new ArrayList<>();
|
||||
for (GpxDisplayGroup group : result) {
|
||||
boolean add = hasFilterType(group.getType());
|
||||
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
|
||||
Iterator<GpxDisplayItem> item = group.getModifiableList().iterator();
|
||||
while (item.hasNext()) {
|
||||
GpxDisplayItem it2 = item.next();
|
||||
if (it2.analysis != null && it2.analysis.totalDistance < 100) {
|
||||
item.remove();
|
||||
if (getTrackActivity() != null) {
|
||||
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(false);
|
||||
for (GpxDisplayGroup group : result) {
|
||||
boolean add = hasFilterType(group.getType());
|
||||
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
|
||||
Iterator<GpxDisplayItem> item = group.getModifiableList().iterator();
|
||||
while (item.hasNext()) {
|
||||
GpxDisplayItem it2 = item.next();
|
||||
if (it2.analysis != null && it2.analysis.totalDistance < 100) {
|
||||
item.remove();
|
||||
}
|
||||
}
|
||||
if (group.getModifiableList().isEmpty()) {
|
||||
add = false;
|
||||
}
|
||||
}
|
||||
if (group.getModifiableList().isEmpty()) {
|
||||
add = false;
|
||||
if (add) {
|
||||
groups.add(group);
|
||||
}
|
||||
}
|
||||
if (add) {
|
||||
groups.add(group);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
@ -537,8 +539,8 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
|||
|
||||
private void selectFavoritesImpl() {
|
||||
if (!selectedItems.isEmpty()) {
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(getMyActivity());
|
||||
final EditText editText = new EditText(getMyActivity());
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(getTrackActivity());
|
||||
final EditText editText = new EditText(getTrackActivity());
|
||||
String name = selectedItems.iterator().next().group.getName();
|
||||
if(name.indexOf('\n') > 0) {
|
||||
name = name.substring(0, name.indexOf('\n'));
|
||||
|
@ -818,7 +820,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
|||
groupColor = gpxItem.locationStart.getColor(groupColor);
|
||||
}
|
||||
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));
|
||||
} else {
|
||||
|
|
|
@ -236,7 +236,11 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
private GPXFile getGpx() {
|
||||
return getTrackActivity().getGpx();
|
||||
TrackActivity activity = getTrackActivity();
|
||||
if (activity == null) {
|
||||
return null;
|
||||
}
|
||||
return activity.getGpx();
|
||||
}
|
||||
|
||||
private GpxDataItem getGpxDataItem() {
|
||||
|
@ -278,14 +282,24 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
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) {
|
||||
LatLon location = new LatLon(pointToShow.getLatitude(),
|
||||
pointToShow.getLongitude());
|
||||
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.getLastKnownMapZoom(),
|
||||
new PointDescription(PointDescription.POINT_TYPE_WPT, getGpxDataItem().getFile().getName()),
|
||||
new PointDescription(PointDescription.POINT_TYPE_WPT, trackName),
|
||||
false,
|
||||
getRect()
|
||||
);
|
||||
|
@ -710,29 +724,28 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
private List<GpxDisplayGroup> filterGroups(boolean useDisplayGroups) {
|
||||
if (getTrackActivity() == null) {
|
||||
return null;
|
||||
}
|
||||
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(useDisplayGroups);
|
||||
List<GpxDisplayGroup> groups = new ArrayList<>();
|
||||
for (GpxDisplayGroup group : result) {
|
||||
boolean add = hasFilterType(group.getType());
|
||||
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
|
||||
Iterator<GpxDisplayItem> item = group.getModifiableList().iterator();
|
||||
while (item.hasNext()) {
|
||||
GpxDisplayItem it2 = item.next();
|
||||
if (it2.analysis != null && it2.analysis.totalDistance < 100) {
|
||||
item.remove();
|
||||
if (getTrackActivity() != null) {
|
||||
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(useDisplayGroups);
|
||||
for (GpxDisplayGroup group : result) {
|
||||
boolean add = hasFilterType(group.getType());
|
||||
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
|
||||
Iterator<GpxDisplayItem> item = group.getModifiableList().iterator();
|
||||
while (item.hasNext()) {
|
||||
GpxDisplayItem it2 = item.next();
|
||||
if (it2.analysis != null && it2.analysis.totalDistance < 100) {
|
||||
item.remove();
|
||||
}
|
||||
}
|
||||
if (group.getModifiableList().isEmpty()) {
|
||||
add = false;
|
||||
}
|
||||
}
|
||||
if (group.getModifiableList().isEmpty()) {
|
||||
add = false;
|
||||
if (add) {
|
||||
groups.add(group);
|
||||
}
|
||||
}
|
||||
if (add) {
|
||||
groups.add(group);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
@ -746,7 +759,9 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
adapter.setNotifyOnChange(true);
|
||||
adapter.notifyDataSetChanged();
|
||||
updateHeader();
|
||||
if (getActivity() != null) {
|
||||
updateHeader();
|
||||
}
|
||||
}
|
||||
|
||||
protected List<GpxDisplayItem> flatten(List<GpxDisplayGroup> groups) {
|
||||
|
@ -1541,9 +1556,6 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
if (mSelectedGpxFile != null) {
|
||||
List<GpxDisplayGroup> groups = getDisplayGroups();
|
||||
if (groups == null) {
|
||||
return;
|
||||
}
|
||||
mSelectedGpxFile.setDisplayGroups(groups);
|
||||
}
|
||||
if (mFragment.isVisible()) {
|
||||
|
|
|
@ -96,7 +96,7 @@ public class UploadOpenstreetmapPointAsyncTask
|
|||
@Override
|
||||
protected void onPostExecute(Map<OsmPoint, String> loadErrorsMap) {
|
||||
if (progress != null) {
|
||||
progress.dismiss();
|
||||
progress.dismissAllowingStateLoss();
|
||||
}
|
||||
listener.uploadEnded(loadErrorsMap);
|
||||
}
|
||||
|
|
|
@ -137,6 +137,9 @@ public class SendPoiDialogFragment extends DialogFragment {
|
|||
|
||||
private String createDefaultChangeSet() {
|
||||
Map<String, PoiType> allTranslatedSubTypes = getMyApplication().getPoiTypes().getAllTranslatedNames(true);
|
||||
if (allTranslatedSubTypes == null) {
|
||||
return "";
|
||||
}
|
||||
Map<String, Integer> addGroup = new HashMap<>();
|
||||
Map<String, Integer> editGroup = new HashMap<>();
|
||||
Map<String, Integer> deleteGroup = new HashMap<>();
|
||||
|
@ -146,6 +149,9 @@ public class SendPoiDialogFragment extends DialogFragment {
|
|||
if (p.getGroup() == OsmPoint.Group.POI) {
|
||||
OsmPoint.Action action = p.getAction();
|
||||
String type = ((OpenstreetmapPoint) p).getEntity().getTag(EditPoiData.POI_TYPE_TAG);
|
||||
if (type == null) {
|
||||
continue;
|
||||
}
|
||||
PoiType localizedPoiType = allTranslatedSubTypes.get(type.toLowerCase().trim());
|
||||
if (localizedPoiType != null) {
|
||||
type = Algorithms.capitalizeFirstLetter(localizedPoiType.getKeyName().replace('_', ' '));
|
||||
|
@ -178,7 +184,6 @@ public class SendPoiDialogFragment extends DialogFragment {
|
|||
}
|
||||
}
|
||||
int modifiedItemsOutOfLimit = 0;
|
||||
boolean stringModifiedIfExceeded = false;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
String action;
|
||||
Map<String, Integer> group;
|
||||
|
@ -205,37 +210,27 @@ public class SendPoiDialogFragment extends DialogFragment {
|
|||
}
|
||||
|
||||
if (!group.isEmpty()) {
|
||||
if (modifiedItemsOutOfLimit == 0) {
|
||||
comment = comment.concat(action).concat(" ");
|
||||
}
|
||||
int pos = 0;
|
||||
for (Map.Entry<String, Integer> entry : group.entrySet()) {
|
||||
String type = entry.getKey();
|
||||
int quantity = entry.getValue();
|
||||
if (comment.length() > 200) {
|
||||
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 {
|
||||
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++;
|
||||
}
|
||||
if (modifiedItemsOutOfLimit == 0) {
|
||||
comment = comment.substring(0, comment.length() - 2).concat("; ");
|
||||
}
|
||||
}
|
||||
}
|
||||
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("")){
|
||||
comment = comment.substring(0, comment.length() - 2).concat(".");
|
||||
comment = comment.concat(".");
|
||||
}
|
||||
return comment;
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ public class PoiFiltersHelper {
|
|||
}
|
||||
|
||||
public List<PoiUIFilter> getTopDefinedPoiFilters() {
|
||||
// if (cacheTopStandardFilters == null) {
|
||||
if (cacheTopStandardFilters == null) {
|
||||
List<PoiUIFilter> top = new ArrayList<PoiUIFilter>();
|
||||
// user defined
|
||||
top.addAll(getUserDefinedPoiFilters());
|
||||
|
@ -209,7 +209,7 @@ public class PoiFiltersHelper {
|
|||
}
|
||||
Collections.sort(top);
|
||||
cacheTopStandardFilters = top;
|
||||
// }
|
||||
}
|
||||
List<PoiUIFilter> result = new ArrayList<PoiUIFilter>();
|
||||
result.addAll(cacheTopStandardFilters);
|
||||
result.add(getShowAllPOIFilter());
|
||||
|
|
|
@ -578,10 +578,19 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
|
||||
private void putAllAcceptedTypes(Map<PoiCategory, LinkedHashSet<String>> types) {
|
||||
for (PoiCategory category : types.keySet()) {
|
||||
LinkedHashSet<String> typesSet = types.get(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 {
|
||||
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){
|
||||
close();
|
||||
// check we have some assets to copy to sdcard
|
||||
warnings.addAll(checkAssets(progress));
|
||||
warnings.addAll(checkAssets(progress, false));
|
||||
progress.notifyEvent(InitEvents.ASSETS_COPIED);
|
||||
reloadIndexes(progress, warnings);
|
||||
progress.notifyEvent(InitEvents.MAPS_INITIALIZED);
|
||||
|
@ -414,9 +414,9 @@ public class ResourceManager {
|
|||
return warnings;
|
||||
}
|
||||
|
||||
private List<String> checkAssets(IProgress progress) {
|
||||
public List<String> checkAssets(IProgress progress, boolean forceUpdate) {
|
||||
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);
|
||||
applicationDataDir.mkdirs();
|
||||
if (applicationDataDir.canWrite()) {
|
||||
|
@ -424,7 +424,7 @@ public class ResourceManager {
|
|||
progress.startTask(context.getString(R.string.installing_new_resources), -1);
|
||||
AssetManager assetManager = context.getAssets();
|
||||
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);
|
||||
copyRegionsBoundaries();
|
||||
// see Issue #3381
|
||||
|
|
|
@ -484,16 +484,10 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
renderedObjects = nativeLib.searchRenderedObjectsFromContext(rc, (int) (point.x - x), (int) (point.y - y));
|
||||
}
|
||||
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;
|
||||
double cosRotateTileSize = Math.cos(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 cy = r.getBbox().centerY();
|
||||
double dTileX = (cx * cosRotateTileSize + cy * sinRotateTileSize) / (TILE_SIZE * TILE_SIZE);
|
||||
|
@ -544,16 +538,15 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
}
|
||||
if (selectedObjects.size() == 1) {
|
||||
Object selectedObj = selectedObjects.keySet().iterator().next();
|
||||
LatLon latLon = null;
|
||||
LatLon latLon = objectLatLon;
|
||||
PointDescription pointDescription = null;
|
||||
final IContextMenuProvider provider = selectedObjects.get(selectedObj);
|
||||
if (provider != null) {
|
||||
latLon = provider.getObjectLocation(selectedObj);
|
||||
if (latLon == null) {
|
||||
latLon = provider.getObjectLocation(selectedObj);
|
||||
}
|
||||
pointDescription = provider.getObjectName(selectedObj);
|
||||
}
|
||||
if (latLon == null) {
|
||||
latLon = objectLatLon;
|
||||
}
|
||||
if (latLon == null) {
|
||||
latLon = getLatLon(point, tileBox);
|
||||
}
|
||||
|
@ -763,7 +756,12 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
|
||||
if (movementListener.onTouchEvent(event)) {
|
||||
if (menu.isVisible()) {
|
||||
menu.hide();
|
||||
if (!menu.isClosable()) {
|
||||
menu.hide();
|
||||
} else {
|
||||
menu.updateMapCenter(null);
|
||||
menu.close();
|
||||
}
|
||||
}
|
||||
if (multiSelectionMenu.isVisible()) {
|
||||
multiSelectionMenu.hide();
|
||||
|
|
|
@ -278,22 +278,22 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
// request to load
|
||||
for (SelectedGpxFile g : selectedGPXFiles) {
|
||||
List<GpxDisplayGroup> groups = g.getDisplayGroups();
|
||||
if (groups != null) {
|
||||
for (GpxDisplayGroup group : groups) {
|
||||
GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path));
|
||||
int color = gpxDataItem.getColor();
|
||||
if (color == 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 (groups != null && !groups.isEmpty()) {
|
||||
GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path));
|
||||
int color = gpxDataItem.getColor();
|
||||
if (color == 0) {
|
||||
color = g.getModifiableGpxFile().getColor(0);
|
||||
}
|
||||
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 net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.core.android.MapRendererContext;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
|
@ -273,6 +274,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
search.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mapActivity.dismissCardDialog();
|
||||
mapActivity.showQuickSearch(ShowQuickSearchMode.NEW_IF_EXPIRED, false);
|
||||
}
|
||||
});
|
||||
|
@ -423,6 +425,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
routePlanButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mapActivity.dismissCardDialog();
|
||||
doRoute(false);
|
||||
}
|
||||
});
|
||||
|
@ -792,8 +795,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
private void updateMyLocation(RoutingHelper rh, boolean dialogOpened) {
|
||||
boolean enabled = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation() != null &&
|
||||
!isLocationOutdated(mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation());
|
||||
Location lastKnownLocation = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||
boolean enabled = lastKnownLocation != null && !isLocationOutdated(lastKnownLocation);
|
||||
boolean tracked = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
|
||||
|
||||
if (!enabled) {
|
||||
|
|
|
@ -80,8 +80,10 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
quickActionButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!showTutorialIfNeeded())
|
||||
mapActivity.dismissCardDialog();
|
||||
if (!showTutorialIfNeeded()) {
|
||||
setLayerState(!isWidgetVisible());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import android.view.WindowManager;
|
|||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.SecondSplashScreenFragment;
|
||||
import net.osmand.access.AccessibilityActionsProvider;
|
||||
import net.osmand.core.android.MapRendererView;
|
||||
import net.osmand.data.LatLon;
|
||||
|
@ -109,6 +108,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
public boolean onPressEvent(PointF point);
|
||||
}
|
||||
|
||||
public interface OnDrawMapListener {
|
||||
public void onDrawOverMap();
|
||||
}
|
||||
|
||||
public int getDefaultColor() {
|
||||
return defaultColor;
|
||||
}
|
||||
|
@ -142,6 +145,8 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
|
||||
private Map<OsmandMapLayer, Float> zOrders = new HashMap<OsmandMapLayer, Float>();
|
||||
|
||||
private OnDrawMapListener onDrawMapListener;
|
||||
|
||||
// UI Part
|
||||
// handler to refresh map (in ui thread - ui thread is not necessary, but msg queue is required).
|
||||
protected Handler handler;
|
||||
|
@ -448,6 +453,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
return locationListener;
|
||||
}
|
||||
|
||||
public void setOnDrawMapListener(OnDrawMapListener onDrawMapListener) {
|
||||
this.onDrawMapListener = onDrawMapListener;
|
||||
}
|
||||
|
||||
// ////////////////////////////// DRAWING MAP PART /////////////////////////////////////////////
|
||||
public BaseMapLayer getMainLayer() {
|
||||
return mainLayer;
|
||||
|
@ -663,10 +672,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
}
|
||||
}
|
||||
|
||||
if (activity instanceof MapActivity && !((MapActivity) activity).isActivityDestroyed() &&
|
||||
((MapActivity) activity).getSupportFragmentManager().findFragmentByTag(SecondSplashScreenFragment.TAG) != null) {
|
||||
((MapActivity) activity).dismissSecondSplashScreen();
|
||||
if (onDrawMapListener != null) {
|
||||
onDrawMapListener.onDrawOverMap();
|
||||
}
|
||||
|
||||
for (int i = 0; i < layers.size(); i++) {
|
||||
try {
|
||||
OsmandMapLayer layer = layers.get(i);
|
||||
|
|
|
@ -86,9 +86,9 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
|||
}
|
||||
// draw
|
||||
boolean nm = nightMode != null && nightMode.isNightMode();
|
||||
updateIcons(view.getSettings().getApplicationMode(), nm,
|
||||
isLocationOutdated(locationProvider.getLastKnownLocation()));
|
||||
Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
||||
updateIcons(view.getSettings().getApplicationMode(), nm,
|
||||
isLocationOutdated(lastKnownLocation));
|
||||
if(lastKnownLocation == null || view == null){
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.graphics.BitmapFactory;
|
|||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.Style;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Handler;
|
||||
|
@ -19,14 +18,13 @@ import net.osmand.data.QuadPoint;
|
|||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.OsmandSettings.RulerMode;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
||||
public class RulerControlLayer extends OsmandMapLayer {
|
||||
|
||||
private static final long DRAW_TIME = 2000;
|
||||
|
@ -49,14 +47,13 @@ public class RulerControlLayer extends OsmandMapLayer {
|
|||
private int acceptableTouchRadius;
|
||||
|
||||
private QuadPoint cacheCenter;
|
||||
private float cacheMapDensity;
|
||||
private OsmandSettings.OsmandPreference<Float> mapDensity;
|
||||
private int cacheIntZoom;
|
||||
private double cacheTileX;
|
||||
private double cacheTileY;
|
||||
private long cacheMultiTouchEndTime;
|
||||
private ArrayList<String> cacheDistances;
|
||||
private Path distancePath;
|
||||
private TIntArrayList tx;
|
||||
private TIntArrayList ty;
|
||||
private LatLon touchPointLatLon;
|
||||
private PointF touchPoint;
|
||||
private long touchStartTime;
|
||||
|
@ -93,13 +90,12 @@ public class RulerControlLayer extends OsmandMapLayer {
|
|||
public void initLayer(final OsmandMapTileView view) {
|
||||
app = mapActivity.getMyApplication();
|
||||
this.view = view;
|
||||
mapDensity = mapActivity.getMyApplication().getSettings().MAP_DENSITY;
|
||||
cacheMapDensity = mapDensity.get();
|
||||
cacheDistances = new ArrayList<>();
|
||||
cacheCenter = new QuadPoint();
|
||||
maxRadiusInDp = mapActivity.getResources().getDimensionPixelSize(R.dimen.map_ruler_width);
|
||||
rightWidgetsPanel = mapActivity.findViewById(R.id.map_right_widgets_panel);
|
||||
distancePath = new Path();
|
||||
tx = new TIntArrayList();
|
||||
ty = new TIntArrayList();
|
||||
touchPoint = new PointF();
|
||||
acceptableTouchRadius = mapActivity.getResources().getDimensionPixelSize(R.dimen.acceptable_touch_radius);
|
||||
|
||||
|
@ -156,7 +152,7 @@ public class RulerControlLayer extends OsmandMapLayer {
|
|||
if (d > acceptableTouchRadius) {
|
||||
touchOutside = true;
|
||||
}
|
||||
} else if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
} else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
touched = false;
|
||||
touchEndTime = System.currentTimeMillis();
|
||||
refreshMapDelayed();
|
||||
|
@ -205,8 +201,8 @@ public class RulerControlLayer extends OsmandMapLayer {
|
|||
drawCenterIcon(canvas, tb, center, settings.isNightMode(), mode);
|
||||
Location currentLoc = app.getLocationProvider().getLastKnownLocation();
|
||||
if (showDistBetweenFingerAndLocation && currentLoc != null) {
|
||||
float x = tb.getPixXFromLonNoRot(touchPointLatLon.getLongitude());
|
||||
float y = tb.getPixYFromLatNoRot(touchPointLatLon.getLatitude());
|
||||
float x = tb.getPixXFromLatLon(touchPointLatLon.getLatitude(), touchPointLatLon.getLongitude());
|
||||
float y = tb.getPixYFromLatLon(touchPointLatLon.getLatitude(), touchPointLatLon.getLongitude());
|
||||
drawDistBetweenFingerAndLocation(canvas, tb, x, y, currentLoc, settings.isNightMode());
|
||||
} else if (showTwoFingersDistance) {
|
||||
LatLon firstTouchPoint = view.getFirstTouchPointLatLon();
|
||||
|
@ -272,21 +268,31 @@ public class RulerControlLayer extends OsmandMapLayer {
|
|||
|
||||
private void drawDistBetweenFingerAndLocation(Canvas canvas, RotatedTileBox tb, float x, float y,
|
||||
Location currentLoc, boolean nightMode) {
|
||||
int currX = tb.getPixXFromLonNoRot(currentLoc.getLongitude());
|
||||
int currY = tb.getPixYFromLatNoRot(currentLoc.getLatitude());
|
||||
distancePath.reset();
|
||||
tx.clear();
|
||||
ty.clear();
|
||||
int currX = (int) tb.getPixXFromLatLon(currentLoc.getLatitude(), currentLoc.getLongitude());
|
||||
int currY = (int) tb.getPixYFromLatLon(currentLoc.getLatitude(), currentLoc.getLongitude());
|
||||
int width = tb.getPixWidth();
|
||||
int height = tb.getPixHeight();
|
||||
|
||||
tx.add(currX);
|
||||
ty.add(currY);
|
||||
tx.add((int) x);
|
||||
ty.add((int) y);
|
||||
if (currX < 0 || currY < 0 || currX > width || currY > height) {
|
||||
float xNew = (currX + x) / 2;
|
||||
float yNew = (currY + y) / 2;
|
||||
|
||||
calculatePath(tb, tx, ty, distancePath);
|
||||
canvas.drawPath(distancePath, lineAttrs.paint);
|
||||
// canvas.drawLine(currX, currY, x, y, lineAttrs.paint);
|
||||
while (true) {
|
||||
if (xNew < 0 || yNew < 0 || xNew > width || yNew > height) {
|
||||
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);
|
||||
canvas.rotate(tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||
}
|
||||
|
||||
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 ||
|
||||
Math.abs(tb.getCenterTileY() - cacheTileY) > 1;
|
||||
Math.abs(tb.getCenterTileY() - cacheTileY) > 1 || mapDensity.get() != cacheMapDensity;
|
||||
|
||||
if (!tb.isZoomAnimated() && move) {
|
||||
cacheIntZoom = tb.getZoom();
|
||||
cacheTileX = tb.getCenterTileX();
|
||||
cacheTileY = tb.getCenterTileY();
|
||||
cacheMapDensity = mapDensity.get();
|
||||
cacheDistances.clear();
|
||||
updateDistance(tb);
|
||||
}
|
||||
|
|
|
@ -580,14 +580,18 @@ public class MapInfoWidgetsFactory {
|
|||
titleView.setSingleLine(false);
|
||||
}
|
||||
|
||||
if (controller.closeBtnVisible && closeButton.getVisibility() == View.GONE) {
|
||||
closeButton.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (controller.closeBtnVisible) {
|
||||
if (closeButton.getVisibility() == View.GONE) {
|
||||
closeButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if (closeButton.getVisibility() == View.VISIBLE) {
|
||||
closeButton.setVisibility(View.GONE);
|
||||
}
|
||||
if (controller.refreshBtnVisible && refreshButton.getVisibility() == View.GONE) {
|
||||
refreshButton.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (controller.refreshBtnVisible) {
|
||||
if (refreshButton.getVisibility() == View.GONE) {
|
||||
refreshButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if (refreshButton.getVisibility() == View.VISIBLE) {
|
||||
refreshButton.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
@ -714,18 +718,20 @@ public class MapInfoWidgetsFactory {
|
|||
settings.SHOW_STREET_NAME.get()) {
|
||||
RouteDataObject rt = locationProvider.getLastKnownRouteSegment();
|
||||
if (rt != null) {
|
||||
Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
||||
text = RoutingHelper.formatStreetName(
|
||||
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.getDestinationName(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(lastKnownLocation)),
|
||||
"»");
|
||||
}
|
||||
if (text == null) {
|
||||
text = "";
|
||||
} else {
|
||||
if(!Algorithms.isEmpty(text) && locationProvider.getLastKnownLocation() != null) {
|
||||
Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
||||
if(!Algorithms.isEmpty(text) && lastKnownLocation != null) {
|
||||
double dist =
|
||||
CurrentPositionHelper.getOrthogonalDistance(rt, locationProvider.getLastKnownLocation());
|
||||
CurrentPositionHelper.getOrthogonalDistance(rt, lastKnownLocation);
|
||||
if(dist < 50) {
|
||||
showMarker = true;
|
||||
} else {
|
||||
|
|
|
@ -1048,6 +1048,8 @@ public class RouteInfoWidgetsFactory {
|
|||
private MapActivity ma;
|
||||
private String cacheRulerText;
|
||||
private int maxWidth;
|
||||
private float cacheMapDensity;
|
||||
private OsmandSettings.OsmandPreference<Float> mapDensity;
|
||||
private int cacheRulerZoom;
|
||||
private double cacheRulerTileX;
|
||||
private double cacheRulerTileY;
|
||||
|
@ -1061,6 +1063,8 @@ public class RouteInfoWidgetsFactory {
|
|||
textShadow = (TextView) ma.findViewById(R.id.map_ruler_text_shadow);
|
||||
maxWidth = ma.getResources().getDimensionPixelSize(R.dimen.map_ruler_width);
|
||||
orientationPortrait = AndroidUiHelper.isOrientationPortrait(ma);
|
||||
mapDensity = ma.getMyApplication().getSettings().MAP_DENSITY;
|
||||
cacheMapDensity = mapDensity.get();
|
||||
}
|
||||
|
||||
public void updateTextSize(boolean isNight, int textColor, int textShadowColor, int shadowRadius) {
|
||||
|
@ -1077,10 +1081,12 @@ public class RouteInfoWidgetsFactory {
|
|||
} else if (!orientationPortrait && ma.getRoutingHelper().isRoutePlanningMode()) {
|
||||
visible = false;
|
||||
} 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();
|
||||
cacheRulerTileX = tb.getCenterTileX();
|
||||
cacheRulerTileY = tb.getCenterTileY();
|
||||
cacheMapDensity = mapDensity.get();
|
||||
final double dist = tb.getDistance(0, tb.getPixHeight() / 2, tb.getPixWidth(), tb.getPixHeight() / 2);
|
||||
double pixDensity = tb.getPixWidth() / dist;
|
||||
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() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean success = execOsmAndInstall("market://search?q=pname:");
|
||||
boolean success = execOsmAndInstall("market://details?id=");
|
||||
if (!success) {
|
||||
success = execOsmAndInstall("https://play.google.com/store/apps/details?id=");
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class NauticalActivity extends Activity {
|
|||
public void onClick(View v) {
|
||||
String appName = OSMAND_COMPONENT;
|
||||
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 {
|
||||
//stopService(intent);
|
||||
startActivity(intent);
|
||||
|
|
|
@ -56,7 +56,7 @@ public class ParkingPluginActivity extends Activity {
|
|||
public void onClick(View v) {
|
||||
String appName = OSMAND_COMPONENT;
|
||||
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 {
|
||||
//stopService(intent);
|
||||
startActivity(intent);
|
||||
|
|
|
@ -58,7 +58,7 @@ public class SRTMPluginActivity extends Activity {
|
|||
public void onClick(View v) {
|
||||
String appName = OSMAND_COMPONENT;
|
||||
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 {
|
||||
//stopService(intent);
|
||||
startActivity(intent);
|
||||
|
|
|
@ -59,7 +59,7 @@ public class SkiMapsActivity extends Activity {
|
|||
public void onClick(View v) {
|
||||
String appName = OSMAND_COMPONENT;
|
||||
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 {
|
||||
//stopService(intent);
|
||||
startActivity(intent);
|
||||
|
|
Loading…
Reference in a new issue