feat: show error if loan account failed to fetch
diff --git a/app/src/main/java/org/apache/fineract/ui/online/loanaccounts/loandetails/CustomerLoanDetailsFragment.java b/app/src/main/java/org/apache/fineract/ui/online/loanaccounts/loandetails/CustomerLoanDetailsFragment.java
index ca8cd6c..f31cf7a 100644
--- a/app/src/main/java/org/apache/fineract/ui/online/loanaccounts/loandetails/CustomerLoanDetailsFragment.java
+++ b/app/src/main/java/org/apache/fineract/ui/online/loanaccounts/loandetails/CustomerLoanDetailsFragment.java
@@ -4,6 +4,7 @@
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.design.widget.CoordinatorLayout;
+import android.support.v4.widget.NestedScrollView;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -60,24 +61,18 @@
     @BindView(R.id.tv_loan_current_status)
     TextView tvLoanCurrentStatus;
 
-    @BindView(R.id.cl_customer_loan_details)
-    CoordinatorLayout clCustomerLoanDetails;
+    @BindView(R.id.ncv_customer_loan_details)
+    NestedScrollView ncvCustomerLoanDetails;
 
     @BindView(R.id.layout_disburse_btn)
     RelativeLayout layoutDisburseButton;
 
-    @BindView(R.id.rl_error)
-    RelativeLayout rlError;
-
     @BindView(R.id.tv_alert_text_1)
     TextView tvAlertText1;
 
     @BindView(R.id.tv_alert_text_2)
     TextView tvAlertText2;
 
-    @BindView(R.id.tv_error)
-    TextView tvError;
-
     @BindView(R.id.tv_customer_deposit_account)
     TextView tvCustomerDepositAccount;
 
@@ -87,6 +82,9 @@
     @BindView(R.id.tv_last_modified_by)
     TextView tvLastModifiedBy;
 
+    @BindView(R.id.layout_error)
+    View layoutError;
+
     @Inject
     CustomerLoanDetailsPresenter customerLoanDetailsPresenter;
 
@@ -127,6 +125,7 @@
         rootView = inflater.inflate(R.layout.fragment_customer_loan_details, container, false);
         ((FineractBaseActivity) getActivity()).getActivityComponent().inject(this);
         ButterKnife.bind(this, rootView);
+        initializeFineractUIErrorHandler(getActivity(), rootView);
         customerLoanDetailsPresenter.attachView(this);
 
         customerLoanDetailsPresenter.fetchCustomerLoanDetails(productIdentifier, caseIdentifier);
@@ -134,10 +133,10 @@
         return rootView;
     }
 
-    @OnClick(R.id.iv_retry)
-    void onRetry() {
-        clCustomerLoanDetails.setVisibility(View.GONE);
-        rlError.setVisibility(View.GONE);
+    @OnClick(R.id.btn_try_again)
+    void tryAgainOnError() {
+        ncvCustomerLoanDetails.setVisibility(View.GONE);
+        layoutError.setVisibility(View.GONE);
         customerLoanDetailsPresenter.fetchCustomerLoanDetails(productIdentifier, caseIdentifier);
     }
 
@@ -160,8 +159,8 @@
     @Override
     public void showLoanAccountDetails(LoanAccount loanAccount) {
         this.loanAccount = loanAccount;
-        clCustomerLoanDetails.setVisibility(View.VISIBLE);
-        rlError.setVisibility(View.GONE);
+        ncvCustomerLoanDetails.setVisibility(View.VISIBLE);
+        layoutError.setVisibility(View.GONE);
         setToolbarTitle(loanAccount.getIdentifier());
 
         tvPaymentAmount.setText(
@@ -250,10 +249,9 @@
 
     @Override
     public void showError(String message) {
-        clCustomerLoanDetails.setVisibility(View.GONE);
-        rlError.setVisibility(View.VISIBLE);
-        tvError.setText(message);
-        Toaster.show(rootView, message);
+        ncvCustomerLoanDetails.setVisibility(View.GONE);
+        layoutError.setVisibility(View.VISIBLE);
+        showFineractErrorUI(getString(R.string.loan_account));
     }
 
     @Override
diff --git a/app/src/main/java/org/apache/fineract/ui/uierrorhandler/FineractUIErrorHandler.java b/app/src/main/java/org/apache/fineract/ui/uierrorhandler/FineractUIErrorHandler.java
index 339cb54..9f84055 100644
--- a/app/src/main/java/org/apache/fineract/ui/uierrorhandler/FineractUIErrorHandler.java
+++ b/app/src/main/java/org/apache/fineract/ui/uierrorhandler/FineractUIErrorHandler.java
@@ -3,6 +3,7 @@
 import android.content.Context;
 import android.support.annotation.Nullable;
 import android.view.View;
+import android.widget.Button;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
@@ -20,9 +21,11 @@
     private ImageView ivEmptyFeatureImage;
     private TextView tvFeatureName;
     private TextView tvSubFeatureName;
+    private Button btnTryAgain;
     private LinearLayout llEmptyUI;
     private LinearLayout llErrorToLoad;
     private LinearLayout llNoInternet;
+    private LinearLayout llError;
     private TextView tvErrorFeatureName;
 
     private Context context;
@@ -44,18 +47,21 @@
                 tvSubFeatureName.setText(
                         context.getString(R.string.empty_ui_sub_message, subFeatureName));
                 llErrorToLoad.setVisibility(View.GONE);
-                llNoInternet.setVisibility(View.GONE);
                 break;
             case ERROR_UI:
-                llErrorToLoad.setVisibility(View.VISIBLE);
-                tvErrorFeatureName.setText(featureName);
                 llEmptyUI.setVisibility(View.GONE);
                 llNoInternet.setVisibility(View.GONE);
+                llError.setVisibility(View.VISIBLE);
+                llErrorToLoad.setVisibility(View.VISIBLE);
+                btnTryAgain.setText(context.getString(R.string.try_again));
+                tvErrorFeatureName.setText(featureName);
                 break;
             case NO_INTERNET:
                 llEmptyUI.setVisibility(View.GONE);
-                llErrorToLoad.setVisibility(View.GONE);
+                llError.setVisibility(View.GONE);
                 llNoInternet.setVisibility(View.VISIBLE);
+                llErrorToLoad.setVisibility(View.VISIBLE);
+                btnTryAgain.setText(context.getString(R.string.retry));
                 break;
         }
     }
@@ -67,6 +73,8 @@
         llEmptyUI = ButterKnife.findById(view, R.id.ll_empty_ui);
         llErrorToLoad = ButterKnife.findById(view, R.id.ll_error_to_load);
         llNoInternet = ButterKnife.findById(view, R.id.ll_no_internet);
+        llError = ButterKnife.findById(view, R.id.ll_error);
+        btnTryAgain = ButterKnife.findById(view, R.id.btn_try_again);
         tvErrorFeatureName = ButterKnife.findById(view, R.id.tv_error_feature_name);
     }
 }
diff --git a/app/src/main/res/layout/fragment_customer_loan_details.xml b/app/src/main/res/layout/fragment_customer_loan_details.xml
index dfd0927..c8c3d52 100644
--- a/app/src/main/res/layout/fragment_customer_loan_details.xml
+++ b/app/src/main/res/layout/fragment_customer_loan_details.xml
@@ -6,8 +6,7 @@
     android:id="@+id/cl_customer_loan_details"
     android:layout_height="match_parent"
     android:layout_width="match_parent"
-    android:orientation="vertical"
-    android:visibility="invisible">
+    android:orientation="vertical">
 
     <android.support.v4.widget.NestedScrollView
         xmlns:android="http://schemas.android.com/apk/res/android"
@@ -16,6 +15,7 @@
         android:id="@+id/ncv_customer_loan_details"
         android:layout_height="match_parent"
         android:layout_width="match_parent"
+        android:visibility="invisible"
         app:layout_behavior="@string/appbar_scrolling_view_behavior">
 
         <LinearLayout
@@ -229,17 +229,17 @@
                     </LinearLayout>
 
                     <View
-                        android:layout_width="match_parent"
-                        android:layout_height="0.2dp"
                         android:background="#E7DFDF"
-                        android:layout_marginTop="@dimen/layout_padding_16dp"/>
+                        android:layout_height="0.2dp"
+                        android:layout_marginTop="@dimen/layout_padding_16dp"
+                        android:layout_width="match_parent"/>
 
                     <LinearLayout
                         android:layout_height="wrap_content"
                         android:layout_width="wrap_content"
                         android:orientation="horizontal"
-                        android:paddingTop="@dimen/layout_padding_8dp"
-                        android:paddingBottom="@dimen/layout_padding_16dp">
+                        android:paddingBottom="@dimen/layout_padding_16dp"
+                        android:paddingTop="@dimen/layout_padding_8dp">
 
                         <LinearLayout
                             android:layout_height="wrap_content"
@@ -511,8 +511,8 @@
         android:visibility="gone"/>
 
     <include
-        layout="@layout/layout_error"
-        android:id="@+id/rl_error"
+        layout="@layout/layout_exception_handler"
+        android:id="@+id/layout_error"
         android:visibility="gone"/>
 
 </android.support.design.widget.CoordinatorLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_exception_handler.xml b/app/src/main/res/layout/layout_exception_handler.xml
index 3ada782..9bbd38e 100644
--- a/app/src/main/res/layout/layout_exception_handler.xml
+++ b/app/src/main/res/layout/layout_exception_handler.xml
@@ -13,7 +13,7 @@
         android:layout_height="match_parent"
         android:layout_width="match_parent"
         android:orientation="vertical"
-        android:visibility="gone">
+        android:visibility="visible">
 
         <ImageView
             android:contentDescription="@string/status_image"
@@ -24,23 +24,69 @@
             android:tint="@color/grey_500"
             app:srcCompat="@drawable/ic_cloud_off_black_24dp"/>
 
-        <TextView
-            style="@style/Base.TextAppearance.AppCompat.Medium"
+        <!--Views for Any error occurred while make REST API call-->
+        <LinearLayout
+            android:id="@+id/ll_error"
             android:layout_height="wrap_content"
             android:layout_width="wrap_content"
-            android:text="@string/error_sorry_not_able_to_load"
-            android:textColor="@color/grey_500"
-            android:textSize="@dimen/text_size_14sp"
-            android:typeface="monospace"/>
+            android:orientation="vertical">
 
-        <TextView
-            android:id="@+id/tv_error_feature_name"
+            <TextView
+                style="@style/Base.TextAppearance.AppCompat.Medium"
+                android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/error_sorry_not_able_to_load"
+                android:textColor="@color/grey_500"
+                android:textSize="@dimen/text_size_14sp"
+                android:typeface="monospace"/>
+
+            <TextView
+                android:id="@+id/tv_error_feature_name"
+                android:layout_gravity="center"
+                android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:textColor="@color/grey_500"
+                android:textSize="@dimen/text_size_14sp"
+                tools:text="Deposit Accounts"/>
+
+        </LinearLayout>
+
+        <!--Views for No Internet connection-->
+        <LinearLayout
+            android:id="@+id/ll_no_internet"
             android:layout_height="wrap_content"
             android:layout_width="wrap_content"
-            android:textColor="@color/grey_500"
-            android:textSize="@dimen/text_size_14sp"
-            tools:text="Deposit Accounts"/>
+            android:orientation="vertical"
+            android:visibility="gone">
 
+            <TextView
+                style="@style/Base.TextAppearance.AppCompat.Large"
+                android:layout_gravity="center"
+                android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/oh_no"
+                android:textColor="@color/grey_500"
+                android:typeface="monospace"/>
+
+            <TextView
+                android:layout_gravity="center"
+                android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/no_internet_connection"
+                android:textColor="@color/grey_500"
+                android:textSize="@dimen/text_size_14sp"/>
+
+            <TextView
+                android:layout_gravity="center"
+                android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/or_try_again"
+                android:textColor="@color/grey_500"
+                android:textSize="@dimen/text_size_14sp"/>
+
+        </LinearLayout>
+
+        <!--Button to retry again-->
         <Button
             android:id="@+id/btn_try_again"
             android:layout_height="wrap_content"
@@ -91,54 +137,4 @@
 
     </LinearLayout>
 
-    <LinearLayout
-        android:gravity="center"
-        android:id="@+id/ll_no_internet"
-        android:layout_height="match_parent"
-        android:layout_width="match_parent"
-        android:orientation="vertical"
-        android:visibility="gone">
-
-        <ImageView
-            android:contentDescription="@string/status_image"
-            android:layout_gravity="center|center_horizontal"
-            android:layout_height="70dp"
-            android:layout_marginBottom="@dimen/layout_padding_16dp"
-            android:layout_width="70dp"
-            android:tint="@color/grey_500"
-            app:srcCompat="@drawable/ic_portable_wifi_off_black_24dp"/>
-
-        <TextView
-            style="@style/Base.TextAppearance.AppCompat.Large"
-            android:layout_height="wrap_content"
-            android:layout_width="wrap_content"
-            android:text="@string/oh_no"
-            android:textColor="@color/grey_500"
-            android:typeface="monospace"/>
-
-        <TextView
-            android:layout_height="wrap_content"
-            android:layout_width="wrap_content"
-            android:text="@string/no_internet_connection"
-            android:textColor="@color/grey_500"
-            android:textSize="@dimen/text_size_14sp"/>
-
-        <TextView
-            android:layout_height="wrap_content"
-            android:layout_width="wrap_content"
-            android:text="@string/or_try_again"
-            android:textColor="@color/grey_500"
-            android:textSize="@dimen/text_size_14sp"/>
-
-        <Button
-            android:id="@+id/btn_retry"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="@dimen/layout_padding_16dp"
-            android:layout_width="wrap_content"
-            android:paddingLeft="@dimen/layout_padding_24dp"
-            android:paddingRight="@dimen/layout_padding_24dp"
-            android:text="@string/retry"/>
-
-    </LinearLayout>
-
 </android.support.design.widget.CoordinatorLayout>
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1d146dd..e0f86e4 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -20,6 +20,7 @@
     <string name="financial_products">Financial products</string>
     <string name="manage_loan_accounts">Manage loan accounts</string>
     <string name="loan_accounts">Loan accounts</string>
+    <string name="loan_account">Loan account</string>
     <string name="deposit_accounts">Deposit accounts</string>
     <string name="roles_and_permissions">Roles/Permissions</string>
     <string name="manage_deposit_accounts">Manage deposit accounts</string>