From cd4d0c13c1a821ac15cd3090ec0c942377728e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E7=9A=AE?= <14840170+lao-pi123@user.noreply.gitee.com> Date: Thu, 12 Sep 2024 13:23:42 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E8=8B=B1=E8=AF=AD?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E7=9A=84UI=E6=98=BE=E7=A4=BA=202?= =?UTF-8?q?=E3=80=81=E7=A7=BB=E9=99=A4=E4=B8=8B=E6=A0=87=E7=9A=84=E7=BA=A2?= =?UTF-8?q?=E7=82=B9=EF=BC=8C=E6=94=B9=E5=88=B0=E6=B6=88=E6=81=AF=E4=B8=AD?= =?UTF-8?q?=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/res/layout/item_new_game_room.xml | 19 ++++++++++---- common/src/main/res/values-zh/strings.xml | 1 + common/src/main/res/values/strings.xml | 1 + .../yunbao/main/activity/MainActivity.java | 19 ++++++++------ .../yunbao/main/adapter/MainMeAdapter.java | 11 +++++++- .../main/event/MessageRefreshEvent.java | 6 +++++ .../yunbao/main/views/MainMeViewHolder.java | 16 ++++++++++++ .../main/res/layout/item_game_room_type_1.xml | 8 +++++- .../main/res/layout/item_game_room_type_2.xml | 8 +++++- main/src/main/res/layout/item_main_me_2.xml | 25 ++++++++++++++++--- main/src/main/res/layout/view_new_main_me.xml | 11 +++++--- 11 files changed, 103 insertions(+), 22 deletions(-) create mode 100644 main/src/main/java/com/yunbao/main/event/MessageRefreshEvent.java diff --git a/common/src/main/res/layout/item_new_game_room.xml b/common/src/main/res/layout/item_new_game_room.xml index fd5e57de1..eee4211ac 100644 --- a/common/src/main/res/layout/item_new_game_room.xml +++ b/common/src/main/res/layout/item_new_game_room.xml @@ -72,7 +72,7 @@ /> diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index f7667fcef..602355714 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -809,6 +809,7 @@ 每日13:00PM-1:00AM 撤回 開通貴族享受專屬特權! + 開通貴族享專屬特權 與喜歡的人不期而遇~ 暫無動態消息哦~~ diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 28142c211..2a7e606b4 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -768,6 +768,7 @@ Withdraw Open VIP and enjoy exclusive privileges! + Open VIP and enjoy exclusive privileges! Meet someone you like by chance~ There is no news yet~~ diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 76d917dc0..1219ffaa1 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -61,6 +61,7 @@ import com.yunbao.common.bean.QiniuLog; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.server.DownloadService; import com.yunbao.common.utils.AppManager; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.L; import com.yunbao.common.utils.LogUtil; import com.yunbao.common.utils.MobclickAgent; @@ -129,6 +130,7 @@ import com.yunbao.main.dialog.AnchorStartLiveNotifyDialog; import com.yunbao.main.dialog.MainStartDialogFragment; import com.yunbao.main.dialog.ReturnUserDialog; import com.yunbao.main.dialog.SigninDialog; +import com.yunbao.main.event.MessageRefreshEvent; import com.yunbao.main.event.PDLiveConversationListEvent; import com.yunbao.main.http.MainHttpConsts; import com.yunbao.main.http.MainHttpUtil; @@ -207,7 +209,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene private boolean isWebClose = false; public static boolean isTabClose = false; private boolean isFirstOpen = true; - private int messageNumber = 0, numberMe = 0; + public static int messageNumber = 0; + private static int numberMe = 0; private ImageView waitingTip; private FloatBannerView floatBanner; private boolean isfloatBannernet = true, isFirst = true; @@ -651,11 +654,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene MainHttpUtil.getBaseInfo(new CommonCallback() { @Override public void callback(UserBean bean) { - if (bean.getUserInfoComplete() == 0) { + /* if (bean.getUserInfoComplete() == 0) { v_table_redpoint_me.setVisibility(View.VISIBLE); } else { v_table_redpoint_me.setVisibility(View.GONE); - } + }*/ } }); @@ -1511,7 +1514,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) public void onMessageIMEvent(MessageIMEvent event) { messageNumber = event.getNumber(); - if (event.getNumber() > 0) { + Bus.get().post(new MessageRefreshEvent()); + + /* if (event.getNumber() > 0) { v_table_redpoint.setVisibility(View.VISIBLE); if (event.getNumber() > 99) { v_table_redpoint.setText("99+"); @@ -1522,7 +1527,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } else { v_table_redpoint.setVisibility(View.GONE); v_table_redpoint.setText(""); - } + }*/ } //红点(我的) @@ -1539,11 +1544,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene //红点(我的) @Subscribe(threadMode = ThreadMode.MAIN) public void onCompleteInformationEvent(CompleteInformationEvent event) { - if (event.isCompleteInformation()) { + /*if (event.isCompleteInformation()) { v_table_redpoint_me.setVisibility(View.VISIBLE); } else { v_table_redpoint_me.setVisibility(View.GONE); - } + }*/ } /** diff --git a/main/src/main/java/com/yunbao/main/adapter/MainMeAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainMeAdapter.java index e12668ce6..eca6c42f7 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainMeAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainMeAdapter.java @@ -15,6 +15,7 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.main.R; +import com.yunbao.main.activity.MainActivity; import java.util.List; @@ -104,12 +105,14 @@ public class MainMeAdapter extends RecyclerView.Adapter { class Vh extends RecyclerView.ViewHolder { ImageView mThumb; - TextView mName; + TextView mName,message_redpoint; + public Vh(View itemView) { super(itemView); mThumb = (ImageView) itemView.findViewById(R.id.thumb); mName = (TextView) itemView.findViewById(R.id.name); + message_redpoint = (TextView) itemView.findViewById(R.id.message_redpoint); ViewClicksAntiShake.clicksAntiShake(itemView, () -> { Object tag = itemView.getTag(); if (tag != null) { @@ -125,6 +128,12 @@ public class MainMeAdapter extends RecyclerView.Adapter { itemView.setTag(bean); ImgLoader.display(mContext, bean.getThumb(), mThumb); mName.setText(bean.getName()); + if (MainActivity.messageNumber > 0 && bean.getId() == 101){ + message_redpoint.setVisibility(View.VISIBLE); + message_redpoint.setText(String.valueOf(MainActivity.messageNumber)); + }else { + message_redpoint.setVisibility(View.GONE); + } } } } diff --git a/main/src/main/java/com/yunbao/main/event/MessageRefreshEvent.java b/main/src/main/java/com/yunbao/main/event/MessageRefreshEvent.java new file mode 100644 index 000000000..de225cc19 --- /dev/null +++ b/main/src/main/java/com/yunbao/main/event/MessageRefreshEvent.java @@ -0,0 +1,6 @@ +package com.yunbao.main.event; + +import com.yunbao.common.bean.BaseModel; + +public class MessageRefreshEvent extends BaseModel { +} diff --git a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java index b59a5bfb3..d037e64b5 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java @@ -30,6 +30,7 @@ import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; @@ -71,10 +72,14 @@ import com.yunbao.main.activity.SettingActivity; import com.yunbao.main.activity.ThreeDistributActivity; import com.yunbao.main.activity.ZhuangBanActivity; import com.yunbao.main.adapter.MainMeAdapter; +import com.yunbao.main.event.EditProfileEvent; +import com.yunbao.main.event.MessageRefreshEvent; import com.yunbao.main.http.MainHttpConsts; import com.yunbao.main.http.MainHttpUtil; import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; import java.math.BigDecimal; import java.net.MalformedURLException; @@ -116,9 +121,11 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi return R.layout.view_new_main_me; } + @SuppressLint("WrongViewCast") @Override public void init() { + Bus.getOn(this); mAvatar = (ImageView) findViewById(R.id.avatar); ViewClicksAntiShake.clicksAntiShake(mAvatar, new ViewClicksAntiShake.ViewClicksCallBack() { @Override @@ -196,6 +203,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi @Override public void onDestroy() { super.onDestroy(); + Bus.getOff(this); MainHttpUtil.cancel(MainHttpConsts.GET_BASE_INFO); } @@ -267,6 +275,14 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi private List mBannerListNew = new ArrayList<>(); + + @SuppressLint("NotifyDataSetChanged") + @Subscribe(threadMode = ThreadMode.MAIN) + public void onMessageRefreshEvent(MessageRefreshEvent event) { + mAdapter.notifyDataSetChanged(); + } + + private void showData(UserBean u, List list) { mBannerList.clear(); mBannerListNew.clear(); diff --git a/main/src/main/res/layout/item_game_room_type_1.xml b/main/src/main/res/layout/item_game_room_type_1.xml index a990ca1dd..9db99762d 100644 --- a/main/src/main/res/layout/item_game_room_type_1.xml +++ b/main/src/main/res/layout/item_game_room_type_1.xml @@ -34,7 +34,7 @@ diff --git a/main/src/main/res/layout/item_game_room_type_2.xml b/main/src/main/res/layout/item_game_room_type_2.xml index f5770328a..ff0f7960e 100644 --- a/main/src/main/res/layout/item_game_room_type_2.xml +++ b/main/src/main/res/layout/item_game_room_type_2.xml @@ -24,7 +24,7 @@ /> diff --git a/main/src/main/res/layout/item_main_me_2.xml b/main/src/main/res/layout/item_main_me_2.xml index fc4fcb0cb..9b2994215 100644 --- a/main/src/main/res/layout/item_main_me_2.xml +++ b/main/src/main/res/layout/item_main_me_2.xml @@ -1,13 +1,17 @@ - + > @@ -17,10 +21,25 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="6dp" + app:layout_constraintTop_toBottomOf="@id/thumb" android:text="" android:singleLine="true" android:ellipsize="end" android:textColor="@color/textColor" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" android:textSize="12sp" /> - + + + diff --git a/main/src/main/res/layout/view_new_main_me.xml b/main/src/main/res/layout/view_new_main_me.xml index 955e3ecde..476f58dd0 100644 --- a/main/src/main/res/layout/view_new_main_me.xml +++ b/main/src/main/res/layout/view_new_main_me.xml @@ -360,12 +360,14 @@ android:id="@+id/user_noble_time" android:layout_width="0dp" android:layout_height="wrap_content" - android:text="@string/open_noble_text" - android:textColor="#000000" + android:text="@string/open_noble_text_new" + android:textColor="#777777" android:textSize="10sp" app:layout_constraintStart_toEndOf="@id/user_noble_ico" android:layout_marginStart="10dp" android:layout_marginBottom="5dp" + android:maxLines="2" + android:ellipsize="end" app:layout_constraintEnd_toEndOf="@id/guizu_center_tv" app:layout_constraintTop_toBottomOf="@id/user_noble_text" android:layout_marginEnd="5dp" @@ -420,14 +422,15 @@ android:layout_height="wrap_content" android:layout_marginTop="5dp" android:text="@string/guard_for_your_beloved_one" - android:textColor="#000000" + android:textColor="#777777" android:textSize="10sp" app:layout_constraintStart_toEndOf="@id/shouhu_center_iv" android:layout_marginStart="10dp" android:id="@+id/shouhu_center_tv2" app:layout_constraintEnd_toEndOf="@id/shouhu_center" app:layout_constraintTop_toBottomOf="@id/shouhu_center_tv" - + android:maxLines="2" + android:ellipsize="end" />