新增通过后端获取国家地区信息接口
调整送联系方式礼物时,不选择其他礼物 调整联系方式礼物接口 调整在模拟器超大分辨率模式下,信箱ui异常问题
This commit is contained in:
parent
f55e1b9c05
commit
73c8db8fb4
@ -1,6 +1,8 @@
|
||||
package com.yunbao.share.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -29,12 +31,12 @@ public class InviteRewardListAdapter extends RecyclerView.Adapter<InviteRewardLi
|
||||
@NonNull
|
||||
@Override
|
||||
public RewardViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new RewardViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_invite_reward,parent,false));
|
||||
return new RewardViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_invite_reward, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RewardViewHolder holder, int position) {
|
||||
holder.setData(list.get(position),position);
|
||||
holder.setData(list.get(position), position);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,6 +50,7 @@ public class InviteRewardListAdapter extends RecyclerView.Adapter<InviteRewardLi
|
||||
private final TextView item2;
|
||||
private final TextView item3;
|
||||
private final TextView item4;
|
||||
private final View divider, divider2;
|
||||
|
||||
public RewardViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@ -55,6 +58,8 @@ public class InviteRewardListAdapter extends RecyclerView.Adapter<InviteRewardLi
|
||||
item2 = itemView.findViewById(R.id.item2);
|
||||
item3 = itemView.findViewById(R.id.item3);
|
||||
item4 = itemView.findViewById(R.id.item4);
|
||||
divider = itemView.findViewById(R.id.divider);
|
||||
divider2 = itemView.findViewById(R.id.divider2);
|
||||
}
|
||||
|
||||
void setData(InviteRewardBean bean, int position) {
|
||||
@ -62,6 +67,36 @@ public class InviteRewardListAdapter extends RecyclerView.Adapter<InviteRewardLi
|
||||
item2.setText(bean.getInviteTime());
|
||||
item3.setText(bean.getType());
|
||||
item4.setText(bean.getReward());
|
||||
if (position != 0) {
|
||||
divider.setVisibility(View.GONE);
|
||||
divider2.setVisibility(View.GONE);
|
||||
setColor("#2F87B2", item1, item2, item3, item4);
|
||||
setType(Typeface.NORMAL, item1, item2, item3, item4);
|
||||
} else {
|
||||
setColor("#236586", item1, item2, item3, item4);
|
||||
setType(Typeface.BOLD, item1, item2, item3, item4);
|
||||
}
|
||||
setSize(13, item1, item2, item3, item4);
|
||||
}
|
||||
|
||||
void setColor(String color, TextView... textView) {
|
||||
for (TextView view : textView) {
|
||||
view.setTextColor(Color.parseColor(color));
|
||||
}
|
||||
}
|
||||
|
||||
void setSize(float size, TextView... textView) {
|
||||
for (TextView view : textView) {
|
||||
view.setTextSize(size);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void setType(int type, TextView... textView) {
|
||||
for (TextView view : textView) {
|
||||
view.setTypeface(Typeface.defaultFromStyle(type));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,10 @@ import android.app.Dialog;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Shader;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -15,6 +19,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.pdlive.shayu.R;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@ -31,12 +36,14 @@ public class InvitePopDialog extends AbsDialogPopupWindow {
|
||||
private RoundedImageView avatar;
|
||||
private TextView info;
|
||||
private TextView link;
|
||||
private TextView title;
|
||||
private List<ShareBuilder> data;
|
||||
|
||||
private String uid;
|
||||
private String anchorId;
|
||||
private String anchorName;
|
||||
private String anchorAvatar;
|
||||
private String url;
|
||||
|
||||
public InvitePopDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
@ -78,11 +85,9 @@ public class InvitePopDialog extends AbsDialogPopupWindow {
|
||||
super.onCreate();
|
||||
findViewById(R.id.close).setOnClickListener(v -> dismiss());
|
||||
findViewById(R.id.share_copy).setOnClickListener(v -> copyLink());
|
||||
findViewById(R.id.share_title).setOnClickListener(v -> copyLink());
|
||||
findViewById(R.id.share_preview).setVisibility(GONE);
|
||||
// findViewById(R.id.share_preview).setVisibility(GONE);
|
||||
findViewById(R.id.share_dialog).setBackgroundResource(R.mipmap.bg_dialog_inviet);
|
||||
((TextView) findViewById(R.id.share_title)).setText(R.string.dialog_invite_title);
|
||||
((TextView) findViewById(R.id.share_title)).setTextColor(R.drawable.bg_invite_title);
|
||||
title = findViewById(R.id.share_title);
|
||||
list = findViewById(R.id.share_apps_list);
|
||||
avatar = findViewById(R.id.share_avatar);
|
||||
info = findViewById(R.id.share_info);
|
||||
@ -91,6 +96,28 @@ public class InvitePopDialog extends AbsDialogPopupWindow {
|
||||
list.setLayoutManager(new GridLayoutManager(getContext(), 3));
|
||||
list.setAdapter(adapter);
|
||||
initData();
|
||||
link.setText(url.substring(0, 40));
|
||||
info.setText(R.string.dialog_invite_info);
|
||||
avatar.setImageResource(R.mipmap.ic_launcher);
|
||||
//title.setTextColor(getContext().getResources().getColorStateList(R.drawable.bg_invite_title));
|
||||
title.setText(R.string.dialog_invite_title);
|
||||
title.setOnClickListener(v -> copyLink());
|
||||
title.getViewTreeObserver().addOnGlobalLayoutListener(this::setTitleColor);
|
||||
}
|
||||
|
||||
private void setTitleColor() {
|
||||
int[] colors = {
|
||||
Color.parseColor("#3377FF"),
|
||||
Color.parseColor("#7F66FF"),
|
||||
};
|
||||
float[] position = {
|
||||
0f,
|
||||
1.0f
|
||||
};
|
||||
float height = title.getMeasuredHeight();
|
||||
LinearGradient mLinearGradient = new LinearGradient(0, 0, 0, height, colors, position, Shader.TileMode.CLAMP);
|
||||
title.getPaint().setShader(mLinearGradient);
|
||||
title.invalidate();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
@ -100,15 +127,15 @@ public class InvitePopDialog extends AbsDialogPopupWindow {
|
||||
data.add(builder(ShareBuilder.APP_TWITTER));
|
||||
data.add(builder(ShareBuilder.APP_WHATSAPP));
|
||||
data.add(builder(ShareBuilder.APP_MESSENGER));
|
||||
// data.add(builder(ShareBuilder.APP_INSTAGRAM));
|
||||
// data.add(builder(ShareBuilder.APP_INSTAGRAM));
|
||||
adapter.setList(data);
|
||||
|
||||
}
|
||||
|
||||
private ShareBuilder builder(int type) {
|
||||
ShareBuilder builder = ShareBuilder.builder(type);
|
||||
//builder.setText(WordUtil.getString(R.string.dialog_share_info));
|
||||
builder.setLink(ShareBuilder.createInviteLink(uid));
|
||||
builder.setText(WordUtil.getString(R.string.dialog_share_info));
|
||||
builder.setLink(url);
|
||||
builder.setUid(uid);
|
||||
builder.setAnchorId(anchorId);
|
||||
builder.setAnchorName(anchorName);
|
||||
@ -118,14 +145,19 @@ public class InvitePopDialog extends AbsDialogPopupWindow {
|
||||
|
||||
private void copyLink() {
|
||||
ClipboardManager cm = (ClipboardManager) getContext().getSystemService(CLIPBOARD_SERVICE);
|
||||
ClipData clipData = ClipData.newPlainText("text", link.getText().toString());
|
||||
ClipData clipData = ClipData.newPlainText("text", url);
|
||||
cm.setPrimaryClip(clipData);
|
||||
ToastUtil.show(WordUtil.getString(com.yunbao.common.R.string.copy_success));
|
||||
DialogUitl.showSimpleDialog(getContext(), ShareBuilder.createInviteLink(uid), new DialogUitl.SimpleCallback() {
|
||||
DialogUitl.showSimpleDialog(getContext(),url, new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public InvitePopDialog setUrl(String data) {
|
||||
this.url = data+"&isGoogle="+ (CommonAppConfig.IS_GOOGLE_PLAY ? "1" : "0");
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,9 @@ import android.app.Dialog;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Shader;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -19,6 +22,8 @@ import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.share.adapters.InviteRewardListAdapter;
|
||||
import com.yunbao.share.bean.InviteRewardBean;
|
||||
import com.yunbao.share.bean.ShareBuilder;
|
||||
import com.yunbao.share.adapters.ShareAppAdapter;
|
||||
|
||||
@ -26,13 +31,13 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class InviteRewardPopDialog extends AbsDialogPopupWindow {
|
||||
private ShareAppAdapter adapter;
|
||||
private InviteRewardListAdapter adapter;
|
||||
private RecyclerView list;
|
||||
private RoundedImageView avatar;
|
||||
private TextView info;
|
||||
private TextView link;
|
||||
private List<ShareBuilder> data;
|
||||
|
||||
private List<InviteRewardBean> data;
|
||||
private TextView title;
|
||||
private String uid;
|
||||
private String anchorId;
|
||||
private String anchorName;
|
||||
@ -78,29 +83,41 @@ public class InviteRewardPopDialog extends AbsDialogPopupWindow {
|
||||
super.onCreate();
|
||||
findViewById(R.id.close).setOnClickListener(v -> dismiss());
|
||||
findViewById(R.id.share_copy).setOnClickListener(v -> copyLink());
|
||||
findViewById(R.id.share_title).setOnClickListener(v -> copyLink());
|
||||
findViewById(R.id.share_preview).setVisibility(GONE);
|
||||
findViewById(R.id.share_dialog).setBackgroundResource(R.mipmap.bg_dialog_inviet);
|
||||
((TextView) findViewById(R.id.share_title)).setText(R.string.dialog_invite_title);
|
||||
((TextView) findViewById(R.id.share_title)).setTextColor(R.drawable.bg_invite_title);
|
||||
title = findViewById(R.id.share_title);
|
||||
title.setOnClickListener(v -> copyLink());
|
||||
title.setText(R.string.dialog_invite_reward_title);
|
||||
list = findViewById(R.id.share_apps_list);
|
||||
avatar = findViewById(R.id.share_avatar);
|
||||
info = findViewById(R.id.share_info);
|
||||
link = findViewById(R.id.share_link);
|
||||
adapter = new ShareAppAdapter(getContext());
|
||||
list.setLayoutManager(new LinearLayoutManager(getContext(),RecyclerView.VERTICAL,false));
|
||||
adapter = new InviteRewardListAdapter(getContext());
|
||||
list.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
|
||||
list.setAdapter(adapter);
|
||||
initData();
|
||||
title.getViewTreeObserver().addOnGlobalLayoutListener(this::setTitleColor);
|
||||
}
|
||||
private void setTitleColor(){
|
||||
int[] colors = {
|
||||
Color.parseColor("#3377FF"),
|
||||
Color.parseColor("#7F66FF"),
|
||||
};
|
||||
float[] position = {
|
||||
0f,
|
||||
1.0f
|
||||
};
|
||||
float height=title.getMeasuredHeight();
|
||||
LinearGradient mLinearGradient = new LinearGradient(0, 0, 0, height, colors, position, Shader.TileMode.CLAMP);
|
||||
title.getPaint().setShader(mLinearGradient);
|
||||
title.invalidate();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
data = new ArrayList<>();
|
||||
data.add(builder(ShareBuilder.APP_FACEBOOK));
|
||||
data.add(builder(ShareBuilder.APP_LINE));
|
||||
data.add(builder(ShareBuilder.APP_TWITTER));
|
||||
data.add(builder(ShareBuilder.APP_WHATSAPP));
|
||||
data.add(builder(ShareBuilder.APP_MESSENGER));
|
||||
// data.add(builder(ShareBuilder.APP_INSTAGRAM));
|
||||
data.add(new InviteRewardBean("標題", "邀請時間", "用戶等級", "獲得獎勵"));
|
||||
for (int i = 0; i < 5; i++) {
|
||||
data.add(new InviteRewardBean("用戶" + 1, "時間" + 1, "等級" + 1, "獎勵" + 1));
|
||||
}
|
||||
adapter.setList(data);
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
@ -29,6 +29,7 @@
|
||||
android:id="@+id/item1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle=""
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="TextView" />
|
||||
|
@ -27,6 +27,7 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
import com.yunbao.common.utils.AndroidBug5497Workaround;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
||||
@ -63,6 +64,7 @@ public class WebViewActivity extends AbsActivity {
|
||||
protected void main() {
|
||||
String url = getIntent().getStringExtra(Constants.URL);
|
||||
L.e("H5--->" + url);
|
||||
Bus.getOn(this);
|
||||
LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView);
|
||||
mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
|
||||
btnEdit = (ImageView) findViewById(R.id.btn_edit);
|
||||
@ -254,6 +256,7 @@ public class WebViewActivity extends AbsActivity {
|
||||
Constants.myIntoIndex = 0;
|
||||
indexInto = 0;
|
||||
Constants.LoginKefu = true;
|
||||
Bus.getOff(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@ -309,5 +312,16 @@ public class WebViewActivity extends AbsActivity {
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onJavascriptInterfaceEvent(JavascriptInterfaceEvent event) {
|
||||
indexInto = event.getIndexInto();
|
||||
if (event.getMethod().equals("androidInviteShare")) {
|
||||
try {
|
||||
Class<?> clz = mContext.getClassLoader().loadClass("com.yunbao.share.ui.InvitePopDialog");
|
||||
Object invite = clz.getConstructor(Context.class).newInstance(mContext);
|
||||
invite = invite.getClass().getMethod("setUrl", String.class).invoke(invite, event.getData());
|
||||
assert invite != null;
|
||||
invite.getClass().getMethod("showDialog").invoke(invite);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
public class UserAreaBean extends BaseModel {
|
||||
private String area;
|
||||
|
||||
public UserAreaBean() {
|
||||
}
|
||||
|
||||
public String getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
public void setArea(String area) {
|
||||
this.area = area;
|
||||
}
|
||||
}
|
@ -37,6 +37,7 @@ import com.yunbao.common.bean.SearchModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.UserAreaBean;
|
||||
import com.yunbao.common.bean.VipModel;
|
||||
import com.yunbao.common.bean.WishListGiftConfModel;
|
||||
import com.yunbao.common.bean.WishListModel;
|
||||
@ -679,4 +680,10 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<List<DiscountsModel>>> getDiscountInfo(
|
||||
@Query("type") int type
|
||||
);
|
||||
/**
|
||||
* 获取地区
|
||||
*/
|
||||
@GET("/api/public/?service=User.getUserArea")
|
||||
Observable<ResponseModel<UserAreaBean>> getUserArea();
|
||||
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.UserAreaBean;
|
||||
import com.yunbao.common.bean.VipModel;
|
||||
import com.yunbao.common.bean.WishListGiftConfModel;
|
||||
import com.yunbao.common.bean.WishListModel;
|
||||
@ -1379,6 +1380,27 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
public void getUserArea(HttpCallback<UserAreaBean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getUserArea()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<UserAreaBean>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<UserAreaBean> wishListGiftConfModelResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(wishListGiftConfModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
|
@ -497,6 +497,12 @@ public class JavascriptInterfaceUtils {
|
||||
mWebView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 社区分享
|
||||
* @param avatar 头像
|
||||
* @param link 分享连接
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public void androidCommunityShare(String avatar,String link){
|
||||
JSONObject json=new JSONObject();
|
||||
@ -506,4 +512,10 @@ public class JavascriptInterfaceUtils {
|
||||
.setMethod("androidCommunityShare")
|
||||
.setData(json.toJSONString()));
|
||||
}
|
||||
@JavascriptInterface
|
||||
public void androidInviteShare(String url){
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidInviteShare")
|
||||
.setData(url));
|
||||
}
|
||||
}
|
||||
|
@ -177,6 +177,7 @@ public class LiveAnchorEditCallMeAdapter extends RecyclerView.Adapter<LiveAnchor
|
||||
}
|
||||
})
|
||||
.setShowNumber(false)
|
||||
.setOldGiftList(true)
|
||||
.setTitle(WordUtil.getString(R.string.live_anchor_edit_call_me_select_gift))
|
||||
.showDialog()
|
||||
;
|
||||
|
@ -54,6 +54,11 @@ public class LiveGiftAdapter extends RecyclerView.Adapter<LiveGiftAdapter.Vh> {
|
||||
private ScaleAnimation mAnimation;
|
||||
private View mAnimView;
|
||||
private String mName1, mName2;
|
||||
boolean isTouch=true;
|
||||
|
||||
public void setTouch(boolean touch) {
|
||||
isTouch = touch;
|
||||
}
|
||||
|
||||
public LiveGiftAdapter(Context context, LayoutInflater inflater, List<LiveGiftBean> list, String coinName) {
|
||||
mContext = context;
|
||||
@ -65,6 +70,9 @@ public class LiveGiftAdapter extends RecyclerView.Adapter<LiveGiftAdapter.Vh> {
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(!isTouch){
|
||||
return;
|
||||
}
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
|
@ -7,6 +7,7 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
@ -83,6 +84,7 @@ public class LiveGiftPagerAdapter extends PagerAdapter {
|
||||
|
||||
/**
|
||||
* 刷新指定礼物id的item 界面
|
||||
*
|
||||
* @param giftId
|
||||
*/
|
||||
public void refreshId(int giftId) {
|
||||
@ -90,7 +92,7 @@ public class LiveGiftPagerAdapter extends PagerAdapter {
|
||||
RecyclerView.Adapter<?> adapter = recyclerView.getAdapter();
|
||||
if (adapter instanceof LiveGiftAdapter) {
|
||||
for (int i = 0; i < ((LiveGiftAdapter) adapter).getList().size(); i++) {
|
||||
if(((LiveGiftAdapter) adapter).getList().get(i).getId()==giftId){
|
||||
if (((LiveGiftAdapter) adapter).getList().get(i).getId() == giftId) {
|
||||
adapter.notifyItemChanged(i);
|
||||
return;
|
||||
}
|
||||
@ -157,6 +159,23 @@ public class LiveGiftPagerAdapter extends PagerAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁止用户点击更换礼物
|
||||
*/
|
||||
public void disTouch(int giftId) {
|
||||
for (RecyclerView recyclerView : mViewList) {
|
||||
RecyclerView.Adapter<?> adapter = recyclerView.getAdapter();
|
||||
if (adapter instanceof LiveGiftAdapter) {
|
||||
for (int i = 0; i < ((LiveGiftAdapter) adapter).getList().size(); i++) {
|
||||
if (((LiveGiftAdapter) adapter).getList().get(i).getId() == giftId) {
|
||||
((LiveGiftAdapter) adapter).setTouch(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface ActionListener {
|
||||
void onItemChecked(LiveGiftBean bean);
|
||||
}
|
||||
|
40
live/src/main/java/com/yunbao/live/custom/GiftViewPager.java
Normal file
40
live/src/main/java/com/yunbao/live/custom/GiftViewPager.java
Normal file
@ -0,0 +1,40 @@
|
||||
package com.yunbao.live.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
public class GiftViewPager extends ViewPager {
|
||||
boolean isTouch=true;
|
||||
public GiftViewPager(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public GiftViewPager(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public void setTouch(boolean touch) {
|
||||
isTouch = touch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
if(!isTouch){
|
||||
return false;
|
||||
}
|
||||
return super.onTouchEvent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if(!isTouch){
|
||||
return false;
|
||||
}
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}
|
||||
}
|
@ -65,6 +65,7 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene
|
||||
private View numberView;
|
||||
private String title;
|
||||
private TextView mTitle;
|
||||
private boolean isOldGiftList = false;
|
||||
|
||||
|
||||
public GiftPopDialog(@NonNull Context context) {
|
||||
@ -159,25 +160,52 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene
|
||||
return this;
|
||||
}
|
||||
|
||||
public GiftPopDialog setOldGiftList(boolean oldGiftList) {
|
||||
isOldGiftList = oldGiftList;
|
||||
return this;
|
||||
}
|
||||
|
||||
private void initDate() {
|
||||
LiveHttpUtil.getNewGiftList(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
JSONArray list = obj.getJSONArray("listarray");
|
||||
setDate(list);
|
||||
if (isOldGiftList) {
|
||||
LiveHttpUtil.getGiftList(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
obj.put("listarray", obj.getJSONArray("giftlist"));
|
||||
JSONArray list = obj.getJSONArray("listarray");
|
||||
setDate(list);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if (mLoading != null) {
|
||||
mLoading.setVisibility(View.INVISIBLE);
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if (mLoading != null) {
|
||||
mLoading.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
LiveHttpUtil.getNewGiftList(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
JSONArray list = obj.getJSONArray("listarray");
|
||||
setDate(list);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if (mLoading != null) {
|
||||
mLoading.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void setDate(JSONArray list) {
|
||||
@ -190,7 +218,10 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene
|
||||
}
|
||||
|
||||
giftTopAdapter.setList(name);
|
||||
|
||||
if(isOldGiftList){
|
||||
showGiftList(JSON.parseArray(list.toJSONString(), LiveGiftBean.class));
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject obj2 = list.getJSONObject(type);
|
||||
String giftJson = obj2.getString("giftlist");
|
||||
@ -198,7 +229,6 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene
|
||||
}
|
||||
|
||||
private void showGiftList(List<LiveGiftBean> list) {
|
||||
|
||||
mLiveGiftPagerAdapter = new LiveGiftPagerAdapter(mContext, list);
|
||||
mLiveGiftPagerAdapter.setActionListener(this);
|
||||
|
||||
|
@ -26,16 +26,11 @@ import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@ -54,6 +49,7 @@ import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.GiftCacheUtil;
|
||||
import com.yunbao.common.utils.NobleUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
@ -62,6 +58,7 @@ import com.yunbao.live.adapter.LiveGiftCountAdapter;
|
||||
import com.yunbao.live.adapter.LiveGiftPagerAdapter;
|
||||
import com.yunbao.live.bean.GiftTopBean;
|
||||
import com.yunbao.live.bean.LiveGuardInfo;
|
||||
import com.yunbao.live.custom.GiftViewPager;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.utils.ToolsButton;
|
||||
@ -84,8 +81,8 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
private TextView mCoin;
|
||||
private TextView mTvGoldCoin;
|
||||
private TextView mTvGoCharge;
|
||||
|
||||
private ViewPager mViewPager, mVPWrapList;
|
||||
private GiftViewPager mViewPager;
|
||||
private ViewPager mVPWrapList;
|
||||
private RadioGroup mRadioGroup, mRGroupWrap;
|
||||
private View mLoading;
|
||||
private View mArrow;
|
||||
@ -199,7 +196,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
mLianText = (TextView) mRootView.findViewById(R.id.lian_text);
|
||||
mDrawable1 = ContextCompat.getDrawable(mContext, R.drawable.bg_live_gift_send);
|
||||
mDrawable2 = ContextCompat.getDrawable(mContext, R.drawable.bg_live_gift_send_2);
|
||||
mViewPager = (ViewPager) mRootView.findViewById(R.id.viewPager);
|
||||
mViewPager = (GiftViewPager) mRootView.findViewById(R.id.viewPager);
|
||||
mVPWrapList = (ViewPager) mRootView.findViewById(R.id.vpWrapList);
|
||||
final LinearLayoutManager manager = new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false);
|
||||
items.setLayoutManager(manager);
|
||||
@ -303,6 +300,10 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
mWishGiftId = bundle.getString(Constants.LIVE_WISH_GIFTID);
|
||||
by = bundle.getString("by");
|
||||
isContactGift = bundle.getBoolean("isContactGift", false) ? 1 : 0;
|
||||
if (isContactGift == 1) {
|
||||
mViewPager.setTouch(false);
|
||||
findViewById(R.id.gift_tab_layout).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
loadGiftListData();
|
||||
loadUserVip();
|
||||
@ -339,7 +340,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
//根据变量,判断是否取缓存
|
||||
if (isGetNewWrap) {
|
||||
isGetNewWrap = false;
|
||||
} else {
|
||||
} else if (isContactGift == 0) {
|
||||
String giftListJson = CommonAppConfig.getInstance().getGiftListJson();
|
||||
if (!TextUtils.isEmpty(giftListJson)) {
|
||||
try {
|
||||
@ -351,29 +352,56 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
}
|
||||
}
|
||||
if (list == null) {
|
||||
LiveHttpUtil.getNewGiftList(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
list = obj.getJSONArray("listarray");
|
||||
Log.i("tttts", obj.getString("listarray") + "");
|
||||
CommonAppConfig.getInstance().setGiftListJson(obj.getString("listarray"));
|
||||
|
||||
upData();
|
||||
mCoin.setText(obj.getString("coin"));
|
||||
mTvGoldCoin.setText(obj.getString("gold"));
|
||||
Bus.getOn(LiveGiftDialogFragment.this);
|
||||
if (isContactGift == 1) {
|
||||
LiveHttpUtil.getGiftList(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
obj.put("listarray", obj.getJSONArray("giftlist"));
|
||||
list = obj.getJSONArray("listarray");
|
||||
Log.i("tttts", obj.getString("giftlist") + "");
|
||||
List<LiveGiftBean> _list = JSON.parseArray(obj.getJSONArray("giftlist").toJSONString(), LiveGiftBean.class);
|
||||
showGiftList(_list);
|
||||
mGiftPackage.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mCoin.setText(obj.getString("coin"));
|
||||
mTvGoldCoin.setText(obj.getString("gold"));
|
||||
Bus.getOn(LiveGiftDialogFragment.this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if (mLoading != null) {
|
||||
mLoading.setVisibility(View.INVISIBLE);
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if (mLoading != null) {
|
||||
mLoading.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
LiveHttpUtil.getNewGiftList(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
list = obj.getJSONArray("listarray");
|
||||
Log.i("tttts", obj.getString("listarray") + "");
|
||||
CommonAppConfig.getInstance().setGiftListJson(obj.getString("listarray"));
|
||||
|
||||
upData();
|
||||
mCoin.setText(obj.getString("coin"));
|
||||
mTvGoldCoin.setText(obj.getString("gold"));
|
||||
Bus.getOn(LiveGiftDialogFragment.this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if (mLoading != null) {
|
||||
mLoading.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
mLoading.setVisibility(View.INVISIBLE);
|
||||
upData();
|
||||
@ -467,7 +495,10 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
mBeanFromWish = bean;
|
||||
bean.setChecked(true);
|
||||
itemCheckOp(bean);
|
||||
mViewPager.setCurrentItem(i / 10);
|
||||
mViewPager.setCurrentItem(i / 8);
|
||||
if (isContactGift == 1) {
|
||||
mLiveGiftPagerAdapter.disTouch(bean.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -689,6 +720,9 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
}
|
||||
}
|
||||
SendGiftCallback callback = new SendGiftCallback(mLiveGiftBean);
|
||||
if (!StringUtil.isEmpty(mWishGiftId) && mLiveGiftBean.getId() != Integer.parseInt(mWishGiftId)) {
|
||||
isContactGift = 0;
|
||||
}
|
||||
if (by != null) {
|
||||
LiveHttpUtil.sendGift("1", mLiveUid, mStream, mLiveGiftBean.getId(), mCount, isContactGift, callback);
|
||||
} else {
|
||||
|
@ -135,7 +135,7 @@
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
<com.yunbao.live.custom.GiftViewPager
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
|
@ -9,7 +9,7 @@
|
||||
android:id="@+id/bg_top"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitEnd"
|
||||
android:scaleType="fitStart"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -19,8 +19,8 @@
|
||||
android:id="@+id/textView10"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="85dp"
|
||||
android:layout_marginTop="45dp"
|
||||
android:layout_marginStart="62dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/dialog_live_mailbox_title"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
|
@ -9,7 +9,7 @@
|
||||
android:id="@+id/bg_top"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitEnd"
|
||||
android:scaleType="fitStart"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -19,9 +19,9 @@
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="85dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="信件欄"
|
||||
android:layout_marginStart="62dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/dialog_live_mailbox_title"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
|
@ -3,18 +3,9 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:background="@mipmap/bg_live_user_mailbox"
|
||||
android:layout_height="235dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="235dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/bg_live_user_mailbox" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/top_text"
|
||||
@ -65,7 +56,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:gravity="start"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
@ -78,15 +69,15 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:background="@drawable/bg_item_live_user_mailbox_info_text"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:text="@string/live_user_mailbox_more_text"
|
||||
android:textColor="#3399FF"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:text="@string/live_user_mailbox_more_text" />
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 151 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@ -14,7 +14,6 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@ -36,12 +35,14 @@ import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.LoginData;
|
||||
import com.yunbao.common.bean.UserAreaBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.JsonBean;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||
@ -100,6 +101,7 @@ public class LoginActivity extends AbsActivity {
|
||||
@Override
|
||||
protected void main() {
|
||||
EventBus.getDefault().register(this);
|
||||
initUserArea();
|
||||
mRoot = findViewById(R.id.root);
|
||||
Contexts = this;
|
||||
activity = this;
|
||||
@ -364,6 +366,19 @@ public class LoginActivity extends AbsActivity {
|
||||
mUuidDevice = DeviceUtils.getUniqueDeviceId();
|
||||
}
|
||||
|
||||
private void initUserArea(){
|
||||
LiveNetManager.get(mContext).getUserArea(new com.yunbao.common.http.base.HttpCallback<UserAreaBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserAreaBean data) {
|
||||
IMLoginManager.get(mContext).put("sys_user_area",data.getArea());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
|
@ -192,7 +192,9 @@ public class RegisterActivity extends AbsActivity {
|
||||
allCountries.clear();
|
||||
allCountries.addAll(Country.getAll(mContext, null));
|
||||
|
||||
String ct = Locale.getDefault().getCountry();
|
||||
//String ct = Locale.getDefault().getCountry();
|
||||
String ct = IMLoginManager.get(mContext).getString("sys_user_area");
|
||||
ToastUtil.show("地区:"+ct);
|
||||
ct = TextUtils.equals("CN", ct) ? "HK" : ct;
|
||||
for (int i = 0; i < allCountries.size(); i++) {
|
||||
if (allCountries.get(i).locale.equals(ct)) {
|
||||
|
Loading…
Reference in New Issue
Block a user