直播间修改
This commit is contained in:
@@ -206,6 +206,17 @@ public class IMLoginModel extends BaseModel {
|
||||
private List<List<ListModel>> list;
|
||||
@SerializedName("slide")
|
||||
private List<SlideModel> slide;
|
||||
@SerializedName("gift_effect")
|
||||
private boolean giftEffect =false;
|
||||
|
||||
public boolean isGiftEffect() {
|
||||
return giftEffect;
|
||||
}
|
||||
|
||||
public IMLoginModel setGiftEffect(boolean giftEffect) {
|
||||
this.giftEffect = giftEffect;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,36 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 直播首页轮播和侧边栏轮播
|
||||
*/
|
||||
public class SlideInfoModel extends BaseModel {
|
||||
/**
|
||||
* slide_pic : https://qny.shayucm.com/20220810/81a4c030334a4a5a30eb62b84191f46d.jpg
|
||||
* slide_url : https://napi.yaoulive.com/h5/monthlyActivities/202208QIXI/index.html?t=1660619212
|
||||
*/
|
||||
|
||||
@SerializedName("slide_pic")
|
||||
private String slidePic = "";
|
||||
@SerializedName("slide_url")
|
||||
private String slideUrl = "";
|
||||
|
||||
public String getSlidePic() {
|
||||
return slidePic;
|
||||
}
|
||||
|
||||
public SlideInfoModel setSlidePic(String slidePic) {
|
||||
this.slidePic = slidePic;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSlideUrl() {
|
||||
return slideUrl;
|
||||
}
|
||||
|
||||
public SlideInfoModel setSlideUrl(String slideUrl) {
|
||||
this.slideUrl = slideUrl;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,6 @@ package com.yunbao.common.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
@@ -13,6 +9,11 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
|
||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
|
||||
@@ -163,6 +164,7 @@ public class CommonRefreshView extends FrameLayout implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
mDataHelper.onRefreshSuccess(adapter.getList(), adapter.getItemCount());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -265,6 +267,18 @@ public class CommonRefreshView extends FrameLayout implements View.OnClickListen
|
||||
}
|
||||
};
|
||||
|
||||
public void onFinish() {
|
||||
if (mLoadFailureView != null && mLoadFailureView.getVisibility() == View.VISIBLE) {
|
||||
mLoadFailureView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
if (mEmptyLayout != null && mEmptyLayout.getVisibility() == View.VISIBLE) {
|
||||
mEmptyLayout.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
if (mSmartRefreshLayout != null) {
|
||||
mSmartRefreshLayout.finishRefresh(true);
|
||||
}
|
||||
}
|
||||
|
||||
public <T> void setDataHelper(DataHelper<T> dataHelper) {
|
||||
mDataHelper = dataHelper;
|
||||
}
|
||||
@@ -328,6 +342,9 @@ public class CommonRefreshView extends FrameLayout implements View.OnClickListen
|
||||
mPageCount = 1;
|
||||
mDataHelper.loadData(mPageCount, mRefreshCallback);
|
||||
}
|
||||
if (dataHelperNew != null) {
|
||||
dataHelperNew.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadMore() {
|
||||
@@ -338,6 +355,9 @@ public class CommonRefreshView extends FrameLayout implements View.OnClickListen
|
||||
mPageCount++;
|
||||
mDataHelper.loadData(mPageCount, mLoadMoreCallback);
|
||||
}
|
||||
if (dataHelperNew != null) {
|
||||
dataHelperNew.loadData(mPageCount);
|
||||
}
|
||||
}
|
||||
|
||||
public int getPageCount() {
|
||||
@@ -376,6 +396,18 @@ public class CommonRefreshView extends FrameLayout implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
public interface DataHelperNew {
|
||||
void loadData(int p);
|
||||
|
||||
void refresh();
|
||||
}
|
||||
|
||||
private DataHelperNew dataHelperNew;
|
||||
|
||||
public CommonRefreshView setDataHelperNew(DataHelperNew dataHelperNew) {
|
||||
this.dataHelperNew = dataHelperNew;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface DataHelper<T> {
|
||||
RefreshAdapter<T> getAdapter();
|
||||
|
||||
@@ -8,10 +8,8 @@ import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.SearchModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
@@ -135,4 +133,12 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<List<SetAttentsModel>>> setAttents(
|
||||
@Query("touid") String liveuid
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取首页位
|
||||
*/
|
||||
@GET("/api/public/?service=Home.getHot")
|
||||
Observable<ResponseModel<List<SlideInBannerModel>>> getHot(
|
||||
@Query("p") int page
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,16 +2,15 @@ package com.yunbao.common.http.main;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.yunbao.common.bean.FaceBookUpModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.FaceBookUpModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.SearchModel;
|
||||
import com.yunbao.common.bean.SlideInfoModel;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
@@ -70,6 +69,7 @@ public class MainNetManager {
|
||||
|
||||
/**
|
||||
* FB是否替换新Key
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
public void FaceBookUp(HttpCallback<FaceBookUpModel> callback) {
|
||||
@@ -89,6 +89,7 @@ public class MainNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 猜你喜欢
|
||||
*
|
||||
@@ -120,7 +121,7 @@ public class MainNetManager {
|
||||
* @param p 頁碼
|
||||
*/
|
||||
public void search(String jianKey, String fanKey, int type, int p, HttpCallback<List<List<SearchModel>>> callback) {
|
||||
API.get().pdLiveApi(mContext).search(jianKey,fanKey,type,p)
|
||||
API.get().pdLiveApi(mContext).search(jianKey, fanKey, type, p)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(listResponseModel -> {
|
||||
@@ -134,6 +135,7 @@ public class MainNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*
|
||||
@@ -143,7 +145,7 @@ public class MainNetManager {
|
||||
* @param p 頁碼
|
||||
*/
|
||||
public void searchNew(String jianKey, String fanKey, int type, int p, HttpCallback<List<SearchModel>> callback) {
|
||||
API.get().pdLiveApi(mContext).searchNew(jianKey,fanKey,type,p)
|
||||
API.get().pdLiveApi(mContext).searchNew(jianKey, fanKey, type, p)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(listResponseModel -> {
|
||||
@@ -158,4 +160,23 @@ public class MainNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取首页轮播
|
||||
*/
|
||||
public void getHot(int page, HttpCallback<List<SlideInfoModel>> callback) {
|
||||
API.get().pdLiveApi(mContext).getHot(page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(slideInBannerModelResponseModel -> {
|
||||
if (!mContext.isFinishing() && callback != null) {
|
||||
List<SlideInfoModel> slideInfoModels = slideInBannerModelResponseModel.getData().getInfo().get(0).getSlide();
|
||||
callback.onSuccess(slideInfoModels);
|
||||
}
|
||||
}, throwable -> {
|
||||
if (!mContext.isFinishing() && callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.ms.banner.holder.BannerViewHolder;
|
||||
import com.yunbao.common.bean.SlideInfoModel;
|
||||
|
||||
public class SlideInBannerViewHolder implements BannerViewHolder<SlideInfoModel> {
|
||||
|
||||
@Override
|
||||
public View createView(Context context, int position, SlideInfoModel data) {
|
||||
// 返回mImageView页面布局
|
||||
ImageView imageView = new ImageView(context);
|
||||
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
|
||||
);
|
||||
imageView.setLayoutParams(params);
|
||||
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
Glide.with(context).load(data.getSlidePic()).into(imageView);
|
||||
|
||||
return imageView;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user