diff --git a/app/src/main/java/org/gnucash/android/db/adapter/AccountsDbAdapter.java b/app/src/main/java/org/gnucash/android/db/adapter/AccountsDbAdapter.java
index e19138306..f5d43e25d 100644
--- a/app/src/main/java/org/gnucash/android/db/adapter/AccountsDbAdapter.java
+++ b/app/src/main/java/org/gnucash/android/db/adapter/AccountsDbAdapter.java
@@ -731,20 +731,21 @@ public Cursor fetchAccounts(@Nullable String where, @Nullable String[] whereArgs
null, where, whereArgs, null, null,
orderBy);
}
-
- /**
- * Returns a Cursor set of accounts which fulfill where
- *
This method returns the accounts list sorted by the full account name
- * @param where SQL WHERE statement without the 'WHERE' itself - * @param whereArgs where args - * @return Cursor set of accounts which fulfillwhere
- */
- public Cursor fetchAccountsOrderedByFullName(String where, String[] whereArgs) {
- Log.v(LOG_TAG, "Fetching all accounts from db where " + where);
- return mDb.query(AccountEntry.TABLE_NAME,
- null, where, whereArgs, null, null,
- AccountEntry.COLUMN_FULL_NAME + " ASC");
- }
+
+ // #869
+// /**
+// * Returns a Cursor set of accounts which fulfill where
+// * This method returns the accounts list sorted by the full account name
+// * @param where SQL WHERE statement without the 'WHERE' itself +// * @param whereArgs where args +// * @return Cursor set of accounts which fulfillwhere
+// */
+// public Cursor fetchAccountsOrderedByFullName(String where, String[] whereArgs) {
+// Log.v(LOG_TAG, "Fetching all accounts from db where " + where);
+// return mDb.query(AccountEntry.TABLE_NAME,
+// null, where, whereArgs, null, null,
+// AccountEntry.COLUMN_FULL_NAME + " ASC");
+// }
/**
* Returns a Cursor set of accounts which fulfill where
diff --git a/app/src/main/java/org/gnucash/android/ui/account/AccountFormFragment.java b/app/src/main/java/org/gnucash/android/ui/account/AccountFormFragment.java
index 35d5f3e7b..45b785945 100644
--- a/app/src/main/java/org/gnucash/android/ui/account/AccountFormFragment.java
+++ b/app/src/main/java/org/gnucash/android/ui/account/AccountFormFragment.java
@@ -575,8 +575,8 @@ private void loadDefaultTransferAccountList(){
+ " AND " + DatabaseSchema.AccountEntry.COLUMN_HIDDEN + "=0"
+ " AND " + DatabaseSchema.AccountEntry.COLUMN_TYPE + " != ?";
- Cursor defaultTransferAccountCursor = mAccountsDbAdapter.fetchAccountsOrderedByFullName(condition,
- new String[]{AccountType.ROOT.name()});
+ Cursor defaultTransferAccountCursor = mAccountsDbAdapter.fetchAccountsOrderedByFavoriteAndFullName(condition,
+ new String[]{AccountType.ROOT.name()});
if (mDefaultTransferAccountSpinner.getCount() <= 0) {
setDefaultTransferAccountInputsVisible(false);
@@ -611,7 +611,7 @@ private void loadParentAccountList(AccountType accountType){
if (mParentAccountCursor != null)
mParentAccountCursor.close();
- mParentAccountCursor = mAccountsDbAdapter.fetchAccountsOrderedByFullName(condition, null);
+ mParentAccountCursor = mAccountsDbAdapter.fetchAccountsOrderedByFavoriteAndFullName(condition, null);
final View view = getView();
assert view != null;
if (mParentAccountCursor.getCount() <= 0){
diff --git a/app/src/main/java/org/gnucash/android/ui/account/DeleteAccountDialogFragment.java b/app/src/main/java/org/gnucash/android/ui/account/DeleteAccountDialogFragment.java
index 4d5f6c551..cf38aa4cf 100644
--- a/app/src/main/java/org/gnucash/android/ui/account/DeleteAccountDialogFragment.java
+++ b/app/src/main/java/org/gnucash/android/ui/account/DeleteAccountDialogFragment.java
@@ -148,8 +148,10 @@ public void onActivityCreated(Bundle savedInstanceState) {
+ DatabaseSchema.AccountEntry.COLUMN_PLACEHOLDER + " = 0 AND "
+ DatabaseSchema.AccountEntry.COLUMN_UID + " NOT IN ('" + TextUtils.join("','", descendantAccountUIDs) + "')"
+ ")";
- Cursor cursor = accountsDbAdapter.fetchAccountsOrderedByFullName(transactionDeleteConditions,
- new String[]{mOriginAccountUID, currencyCode, accountType.name()});
+ Cursor cursor = accountsDbAdapter.fetchAccountsOrderedByFavoriteAndFullName(transactionDeleteConditions,
+ new String[]{mOriginAccountUID,
+ currencyCode,
+ accountType.name()});
SimpleCursorAdapter mCursorAdapter = new QualifiedAccountNameCursorAdapter(getActivity(), cursor);
mTransactionsDestinationAccountSpinner.setAdapter(mCursorAdapter);
@@ -160,8 +162,11 @@ public void onActivityCreated(Bundle savedInstanceState) {
+ DatabaseSchema.AccountEntry.COLUMN_TYPE + " = ? AND "
+ DatabaseSchema.AccountEntry.COLUMN_UID + " NOT IN ('" + TextUtils.join("','", descendantAccountUIDs) + "')"
+ ")";
- cursor = accountsDbAdapter.fetchAccountsOrderedByFullName(accountMoveConditions,
- new String[]{mOriginAccountUID, currencyCode, accountType.name()});
+ cursor = accountsDbAdapter.fetchAccountsOrderedByFavoriteAndFullName(accountMoveConditions,
+ new String[]{mOriginAccountUID,
+ currencyCode,
+ accountType.name()});
+
mCursorAdapter = new QualifiedAccountNameCursorAdapter(getActivity(), cursor);
mAccountsDestinationAccountSpinner.setAdapter(mCursorAdapter);
diff --git a/app/src/main/java/org/gnucash/android/ui/transaction/SplitEditorFragment.java b/app/src/main/java/org/gnucash/android/ui/transaction/SplitEditorFragment.java
index 1494b16c7..9e456d905 100644
--- a/app/src/main/java/org/gnucash/android/ui/transaction/SplitEditorFragment.java
+++ b/app/src/main/java/org/gnucash/android/ui/transaction/SplitEditorFragment.java
@@ -83,12 +83,12 @@ public class SplitEditorFragment extends Fragment {
@BindView(R.id.calculator_keyboard) KeyboardView mKeyboardView;
@BindView(R.id.imbalance_textview) TextView mImbalanceTextView;
- private AccountsDbAdapter mAccountsDbAdapter;
- private Cursor mCursor;
- private SimpleCursorAdapter mCursorAdapter;
- private List