You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2020/06/08 06:21:32 UTC

[GitHub] [fineract-cn-mobile] jawidMuhammadi commented on a change in pull request #87: fix: Back button in different fragments in dashboard

jawidMuhammadi commented on a change in pull request #87:
URL: https://github.com/apache/fineract-cn-mobile/pull/87#discussion_r436477619



##########
File path: app/src/main/java/org/apache/fineract/ui/online/DashboardActivity.java
##########
@@ -166,6 +166,21 @@ public void onBackPressed() {
             new Handler().postDelayed(
                     () -> isBackPressedOnce = false
                     , 2000);
+        } else if (fragment instanceof CustomersFragment) {
+            if (((CustomersFragment) fragment).onBackPressed())
+                super.onBackPressed();
+        } else if (fragment instanceof LedgerFragment) {
+            if (((LedgerFragment) fragment).onBackPressed())
+                super.onBackPressed();
+        } else if (fragment instanceof AccountsFragment) {
+            if (((AccountsFragment) fragment).onBackPressed())
+                super.onBackPressed();
+        } else if (fragment instanceof TellerFragment) {
+            if (((TellerFragment) fragment).onBackPressed())
+                super.onBackPressed();
+        } else if (fragment instanceof ProductFragment) {
+            if (((ProductFragment) fragment).onBackPressed())
+                super.onBackPressed();

Review comment:
       Is it really necessary to add too many if-else conditions here? Can't only one `else block` do the work, as I see whatever fragment it is we are calling `super.onBackPressed()`. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org