直播间UI调整,修改悬浮

This commit is contained in:
18401019693 2022-10-27 10:36:25 +08:00
parent 1d8cdf250d
commit 2891c3bf14
7 changed files with 118 additions and 33 deletions

View File

@ -6,43 +6,48 @@
android:orientation="vertical">
<TextView
android:id="@+id/fun_games"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:text="@string/fun_games"
android:visibility="gone"
android:textColor="@color/white"
android:textSize="14sp" />
android:textSize="14sp"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/fun_games_list"
android:layout_width="match_parent"
android:layout_height="62dp"
android:visibility="gone"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp" />
android:layout_marginTop="10dp"
android:visibility="gone" />
<TextView
android:id="@+id/value_added_benefits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="30dp"
android:text="@string/value_added_benefits"
android:textColor="@color/white"
android:textSize="14sp" />
android:textSize="14sp"
android:visibility="gone" />
<HorizontalScrollView
android:id="@+id/benefits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="none">
android:scrollbars="none"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:paddingEnd="16dp">
<LinearLayout
@ -114,6 +119,7 @@
<TextView
android:id="@+id/basic_tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
@ -123,6 +129,7 @@
android:textSize="14sp" />
<HorizontalScrollView
android:id="@+id/basic_tools_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -200,6 +207,7 @@
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/float_settings_layout"
android:layout_width="wrap_content"

View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -74,6 +74,7 @@ import com.yunbao.live.adapter.VerticalPagerAdapter;
import com.yunbao.live.bean.ImUserBean;
import com.yunbao.live.bean.LiveChatBean;
import com.yunbao.live.dialog.LiveFansFragment;
import com.yunbao.live.dialog.LiveGameDialogFragment;
import com.yunbao.live.dialog.LiveGiftDialogFragment;
import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LiveMicUserDialogFragment;
@ -683,7 +684,7 @@ public class LiveAudienceActivity extends LiveActivity {
@Subscribe(threadMode = ThreadMode.MAIN)
public void onOpenDrawer(LiveAudienceEvent event) {
Bundle bundle = new Bundle();
Log.i("SocketRyClient", "onOpenDrawer: "+event.getType()+" "+event);
Log.i("SocketRyClient", "onOpenDrawer: " + event.getType() + " " + event);
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
switch (event.getType()) {
case SIDEBAR:
@ -708,6 +709,9 @@ public class LiveAudienceActivity extends LiveActivity {
case BOTTOM_COLLECTION:
LiveTotalDialog liveTotalDialog = new LiveTotalDialog();
liveTotalDialog.setAnchorBean(mLiveBean);
Bundle liveBundle = new Bundle();
liveBundle.putBoolean("isActivity", event.isActivity());
liveTotalDialog.setArguments(liveBundle);
liveTotalDialog.show(getSupportFragmentManager(), "LiveTotalDialog");
break;
case GIFT_POPUP:
@ -729,6 +733,12 @@ public class LiveAudienceActivity extends LiveActivity {
liveHDDialogFragment.setArguments(bundle);
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
break;
case WE_CHEAT:
LiveGameDialogFragment fragment=new LiveGameDialogFragment();
fragment.selectIndex(3);
fragment.setRoomId(mLiveUid);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment");
break;
case FAN_CLUB:
LiveFansFragment liveFansFragment = new LiveFansFragment();

View File

@ -2,15 +2,21 @@ package com.yunbao.live.dialog;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.HorizontalScrollView;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.ActiveModel;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.adapter.FunGamesAdapter;
@ -19,6 +25,8 @@ import com.yunbao.live.event.LiveAudienceEvent;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.List;
/**
* 直播间合计弹窗
*/
@ -26,6 +34,8 @@ public class LiveTotalDialog extends AbsDialogFragment {
private RecyclerView funGamesList;
private FunGamesAdapter gamesAdapter;
private LiveBean anchorBean;//主播bean
private TextView funGames,valueAddedBenefits,basicTools;
private HorizontalScrollView benefits,basicToolsLayout;
@Override
protected int getLayoutId() {
@ -50,22 +60,48 @@ public class LiveTotalDialog extends AbsDialogFragment {
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Bus.getOn(this);
boolean isActivity = false;
Bundle bundle = getArguments();
if (bundle != null) {
isActivity = bundle.getBoolean("isActivity", false);
}
funGamesList = (RecyclerView) findViewById(R.id.fun_games_list);
funGames = (TextView) findViewById(R.id.fun_games);
valueAddedBenefits = (TextView) findViewById(R.id.value_added_benefits);
basicTools = (TextView) findViewById(R.id.basic_tools);
benefits = (HorizontalScrollView) findViewById(R.id.benefits);
basicToolsLayout = (HorizontalScrollView) findViewById(R.id.basic_tools_layout);
gamesAdapter = new FunGamesAdapter();
funGamesList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
funGamesList.setAdapter(gamesAdapter);
// LiveNetManager.get(getContext())
// .getActiveList(new HttpCallback<List<ActiveModel>>() {
// @Override
// public void onSuccess(List<ActiveModel> data) {
// if (!isDetached())
// gamesAdapter.addData(data);
// }
//
// @Override
// public void onError(String error) {
// }
// });
if (isActivity) {
funGames.setVisibility(View.VISIBLE);
funGamesList.setVisibility(View.VISIBLE);
valueAddedBenefits.setVisibility(View.VISIBLE);
benefits.setVisibility(View.VISIBLE);
basicTools.setVisibility(View.GONE);
basicToolsLayout.setVisibility(View.GONE);
LiveNetManager.get(getContext())
.getActiveList(new HttpCallback<List<ActiveModel>>() {
@Override
public void onSuccess(List<ActiveModel> data) {
if (!isDetached())
gamesAdapter.addData(data);
}
@Override
public void onError(String error) {
}
});
} else {
funGames.setVisibility(View.GONE);
funGamesList.setVisibility(View.GONE);
valueAddedBenefits.setVisibility(View.GONE);
benefits.setVisibility(View.GONE);
basicTools.setVisibility(View.VISIBLE);
basicToolsLayout.setVisibility(View.VISIBLE);
}
//周星榜
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_wks_layout), () -> {
Bus.get().post(new LiveAudienceEvent()

View File

@ -21,6 +21,16 @@ public class LiveAudienceEvent extends BaseModel {
private MsgModel msgModel;//全服消息
private AiAutomaticSpeechModel aiAutomaticSpeechModel;//机器人消息
private boolean voicePress = false;
private boolean isActivity = false;//是否展示趣味活动和增值权益
public boolean isActivity() {
return isActivity;
}
public LiveAudienceEvent setActivity(boolean activity) {
isActivity = activity;
return this;
}
public boolean isVoicePress() {
return voicePress;
@ -161,7 +171,9 @@ public class LiveAudienceEvent extends BaseModel {
MESSAGE_BOTTOM(28, "聊天消息滚动到底部"),
FLOAT_SETTING(29, "悬浮窗设置"),
VOICE_PRESS(30, "长按展示图片"),
LUCKY_ANGEL(31,"幸运天使");
LUCKY_ANGEL(31, "幸运天使"),
WE_CHEAT(32, "整蛊")
;
private int type;
private String name;

View File

@ -258,10 +258,30 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
@Override
public void onViewClicks() {
Bus.get().post(new LiveAudienceEvent()
.setActivity(false)
.setType(LiveAudienceEvent.LiveAudienceType.BOTTOM_COLLECTION));
}
});
//
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_play), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
Bus.get().post(new LiveAudienceEvent()
.setActivity(true)
.setType(LiveAudienceEvent.LiveAudienceType.BOTTOM_COLLECTION));
}
});
//整蛊
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_cheat), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.WE_CHEAT));
}
});
//底部礼物弹窗
ImgLoader.displayGif(mContext, R.mipmap.live_lw, giftImage);
@ -398,7 +418,6 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
}
@Override
public void onClick(View v) {
if (!canClick()) {
@ -424,11 +443,11 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
openZGListWindow();
} else if (i == R.id.live_new_people) {
openNewPeopleDialog();
} else if (i == R.id.live_privilege){
} else if (i == R.id.live_privilege) {
openRoleDialog();
}else if(i==R.id.live_cheat){
} else if (i == R.id.live_cheat) {
}else if (i==R.id.live_play){
} else if (i == R.id.live_play) {
}
@ -473,8 +492,8 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
/**
* 身份特权
*/
public void openRoleDialog(){
LiveRoleDialogFragment fragment=new LiveRoleDialogFragment();
public void openRoleDialog() {
LiveRoleDialogFragment fragment = new LiveRoleDialogFragment();
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoleDialogFragment");
}

View File

@ -351,22 +351,22 @@
<!--特权-->
<ImageView
android:id="@+id/live_privilege"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_width="27.2dp"
android:layout_height="27.2dp"
android:layout_marginEnd="10dp"
android:src="@mipmap/live_icon_role" />
<!--整蛊-->
<ImageView
android:id="@+id/live_cheat"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_width="27.2dp"
android:layout_height="27.2dp"
android:layout_marginEnd="10dp"
android:src="@mipmap/live_icon_cheat" />
<!---->
<ImageView
android:id="@+id/live_play"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_width="27.2dp"
android:layout_height="27.2dp"
android:layout_marginEnd="10dp"
android:src="@mipmap/live_icon_play" />
<!--新人特惠-->