From dfd5608c891c3b80074032c6fcfb0c1afd96ef2f Mon Sep 17 00:00:00 2001 From: sonora Date: Sat, 3 Jan 2015 14:21:06 +0100 Subject: [PATCH] Limit POI arrow updates to >3 degrees and see if commenting out Handler solves issues on some devices --- .../activities/search/SearchPOIActivity.java | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java index f3fbdce6c8..7d5e121ed6 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java @@ -506,17 +506,27 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa @Override public void updateCompassValue(float value) { + float lastHeading = heading; heading = value; - if(!uiHandler.hasMessages(COMPASS_REFRESH_MSG_ID)){ - Message msg = Message.obtain(uiHandler, new Runnable(){ - @Override - public void run() { - amenityAdapter.notifyDataSetChanged(); - } - }); - msg.what = COMPASS_REFRESH_MSG_ID; - uiHandler.sendMessageDelayed(msg, 100); + if(heading != null && lastheading != null && Math.abs(MapUtils.degreesDiff(lastHeading, heading)) > 3) { + @Override + public void run() { + amenityAdapter.notifyDataSetChanged(); + } + } else { + heading = lastHeading; } + //Comment out and use lastHeading above to see if this fixes issues seen on some devices + //if(!uiHandler.hasMessages(COMPASS_REFRESH_MSG_ID)){ + // Message msg = Message.obtain(uiHandler, new Runnable(){ + // @Override + // public void run() { + // amenityAdapter.notifyDataSetChanged(); + // } + // }); + // msg.what = COMPASS_REFRESH_MSG_ID; + // uiHandler.sendMessageDelayed(msg, 100); + //} }