Просмотр исходного кода

提交分类: 功能开发;
提交内容: 1、企业架构页面刷新控件替换
当前版本: 测试版本6.1.1
是否冲突: 否

raomeng 8 лет назад
Родитель
Сommit
da66b72346

+ 23 - 23
WeiChat/build.gradle

@@ -120,29 +120,29 @@ android {
         flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
     }
 
-//    applicationVariants.all { variant ->
-//        variant.outputs.each { output ->
-//            def outputFile = output.outputFile
-//            def fileName
-//            if (outputFile != null && outputFile.name.endsWith('.apk')) {
-//                if (variant.buildType.name.equals('release')) {
-//                    //赋值app属性版本名
-//                    //variant.mergedFlavor.versionName = getVersionName() + "_" + variant.productFlavors[0].name+"(Build"+currentVersionCode+")"
-//                    //variant.mergedFlavor.versionName ="v"+versionArray[0].toString().substring(0,1)+"."+ versionArray[0].toString().substring(1,2)+"."+  versionArray[0].toString().substring(2,3)
-//                    def releaseInfo= "v"+versionArray[0].toString().substring(0,1)+"."+ versionArray[0].toString().substring(1,2)+"."+  versionArray[0].toString().substring(2,3)+ "_" + variant.productFlavors[0].name+"(Build"+versionArray[1]+")"
-//                    fileName = "WeiChat_${releaseInfo}_release.apk"
-//
-//                } else if (variant.buildType.name.equals('debug')) {
-//                    //赋值app属性版本名
-//                    variant.mergedFlavor.versionName = getVersionName() + "_" + releaseTime() + "_" + variant.productFlavors[0].name+"(Build"+versionArray[3]+")"+"_debug"
-//                    def debugInfo= getVersionName() + "_" + releaseTime() + "_" + variant.productFlavors[0].name+"(Build"+versionArray[3]+")"
-//                    fileName = "WeiChat_${debugInfo}_debug.apk"
-//
-//                }
-//                output.outputFile = new File(outputFile.parent, fileName)
-//            }
-//        }
-//    }
+    applicationVariants.all { variant ->
+        variant.outputs.each { output ->
+            def outputFile = output.outputFile
+            def fileName
+            if (outputFile != null && outputFile.name.endsWith('.apk')) {
+                if (variant.buildType.name.equals('release')) {
+                    //赋值app属性版本名
+                    //variant.mergedFlavor.versionName = getVersionName() + "_" + variant.productFlavors[0].name+"(Build"+currentVersionCode+")"
+                    //variant.mergedFlavor.versionName ="v"+versionArray[0].toString().substring(0,1)+"."+ versionArray[0].toString().substring(1,2)+"."+  versionArray[0].toString().substring(2,3)
+                    def releaseInfo= "v"+versionArray[0].toString().substring(0,1)+"."+ versionArray[0].toString().substring(1,2)+"."+  versionArray[0].toString().substring(2,3)+ "_" + variant.productFlavors[0].name+"(Build"+versionArray[1]+")"
+                    fileName = "WeiChat_${releaseInfo}_release.apk"
+
+                } else if (variant.buildType.name.equals('debug')) {
+                    //赋值app属性版本名
+                    variant.mergedFlavor.versionName = getVersionName() + "_" + releaseTime() + "_" + variant.productFlavors[0].name+"(Build"+versionArray[3]+")"+"_debug"
+                    def debugInfo= getVersionName() + "_" + releaseTime() + "_" + variant.productFlavors[0].name+"(Build"+versionArray[3]+")"
+                    fileName = "WeiChat_${debugInfo}_debug.apk"
+
+                }
+                output.outputFile = new File(outputFile.parent, fileName)
+            }
+        }
+    }
 }
 
 dependencies {

+ 0 - 99
WeiChat/src/main/res/layout/act_staff_query_list.xml

@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:focusable="true"
-    android:focusableInTouchMode="true"
-    android:orientation="vertical">
-
-    <com.core.widget.VoiceSearchView
-        android:id="@+id/voiceSearchView"
-        android:layout_width="match_parent"
-        android:layout_height="48dp" />
-    <com.core.widget.SuperSwipeRefreshLayout
-        android:id="@+id/refresh_top"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        xmlns:ptr="http://schemas.android.com/apk/res-auto"
-        android:fillViewport="true"
-        ptr:ptrAnimationStyle="flip"
-        >
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:orientation="vertical">
-
-            <include layout="@layout/erp_empty_view" />
-
-            <LinearLayout
-                android:id="@+id/ll_content"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:orientation="vertical"
-                android:visibility="gone">
-
-                <HorizontalScrollView
-                    android:id="@+id/hv_head_view"
-                    android:layout_width="match_parent"
-                    android:layout_height="40dip"
-                    android:background="#ffffff"
-                    android:fadingEdge="none"
-                    android:paddingLeft="10dp"
-                    android:scrollbars="none">
-
-                    <RelativeLayout
-                        android:layout_width="match_parent"
-                        android:layout_height="match_parent"
-                        android:layout_gravity="top">
-
-                        <RadioGroup
-                            android:id="@+id/rg_nav_content"
-                            android:layout_width="match_parent"
-                            android:layout_height="40dip"
-                            android:background="#FfFfFf"
-                            android:orientation="horizontal" />
-                    </RelativeLayout>
-                </HorizontalScrollView>
-
-                <View
-                    android:layout_width="match_parent"
-                    android:layout_height="1dp"
-                    android:background="#DEDEDE" />
-
-                <LinearLayout
-                    android:id="@+id/ll_list"
-                    android:layout_width="match_parent"
-                    android:layout_height="match_parent"
-                    android:orientation="horizontal"
-                    android:weightSum="7">
-
-                    <com.core.widget.CustomerListView
-                        android:id="@+id/lv_saff_list"
-                        android:layout_width="0dp"
-                        android:layout_height="match_parent"
-                        android:layout_weight="2"
-                        android:background="@color/white"
-                        android:clipToPadding="false"
-                        android:fadingEdge="none"
-                        android:scrollbars="none" />
-
-                    <View
-                        android:layout_width="1dp"
-                        android:layout_height="match_parent"
-                        android:background="#DEDEDE"
-                        android:visibility="gone"/>
-
-                    <com.core.widget.CustomerListView
-                        android:id="@+id/lv_left_list"
-                        android:layout_width="0dp"
-                        android:layout_height="match_parent"
-                        android:layout_weight="5"
-                        android:divider="#dfdede"
-                        android:dividerHeight="0.5dp"
-                        android:scrollbars="none" />
-                </LinearLayout>
-            </LinearLayout>
-        </LinearLayout>
-    </com.core.widget.SuperSwipeRefreshLayout>
-
-</LinearLayout>

+ 3 - 3
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Fri Dec 29 16:05:43 CST 2017
-debugName=346
+#Tue Jan 02 18:21:52 CST 2018
+debugName=361
 versionName=624
-debugCode=346
+debugCode=361
 versionCode=163

+ 16 - 9
app_core/common/src/main/res/layout/act_staff_query_list.xml

@@ -1,5 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:focusable="true"
@@ -10,14 +12,19 @@
         android:id="@+id/voiceSearchView"
         android:layout_width="match_parent"
         android:layout_height="48dp" />
-    <com.core.widget.SuperSwipeRefreshLayout
-        android:id="@+id/refresh_top"
+
+    <com.scwang.smartrefresh.layout.SmartRefreshLayout
+        android:id="@+id/act_staff_query_refresh_layout"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        xmlns:ptr="http://schemas.android.com/apk/res-auto"
-        android:fillViewport="true"
-        ptr:ptrAnimationStyle="flip"
-        >
+        app:srlEnableLoadmore="false"
+        app:srlEnablePreviewInEditMode="false">
+
+        <com.scwang.smartrefresh.layout.header.ClassicsHeader
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            app:srlAccentColor="@android:color/darker_gray" />
+
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="match_parent"
@@ -81,7 +88,7 @@
                         android:layout_width="1dp"
                         android:layout_height="match_parent"
                         android:background="#DEDEDE"
-                        android:visibility="gone"/>
+                        android:visibility="gone" />
 
                     <com.core.widget.CustomerListView
                         android:id="@+id/lv_left_list"
@@ -94,6 +101,6 @@
                 </LinearLayout>
             </LinearLayout>
         </LinearLayout>
-    </com.core.widget.SuperSwipeRefreshLayout>
+    </com.scwang.smartrefresh.layout.SmartRefreshLayout>
 
 </LinearLayout>

+ 1 - 1
app_modular/appcontact/src/main/AndroidManifest.xml

@@ -23,7 +23,7 @@
             </intent-filter>
         <activity
             android:name="com.uas.appcontact.ui.activity.CompanyContactsActivity"
-            android:windowSoftInputMode="stateVisible|adjustResize" />
+            android:windowSoftInputMode="stateHidden|adjustResize" />
         <activity android:name="com.uas.appcontact.ui.activity.CommonFragmentActivity" />
         <!-- 附近模块 -->
         <activity

+ 82 - 40
app_modular/appcontact/src/main/java/com/uas/appcontact/ui/activity/CompanyContactsActivity.java

@@ -50,9 +50,10 @@ import com.core.net.http.ViewUtil;
 import com.core.utils.CommonUtil;
 import com.core.utils.helper.AvatarHelper;
 import com.core.widget.CustomerListView;
-import com.core.widget.SuperSwipeRefreshLayout;
 import com.core.widget.VoiceSearchView;
 import com.core.xmpp.dao.FriendDao;
+import com.scwang.smartrefresh.layout.api.RefreshLayout;
+import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
 import com.uas.appcontact.R;
 
 import java.text.ParseException;
@@ -80,13 +81,15 @@ public class CompanyContactsActivity extends BaseActivity {
     private RadioGroup rg_nav_content;
     private LinearLayout ll_content;
     private RelativeLayout rl_empty;
-    private SuperSwipeRefreshLayout reScrollView;
-    
+    private RefreshLayout mRefreshLayout;
+
+//    private SuperSwipeRefreshLayout reScrollView;
+
     private Context ct;
     //关键变量
     public static ArrayList<String> tabTitle = new ArrayList<>(); // 标题
     public static Map<String, Object> keystore = new LinkedHashMap<>(); // 标题
-    
+
     private LayoutInflater mInflater;
     private Hrorgs hrorgs_parent;
     private Hrorgs hrorgs_left;
@@ -115,8 +118,11 @@ public class CompanyContactsActivity extends BaseActivity {
                                 "ed_company=? and ed_whichsys=?");
                         LoadServerData(master, date);
                     } else {
-                        if (reScrollView.isRefreshing()) {
-                            reScrollView.setRefreshing(false);
+//                        if (reScrollView.isRefreshing()) {
+//                            reScrollView.setRefreshing(false);
+//                        }
+                        if (mRefreshLayout.isRefreshing()) {
+                            mRefreshLayout.finishRefresh(0);
                         }
                         ll_content.setVisibility(View.GONE);
                         rl_empty.setVisibility(View.VISIBLE);
@@ -135,7 +141,7 @@ public class CompanyContactsActivity extends BaseActivity {
                     if (hrEntity != null) {
                         isFristLoad = false;
                     }
-                    reScrollView.setRefreshing(true);
+//                    reScrollView.setRefreshing(true);
                     if (!hrorgsEntities.isEmpty() || !employeesEntities.isEmpty()) {
                         insertDataSqlite(isFristLoad, hrorgsEntities, employeesEntities,
                                 server_time);    //写入缓存
@@ -146,10 +152,13 @@ public class CompanyContactsActivity extends BaseActivity {
                         Log.i(TAG, "取缓存数据.....!");
                         LoadRootHrorgFromServer();//取缓存
                     }
-                    if (reScrollView.isRefreshing()) {
-                        reScrollView.setRefreshing(false);
+//                    if (reScrollView.isRefreshing()) {
+//                        reScrollView.setRefreshing(false);
+//                    }
+                    if (mRefreshLayout.isRefreshing()) {
+                        mRefreshLayout.finishRefresh(0);
                     }
-//                    progressDialog.dismiss();
+                    progressDialog.dismiss();
                     break;
                 case Constants.LOAD_SUCCESS://根节点
                     if (!keystore.isEmpty()) {
@@ -206,7 +215,10 @@ public class CompanyContactsActivity extends BaseActivity {
                         }
                     }
 
-//                    progressDialog.dismiss();
+                    progressDialog.dismiss();
+                    if (mRefreshLayout.isRefreshing()) {
+                        mRefreshLayout.finishRefresh(0);
+                    }
                     //reScrollView.onRefreshComplete();
                     break;
                 /** @注释:左边栏接收数据 */
@@ -372,8 +384,11 @@ public class CompanyContactsActivity extends BaseActivity {
                     com.core.net.http.ViewUtil.AutoLoginErp(ct);
 //                    reScrollView.onRefreshComplete();
 
-                    if (reScrollView.isRefreshing()) {
-                        reScrollView.setRefreshing(false);
+//                    if (reScrollView.isRefreshing()) {
+//                        reScrollView.setRefreshing(false);
+//                    }
+                    if (mRefreshLayout.isRefreshing()) {
+                        mRefreshLayout.finishRefresh(0);
                     }
                     break;
                 default:
@@ -422,17 +437,24 @@ public class CompanyContactsActivity extends BaseActivity {
         rg_nav_content = (RadioGroup) findViewById(R.id.rg_nav_content);
         ll_content = (LinearLayout) findViewById(R.id.ll_content);
         rl_empty = (RelativeLayout) findViewById(R.id.rl_empty);
-        reScrollView = (SuperSwipeRefreshLayout) findViewById(R.id.refresh_top);
-
+        rl_empty.setVisibility(View.GONE);
+//        reScrollView = (SuperSwipeRefreshLayout) findViewById(R.id.refresh_top);
+        mRefreshLayout = (RefreshLayout) findViewById(R.id.act_staff_query_refresh_layout);
 
         initListener();
         mHandler.post(new Runnable() {
             @Override
             public void run() {
-                reScrollView.setRefreshing(true);
+//                reScrollView.setRefreshing(true);
+                mRefreshLayout.autoRefresh(300, 1f);
             }
         });
-        mHandler.sendEmptyMessage(UPDATE_CHANGE_MASTER);
+        mHandler.postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                mHandler.sendEmptyMessage(UPDATE_CHANGE_MASTER);
+            }
+        }, 300);
     }
 
     private String next_or_id;//记录下级标题栏的or_id   解决顶部导航栏点击选择问题
@@ -537,10 +559,15 @@ public class CompanyContactsActivity extends BaseActivity {
 
             @Override
             public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
-                if (firstVisibleItem == 0)
-                    reScrollView.setEnabled(true);
-                else
-                    reScrollView.setEnabled(false);
+//                if (firstVisibleItem == 0)
+//                    reScrollView.setEnabled(true);
+//                else
+//                    reScrollView.setEnabled(false);
+                if (firstVisibleItem == 0) {
+                    mRefreshLayout.setEnableRefresh(true);
+                } else {
+                    mRefreshLayout.setEnableRefresh(false);
+                }
             }
         });
         mlistleft.setOnScrollListener(new AbsListView.OnScrollListener() {
@@ -550,30 +577,42 @@ public class CompanyContactsActivity extends BaseActivity {
 
             @Override
             public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
-                if (firstVisibleItem == 0)
-                    reScrollView.setEnabled(true);
-                else
-                    reScrollView.setEnabled(false);
+//                if (firstVisibleItem == 0)
+//                    reScrollView.setEnabled(true);
+//                else
+//                    reScrollView.setEnabled(false);
+                if (firstVisibleItem == 0) {
+                    mRefreshLayout.setEnableRefresh(true);
+                } else {
+                    mRefreshLayout.setEnableRefresh(false);
+                }
             }
         });
         viewHead = LayoutInflater.from(this).inflate(R.layout.head_view, null);
-        reScrollView.setHeaderView(viewHead);
-        reScrollView.setOnPullRefreshListener(new SuperSwipeRefreshLayout.OnPullRefreshListener() {
+//        reScrollView.setHeaderView(viewHead);
+//        reScrollView.setOnPullRefreshListener(new SuperSwipeRefreshLayout.OnPullRefreshListener() {
+//            @Override
+//            public void onRefresh() {
+//                manager.deleteData(CommonUtil.getSharedPreferences(ct, "erp_master"));
+//                LoadServerData(CommonUtil.getSharedPreferences(ct, "erp_master"), null);
+//            }
+//
+//            @Override
+//            public void onPullDistance(int distance) {
+//                //TODO 下拉距离
+//            }
+//
+//            @Override
+//            public void onPullEnable(boolean enable) {
+//                //TODO 下拉过程中,下拉的距离是否足够出发刷新
+//            }
+//        });
+        mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
             @Override
-            public void onRefresh() {
+            public void onRefresh(RefreshLayout refreshLayout) {
                 manager.deleteData(CommonUtil.getSharedPreferences(ct, "erp_master"));
                 LoadServerData(CommonUtil.getSharedPreferences(ct, "erp_master"), null);
             }
-
-            @Override
-            public void onPullDistance(int distance) {
-                //TODO 下拉距离
-            }
-
-            @Override
-            public void onPullEnable(boolean enable) {
-                //TODO 下拉过程中,下拉的距离是否足够出发刷新
-            }
         });
 
         voiceSearchView.addTextChangedListener(new TextWatcher() {
@@ -639,7 +678,7 @@ public class CompanyContactsActivity extends BaseActivity {
         if (friendOne == null) {
             FriendDao.getInstance().createOrUpdateFriend(friend);
         }
-        Intent intent = new Intent("com.modular.message.ChatActivity" );
+        Intent intent = new Intent("com.modular.message.ChatActivity");
         intent.putExtra("friend", friend);
         startActivity(intent);
     }
@@ -732,7 +771,10 @@ public class CompanyContactsActivity extends BaseActivity {
      */
     public void LoadServerData(String master, String lastdate) {
         if (StringUtil.isEmpty(master)) {
-            reScrollView.setRefreshing(false);
+//            reScrollView.setRefreshing(false);
+            if (mRefreshLayout.isRefreshing()) {
+                mRefreshLayout.finishRefresh(0);
+            }
             ll_content.setVisibility(View.GONE);
             rl_empty.setVisibility(View.VISIBLE);
             return;