Пример #1
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    switch (requestCode) {
      case REQUEST_CODE_SEND_MAIL:
        break;

      case REQUEST_CODE_ADD_ITEM:
        if (resultCode == Activity.RESULT_OK) {
          data.putExtra(ITEM_ID_PARAM_NAME, ExpenseUI.PARAM_EXPENSE_ID);
        }
        break;

      case REQUEST_CODE_UPDATE_ITEM:
        if (resultCode == Activity.RESULT_OK) {
          data.putExtra(ITEM_ID_PARAM_NAME, ExpenseUI.PARAM_EXPENSE_ID);
        }
        break;

      case REQUEST_CODE_ADD_DATE_INTERVAL:
        switch (resultCode) {
          case Activity.RESULT_OK:
            dateRange.id = data.getExtras().getLong(DateIntervalUI.PARAM_DATE_INTERVAL_ID);
            // date range was set - so reset dateSelector (if set)
            dateSelector = null;
            refresh();
            break;
          case Activity.RESULT_CANCELED:
            break;
          default:
            break;
        }

        break;

      default:
        break;
    }

    super.onActivityResult(requestCode, resultCode, data);
  }
Пример #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (cardDrawable == null) {
      cardDrawable = getResources().getDrawable(R.drawable.cards);
    }
    if (cashDrawable == null) {
      cashDrawable = getResources().getDrawable(R.drawable.cash);
    }

    setHeaderTextLeft(R.string.expense_ui_title);
    setHeaderTextRight(R.string.blank);
    //		setActionDialogTitle("");

    dateRange = new DateInterval();

    SharedPreferences settings = getPreferences(MODE_PRIVATE);
    dateRange.id = settings.getLong(PREF_DATE_RANGE_ID, -1);
    typeSelector = settings.getString(PREF_TYPE_SELECTOR, null);
    categorySelector = settings.getString(PREF_CATEGORY_SELECTOR, null);
    descriptionSelector = settings.getString(PREF_DESCRIPTION_SELECTOR, null);
    dateSelector = Util.parseDateString(settings.getString(PREF_DATE_SELECTOR, null));
  }