Fix exceptions
This commit is contained in:
parent
e8a67845f1
commit
2ff8ff8230
4 changed files with 52 additions and 51 deletions
|
@ -43,12 +43,13 @@ public enum AmenityType {
|
||||||
this.defaultTag = defaultTag;
|
this.defaultTag = defaultTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AmenityType fromString(String s){
|
public static AmenityType fromString(String s) {
|
||||||
try {
|
for (AmenityType t : values()) {
|
||||||
return AmenityType.valueOf(s.toUpperCase());
|
if (t.name().equalsIgnoreCase(s)) {
|
||||||
} catch (IllegalArgumentException e) {
|
return t;
|
||||||
return AmenityType.OTHER;
|
}
|
||||||
}
|
}
|
||||||
|
return OTHER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultTag() {
|
public String getDefaultTag() {
|
||||||
|
|
|
@ -248,7 +248,7 @@ public class MapRenderingTypes {
|
||||||
rtype.value = null;
|
rtype.value = null;
|
||||||
}
|
}
|
||||||
if (poiParentCategory != null) {
|
if (poiParentCategory != null) {
|
||||||
rtype.poiCategory = AmenityType.valueOf(poiParentCategory.toUpperCase());
|
rtype.poiCategory = AmenityType.fromString(poiParentCategory);
|
||||||
rtype.poiSpecified = true;
|
rtype.poiSpecified = true;
|
||||||
}
|
}
|
||||||
if (poiParentPrefix != null) {
|
if (poiParentPrefix != null) {
|
||||||
|
@ -305,7 +305,7 @@ public class MapRenderingTypes {
|
||||||
String tag = parser.getAttributeValue("","poi_tag");
|
String tag = parser.getAttributeValue("","poi_tag");
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
AmenityRuleType rtype = new AmenityRuleType();
|
AmenityRuleType rtype = new AmenityRuleType();
|
||||||
rtype.poiCategory = AmenityType.valueOf(poiParentCategory.toUpperCase());
|
rtype.poiCategory = AmenityType.fromString(poiParentCategory);
|
||||||
rtype.poiSpecified = true;
|
rtype.poiSpecified = true;
|
||||||
rtype.relation = Boolean.parseBoolean(parser.getAttributeValue("", "relation"));
|
rtype.relation = Boolean.parseBoolean(parser.getAttributeValue("", "relation"));
|
||||||
rtype.poiPrefix = poiParentPrefix;
|
rtype.poiPrefix = poiParentPrefix;
|
||||||
|
|
|
@ -425,7 +425,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
title = R.string.search_poi_location;
|
title = R.string.search_poi_location;
|
||||||
enabled = false;
|
enabled = false;
|
||||||
} else if (!isNameFinderFilter() && !isSearchByNameFilter()) {
|
} else if (filter != null && !isNameFinderFilter() && !isSearchByNameFilter()) {
|
||||||
title = R.string.search_POI_level_btn;
|
title = R.string.search_POI_level_btn;
|
||||||
enabled = (taskAlreadyFinished || currentSearchTask.getStatus() != Status.RUNNING) && filter.isSearchFurtherAvailable();
|
enabled = (taskAlreadyFinished || currentSearchTask.getStatus() != Status.RUNNING) && filter.isSearchFurtherAvailable();
|
||||||
} else if (filter != null) {
|
} else if (filter != null) {
|
||||||
|
|
|
@ -47,52 +47,52 @@ public class SettingsAudioVideoActivity extends SettingsBaseActivity {
|
||||||
ListPreference defAct = createListPreference(p.AV_DEFAULT_ACTION, entries, intValues, R.string.av_widget_action,
|
ListPreference defAct = createListPreference(p.AV_DEFAULT_ACTION, entries, intValues, R.string.av_widget_action,
|
||||||
R.string.av_widget_action_descr);
|
R.string.av_widget_action_descr);
|
||||||
grp.addPreference(defAct);
|
grp.addPreference(defAct);
|
||||||
|
|
||||||
// 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();
|
final Camera cam = openCamera();
|
||||||
Parameters parameters = cam.getParameters();
|
if (cam != null) {
|
||||||
List<String> sfm = parameters.getSupportedFocusModes();
|
// camera type settings:
|
||||||
List<String> items = new ArrayList<String>();
|
grp.addPreference(createCheckBoxPreference(p.AV_EXTERNAL_PHOTO_CAM, R.string.av_use_external_camera,
|
||||||
List<Integer> itemsValues = new ArrayList<Integer>();
|
R.string.av_use_external_camera_descr));
|
||||||
// filtering known types for translate and set index:
|
// focus mode settings:
|
||||||
for (int index = 0; index < sfm.size(); index++) {
|
// show in menu only suppoted modes:
|
||||||
if (sfm.get(index).equals("auto")) {
|
|
||||||
items.add(getString(R.string.av_camera_focus_auto));
|
Parameters parameters = cam.getParameters();
|
||||||
itemsValues.add(AV_CAMERA_FOCUS_AUTO);
|
List<String> sfm = parameters.getSupportedFocusModes();
|
||||||
} else if (sfm.get(index).equals("fixed")) {
|
List<String> items = new ArrayList<String>();
|
||||||
items.add(getString(R.string.av_camera_focus_hiperfocal));
|
List<Integer> itemsValues = new ArrayList<Integer>();
|
||||||
itemsValues.add(AV_CAMERA_FOCUS_HIPERFOCAL);
|
// filtering known types for translate and set index:
|
||||||
} else if (sfm.get(index).equals("edof")) {
|
for (int index = 0; index < sfm.size(); index++) {
|
||||||
items.add(getString(R.string.av_camera_focus_edof));
|
if (sfm.get(index).equals("auto")) {
|
||||||
itemsValues.add(AV_CAMERA_FOCUS_EDOF);
|
items.add(getString(R.string.av_camera_focus_auto));
|
||||||
} else if (sfm.get(index).equals("infinity")) {
|
itemsValues.add(AV_CAMERA_FOCUS_AUTO);
|
||||||
items.add(getString(R.string.av_camera_focus_infinity));
|
} else if (sfm.get(index).equals("fixed")) {
|
||||||
itemsValues.add(AV_CAMERA_FOCUS_INFINITY);
|
items.add(getString(R.string.av_camera_focus_hiperfocal));
|
||||||
} else if (sfm.get(index).equals("macro")) {
|
itemsValues.add(AV_CAMERA_FOCUS_HIPERFOCAL);
|
||||||
items.add(getString(R.string.av_camera_focus_macro));
|
} else if (sfm.get(index).equals("edof")) {
|
||||||
itemsValues.add(AV_CAMERA_FOCUS_MACRO);
|
items.add(getString(R.string.av_camera_focus_edof));
|
||||||
} else if (sfm.get(index).equals("continuous-picture")) {
|
itemsValues.add(AV_CAMERA_FOCUS_EDOF);
|
||||||
items.add(getString(R.string.av_camera_focus_continuous));
|
} else if (sfm.get(index).equals("infinity")) {
|
||||||
itemsValues.add(AV_CAMERA_FOCUS_CONTINUOUS);
|
items.add(getString(R.string.av_camera_focus_infinity));
|
||||||
|
itemsValues.add(AV_CAMERA_FOCUS_INFINITY);
|
||||||
|
} else if (sfm.get(index).equals("macro")) {
|
||||||
|
items.add(getString(R.string.av_camera_focus_macro));
|
||||||
|
itemsValues.add(AV_CAMERA_FOCUS_MACRO);
|
||||||
|
} else if (sfm.get(index).equals("continuous-picture")) {
|
||||||
|
items.add(getString(R.string.av_camera_focus_continuous));
|
||||||
|
itemsValues.add(AV_CAMERA_FOCUS_CONTINUOUS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
entries = items.toArray(entries);
|
||||||
|
intValues = itemsValues.toArray(intValues);
|
||||||
|
if (entries.length > 0) {
|
||||||
|
ListPreference camFocus = createListPreference(p.AV_CAMERA_FOCUS_TYPE, entries, intValues, R.string.av_camera_focus,
|
||||||
|
R.string.av_camera_focus_descr);
|
||||||
|
grp.addPreference(camFocus);
|
||||||
|
}
|
||||||
|
// play sound on success photo:
|
||||||
|
grp.addPreference(createCheckBoxPreference(p.AV_PHOTO_PLAY_SOUND, R.string.av_photo_play_sound,
|
||||||
|
R.string.av_photo_play_sound_descr));
|
||||||
|
cam.release();
|
||||||
}
|
}
|
||||||
entries = items.toArray(entries);
|
|
||||||
intValues = itemsValues.toArray(intValues);
|
|
||||||
if (entries.length > 0) {
|
|
||||||
ListPreference camFocus = createListPreference(p.AV_CAMERA_FOCUS_TYPE, entries, intValues, R.string.av_camera_focus,
|
|
||||||
R.string.av_camera_focus_descr);
|
|
||||||
grp.addPreference(camFocus);
|
|
||||||
}
|
|
||||||
// play sound on success photo:
|
|
||||||
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:
|
// video settings:
|
||||||
grp.addPreference(createCheckBoxPreference(p.AV_EXTERNAL_RECORDER, R.string.av_use_external_recorder,
|
grp.addPreference(createCheckBoxPreference(p.AV_EXTERNAL_RECORDER, R.string.av_use_external_recorder,
|
||||||
R.string.av_use_external_recorder_descr));
|
R.string.av_use_external_recorder_descr));
|
||||||
|
|
Loading…
Reference in a new issue