fix handling the click on the account expander image
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 2 Apr 2019 21:24:15 +0000 (00:24 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 2 Apr 2019 21:24:15 +0000 (00:24 +0300)
app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java
app/src/main/res/layout/account_summary_row.xml

index 77a56c3..d711247 100644 (file)
@@ -677,10 +677,14 @@ public class MainActivity extends ProfileThemedActivity {
 
     }
     public void onAccountSummaryRowViewClicked(View view) {
-        ViewGroup row = (ViewGroup) view.getParent();
+        ViewGroup row;
+        if ( view.getId() == R.id.account_expander ) row = (ViewGroup) view.getParent().getParent();
+        else row = (ViewGroup) view.getParent();
+
         LedgerAccount acc = (LedgerAccount) row.getTag();
         switch (view.getId()) {
             case R.id.account_row_acc_name:
+            case R.id.account_expander:
             case R.id.account_expander_container:
                 Log.d("accounts", "Account expander clicked");
                 if (!acc.hasSubAccounts()) return;
index f962ada..ca88fe8 100644 (file)
@@ -68,7 +68,9 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:layout_margin="8dp"
-            android:background="@drawable/ic_expand_less_black_24dp" />
+            android:background="@drawable/ic_expand_less_black_24dp"
+            android:clickable="true"
+            android:onClick="onAccountSummaryRowViewClicked" />
     </FrameLayout>
 
     <TextView