Skip to content

Commit 20c7408

Browse files
committed
Merge branch 'hotfix/patches'
2 parents 6c320cf + 0f10259 commit 20c7408

File tree

5 files changed

+36
-16
lines changed

5 files changed

+36
-16
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Change Log
22
===============================================================================
3+
Version 2.0.5 *(2015-12-12)*
4+
----------------------------
5+
* Fixed: Wrong decimal formatting in multi-currency transactions
6+
* Improved: Reliability of exports
7+
38
Version 2.0.4 *(2015-12-02)*
49
----------------------------
510
* Fixed: Transaction export time not always working reliably

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ Matthew Hague <[email protected]>
2929
Spanti Nicola <[email protected]>
3030
Jesse Shieh <[email protected]>
3131
Terry Chung <[email protected]>
32+
Caesar Wirth <[email protected]>

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apply plugin: 'io.fabric'
55

66
def versionMajor = 2
77
def versionMinor = 0
8-
def versionPatch = 4
8+
def versionPatch = 5
99
def versionBuild = 0
1010

1111
def buildTime() {
@@ -119,7 +119,7 @@ android {
119119

120120
}
121121

122-
122+
123123
compileOptions { //we want switch with strings during xml parsing
124124
encoding "UTF-8"
125125
sourceCompatibility JavaVersion.VERSION_1_7

app/src/main/java/org/gnucash/android/export/Exporter.java

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public abstract class Exporter {
5858
/**
5959
* Application folder on external storage
6060
*/
61-
public static final String BASE_FOLDER_PATH = Environment.getExternalStorageDirectory() + "/" + BuildConfig.APPLICATION_ID;
61+
private static final String BASE_FOLDER_PATH = Environment.getExternalStorageDirectory() + "/" + BuildConfig.APPLICATION_ID;
6262

6363
/**
6464
* Folder where exports like QIF and OFX will be saved for access by external programs
@@ -73,7 +73,7 @@ public abstract class Exporter {
7373
/**
7474
* Export options
7575
*/
76-
protected ExportParams mExportParams;
76+
protected final ExportParams mExportParams;
7777

7878
/**
7979
* Cache directory to which files will be first exported before moved to final destination.
@@ -82,7 +82,7 @@ public abstract class Exporter {
8282
* The files created here are only accessible within this application, and should be copied to SD card before they can be shared
8383
* </p>
8484
*/
85-
protected File mCacheDir;
85+
private final File mCacheDir;
8686

8787
private static final SimpleDateFormat EXPORT_FILENAME_DATE_FORMAT = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US);
8888

@@ -96,13 +96,14 @@ public abstract class Exporter {
9696
* Adapter for retrieving accounts to export
9797
* Subclasses should close this object when they are done with exporting
9898
*/
99-
protected AccountsDbAdapter mAccountsDbAdapter;
100-
protected TransactionsDbAdapter mTransactionsDbAdapter;
101-
protected SplitsDbAdapter mSplitsDbAdapter;
102-
protected ScheduledActionDbAdapter mScheduledActionDbAdapter;
103-
protected PricesDbAdapter mPricesDbAdapter;
104-
protected CommoditiesDbAdapter mCommoditiesDbAdapter;
105-
protected Context mContext;
99+
protected final AccountsDbAdapter mAccountsDbAdapter;
100+
protected final TransactionsDbAdapter mTransactionsDbAdapter;
101+
protected final SplitsDbAdapter mSplitsDbAdapter;
102+
protected final ScheduledActionDbAdapter mScheduledActionDbAdapter;
103+
protected final PricesDbAdapter mPricesDbAdapter;
104+
protected final CommoditiesDbAdapter mCommoditiesDbAdapter;
105+
protected final Context mContext;
106+
private String mExportCacheFilePath;
106107

107108
public Exporter(ExportParams params, SQLiteDatabase db) {
108109
this.mExportParams = params;
@@ -123,6 +124,7 @@ public Exporter(ExportParams params, SQLiteDatabase db) {
123124
mCommoditiesDbAdapter = new CommoditiesDbAdapter(db);
124125
}
125126

127+
mExportCacheFilePath = null;
126128
mCacheDir = new File(mContext.getCacheDir(), params.getExportFormat().name());
127129
mCacheDir.mkdir();
128130
purgeDirectory(mCacheDir);
@@ -184,10 +186,16 @@ private void purgeDirectory(File directory){
184186
* @return Absolute path to file
185187
*/
186188
protected String getExportCacheFilePath(){
187-
String cachePath = mCacheDir.getAbsolutePath();
188-
if (!cachePath.endsWith("/"))
189-
cachePath += "/";
190-
return cachePath + buildExportFilename(mExportParams.getExportFormat());
189+
// The file name contains a timestamp, so ensure it doesn't change with multiple calls to
190+
// avoid issues like #448
191+
if (mExportCacheFilePath == null) {
192+
String cachePath = mCacheDir.getAbsolutePath();
193+
if (!cachePath.endsWith("/"))
194+
cachePath += "/";
195+
mExportCacheFilePath = cachePath + buildExportFilename(mExportParams.getExportFormat());
196+
}
197+
198+
return mExportCacheFilePath;
191199
}
192200

193201
/**

app/src/main/java/org/gnucash/android/ui/transaction/TransactionFormFragment.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,9 @@ private void initializeViewsWithTransaction(){
494494
Currency accountCurrency = Currency.getInstance(currencyCode);
495495
mCurrencyTextView.setText(accountCurrency.getSymbol());
496496

497+
Commodity commodity = Commodity.getInstance(currencyCode);
498+
mAmountEditText.setCommodity(commodity);
499+
497500
mSaveTemplateCheckbox.setChecked(mTransaction.isTemplate());
498501
String scheduledActionUID = getArguments().getString(UxArgument.SCHEDULED_ACTION_UID);
499502
if (scheduledActionUID != null && !scheduledActionUID.isEmpty()) {
@@ -544,6 +547,9 @@ private void initalizeViews() {
544547
Currency accountCurrency = Currency.getInstance(code);
545548
mCurrencyTextView.setText(accountCurrency.getSymbol());
546549

550+
Commodity commodity = Commodity.getInstance(code);
551+
mAmountEditText.setCommodity(commodity);
552+
547553
if (mUseDoubleEntry){
548554
String currentAccountUID = mAccountUID;
549555
long defaultTransferAccountID = 0;

0 commit comments

Comments
 (0)