コード例 #1
0
 private void initSpinnerGeologyValue(Context context) {
   slog.p(TAG, "initSpinnerGeologyValue ");
   ArrayList<String> str = createArrayList(bean.geoObjects);
   if (adapterGeology != null) {
     adapterGeology.clear();
     adapterGeology.addAll(str);
     adapterGeology.notifyDataSetChanged();
   } else {
     adapterGeology = new ArrayAdapter<String>(context, getAdapterLayoutID(), str);
     mSpinnerGeology.setAdapter(adapterGeology);
     mSpinnerGeology.setSelection(geologyIndex);
   }
 }
コード例 #2
0
 @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);
     }
   }
 }
コード例 #3
0
 public String getSpinnerValue(int index) {
   String value = null;
   slog.p(TAG, "getFirstSpinnerValue index is " + index);
   switch (index) {
     case 0:
       value = (String) mSpinnerFisrt.getSelectedItem();
       break;
     case 1:
       value = (String) mSpinnerGeology.getSelectedItem();
       break;
     case 2:
       value = (String) mSpinnerCondition.getSelectedItem();
       break;
     case 3:
       value = (String) mSpinnerConditionValue.getSelectedItem();
       break;
   }
   slog.p(TAG, "getFirstSpinnerValue value is " + value);
   return value;
 }
コード例 #4
0
 private void initConditions(Context context) {
   slog.p(TAG, "initConditions geologyIndex " + geologyIndex);
   ArrayList<String> str = createArrayList(bean.geoObjects.get(geologyIndex).conditions);
   if (adapterCondition != null) {
     adapterCondition.clear();
     adapterCondition.addAll(str);
     adapterCondition.notifyDataSetChanged();
   } else {
     adapterCondition = new ArrayAdapter<String>(context, getAdapterLayoutID(), str);
     mSpinnerCondition.setAdapter(adapterCondition);
   }
 }
コード例 #5
0
    public QueryItem(Context context) {
      super(context);
      LayoutInflater.from(context).inflate(R.layout.layout_condition_query_compotent, this, true);

      mSpinnerFisrt = (Spinner) findViewById(R.id.id_spner_first);
      mSpinnerGeology = (Spinner) findViewById(R.id.id_spner_geology);
      mSpinnerCondition = (Spinner) findViewById(R.id.id_spner_condition);
      mSpinnerConditionValue = (Spinner) findViewById(R.id.id_spner_condition_value);
      mETValue1 = (EditText) findViewById(R.id.id_spner_condition_custom_value1);
      mETValue2 = (EditText) findViewById(R.id.id_spner_condition_custom_value2);
      geologyIndex = new PreferencesUtil(context).getInt("geologyIndex", 0);

      initFirstValue(context);
      initSpinnerGeologyValue(context);
      initConditions(context);
      initConditiontValue(context);

      mSpinnerFisrt.setOnItemSelectedListener(this);
      mSpinnerGeology.setOnItemSelectedListener(this);
      mSpinnerCondition.setOnItemSelectedListener(this);
      mSpinnerConditionValue.setOnItemSelectedListener(this);
    }
コード例 #6
0
    private void initConditiontValue(Context context) {
      slog.p(
          TAG, "initConditions geologyIndex " + geologyIndex + " conditionIndex " + conditionIndex);

      ArrayList<Values> arrsys =
          bean.geoObjects.get(geologyIndex).conditions.get(conditionIndex).values;
      //			ArrayList<String> str = createArrayList(arrsys);

      ArrayList<String> str = new ArrayList<String>();

      getAllChildStr(arrsys, str);

      if (adapterConditionValue != null) {
        adapterConditionValue.clear();
        adapterConditionValue.addAll(str);
        adapterConditionValue.notifyDataSetChanged();
      } else {
        adapterConditionValue = new ArrayAdapter<String>(context, getAdapterLayoutID(), str);
        mSpinnerConditionValue.setAdapter(adapterConditionValue);
      }
    }
コード例 #7
0
 public void setSpinerValue(Spinner spinner, int value) {
   spinner.setSelection(value);
 }
コード例 #8
0
 public void hideFirstSpiner() {
   mSpinnerFisrt.setVisibility(View.INVISIBLE);
 }
コード例 #9
0
 private void initFirstValue(Context context) {
   ArrayAdapter<String> adapter =
       new ArrayAdapter<String>(context, getAdapterLayoutID(), new String[] {AND /*, "或者"*/});
   mSpinnerFisrt.setAdapter(adapter);
 }