Skip to content

Commit

Permalink
Default export format for double-entry.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnemonic78 committed Jan 10, 2025
1 parent 9274192 commit 01fae65
Showing 1 changed file with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,8 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mBinding.inputRecurrence.setOnClickListener(new RecurrenceViewClickListener(activity, mRecurrenceRule, this));

//this part (setting the export format) must come after the recurrence view bindings above
String defaultExportFormat = sharedPrefs.getString(getString(R.string.key_default_export_format), ExportFormat.CSVT.value);
String keyDefaultExportFormat = getString(R.string.key_default_export_format);
String defaultExportFormat = sharedPrefs.getString(keyDefaultExportFormat, ExportFormat.XML.value);
mExportParams.setExportFormat(ExportFormat.of(defaultExportFormat));

RadioButton.OnCheckedChangeListener radioClickListener = new RadioButton.OnCheckedChangeListener() {
Expand All @@ -520,6 +521,19 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mBinding.radioSeparatorSemicolonFormat.setOnCheckedChangeListener(radioClickListener);

ExportFormat defaultFormat = ExportFormat.of(defaultExportFormat.toUpperCase());

if (GnuCashApplication.isDoubleEntryEnabled()) {
mBinding.radioOfxFormat.setVisibility(View.GONE);
if (defaultFormat == ExportFormat.OFX) {
defaultFormat = ExportFormat.XML;
}
} else {
mBinding.radioXmlFormat.setVisibility(View.GONE);
if (defaultFormat == ExportFormat.XML) {
defaultFormat = ExportFormat.OFX;
}
}

switch (defaultFormat) {
case QIF:
mBinding.radioQifFormat.performClick();
Expand All @@ -536,12 +550,6 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
break;
}

if (GnuCashApplication.isDoubleEntryEnabled()) {
mBinding.radioOfxFormat.setVisibility(View.GONE);
} else {
mBinding.radioXmlFormat.setVisibility(View.GONE);
}

}

/**
Expand Down

0 comments on commit 01fae65

Please sign in to comment.