Merge remote-tracking branch 'origin/dev_680_礼物展馆' into dev_680_礼物展馆
# Conflicts: # common/src/main/java/com/yunbao/common/http/PDLiveApi.java # common/src/main/res/values-zh/strings.xml # common/src/main/res/values/strings.xml
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.UserMedalListModel;
|
||||
import com.yunbao.common.bean.UserMedalListModel;
|
||||
import com.yunbao.common.event.GiftNumberEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.views.GiftNumber;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GiftWallAchieveAdapter extends RecyclerView.Adapter {
|
||||
private List<UserMedalListModel> giftQuantityModels;
|
||||
private Context mContext;
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
public GiftWallAchieveAdapter(List<UserMedalListModel> giftQuantityModels, Context context) {
|
||||
this.giftQuantityModels = giftQuantityModels;
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View robotSayHelloView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_gift_wall_achieve_item, parent, false);
|
||||
return new GiftWallAchieveViewHolder(robotSayHelloView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
GiftWallAchieveViewHolder giftWallAchieveViewHolder = (GiftWallAchieveViewHolder) holder;
|
||||
giftWallAchieveViewHolder.showData(giftQuantityModels.get(position));
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
|
||||
this.onItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return giftQuantityModels.size();
|
||||
}
|
||||
|
||||
class GiftWallAchieveViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView achieveName;
|
||||
private ImageView achieveImg;
|
||||
|
||||
public GiftWallAchieveViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(onItemClickListener!=null){
|
||||
onItemClickListener.onItemClick(getAdapterPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
achieveName = itemView.findViewById(R.id.achieveName);
|
||||
achieveImg = itemView.findViewById(R.id.achieve_img);
|
||||
}
|
||||
|
||||
public void showData(UserMedalListModel quantityModel) {
|
||||
achieveName.setText(quantityModel.getDressName());
|
||||
ImgLoader.display(mContext,quantityModel.getDisplaySrc(),achieveImg);
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(int position);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.stx.xhb.androidx.entity.BaseBannerInfo;
|
||||
|
||||
public class UserMedalModel extends BaseModel {
|
||||
public class UserMedalModel extends BaseModel implements BaseBannerInfo {
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("display_src")
|
||||
@@ -13,9 +14,22 @@ public class UserMedalModel extends BaseModel {
|
||||
private String dressDescription;
|
||||
@SerializedName("sort")
|
||||
private String sort;
|
||||
@SerializedName("use_status")
|
||||
private String use_status;
|
||||
@SerializedName("dress_status")
|
||||
private String dressStatus;
|
||||
|
||||
@SerializedName("users_dress_id")
|
||||
private String users_dress_id;
|
||||
|
||||
public String getUsersDressId() {
|
||||
return users_dress_id;
|
||||
}
|
||||
|
||||
public String getUseStatus() {
|
||||
return use_status;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -69,4 +83,14 @@ public class UserMedalModel extends BaseModel {
|
||||
this.dressStatus = dressStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getXBannerUrl() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getXBannerTitle() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.yunbao.common.custom;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.stx.xhb.androidx.transformers.BasePageTransformer;
|
||||
import com.yunbao.common.utils.L;
|
||||
|
||||
public class LiveGifWallAchieveWearTransformer extends BasePageTransformer {
|
||||
private float mMinScale = 0.85f;
|
||||
private float mMinAlpha = 1f;
|
||||
@Override
|
||||
public void handleInvisiblePage(View view, float position) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleLeftPage(View view, float position) {
|
||||
float scale = Math.max(mMinScale, 1 + position);
|
||||
float vertMargin = view.getHeight() * (1 - scale) / 2;
|
||||
float horzMargin = view.getWidth() * (1 - scale) / 2;
|
||||
view.setTranslationX(horzMargin - vertMargin / 2);
|
||||
view.setScaleX(scale);
|
||||
view.setScaleY( scale);
|
||||
L.e("handleLeftPage scale:"+scale);
|
||||
view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRightPage(View view, float position) {
|
||||
float scale = Math.max(mMinScale, 1 - position);
|
||||
float vertMargin = view.getHeight() * (1 - scale) / 2;
|
||||
float horzMargin = view.getWidth() * (1 - scale) / 2;
|
||||
view.setTranslationX( -horzMargin + vertMargin / 2);
|
||||
view.setScaleX( scale);
|
||||
view.setScaleY( scale);
|
||||
L.e("handleRightPage scale:"+scale);
|
||||
view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha));
|
||||
}
|
||||
|
||||
public void setMinAlpha(float minAlpha) {
|
||||
if (minAlpha >= 0.6f && minAlpha <= 1.0f) {
|
||||
mMinAlpha = minAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMinScale(float minScale) {
|
||||
if (minScale >= 0.6f && minScale <= 1.0f) {
|
||||
mMinScale = minScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import androidx.core.view.ViewCompat;
|
||||
|
||||
import com.stx.xhb.androidx.transformers.BasePageTransformer;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.L;
|
||||
|
||||
public class LiveGuardScalePageTransformer extends BasePageTransformer {
|
||||
/**
|
||||
@@ -39,6 +40,7 @@ public class LiveGuardScalePageTransformer extends BasePageTransformer {
|
||||
view.setTranslationX(horzMargin - vertMargin / 2);
|
||||
view.setScaleX(scale);
|
||||
view.setScaleY( scale);
|
||||
L.e("handleLeftPage scale:"+scale);
|
||||
view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha));
|
||||
}
|
||||
|
||||
@@ -49,8 +51,8 @@ public class LiveGuardScalePageTransformer extends BasePageTransformer {
|
||||
float horzMargin = view.getWidth() * (1 - scale) / 2;
|
||||
view.setTranslationX( -horzMargin + vertMargin / 2);
|
||||
view.setScaleX( scale);
|
||||
|
||||
view.setScaleY( scale);
|
||||
L.e("handleRightPage scale:"+scale);
|
||||
view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.GiftWallAchieveAdapter;
|
||||
import com.yunbao.common.bean.MedalAchievementModel;
|
||||
import com.yunbao.common.bean.UserMedalListModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 礼物墙-荣誉成就
|
||||
*/
|
||||
public class GiftWallAchieveDialog extends AbsDialogPopupWindow {
|
||||
|
||||
private ImageView mIvBg;
|
||||
private ImageView mIvBack;
|
||||
private TextView numCount;
|
||||
private boolean isFullWindows;
|
||||
private RecyclerView mRecyclerView;
|
||||
private GiftWallAchieveAdapter giftWallAchieveAdapter;
|
||||
private String toUid;
|
||||
|
||||
private List<UserMedalListModel> userMedalListModelList = new ArrayList<>();
|
||||
|
||||
public GiftWallAchieveDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public GiftWallAchieveDialog setFullWindows(boolean fullWindows) {
|
||||
isFullWindows = fullWindows;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GiftWallAchieveDialog setToUid(String toUid) {
|
||||
this.toUid = toUid;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_gift_wall_achieve;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPopupHeight() {
|
||||
if (isFullWindows) {
|
||||
return super.getPopupHeight();
|
||||
}
|
||||
int screenHeight = ScreenDimenUtil.getInstance().getScreenHeight();
|
||||
return (int) (screenHeight * 0.8);
|
||||
}
|
||||
|
||||
void initView() {
|
||||
mIvBg = findViewById(R.id.iv_root_bg);
|
||||
mIvBack = findViewById(R.id.iv_back);
|
||||
mRecyclerView = findViewById(R.id.recyclerView);
|
||||
mRecyclerView.setLayoutManager(new GridLayoutManager(mContext, 3, GridLayoutManager.VERTICAL, false));
|
||||
numCount = findViewById(R.id.numCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
initView();
|
||||
/*RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mIvBack.getLayoutParams();
|
||||
if (isFullWindows) {
|
||||
params.width=DpUtil.dp2px(20);
|
||||
mIvBack.setVisibility(View.VISIBLE);
|
||||
mIvBg.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
} else {
|
||||
params.width=DpUtil.dp2px(1);
|
||||
mIvBack.setVisibility(View.INVISIBLE);
|
||||
mIvBg.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
}
|
||||
mIvBack.setLayoutParams(params);*/
|
||||
initData();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
LiveNetManager.get(getContext())
|
||||
.getGiftHallMedalList(toUid,"",new HttpCallback<MedalAchievementModel>() {
|
||||
@Override
|
||||
public void onSuccess(MedalAchievementModel data) {
|
||||
numCount.setText(data.getMedalLightNumber()+"/"+data.getMedalTotalNumber());
|
||||
userMedalListModelList = data.getMedalData();
|
||||
giftWallAchieveAdapter = new GiftWallAchieveAdapter(userMedalListModelList,mContext);
|
||||
giftWallAchieveAdapter.setOnItemClickListener(new GiftWallAchieveAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(int position) {
|
||||
GiftWallAchieveWearDialog giftWallAchieveWearDialog = new GiftWallAchieveWearDialog(mContext,userMedalListModelList.get(position).getDressInfo());
|
||||
giftWallAchieveWearDialog.showDialog();
|
||||
}
|
||||
});
|
||||
mRecyclerView.setAdapter(giftWallAchieveAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.stx.xhb.androidx.XBanner;
|
||||
import com.stx.xhb.androidx.transformers.Transformer;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.UserMedalModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 礼物墙-荣誉成就
|
||||
*/
|
||||
public class GiftWallAchieveWearDialog extends AbsDialogPopupWindow {
|
||||
|
||||
private ImageView mIvBg;
|
||||
private ImageView mIvBack;
|
||||
private boolean isFullWindows;
|
||||
private String toUid;
|
||||
private XBanner xBanner;
|
||||
private TextView textAchieveName;
|
||||
private TextView textAchieveHint;
|
||||
private TextView btnConfirm;
|
||||
private int selectPosition = 0;
|
||||
|
||||
String putOn = WordUtil.isNewZh() ? "佩戴" : "wearing";
|
||||
String wearing = WordUtil.isNewZh() ? "已佩戴" : "worn";
|
||||
private List<UserMedalModel> achieveWearModels = new ArrayList<>();
|
||||
|
||||
public GiftWallAchieveWearDialog(@NonNull Context context, List<UserMedalModel> achieveWearModels) {
|
||||
super(context);
|
||||
this.achieveWearModels = achieveWearModels;
|
||||
}
|
||||
|
||||
public GiftWallAchieveWearDialog setFullWindows(boolean fullWindows) {
|
||||
isFullWindows = fullWindows;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GiftWallAchieveWearDialog setToUid(String toUid) {
|
||||
this.toUid = toUid;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_gift_wall_achieve_wear;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPopupHeight() {
|
||||
if (isFullWindows) {
|
||||
return super.getPopupHeight();
|
||||
}
|
||||
return ScreenDimenUtil.getInstance().getScreenHeight();
|
||||
}
|
||||
|
||||
void initView() {
|
||||
mIvBg = findViewById(R.id.iv_root_bg);
|
||||
mIvBack = findViewById(R.id.iv_back);
|
||||
xBanner = findViewById(R.id.gift_wall_achieve_banner);
|
||||
textAchieveName = findViewById(R.id.text_achieve_name);
|
||||
textAchieveHint = findViewById(R.id.text_achieve_hint);
|
||||
btnConfirm = findViewById(R.id.btn_confirm);
|
||||
findViewById(R.id.btn_cancel).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
btnConfirm.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (achieveWearModels.get(selectPosition).getUseStatus().equals("2") && achieveWearModels.get(selectPosition).getDressStatus().equals("2")) {
|
||||
LiveNetManager.get(mContext).userUseDress("3", achieveWearModels.get(selectPosition).getUsersDressId(), new HttpCallback<BaseModel>() {
|
||||
@Override
|
||||
public void onSuccess(BaseModel data) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
initView();
|
||||
/*RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mIvBack.getLayoutParams();
|
||||
if (isFullWindows) {
|
||||
params.width=DpUtil.dp2px(20);
|
||||
mIvBack.setVisibility(View.VISIBLE);
|
||||
mIvBg.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
} else {
|
||||
params.width=DpUtil.dp2px(1);
|
||||
mIvBack.setVisibility(View.INVISIBLE);
|
||||
mIvBg.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
}
|
||||
mIvBack.setLayoutParams(params);*/
|
||||
initData();
|
||||
}
|
||||
|
||||
public void setWearInfo() {
|
||||
textAchieveName.setText(achieveWearModels.get(selectPosition).getDressName());
|
||||
textAchieveHint.setText(achieveWearModels.get(selectPosition).getDressDescription());
|
||||
btnConfirm.setText(achieveWearModels.get(selectPosition).getUseStatus().equals("2") ? wearing : putOn);
|
||||
if (achieveWearModels.get(selectPosition).getUseStatus().equals("2") && achieveWearModels.get(selectPosition).getDressStatus().equals("2")) {
|
||||
btnConfirm.setBackground(getResources().getDrawable(R.drawable.gift_wall_achieve_wear_sure));
|
||||
} else {
|
||||
btnConfirm.setBackground(getResources().getDrawable(R.drawable.gift_wall_achieve_wear_disable));
|
||||
}
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
setWearInfo();
|
||||
|
||||
xBanner.setBannerData(R.layout.dialog_gift_wall_achieve_wear_item, achieveWearModels);
|
||||
//xBanner.setCustomPageTransformer(new LiveGifWallAchieveWearTransformer());
|
||||
xBanner.setIsClipChildrenMode(true);
|
||||
xBanner.setPageTransformer(Transformer.Scale);
|
||||
xBanner.getViewPager().setOffscreenPageLimit(3);
|
||||
xBanner.loadImage(new XBanner.XBannerAdapter() {
|
||||
@Override
|
||||
public void loadBanner(XBanner banner, Object model, View view, int position) {
|
||||
UserMedalModel guardBannerModel = ((UserMedalModel) model);
|
||||
ImageView wearImg = view.findViewById(R.id.wearImg);
|
||||
ImageView notUnlocked = view.findViewById(R.id.notUnlocked);
|
||||
ImgLoader.display(getContext(), guardBannerModel.getDisplaySrc(), wearImg);
|
||||
notUnlocked.setVisibility(guardBannerModel.getDressStatus().equals("1") ? VISIBLE : View.GONE);
|
||||
}
|
||||
});
|
||||
xBanner.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int i, float v, int i1) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int i) {
|
||||
selectPosition = i;
|
||||
setWearInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int i) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,12 @@ public class GiftWallDialog extends AbsDialogPopupWindow {
|
||||
mTvTab2.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
mViewPager.setCurrentItem(1, false);
|
||||
});
|
||||
|
||||
ViewClicksAntiShake.clicksAntiShake(mAchievement, () -> {
|
||||
new GiftWallAchieveDialog(mContext).setFullWindows(false).setToUid("98889").showDialog();
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(mIvTips, () -> {
|
||||
new GiftWallRuleDialog(mContext).setFullWindows(false).showDialog();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.GiftWallAchieveAdapter;
|
||||
import com.yunbao.common.bean.MedalAchievementModel;
|
||||
import com.yunbao.common.bean.UserMedalListModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 礼物墙-規則
|
||||
*/
|
||||
public class GiftWallRuleDialog extends AbsDialogPopupWindow {
|
||||
|
||||
private ImageView mIvBg;
|
||||
private ImageView mIvBack;
|
||||
private ImageView iv_rule;
|
||||
private boolean isFullWindows;
|
||||
public GiftWallRuleDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public GiftWallRuleDialog setFullWindows(boolean fullWindows) {
|
||||
isFullWindows = fullWindows;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_gift_wall_rule;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPopupHeight() {
|
||||
if (isFullWindows) {
|
||||
return super.getPopupHeight();
|
||||
}
|
||||
int screenHeight = ScreenDimenUtil.getInstance().getScreenHeight();
|
||||
return (int) (screenHeight * 0.8);
|
||||
}
|
||||
|
||||
void initView() {
|
||||
mIvBg = findViewById(R.id.iv_root_bg);
|
||||
mIvBack = findViewById(R.id.iv_back);
|
||||
iv_rule= findViewById(R.id.iv_rule);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
initView();
|
||||
/*RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mIvBack.getLayoutParams();
|
||||
if (isFullWindows) {
|
||||
params.width=DpUtil.dp2px(20);
|
||||
mIvBack.setVisibility(View.VISIBLE);
|
||||
mIvBg.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
} else {
|
||||
params.width=DpUtil.dp2px(1);
|
||||
mIvBack.setVisibility(View.INVISIBLE);
|
||||
mIvBg.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
}
|
||||
mIvBack.setLayoutParams(params);*/
|
||||
ImgLoader.displayDrawable(mContext, WordUtil.isNewZh() ? "https://downs.yaoulive.com/Group%201384.png" : "https://downs.yaoulive.com/Group%201381.png", -1, -1, new ImgLoader.DrawableCallback() {
|
||||
@Override
|
||||
public void onLoadSuccess(Drawable drawable) {
|
||||
iv_rule.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1269,6 +1269,14 @@ public interface PDLiveApi {
|
||||
@Query("type")String type
|
||||
);
|
||||
|
||||
@GET("/api/public/?service=Gift.getGiftHallMedalList")
|
||||
Observable<ResponseModel<MedalAchievementModel>> getGiftHallMedalList(@Query("to_uid") String liveUid,@Query("type")String type);
|
||||
|
||||
@GET("/api/public/?service=Dress.userUseDress")
|
||||
Observable<ResponseModel<BaseModel>> userUseDress(@Query("dress_type") String dress_type,@Query("users_dress_id")String users_dress_id);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 个人展馆
|
||||
*/
|
||||
|
||||
@@ -3477,6 +3477,51 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
|
||||
public void getGiftHallMedalList(String toUid,String type, HttpCallback<MedalAchievementModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getGiftHallMedalList(toUid,type)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<MedalAchievementModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<MedalAchievementModel> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void userUseDress(String dressType,String usersDressId, HttpCallback<BaseModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.userUseDress(dressType,usersDressId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<BaseModel> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
private MultipartBody.Part createUploadFile(File file) {
|
||||
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
||||
|
||||
@@ -26,7 +26,7 @@ public class HwBuilder {
|
||||
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||
invite.getClass().getMethod("pay", String.class).invoke(invite, changeid);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class HwBuilder {
|
||||
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||
invite.getClass().getMethod("consume").invoke(invite);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,13 +49,13 @@ public class HwBuilder {
|
||||
* @return
|
||||
*/
|
||||
public JSONObject getPayResult(Intent intent) {
|
||||
JSONObject object;
|
||||
JSONObject object = null;
|
||||
try {
|
||||
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_huawei.utils.HuaWeiPayManage");
|
||||
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||
object = (JSONObject) invite.getClass().getMethod("getPayResult", Intent.class).invoke(invite, intent);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class GoogleUtils {
|
||||
googlePay = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||
flag = (boolean) googlePay.getClass().getMethod("getGoogleService").invoke(googlePay);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
@@ -87,13 +87,13 @@ public class GoogleUtils {
|
||||
* @return
|
||||
*/
|
||||
public JSONObject getLoginResult(Intent intent) {
|
||||
JSONObject object;
|
||||
JSONObject object = null;
|
||||
try {
|
||||
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleManage");
|
||||
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||
object = (JSONObject) invite.getClass().getMethod("getLoginResult", Intent.class).invoke(invite, intent);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return object;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class GoogleUtils {
|
||||
googlePay = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||
googlePay.getClass().getMethod("initGooglePay").invoke(googlePay);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,10 @@ public class GoogleUtils {
|
||||
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||
adId = (String) invite.getClass().getMethod("getAdid").invoke(googlePay);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
|
||||
/*throw new RuntimeException(e);*/
|
||||
}
|
||||
return adId;
|
||||
}
|
||||
@@ -132,7 +135,7 @@ public class GoogleUtils {
|
||||
try {
|
||||
googlePay.getClass().getMethod("checkSku", String.class).invoke(googlePay, skuId);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +150,7 @@ public class GoogleUtils {
|
||||
try {
|
||||
googlePay.getClass().getMethod("initResultCode").invoke(googlePay);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
timer = new Timer();
|
||||
@@ -170,7 +173,7 @@ public class GoogleUtils {
|
||||
billingListener.onPayFailed(mActivity.getString(R.string.pay_fail));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -183,7 +186,7 @@ public class GoogleUtils {
|
||||
Object invite = clz.getConstructor(Context.class).newInstance(context);
|
||||
invite.getClass().getMethod("initializeApp").invoke(invite);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +204,7 @@ public class GoogleUtils {
|
||||
timer.cancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -214,7 +217,7 @@ public class GoogleUtils {
|
||||
googlePay = clz.getConstructor(Activity.class).newInstance(activity);
|
||||
googlePay.getClass().getMethod("initToken").invoke(googlePay);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +227,7 @@ public class GoogleUtils {
|
||||
googlePay = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||
googlePay.getClass().getMethod("consumeAll").invoke(googlePay);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,7 +240,7 @@ public class GoogleUtils {
|
||||
.getMethod("setFirebaseCrashData", String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class)
|
||||
.invoke(googlePay, uid, userData, isGoogle, cpu, runTime, enterRoom, slidingRoom, playSvga, ActivitySize);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +258,7 @@ public class GoogleUtils {
|
||||
timer.cancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user