Skip to content

Commit

Permalink
Merge branch 'hotfix/patches'
Browse files Browse the repository at this point in the history
  • Loading branch information
codinguser committed Dec 11, 2015
2 parents 6c320cf + 0f10259 commit 20c7408
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 16 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ Matthew Hague <matthewhague@zoho.com>
Spanti Nicola <rydroid_dev@yahoo.com>
Jesse Shieh <jesse.shieh.pub@gmail.com>
Terry Chung <terrywmc@gmail.com>
Caesar Wirth <cjwirth@gmail.com>
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -119,7 +119,7 @@ android {

}


compileOptions { //we want switch with strings during xml parsing
encoding "UTF-8"
sourceCompatibility JavaVersion.VERSION_1_7
Expand Down
36 changes: 22 additions & 14 deletions app/src/main/java/org/gnucash/android/export/Exporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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
* </p>
*/
protected File mCacheDir;
private final File mCacheDir;

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

Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 20c7408

Please sign in to comment.