Skip to content

Commit

Permalink
Added permission group for Gnucash and descriptive labels
Browse files Browse the repository at this point in the history
Fixed bugs
  • Loading branch information
codinguser committed Jul 22, 2012
1 parent 7838865 commit 4185aa7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
14 changes: 12 additions & 2 deletions GnucashMobile/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,24 @@
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15"/>

<permission-group
android:name="org.gnucash.android.permission.group.GNUCASH"
android:label="@string/label_permission_group"
android:description="@string/description_permission_group" />

<permission android:name="org.gnucash.android.permission.CREATE_ACCOUNT"
android:label="@string/label_permission_create_account"
android:permissionGroup="org.gnucash.android.permission.group.GNUCASH"
android:protectionLevel="dangerous" />
<permission android:name="org.gnucash.android.permission.RECORD_TRANSACTION"
android:label="@string/label_permission_record_transaction"
android:permissionGroup="org.gnucash.android.permission.group.GNUCASH"
android:protectionLevel="dangerous" />

<uses-permission android:label="@string/permission_record_transactions"
<uses-permission android:label="@string/label_permission_record_transactions"
android:name="org.gnucash.android.permission.RECORD_TRANSACTION" />
<uses-permission android:label="@string/permission_create_accounts"
<uses-permission android:label="@string/label_permission_create_accounts"
android:name="org.gnucash.android.permission.CREATE_ACCOUNT" />
<uses-permission android:label="@string/permission_access_sdcard"
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Expand Down
10 changes: 7 additions & 3 deletions GnucashMobile/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@
<string name="choose_currency">Choose default currency</string>
<string name="title_default_currency">Default currency</string>
<string name="summary_default_currency">Default currency to assign to new accounts</string>
<string name="permission_record_transactions">Enables recording transactions in Gnucash for Android</string><string name="permission_create_accounts">Enables creation of accounts in Gnucash for Android</string>
<string name="label_permission_record_transactions">Enables recording transactions in Gnucash for Android</string>
<string name="label_permission_create_accounts">Enables creation of accounts in Gnucash for Android</string>
<string name="label_permission_group">Your GnuCash data</string>
<string name="description_permission_group">Record transactions in GnuCash, read GnuCash data</string>
<string name="label_permission_record_transaction">record transactions</string>
<string name="label_permission_create_account">create accounts</string>
<string-array name="currency_names">
<item>Afghani</item>
<item>Algerian Dinar</item>
Expand Down Expand Up @@ -439,6 +444,5 @@
<item>ZWL</item>
<item>PLN</item>
</string-array>



</resources>
8 changes: 4 additions & 4 deletions GnucashMobile/src/org/gnucash/android/data/Account.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

package org.gnucash.android.data;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Currency;
import java.util.List;
Expand Down Expand Up @@ -222,10 +221,11 @@ public boolean hasUnexportedTransactions(){
* It takes into account debit and credit amounts
* @return Aggregate amount of all transactions in account.
*/
public BigDecimal getBalance(){
BigDecimal balance = new BigDecimal(0);
public Money getBalance(){
Money balance = new Money();
for (Transaction transx : mTransactionsList) {
balance.add(transx.getAmount().asBigDecimal()); }
balance = balance.add(transx.getAmount());
}
return balance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ public void onClick(View v) {
return v;
}

@Override
public void onDestroyView() {
super.onDestroyView();
mDbAdapter.close();
}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Expand Down

0 comments on commit 4185aa7

Please sign in to comment.