Fix crash & icons

This commit is contained in:
Victor Shcherb 2015-04-14 17:27:08 +03:00
parent 8e2eb94624
commit bc48e093f2
4 changed files with 30 additions and 32 deletions

View file

@ -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

View file

@ -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());

View file

@ -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);
if(showOnMapItem != null) {
showOnMapItem.setEnabled(amenityAdapter.getCount() > 0);
}
} else {
amenityAdapter.setNewModel(result);
}

View file

@ -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);