6.5.4礼物冠名

This commit is contained in:
18401019693 2023-08-02 17:47:00 +08:00
parent b78fef6adc
commit 8ed7595aec
6 changed files with 408 additions and 0 deletions

View File

@ -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) {

View File

@ -5,6 +5,7 @@
<!--com.kugou.fanxing.allinone.watch.liveroominone.media.FALiveRoomInOneActivity"-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:allowBackup="true"
@ -15,6 +16,11 @@
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
<activity
android:name=".activity.GiftWallActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
<activity
android:name=".activity.LiveAudienceActivity"
android:configChanges="screenLayout|orientation"

View File

@ -0,0 +1,190 @@
package com.yunbao.live.activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentTransaction;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.lxj.xpopup.XPopup;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.event.GiftWallItemEvent;
import com.yunbao.common.event.LiveGiftDialogEvent;
import com.yunbao.common.fragment.AllServiceChampionFragment;
import com.yunbao.common.fragment.GiftWithoutWallFragment;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.dialog.CodexDialog;
import com.yunbao.live.dialog.GiftWallItemPopup;
import com.yunbao.live.dialog.RegularIntroducePopup;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.views.GiftAlreadyWallFragment;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
@Route(path = RouteUtil.PATH_GIFT_WALL)
public class GiftWallActivity extends AbsActivity {
private LinearLayout layoutLitIcon, layoutUnlitIcon, layoutAllServiceChampion;
private TextView textLitIcon, textUnlitIcon, textAllServiceChampion, anchorName;
private View viewAllServiceChampion, viewUnlitIcon, viewLitIcon, attention;
private RoundedImageView avatar;
private List<TextView> tabText = new ArrayList<>();
private List<View> 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<Integer>() {
@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();
}
}

View File

@ -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;

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:centerColor="#8391FE"
android:endColor="#818CFF"
android:startColor="#8D9DFF" />
</shape>

View File

@ -0,0 +1,192 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_gift_wall_shape"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:background="@mipmap/background_gift_wall"
android:orientation="vertical">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="41dp"
android:layout_height="41dp"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="11dp"
android:scaleType="centerCrop"
android:src="@drawable/m_chu_xia"
app:riv_oval="true" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:gravity="center_vertical">
<TextView
android:id="@+id/anchor_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="主播昵称"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
android:id="@+id/attention"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginStart="4dp"
android:src="@mipmap/icon_following_anchor" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginStart="6dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="6dp"
android:background="@mipmap/background_giftwall_tab">
<TextView
android:id="@+id/codex_layout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@string/codex"
android:textColor="#184DED"
android:textSize="16sp" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@string/honorary_achievement"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="15dp"
android:layout_marginTop="14dp"
android:layout_marginEnd="15dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="4dp"
android:background="@drawable/bg_gift_wall_list"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="41dp">
<LinearLayout
android:id="@+id/layout_lit_icon"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/text_lit_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="@string/lit_icon"
android:textColor="#3E68FF"
android:textSize="14sp"
android:textStyle="italic|bold" />
<View
android:id="@+id/view_lit_icon"
android:layout_width="18dp"
android:layout_height="5dp"
android:background="@drawable/tablayout_gift_wall" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_unlit_icon"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/text_unlit_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="@string/unlit_icon"
android:textColor="#3E68FF"
android:textSize="14sp"
android:textStyle="italic" />
<View
android:id="@+id/view_unlit_icon"
android:layout_width="18dp"
android:layout_height="5dp"
android:background="@drawable/tablayout_gift_wall" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_all_service_champion"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/text_all_service_champion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="@string/all_service_champion"
android:textColor="#3E68FF"
android:textSize="14sp"
android:textStyle="italic" />
<View
android:id="@+id/view_all_service_champion"
android:layout_width="18dp"
android:layout_height="5dp"
android:background="@drawable/tablayout_gift_wall" />
</LinearLayout>
</LinearLayout>
<FrameLayout
android:id="@+id/context_layout_gift"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<TextView
android:layout_width="148dp"
android:layout_height="27dp"
android:layout_gravity="center_horizontal"
android:background="@mipmap/background_gift_wall_title"
android:gravity="center"
android:text="@string/gift_wall"
android:textColor="#3E68FF"
android:textSize="15sp" />
</FrameLayout>
</LinearLayout>
</FrameLayout>