Browse Source

打包测试发布版本

Bitliker 9 years ago
parent
commit
6fce6fd5ff

+ 2 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/db/dao/FriendDao.java

@@ -429,6 +429,7 @@ public class FriendDao {
                     .and().notIn("userId", Friend.ID_ERP_NEWS)
                     .and().notIn("userId", Friend.ID_ERP_GONGGAO)
                     .and().notIn("userId", Friend.ID_ERP_NOTICE)
+                    .or().eq("type", XmppMessage.TYPE_ERP)
                     .prepare();
             friends = friendDao.query(preparedQuery);
         } catch (SQLException e) {
@@ -437,6 +438,7 @@ public class FriendDao {
         return friends;
     }
 
+
     /**
      * 创建或者更新好友
      *

+ 18 - 17
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/MainActivity.java

@@ -188,16 +188,17 @@ public class MainActivity extends BaseActivity implements NetWorkObservable.NetW
                 if (mMessageFragment == null) {
                     mMessageFragment = new MessageFragment();
                 }
-                mMessageFragment.setOnRefreshRedUI(new MessageFragment.OnRefreshUIListener() {
-                    @Override
-                    public void updata(int num) {
-                        //当首页有更新,mainactivity跟着更新页面
-                        mMsgUnReadNum = mMsgUnReadNum - oldERPNum > 0 ? (mMsgUnReadNum - oldERPNum) : 0;
-                        mMsgUnReadNum = mMsgUnReadNum + num;
-                        oldERPNum = num;
-                        updateMsgUnReadTv();
-                    }
-                });
+                //TODO 红点问题
+//                mMessageFragment.setOnRefreshRedUI(new MessageFragment.OnRefreshUIListener() {
+//                    @Override
+//                    public void updata(int num) {
+//                        //当首页有更新,mainactivity跟着更新页面
+//                        mMsgUnReadNum = mMsgUnReadNum - oldERPNum > 0 ? (mMsgUnReadNum - oldERPNum) : 0;
+//                        mMsgUnReadNum = mMsgUnReadNum + num;
+//                        oldERPNum = num;
+//                        updateMsgUnReadTv();
+//                    }
+//                });
                 changeFragment(mMessageFragment, TAG_MESSAGE);//消息
                 updateMessageTitle();
             } else if (checkedId == R.id.main_tab_two) {
@@ -682,13 +683,13 @@ public class MainActivity extends BaseActivity implements NetWorkObservable.NetW
         //TODO 当前隐藏性功能提醒红点
         PreferenceUtils.putInt(MainActivity.NEW_FUNCTION_NOTICE, 1);
         PushManager.resumeWork(MyApplication.getInstance());
-        int new_function_notice = PreferenceUtils.getInt(MyApplication.getInstance(),MainActivity.NEW_FUNCTION_NOTICE);
-        if(new_function_notice == 1){
+        int new_function_notice = PreferenceUtils.getInt(MyApplication.getInstance(), MainActivity.NEW_FUNCTION_NOTICE);
+        if (new_function_notice == 1) {
             main_tab_three_tv.setVisibility(View.INVISIBLE);
-        }else {
+        } else {
             main_tab_three_tv.setVisibility(View.VISIBLE);
         }
-        Log.i("new_function_notice",new_function_notice +"");
+        Log.i("new_function_notice", new_function_notice + "");
     }
 
     private void changeFragment(Fragment addFragment, String tag) {
@@ -767,10 +768,10 @@ public class MainActivity extends BaseActivity implements NetWorkObservable.NetW
         requestMyBusiness();
         Runtime.getRuntime().gc();
 
-        int new_function_notice = PreferenceUtils.getInt(MyApplication.getInstance(),MainActivity.NEW_FUNCTION_NOTICE);
-        if(new_function_notice == 1){
+        int new_function_notice = PreferenceUtils.getInt(MyApplication.getInstance(), MainActivity.NEW_FUNCTION_NOTICE);
+        if (new_function_notice == 1) {
             main_tab_three_tv.setVisibility(View.INVISIBLE);
-        }else {
+        } else {
             main_tab_three_tv.setVisibility(View.VISIBLE);
         }
     }

+ 12 - 11
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/oa/MsgsSecondCommonActivity.java

@@ -29,7 +29,7 @@ import com.xzjmyk.pm.activity.util.DisplayUtil;
  * Created by FANGlh on 2017/2/24.
  * function: 消息第二层 通用界面
  */
-public class MsgsSecondCommonActivity extends BaseActivity implements View.OnClickListener{
+public class MsgsSecondCommonActivity extends BaseActivity implements View.OnClickListener {
     @ViewInject(R.id.waitting_work_plv)
     private PullToRefreshListView myplv;
     private String msg_title = "";
@@ -38,11 +38,11 @@ public class MsgsSecondCommonActivity extends BaseActivity implements View.OnCli
     private int mPosition;
     private EmptyLayout mEmptyLayout;
     private int mSize = 50;
-    private Handler mhandler = new Handler(){
+    private Handler mhandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
             super.handleMessage(msg);
-            switch (msg.what){
+            switch (msg.what) {
 
                 default:
                     if (msg.getData() != null) {
@@ -77,7 +77,6 @@ public class MsgsSecondCommonActivity extends BaseActivity implements View.OnCli
     }
 
     private void NewMsgsEvent() {
-
         myplv.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
             @Override
             public void onPullDownToRefresh(PullToRefreshBase refreshView) { //TODO 下拉刷新
@@ -86,7 +85,7 @@ public class MsgsSecondCommonActivity extends BaseActivity implements View.OnCli
                     public void run() {
                         myplv.onRefreshComplete();
                     }
-                },3000);
+                }, 3000);
             }
 
             @Override
@@ -126,7 +125,7 @@ public class MsgsSecondCommonActivity extends BaseActivity implements View.OnCli
     }
 
     private void initPopupWindow() {
-        View viewContext = LayoutInflater.from(ct).inflate(R.layout.msgs_long_click,null);
+        View viewContext = LayoutInflater.from(ct).inflate(R.layout.msgs_long_click, null);
         viewContext.findViewById(R.id.delete_tv).setOnClickListener(this);
         viewContext.findViewById(R.id.markread_tv).setOnClickListener(this);
         setWindow = new PopupWindow(viewContext,
@@ -140,14 +139,16 @@ public class MsgsSecondCommonActivity extends BaseActivity implements View.OnCli
             }
         });
     }
+
     private void closePopupWindow() {
         if (setWindow != null)
             setWindow.dismiss();
         DisplayUtil.backgroundAlpha(this, 1f);
     }
+
     @Override
     public void onClick(View v) {
-        switch (v.getId()){
+        switch (v.getId()) {
             case R.id.delete_tv:
                 doDeleteMsg();     //TODO 删除操作
                 closePopupWindow();
@@ -168,7 +169,7 @@ public class MsgsSecondCommonActivity extends BaseActivity implements View.OnCli
     }
 
     //TODO 列表适配器
-    public  class NewMsgAdapter extends BaseAdapter {
+    public class NewMsgAdapter extends BaseAdapter {
 
         @Override
         public int getCount() {
@@ -188,8 +189,8 @@ public class MsgsSecondCommonActivity extends BaseActivity implements View.OnCli
         @Override
         public View getView(int position, View convertView, ViewGroup parent) {
             ViewHolder viewHolder;
-            if (convertView == null){
-                convertView = View.inflate(ct,R.layout.item_newmsgs,null);
+            if (convertView == null) {
+                convertView = View.inflate(ct, R.layout.item_newmsgs, null);
                 viewHolder = new ViewHolder();
                 viewHolder.msgs_img = (ImageView) convertView.findViewById(R.id.msgs_img);
                 viewHolder.msgs_nums_tv = (TextView) convertView.findViewById(R.id.msgs_nums_tv);
@@ -197,7 +198,7 @@ public class MsgsSecondCommonActivity extends BaseActivity implements View.OnCli
                 viewHolder.msgs_content_tv = (TextView) convertView.findViewById(R.id.msgs_content_tv);
                 viewHolder.msgs_time_tv = (TextView) convertView.findViewById(R.id.msgs_time_tv);
                 convertView.setTag(viewHolder);
-            }else {
+            } else {
                 viewHolder = (ViewHolder) convertView.getTag();
             }
             return convertView;

+ 13 - 2
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/presenter/MessagePresenter.java

@@ -17,6 +17,8 @@ import com.xzjmyk.pm.activity.ui.erp.presenter.imp.IMessageView;
 import com.xzjmyk.pm.activity.ui.erp.util.CommonUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.ListUtils;
 import com.xzjmyk.pm.activity.ui.erp.util.auto.HttpHandler;
+import com.xzjmyk.pm.activity.util.StringUtils;
+import com.xzjmyk.pm.activity.util.TimeUtils;
 import com.xzjmyk.pm.activity.util.WorkHandlerUtil;
 
 import java.util.ArrayList;
@@ -82,15 +84,15 @@ public class MessagePresenter implements HttpHandler.OnResultListener {
             //TODO  为空数据情况下
             return;
         }
-        List<BaseSortModel<Friend>> erpFriend = new ArrayList<>();
         JSONObject object = null;
         Friend friend = null;
+        List<BaseSortModel<Friend>> erpFriend = new ArrayList<>();
         for (int i = 0; i < array.size(); i++) {
             object = array.getJSONObject(i);
             friend = new Friend();
             friend.setNickName(object.getString("title"));
             friend.setContent(object.getString("lastMessage"));
-            friend.setTimeSend(10000000);
+            friend.setTimeSend(getErpTime(object, "lastTime"));
             friend.setType(XmppMessage.TYPE_ERP);
             friend.setDescription(object.getString("type"));
             BaseSortModel<Friend> mode = new BaseSortModel<>();
@@ -110,6 +112,15 @@ public class MessagePresenter implements HttpHandler.OnResultListener {
         iMessageView.showModel(erpFriend);
     }
 
+    private int getErpTime(JSONObject object, String lastTime) {
+        String time = object.getString(lastTime);
+        if (StringUtils.isEmpty(time)) {
+            return (int) (System.currentTimeMillis() / 1000);
+        } else {
+            return (int) (TimeUtils.f_str_2_long(time) / 1000);
+        }
+    }
+
     private final void setSortCondition(BaseSortModel<Friend> mode) {
         Friend friend = mode.getBean();
         if (friend == null) {

+ 21 - 5
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/MessageFragment.java

@@ -59,6 +59,7 @@ import com.xzjmyk.pm.activity.ui.base.EasyFragment;
 import com.xzjmyk.pm.activity.ui.erp.activity.NoticeMenuActivity;
 import com.xzjmyk.pm.activity.ui.erp.activity.TaskActivity;
 import com.xzjmyk.pm.activity.ui.erp.activity.message.ProcessMsgActivity;
+import com.xzjmyk.pm.activity.ui.erp.activity.oa.MsgsSecondCommonActivity;
 import com.xzjmyk.pm.activity.ui.erp.db.DBManager;
 import com.xzjmyk.pm.activity.ui.erp.entity.B2BMsg;
 import com.xzjmyk.pm.activity.ui.erp.model.AllProcess;
@@ -274,7 +275,7 @@ public class MessageFragment extends EasyFragment implements RecognizerDialogLis
         mPullToRefreshListView.setMode(Mode.PULL_FROM_START);
         mAdapter = new NearlyMessageAdapter(mActivity);
         mPullToRefreshListView.getRefreshableView().setAdapter(mAdapter);
-
+        mPullToRefreshListView.getRefreshableView().addHeaderView(getHeaderView());
         mPullToRefreshListView.setOnRefreshListener(new OnRefreshListener<SlideListView>() {
             @Override
             public void onRefresh(PullToRefreshBase<SlideListView> refreshView) {
@@ -282,7 +283,7 @@ public class MessageFragment extends EasyFragment implements RecognizerDialogLis
                 refreshUI();
             }
         });
-        mPullToRefreshListView.getRefreshableView().addHeaderView(getHeaderView());
+
         mPullToRefreshListView.getRefreshableView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
             @Override
             public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
@@ -311,7 +312,6 @@ public class MessageFragment extends EasyFragment implements RecognizerDialogLis
                     intent.putExtra(AppConstant.EXTRA_IS_GROUP_CHAT, true);
                     startActivity(intent);
                 }
-
                 if (friend.getUnReadNum() > 0) {
                     MsgBroadcast.broadcastMsgNumUpdate(mActivity, false, friend.getUnReadNum());
                     friend.setUnReadNum(0);
@@ -335,8 +335,13 @@ public class MessageFragment extends EasyFragment implements RecognizerDialogLis
      */
     private void turn2ERp(Friend friend) {
         String description = friend.getDescription();
-        if (StringUtils.isEmpty(description)) return;
 
+        if (StringUtils.isEmpty(description)) return;
+        Intent intent = new Intent(ct, MsgsSecondCommonActivity.class);
+        intent.putExtra("type", description);
+        intent.putExtra("title", friend.getNickName());
+        intent.putExtra("emcode", CommonUtil.getSharedPreferences(ct, "erp_username"));
+        ct.startActivity(intent);
     }
 
     public void setNetNoticeVisiable(boolean visiable) {
@@ -527,9 +532,10 @@ public class MessageFragment extends EasyFragment implements RecognizerDialogLis
             friend = new Friend();
             friend.setNickName(object.getString("title"));
             friend.setContent(object.getString("lastMessage"));
-            friend.setTimeSend(10000000);
+            friend.setTimeSend(getErpTime(object, "lastTime"));
             friend.setType(XmppMessage.TYPE_ERP);
             friend.setDescription(object.getString("type"));
+
             BaseSortModel<Friend> mode = new BaseSortModel<>();
             mode.setBean(friend);
             setSortCondition(mode);
@@ -548,6 +554,16 @@ public class MessageFragment extends EasyFragment implements RecognizerDialogLis
         mAdapter.notifyDataSetChanged();
     }
 
+
+    private int getErpTime(JSONObject object, String lastTime) {
+        String time = object.getString(lastTime);
+        if (StringUtils.isEmpty(time)) {
+            return (int) (System.currentTimeMillis() / 1000);
+        } else {
+            return (int) (TimeUtils.f_str_2_long(time) / 1000);
+        }
+    }
+
     /**
      * 请求加载新的筛选条件的数据
      * <p/>

+ 10 - 3
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/NewMessageFragment.java

@@ -2,6 +2,7 @@ package com.xzjmyk.pm.activity.ui.message;
 
 import android.content.Context;
 import android.content.Intent;
+import android.graphics.Color;
 import android.os.Bundle;
 import android.provider.Settings;
 import android.text.Editable;
@@ -11,7 +12,6 @@ import android.widget.AdapterView;
 import android.widget.TextView;
 
 import com.handmark.pulltorefresh.library.PullToRefreshBase;
-import com.handmark.pulltorefresh.library.PullToRefreshListView;
 import com.iflytek.cloud.speech.RecognizerResult;
 import com.iflytek.cloud.speech.SpeechError;
 import com.iflytek.cloud.ui.RecognizerDialogListener;
@@ -31,6 +31,7 @@ import com.xzjmyk.pm.activity.ui.erp.presenter.imp.IMessageView;
 import com.xzjmyk.pm.activity.ui.erp.util.CommonUtil;
 import com.xzjmyk.pm.activity.view.ClearEditText;
 import com.xzjmyk.pm.activity.view.DrawableCenterTextView;
+import com.xzjmyk.pm.activity.view.PullToRefreshSlideListView;
 
 import java.util.List;
 
@@ -45,8 +46,8 @@ public class NewMessageFragment extends EasyFragment implements IMessageView, Re
 
     @ViewInject(R.id.message_net_set)
     private DrawableCenterTextView message_net_set;
-    @ViewInject(R.id.listView)
-    private PullToRefreshListView listView;
+    @ViewInject(R.id.pull_refresh_list)
+    private PullToRefreshSlideListView listView;
 
     private MainActivity mContext;
     private MessagePresenter presenter;
@@ -108,6 +109,12 @@ public class NewMessageFragment extends EasyFragment implements IMessageView, Re
         mVoice = new VoiceToWord(mContext, "534e3fe2");
         listView.setMode(PullToRefreshBase.Mode.PULL_FROM_START);//只有下拉没有上拉
         listView.getRefreshableView().addHeaderView(initHeaderView());
+        listView.setShowIndicator(false);
+        listView.getRefreshableView().setCacheColorHint(Color.parseColor("#000000"));
+        listView.getRefreshableView().setScrollingCacheEnabled(false);
+        listView.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
+        mAdapter = new MessageAdapter(null, mContext);
+        listView.getRefreshableView().setAdapter(mAdapter);
         presenter = new MessagePresenter(mContext, this);
         presenter.loadData();
     }

+ 0 - 1
WeiChat/src/main/res/layout/fragment_message.xml

@@ -1,5 +1,4 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"

+ 37 - 18
WeiChat/src/main/res/layout/fragment_new_message.xml

@@ -1,23 +1,24 @@
 <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:background="#ebe9e9"
-    android:orientation="vertical">
+    android:orientation="vertical" >
 
     <RelativeLayout
+        android:background="@drawable/bg_bar"
         android:layout_width="match_parent"
         android:layout_height="48dp"
-        android:background="@drawable/bg_bar"
         android:orientation="horizontal"
         android:paddingBottom="5dp"
         android:paddingLeft="15dp"
         android:paddingRight="15dp"
-        android:paddingTop="5dp">
+        android:paddingTop="5dp" >
 
         <com.xzjmyk.pm.activity.view.ClearEditText
             android:id="@+id/search_edit"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
+            android:layout_width="fill_parent"
+            android:layout_height="fill_parent"
             android:layout_centerVertical="true"
             android:background="@drawable/search_input"
             android:drawableLeft="@drawable/search"
@@ -29,14 +30,15 @@
 
         <ImageView
             android:id="@+id/voice_search_iv"
-            android:layout_width="20dp"
-            android:layout_height="20dp"
+            android:background="@drawable/btn_yuyin_nor"
+            android:visibility="visible"
+            android:layout_marginRight="25dp"
             android:layout_alignParentRight="true"
             android:layout_alignRight="@+id/search_edit"
-            android:layout_marginRight="25dp"
+            android:layout_width="20dp"
+            android:layout_height="20dp"
             android:layout_marginTop="8dp"
-            android:background="@drawable/btn_yuyin_nor"
-            android:visibility="visible" />
+            />
     </RelativeLayout>
 
     <com.xzjmyk.pm.activity.view.DrawableCenterTextView
@@ -44,15 +46,32 @@
         android:layout_width="match_parent"
         android:layout_height="35dp"
         android:background="#fcd8d8"
-        android:drawableLeft="@drawable/ic_net_noticce"
-        android:drawablePadding="10dp"
-        android:gravity="center_vertical"
         android:text="当前网络不可用,请检查您的网络设置"
+        android:gravity="center_vertical"
         android:textColor="@color/black"
-        android:visibility="gone" />
+        android:drawableLeft="@drawable/ic_net_noticce"
+        android:drawablePadding="10dp"
+        android:visibility="gone"/>
+
+    <com.xzjmyk.pm.activity.view.PullToRefreshSlideListView
+        xmlns:slide="http://schemas.android.com/apk/res-auto"
+        android:id="@+id/pull_refresh_list"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="#ebe9e9"
+        android:hardwareAccelerated="false"
+        android:layerType="software"
+        app:ptrAnimationStyle="flip"
+        app:ptrDrawableEnd="@drawable/default_ptr_rotate"
+        app:ptrDrawableStart="@drawable/default_ptr_flip"
+        app:ptrHeaderTextColor="@color/black"
+        app:ptrMode="both"
+        app:ptrOverScroll="false"
+        app:ptrScrollingWhileRefreshingEnabled="true"
+        app:ptrShowIndicator="false"
+        slide:slideAnimationTime="200"
+        slide:slideLeftAction="scroll"
+        slide:slideMode="right"
+        slide:slideRightAction="scroll"/>
 
-    <com.handmark.pulltorefresh.library.PullToRefreshListView
-        android:id="@+id/listView"
-        style="@style/ListViewBasic"
-        android:divider="@drawable/bg_bar" />
 </LinearLayout>