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 Jan 26, 2015
2 parents 656046b + 8eeb0c8 commit ed05399
Show file tree
Hide file tree
Showing 27 changed files with 56 additions and 29 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
Change Log
===============================================================================
Version 1.5.2 *(2015-01-26)*
----------------------------
* Fixed: Crash when importing XML with TRADING accounts
* Fixed: Full name not updated when account name is changed
* Fixed: Toggle button shown when double-entry is disabled
* Fixed: Amount input problems on some devices or keyboards
* Fixed: Crash when changing the parent of an account
* Fixed: Deleting a transaction only deletes some splits, not the whole.

Version 1.5.1 *(2014-10-08)*
----------------------------
* Fixed: Crash when upgrading from v1.4.x to v1.5.x
Expand Down
5 changes: 4 additions & 1 deletion CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ Pedro Abel <[email protected]>
windwarrior <[email protected]>
Oleksandr Tyshkovets <[email protected]>
Lei Xiao Bao <[email protected]>
Yongxin Wang <[email protected]>
Yongxin Wang <[email protected]>
Matthew Hague <[email protected]>
Spanti Nicola <[email protected]>
Jesse Shieh <[email protected]>
2 changes: 1 addition & 1 deletion app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.gnucash.android"
android:versionCode="43"
android:versionCode="45"
android:versionName="@string/app_version_name" >

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>
Expand Down
2 changes: 1 addition & 1 deletion app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<description>Gnucash Android companion application</description>

<parent>
<version>1.5.1-SNAPSHOT</version>
<version>1.5.2-SNAPSHOT</version>
<groupId>org.gnucash.android</groupId>
<artifactId>gnucash-android-parent</artifactId>
</parent>
Expand Down
1 change: 1 addition & 0 deletions app/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@
<item>WÄHRUNG</item>
<item>AKTIENKONTO</item>
<item>INVESTMENTFONDS</item>
<item>TRADING</item>
</string-array>
<string-array name="export_formats">
<item>QIF</item>
Expand Down
1 change: 1 addition & 0 deletions app/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@
<item>ΝΟΜΙΣΜΑ</item>
<item>ΜΕΤΟΧΗ</item>
<item>ΑΜΟΙΒΑΙΟ ΚΕΦΑΛΑΙΟ</item>
<item>TRADING</item>
</string-array>
<string-array name="export_formats">
<item>QIF</item>
Expand Down
1 change: 1 addition & 0 deletions app/res/values-es-rMX/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@
<item>DIVISA</item>
<item>ACCIONES</item>
<item>FONDOS</item>
<item>TRADING</item>
</string-array>
<string-array name="export_formats">
<item>QIF</item>
Expand Down
1 change: 1 addition & 0 deletions app/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@
<item>DIVISA</item>
<item>ACCIONES</item>
<item>FONDOS</item>
<item>TRADING</item>
</string-array>
<string-array name="export_formats">
<item>QIF</item>
Expand Down
1 change: 1 addition & 0 deletions app/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@
<item>DEVISES</item>
<item>ACTIONS</item>
<item>FONDS COMMUNS</item>
<item>TRADING</item>
</string-array>
<string-array name="export_formats">
<item>QIF</item>
Expand Down
1 change: 1 addition & 0 deletions app/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@
<item>CURRENCY</item>
<item>STOCK</item>
<item>MUTUAL FUND</item>
<item>TRADING</item>
</string-array>
<string-array name="export_formats">
<item>QIF</item>
Expand Down
1 change: 1 addition & 0 deletions app/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@
<item>VALUTA</item>
<item>AZIONE</item>
<item>FONDO COMUNE</item>
<item>TRADING</item>
</string-array>
<string-array name="export_formats">
<item>QIF</item>
Expand Down
1 change: 1 addition & 0 deletions app/res/values-nb/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@
<item>VALUTA</item>
<item>AKSJE</item>
<item>AKSJEFOND</item>
<item>TRADING</item>
</string-array>
<string-array name="export_formats">
<item>QIF</item>
Expand Down
1 change: 1 addition & 0 deletions app/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@
<item>CURRENCY</item>
<item>STOCK</item>
<item>MUTUAL FUND</item>
<item>TRADING</item>
</string-array>
<string-array name="export_formats">
<item>QIF</item>
Expand Down
1 change: 1 addition & 0 deletions app/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@
<item>CURRENCY</item>
<item>AÇÕES</item>
<item>FUNDO MÚTUO</item>
<item>TRADING</item>
</string-array>
<string-array name="export_formats">
<item>QIF</item>
Expand Down
1 change: 1 addition & 0 deletions app/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@
<item>СОБСТВЕННЫЕ СРЕДСТВА</item>
<item>ТОРГОВЛЯ</item>
<item>ВЗАИМНЫЙ ФОНД</item>
<item>TRADING</item>
</string-array>
<string-array name="export_formats">
<item>QIF</item>
Expand Down
1 change: 1 addition & 0 deletions app/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@
<item>货币</item>
<item>股票</item>
<item>共同基金</item>
<item>TRADING</item>
</string-array>
<string-array name="export_formats">
<item>QIF</item>
Expand Down
1 change: 1 addition & 0 deletions app/res/values/key_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<item>CURRENCY</item>
<item>STOCK</item>
<item>MUTUAL</item>
<item>TRADING</item>
</string-array>
<string-array name="key_export_format_values">
<item>QIF</item>
Expand Down
3 changes: 2 additions & 1 deletion app/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name">GnuCash</string>
<string name="app_version_name">1.5.1</string>
<string name="app_version_name">1.5.2</string>
<string name="title_add_account">Create Account</string>
<string name="title_edit_account">Edit Account</string>
<string name="info_details">Info</string>
Expand Down Expand Up @@ -376,6 +376,7 @@
<item>CURRENCY</item>
<item>STOCK</item>
<item>MUTUAL FUND</item>
<item>TRADING</item>
</string-array>
<string-array name="export_formats">
<item>QIF</item>
Expand Down
8 changes: 2 additions & 6 deletions app/src/org/gnucash/android/db/TransactionsDbAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -546,14 +546,10 @@ public Cursor fetchRecord(long rowId) {
* @return Cursor to the data set containing all matching transactions
*/
public Cursor fetchTransactionsStartingWith(String prefix){
StringBuffer stringBuffer = new StringBuffer(TransactionEntry.COLUMN_DESCRIPTION)
.append(" LIKE '").append(prefix).append("%'");
String selection = stringBuffer.toString();

return mDb.query(TransactionEntry.TABLE_NAME,
new String[]{TransactionEntry._ID, TransactionEntry.COLUMN_DESCRIPTION},
selection,
null, null, null,
TransactionEntry.COLUMN_DESCRIPTION + " LIKE ?",
new String[]{prefix+"%"}, null, null,
TransactionEntry.COLUMN_DESCRIPTION + " ASC");
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/org/gnucash/android/model/AccountType.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public enum AccountType {
CASH(TransactionType.DEBIT), BANK(TransactionType.DEBIT), CREDIT, ASSET(TransactionType.DEBIT), LIABILITY,
INCOME, EXPENSE(TransactionType.DEBIT), PAYABLE, RECEIVABLE(TransactionType.DEBIT), EQUITY, CURRENCY,
STOCK(TransactionType.DEBIT), MUTUAL(TransactionType.DEBIT), ROOT;
STOCK(TransactionType.DEBIT), MUTUAL(TransactionType.DEBIT), TRADING, ROOT;

/**
* Indicates that this type of normal balance the account type has
Expand Down
19 changes: 11 additions & 8 deletions app/src/org/gnucash/android/ui/account/AccountFormFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -554,10 +554,10 @@ private void loadParentAccountList(AccountType accountType){

if (mAccount != null){ //if editing an account
mDescendantAccountUIDs = mAccountsDbAdapter.getDescendantAccountUIDs(mAccount.getUID(), null, null);
mDescendantAccountUIDs.add(mAccountUID); //cannot set self as parent
// limit cyclic account hierarchies.
condition += " AND (" + DatabaseSchema.AccountEntry.COLUMN_PARENT_ACCOUNT_UID + " IS NULL "
+ " OR " + DatabaseSchema.AccountEntry.COLUMN_UID + " NOT IN ( '" + TextUtils.join("','", mDescendantAccountUIDs) + "' ) )";
+ " OR " + DatabaseSchema.AccountEntry.COLUMN_UID + " NOT IN ( '"
+ TextUtils.join("','", mDescendantAccountUIDs) + "','" + mAccountUID + "' ) )";
}

//if we are reloading the list, close the previous cursor first
Expand Down Expand Up @@ -684,6 +684,7 @@ public void onDestroy() {
private void saveAccount() {
// accounts to update, in case we're updating full names of a sub account tree
ArrayList<Account> accountsToUpdate = new ArrayList<Account>();
boolean nameChanged = false;
if (mAccount == null){
String name = getEnteredName();
if (name == null || name.length() == 0){
Expand All @@ -694,8 +695,10 @@ private void saveAccount() {
}
mAccount = new Account(getEnteredName());
}
else
mAccount.setName(getEnteredName());
else {
nameChanged = !mAccount.getName().equals(getEnteredName());
mAccount.setName(getEnteredName());
}

String curCode = mCurrencyCodes.get(mCurrencySpinner
.getSelectedItemPosition());
Expand Down Expand Up @@ -730,8 +733,8 @@ private void saveAccount() {

long parentAccountId = mAccountsDbAdapter.getID(mParentAccountUID);
// update full names
if (mDescendantAccountUIDs == null || newParentAccountId != parentAccountId) {
// new Account or parent account changed
if (nameChanged || mDescendantAccountUIDs == null || newParentAccountId != parentAccountId) {
// current account name changed or new Account or parent account changed
String newAccountFullName;
if (newParentAccountId == mRootAccountId){
newAccountFullName = mAccount.getName();
Expand All @@ -742,8 +745,8 @@ private void saveAccount() {
}
mAccount.setFullName(newAccountFullName);
if (mDescendantAccountUIDs != null) {
// modifying existing account
if (parentAccountId != newParentAccountId && mDescendantAccountUIDs.size() > 0) {
// modifying existing account, e.t. name changed and/or parent changed
if ((nameChanged || parentAccountId != newParentAccountId) && mDescendantAccountUIDs.size() > 0) {
// parent change, update all full names of descent accounts
accountsToUpdate.addAll(mAccountsDbAdapter.getSimpleAccountList(
DatabaseSchema.AccountEntry.COLUMN_UID + " IN ('" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public CharSequence convertToString(Cursor cursor) {
adapter.setFilterQueryProvider(new FilterQueryProvider() {
@Override
public Cursor runQuery(CharSequence name) {
return mTransactionsDbAdapter.fetchTransactionsStartingWith(name.toString());
return mTransactionsDbAdapter.fetchTransactionsStartingWith(name==null?"":name.toString());
}
});

Expand Down Expand Up @@ -343,15 +343,17 @@ private void initializeViewsWithTransaction(){

//if there are more than two splits (which is the default for one entry), then
//disable editing of the transfer account. User should open editor
if (mTransaction.getSplits().size() > 2) {
setAmountEditViewVisible(View.GONE);
} else {
if (mSplitsList.size() == 2 && mSplitsList.get(0).isPairOf(mSplitsList.get(1))) {
for (Split split : mTransaction.getSplits()) {
//two splits, one belongs to this account and the other to another account
if (mUseDoubleEntry && !split.getAccountUID().equals(mAccountUID)) {
setSelectedTransferAccount(mAccountsDbAdapter.getAccountID(split.getAccountUID()));
}
}
} else {
if (mUseDoubleEntry) {
setAmountEditViewVisible(View.GONE);
}
}
mSplitsList = new ArrayList<Split>(mTransaction.getSplits()); //we need a copy so we can modify with impunity
mAmountEditText.setEnabled(mSplitsList.size() <= 2);
Expand Down Expand Up @@ -720,6 +722,7 @@ public void setSplitList(List<Split> splitList, List<String> removedSplitUIDs){
Money balance = Transaction.computeBalance(mAccountUID, mSplitsList);

mAmountEditText.setText(balance.toPlainString());
mTransactionTypeButton.setChecked(balance.isNegative());
//once we set the split list, do not allow direct editing of the total
if (mSplitsList.size() > 1){
mAmountEditText.setEnabled(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,9 @@ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
return true;

case R.id.context_menu_delete:
SplitsDbAdapter splitsDbAdapter = new SplitsDbAdapter(getActivity());
for (long id : getListView().getCheckedItemIds()) {
splitsDbAdapter.deleteSplitsForTransactionAndAccount(mTransactionsDbAdapter.getUID(id), mAccountUID);
mTransactionsDbAdapter.deleteRecord(id);
}
splitsDbAdapter.close();
refresh();
mode.finish();
WidgetConfigurationActivity.updateAllWidgets(getActivity());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public AmountInputFormatter(EditText amountInput) {

@Override
public void afterTextChanged(Editable s) {
if (s.length() == 0)
if (s.length() == 0 || s.toString().equals(current))
return;
//make sure that the sign of the input is in line with the type button state
BigDecimal amount = TransactionFormFragment.parseInputToDecimal(s.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public void setAccountType(AccountType accountType){
break;
case CURRENCY:
case ROOT:
default:
setTextOn(context.getString(R.string.label_debit));
setTextOff(context.getString(R.string.label_credit));
break;
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<version>1.5.1-SNAPSHOT</version>
<version>1.5.2-SNAPSHOT</version>
<groupId>org.gnucash.android</groupId>
<artifactId>gnucash-android-parent</artifactId>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>1.5.1-SNAPSHOT</version>
<version>1.5.2-SNAPSHOT</version>
<groupId>org.gnucash.android</groupId>
<artifactId>gnucash-android-parent</artifactId>
<name>GnuCash Android parent</name>
Expand Down

0 comments on commit ed05399

Please sign in to comment.