重新调整活动Banner逻辑
This commit is contained in:
parent
6efcb75c31
commit
cccde7a3f8
@ -15,6 +15,7 @@ public class BannerBean {
|
|||||||
private String mIntoUrl;
|
private String mIntoUrl;
|
||||||
private int type;
|
private int type;
|
||||||
private String name;
|
private String name;
|
||||||
|
private int activityId=0;
|
||||||
|
|
||||||
private StarChallengeStatusModel model;
|
private StarChallengeStatusModel model;
|
||||||
|
|
||||||
@ -90,6 +91,14 @@ public class BannerBean {
|
|||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
@JSONField(name = "active_id")
|
||||||
|
public int getActivityId() {
|
||||||
|
return activityId;
|
||||||
|
}
|
||||||
|
@JSONField(name = "active_id")
|
||||||
|
public void setActivityId(int activityId) {
|
||||||
|
this.activityId = activityId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -16,6 +16,8 @@ public class LiveRoomActivityBanner extends BaseModel{
|
|||||||
private int hidden;
|
private int hidden;
|
||||||
@SerializedName("show_type")
|
@SerializedName("show_type")
|
||||||
private String type;
|
private String type;
|
||||||
|
@SerializedName("active_id")
|
||||||
|
private int activeId;
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
@ -56,4 +58,12 @@ public class LiveRoomActivityBanner extends BaseModel{
|
|||||||
public void setType(String type) {
|
public void setType(String type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getActiveId() {
|
||||||
|
return activeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActiveId(int activeId) {
|
||||||
|
this.activeId = activeId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,12 +66,18 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
|
|||||||
private String roomId;
|
private String roomId;
|
||||||
private TabLayout tabLayout;
|
private TabLayout tabLayout;
|
||||||
private int tabIndex = 0;
|
private int tabIndex = 0;
|
||||||
|
private int activityId = -1;
|
||||||
private LinearLayout layout;
|
private LinearLayout layout;
|
||||||
|
private boolean isFullWindow = false;
|
||||||
|
|
||||||
public LiveGameDialogFragment() {
|
public LiveGameDialogFragment() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LiveGameDialogFragment(boolean isFullWindow) {
|
||||||
|
this.isFullWindow = isFullWindow;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置打开第几个tab
|
* 设置打开第几个tab
|
||||||
*/
|
*/
|
||||||
@ -79,6 +85,10 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
|
|||||||
this.tabIndex = index;
|
this.tabIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setActivityId(int activityId) {
|
||||||
|
this.activityId = activityId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
return R.layout.dialog_live_game;
|
return R.layout.dialog_live_game;
|
||||||
@ -100,7 +110,28 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
|
|||||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||||
WindowManager.LayoutParams params = window.getAttributes();
|
WindowManager.LayoutParams params = window.getAttributes();
|
||||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||||
|
if (isFullWindow) {
|
||||||
|
Display display = null;
|
||||||
|
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
|
display = requireContext().getDisplay();
|
||||||
|
window.getInsetsController().hide(WindowInsets.Type.statusBars());
|
||||||
|
window.getInsetsController().hide(WindowInsets.Type.navigationBars());
|
||||||
|
} else {
|
||||||
|
display = window.getWindowManager().getDefaultDisplay();
|
||||||
|
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
|
}
|
||||||
|
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
|
window.getDecorView().setBackgroundColor(Color.parseColor("#10000000"));
|
||||||
|
params.height = WindowManager.LayoutParams.MATCH_PARENT;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
window.getDecorView().setMinimumHeight(display.getMode().getPhysicalHeight());
|
||||||
|
window.getDecorView().setMinimumWidth(display.getMode().getPhysicalWidth());
|
||||||
|
}
|
||||||
|
window.getDecorView().setPadding(10, -10, 0, 0);
|
||||||
|
} else {
|
||||||
params.height = DpUtil.dp2px(540);
|
params.height = DpUtil.dp2px(540);
|
||||||
|
}
|
||||||
params.gravity = Gravity.BOTTOM;
|
params.gravity = Gravity.BOTTOM;
|
||||||
window.setAttributes(params);
|
window.setAttributes(params);
|
||||||
}
|
}
|
||||||
@ -147,6 +178,7 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<ActiveModel> data) {
|
public void onSuccess(List<ActiveModel> data) {
|
||||||
initTab(data);
|
initTab(data);
|
||||||
|
activityToPosition();
|
||||||
selectTab(tabIndex);
|
selectTab(tabIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,6 +216,21 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过活动id来展示页面
|
||||||
|
*/
|
||||||
|
public void activityToPosition() {
|
||||||
|
int count = tabLayout.getTabCount();
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
ActiveModel model = (ActiveModel) tabLayout.getTabAt(i).getTag();
|
||||||
|
if ((activityId + "").equals(model.getActiveId())) {
|
||||||
|
tabIndex=i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
private void selectTab(int position) {
|
private void selectTab(int position) {
|
||||||
TabLayout.Tab tab = tabLayout.getTabAt(position);
|
TabLayout.Tab tab = tabLayout.getTabAt(position);
|
||||||
if (tab != null) {
|
if (tab != null) {
|
||||||
|
@ -1289,7 +1289,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
public void onSuccess(List<LiveRoomActivityBanner> data) {
|
public void onSuccess(List<LiveRoomActivityBanner> data) {
|
||||||
mBannerList4.clear();
|
mBannerList4.clear();
|
||||||
for (LiveRoomActivityBanner datum : data) {
|
for (LiveRoomActivityBanner datum : data) {
|
||||||
|
if (datum.getHidden() == 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
BannerBean bean = new BannerBean();
|
BannerBean bean = new BannerBean();
|
||||||
|
bean.setActivityId(datum.getActiveId());
|
||||||
bean.setName(datum.getName());
|
bean.setName(datum.getName());
|
||||||
bean.setLink(datum.getLink());
|
bean.setLink(datum.getLink());
|
||||||
bean.setImageUrl(datum.getImg());
|
bean.setImageUrl(datum.getImg());
|
||||||
@ -3000,13 +3004,19 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
BannerBean bean = mBannerList4.get(p);
|
BannerBean bean = mBannerList4.get(p);
|
||||||
loadingDialog = DialogUitl.loadingDialog(mContext);
|
loadingDialog = DialogUitl.loadingDialog(mContext);
|
||||||
loadingDialog.show();
|
loadingDialog.show();
|
||||||
if ("幸运天使".equals(bean.getName())) {
|
if (bean.getActivityId() == -1) {//-1写死跳活动弹窗
|
||||||
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
|
.setActivity(true)
|
||||||
|
.setType(LiveAudienceEvent.LiveAudienceType.BOTTOM_COLLECTION));
|
||||||
|
if (loadingDialog != null && loadingDialog.isShowing()) {
|
||||||
|
loadingDialog.dismiss();
|
||||||
|
loadingDialog = null;
|
||||||
|
}
|
||||||
|
} else if (bean.getActivityId() == 0) {
|
||||||
openWebDialog(bean.getLink());
|
openWebDialog(bean.getLink());
|
||||||
} else if ("新人特惠".equals(bean.getName())) {
|
|
||||||
showNewPeopleInfo();
|
|
||||||
} else {
|
} else {
|
||||||
LiveGameDialogFragment fragment=new LiveGameDialogFragment();
|
LiveGameDialogFragment fragment = new LiveGameDialogFragment("1".equals(bean.getShow_type()));
|
||||||
fragment.selectIndex(0);
|
fragment.setActivityId(bean.getActivityId());
|
||||||
fragment.setRoomId(mLiveUid);
|
fragment.setRoomId(mLiveUid);
|
||||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment");
|
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment");
|
||||||
if (loadingDialog != null && loadingDialog.isShowing()) {
|
if (loadingDialog != null && loadingDialog.isShowing()) {
|
||||||
@ -3016,28 +3026,14 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showNewPeopleInfo() {
|
|
||||||
API.get().pdLiveApi(mContext)
|
|
||||||
.getNewPeopleInfo()
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(stringResponseModel -> {
|
|
||||||
NewPeopleInfo peopleInfo = stringResponseModel.getData().getInfo();
|
|
||||||
if (peopleInfo.getIsShow()) {
|
|
||||||
String newPeopleUrl;
|
|
||||||
if (peopleInfo.getLink().startsWith("http")) {
|
|
||||||
newPeopleUrl = peopleInfo.getLink() + "?";
|
|
||||||
} else {
|
|
||||||
newPeopleUrl = CommonAppConfig.HOST + "/" + peopleInfo.getLink();
|
|
||||||
}
|
|
||||||
openWebDialog(newPeopleUrl);
|
|
||||||
}
|
|
||||||
}, Throwable::printStackTrace).isDisposed();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void openWebDialog(String url) {
|
private void openWebDialog(String url) {
|
||||||
if (!url.startsWith("http")) {
|
if (!url.startsWith("http")) {
|
||||||
|
if (url.startsWith("/")) {
|
||||||
url = CommonAppConfig.HOST + url;
|
url = CommonAppConfig.HOST + url;
|
||||||
|
} else {
|
||||||
|
url = CommonAppConfig.HOST + "/" + url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (url.contains("?")) {
|
if (url.contains("?")) {
|
||||||
url += "&";
|
url += "&";
|
||||||
|
Loading…
Reference in New Issue
Block a user