Skip to content

Commit 66b3d0c

Browse files
committed
Merge branch 'hotfix/patches'
2 parents d7d15fc + ad229ab commit 66b3d0c

File tree

16 files changed

+134
-51
lines changed

16 files changed

+134
-51
lines changed

.github/CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ GnuCash Android is built by people like you! Please [join us](https://github.com
55
* You can maintain your stable installation of GnuCash and test with another installation.
66
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
77
* The latest changes are in the `develop` branch.
8+
* Always rebase develop before working on a fix or issuing a pull request
89
* The master branch contains only stable releases.
910
* Pull requests to the `master` branch will be rejected.
11+
* The `hotfix/patches` branch is reserved for very small fixes to the current release
12+
* This branch may diverge significantly from the `develop` branch
13+
* When working on a hotfix, always rebase and start off the `origin/hotfix/patches` branch
14+
* Examples of such are typos, translation updates, critical bugs (e.g. cannot save transactions)
15+
* Any bigger changes should be made to develop
16+
1017
* Make a new branch for every feature you're working on.
1118
* Try to make clean commits that are easily readable (including descriptive commit messages!)
1219
* Test before you push make sure all test pass on your machine.

.github/ISSUE_TEMPLATE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
#### Steps to reproduce the behaviour
2+
1. <!-- List the detail steps to reproduce the problem here -->
3+
14
#### Expected behaviour
25

36

47
#### Actual behaviour
58

69

7-
#### Steps to reproduce the behaviour
8-
1. <!-- List the detail steps to reproduce the problem here -->
9-
1010
#### Software specifications
1111
* GnuCash Android version:
1212
* System Android version:

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
Change Log
22
===============================================================================
3+
Version 2.1.2 *(2016-09-21)*
4+
----------------------------
5+
* Fixed: Scheduled exports always run daily (no matter the actual schedule)
6+
* Fixed: New transactions cannot be saved in single-entry mode
7+
* Fixed: ownCloud connect success messages displayed in red (now green)
8+
* Fixed: Crash when scheduled action service cannot find transaction in db
9+
* Improved: German and Brazilian Portuguese translations
10+
11+
Version 2.1.1 *(2016-09-05)*
12+
----------------------------
13+
* Fixed: Bug cause crash during start-up for devices with no scheduled transactions
14+
315
Version 2.1.0 *(2016-09-01)*
416
----------------------------
517
* Feature: Use multiple GnuCash books in single application
@@ -15,7 +27,9 @@ Version 2.1.0 *(2016-09-01)*
1527
Version 2.0.7 *(2016-05-05)*
1628
----------------------------
1729
* Fixed: Currency exchange rate does not accept very small rates (> 2 decimal places)
18-
* Improved: Updated translations for Japanese, Polish, French, Version 2.0.6 *(2016-02-20)*
30+
* Improved: Updated translations for Japanese, Polish, French,
31+
32+
Version 2.0.6 *(2016-02-20)*
1933
----------------------------
2034
* Fixed: Saving transaction gets slower with increase in size of database
2135
* Fixed: Imbalance amount wrongly computed in split editor (for some accounts)

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ apply plugin: 'io.fabric'
77

88
def versionMajor = 2
99
def versionMinor = 1
10-
def versionPatch = 1
10+
def versionPatch = 2
1111
def versionBuild = 0
1212

1313
def buildTime() {

app/src/main/java/org/gnucash/android/service/ScheduledActionService.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ protected void onHandleIntent(Intent intent) {
8282
Log.i(LOG_TAG, String.format("Processing %d total scheduled actions for Book: %s",
8383
scheduledActions.size(), book.getDisplayName()));
8484
processScheduledActions(scheduledActions, db);
85+
86+
//close all databases except the currently active database
87+
if (!db.getPath().equals(GnuCashApplication.getActiveDb().getPath()))
88+
db.close();
8589
}
8690

8791
Log.i(LOG_TAG, "Completed service @ " + java.text.DateFormat.getDateTimeInstance().format(new Date()));
@@ -142,10 +146,11 @@ private static void executeScheduledEvent(ScheduledAction scheduledAction, SQLit
142146
ContentValues contentValues = new ContentValues();
143147
contentValues.put(DatabaseSchema.ScheduledActionEntry.COLUMN_LAST_RUN, System.currentTimeMillis());
144148
contentValues.put(DatabaseSchema.ScheduledActionEntry.COLUMN_EXECUTION_COUNT, executionCount);
145-
new ScheduledActionDbAdapter(db, new RecurrenceDbAdapter(db)).updateRecord(scheduledAction.getUID(), contentValues);
149+
db.update(DatabaseSchema.ScheduledActionEntry.TABLE_NAME, contentValues,
150+
DatabaseSchema.ScheduledActionEntry.COLUMN_UID + "=?", new String[]{scheduledAction.getUID()});
146151

147-
//set the values in the object because they will be checked for the next iteration in the calling loop
148-
scheduledAction.setExecutionCount(executionCount);
152+
//set the execution count in the object because it will be checked for the next iteration in the calling loop
153+
scheduledAction.setExecutionCount(executionCount); //this call is important, do not remove!!
149154
}
150155

151156
/**
@@ -163,6 +168,9 @@ private static int executeBackup(ScheduledAction scheduledAction, SQLiteDatabase
163168
if (endTime > 0 && endTime < now)
164169
return executionCount;
165170

171+
if (scheduledAction.computeNextScheduledExecutionTime() > now)
172+
return 0;
173+
166174
ExportParams params = ExportParams.parseCsv(scheduledAction.getTag());
167175
try {
168176
//wait for async task to finish before we proceed (we are holding a wake lock)
@@ -187,7 +195,14 @@ private static int executeTransactions(ScheduledAction scheduledAction, SQLiteDa
187195
int executionCount = 0;
188196
String actionUID = scheduledAction.getActionUID();
189197
TransactionsDbAdapter transactionsDbAdapter = new TransactionsDbAdapter(db, new SplitsDbAdapter(db));
190-
Transaction trxnTemplate = transactionsDbAdapter.getRecord(actionUID);
198+
Transaction trxnTemplate = null;
199+
try {
200+
trxnTemplate = transactionsDbAdapter.getRecord(actionUID);
201+
} catch (IllegalArgumentException ex){ //if the record could not be found, abort
202+
Log.e(LOG_TAG, "Scheduled transaction with UID " + actionUID + " could not be found in the db with path " + db.getPath());
203+
return executionCount;
204+
}
205+
191206

192207
long now = System.currentTimeMillis();
193208
//if there is an end time in the past, we execute all schedules up to the end time.

app/src/main/java/org/gnucash/android/ui/account/AccountsListFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ public void onSaveInstanceState(Bundle outState) {
318318
@Override
319319
public void onDestroy() {
320320
super.onDestroy();
321-
mAccountRecyclerAdapter.swapCursor(null);
321+
if (mAccountRecyclerAdapter != null)
322+
mAccountRecyclerAdapter.swapCursor(null);
322323
}
323324

324325
/**

app/src/main/java/org/gnucash/android/ui/settings/dialog/OwnCloudDialogFragment.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import android.os.Bundle;
77
import android.os.Handler;
88
import android.support.v4.app.DialogFragment;
9+
import android.support.v4.content.ContextCompat;
910
import android.support.v7.preference.CheckBoxPreference;
1011
import android.support.v7.preference.Preference;
1112
import android.util.Log;
@@ -180,19 +181,23 @@ public void onRemoteOperationFinish(RemoteOperation caller, RemoteOperationResul
180181
Log.e("OC", result.getLogMessage(), result.getException());
181182

182183
if (caller instanceof GetRemoteStatusOperation) {
184+
mServerError.setTextColor(ContextCompat.getColor(getContext(), R.color.debit_red));
183185
mServerError.setText(getString(R.string.owncloud_server_invalid));
184186
mServerError.setVisibility(View.VISIBLE);
185187

186188
} else if (caller instanceof GetRemoteUserNameOperation &&
187189
mServerError.getText().toString().equals(getString(R.string.owncloud_server_ok))) {
190+
mUsernameError.setTextColor(ContextCompat.getColor(getContext(), R.color.debit_red));
188191
mUsernameError.setText(getString(R.string.owncloud_user_invalid));
189192
mUsernameError.setVisibility(View.VISIBLE);
190193
}
191194
} else {
192195
if (caller instanceof GetRemoteStatusOperation) {
196+
mServerError.setTextColor(ContextCompat.getColor(getContext(), R.color.theme_primary));
193197
mServerError.setText(getString(R.string.owncloud_server_ok));
194198
mServerError.setVisibility(View.VISIBLE);
195199
} else if (caller instanceof GetRemoteUserNameOperation) {
200+
mUsernameError.setTextColor(ContextCompat.getColor(getContext(), R.color.theme_primary));
196201
mUsernameError.setText(getString(R.string.owncloud_user_ok));
197202
mUsernameError.setVisibility(View.VISIBLE);
198203
}
@@ -208,9 +213,11 @@ public void onRemoteOperationFinish(RemoteOperation caller, RemoteOperationResul
208213
gu.execute(mClient, listener, mHandler);
209214

210215
if (FileUtils.isValidPath(mOC_dir, false)) {
216+
mDirError.setTextColor(ContextCompat.getColor(getContext(), R.color.theme_primary));
211217
mDirError.setText(getString(R.string.owncloud_dir_ok));
212218
mDirError.setVisibility(View.VISIBLE);
213219
} else {
220+
mDirError.setTextColor(ContextCompat.getColor(getContext(), R.color.debit_red));
214221
mDirError.setText(getString(R.string.owncloud_dir_invalid));
215222
mDirError.setVisibility(View.VISIBLE);
216223
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,9 @@ public boolean onOptionsItemSelected(MenuItem item) {
938938
* @return {@code true} if the transaction can be saved, {@code false} otherwise
939939
*/
940940
private boolean canSave(){
941-
return (mAmountEditText.isInputValid())
942-
&& (mUseDoubleEntry && mTransferAccountSpinner.getCount() > 0);
941+
return (mUseDoubleEntry && mAmountEditText.isInputValid()
942+
&& mTransferAccountSpinner.getCount() > 0)
943+
|| (!mUseDoubleEntry && mAmountEditText.isInputValid());
943944
}
944945

945946
/**

app/src/main/java/org/gnucash/android/util/RecursiveMoveFiles.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private boolean copy(File src, File dst) throws IOException {
7474
*/
7575
private int recursiveMove(File src, File dst){
7676
int copyCount = 0;
77-
if (src.isDirectory()){
77+
if (src.isDirectory() && src.listFiles() != null){
7878
dst.mkdirs(); //we assume it works everytime. Great, right?
7979
for (File file : src.listFiles()) {
8080
File target = new File(dst, file.getName());

app/src/main/res/values-de/strings.xml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -459,20 +459,20 @@ No user-identifiable information will be collected as part of this process!</str
459459
<item quantity="other">%d Buchungen</item>
460460
</plurals>
461461
<string-array name="report_account_types">
462-
<item>EXPENSE</item>
463-
<item>INCOME</item>
462+
<item>AUFWENDUNGEN</item>
463+
<item>ERTRÄGE</item>
464464
</string-array>
465-
<string name="toast_connected_to_google_drive">Connected to Google Drive</string>
466-
<string name="toast_unable_to_connect_to_google_drive">Unable to connect to Google Drive</string>
467-
<string name="toast_enter_amount_to_split">Please enter an amount to split</string>
468-
<string name="label_export_target_external_service">external service</string>
469-
<string name="toast_updated_transaction_recurring_schedule">Updated transaction recurring schedule</string>
470-
<string name="label_export_transactions_since_date">Since</string>
471-
<string name="switch_export_transactions_from_all_time">All time</string>
472-
<string name="label_recommend_app">Recommend in Play Store</string>
473-
<string name="repeat_until_date">until %1$s</string>
474-
<string name="repeat_on_weekday">on %1$s</string>
475-
<string name="repeat_x_times">for %1$s times</string>
476-
<string name="menu_show_compact_view">Compact View</string>
477-
<string name="book_default_name">Book %1$d</string>
465+
<string name="toast_connected_to_google_drive">Verbunden mit Google Drive</string>
466+
<string name="toast_unable_to_connect_to_google_drive">Keine Verbindung zu Google Drive</string>
467+
<string name="toast_enter_amount_to_split">Bitte geben Sie einen aufzuteilenden Betrag ein</string>
468+
<string name="label_export_target_external_service">externer Dienst</string>
469+
<string name="toast_updated_transaction_recurring_schedule">Aktualisierte Buchung aus wiederkehrendem Zeitplan</string>
470+
<string name="label_export_transactions_since_date">Seit</string>
471+
<string name="switch_export_transactions_from_all_time">Zeitlich unbegrenzt</string>
472+
<string name="label_recommend_app">Im Play Store empfehlen</string>
473+
<string name="repeat_until_date">bis %1$s</string>
474+
<string name="repeat_on_weekday">am %1$s</string>
475+
<string name="repeat_x_times">%1$s mal</string>
476+
<string name="menu_show_compact_view">Kompakte Ansicht</string>
477+
<string name="book_default_name">Buch %1$d</string>
478478
</resources>

app/src/main/res/values-es/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,5 +472,5 @@ Este proceso solo recoge información que no permite identificar al usuario</str
472472
<string name="repeat_on_weekday">en %1$s</string>
473473
<string name="repeat_x_times">%1$s veces</string>
474474
<string name="menu_show_compact_view">Vista compacta</string>
475-
<string name="book_default_name">Book %1$d</string>
475+
<string name="book_default_name">Libro %1$d</string>
476476
</resources>

app/src/main/res/values-it-rIT/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,5 +474,5 @@
474474
<string name="repeat_on_weekday">il %1$s</string>
475475
<string name="repeat_x_times">per %1$s volte</string>
476476
<string name="menu_show_compact_view">Visualizzazione compatta</string>
477-
<string name="book_default_name">Book %1$d</string>
477+
<string name="book_default_name">Libro %1$d</string>
478478
</resources>

app/src/main/res/values-ja-rJP/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,5 +463,5 @@
463463
<string name="repeat_on_weekday">%1$s に</string>
464464
<string name="repeat_x_times">%1$s 回</string>
465465
<string name="menu_show_compact_view">コンパクト表示</string>
466-
<string name="book_default_name">Book %1$d</string>
466+
<string name="book_default_name">帳簿 %1$d</string>
467467
</resources>

app/src/main/res/values-pt-rPT/strings.xml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ Neste processo não serão recolhidas informações do utilizador!</string>
416416
<!-- Passcode lock -->
417417
<string name="digit_one">1</string>
418418
<!-- In the English locale, digit 1 has no text on it. This is simply empty space. If your locale has text on digit 1, then translate-->
419-
<string name="digit_one_text"></string>
419+
<string name="digit_one_text"> </string>
420420
<string name="digit_two">2</string>
421421
<string name="digit_two_text">ABC</string>
422422
<string name="digit_three">3</string>
@@ -449,27 +449,27 @@ Neste processo não serão recolhidas informações do utilizador!</string>
449449
<string name="label_inside_account_with_name">em %1$s</string>
450450
<plurals name="book_account_stats">
451451
<item quantity="one">%d conta</item>
452-
<item quantity="other">%d accounts</item>
452+
<item quantity="other">%d contas</item>
453453
</plurals>
454454
<plurals name="book_transaction_stats">
455455
<item quantity="one">%d transação</item>
456-
<item quantity="other">%d transactions</item>
456+
<item quantity="other">%d transações</item>
457457
</plurals>
458458
<string-array name="report_account_types">
459-
<item>EXPENSE</item>
460-
<item>INCOME</item>
459+
<item>DESPESA</item>
460+
<item>RECEITA</item>
461461
</string-array>
462-
<string name="toast_connected_to_google_drive">Connected to Google Drive</string>
463-
<string name="toast_unable_to_connect_to_google_drive">Unable to connect to Google Drive</string>
464-
<string name="toast_enter_amount_to_split">Please enter an amount to split</string>
465-
<string name="label_export_target_external_service">external service</string>
466-
<string name="toast_updated_transaction_recurring_schedule">Updated transaction recurring schedule</string>
467-
<string name="label_export_transactions_since_date">Since</string>
468-
<string name="switch_export_transactions_from_all_time">All time</string>
469-
<string name="label_recommend_app">Recommend in Play Store</string>
470-
<string name="repeat_until_date">until %1$s</string>
471-
<string name="repeat_on_weekday">on %1$s</string>
472-
<string name="repeat_x_times">for %1$s times</string>
473-
<string name="menu_show_compact_view">Compact View</string>
474-
<string name="book_default_name">Book %1$d</string>
462+
<string name="toast_connected_to_google_drive">Ligado ao Google Drive</string>
463+
<string name="toast_unable_to_connect_to_google_drive">Não é possível estabelecer ligação ao Google Drive</string>
464+
<string name="toast_enter_amount_to_split">Por favor introduza um montante a dividir</string>
465+
<string name="label_export_target_external_service">serviço externo</string>
466+
<string name="toast_updated_transaction_recurring_schedule">Transação atualizada agendamento recorrente</string>
467+
<string name="label_export_transactions_since_date">Desde</string>
468+
<string name="switch_export_transactions_from_all_time">Todo o tempo</string>
469+
<string name="label_recommend_app">Recomendado na Play Store</string>
470+
<string name="repeat_until_date">desde%1$s</string>
471+
<string name="repeat_on_weekday">na %1$s</string>
472+
<string name="repeat_x_times">para %1$s vezes</string>
473+
<string name="menu_show_compact_view">Vista Compacta</string>
474+
<string name="book_default_name">Livro %1$d</string>
475475
</resources>

app/src/main/res/values-ru/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,5 +482,5 @@
482482
<string name="repeat_on_weekday">в %1$s</string>
483483
<string name="repeat_x_times">для %1$s раз</string>
484484
<string name="menu_show_compact_view">Компактный вид</string>
485-
<string name="book_default_name">Book %1$d</string>
485+
<string name="book_default_name">Книга %1$d</string>
486486
</resources>

0 commit comments

Comments
 (0)