Parcourir la source

优化任务搜索,列表卡顿

ychk il y a 5 mois
Parent
commit
85c3293952

+ 3 - 1
account

@@ -1,2 +1,4 @@
 zhoujinzhu   Wdq@2024
-demo         000000sS@
+demo         000000sS@
+
+jw      Jw135024

+ 2 - 2
app/build.gradle

@@ -10,8 +10,8 @@ android {
         minSdkVersion 21
         //noinspection OldTargetApi
         targetSdkVersion 29
-        versionCode 75
-        versionName "7.5"
+        versionCode 76
+        versionName "7.6"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         ndk {
             abiFilters 'arm64-v8a'

+ 92 - 65
app/src/main/java/com/tofly/yxpc/ui/activity/TaskActivity.java

@@ -1,13 +1,13 @@
 package com.tofly.yxpc.ui.activity;
 
+import android.content.Context;
 import android.content.Intent;
 import android.os.Build;
-import android.os.Handler;
-import android.text.Editable;
 import android.text.TextUtils;
-import android.text.TextWatcher;
 import android.view.MotionEvent;
 import android.view.View;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodManager;
 import android.widget.TextView;
 
 import androidx.annotation.Nullable;
@@ -39,6 +39,8 @@ import com.tofly.yxpc.utils.DialogUtils;
 import com.tofly.yxpc.utils.RecyclerViewUtils;
 import com.tofly.yxpc.utils.db.DaoUtilsStore;
 
+import org.greenrobot.greendao.query.WhereCondition;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -71,22 +73,7 @@ public class TaskActivity extends PhotoActivity {
     private LatLng taskPoint = null;
     private String smbh = null;
     private boolean isScanStart = false;
-    private final Handler handler = new Handler();
-    private final Runnable runnable = () -> {
-        long noNum = DaoUtilsStore.getInstance().getWaterMeterEntityDbUtils().queryCountByQueryBuilder(WaterMeterEntityDao.Properties.TaskId.eq(waterMeterTaskEntity.getId()), WaterMeterEntityDao.Properties.State.eq(0));
-        long draftNum = DaoUtilsStore.getInstance().getWaterMeterEntityDbUtils().queryCountByQueryBuilder(WaterMeterEntityDao.Properties.TaskId.eq(waterMeterTaskEntity.getId()), WaterMeterEntityDao.Properties.State.eq(1));
-        long localNum = DaoUtilsStore.getInstance().getWaterMeterEntityDbUtils().queryCountByQueryBuilder(WaterMeterEntityDao.Properties.TaskId.eq(waterMeterTaskEntity.getId()), WaterMeterEntityDao.Properties.State.eq(2));
-        long commitNum = DaoUtilsStore.getInstance().getWaterMeterEntityDbUtils().queryCountByQueryBuilder(WaterMeterEntityDao.Properties.TaskId.eq(waterMeterTaskEntity.getId()), WaterMeterEntityDao.Properties.State.eq(3));
-        list.clear();
-        list.addAll(DaoUtilsStore.getInstance().getWaterMeterEntityDbUtils().queryByQueryBuilder(WaterMeterEntityDao.Properties.TaskId.eq(waterMeterTaskEntity.getId()), WaterMeterEntityDao.Properties.State.eq(type)));
-        runOnUiThread(() -> {
-            binding.tvNoStartNum.setText(String.valueOf(noNum));
-            binding.tvDraftNum.setText(String.valueOf(draftNum));
-            binding.tvLocalNum.setText(String.valueOf(localNum));
-            binding.tvCommitNum.setText(String.valueOf(commitNum));
-            adapter.setNewData(list);
-        });
-    };
+    private int page = 1;
 
 
     @Override
@@ -126,6 +113,7 @@ public class TaskActivity extends PhotoActivity {
     @Override
     public void onResume() {
         super.onResume();
+        page = 1;
         getData();
     }
 
@@ -168,22 +156,6 @@ public class TaskActivity extends PhotoActivity {
             initColor();
             getData();
         });
-        binding.etSearch.addTextChangedListener(new TextWatcher() {
-            @Override
-            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
-            }
-
-            @Override
-            public void onTextChanged(CharSequence s, int start, int before, int count) {
-
-            }
-
-            @Override
-            public void afterTextChanged(Editable s) {
-                getData();
-            }
-        });
         binding.imgScan.setOnClickListener(v -> {
             if (MyApp.getInstance().isOverTime()) {
                 IntentIntegrator integrator = new IntentIntegrator(this);
@@ -201,32 +173,23 @@ public class TaskActivity extends PhotoActivity {
                 startActivity(new Intent(this, UnRegisterActivity.class));
             }
         });
-        binding.etSearch.addTextChangedListener(new TextWatcher() {
-            @Override
-            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
-            }
-
-            @Override
-            public void onTextChanged(CharSequence s, int start, int before, int count) {
-
+        binding.imgSearch.setOnClickListener(v -> {
+            if (MyApp.getInstance().isOverTime()) {
+                page = 1;
+                getData();
             }
-
-            @Override
-            public void afterTextChanged(Editable s) {
-                if (!TextUtils.isEmpty(s)) {
-                    list.clear();
-                    list.addAll(DaoUtilsStore.getInstance().getWaterMeterEntityDbUtils()
-                            .queryByQueryBuilderAndOr(WaterMeterEntityDao.Properties.TaskId.eq(waterMeterTaskEntity.getId())
-                                    , WaterMeterEntityDao.Properties.UserNum.like("%" + s + "%")
-                                    , WaterMeterEntityDao.Properties.UserName.like("%" + s + "%")
-                                    , WaterMeterEntityDao.Properties.UserAddr.like("%" + s + "%")
-                            ));
-                    adapter.setNewData(list);
-                } else {
-                    getData();
+        });
+        binding.etSearch.setOnEditorActionListener((v, actionId, event) -> {
+            if (actionId == EditorInfo.IME_ACTION_SEND) {
+                InputMethodManager inputMethodManager = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+                if (inputMethodManager.isActive()) {
+                    inputMethodManager.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0);
                 }
+                page = 1;
+                getData();
+                return true;
             }
+            return false;
         });
         adapter.setOnItemClickListener((adapter1, view, position) -> {
             if (MyApp.getInstance().isOverTime()) {
@@ -236,6 +199,15 @@ public class TaskActivity extends PhotoActivity {
                 startActivity(intent);
             }
         });
+
+        binding.swipeRefreshLayout.setOnRefreshListener(() -> {
+            page = 1;
+            getData();
+        });
+        adapter.setOnLoadMoreListener(() -> {
+            page++;
+            getData();
+        }, binding.rvList);
     }
 
     private void initColor() {
@@ -251,7 +223,68 @@ public class TaskActivity extends PhotoActivity {
     }
 
     private void getData() {
-        handler.postDelayed(runnable, 100);
+        List<WhereCondition> andList = new ArrayList<>();
+        List<WhereCondition> orList = new ArrayList<>();
+        andList.add(WaterMeterEntityDao.Properties.TaskId.eq(waterMeterTaskEntity.getId()));
+        if (!TextUtils.isEmpty(binding.etSearch.getText())) {
+            orList.add(WaterMeterEntityDao.Properties.UserNum.like("%" + binding.etSearch.getText().toString() + "%"));
+            orList.add(WaterMeterEntityDao.Properties.UserName.like("%" + binding.etSearch.getText().toString() + "%"));
+            orList.add(WaterMeterEntityDao.Properties.UserAddr.like("%" + binding.etSearch.getText().toString() + "%"));
+        }
+        if (page == 1) {
+            binding.swipeRefreshLayout.setRefreshing(true);
+            list.clear();
+            andList.add(WaterMeterEntityDao.Properties.State.eq(0));
+            long noNum = DaoUtilsStore.getInstance().getWaterMeterEntityDbUtils().queryByQueryBuilderAndOrSize(andList, orList);
+            andList.remove(andList.size() - 1);
+            andList.add(WaterMeterEntityDao.Properties.State.eq(1));
+            long draftNum = DaoUtilsStore.getInstance().getWaterMeterEntityDbUtils().queryByQueryBuilderAndOrSize(andList, orList);
+            andList.remove(andList.size() - 1);
+            andList.add(WaterMeterEntityDao.Properties.State.eq(2));
+            long localNum = DaoUtilsStore.getInstance().getWaterMeterEntityDbUtils().queryByQueryBuilderAndOrSize(andList, orList);
+            andList.remove(andList.size() - 1);
+            andList.add(WaterMeterEntityDao.Properties.State.eq(3));
+            long commitNum = DaoUtilsStore.getInstance().getWaterMeterEntityDbUtils().queryByQueryBuilderAndOrSize(andList, orList);
+            binding.tvNoStartNum.setText(String.valueOf(noNum));
+            binding.tvDraftNum.setText(String.valueOf(draftNum));
+            binding.tvLocalNum.setText(String.valueOf(localNum));
+            binding.tvCommitNum.setText(String.valueOf(commitNum));
+            andList.remove(andList.size() - 1);
+        }
+        andList.add(WaterMeterEntityDao.Properties.State.eq(type));
+        List<WaterMeterEntity> waterMeterEntityList = DaoUtilsStore.getInstance().getWaterMeterEntityDbUtils().queryByQueryBuilderAndOr(andList, orList, page);
+        if (!waterMeterEntityList.isEmpty()) {
+            list.addAll(waterMeterEntityList);
+            adapter.setNewData(list);
+            switch (type) {
+                case 0:
+                    stopRefreshing(Integer.parseInt(binding.tvNoStartNum.getText().toString()));
+                    break;
+                case 1:
+                    stopRefreshing(Integer.parseInt(binding.tvDraftNum.getText().toString()));
+                    break;
+                case 2:
+                    stopRefreshing(Integer.parseInt(binding.tvLocalNum.getText().toString()));
+                    break;
+                default:
+                    stopRefreshing(Integer.parseInt(binding.tvCommitNum.getText().toString()));
+                    break;
+            }
+        } else {
+            stopRefreshing(0);
+        }
+    }
+
+    private void stopRefreshing(int total) {
+        if (page == 1) {
+            binding.swipeRefreshLayout.postDelayed(() -> binding.swipeRefreshLayout.setRefreshing(false), 1000);
+        }
+        if (adapter != null) {
+            int count = adapter.getItemCount();
+            if (count > total) {
+                adapter.loadMoreEnd();
+            }
+        }
     }
 
     @RequiresApi(api = Build.VERSION_CODES.M)
@@ -388,12 +421,6 @@ public class TaskActivity extends PhotoActivity {
         mPresenter.getResultFour(this, map);
     }
 
-    @Override
-    protected void onDestroy() {
-        handler.removeCallbacks(runnable);
-        super.onDestroy();
-    }
-
     @Override
     public <T> void getResultOne(T response) {
         hideLoading();

+ 1 - 1
app/src/main/java/com/tofly/yxpc/ui/fragment/DataCheckFragment.java

@@ -247,7 +247,7 @@ public class DataCheckFragment extends LatteDelegate {
                     orList.add(BaseUpdataEntityDao.Properties.UserName.like("%" + binding.etSearch.getText().toString() + "%"));
                     orList.add(BaseUpdataEntityDao.Properties.WaterMeterNum.like("%" + binding.etSearch.getText().toString() + "%"));
                 }
-                list.addAll(baseUpdataEntityDbUtils.queryByQueryBuilderAndOr(andList, orList));
+                list.addAll(baseUpdataEntityDbUtils.queryByQueryBuilderAndOr(andList, orList, page));
                 adapter.setNewData(list);
             }
         }

+ 1 - 1
app/src/main/java/com/tofly/yxpc/ui/fragment/DataUnregisterFragment.java

@@ -211,7 +211,7 @@ public class DataUnregisterFragment extends LatteDelegate {
                 orList.add(BaseUpdataEntityDao.Properties.UserName.like("%" + binding.etSearch.getText().toString() + "%"));
                 orList.add(BaseUpdataEntityDao.Properties.WaterMeterNum.like("%" + binding.etSearch.getText().toString() + "%"));
             }
-            list.addAll(baseUpdataEntityDbUtils.queryByQueryBuilderAndOr(andList, orList));
+            list.addAll(baseUpdataEntityDbUtils.queryByQueryBuilderAndOr(andList, orList, page));
             adapter.setNewData(list);
         }
     }

+ 20 - 2
app/src/main/java/com/tofly/yxpc/utils/db/DbUtils.java

@@ -262,7 +262,7 @@ public class DbUtils<T> {
     /**
      * 多条件并列、串联查询
      */
-    public List<T> queryByQueryBuilderAndOr(@NonNull List<WhereCondition> andMore, @NonNull List<WhereCondition> orMore) {
+    public List<T> queryByQueryBuilderAndOr(@NonNull List<WhereCondition> andMore, @NonNull List<WhereCondition> orMore, int page) {
         QueryBuilder<T> queryBuilder = entityDao.queryBuilder();
         if (!andMore.isEmpty()) {
             queryBuilder.where(andMore.get(0), andMore.toArray(new WhereCondition[0]));
@@ -274,6 +274,24 @@ public class DbUtils<T> {
                 queryBuilder.whereOr(orMore.get(0), orMore.get(1), orMore.toArray(new WhereCondition[0]));
             }
         }
-        return queryBuilder.list();
+        return queryBuilder.offset((page - 1) * 20).limit(20).list();
+    }
+
+    /**
+     * 多条件并列、串联查询
+     */
+    public long queryByQueryBuilderAndOrSize(@NonNull List<WhereCondition> andMore, @NonNull List<WhereCondition> orMore) {
+        QueryBuilder<T> queryBuilder = entityDao.queryBuilder();
+        if (!andMore.isEmpty()) {
+            queryBuilder.where(andMore.get(0), andMore.toArray(new WhereCondition[0]));
+        }
+        if (!orMore.isEmpty()) {
+            if (orMore.size() == 1) {
+                queryBuilder.where(orMore.get(0));
+            } else {
+                queryBuilder.whereOr(orMore.get(0), orMore.get(1), orMore.toArray(new WhereCondition[0]));
+            }
+        }
+        return queryBuilder.count();
     }
 }

+ 4 - 2
app/src/main/res/layout/activity_main.xml

@@ -46,7 +46,8 @@
             android:gravity="center"
             android:text="@string/main_data_check"
             android:textColor="@drawable/select_main_text"
-            android:textSize="@dimen/sp_14" />
+            android:textSize="@dimen/sp_14"
+            android:visibility="gone" />
 
         <RadioButton
             android:id="@+id/rbt_data_unregister"
@@ -59,7 +60,8 @@
             android:gravity="center"
             android:text="违章用水"
             android:textColor="@drawable/select_main_text"
-            android:textSize="@dimen/sp_14" />
+            android:textSize="@dimen/sp_14"
+            android:visibility="gone" />
 
         <RadioButton
             android:id="@+id/rbt_data_update"

+ 163 - 148
app/src/main/res/layout/activity_task.xml

@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
@@ -10,184 +9,201 @@
         android:id="@+id/ll_toolbar"
         layout="@layout/top_bar" />
 
-    <androidx.core.widget.NestedScrollView
+    <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:layout_below="@+id/ll_toolbar">
+        android:layout_below="@+id/ll_toolbar"
+        android:orientation="vertical">
+
+        <include
+            android:id="@+id/ll_map"
+            layout="@layout/view_map"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/dp_150" />
 
         <LinearLayout
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:orientation="vertical">
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/dp_10"
+            android:gravity="center_vertical"
+            android:orientation="horizontal">
 
-            <include
-                android:id="@+id/ll_map"
-                layout="@layout/view_map"
-                android:layout_width="match_parent"
-                android:layout_height="@dimen/dp_195" />
+            <View
+                android:layout_width="@dimen/dp_4"
+                android:layout_height="@dimen/dp_20"
+                android:layout_marginStart="@dimen/dp_10"
+                android:layout_marginEnd="@dimen/dp_6"
+                android:background="@color/blue" />
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="水表列表"
+                android:textColor="@color/color_333"
+                android:textSize="@dimen/sp_20" />
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="@dimen/dp_10"
+            android:layout_marginTop="@dimen/dp_10"
+            android:layout_marginEnd="@dimen/dp_10"
+            android:orientation="horizontal">
 
             <LinearLayout
-                android:layout_width="match_parent"
+                android:id="@+id/ll_no_start"
+                android:layout_width="0dp"
                 android:layout_height="wrap_content"
-                android:layout_marginTop="@dimen/dp_10"
-                android:gravity="center_vertical"
-                android:orientation="horizontal">
+                android:layout_weight="1"
+                android:background="@drawable/bg_white6"
+                android:gravity="center"
+                android:orientation="vertical"
+                android:paddingTop="@dimen/dp_10"
+                android:paddingBottom="@dimen/dp_9">
 
-                <View
-                    android:layout_width="@dimen/dp_4"
-                    android:layout_height="@dimen/dp_20"
-                    android:layout_marginStart="@dimen/dp_10"
-                    android:layout_marginEnd="@dimen/dp_6"
-                    android:background="@color/blue" />
+                <TextView
+                    android:id="@+id/tv_no_start_num"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="@color/blue"
+                    android:textSize="@dimen/sp_20"
+                    tools:text="88" />
 
                 <TextView
+                    android:id="@+id/tv_no_start_name"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:text="水表列表"
-                    android:textColor="@color/color_333"
-                    android:textSize="@dimen/sp_20" />
+                    android:text="未开始"
+                    android:textColor="@color/blue"
+                    android:textSize="@dimen/sp_16" />
             </LinearLayout>
 
             <LinearLayout
-                android:layout_width="match_parent"
+                android:id="@+id/ll_draft"
+                android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_marginStart="@dimen/dp_10"
-                android:layout_marginTop="@dimen/dp_10"
-                android:layout_marginEnd="@dimen/dp_10"
-                android:orientation="horizontal">
+                android:layout_weight="1"
+                android:background="@drawable/bg_white6"
+                android:gravity="center"
+                android:orientation="vertical"
+                android:paddingTop="@dimen/dp_10"
+                android:paddingBottom="@dimen/dp_9">
 
-                <LinearLayout
-                    android:id="@+id/ll_no_start"
-                    android:layout_width="0dp"
+                <TextView
+                    android:id="@+id/tv_draft_num"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_weight="1"
-                    android:background="@drawable/bg_white6"
-                    android:gravity="center"
-                    android:orientation="vertical"
-                    android:paddingTop="@dimen/dp_10"
-                    android:paddingBottom="@dimen/dp_9">
-
-                    <TextView
-                        android:id="@+id/tv_no_start_num"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:textColor="@color/blue"
-                        android:textSize="@dimen/sp_20"
-                        tools:text="88" />
-
-                    <TextView
-                        android:id="@+id/tv_no_start_name"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:text="未开始"
-                        android:textColor="@color/blue"
-                        android:textSize="@dimen/sp_16" />
-                </LinearLayout>
-
-                <LinearLayout
-                    android:id="@+id/ll_draft"
-                    android:layout_width="0dp"
+                    android:textColor="@color/color_333"
+                    android:textSize="@dimen/sp_20"
+                    tools:text="56" />
+
+                <TextView
+                    android:id="@+id/tv_draft_name"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_marginStart="@dimen/dp_10"
-                    android:layout_weight="1"
-                    android:background="@drawable/bg_white6"
-                    android:gravity="center"
-                    android:orientation="vertical"
-                    android:paddingTop="@dimen/dp_10"
-                    android:paddingBottom="@dimen/dp_9">
-
-                    <TextView
-                        android:id="@+id/tv_draft_num"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:textColor="@color/color_333"
-                        android:textSize="@dimen/sp_20"
-                        tools:text="56" />
-
-                    <TextView
-                        android:id="@+id/tv_draft_name"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:text="@string/draft"
-                        android:textColor="@color/color_333"
-                        android:textSize="@dimen/sp_16" />
-                </LinearLayout>
-
-                <LinearLayout
-                    android:id="@+id/ll_local"
-                    android:layout_width="0dp"
+                    android:text="@string/draft"
+                    android:textColor="@color/color_333"
+                    android:textSize="@dimen/sp_16" />
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/ll_local"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/dp_10"
+                android:layout_weight="1"
+                android:background="@drawable/bg_white6"
+                android:gravity="center"
+                android:orientation="vertical"
+                android:paddingTop="@dimen/dp_10"
+                android:paddingBottom="@dimen/dp_9">
+
+                <TextView
+                    android:id="@+id/tv_local_num"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_marginStart="@dimen/dp_10"
-                    android:layout_weight="1"
-                    android:background="@drawable/bg_white6"
-                    android:gravity="center"
-                    android:orientation="vertical"
-                    android:paddingTop="@dimen/dp_10"
-                    android:paddingBottom="@dimen/dp_9">
-
-                    <TextView
-                        android:id="@+id/tv_local_num"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:textColor="@color/color_333"
-                        android:textSize="@dimen/sp_20"
-                        tools:text="10" />
-
-                    <TextView
-                        android:id="@+id/tv_local_name"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:text="本地保存"
-                        android:textColor="@color/color_333"
-                        android:textSize="@dimen/sp_16" />
-                </LinearLayout>
-
-                <LinearLayout
-                    android:id="@+id/ll_commit"
-                    android:layout_width="0dp"
+                    android:textColor="@color/color_333"
+                    android:textSize="@dimen/sp_20"
+                    tools:text="10" />
+
+                <TextView
+                    android:id="@+id/tv_local_name"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_marginStart="@dimen/dp_10"
-                    android:layout_weight="1"
-                    android:background="@drawable/bg_white6"
-                    android:gravity="center"
-                    android:orientation="vertical"
-                    android:paddingTop="@dimen/dp_10"
-                    android:paddingBottom="@dimen/dp_9">
-
-                    <TextView
-                        android:id="@+id/tv_commit_num"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:textColor="@color/color_333"
-                        android:textSize="@dimen/sp_20"
-                        tools:text="22" />
-
-                    <TextView
-                        android:id="@+id/tv_commit_name"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:text="已提交"
-                        android:textColor="@color/color_333"
-                        android:textSize="@dimen/sp_16" />
-                </LinearLayout>
+                    android:text="本地保存"
+                    android:textColor="@color/color_333"
+                    android:textSize="@dimen/sp_16" />
+            </LinearLayout>
 
+            <LinearLayout
+                android:id="@+id/ll_commit"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/dp_10"
+                android:layout_weight="1"
+                android:background="@drawable/bg_white6"
+                android:gravity="center"
+                android:orientation="vertical"
+                android:paddingTop="@dimen/dp_10"
+                android:paddingBottom="@dimen/dp_9">
+
+                <TextView
+                    android:id="@+id/tv_commit_num"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="@color/color_333"
+                    android:textSize="@dimen/sp_20"
+                    tools:text="22" />
+
+                <TextView
+                    android:id="@+id/tv_commit_name"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="已提交"
+                    android:textColor="@color/color_333"
+                    android:textSize="@dimen/sp_16" />
             </LinearLayout>
 
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/dp_40"
+            android:layout_marginHorizontal="@dimen/dp_10"
+            android:layout_marginTop="@dimen/dp_10"
+            android:background="@drawable/bg_white6"
+            android:gravity="center_vertical"
+            android:orientation="horizontal">
+
             <EditText
                 android:id="@+id/et_search"
-                android:layout_width="match_parent"
-                android:layout_height="@dimen/dp_40"
-                android:layout_marginStart="@dimen/dp_10"
-                android:layout_marginTop="@dimen/dp_10"
-                android:layout_marginEnd="@dimen/dp_10"
-                android:background="@drawable/bg_white6"
-                android:drawableEnd="@mipmap/icon_search"
-                android:hint="搜素用户编号、名称、地址、水表表号"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:background="@null"
+                android:hint="搜素用户编号、名称、地址和水表表号"
+                android:imeOptions="actionSend"
                 android:paddingStart="@dimen/dp_20"
                 android:paddingEnd="@dimen/dp_20"
+                android:singleLine="true"
                 android:textColor="@color/color_333"
                 android:textSize="@dimen/sp_15" />
 
+            <ImageView
+                android:id="@+id/img_search"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:padding="@dimen/dp_10"
+                android:src="@mipmap/icon_search" />
+        </LinearLayout>
+
+        <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
+            android:id="@+id/swipe_refresh_layout"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
+
             <androidx.recyclerview.widget.RecyclerView
                 android:id="@+id/rv_list"
                 android:layout_width="match_parent"
@@ -196,10 +212,9 @@
                 android:layout_marginEnd="@dimen/dp_10"
                 android:layout_marginBottom="@dimen/dp_10"
                 tools:listitem="@layout/item_task" />
+        </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
 
-        </LinearLayout>
-    </androidx.core.widget.NestedScrollView>
-
+    </LinearLayout>
 
     <LinearLayout
         android:layout_width="wrap_content"