You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ra...@apache.org on 2019/06/01 07:43:18 UTC
[fineract-cn-mobile] branch development updated: feat: added
sweet-error library
This is an automated email from the ASF dual-hosted git repository.
rajanmaurya154 pushed a commit to branch development
in repository https://gitbox.apache.org/repos/asf/fineract-cn-mobile.git
The following commit(s) were added to refs/heads/development by this push:
new ab40f44 feat: added sweet-error library
ab40f44 is described below
commit ab40f44e55eb35382af515c6024465e8dec91c07
Author: abhijitramesh <ab...@gmail.com>
AuthorDate: Fri Jan 25 18:16:43 2019 +0530
feat: added sweet-error library
---
.../fineract/ui/offline/CustomerPayloadFragment.java | 5 +++--
.../online/customers/customerlist/CustomersFragment.java | 15 ++++++++++-----
.../customerprofile/CustomerProfileActivity.java | 12 +++++++++---
app/src/main/res/layout/activity_customer_profile.xml | 4 ++++
app/src/main/res/layout/fragment_roles_list.xml | 5 ++++-
5 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/app/src/main/java/org/apache/fineract/ui/offline/CustomerPayloadFragment.java b/app/src/main/java/org/apache/fineract/ui/offline/CustomerPayloadFragment.java
index c5a1a03..7658094 100644
--- a/app/src/main/java/org/apache/fineract/ui/offline/CustomerPayloadFragment.java
+++ b/app/src/main/java/org/apache/fineract/ui/offline/CustomerPayloadFragment.java
@@ -85,11 +85,12 @@ public class CustomerPayloadFragment extends FineractBaseFragment implements
@Override
public void showNoInternetConnection() {
-
+ sweetUIErrorHandler.showSweetNoInternetUI(swipeRefreshLayout,layoutError);
}
@Override
public void showError(String message) {
-
+ sweetUIErrorHandler.showSweetCustomErrorUI(message,
+ R.drawable.ic_error_black_24dp,swipeRefreshLayout,layoutError);
}
}
diff --git a/app/src/main/java/org/apache/fineract/ui/online/customers/customerlist/CustomersFragment.java b/app/src/main/java/org/apache/fineract/ui/online/customers/customerlist/CustomersFragment.java
index 36e0edf..54a97f8 100644
--- a/app/src/main/java/org/apache/fineract/ui/online/customers/customerlist/CustomersFragment.java
+++ b/app/src/main/java/org/apache/fineract/ui/online/customers/customerlist/CustomersFragment.java
@@ -144,11 +144,13 @@ public class CustomersFragment extends FineractBaseFragment implements Customers
@Override
public void onRefresh() {
customerPresenter.fetchCustomers(0, false);
+ sweetUIErrorHandler.hideSweetErrorLayoutUI(rvCustomers,layoutError);
}
@OnClick(R.id.btn_try_again)
void onRetry() {
customerPresenter.fetchCustomers(0, false);
+ sweetUIErrorHandler.hideSweetErrorLayoutUI(rvCustomers,layoutError);
}
@Override
@@ -162,7 +164,7 @@ public class CustomersFragment extends FineractBaseFragment implements Customers
swipeRefreshLayout.setColorSchemeColors(getActivity()
.getResources().getIntArray(R.array.swipeRefreshColors));
swipeRefreshLayout.setOnRefreshListener(this);
-
+ sweetUIErrorHandler = new SweetUIErrorHandler(getActivity(),rootView);
}
@OnClick(R.id.fab_add_customer)
@@ -190,8 +192,8 @@ public class CustomersFragment extends FineractBaseFragment implements Customers
@Override
public void showEmptyCustomers(String message) {
showRecyclerView(false);
- showFineractEmptyUI(getString(R.string.customers), getString(R.string.customer),
- R.drawable.ic_customer_black_24dp);
+ sweetUIErrorHandler.showSweetCustomErrorUI(getString(R.string.customer),
+ getString(Integer.parseInt(message)),R.drawable.ic_customer_black_24dp,rvCustomers,layoutError);
}
@Override
@@ -229,15 +231,18 @@ public class CustomersFragment extends FineractBaseFragment implements Customers
public void showNoInternetConnection() {
showRecyclerView(false);
showFineractNoInternetUI();
+ sweetUIErrorHandler.showSweetNoInternetUI(swipeRefreshLayout,layoutError);
}
@Override
public void showError(String message) {
if (customerAdapter.getItemCount() != 0) {
- showMessage(getString(R.string.error_failed_to_refresh_customers));
+ sweetUIErrorHandler.showSweetCustomErrorUI(message,
+ R.drawable.ic_error_black_24dp,swipeRefreshLayout,layoutError);
} else {
showRecyclerView(false);
- showFineractErrorUI(getString(R.string.customers));
+ sweetUIErrorHandler.showSweetCustomErrorUI(getString(R.string.customers),
+ R.drawable.ic_error_black_24dp,swipeRefreshLayout,layoutError);
}
}
diff --git a/app/src/main/java/org/apache/fineract/ui/online/customers/customerprofile/CustomerProfileActivity.java b/app/src/main/java/org/apache/fineract/ui/online/customers/customerprofile/CustomerProfileActivity.java
index bed1d69..7bed36d 100644
--- a/app/src/main/java/org/apache/fineract/ui/online/customers/customerprofile/CustomerProfileActivity.java
+++ b/app/src/main/java/org/apache/fineract/ui/online/customers/customerprofile/CustomerProfileActivity.java
@@ -16,6 +16,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.widget.ImageView;
+import com.github.therajanmaurya.sweeterror.SweetUIErrorHandler;
import org.apache.fineract.R;
import org.apache.fineract.ui.base.FineractBaseActivity;
import org.apache.fineract.ui.base.Toaster;
@@ -38,10 +39,12 @@ import butterknife.ButterKnife;
*/
public class CustomerProfileActivity extends FineractBaseActivity
implements CustomerProfileContract.View, RefreshProfileImage {
-
+ private SweetUIErrorHandler sweetUIErrorHandler;
@BindView(R.id.iv_customer_picture)
ImageView ivCustomerProfile;
+ @BindView(R.id.layout_error)
+ ImageView errorView;
private String customerIdentifier;
@Override
@@ -52,6 +55,7 @@ public class CustomerProfileActivity extends FineractBaseActivity
customerIdentifier = getIntent().getExtras().getString(ConstantKeys.CUSTOMER_IDENTIFIER);
+ sweetUIErrorHandler = new SweetUIErrorHandler(this, findViewById(android.R.id.content));
loadCustomerPortrait();
showBackButton();
@@ -163,13 +167,15 @@ public class CustomerProfileActivity extends FineractBaseActivity
@Override
public void refreshUI() {
loadCustomerPortrait();
+ sweetUIErrorHandler.hideSweetErrorLayoutUI(ivCustomerProfile,errorView);
}
@Override
- public void showNoInternetConnection() {
+ public void showNoInternetConnection() {sweetUIErrorHandler.showSweetNoInternetUI(ivCustomerProfile,errorView);
}
@Override
- public void showError(String message) {
+ public void showError(String message) {sweetUIErrorHandler.showSweetCustomErrorUI(message,
+ R.drawable.ic_error_black_24dp,ivCustomerProfile,errorView);
}
}
diff --git a/app/src/main/res/layout/activity_customer_profile.xml b/app/src/main/res/layout/activity_customer_profile.xml
index 8fa1a60..50707b8 100644
--- a/app/src/main/res/layout/activity_customer_profile.xml
+++ b/app/src/main/res/layout/activity_customer_profile.xml
@@ -25,5 +25,9 @@
</LinearLayout>
+ <include
+ layout="@layout/layout_sweet_exception_handler"
+ android:id="@+id/layout_error"
+ android:visibility="gone"/>
</RelativeLayout>
diff --git a/app/src/main/res/layout/fragment_roles_list.xml b/app/src/main/res/layout/fragment_roles_list.xml
index 466dec4..ac12610 100644
--- a/app/src/main/res/layout/fragment_roles_list.xml
+++ b/app/src/main/res/layout/fragment_roles_list.xml
@@ -33,5 +33,8 @@
android:layout_width="wrap_content"
app:layout_behavior="org.apache.fineract.utils.ScrollFabBehavior"
app:srcCompat="@drawable/ic_add_black_24dp"/>
-
+ <include
+ layout="@layout/layout_sweet_exception_handler"
+ android:id="@+id/layout_error"
+ android:visibility="gone"/>
</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file