diff --git a/CHANGELOG.md b/CHANGELOG.md index 80e01a7d4..8acd01ee4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ Change Log =============================================================================== +Version 2.0.5 *(2015-12-12)* +---------------------------- +* Fixed: Wrong decimal formatting in multi-currency transactions +* Improved: Reliability of exports + Version 2.0.4 *(2015-12-02)* ---------------------------- * Fixed: Transaction export time not always working reliably diff --git a/CONTRIBUTORS b/CONTRIBUTORS index fb10c0231..2c70b48bf 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -29,3 +29,4 @@ Matthew Hague Spanti Nicola Jesse Shieh Terry Chung +Caesar Wirth diff --git a/app/build.gradle b/app/build.gradle index 3280e903d..1a8df8fca 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'io.fabric' def versionMajor = 2 def versionMinor = 0 -def versionPatch = 4 +def versionPatch = 5 def versionBuild = 0 def buildTime() { @@ -119,7 +119,7 @@ android { } - + compileOptions { //we want switch with strings during xml parsing encoding "UTF-8" sourceCompatibility JavaVersion.VERSION_1_7 diff --git a/app/src/main/java/org/gnucash/android/export/Exporter.java b/app/src/main/java/org/gnucash/android/export/Exporter.java index 7e2878a8d..dc956fd99 100644 --- a/app/src/main/java/org/gnucash/android/export/Exporter.java +++ b/app/src/main/java/org/gnucash/android/export/Exporter.java @@ -58,7 +58,7 @@ public abstract class Exporter { /** * Application folder on external storage */ - public static final String BASE_FOLDER_PATH = Environment.getExternalStorageDirectory() + "/" + BuildConfig.APPLICATION_ID; + private static final String BASE_FOLDER_PATH = Environment.getExternalStorageDirectory() + "/" + BuildConfig.APPLICATION_ID; /** * Folder where exports like QIF and OFX will be saved for access by external programs @@ -73,7 +73,7 @@ public abstract class Exporter { /** * Export options */ - protected ExportParams mExportParams; + protected final ExportParams mExportParams; /** * Cache directory to which files will be first exported before moved to final destination. @@ -82,7 +82,7 @@ public abstract class Exporter { * The files created here are only accessible within this application, and should be copied to SD card before they can be shared *

*/ - protected File mCacheDir; + private final File mCacheDir; private static final SimpleDateFormat EXPORT_FILENAME_DATE_FORMAT = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US); @@ -96,13 +96,14 @@ public abstract class Exporter { * Adapter for retrieving accounts to export * Subclasses should close this object when they are done with exporting */ - protected AccountsDbAdapter mAccountsDbAdapter; - protected TransactionsDbAdapter mTransactionsDbAdapter; - protected SplitsDbAdapter mSplitsDbAdapter; - protected ScheduledActionDbAdapter mScheduledActionDbAdapter; - protected PricesDbAdapter mPricesDbAdapter; - protected CommoditiesDbAdapter mCommoditiesDbAdapter; - protected Context mContext; + protected final AccountsDbAdapter mAccountsDbAdapter; + protected final TransactionsDbAdapter mTransactionsDbAdapter; + protected final SplitsDbAdapter mSplitsDbAdapter; + protected final ScheduledActionDbAdapter mScheduledActionDbAdapter; + protected final PricesDbAdapter mPricesDbAdapter; + protected final CommoditiesDbAdapter mCommoditiesDbAdapter; + protected final Context mContext; + private String mExportCacheFilePath; public Exporter(ExportParams params, SQLiteDatabase db) { this.mExportParams = params; @@ -123,6 +124,7 @@ public Exporter(ExportParams params, SQLiteDatabase db) { mCommoditiesDbAdapter = new CommoditiesDbAdapter(db); } + mExportCacheFilePath = null; mCacheDir = new File(mContext.getCacheDir(), params.getExportFormat().name()); mCacheDir.mkdir(); purgeDirectory(mCacheDir); @@ -184,10 +186,16 @@ private void purgeDirectory(File directory){ * @return Absolute path to file */ protected String getExportCacheFilePath(){ - String cachePath = mCacheDir.getAbsolutePath(); - if (!cachePath.endsWith("/")) - cachePath += "/"; - return cachePath + buildExportFilename(mExportParams.getExportFormat()); + // The file name contains a timestamp, so ensure it doesn't change with multiple calls to + // avoid issues like #448 + if (mExportCacheFilePath == null) { + String cachePath = mCacheDir.getAbsolutePath(); + if (!cachePath.endsWith("/")) + cachePath += "/"; + mExportCacheFilePath = cachePath + buildExportFilename(mExportParams.getExportFormat()); + } + + return mExportCacheFilePath; } /** diff --git a/app/src/main/java/org/gnucash/android/ui/transaction/TransactionFormFragment.java b/app/src/main/java/org/gnucash/android/ui/transaction/TransactionFormFragment.java index 48db0b815..fd4486d13 100644 --- a/app/src/main/java/org/gnucash/android/ui/transaction/TransactionFormFragment.java +++ b/app/src/main/java/org/gnucash/android/ui/transaction/TransactionFormFragment.java @@ -494,6 +494,9 @@ private void initializeViewsWithTransaction(){ Currency accountCurrency = Currency.getInstance(currencyCode); mCurrencyTextView.setText(accountCurrency.getSymbol()); + Commodity commodity = Commodity.getInstance(currencyCode); + mAmountEditText.setCommodity(commodity); + mSaveTemplateCheckbox.setChecked(mTransaction.isTemplate()); String scheduledActionUID = getArguments().getString(UxArgument.SCHEDULED_ACTION_UID); if (scheduledActionUID != null && !scheduledActionUID.isEmpty()) { @@ -544,6 +547,9 @@ private void initalizeViews() { Currency accountCurrency = Currency.getInstance(code); mCurrencyTextView.setText(accountCurrency.getSymbol()); + Commodity commodity = Commodity.getInstance(code); + mAmountEditText.setCommodity(commodity); + if (mUseDoubleEntry){ String currentAccountUID = mAccountUID; long defaultTransferAccountID = 0;