Skip to content

Commit 0a1dbce

Browse files
committed
Extract code to refresh views into a new method
1 parent 66a48e6 commit 0a1dbce

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

app/src/main/java/org/gnucash/android/export/ExportAsyncTask.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,7 @@ protected void onPostExecute(Boolean exportResult) {
193193
if (mExportParams.shouldDeleteTransactionsAfterExport()) {
194194
Log.i(TAG, "Backup and deleting transactions after export");
195195
backupAndDeleteTransactions();
196-
197-
//now refresh the respective views
198-
if (mContext instanceof AccountsActivity){
199-
AccountsListFragment fragment =
200-
((AccountsActivity) mContext).getCurrentAccountListFragment();
201-
if (fragment != null)
202-
fragment.refresh();
203-
}
204-
if (mContext instanceof TransactionsActivity){
205-
((TransactionsActivity) mContext).refresh();
206-
}
196+
refreshViews();
207197
}
208198
}
209199

@@ -537,4 +527,16 @@ private void reportSuccess() {
537527
String.format(mContext.getString(R.string.toast_exported_to), targetLocation),
538528
Toast.LENGTH_LONG).show();
539529
}
530+
531+
private void refreshViews() {
532+
if (mContext instanceof AccountsActivity){
533+
AccountsListFragment fragment =
534+
((AccountsActivity) mContext).getCurrentAccountListFragment();
535+
if (fragment != null)
536+
fragment.refresh();
537+
}
538+
if (mContext instanceof TransactionsActivity){
539+
((TransactionsActivity) mContext).refresh();
540+
}
541+
}
540542
}

0 commit comments

Comments
 (0)