Skip to content

Commit 52f7297

Browse files
committed
Merge branch 'develop'
2 parents bcdab71 + 65e3fbc commit 52f7297

File tree

186 files changed

+2638
-3144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+2638
-3144
lines changed

.github/CONTRIBUTING.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
GnuCash Android is built by people like you! Please [join us](https://github.com/codinguser/gnucash-android).
22

3-
## Git and Pull requests
3+
## Reporting Issues
4+
* The GitHub issue tracker is used for collecting and managing bugs, feature requests and general development planning.
5+
* When creating a request, first search to make sure a similar one doesn't already exist in the tracker.
6+
* Be as specific as possible when providing descriptions of the problems encountered and what the expected behaviour should be.
7+
* It is also possible to report issues by creating tickets directly from within the app (in the Help Center)
8+
9+
## Code Contributions
410
* Contributions are submitted, reviewed, and accepted using Github pull requests. [Read this article](https://help.github.com/articles/using-pull-requests) for some details. We use the _Fork and Pull_ model, as described there.
511
* You can maintain your stable installation of GnuCash and test with another installation.
612
The two instances of GnuCash Android will live side-by-side on your device and not affect each other. You can install the development version by executing `gradle installDD` inside the root project directory
@@ -18,8 +24,8 @@ The two instances of GnuCash Android will live side-by-side on your device and n
1824
* Try to make clean commits that are easily readable (including descriptive commit messages!)
1925
* Test before you push make sure all test pass on your machine.
2026
* Unit tests can be run with `gradle test`
21-
* UI tests can be run with `gradle cDDAT`
22-
* Make small pull requests that are easy to review but make sure they do add value by themselves.
27+
* UI tests can be run with `gradle spoonDD`. This will run the tests on all connected devices/emulators.
28+
* Make small pull requests that are easy to review but which also add value.
2329

2430
## Coding style
2531
* Do write comments. You don't have to comment every line, but if you come up with something thats a bit complex/weird, just leave a comment. Bear in mind that you will probably leave the project at some point and that other people will read your code. Undocumented huge amounts of code are nearly worthless!

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ android:
55
- platform-tools
66
- tools
77
- tools #not a typo. Needed for SDK update
8-
- build-tools-24.0.3
8+
- build-tools-25.0.0
99

1010
# The SDK version used to compile your project
1111
- android-24

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
Change Log
22
===============================================================================
3+
Version 2.2.0 *(2017-05-05)*
4+
----------------------------
5+
* Feature #646: Option to select backup file using Storage Access Framework
6+
* Feature #565: Regular automatic backups (even when not explicitly set by user)
7+
* Feature #656: Added Bitcoin (BTC) currency support
8+
* Feature #634: Added support for renaming books
9+
* Fixed #672: Crash when exporting multi-currency transactions to Google Drive
10+
* Fixed #654: Crash when editing account if its default transfer account no longer exists
11+
* Fixed #625: Hourly backups were being executed on a monthly basis
12+
* Fixed #607: Widgets stop functioning after switching books
13+
* Fixed #641: Weekday is ignored for weekly scheduled actions
14+
* Improved #635: Improved support for BYN currency
15+
* Improved #661: Removed need for WRITE_EXTERNAL_STORAGE permission for Android 4.4 (KitKat) and above
16+
* This release raises the minimum API level to 19 (KitKat)
17+
318
Version 2.1.7 *(2017-04-18)*
419
----------------------------
520
* Properly handle crashes during migration of backup/export files to new location

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@ Accounts | Transactions | Reports
1111
:-------------------------:|:-------------------------:|:-------------------------:
1212
![Accounts List](docs/images/v2.0.0_home.png) | ![Transactions List](docs/images/v2.0.0_transactions_list.png) | ![Reports](docs/images/v2.0.0_reports.png)
1313

14-
The application supports Android 2.3.3 Gingerbread (API level 10) and above.
14+
The application supports Android 4.4 KitKat (API level 10) and above.
1515

1616
Features include:
1717

1818
* An easy-to-use interface.
1919

20-
* Chart of Accounts: A master account can have a hierarchy of detail accounts underneath it.
20+
* **Chart of Accounts**: A master account can have a hierarchy of detail accounts underneath it.
2121
This allows similar account types (e.g. Cash, Bank, Stock) to be grouped into one master account (e.g. Assets).
2222

23-
* Split Transactions: A single transaction can be split into several pieces to record taxes, fees, and other compound entries.
23+
* **Split Transactions**: A single transaction can be split into several pieces to record taxes, fees, and other compound entries.
2424

25-
* Double Entry: Every transaction must debit one account and credit another by an equal amount.
25+
* **Double Entry**: Every transaction must debit one account and credit another by an equal amount.
2626
This ensures that the "books balance": that the difference between income and outflow exactly
2727
equals the sum of all assets, be they bank, cash, stock or other.
2828

29-
* Income/Expense Account Types (Categories): These serve not only to categorize your cash flow, but when used properly with the double-entry feature, these can provide an accurate Profit&Loss statement.
29+
* **Income/Expense Account Types (Categories)**: These serve not only to categorize your cash flow, but when used properly with the double-entry feature, these can provide an accurate Profit&Loss statement.
3030

31-
* Scheduled Transactions: GnuCash has the ability to automatically create and enter transactions.
31+
* **Scheduled Transactions**: GnuCash has the ability to automatically create and enter transactions.
3232

33-
* Export to GnuCash XML, QIF or OFX. Also, scheduled exports to 3rd-party sync services like DropBox and Google Drive
33+
* **Export to GnuCash XML**, QIF or OFX. Also, scheduled exports to 3rd-party sync services like DropBox and Google Drive
3434

35-
* Reports: View summary of transactions (income and expenses) as pie/bar/line charts
35+
* **Reports**: View summary of transactions (income and expenses) as pie/bar/line charts
3636

3737

3838
# Installation
@@ -88,17 +88,17 @@ Google+ Community: https://plus.google.com/communities/104728406764752407046
8888

8989
There are several ways you could contribute to the development.
9090

91+
* Pull requests are always welcome! You could contribute code by fixing bugs, adding new features or automated tests.
92+
Take a look at the [bug tracker](https://github.com/codinguser/gnucash-android/issues?state=open)
93+
for ideas where to start. Also make sure to read our [contribution guidlines](https://github.com/codinguser/gnucash-android/blob/master/.github/CONTRIBUTING.md)
94+
9195
* One way is providing translations for locales which are not yet available, or improving translations.
9296
Please visit [CrowdIn](https://crowdin.com/project/gnucash-android) in order to update and create new translations
9397

94-
* You could as well contribute code, fixing bugs, new features or automated tests. Pull requests are always welcome.
95-
Take a look at the [bug tracker](https://github.com/codinguser/gnucash-android/issues?state=open)
96-
for ideas where to start. Also take a look at the [contribution guidlines](https://github.com/codinguser/gnucash-android/blob/master/.github/CONTRIBUTING.md)
97-
9898
For development, it is recommended to use the Android Studio for development which is available for free.
9999
Import the project into the IDE using the build.gradle file. The IDE will resolve dependencies automatically.
100100

101-
#Licence
101+
# Licence
102102
GnuCash Android is free software; you can redistribute it and/or
103103
modify it under the terms of the Apache license, version 2.0.
104104
You may obtain a copy of the License at

app/build.gradle

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ apply plugin: 'io.fabric'
55
apply plugin: 'android-apt'
66

77
def versionMajor = 2
8-
def versionMinor = 1
9-
def versionPatch = 7
10-
def versionBuild = 0
8+
def versionMinor = 2
9+
def versionPatch = 0
10+
def versionBuild = 4
1111

1212
def buildTime() {
1313
def df = new SimpleDateFormat("yyyyMMdd HH:mm 'UTC'")
@@ -22,11 +22,11 @@ def gitSha() {
2222

2323
android {
2424
compileSdkVersion 24
25-
buildToolsVersion '24.0.3'
25+
buildToolsVersion '25.0.0'
2626
defaultConfig {
2727
applicationId "org.gnucash.android"
2828
testApplicationId 'org.gnucash.android.test'
29-
minSdkVersion 10
29+
minSdkVersion 19
3030
targetSdkVersion 23
3131
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
3232
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
@@ -85,6 +85,7 @@ android {
8585
}
8686
debug {
8787
debuggable true
88+
minifyEnabled false
8889
// testCoverageEnabled true
8990
signingConfig signingConfigs.debug
9091
}
@@ -167,6 +168,7 @@ afterEvaluate {
167168
spoon {
168169
debug = true
169170
grantAllPermissions = true
171+
codeCoverage = true
170172
}
171173
initCrashlyticsPropertiesIfNeeded()
172174
}
@@ -190,7 +192,7 @@ android.productFlavors.all { flavour ->
190192
}
191193

192194

193-
def androidSupportVersion = "24.2.1"
195+
def androidSupportVersion = "25.3.1"
194196
def androidEspressoVersion = "2.2.2"
195197
def androidSupportTestVersion = "0.5"
196198

@@ -209,31 +211,32 @@ dependencies {
209211
'com.android.support:cardview-v7:' + androidSupportVersion,
210212
'com.android.support:preference-v7:' + androidSupportVersion,
211213
'com.android.support:recyclerview-v7:' + androidSupportVersion,
212-
'com.code-troopers.betterpickers:library:3.0.1',
214+
'com.code-troopers.betterpickers:library:3.1.0',
213215
'org.jraf:android-switch-backport:2.0.1@aar',
214216
'com.github.PhilJay:MPAndroidChart:v2.1.3',
215217
'joda-time:joda-time:2.9.4',
216218
'com.google.android.gms:play-services-drive:9.6.1',
217-
'io.github.kobakei:ratethisapp:1.1.0',
219+
'io.github.kobakei:ratethisapp:1.1.3',
218220
'com.squareup:android-times-square:1.6.5@aar',
219221
'com.github.techfreak:wizardpager:1.0.3',
220222
'net.objecthunter:exp4j:0.4.7',
221223
'org.apache.jackrabbit:jackrabbit-webdav:2.13.3',
222224
'com.dropbox.core:dropbox-core-sdk:2.1.2',
223-
'com.facebook.stetho:stetho:1.4.1',
224225
'com.android.support:multidex:1.0.1'
225226
)
226227

227-
compile 'com.jakewharton:butterknife:8.4.0'
228-
apt 'com.jakewharton:butterknife-compiler:8.4.0'
228+
debugCompile 'com.facebook.stetho:stetho:1.4.2'
229+
230+
compile 'com.jakewharton:butterknife:8.5.1'
231+
apt 'com.jakewharton:butterknife-compiler:8.5.1'
229232

230233
compile ('com.uservoice:uservoice-android-sdk:1.2.5') {
231234
exclude module: 'commons-logging'
232235
exclude module: 'httpcore'
233236
exclude module: 'httpclient'
234237
}
235238

236-
compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
239+
compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
237240
transitive = true;
238241
}
239242

app/src/androidTest/java/org/gnucash/android/test/ui/AccountsActivityTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ public static void preventFirstRunDialogs(Context context) {
175175
}
176176

177177

178-
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
179178
public void testDisplayAccountsList(){
180179
AccountsActivity.createDefaultAccounts("EUR", mAccountsActivity);
181180
mAccountsActivity.recreate();
@@ -462,7 +461,6 @@ public void testIntentAccountCreation(){
462461
/**
463462
* Tests that the setup wizard is displayed on first run
464463
*/
465-
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
466464
@Test
467465
public void shouldShowWizardOnFirstRun() throws Throwable {
468466
Editor editor = PreferenceManager.getDefaultSharedPreferences(mAccountsActivity)

app/src/androidTest/java/org/gnucash/android/test/ui/ExportTransactionsTest.java

Lines changed: 3 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
import android.content.pm.PackageManager;
2323
import android.database.SQLException;
2424
import android.database.sqlite.SQLiteDatabase;
25+
import android.net.Uri;
2526
import android.os.Build;
2627
import android.support.test.InstrumentationRegistry;
28+
import android.support.test.espresso.Espresso;
2729
import android.support.test.espresso.contrib.DrawerActions;
2830
import android.support.test.espresso.matcher.ViewMatchers;
2931
import android.support.test.runner.AndroidJUnit4;
@@ -53,6 +55,7 @@
5355
import org.gnucash.android.model.Transaction;
5456
import org.gnucash.android.ui.account.AccountsActivity;
5557
import org.gnucash.android.ui.settings.PreferenceActivity;
58+
import org.gnucash.android.util.BookUtils;
5659
import org.junit.After;
5760
import org.junit.Before;
5861
import org.junit.FixMethodOrder;
@@ -139,139 +142,6 @@ public void setUp() throws Exception {
139142
mAccountsDbAdapter.addRecord(account, DatabaseAdapter.UpdateMethod.insert);
140143

141144
}
142-
143-
/**
144-
* Tests the export of an OFX file with the transactions from the application.
145-
* The exported file name contains a timestamp with minute precision.
146-
* If this test fails, it may be due to the file being created and tested in different minutes of the clock
147-
* Just try rerunning it again.
148-
*/
149-
@Test
150-
public void testOfxExport(){
151-
SharedPreferences.Editor prefsEditor = PreferenceActivity.getActiveBookSharedPreferences()
152-
.edit();
153-
prefsEditor.putBoolean(mAcccountsActivity.getString(R.string.key_use_double_entry), false)
154-
.commit();
155-
testExport(ExportFormat.OFX);
156-
prefsEditor.putBoolean(mAcccountsActivity.getString(R.string.key_use_double_entry), true)
157-
.commit();
158-
}
159-
160-
@Test
161-
public void whenInSingleEntry_shouldHideXmlExportOption(){
162-
SharedPreferences.Editor prefsEditor = PreferenceActivity.getActiveBookSharedPreferences()
163-
.edit();
164-
prefsEditor.putBoolean(mAcccountsActivity.getString(R.string.key_use_double_entry), false)
165-
.commit();
166-
167-
DrawerActions.openDrawer(R.id.drawer_layout);
168-
onView(withText(R.string.nav_menu_export)).perform(click());
169-
onView(withId(R.id.radio_xml_format)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)));
170-
171-
prefsEditor.putBoolean(mAcccountsActivity.getString(R.string.key_use_double_entry), true)
172-
.commit();
173-
}
174-
175-
/**
176-
* Test the export of transactions in the QIF format
177-
*/
178-
@Test
179-
public void testQifExport(){
180-
testExport(ExportFormat.QIF);
181-
}
182-
183-
@Test
184-
public void testXmlExport(){
185-
testExport(ExportFormat.XML);
186-
}
187-
188-
/**
189-
* Generates export for the specified format and tests that the file actually is created
190-
* @param format Export format to use
191-
*/
192-
public void testExport(ExportFormat format){
193-
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
194-
if (mAcccountsActivity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
195-
!= PackageManager.PERMISSION_GRANTED) {
196-
mAcccountsActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,
197-
Manifest.permission.READ_EXTERNAL_STORAGE}, 0x23);
198-
199-
onView(withId(AlertDialog.BUTTON_POSITIVE)).perform(click());
200-
}
201-
}
202-
203-
File folder = new File(Exporter.getExportFolderPath(BooksDbAdapter.getInstance().getActiveBookUID()));
204-
folder.mkdirs();
205-
assertThat(folder).exists();
206-
207-
for (File file : folder.listFiles()) {
208-
file.delete();
209-
}
210-
211-
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
212-
onView(withText(R.string.nav_menu_export)).perform(click());
213-
214-
onView(withId(R.id.spinner_export_destination)).perform(click());
215-
String[] destinations = getActivity().getResources().getStringArray(R.array.export_destinations);
216-
217-
onView(withText(destinations[0])).perform(click());
218-
onView(withText(format.name())).perform(click());
219-
220-
onView(withId(R.id.menu_save)).perform(click());
221-
222-
assertThat(folder.listFiles().length).isEqualTo(1);
223-
File exportFile = folder.listFiles()[0];
224-
assertThat(exportFile.getName()).endsWith(format.getExtension());
225-
}
226-
227-
@Test
228-
public void testDeleteTransactionsAfterExport(){
229-
assertThat(mTransactionsDbAdapter.getRecordsCount()).isGreaterThan(0);
230-
231-
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getActivity()).edit(); //PreferenceActivity.getActiveBookSharedPreferences(getActivity()).edit();
232-
editor.putBoolean(mAcccountsActivity.getString(R.string.key_delete_transactions_after_export), true);
233-
editor.commit();
234-
235-
PreferenceActivity.getActiveBookSharedPreferences()
236-
.edit()
237-
.putBoolean(mAcccountsActivity.getString(R.string.key_use_double_entry), true)
238-
.apply();
239-
240-
testExport(ExportFormat.XML);
241-
242-
assertThat(mTransactionsDbAdapter.getRecordsCount()).isEqualTo(0);
243-
List<Transaction> transactions = mTransactionsDbAdapter.getAllTransactions();
244-
245-
editor.putBoolean(mAcccountsActivity.getString(R.string.key_delete_transactions_after_export), false).commit();
246-
}
247-
248-
/**
249-
* Test creating a scheduled export
250-
* Does not work on Travis yet
251-
*/
252-
@Test
253-
public void testShouldCreateExportSchedule(){
254-
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
255-
onView(withText(R.string.nav_menu_export)).perform(click());
256-
257-
onView(withText(ExportFormat.XML.name())).perform(click());
258-
onView(withId(R.id.input_recurrence)).perform(click());
259-
260-
//switch on recurrence dialog
261-
onView(allOf(isAssignableFrom(CompoundButton.class), isDisplayed(), isEnabled())).perform(click());
262-
onView(withText("OK")).perform(click());
263-
264-
onView(withId(R.id.menu_save)).perform(click());
265-
ScheduledActionDbAdapter scheduledactionDbAdapter = ScheduledActionDbAdapter.getInstance(); //new ScheduledActionDbAdapter(mDb, new RecurrenceDbAdapter(mDb));
266-
List<ScheduledAction> scheduledActions = scheduledactionDbAdapter.getAllEnabledScheduledActions();
267-
assertThat(scheduledActions)
268-
.hasSize(1)
269-
.extracting("mActionType").contains(ScheduledAction.ActionType.BACKUP);
270-
271-
ScheduledAction action = scheduledActions.get(0);
272-
assertThat(action.getRecurrence().getPeriodType()).isEqualTo(PeriodType.WEEK);
273-
assertThat(action.getEndTime()).isEqualTo(0);
274-
}
275145

276146
@Test
277147
public void testCreateBackup(){

0 commit comments

Comments
 (0)