From 954a14662beed8c5d8cb77b140b8e1ef9f56d0a8 Mon Sep 17 00:00:00 2001 From: hch <16607480311@163.com> Date: Wed, 3 Apr 2024 18:25:27 +0800 Subject: [PATCH] =?UTF-8?q?fix=20[=E4=BF=AE=E5=A4=8D-=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E9=97=AE=E9=A2=98=E3=80=81=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=BF=85=E5=A1=AB=E4=BF=A1=E6=81=AF=E9=97=AE=E9=A2=98]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../res/layout/activity_community_details.xml | 2 +- .../res/layout/item_comment_reply_view.xml | 1 + .../src/main/res/layout/item_comment_view.xml | 2 ++ .../activity/CommunityDetailsActivity.java | 29 +++++++++++++++++++ .../main/activity/CommunitySendActivity.java | 6 +--- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/common/src/main/res/layout/activity_community_details.xml b/common/src/main/res/layout/activity_community_details.xml index c6e484e..9535574 100644 --- a/common/src/main/res/layout/activity_community_details.xml +++ b/common/src/main/res/layout/activity_community_details.xml @@ -38,7 +38,7 @@ android:layout_height="70dp" android:padding="1dp" android:scaleType="centerCrop" - app:riv_oval="true" /> + app:riv_corner_radius="20dp" /> diff --git a/common/src/main/res/layout/item_comment_view.xml b/common/src/main/res/layout/item_comment_view.xml index 61cf8c6..10b5dd9 100644 --- a/common/src/main/res/layout/item_comment_view.xml +++ b/common/src/main/res/layout/item_comment_view.xml @@ -17,6 +17,7 @@ android:id="@+id/avatar" android:layout_width="30dp" android:layout_height="30dp" + android:scaleType="centerCrop" android:src="@mipmap/icon_data_empty" app:riv_oval="true" /> @@ -123,6 +124,7 @@ android:id="@+id/avatar01" android:layout_width="23dp" android:layout_height="23dp" + android:scaleType="centerCrop" android:src="@mipmap/icon_data_empty" app:riv_corner_radius="20dp" /> diff --git a/main/src/main/java/com/yunbao/main/activity/CommunityDetailsActivity.java b/main/src/main/java/com/yunbao/main/activity/CommunityDetailsActivity.java index c62a2eb..867375d 100644 --- a/main/src/main/java/com/yunbao/main/activity/CommunityDetailsActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/CommunityDetailsActivity.java @@ -4,6 +4,7 @@ import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.graphics.Color; +import android.text.TextUtils; import android.util.SparseArray; import android.view.View; import android.view.WindowManager; @@ -30,6 +31,7 @@ import com.yunbao.common.bean.ActiveBean; import com.yunbao.common.bean.CommentBean; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.dialog.ImagePreviewDialog; +import com.yunbao.common.event.FollowEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; @@ -44,9 +46,14 @@ import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.NineGridLayout; import com.yunbao.common.views.TopGradual; +import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.share.bean.ShareBean; import com.yunbao.share.ui.SharePopDialog; +import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -103,6 +110,7 @@ public class CommunityDetailsActivity extends AbsActivity { activeId = getIntent().getStringExtra(Constants.TO_COMMUNITY_ID); initView(); initData(); + EventBus.getDefault().register(this); } private void initView() { @@ -366,6 +374,27 @@ public class CommunityDetailsActivity extends AbsActivity { }); } + /** + * 监听关注变化事件 + */ + @Subscribe(threadMode = ThreadMode.MAIN) + public void onFollowEvent(FollowEvent e) { + if (!TextUtils.isEmpty(activeBean.getUser_id()) && activeBean.getUser_id().equals(e.getToUid())) { + activeBean.setIs_attention(String.valueOf(e.getIsAttention())); + if (e.getIsAttention() == 1) {//关注 + ImgLoader.display(CommunityDetailsActivity.this, R.mipmap.icon_like_followed, followIcon); + followName.setText(getResources().getString(R.string.following)); + followName.setTextColor(Color.parseColor("#777777")); + followLayout.setBackground(getResources().getDrawable(R.drawable.bg_main_com_type_1)); + } else { + ImgLoader.display(CommunityDetailsActivity.this, R.mipmap.icon_like_follow, followIcon); + followName.setText(getResources().getString(R.string.follow)); + followName.setTextColor(getResources().getColor(R.color.white)); + followLayout.setBackground(getResources().getDrawable(R.drawable.bg_main_com_type)); + } + } + } + @SuppressLint("UseCompatLoadingForDrawables") private void initData() { LiveNetManager.get(mContext).getDynamicInfo(activeId, new com.yunbao.common.http.base.HttpCallback() { diff --git a/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java b/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java index 0e98349..ca39f10 100644 --- a/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java @@ -86,7 +86,7 @@ public class CommunitySendActivity extends AbsActivity { private List imgUrlList = new ArrayList<>(); private String videoUrl; List newCommunityTypeList = new ArrayList<>(); - int talkId; + int talkId = 0; Dialog dialog; private Uri videoUri; @@ -129,10 +129,6 @@ public class CommunitySendActivity extends AbsActivity { return; } } - if (StringUtil.isEmpty(talkContent.getText().toString())) { - ToastUtil.show(mContext.getResources().getString(com.yunbao.main.R.string.please_input_content)); - return; - } List uploadBeanList = new ArrayList<>(); if (isImage) { for (int i = 0; i < activeImageAdapter.getImageFileList().size(); i++) {