/** Bindet die View an Daten. Wird gerufen, wenn sich Inhalte der View geaendert haben koennen */ @CallSuper protected void bindView() { View contentView = getView(); for (int resID : viewResIDs) { TextView view = (TextView) contentView.findViewById(resID); switch (resID) { case R.id.tvAmount: CalculatorTextCurrency ecAmount = (CalculatorTextCurrency) view; ecAmount.setValue(mUmsatz.getAsLong(R.string.column_amount, 0)); if (mUmsatz.isUmbuchung() || mUmsatz.hasSplitBuchung()) { ecAmount.setFocusable(false); } break; case R.id.actvCat: MonMaAutoCompleteTextView actvCat = (MonMaAutoCompleteTextView) view; MonMaAutoCompleteTextView.Target target = MonMaAutoCompleteTextView.Target.Categorie; actvCat.initialize(target, this); Long id = mUmsatz.getAsLong( R.string.column_catID, -mUmsatz.getAsLong(R.string.column_transferaccountID, NOID)); String text = Categorie.getCatName(id); actvCat.setText(text); if (mUmsatz.hasSplitBuchung()) { actvCat.setText(R.string.Splittbuchung); actvCat.setFocusable(false); } else { if (mUmsatz.isUmbuchung()) { actvCat.setFocusable(false); } } break; case R.id.tvBtag: AWDateTextView tvBtag = (AWDateTextView) view; tvBtag.setDate(mUmsatz.getBuchungsDatum()); break; case R.id.tvMemo: view.setText(mUmsatz.getMemo()); break; case R.id.actvPayee: MonMaAutoCompleteTextView actvPayee = (MonMaAutoCompleteTextView) view; actvPayee.setText(mUmsatz.getPartnerName()); break; } } }
@Override public void onViewCreated(View v, Bundle savedInstanceState) { super.onViewCreated(v, savedInstanceState); MonMaAutoCompleteTextView actv; for (int resID : viewResIDs) { View view = v.findViewById(resID); switch (resID) { case R.id.tvMemo: ((AWEditText) view).setOnTextChangedListener(this); break; case R.id.tvBtag: AWDateTextView dtv = (AWDateTextView) view; dtv.setOnDateChangedListener(this); break; case R.id.tvAmount: CalculatorTextCurrency ctc = (CalculatorTextCurrency) view; ctc.setOnLongValueChangedListener(this); if (mUmsatz.isUmbuchung() || mUmsatz.hasSplitBuchung()) { ctc.setFocusable(false); } break; case R.id.actvPayee: actv = (MonMaAutoCompleteTextView) view; actv.initialize(MonMaAutoCompleteTextView.Target.Payee, this); actv.setText(mUmsatz.getPartnerName()); break; case R.id.actvCat: if (mUmsatz.hasSplitBuchung() || mUmsatz.isUmbuchung()) { EditText et = (EditText) view; et.setFocusable(false); } break; } } bindView(); if (showDetails) { showDetails = false; showSplitBuchung(); } }