添加礼物,活动
This commit is contained in:
parent
062040ce15
commit
3a11fd3955
@ -1,6 +1,10 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
|
||||
/**
|
||||
* 活动
|
||||
@ -69,4 +73,19 @@ public class ActiveModel extends BaseModel {
|
||||
this.showType = showType;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取跳转网页地址
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String activityUrl(Context context, String liveUid) {
|
||||
IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo();
|
||||
String url = CommonAppConfig.HOST + "/" + activeSrc +
|
||||
"?uid=" + userInfo.getId() +
|
||||
"&token=" + userInfo.getToken()
|
||||
+ "&anchorUid=" + liveUid
|
||||
+ "&active_id=" + activeId;
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,20 @@
|
||||
package com.yunbao.live.event;
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class LiveAudienceEvent extends BaseModel {
|
||||
private LiveAudienceType type;
|
||||
private ActiveModel model = new ActiveModel();
|
||||
|
||||
public ActiveModel getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public LiveAudienceEvent setModel(ActiveModel model) {
|
||||
this.model = model;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LiveAudienceType getType() {
|
||||
return type;
|
||||
@ -16,7 +27,10 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
|
||||
public enum LiveAudienceType {
|
||||
SIDEBAR(1, "侧边栏"),
|
||||
BOTTOMCOLLECTION(2, "底部合集");
|
||||
BOTTOMCOLLECTION(2, "底部合集"),
|
||||
GIFTPOPUP(3, "礼物弹窗"),
|
||||
CURRENTACTIVITY(4, "当前活动");
|
||||
|
||||
|
||||
private int type;
|
||||
private String name;
|
@ -4,11 +4,11 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
@ -46,12 +46,14 @@ public class ImgLoader {
|
||||
}
|
||||
Glide.with(context).asDrawable().load(url).placeholder(imageView.getDrawable()).dontAnimate().skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
}
|
||||
|
||||
public static void display2(Context context, int url, ImageView imageView) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context).asDrawable().load(url).placeholder(imageView.getDrawable()).dontAnimate().skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
}
|
||||
|
||||
public static void displayWithError(Context context, String url, ImageView imageView, int errorRes) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
@ -61,6 +63,7 @@ public class ImgLoader {
|
||||
}
|
||||
Glide.with(context).asDrawable().load(url).error(errorRes).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
}
|
||||
|
||||
public static void displayWithError(Context context, int url, ImageView imageView, int errorRes) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
@ -70,6 +73,7 @@ public class ImgLoader {
|
||||
}
|
||||
Glide.with(context).asDrawable().load(url).error(errorRes).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
}
|
||||
|
||||
public static void displayAvatar(Context context, String url, ImageView imageView) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
@ -77,6 +81,7 @@ public class ImgLoader {
|
||||
displayWithError(context, url, imageView, R.mipmap.icon_avatar_placeholder);
|
||||
|
||||
}
|
||||
|
||||
public static void displayAvatar(Context context, int url, ImageView imageView) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
@ -84,6 +89,7 @@ public class ImgLoader {
|
||||
displayWithError(context, url, imageView, R.mipmap.icon_avatar_placeholder);
|
||||
|
||||
}
|
||||
|
||||
public static void display(Context context, File file, ImageView imageView) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
@ -108,6 +114,16 @@ public class ImgLoader {
|
||||
Glide.with(context).asDrawable().load(Uri.fromFile(new File(videoPath))).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示动图
|
||||
*/
|
||||
public static void displayGif(Context context, int videoPath, ImageView imageView) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context).asGif().load(videoPath).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
}
|
||||
|
||||
public static void displayDrawable(Context context, String url, final DrawableCallback callback) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
@ -138,7 +154,6 @@ public class ImgLoader {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 显示模糊的毛玻璃图片
|
||||
*/
|
||||
|
@ -9,7 +9,10 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.event.LiveAudienceEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class FunGamesViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView funGamePic;
|
||||
@ -19,6 +22,7 @@ public class FunGamesViewHolder extends RecyclerView.ViewHolder {
|
||||
super(itemView);
|
||||
funGamePic = itemView.findViewById(R.id.fun_game_pic);
|
||||
funGameName = itemView.findViewById(R.id.fun_game_name);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -29,5 +33,10 @@ public class FunGamesViewHolder extends RecyclerView.ViewHolder {
|
||||
public void showView(ActiveModel model) {
|
||||
ImgLoader.display(itemView.getContext(), model.getActiveImg(), funGamePic);
|
||||
funGameName.setText(model.getActiveName());
|
||||
ViewClicksAntiShake.clicksAntiShake(itemView, () -> {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.CURRENTACTIVITY)
|
||||
.setModel(model));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ ext {
|
||||
]
|
||||
manifestPlaceholders = [
|
||||
//正式
|
||||
// serverHost : "https://napi.yaoulive.com",
|
||||
serverHost : "https://napi.yaoulive.com",
|
||||
//測試
|
||||
serverHost : "https://ceshi.yaoulive.com",
|
||||
// serverHost : "https://ceshi.yaoulive.com",
|
||||
|
||||
//腾讯地图
|
||||
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||
|
@ -51,6 +51,7 @@ import com.yunbao.common.custom.ItemDecoration;
|
||||
import com.yunbao.common.custom.MyViewPager;
|
||||
import com.yunbao.common.dialog.LiveChargeDialogFragment;
|
||||
import com.yunbao.common.dialog.LiveTotalDialog;
|
||||
import com.yunbao.common.event.LiveAudienceEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
@ -79,9 +80,9 @@ import com.yunbao.live.bean.LivePKUserListBean;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.dialog.BlowkissDialog;
|
||||
import com.yunbao.live.dialog.LiveGiftDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveHDDialogFragment;
|
||||
import com.yunbao.live.dialog.NewUserDialog;
|
||||
import com.yunbao.live.event.LinkMicTxAccEvent;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
@ -1384,14 +1385,34 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onOpenDrawer(LiveAudienceEvent event) {
|
||||
Bundle bundle = new Bundle();
|
||||
switch (event.getType()) {
|
||||
case SIDEBAR:
|
||||
//从右边打开侧边栏
|
||||
drawerLayout.openDrawer(GravityCompat.END);
|
||||
break;
|
||||
case BOTTOMCOLLECTION:
|
||||
LiveTotalDialog fragment = new LiveTotalDialog();
|
||||
fragment.show(getSupportFragmentManager(), "LiveTotalDialog");
|
||||
LiveTotalDialog liveTotalDialog = new LiveTotalDialog();
|
||||
liveTotalDialog.show(getSupportFragmentManager(), "LiveTotalDialog");
|
||||
break;
|
||||
case GIFTPOPUP:
|
||||
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) {
|
||||
return;
|
||||
}
|
||||
LiveGiftDialogFragment liveGiftDialogFragment = new LiveGiftDialogFragment();
|
||||
liveGiftDialogFragment.setLiveGuardInfo(mLiveGuardInfo);
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
bundle.putString(Constants.LIVE_STREAM, mStream);
|
||||
liveGiftDialogFragment.setArguments(bundle);
|
||||
liveGiftDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
|
||||
break;
|
||||
case CURRENTACTIVITY:
|
||||
bundle.putString("url", event.getModel().activityUrl(mContext, liveBean.getUid()));
|
||||
int show = TextUtils.isEmpty(event.getModel().getShowType()) ? 0 : Integer.parseInt(event.getModel().getShowType());
|
||||
bundle.putInt("show_type", show);
|
||||
LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment();
|
||||
liveHDDialogFragment.setArguments(bundle);
|
||||
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,6 @@ import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.MsgModel;
|
||||
import com.yunbao.common.dialog.LiveTotalDialog;
|
||||
import com.yunbao.common.event.MessageIMEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
@ -49,7 +48,7 @@ import com.yunbao.live.bean.LiveChatBean;
|
||||
import com.yunbao.live.dialog.LiveHDDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveMicUserDialogFragment;
|
||||
import com.yunbao.live.dialog.LivePromotionDialogFragment;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.common.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@ -75,6 +74,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
private TextView goToRomm;
|
||||
private int icon = 0;
|
||||
private String nobleName, nobleTtext;
|
||||
private ImageView giftImage;
|
||||
|
||||
public LiveAudienceViewHolder(Context context, ViewGroup parentView) {
|
||||
super(context, parentView);
|
||||
@ -180,6 +180,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
findViewById(R.id.btn_red_pack).setOnClickListener(this);
|
||||
findViewById(R.id.btn_gift).setOnClickListener(this);
|
||||
findViewById(R.id.btn_zg).setOnClickListener(this);
|
||||
giftImage = (ImageView) findViewById(R.id.gift_image);
|
||||
svga_new_user_gif = (SVGAImageView) findViewById(R.id.svga_new_user_gif);
|
||||
svga_new_user_double = (SVGAImageView) findViewById(R.id.svga_new_user_double);
|
||||
svga_new_user_follow = (SVGAImageView) findViewById(R.id.svga_new_user_follow);
|
||||
@ -303,6 +304,16 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
|
||||
}
|
||||
});
|
||||
//底部礼物弹窗
|
||||
ImgLoader.displayGif(mContext, R.mipmap.live_lw, giftImage);
|
||||
|
||||
ViewClicksAntiShake.clicksAntiShake(giftImage, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.GIFTPOPUP));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static Handler handler = new Handler();
|
||||
|
@ -79,7 +79,7 @@ import com.yunbao.live.custom.TopGradual;
|
||||
import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveHDDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveUserDialogFragment;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.common.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.presenter.LiveDanmuPresenter;
|
||||
|
@ -2,8 +2,8 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:topLeftRadius="10dp"
|
||||
android:topRightRadius="10dp"/>
|
||||
<corners android:topLeftRadius="12dp"
|
||||
android:topRightRadius="12dp"/>
|
||||
<solid android:color="#f5121001" />
|
||||
</shape>
|
||||
</item>
|
||||
|
@ -1,6 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.cardview.widget.CardView 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:orientation="vertical"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="16dp">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
@ -8,7 +16,6 @@
|
||||
<RelativeLayout
|
||||
android:id="@+id/title_laout"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/white"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
@ -48,5 +55,7 @@
|
||||
android:id="@+id/rlWebview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
Loading…
Reference in New Issue
Block a user