diff --git a/OsmAnd/src/net/osmand/plus/activities/EditPOIFilterActivity.java b/OsmAnd/src/net/osmand/plus/activities/EditPOIFilterActivity.java index 7c75df148e..3d9cfa3e2a 100644 --- a/OsmAnd/src/net/osmand/plus/activities/EditPOIFilterActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/EditPOIFilterActivity.java @@ -241,16 +241,11 @@ public class EditPOIFilterActivity extends OsmandListActivity { return lv; } - private void selectAll(){ + private void selectAll() { AmenityAdapter adapter = getListAdapter(); int count = adapter.getCount(); - for (int i =0; i< count; i++) { + for (int i = 0; i < count; i++) { selectAllFromCategory(adapter.getItem(i)); - ListView lv = EditPOIFilterActivity.this.getListView(); - final int index = lv.getFirstVisiblePosition(); - View v = lv.getChildAt(0); - final int top = (v == null) ? 0 : v.getTop(); - lv.setSelectionFromTop(index, top); } } @@ -260,8 +255,7 @@ public class EditPOIFilterActivity extends OsmandListActivity { for (int i =0; i< count; i++) { filter.setTypeToAccept(adapter.getItem(i), false); } - ListView lv = EditPOIFilterActivity.this.getListView(); - lv.deferNotifyDataSetChanged(); + adapter.notifyDataSetChanged(); } @Override diff --git a/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java b/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java index 33dae4689a..aa870d64fd 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java @@ -142,15 +142,6 @@ public class MainMenuActivity extends BaseDownloadActivity implements OsmAndLoca } } - private void addErrorFragment() { - android.support.v4.app.FragmentManager manager = getSupportFragmentManager(); - android.support.v4.app.FragmentTransaction fragmentTransaction = manager.beginTransaction(); - if (manager.findFragmentByTag(DashErrorFragment.TAG) == null) { - DashErrorFragment errorFragment = new DashErrorFragment(); - fragmentTransaction.add(R.id.content, errorFragment, DashErrorFragment.TAG).commit(); - } - } - private void startMapActivity() { final Intent mapIndent = new Intent(this, getMyApplication().getAppCustomization().getMapActivity()); diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java index cb2300e347..b35862058b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java @@ -76,6 +76,7 @@ import android.widget.Filter; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; +import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; @@ -479,7 +480,12 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa } if (handled) { this.location = location; - amenityAdapter.notifyDataSetChanged(); + amenityAdapter.notifyDataSetInvalidated(); + ListView lv = getListView(); + final int index = lv.getFirstVisiblePosition(); + View v = lv.getChildAt(0); + final int top = (v == null) ? 0 : v.getTop(); + lv.setSelectionFromTop(index, top); updateButtonState(); } @@ -631,7 +637,9 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa Toast.LENGTH_LONG).show(); } amenityAdapter.setNewModel(result); - showOnMapItem.setEnabled(amenityAdapter.getCount() > 0); + if(showOnMapItem != null) { + showOnMapItem.setEnabled(amenityAdapter.getCount() > 0); + } } else { amenityAdapter.setNewModel(result); } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 9113d794b5..05268b90b9 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -140,21 +140,19 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { * creates (if it wasn't created previously) the control to be added on a MapInfoLayer that shows a monitoring state (recorded/stopped) */ private TextInfoWidget createMonitoringControl(final MapActivity map) { - final Drawable monitoringBig = map.getResources().getDrawable(R.drawable.monitoring_rec_big); - final Drawable monitoringSmall = map.getResources().getDrawable(R.drawable.monitoring_rec_small); - final Drawable monitoringInactive = map.getResources().getDrawable(R.drawable.monitoring_rec_inactive); monitoringControl = new TextInfoWidget(map) { long lastUpdateTime; @Override public boolean updateInfo(DrawSettings drawSettings) { if(isSaving){ setText(map.getString(R.string.shared_string_save), ""); - setImageDrawable(monitoringBig); + setIcons(R.drawable.widget_monitoring_rec_big_day, R.drawable.widget_monitoring_rec_big_night); return true; } String txt = map.getString(R.string.monitoring_control_start); String subtxt = null; - Drawable d = monitoringInactive; + int dn = R.drawable.widget_monitoring_rec_inactive_night; + int d = R.drawable.widget_monitoring_rec_inactive_day; long last = lastUpdateTime; final boolean globalRecord = settings.SAVE_GLOBAL_TRACK_TO_GPX.get(); final boolean isRecording = app.getSavingTrackHelper().getIsRecording(); @@ -175,27 +173,34 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { if(globalRecord) { //indicates global recording (+background recording) - d = monitoringBig; + dn = R.drawable.widget_monitoring_rec_big_night; + d = R.drawable.widget_monitoring_rec_big_day; } else if (isRecording) { //indicates (profile-based, configured in settings) recording (looks like is only active during nav in follow mode) - d = monitoringSmall; + dn = R.drawable.widget_monitoring_rec_small_night; + d = R.drawable.widget_monitoring_rec_small_day; } else { - d = monitoringInactive; + dn = R.drawable.widget_monitoring_rec_inactive_night; + d = R.drawable.widget_monitoring_rec_inactive_day; } setText(txt, subtxt); - setImageDrawable(d); + setIcons(d, dn); if ((last != lastUpdateTime) && (globalRecord || isRecording)) { lastUpdateTime = last; //blink implementation with 2 indicator states (global logging + profile/navigation logging) - setImageDrawable(monitoringInactive); + setIcons(R.drawable.widget_monitoring_rec_inactive_day, + R.drawable.widget_monitoring_rec_inactive_night); + map.getMyApplication().runInUIThread(new Runnable() { @Override public void run() { if (globalRecord) { - setImageDrawable(monitoringBig); + setIcons(R.drawable.widget_monitoring_rec_big_day, + R.drawable.widget_monitoring_rec_big_night); } else { - setImageDrawable(monitoringSmall); + setIcons(R.drawable.widget_monitoring_rec_small_day, + R.drawable.widget_monitoring_rec_small_night); } } }, 500);