@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (parent == mSpinnerGeology) { geologyIndex = position; new PreferencesUtil(getContext()).save("geologyIndex", geologyIndex); initConditions(getActivity()); initConditions(getActivity()); initConditiontValue(getActivity()); changeAllGeology(); } if (parent == mSpinnerCondition) { conditionIndex = position; initConditions(getActivity()); initConditiontValue(getActivity()); } if (parent == mSpinnerConditionValue) { conditionValueIndex = position; } String selectItem = null; try { selectItem = mSpinnerConditionValue.getSelectedItem().toString(); } catch (Exception e) { e.printStackTrace(); } slog.p(TAG, "selectItem " + selectItem); if (mETValue1 != null && mETValue2 != null) { if (selectItem != null && selectItem.equals("自定义")) { mETValue1.setVisibility(View.VISIBLE); mETValue2.setVisibility(View.VISIBLE); } else { mETValue1.setVisibility(View.GONE); mETValue2.setVisibility(View.GONE); } } }
private double getEditValue(EditText etvalue) { try { if (etvalue.getVisibility() == View.VISIBLE) { double value = Double.parseDouble(etvalue.getText().toString()); return value; } } catch (Exception e) { slog.e(TAG, "getMaxValue error mETValue1.getText() " + etvalue.getText()); e.printStackTrace(); } return -1; }
private void parser(XmlParser xmlParser, XmlPullParser xrp, String name, boolean start) { if (name == null) { return; } if (name.equals("PropertySearch")) { if (start) { bean = new GeologyBean(); } } if (name.equals("GeoObject")) { if (start) { int count = xrp.getAttributeCount(); if (count < 2) { mylog.e(TAG, "attribute count error below 2 " + count); } try { String id = xrp.getAttributeValue(0); if (id.equals("11")) { System.out.println("11"); } String attName = xrp.getAttributeValue(1); if (bean != null) { geoobj = bean.createOneGeoObj(id, attName); } else { mylog.e(TAG, "W : bean is null "); } } catch (Exception e) { mylog.e(TAG, "E : " + e); e.printStackTrace(); } } } if (name.equals("GeoCondition")) { if (start) { int count = xrp.getAttributeCount(); if (count < 3) { mylog.e(TAG, "attribute count error below 3 " + count); } try { String id = xrp.getAttributeValue(0); String attName = xrp.getAttributeValue(1); String state = xrp.getAttributeValue(2); if (geoobj != null) { condition = geoobj.createOneConditionObj(id, attName, state); } else { mylog.e(TAG, "W : geoobj is null "); } } catch (Exception e) { mylog.e(TAG, "E : " + e); e.printStackTrace(); } } } if (isValue(name)) { if (start) { try { int count = xrp.getAttributeCount(); if (count < 2) { mylog.e( TAG, "attribute count error below 2 " + count + xmlParser.debugAttributeValue(xrp)); } String id = xrp.getAttributeValue(0); String attName = xrp.getAttributeValue(1); if (condition != null) { mValues = condition.createOneVaueObj(id, attName); } } catch (Exception e) { e.printStackTrace(); } } else { mValues = null; } } if (isFvalue(name)) { if (start) { int count = xrp.getAttributeCount(); if (count < 2) { mylog.e(TAG, "attribute count error below 2 " + count); } String id = xrp.getAttributeValue(0); String attName = xrp.getAttributeValue(1); if (mValues != null) { mFvalue = mValues.createFValue(id, attName); } else if (condition != null) { slog.p(TAG, "mValues is null , use condition " + condition.name + " " + attName); mFvalue = condition.createFVaueObj(id, attName); } } } if (isSvalue(name)) { if (start) { int count = xrp.getAttributeCount(); if (count < 2) { mylog.e(TAG, "attribute count error below 2 " + count); } String id = xrp.getAttributeValue(0); String attName = xrp.getAttributeValue(1); if (mFvalue != null) { svalue = mFvalue.createSValue(id, attName); } } else { svalue = null; } } if (isTvalue(name)) { if (start) { int count = xrp.getAttributeCount(); if (count < 2) { mylog.e(TAG, "attribute count error below 2 " + count); } String id = xrp.getAttributeValue(0); String attName = xrp.getAttributeValue(1); if (svalue != null) { svalue.createSValue(id, attName); } else { mylog.e(TAG, "error svalue is null " + name); } } } }