therajanmaurya commented on a change in pull request #10: feat: Sync feature 
for customer and customer details
URL: https://github.com/apache/fineract-cn-mobile/pull/10#discussion_r203735467
 
 

 ##########
 File path: 
app/src/main/java/org/apache/fineract/ui/offline/CustomerPayloadFragment.java
 ##########
 @@ -0,0 +1,95 @@
+package org.apache.fineract.ui.offline;
+
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.v4.widget.SwipeRefreshLayout;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.github.therajanmaurya.sweeterror.SweetUIErrorHandler;
+
+import org.apache.fineract.R;
+import org.apache.fineract.data.models.customer.Customer;
+import org.apache.fineract.ui.adapters.CustomerAdapter;
+import org.apache.fineract.ui.base.FineractBaseActivity;
+import org.apache.fineract.ui.base.FineractBaseFragment;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+public class CustomerPayloadFragment extends FineractBaseFragment implements
+        CustomerPayloadContract.View{
+
+    public static CustomerPayloadFragment newInstance() {
+        CustomerPayloadFragment fragment = new CustomerPayloadFragment();
+        Bundle args = new Bundle();
+        fragment.setArguments(args);
+        return fragment;
+    }
+    @BindView(R.id.rv_customers)
+    RecyclerView rvCustomers;
+
+    @BindView(R.id.swipe_container)
+    SwipeRefreshLayout swipeRefreshLayout;
+
+    @BindView(R.id.layout_error)
+    View layoutError;
+
+    @Inject
+    CustomerAdapter customerAdapter;
+
+    @Inject
+    CustomerPayloadPresenter customerPayloadPresenter;
+
+    private View rootView;
+    private SweetUIErrorHandler sweetUIErrorHandler;
+
+    @Nullable
+    @Override
+    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable 
ViewGroup container,
+                             @Nullable Bundle savedInstanceState) {
+        rootView = inflater.inflate(R.layout.fragment_customer_payload, 
container, false);
+        ((FineractBaseActivity) 
getActivity()).getActivityComponent().inject(this);
+        ButterKnife.bind(this, rootView);
+        sweetUIErrorHandler = new SweetUIErrorHandler(getActivity(), rootView);
+
+        LinearLayoutManager layoutManager = new 
LinearLayoutManager(getActivity());
+        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
+        rvCustomers.setLayoutManager(layoutManager);
+        rvCustomers.setHasFixedSize(true);
+        rvCustomers.setAdapter(customerAdapter);
+
+        customerPayloadPresenter.attachView(this);
+        customerPayloadPresenter.fetchCustomers();
+        return rootView;
+    }
+
+    @Override
+    public void showCustomers(List<Customer> customers) {
+        customerAdapter.setCustomers(customers);
+    }
+
+    @Override
+    public void showEmptyCustomers() {
+        sweetUIErrorHandler.showSweetCustomErrorUI("No Customers to Sync",
 
 Review comment:
   Hard coded string 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to