Fix exceptions

This commit is contained in:
Victor Shcherb 2013-08-04 13:24:00 +02:00
parent 5546e87b1f
commit f89cd246f0
4 changed files with 52 additions and 51 deletions

View file

@ -44,12 +44,13 @@ public enum AmenityType {
}
public static AmenityType fromString(String s) {
try {
return AmenityType.valueOf(s.toUpperCase());
} catch (IllegalArgumentException e) {
return AmenityType.OTHER;
for (AmenityType t : values()) {
if (t.name().equalsIgnoreCase(s)) {
return t;
}
}
return OTHER;
}
public String getDefaultTag() {
return defaultTag;

View file

@ -248,7 +248,7 @@ public class MapRenderingTypes {
rtype.value = null;
}
if (poiParentCategory != null) {
rtype.poiCategory = AmenityType.valueOf(poiParentCategory.toUpperCase());
rtype.poiCategory = AmenityType.fromString(poiParentCategory);
rtype.poiSpecified = true;
}
if (poiParentPrefix != null) {
@ -305,7 +305,7 @@ public class MapRenderingTypes {
String tag = parser.getAttributeValue("","poi_tag");
if (tag != null) {
AmenityRuleType rtype = new AmenityRuleType();
rtype.poiCategory = AmenityType.valueOf(poiParentCategory.toUpperCase());
rtype.poiCategory = AmenityType.fromString(poiParentCategory);
rtype.poiSpecified = true;
rtype.relation = Boolean.parseBoolean(parser.getAttributeValue("", "relation"));
rtype.poiPrefix = poiParentPrefix;

View file

@ -425,7 +425,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
if (location == null) {
title = R.string.search_poi_location;
enabled = false;
} else if (!isNameFinderFilter() && !isSearchByNameFilter()) {
} else if (filter != null && !isNameFinderFilter() && !isSearchByNameFilter()) {
title = R.string.search_POI_level_btn;
enabled = (taskAlreadyFinished || currentSearchTask.getStatus() != Status.RUNNING) && filter.isSearchFurtherAvailable();
} else if (filter != null) {

View file

@ -47,13 +47,14 @@ public class SettingsAudioVideoActivity extends SettingsBaseActivity {
ListPreference defAct = createListPreference(p.AV_DEFAULT_ACTION, entries, intValues, R.string.av_widget_action,
R.string.av_widget_action_descr);
grp.addPreference(defAct);
final Camera cam = openCamera();
if (cam != null) {
// camera type settings:
grp.addPreference(createCheckBoxPreference(p.AV_EXTERNAL_PHOTO_CAM, R.string.av_use_external_camera,
R.string.av_use_external_camera_descr));
// focus mode settings:
// show in menu only suppoted modes:
final Camera cam = openCamera();
Parameters parameters = cam.getParameters();
List<String> sfm = parameters.getSupportedFocusModes();
List<String> items = new ArrayList<String>();
@ -91,8 +92,7 @@ public class SettingsAudioVideoActivity extends SettingsBaseActivity {
grp.addPreference(createCheckBoxPreference(p.AV_PHOTO_PLAY_SOUND, R.string.av_photo_play_sound,
R.string.av_photo_play_sound_descr));
cam.release();
}
// video settings:
grp.addPreference(createCheckBoxPreference(p.AV_EXTERNAL_RECORDER, R.string.av_use_external_recorder,
R.string.av_use_external_recorder_descr));