新增通过后端获取国家地区信息接口
调整送联系方式礼物时,不选择其他礼物 调整联系方式礼物接口 调整在模拟器超大分辨率模式下,信箱ui异常问题
This commit is contained in:
@@ -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 |
Reference in New Issue
Block a user