Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2013-02-14 21:38:56 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:50:55 +0300
commit739a92e67be59f5e4905ef24f6e838425837055c (patch)
tree4b383bb2e6dc2da90b0f0369ed1c30bcd54781c3 /android
parent39a9c09e5a8baa6617a3697c3f121f1f1067c6ef (diff)
[android] [bookmarks] Process distance and direction for the list of bookmarks separately (according to available sensors).
Diffstat (limited to 'android')
-rw-r--r--android/src/com/mapswithme/maps/ArrowImage.java23
-rw-r--r--android/src/com/mapswithme/maps/SearchActivity.java7
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java10
3 files changed, 31 insertions, 9 deletions
diff --git a/android/src/com/mapswithme/maps/ArrowImage.java b/android/src/com/mapswithme/maps/ArrowImage.java
index ec2877172b..457ec70b3a 100644
--- a/android/src/com/mapswithme/maps/ArrowImage.java
+++ b/android/src/com/mapswithme/maps/ArrowImage.java
@@ -34,6 +34,8 @@ public class ArrowImage extends ImageView
public void setFlag(Resources res, String packageName, String flag)
{
+ setVisibility(VISIBLE);
+
m_drawArrow = false;
// The aapt can't process resources with name "do". Hack with renaming.
@@ -42,17 +44,38 @@ public class ArrowImage extends ImageView
final int id = res.getIdentifier(flag, "drawable", packageName);
if (id > 0)
+ {
setImageDrawable(res.getDrawable(id));
+ }
else
+ {
+ setImageDrawable(null);
+
Log.e(TAG, "Failed to get resource id from: " + flag);
+ }
+
+ invalidate();
}
public void setAzimut(double azimut)
{
+ setVisibility(VISIBLE);
+
setImageDrawable(null);
m_drawArrow = true;
m_angle = (float)(azimut / Math.PI * 180.0);
+
+ invalidate();
+ }
+
+ public void clear()
+ {
+ setVisibility(INVISIBLE);
+
+ setImageDrawable(null);
+
+ m_drawArrow = false;
}
@Override
diff --git a/android/src/com/mapswithme/maps/SearchActivity.java b/android/src/com/mapswithme/maps/SearchActivity.java
index 547112235d..9bf7e0c570 100644
--- a/android/src/com/mapswithme/maps/SearchActivity.java
+++ b/android/src/com/mapswithme/maps/SearchActivity.java
@@ -308,18 +308,13 @@ public class SearchActivity extends ListActivity implements LocationService.List
if (r.m_type == 1)
{
- holder.m_flag.setVisibility(View.VISIBLE);
-
if (r.m_flag != null && r.m_flag.length() > 0 && r.m_azimut < 0.0)
holder.m_flag.setFlag(m_resource, m_packageName, r.m_flag);
else
holder.m_flag.setAzimut(r.m_azimut);
-
- // force invalidate arrow image
- holder.m_flag.invalidate();
}
else
- holder.m_flag.setVisibility(View.INVISIBLE);
+ holder.m_flag.clear();
}
}
diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java b/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java
index 9524223f4e..2557f2b460 100644
--- a/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java
+++ b/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java
@@ -60,16 +60,20 @@ public class BookmarkListAdapter extends BaseAdapter implements LocationService.
holder.icon.setImageBitmap(item.getIcon().getIcon());
final Location loc = mLocation.getLastKnown();
- if (mNorth != -1.0 && loc != null)
+ if (loc != null)
{
DistanceAndAthimuth daa = item.getDistanceAndAthimuth(loc.getLatitude(), loc.getLongitude(), mNorth);
holder.distance.setText(daa.getDistance());
- holder.arrow.setAzimut(daa.getAthimuth());
+
+ if (daa.getAthimuth() >= 0.0)
+ holder.arrow.setAzimut(daa.getAthimuth());
+ else
+ holder.arrow.clear();
}
else
{
holder.distance.setText("");
- holder.arrow.setImageDrawable(null);
+ holder.arrow.clear();
}
//Log.d("lat lot", item.getLat() + " " + item.getLon());