diff --git a/OsmAnd/res/drawable-hdpi/ic_action_gdirections_dark.png b/OsmAnd/res/drawable-hdpi/ic_action_gdirections_dark.png
index e523ea8017..ad3e3daaa3 100644
Binary files a/OsmAnd/res/drawable-hdpi/ic_action_gdirections_dark.png and b/OsmAnd/res/drawable-hdpi/ic_action_gdirections_dark.png differ
diff --git a/OsmAnd/res/drawable-hdpi/ic_action_gdirections_light.png b/OsmAnd/res/drawable-hdpi/ic_action_gdirections_light.png
index b50bfb4987..ebfaf653eb 100644
Binary files a/OsmAnd/res/drawable-hdpi/ic_action_gdirections_light.png and b/OsmAnd/res/drawable-hdpi/ic_action_gdirections_light.png differ
diff --git a/OsmAnd/res/drawable-hdpi/ic_download_disabled.png b/OsmAnd/res/drawable-hdpi/ic_download_disabled.png
new file mode 100644
index 0000000000..2f411ee3f6
Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/ic_download_disabled.png differ
diff --git a/OsmAnd/res/drawable-mdpi/ic_action_gdirections_dark.png b/OsmAnd/res/drawable-mdpi/ic_action_gdirections_dark.png
index ed666749e4..4dd4a94c35 100644
Binary files a/OsmAnd/res/drawable-mdpi/ic_action_gdirections_dark.png and b/OsmAnd/res/drawable-mdpi/ic_action_gdirections_dark.png differ
diff --git a/OsmAnd/res/drawable-mdpi/ic_action_gdirections_light.png b/OsmAnd/res/drawable-mdpi/ic_action_gdirections_light.png
index 50033d88ab..cbcbd37aa6 100644
Binary files a/OsmAnd/res/drawable-mdpi/ic_action_gdirections_light.png and b/OsmAnd/res/drawable-mdpi/ic_action_gdirections_light.png differ
diff --git a/OsmAnd/res/drawable-mdpi/ic_download_disabled.png b/OsmAnd/res/drawable-mdpi/ic_download_disabled.png
new file mode 100644
index 0000000000..f0abf30eea
Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/ic_download_disabled.png differ
diff --git a/OsmAnd/res/drawable-xhdpi/ic_action_gdirections_dark.png b/OsmAnd/res/drawable-xhdpi/ic_action_gdirections_dark.png
index 97ed1f6e1c..734cce8e61 100644
Binary files a/OsmAnd/res/drawable-xhdpi/ic_action_gdirections_dark.png and b/OsmAnd/res/drawable-xhdpi/ic_action_gdirections_dark.png differ
diff --git a/OsmAnd/res/drawable-xhdpi/ic_action_gdirections_light.png b/OsmAnd/res/drawable-xhdpi/ic_action_gdirections_light.png
index edae205a0f..4505c9be8c 100644
Binary files a/OsmAnd/res/drawable-xhdpi/ic_action_gdirections_light.png and b/OsmAnd/res/drawable-xhdpi/ic_action_gdirections_light.png differ
diff --git a/OsmAnd/res/drawable-xhdpi/ic_download_disabled.png b/OsmAnd/res/drawable-xhdpi/ic_download_disabled.png
new file mode 100644
index 0000000000..c18a584913
Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/ic_download_disabled.png differ
diff --git a/OsmAnd/res/drawable-xxhdpi/ic_action_gdirections_dark.png b/OsmAnd/res/drawable-xxhdpi/ic_action_gdirections_dark.png
new file mode 100644
index 0000000000..9897a755db
Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/ic_action_gdirections_dark.png differ
diff --git a/OsmAnd/res/drawable-xxhdpi/ic_action_gdirections_light.png b/OsmAnd/res/drawable-xxhdpi/ic_action_gdirections_light.png
new file mode 100644
index 0000000000..98a22f18ea
Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/ic_action_gdirections_light.png differ
diff --git a/OsmAnd/res/drawable-xxhdpi/ic_download_disabled.png b/OsmAnd/res/drawable-xxhdpi/ic_download_disabled.png
new file mode 100644
index 0000000000..28913a115a
Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/ic_download_disabled.png differ
diff --git a/OsmAnd/res/drawable/download_disabled.xml b/OsmAnd/res/drawable/download_disabled.xml
new file mode 100644
index 0000000000..aa07d37a5a
--- /dev/null
+++ b/OsmAnd/res/drawable/download_disabled.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/dash_favorites_item.xml b/OsmAnd/res/layout/dash_favorites_item.xml
index 19134a41ca..c053fae24e 100644
--- a/OsmAnd/res/layout/dash_favorites_item.xml
+++ b/OsmAnd/res/layout/dash_favorites_item.xml
@@ -19,8 +19,9 @@
android:layout_height="28dp"/>
+
+
diff --git a/OsmAnd/res/layout/dash_updates_fragment.xml b/OsmAnd/res/layout/dash_updates_fragment.xml
index 6680c3b211..ba3a36149c 100644
--- a/OsmAnd/res/layout/dash_updates_fragment.xml
+++ b/OsmAnd/res/layout/dash_updates_fragment.xml
@@ -12,6 +12,7 @@
android:layout_width="match_parent"
android:layout_height="40dp">
-
Use secure connection with server
Use HTTPS
Advanced
- Maps
+ You have %1$s maps to update
Search for
SHOW MAP
SHOW ALL
diff --git a/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java b/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java
index d37db427e4..fc214728db 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java
@@ -443,6 +443,10 @@ public class MainMenuActivity extends BaseDownloadActivity {
Fragment f = ref.get();
if(f instanceof DashUpdatesFragment) {
if(!f.isDetached()) {
+ if (downloadQueue.size() > 0){
+ startDownload(downloadQueue.get(0));
+ downloadQueue.remove(0);
+ }
((DashUpdatesFragment) f).updatedDownloadsList(list);
}
}
diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java
index d84f1b3d83..1ba7fbc49a 100644
--- a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java
@@ -21,6 +21,7 @@ import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.FavoriteImageDrawable;
+import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.FontCache;
import net.osmand.util.MapUtils;
@@ -101,6 +102,12 @@ public class DashFavoritesFragment extends DashBaseFragment {
int dist = (int) (MapUtils.getDistance(point.getLatitude(), point.getLongitude(),
lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
String distance = OsmAndFormatter.getFormattedDistance(dist, getMyApplication()) + " ";
+ view.findViewById(R.id.navigate_to).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), point.getLatitude(), point.getLongitude(), point.getName());
+ }
+ });
label.setText(distance, TextView.BufferType.SPANNABLE);
label.setTypeface(Typeface.DEFAULT, point.isVisible() ? Typeface.NORMAL : Typeface.ITALIC);
view.setOnClickListener(new View.OnClickListener() {
diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashUpdatesFragment.java
index 02846629d9..2b3f852b33 100644
--- a/OsmAnd/src/net/osmand/plus/dashboard/DashUpdatesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/dashboard/DashUpdatesFragment.java
@@ -1,8 +1,11 @@
package net.osmand.plus.dashboard;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
+import android.widget.*;
import net.osmand.plus.R;
import net.osmand.plus.base.BasicProgressAsyncTask;
import net.osmand.plus.download.BaseDownloadActivity;
@@ -15,10 +18,6 @@ import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.ImageButton;
-import android.widget.LinearLayout;
-import android.widget.ProgressBar;
-import android.widget.TextView;
/**
* Created by Denis on 21.11.2014.
@@ -31,6 +30,7 @@ public class DashUpdatesFragment extends DashBaseFragment {
private List progressBars = new ArrayList();
private List baseNames = new ArrayList();
private List downloadButtons = new ArrayList();
+ private List downloadQueue = new ArrayList();
private ImageButton cancelButton;
@Override
@@ -56,6 +56,7 @@ public class DashUpdatesFragment extends DashBaseFragment {
@Override
public void onResume() {
super.onResume();
+ downloadQueue.clear();
if (BaseDownloadActivity.downloadListIndexThread != null) {
currentProgress = null;
cancelButton = null;
@@ -64,6 +65,13 @@ public class DashUpdatesFragment extends DashBaseFragment {
}
public void updatedDownloadsList(List list) {
+ List itemList = new ArrayList(list);
+ Collections.sort(itemList, new Comparator() {
+ @Override
+ public int compare(IndexItem indexItem, IndexItem t1) {
+ return (int)(t1.getTimestamp() - indexItem.getTimestamp());
+ }
+ });
View mainView = getView();
//it may be null because download index thread is async
if (mainView == null) {
@@ -73,20 +81,20 @@ public class DashUpdatesFragment extends DashBaseFragment {
baseNames.clear();
downloadButtons.clear();
mainView.findViewById(R.id.main_progress).setVisibility(View.GONE);
- ((TextView) mainView.findViewById(R.id.update_count)).setText(String.valueOf(list.size()));
+ ((TextView) mainView.findViewById(R.id.header)).setText(getString(R.string.map_update ,String.valueOf(list.size())));
LinearLayout updates = (LinearLayout) mainView.findViewById(R.id.updates_items);
updates.removeAllViews();
- if (list.size() < 1) {
+ if (itemList.size() < 1) {
mainView.findViewById(R.id.maps).setVisibility(View.GONE);
return;
} else {
mainView.findViewById(R.id.maps).setVisibility(View.VISIBLE);
}
- for (int i = 0; i < list.size(); i++) {
- final IndexItem item = list.get(i);
+ for (int i = 0; i < itemList.size(); i++) {
+ final IndexItem item = itemList.get(i);
if (i > 2) {
break;
}
@@ -103,8 +111,6 @@ public class DashUpdatesFragment extends DashBaseFragment {
@Override
public void onClick(View view) {
getDownloadActivity().startDownload(item);
- currentProgress = progressBar;
- cancelButton = (ImageButton) view;
}
});
downloadButtons.add((ImageButton) downloadButton);
@@ -124,7 +130,7 @@ public class DashUpdatesFragment extends DashBaseFragment {
return;
}
//needed when rotation is performed and progress can be null
- if (currentProgress == null) {
+ if (!updateOnlyProgress) {
getProgressIfPossible(basicProgressAsyncTask.getDescription());
if (currentProgress == null) {
return;
@@ -140,7 +146,6 @@ public class DashUpdatesFragment extends DashBaseFragment {
if (!visible) {
return;
}
-
cancelButton.setImageResource(R.drawable.cancel_button);
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
diff --git a/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java
index e55f32fa03..c50042e051 100644
--- a/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java
+++ b/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java
@@ -41,6 +41,7 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
protected OsmandSettings settings;
public static DownloadIndexesThread downloadListIndexThread;
protected List> fragList = new ArrayList>();
+ protected List downloadQueue = new ArrayList();
public static final int MAXIMUM_AVAILABLE_FREE_DOWNLOADS = 10;
@@ -113,13 +114,18 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
}
public void startDownload(IndexItem item) {
- if (downloadListIndexThread.getCurrentRunningTask() != null) {
- Toast.makeText(this, "Please wait before previous download is finished", Toast.LENGTH_SHORT).show();
+ if (downloadListIndexThread.getCurrentRunningTask() != null && getEntriesToDownload().get(item) == null) {
+ downloadQueue.add(item);
+ Toast.makeText(this, "Added to download queue", Toast.LENGTH_SHORT).show();
return;
}
+ addToDownload(item);
+ downloadFilesCheckFreeVersion();
+ }
+
+ private void addToDownload(IndexItem item) {
List download = item.createDownloadEntry(getMyApplication(), item.getType(), new ArrayList());
getEntriesToDownload().put(item, download);
- downloadFilesCheckFreeVersion();
}
public void downloadFilesPreCheckSpace() {
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java
index 01162a3622..dedae65eb0 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java
@@ -163,7 +163,10 @@ public class DownloadIndexesThread {
uiActivity.updateDownloadButton(false);
}
} else if (o instanceof String) {
- AccessibleToast.makeText(ctx, (String) o, Toast.LENGTH_LONG).show();
+ String message = (String) o;
+ if(!message.equals("I/O error occurred : Interrupted")){
+ AccessibleToast.makeText(ctx, message, Toast.LENGTH_LONG).show();
+ }
}
}
super.onProgressUpdate(values);