- if (view.getId() == R.id.account_expander_container) {
- Log.d("accounts", "Account expander clicked");
- LedgerAccount acc = (LedgerAccount) row.getTag();
- if (!acc.hasSubAccounts()) return;
-
- boolean wasExpanded = acc.isExpanded();
-
- view.clearAnimation();
- ViewPropertyAnimator animator = view.animate();
-
- acc.toggleExpanded();
- Data.profile.get().storeAccount(MLDB.getWritableDatabase(), acc);
-
- if (wasExpanded) {
- Log.d("accounts", String.format("Collapsing account '%s'", acc.getName()));
- view.setRotation(0);
- animator.rotationBy(180);
-
- // removing all child accounts from the view
- int start = -1, count = 0;
- int i = 0;
- final ArrayList<LedgerAccount> accountList = Data.accounts.get();
- for (LedgerAccount a : accountList) {
- if (acc.isParentOf(a)) {
- if (start == -1) {
- start = i;
+ LedgerAccount acc = (LedgerAccount) row.getTag();
+ switch (view.getId()) {
+ case R.id.account_row_acc_name:
+ case R.id.account_expander_container:
+ Log.d("accounts", "Account expander clicked");
+ if (!acc.hasSubAccounts()) return;
+
+ boolean wasExpanded = acc.isExpanded();
+
+ View arrow = row.findViewById(R.id.account_expander_container);
+
+ arrow.clearAnimation();
+ ViewPropertyAnimator animator = arrow.animate();
+
+ acc.toggleExpanded();
+ Data.profile.get().storeAccount(MLDB.getDatabase(), acc);
+
+ if (wasExpanded) {
+ Log.d("accounts", String.format("Collapsing account '%s'", acc.getName()));
+ arrow.setRotation(0);
+ animator.rotationBy(180);
+
+ // removing all child accounts from the view
+ int start = -1, count = 0;
+ int i = 0;
+ final ArrayList<LedgerAccount> accountList = Data.accounts.get();
+ for (LedgerAccount a : accountList) {
+ if (acc.isParentOf(a)) {
+ if (start == -1) {
+ start = i;
+ }
+ count++;