From 8ed7595aec18935ed90848fee649b477aa0942ba Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 2 Aug 2023 17:47:00 +0800 Subject: [PATCH] =?UTF-8?q?6.5.4=E7=A4=BC=E7=89=A9=E5=86=A0=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/utils/RouteUtil.java | 11 + live/src/main/AndroidManifest.xml | 6 + .../live/activity/GiftWallActivity.java | 190 +++++++++++++++++ .../yunbao/live/views/LiveRoomViewHolder.java | 1 + .../drawable/background_gift_wall_shape.xml | 8 + .../res/layout/activity_live_gift_wall.xml | 192 ++++++++++++++++++ 6 files changed, 408 insertions(+) create mode 100644 live/src/main/java/com/yunbao/live/activity/GiftWallActivity.java create mode 100644 live/src/main/res/drawable/background_gift_wall_shape.xml create mode 100644 live/src/main/res/layout/activity_live_gift_wall.xml diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index aaae75cc4..e7346a06b 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -35,6 +35,7 @@ public class RouteUtil { public static final String PATH_MAIN = "/main/MainActivity"; public static final String PATH_ENTRY = "/main/EntryActivity"; public static final String PATH_LIVE_AUDIENCE = "/live/LiveAudienceActivity"; + public static final String PATH_GIFT_WALL = "/live/GiftWallActivity"; public static final String PATH_SETTING = "/main/SettingActivity"; public static final String PATH_FANSACTIVITY = "/main/FansActivity"; public static final String PATH_MYWEBVIEWACTIVTITY2 = "/main/MyWebViewActivity2"; @@ -232,6 +233,15 @@ public class RouteUtil { postcard.navigation(); } + public static void forwardGiftWallActivity(String mStream, String mAnchorName, String mLiveUid, String mAvatarUrl, int isAttention) { + ARouter.getInstance().build(PATH_GIFT_WALL) + .withString(Constants.LIVE_UID, mLiveUid) + .withString(Constants.STREAM, mStream) + .withString("mAnchorName", mAnchorName) + .withString("mAvatarUrl", mAvatarUrl) + .withInt("isAttention", isAttention) + .navigation(); + } /** * 举报个人 @@ -287,6 +297,7 @@ public class RouteUtil { /** * 红包发放情况 + * * @param id 发放者uid */ public static void forwardRedPacketUser(int id) { diff --git a/live/src/main/AndroidManifest.xml b/live/src/main/AndroidManifest.xml index d780e2f5e..71ec8f14e 100644 --- a/live/src/main/AndroidManifest.xml +++ b/live/src/main/AndroidManifest.xml @@ -5,6 +5,7 @@ + + tabText = new ArrayList<>(); + private List tabView = new ArrayList<>(); + private String mStream, mAnchorName, mLiveUid, mAvatarUrl; + private int isAttention = 0;//是否关注 0=没关注, + + @Override + protected int getLayoutId() { + return R.layout.activity_live_gift_wall; + } + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + Bus.getOn(this); + initView(); + initDate(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + Bus.getOff(this); + } + + private void initView() { + layoutLitIcon = findViewById(R.id.layout_lit_icon); + layoutUnlitIcon = findViewById(R.id.layout_unlit_icon); + layoutAllServiceChampion = findViewById(R.id.layout_all_service_champion); + textLitIcon = findViewById(R.id.text_lit_icon); + textUnlitIcon = findViewById(R.id.text_unlit_icon); + textAllServiceChampion = findViewById(R.id.text_all_service_champion); + viewAllServiceChampion = findViewById(R.id.view_all_service_champion); + viewUnlitIcon = findViewById(R.id.view_unlit_icon); + viewLitIcon = findViewById(R.id.view_lit_icon); + avatar = findViewById(R.id.avatar); + attention = findViewById(R.id.attention); + anchorName = findViewById(R.id.anchor_name); + tabText.add(textLitIcon); + tabText.add(textUnlitIcon); + tabText.add(textAllServiceChampion); + tabView.add(viewLitIcon); + tabView.add(viewUnlitIcon); + tabView.add(viewAllServiceChampion); + selectTab(textLitIcon, viewLitIcon); + ViewClicksAntiShake.clicksAntiShake(layoutLitIcon, () -> { + selectTab(textLitIcon, viewLitIcon); + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.context_layout_gift, GiftAlreadyWallFragment.newInstance(mStream, mLiveUid)); + transaction.commit(); + }); + ViewClicksAntiShake.clicksAntiShake(layoutUnlitIcon, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + selectTab(textUnlitIcon, viewUnlitIcon); + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.context_layout_gift, GiftWithoutWallFragment.newInstance(mStream, mLiveUid)); + transaction.commit(); + + } + }); + ViewClicksAntiShake.clicksAntiShake(layoutAllServiceChampion, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + selectTab(textAllServiceChampion, viewAllServiceChampion); + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.context_layout_gift, AllServiceChampionFragment.newInstance(mStream, mLiveUid)); + transaction.commit(); + } + }); + ViewClicksAntiShake.clicksAntiShake(attention, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + CommonHttpUtil.setAttention(mLiveUid, new CommonCallback() { + @Override + public void callback(Integer isAttention) { + if (isAttention == 1) { + LiveActivity.sendSystemMessage(IMLoginManager.get(GiftWallActivity.this).getUserInfo().getUserNicename() + + getString(R.string.live_follow_anchor)); + attention.setVisibility(View.GONE); + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.IS_ATTENTION).setLiveType(isAttention)); + } + } + }); + } + }); + + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.codex_layout), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + new XPopup.Builder(GiftWallActivity.this) + .enableDrag(false) + .asCustom(new CodexDialog(GiftWallActivity.this, mStream, mLiveUid, false)) + .show(); + } + }); + } + + private void initDate() { + Intent intent = getIntent(); + if (intent == null) { + return; + } + mLiveUid = intent.getStringExtra(Constants.LIVE_UID); + mStream = intent.getStringExtra(Constants.STREAM); + mAnchorName = intent.getStringExtra("mAnchorName"); + mAvatarUrl = intent.getStringExtra("mAvatarUrl"); + isAttention = intent.getIntExtra("isAttention", 0); + + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.context_layout_gift, GiftAlreadyWallFragment.newInstance(mStream, mLiveUid)); + transaction.commit(); + ImgLoader.display(GiftWallActivity.this, mAvatarUrl, avatar); + anchorName.setText(mAnchorName); + attention.setVisibility(isAttention == 0 ? View.VISIBLE : View.GONE); + } + + private void selectTab(TextView textView, View tab) { + for (TextView view : tabText) { + if (textView == view) { + view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD_ITALIC); + } else { + view.setTypeface(Typeface.SANS_SERIF, Typeface.ITALIC); + } + } + for (View view : tabView) { + view.setVisibility(view == tab ? View.VISIBLE : View.GONE); + } + } + + /** + * 关于点击礼物分类的通知 + */ + @Subscribe(threadMode = ThreadMode.MAIN) + public void onGiftWallItemEvent(GiftWallItemEvent event) { + new XPopup.Builder(this) + .asCustom(new GiftWallItemPopup(this, event.getGiftWallModel(), event.isUnlit(), mLiveUid, mStream)) + .show(); + } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onLiveGiftDialogEvent(LiveGiftDialogEvent event) { + onBackPressed(); + } +} \ No newline at end of file diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index beb8f40d1..b4086d48e 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -2668,6 +2668,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis bundle.putInt("isAttention", isAttention); giftWallDialog.setArguments(bundle); giftWallDialog.show(((AbsActivity) mContext).getSupportFragmentManager(), "GiftWallDialog"); +// RouteUtil.forwardGiftWallActivity(mStream,mAnchorName,mLiveUid,mAvatarUrl,isAttention); } public boolean pkHandler = true; diff --git a/live/src/main/res/drawable/background_gift_wall_shape.xml b/live/src/main/res/drawable/background_gift_wall_shape.xml new file mode 100644 index 000000000..652afc29f --- /dev/null +++ b/live/src/main/res/drawable/background_gift_wall_shape.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/activity_live_gift_wall.xml b/live/src/main/res/layout/activity_live_gift_wall.xml new file mode 100644 index 000000000..f9e5835f4 --- /dev/null +++ b/live/src/main/res/layout/activity_live_gift_wall.xml @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file