Browse Source

提交类型 修复bug
提交内容 客户首页添加下拉刷新功能

Bitliker 7 years ago
parent
commit
eed39e6cd3

+ 17 - 1
app_modular/appworks/src/main/java/com/uas/appworks/crm3_0/activity/CustomerManageActivity.java

@@ -15,6 +15,7 @@ import android.widget.AdapterView;
 import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.PopupWindow;
+import android.widget.ScrollView;
 import android.widget.SimpleAdapter;
 import android.widget.TextView;
 
@@ -29,6 +30,8 @@ import com.core.utils.CommonUtil;
 import com.core.utils.time.wheel.DatePicker;
 import com.core.widget.MyListView;
 import com.core.widget.view.MyGridView;
+import com.handmark.pulltorefresh.library.PullToRefreshBase;
+import com.handmark.pulltorefresh.library.PullToRefreshScrollView;
 import com.modular.apputils.activity.BillDetailsActivity;
 import com.modular.apputils.activity.BillInputActivity;
 import com.modular.apputils.activity.BillListActivity;
@@ -66,6 +69,7 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
     private TextView customerCareRefTimeTv;
     private MyListView customerCareLv;
     private ImageView customerCareRefIv;
+    private PullToRefreshScrollView mPullToRefreshScrollView;
 
     private CustomerManagePresenter mCustomerManagePresenter = null;
 
@@ -104,6 +108,7 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
         customerCareRefTimeTv = findViewById(R.id.customerCareRefTimeTv);
         customerCareLv = findViewById(R.id.customerCareLv);
         customerCareRefIv = findViewById(R.id.customerCareRefIv);
+        mPullToRefreshScrollView = findViewById(R.id.mPullToRefreshScrollView);
 
         addGridView = (MyGridView) findViewById(R.id.addGridView);
 
@@ -135,6 +140,14 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
         customerCareRefIv.setOnClickListener(mOnClickListener);
         visitTv.setOnClickListener(mOnClickListener);
         visitRefIv.setOnClickListener(mOnClickListener);
+        mPullToRefreshScrollView.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
+        mPullToRefreshScrollView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ScrollView>() {
+            @Override
+            public void onRefresh(PullToRefreshBase<ScrollView> refreshView) {
+                mCustomerManagePresenter.loadAllData();
+            }
+        });
+
         addGridView.setAdapter(new EasyBaseAdapter(ct, getAddItems()) {
             @Override
             public View bindView(View view, int position, EasyBaseModel model) {
@@ -442,6 +455,7 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
 
     @Override
     public void setShowCustomerAdapter(List<EasyBaseModel> models) {
+        mPullToRefreshScrollView.onRefreshComplete();
         showCustomerRefIv.setAnimation(null);
         showCustomerRefTimeTv.setText(DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
         if (showCustomerAdapter == null) {
@@ -491,6 +505,7 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
 
     @Override
     public void setForgetCustomerAdapter(List<EasyBaseModel> models) {
+        mPullToRefreshScrollView.onRefreshComplete();
         forgetCustomerRefIv.setAnimation(null);
         forgetCustomerRefTimeTv.setText(DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
         if (mCustomerForgetAdapter == null) {
@@ -503,7 +518,7 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
 
     @Override
     public void setCustomerCareAdapter(List<EasyBaseModel> models) {
-
+        mPullToRefreshScrollView.onRefreshComplete();
         customerCareRefIv.setAnimation(null);
         customerCareRefTimeTv.setText(DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
         if (mCustomerCareAdapter == null) {
@@ -516,6 +531,7 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
 
     @Override
     public void setVisitAdapter(List<EasyBaseModel> models) {
+        mPullToRefreshScrollView.onRefreshComplete();
         visitRefIv.setAnimation(null);
         visitRefTimeTv.setText(DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
         if (mVisitAdapter == null) {

+ 3 - 2
app_modular/appworks/src/main/res/layout/activity_customer_manage.xml

@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
-<com.core.widget.CustomerScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+<com.handmark.pulltorefresh.library.PullToRefreshScrollView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
+    android:id="@+id/mPullToRefreshScrollView"
     android:layout_height="match_parent">
 
     <LinearLayout
@@ -270,4 +271,4 @@
         </RelativeLayout>
         <!--end 拜访统计-->
     </LinearLayout>
-</com.core.widget.CustomerScrollView>
+</com.handmark.pulltorefresh.library.PullToRefreshScrollView>