新增图文消息new角标
This commit is contained in:
@@ -5,6 +5,7 @@ import android.widget.ImageView;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.mango.core.manager.IMNetEaseManager;
|
||||||
import com.mango.moshen.ui.im.RouterHandler;
|
import com.mango.moshen.ui.im.RouterHandler;
|
||||||
import com.mango.xchat_android_library.utils.JavaUtil;
|
import com.mango.xchat_android_library.utils.JavaUtil;
|
||||||
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
|
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
|
||||||
@@ -14,6 +15,10 @@ import com.mango.moshen.R;
|
|||||||
import com.mango.moshen.ui.utils.ImageLoadUtils;
|
import com.mango.moshen.ui.utils.ImageLoadUtils;
|
||||||
import com.mango.moshen.ui.webview.CommonWebViewActivity;
|
import com.mango.moshen.ui.webview.CommonWebViewActivity;
|
||||||
import com.mango.core.im.custom.bean.NoticeAttachment;
|
import com.mango.core.im.custom.bean.NoticeAttachment;
|
||||||
|
import com.netease.nimlib.service.NimService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by chenran on 2017/9/21.
|
* Created by chenran on 2017/9/21.
|
||||||
@@ -21,10 +26,13 @@ import com.mango.core.im.custom.bean.NoticeAttachment;
|
|||||||
|
|
||||||
public class MsgViewHolderContent extends MsgViewHolderBase implements View.OnClickListener {
|
public class MsgViewHolderContent extends MsgViewHolderBase implements View.OnClickListener {
|
||||||
|
|
||||||
|
private final static String IS_NEW = "afafgaga";
|
||||||
|
|
||||||
private ImageView bg;
|
private ImageView bg;
|
||||||
private TextView title;
|
private TextView title;
|
||||||
private TextView desc;
|
private TextView desc;
|
||||||
private LinearLayout container;
|
private LinearLayout container;
|
||||||
|
private View ivNewTag;
|
||||||
|
|
||||||
public MsgViewHolderContent(BaseMultiItemFetchLoadAdapter adapter) {
|
public MsgViewHolderContent(BaseMultiItemFetchLoadAdapter adapter) {
|
||||||
super(adapter);
|
super(adapter);
|
||||||
@@ -41,6 +49,7 @@ public class MsgViewHolderContent extends MsgViewHolderBase implements View.OnCl
|
|||||||
title = findViewById(R.id.title);
|
title = findViewById(R.id.title);
|
||||||
desc = findViewById(R.id.desc);
|
desc = findViewById(R.id.desc);
|
||||||
container = findViewById(R.id.layout);
|
container = findViewById(R.id.layout);
|
||||||
|
ivNewTag = findViewById(R.id.iv_new_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -56,6 +65,24 @@ public class MsgViewHolderContent extends MsgViewHolderBase implements View.OnCl
|
|||||||
title.setText(attachment.getTitle());
|
title.setText(attachment.getTitle());
|
||||||
desc.setText(attachment.getDesc());
|
desc.setText(attachment.getDesc());
|
||||||
container.setOnClickListener(this);
|
container.setOnClickListener(this);
|
||||||
|
|
||||||
|
Map<String, Object> localExtension = message.getLocalExtension();
|
||||||
|
boolean isNew = false;
|
||||||
|
if (localExtension != null && localExtension.containsKey(IS_NEW)) {
|
||||||
|
isNew = (boolean) localExtension.get(IS_NEW);
|
||||||
|
} else {
|
||||||
|
isNew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNew) {
|
||||||
|
ivNewTag.setVisibility(View.VISIBLE);
|
||||||
|
if (localExtension == null) localExtension = new HashMap<>();
|
||||||
|
localExtension.put(IS_NEW, false);
|
||||||
|
message.setLocalExtension(localExtension);
|
||||||
|
IMNetEaseManager.get().updateMessageToLocal(message);
|
||||||
|
} else {
|
||||||
|
ivNewTag.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="240dp"
|
android:layout_width="240dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@@ -76,4 +76,12 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
<ImageView
|
||||||
|
android:id="@+id/iv_new_tag"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:src="@drawable/ic_me_new"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
Reference in New Issue
Block a user