Pārlūkot izejas kodu

处理审批流出现的webView显示问题

Bitliker 8 gadi atpakaļ
vecāks
revīzija
ad85c637d2

+ 2 - 0
app_core/common/src/main/java/com/core/xmpp/CoreService.java

@@ -15,6 +15,7 @@ import android.support.v7.app.NotificationCompat;
 import android.text.TextUtils;
 import android.util.Log;
 
+import com.common.LogUtil;
 import com.common.preferences.PreferenceUtils;
 import com.common.system.SystemUtil;
 import com.core.app.Constants;
@@ -69,6 +70,7 @@ public class CoreService extends Service {
     private int notifyId = 1003020303;
 
     public void notificationMesage(ChatMessage chatMessage) {
+        LogUtil.i("chatMessage="+chatMessage.toString());
         int messageType = chatMessage.getType();
         boolean isNotification = PreferenceUtils.getBoolean(getApplicationContext(), Constants.IS_NOTIFICATION);//进行通知
         isNotification = SystemUtil.isBackground(getApplicationContext());

+ 2 - 5
app_core/common/src/main/java/com/core/xmpp/XChatManager.java

@@ -5,8 +5,8 @@ import android.util.Log;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.common.LogUtil;
 import com.common.data.CalendarUtil;
-import com.common.data.DateFormatUtil;
 import com.common.thread.ThreadManager;
 import com.core.app.MyApplication;
 import com.core.broadcast.MsgBroadcast;
@@ -126,6 +126,7 @@ public class XChatManager {
     private MessageListener mMessageListener = new MessageListener() {
         @Override
         public void processMessage(Chat arg0, Message message) {
+            LogUtil.i("message="+message.getBody());
             String from = message.getFrom();
             String to = message.getTo();
             if (TextUtils.isEmpty(from) || TextUtils.isEmpty(to)) {
@@ -139,15 +140,11 @@ public class XChatManager {
             }
             saveSingleMessage(message, false);//将消息保存到本地
             if (mService != null) {
-                Log.d("roamer", "chatMessage:开始 "+ DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
                 ChatMessage chatMessage = new ChatMessage(message.getBody());
-                Log.d("roamer", "chatMessage: 结束 "+ DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
                 if (chatMessage != null && chatMessage.getFromUserId() != mLoginUserId) {
                     mService.notificationMesage(chatMessage);
                 }
             }
-            Log.d("roamer", "将消息保存到本地");
-           
         }
     };
 

+ 27 - 0
app_core/common/src/main/java/com/core/xmpp/model/ChatMessage.java

@@ -6,11 +6,15 @@ import android.text.TextUtils;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.common.data.JSONUtil;
 import com.core.xmpp.dao.ChatMessageDaoImpl;
 import com.core.model.XmppMessage;
 import com.j256.ormlite.field.DatabaseField;
 import com.j256.ormlite.table.DatabaseTable;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * @项目名称: SkWeiChat-Baidu
  * @包名: com.xzjmyk.pm.activity.bean.message
@@ -380,4 +384,27 @@ public class ChatMessage extends XmppMessage implements Parcelable {
         }
 
     };
+
+    @Override
+    public String toString() {
+        Map<String, Object> map = new HashMap<>();
+        map.put("_id", _id);
+        map.put("content", content);
+        map.put("filePath", filePath);
+        map.put("fileSize", fileSize);
+        map.put("fromUserId", fromUserId);
+        map.put("fromUserName", fromUserName);
+        map.put("location_x", location_x);
+        map.put("location_y", location_y);
+        map.put("messageState", messageState);
+        map.put("objectId", objectId);
+        map.put("packetId", packetId);
+        map.put("sipDuration", sipDuration);
+        map.put("sipStatus", sipStatus);
+        map.put("timeLen", timeLen);
+        map.put("timeReceive", timeReceive);
+        map.put("timeSend", timeSend);
+        map.put("type", type);
+        return JSONUtil.map2JSON(map);
+    }
 }

+ 2 - 0
app_modular/appmessages/build.gradle

@@ -23,7 +23,9 @@ dependencies {
     compile fileTree(include: ['*.jar'], dir: 'libs')
     testCompile deps.junit
     compile deps.appcompatV7
+    compile deps.recyclerviewV7
     compile project(':common')
     compile project(':network')
     compile project(':appworks')
+    compile 'com.android.support.constraint:constraint-layout:1.0.2'
 }

+ 11 - 9
app_modular/appmessages/src/main/AndroidManifest.xml

@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="com.modular.appmessages">
 
@@ -5,23 +6,24 @@
         android:allowBackup="true"
         android:label="@string/app_name"
         android:supportsRtl="true">
-        <activity android:name="com.modular.appmessages.activity.MsgsSecondCommonActivity" />
-        <activity android:name="com.modular.appmessages.activity.PlatMsgThirdActivity" />
-        <activity android:name="com.modular.appmessages.activity.ProcessB2BActivity" />
+        <activity android:name=".activity.MsgsSecondCommonActivity" />
+        <activity android:name=".activity.PlatMsgThirdActivity" />
+        <activity android:name=".activity.ProcessB2BActivity" />
         <activity
-            android:name="com.modular.appmessages.activity.ComplaintDetailActivity"
+            android:name=".activity.ComplaintDetailActivity"
             android:label="@string/complaint_doc" />
         <activity
-            android:name="com.modular.appmessages.activity.ProcessMsgActivity"
+            android:name=".activity.ProcessMsgActivity"
             android:label="@string/title_activity_process_msg" />
-        <activity android:name="com.modular.appmessages.activity.AppWebViewActivity" />
-        <activity android:name="com.modular.appmessages.activity.ApprovalActivity" />
+        <activity android:name=".activity.AppWebViewActivity" />
+        <activity android:name=".activity.ApprovalActivity" />
         <activity
-            android:name="com.modular.appmessages.activity.Subscription2Activity"
+            android:name=".activity.Subscription2Activity"
             android:label="@string/subscribe_title" />
         <activity
             android:name=".activity.SubcribeManageActivity"
             android:theme="@style/StyledIndicators" />
+        <activity android:name=".activity.UUHelperActivity"></activity>
     </application>
 
-</manifest>
+</manifest>

+ 15 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/activity/UUHelperActivity.java

@@ -0,0 +1,15 @@
+package com.modular.appmessages.activity;
+
+import android.os.Bundle;
+
+import com.core.base.BaseActivity;
+import com.modular.appmessages.R;
+
+public class UUHelperActivity extends BaseActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_uuhelper);
+    }
+}

+ 175 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/adapter/UUHelperAdapter.java

@@ -0,0 +1,175 @@
+package com.modular.appmessages.adapter;
+
+import android.content.Context;
+import android.support.v7.widget.DefaultItemAnimator;
+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 android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.modular.appmessages.R;
+import com.modular.appmessages.model.UUHelperModel;
+import com.nostra13.universalimageloader.core.ImageLoader;
+
+import java.util.List;
+
+
+/**
+ * Created by Bitliker on 2017/9/7.
+ */
+
+public class UUHelperAdapter extends RecyclerView.Adapter<UUHelperAdapter.ViewHolder> {
+
+    private Context ct;
+    private List<UUHelperModel> models;
+    private LayoutInflater inflater;
+
+    public UUHelperAdapter(Context ct, List<UUHelperModel> models) {
+        this.ct = ct;
+        this.models = models;
+    }
+
+    public List<UUHelperModel> getModels() {
+        return models;
+    }
+
+    public void setModels(List<UUHelperModel> models) {
+        this.models = models;
+    }
+
+    public void insertStart(List<UUHelperModel> startModels) {
+        if (startModels == null || startModels.size() <= 0) return;
+        if (models == null || models.size() <= 0) {
+            setModels(startModels);
+            notifyDataSetChanged();
+        } else {
+            models.addAll(0, startModels);
+            notifyItemRangeInserted(0, startModels.size());
+        }
+    }
+
+    public void insertEnd(List<UUHelperModel> startModels) {
+        if (startModels == null || startModels.size() <= 0) return;
+        if (models == null || models.size() <= 0) {
+            setModels(startModels);
+            notifyDataSetChanged();
+        } else {
+            int startItem = models.size();
+            models.addAll(startModels);
+            notifyItemRangeInserted(startItem, models.size());
+        }
+    }
+
+
+    @Override
+    public UUHelperAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+        return new ViewHolder(parent);
+    }
+
+    @Override
+    public void onBindViewHolder(ViewHolder holder, int position) {
+        UUHelperModel model = models.get(position);
+        holder.itemRV.setTag(model.getDateShow());
+        holder.itemRV.setAdapter(new ItemAdapter(model.getItems()));
+    }
+
+    @Override
+    public int getItemCount() {
+        return models == null ? 0 : models.size();
+    }
+
+    class ViewHolder extends RecyclerView.ViewHolder {
+        TextView timeTV;
+        RecyclerView itemRV;
+
+        public ViewHolder(ViewGroup parent) {
+            this(getViewByLayout(R.layout.item_uuhelper, parent));
+        }
+
+        public ViewHolder(View itemView) {
+            super(itemView);
+            timeTV = (TextView) itemView.findViewById(R.id.timeTV);
+            itemRV = (RecyclerView) itemView.findViewById(R.id.itemRV);
+            itemRV.setLayoutManager(new LinearLayoutManager(ct));
+            itemRV.setItemAnimator(new DefaultItemAnimator());
+        }
+    }
+
+
+    private class ItemAdapter extends RecyclerView.Adapter<ItemAdapter.ItemViewHolder> {
+        private List<UUHelperModel.UUHelperItem> items;
+
+        public ItemAdapter(List<UUHelperModel.UUHelperItem> items) {
+            this.items = items;
+        }
+
+        public void setItems(List<UUHelperModel.UUHelperItem> items) {
+            this.items = items;
+        }
+
+        @Override
+        public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+            return new ItemViewHolder(parent);
+        }
+
+        @Override
+        public int getItemCount() {
+            return this.items == null ? 0 : this.items.size();
+        }
+
+        class ItemViewHolder extends RecyclerView.ViewHolder {
+            RelativeLayout fristRL, normalRL;
+            ImageView fristIV, normalIV;
+            TextView fristTV, normalTV;
+            View line;
+
+            public ItemViewHolder(ViewGroup parent) {
+                this(getViewByLayout(R.layout.item_uuhelper_item, parent));
+            }
+
+            public ItemViewHolder(View itemView) {
+                super(itemView);
+                fristRL = (RelativeLayout) itemView.findViewById(R.id.fristRL);
+                normalRL = (RelativeLayout) itemView.findViewById(R.id.normalRL);
+                fristIV = (ImageView) itemView.findViewById(R.id.fristIV);
+                normalIV = (ImageView) itemView.findViewById(R.id.normalIV);
+                fristTV = (TextView) itemView.findViewById(R.id.fristTV);
+                normalTV = (TextView) itemView.findViewById(R.id.normalTV);
+                line = itemView.findViewById(R.id.line);
+            }
+        }
+
+        @Override
+        public void onBindViewHolder(ItemViewHolder holder, int position) {
+            UUHelperModel.UUHelperItem model = this.items.get(position);
+            if (position == 0) {
+                holder.fristRL.setVisibility(View.VISIBLE);
+                holder.normalRL.setVisibility(View.GONE);
+                ImageLoader.getInstance().displayImage(model.getImageUrl(), holder.fristIV);
+                holder.fristTV.setText(model.getContent());
+            } else {
+                holder.fristRL.setVisibility(View.GONE);
+                holder.normalRL.setVisibility(View.VISIBLE);
+                ImageLoader.getInstance().displayImage(model.getImageUrl(), holder.normalIV);
+                holder.normalTV.setText(model.getContent());
+            }
+            if (position == (items.size() - 1)) {
+                holder.line.setVisibility(View.GONE);
+            } else {
+                holder.line.setVisibility(View.VISIBLE);
+            }
+        }
+    }
+
+
+    private View getViewByLayout(int layout, ViewGroup parent) {
+        if (inflater == null) {
+            inflater = LayoutInflater.from(ct);
+        }
+        return inflater.inflate(layout, parent, false);
+    }
+}

+ 28 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/db/UUHelperDao.java

@@ -0,0 +1,28 @@
+package com.modular.appmessages.db;
+
+
+import android.content.ContentValues;
+import android.database.Cursor;
+
+import com.core.dao.Dao;
+
+/**
+ * Created by Bitliker on 2017/9/8.
+ */
+
+public class UUHelperDao extends Dao {
+    @Override
+    protected String getTable() {
+        return null;
+    }
+
+    @Override
+    protected ContentValues getValues(Object o) throws Exception {
+        return null;
+    }
+
+    @Override
+    protected Object getData(Cursor c) throws Exception {
+        return null;
+    }
+}

+ 84 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/model/UUHelperModel.java

@@ -0,0 +1,84 @@
+package com.modular.appmessages.model;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by Bitliker on 2017/9/7.
+ */
+
+public class UUHelperModel {
+    private String date;
+    private String dateShow;
+    private List<UUHelperItem> items;
+
+    public  static  class UUHelperItem {
+        private long timeSend;//发送时间
+        private String date;//发送日期(通过timeSend)
+        private String imageUrl;//图片网址
+        private String linkUrl;//链接网址
+        private String content;//显示内容
+
+        public UUHelperItem(long timeSend, String imageUrl, String linkUrl, String content) {
+            this.timeSend = timeSend;
+            this.imageUrl = imageUrl;
+            this.linkUrl = linkUrl;
+            this.content = content;
+            //TODO 使用DateFormatUtil
+            date = new SimpleDateFormat("yyyy-MM-dd").format(this.timeSend);
+        }
+
+        public long getTimeSend() {
+            return timeSend;
+        }
+
+        public String getDate() {
+            return date;
+        }
+
+        public String getImageUrl() {
+            return imageUrl;
+        }
+
+        public String getLinkUrl() {
+            return linkUrl;
+        }
+
+        public String getContent() {
+            return content;
+        }
+    }
+
+    public UUHelperModel(long timeSend ) {
+        this.date =new SimpleDateFormat("yyyy-MM-dd").format( timeSend);
+    }
+
+    public String getDate() {
+        return date;
+    }
+
+    public String getDateShow() {
+        return dateShow == null ? "" : dateShow;
+    }
+
+    public List<UUHelperItem> getItems() {
+        return items == null ? items = new ArrayList<UUHelperItem>() : items;
+    }
+
+    public void setDateShow(String dateShow) {
+        this.dateShow = dateShow;
+    }
+
+    public void addItem(long timeSend, String imageUrl, String linkUrl, String content) {
+        getItems().add(new UUHelperItem(timeSend, imageUrl, linkUrl, content));
+    }
+
+    public void addItem(UUHelperItem item) {
+        getItems().add(item);
+    }
+
+    public void addItems(List<UUHelperItem> items) {
+        getItems().addAll(items);
+    }
+}

+ 10 - 0
app_modular/appmessages/src/main/res/drawable/rl_circular_bg.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape>
+            <solid android:color="@color/white" />
+            <corners android:radius="8dp" />
+            <padding android:bottom="4dp" android:left="6dp" android:right="6dp" android:top="4dp" />
+        </shape>
+    </item>
+</selector>

+ 9 - 0
app_modular/appmessages/src/main/res/drawable/text_angle_hint_bg.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape>
+            <solid android:color="#aeaeae" />
+            <padding android:bottom="4dp" android:left="6dp" android:right="6dp" android:top="4dp" />
+        </shape>
+    </item>
+</selector>

+ 10 - 0
app_modular/appmessages/src/main/res/drawable/text_hint_bg.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape>
+            <solid android:color="#aeaeae" />
+            <corners android:radius="8dp" />
+            <padding android:bottom="4dp" android:left="6dp" android:right="6dp" android:top="4dp" />
+        </shape>
+    </item>
+</selector>

+ 9 - 0
app_modular/appmessages/src/main/res/layout/activity_uuhelper.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout 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"
+              tools:context="com.modular.appmessages.activity.UUHelperActivity">
+
+</LinearLayout>

+ 31 - 0
app_modular/appmessages/src/main/res/layout/item_uuhelper.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+
+    <TextView
+        android:id="@+id/timeTV"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerHorizontal="true"
+        android:background="@drawable/text_hint_bg"
+        android:text="2017-11-11 10:11:11"
+        android:textColor="@color/white"
+        android:textSize="@dimen/text_main" />
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@+id/timeTV"
+        android:layout_marginLeft="20dp"
+        android:layout_marginRight="20dp"
+        android:layout_marginTop="10dp"
+        android:background="@drawable/rl_circular_bg">
+
+        <android.support.v7.widget.RecyclerView
+            android:id="@+id/itemRV"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" />
+    </RelativeLayout>
+
+</RelativeLayout>

+ 57 - 0
app_modular/appmessages/src/main/res/layout/item_uuhelper_item.xml

@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+             android:layout_width="match_parent"
+             android:layout_height="wrap_content">
+
+    <RelativeLayout
+        android:id="@+id/fristRL"
+        android:layout_width="match_parent"
+        android:layout_height="100dp">
+
+        <ImageView
+            android:id="@+id/fristIV"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:scaleType="fitXY" />
+
+        <TextView
+            android:id="@+id/fristTV"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:background="@drawable/text_angle_hint_bg"
+            android:text="fristIV"
+            android:textColor="@color/white"
+            android:textSize="@dimen/text_main" />
+    </RelativeLayout>
+
+    <RelativeLayout
+        android:id="@+id/normalRL"
+        android:layout_width="match_parent"
+        android:layout_height="60dp">
+
+        <ImageView
+            android:id="@+id/normalIV"
+            android:layout_width="55dp"
+            android:layout_height="55dp"
+            android:layout_alignParentRight="true"
+            android:scaleType="fitXY" />
+
+        <TextView
+            android:id="@+id/normalTV"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_toLeftOf="@id/normalIV"
+            android:textSize="@dimen/text_main" />
+
+        <View
+            android:id="@+id/line"
+            android:layout_width="match_parent"
+            android:layout_height="2px"
+            android:layout_alignBottom="@+id/normalIV"
+            android:layout_below="@id/normalIV"
+            android:layout_marginLeft="10dp"
+            android:layout_marginRight="10dp"
+            android:background="@color/item_line" />
+    </RelativeLayout>
+</FrameLayout>