!2 完成新人特惠的功能开发

Merge pull request !2 from Yutousama/dev_new_people_dialog
This commit is contained in:
向宽平 2022-08-23 10:15:09 +00:00 committed by Gitee
commit 801d9f3e54
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 103 additions and 2 deletions

View File

@ -0,0 +1,62 @@
package com.yunbao.common.bean;
import androidx.annotation.NonNull;
import com.google.gson.annotations.SerializedName;
/**
* 直播间新人特惠入口信息
*/
public class NewPeopleInfo extends BaseModel{
@SerializedName("charge_hidden")
private int chargeHidden;
@SerializedName("one_coin_show")
private int oneCoinShow;
@SerializedName("is_show")
private int isShow;//是否展示入口
@SerializedName("link")
private String link;//入口地址
public boolean getChargeHidden() {
return chargeHidden==1;
}
public void setChargeHidden(int chargeHidden) {
this.chargeHidden = chargeHidden;
}
public boolean getOneCoinShow() {
return oneCoinShow==1;
}
public void setOneCoinShow(int oneCoinShow) {
this.oneCoinShow = oneCoinShow;
}
public boolean getIsShow() {
return isShow==1;
}
public void setIsShow(int isShow) {
this.isShow = isShow;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
@NonNull
@Override
public String toString() {
return "NewPeopleInfo{" +
"chargeHidden=" + chargeHidden +
", oneCoinShow=" + oneCoinShow +
", isShow=" + isShow +
", link='" + link + '\'' +
'}';
}
}

View File

@ -7,6 +7,7 @@ import com.yunbao.common.bean.ContributeModel;
import com.yunbao.common.bean.FaceBookUpModel;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.NewPeopleInfo;
import com.yunbao.common.bean.NobleTrumpetModel;
import com.yunbao.common.bean.SearchModel;
import com.yunbao.common.bean.SetAttentsModel;
@ -162,4 +163,11 @@ public interface PDLiveApi {
*/
@GET("/api/public/?service=Contribute.index")
Observable<ResponseModel<ContributeModel>> getRanksList(@Query("uid")String uid);
/**
* 直播间新人特惠信息
* @return 新人特惠数据
*/
@GET("/api/public/?service=Live.newUserPreferential")
Observable<ResponseModel<NewPeopleInfo>> getNewPeopleInfo();
}

View File

@ -33,9 +33,10 @@ import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.common.bean.NewPeopleInfo;
import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.API;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
@ -50,6 +51,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.live.http.LiveHttpUtil;
import org.greenrobot.eventbus.EventBus;
@ -58,6 +60,9 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.Locale;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/**
* Created by cxf on 2018/10/9.
* 观众直播间逻辑
@ -78,6 +83,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
private int icon = 0;
private String nobleName, nobleTtext;
private ImageView giftImage, liveNewPeople;
private String newPeopleUrl=null;
public LiveAudienceViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
@ -191,6 +197,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
svga_station_horn = (SVGAImageView) findViewById(R.id.svga_station_horn);
viewFlipper = (ViewFlipper) findViewById(R.id.viewflipper_banner);
stationHornBanner = findViewById(R.id.station_horn_banner);
liveNewPeople.setOnClickListener(this);
svga_new_user_double.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -355,7 +362,20 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
LiveRoomViewHolder.insertChat(lvBean2, 1);
}
}, 10000);//3秒后执行Runnable中的run方法
getNewPeopleInfo();
}
public void getNewPeopleInfo(){
API.get().pdLiveApi(mContext)
.getNewPeopleInfo()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(stringResponseModel -> {
NewPeopleInfo peopleInfo = stringResponseModel.getData().getInfo();
if(peopleInfo.getIsShow()){
liveNewPeople.setVisibility(View.VISIBLE);
newPeopleUrl=peopleInfo.getLink();
}
}).isDisposed();
}
@Override
@ -384,6 +404,16 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
openZGListWindow();
} else if (i == R.id.lt_trickery) {
showTrickeryDialog();
}else if (i==R.id.live_new_people){
Bundle bundle=new Bundle();
String url= newPeopleUrl+"?g=Appapi&m=Turntable&a=tricky";
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
bundle.putString("url", url);
bundle.putInt("show_type", 0);
LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment();
liveHDDialogFragment.setArguments(bundle);
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
}

View File

@ -460,6 +460,7 @@
android:layout_marginEnd="16dp"
android:layout_toStartOf="@id/gift_image"
android:padding="4dp"
android:visibility="gone"
android:src="@mipmap/live_icon_newpeople_en" />
</RelativeLayout>