6.5.4礼物栏优化

This commit is contained in:
18401019693 2023-07-25 14:08:52 +08:00
parent 3376a57f9d
commit 0646f245b6
71 changed files with 3705 additions and 104 deletions

View File

@ -194,5 +194,6 @@ dependencies {
// //
api 'com.github.gzu-liyujiang.AndroidPicker:Common:4.1.11' api 'com.github.gzu-liyujiang.AndroidPicker:Common:4.1.11'
api 'com.github.gzu-liyujiang.AndroidPicker:WheelView:4.1.11' api 'com.github.gzu-liyujiang.AndroidPicker:WheelView:4.1.11'
//
api 'com.makeramen:roundedimageview:2.3.0'
} }

View File

@ -0,0 +1,40 @@
package com.yunbao.common.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.GiftQuantityModel;
import com.yunbao.common.views.GiftNumber;
import java.util.List;
public class GiftNumberAdapter extends RecyclerView.Adapter {
private List<GiftQuantityModel> giftQuantityModels;
public GiftNumberAdapter(List<GiftQuantityModel> giftQuantityModels) {
this.giftQuantityModels = giftQuantityModels;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View robotSayHelloView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_gift_number, parent, false);
return new GiftNumber(robotSayHelloView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
GiftNumber giftNumber = (GiftNumber) holder;
giftNumber.showData(giftQuantityModels.get(position));
}
@Override
public int getItemCount() {
return giftQuantityModels.size();
}
}

View File

@ -0,0 +1,43 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
/**
* 礼物选择数量
*/
public class GiftQuantityModel extends BaseModel {
@SerializedName("id")
private String id;
@SerializedName("gift_quantity")
private String giftQuantity;
@SerializedName("font_colour")
private String fontColour;
public String getId() {
return id;
}
public GiftQuantityModel setId(String id) {
this.id = id;
return this;
}
public String getGiftQuantity() {
return giftQuantity;
}
public GiftQuantityModel setGiftQuantity(String giftQuantity) {
this.giftQuantity = giftQuantity;
return this;
}
public String getFontColour() {
return fontColour;
}
public GiftQuantityModel setFontColour(String fontColour) {
this.fontColour = fontColour;
return this;
}
}

View File

@ -23,7 +23,7 @@ public class LiveGiftBean {
private String name; private String name;
private String price; private String price;
private String icon; private String icon;
private boolean checked; private boolean checked = false;
private int page; private int page;
private View mView; private View mView;
private String sendType;//支付是金币还是钻石 private String sendType;//支付是金币还是钻石
@ -36,6 +36,30 @@ public class LiveGiftBean {
private String tag; private String tag;
@JSONField(name = "blind_box_type") @JSONField(name = "blind_box_type")
private int blind_box_type = 0; private int blind_box_type = 0;
//礼物角标
@JSONField(name = "corner_mark")
private String cornerMark;
@JSONField(name = "gift_description")
private String giftDescription;
public String getGiftDescription() {
return giftDescription;
}
public LiveGiftBean setGiftDescription(String giftDescription) {
this.giftDescription = giftDescription;
return this;
}
public String getCornerMark() {
return cornerMark;
}
public LiveGiftBean setCornerMark(String cornerMark) {
this.cornerMark = cornerMark;
return this;
}
public int getBlind_box_type() { public int getBlind_box_type() {
return blind_box_type; return blind_box_type;

View File

@ -0,0 +1,16 @@
package com.yunbao.common.event;
import com.yunbao.common.bean.BaseModel;
public class GiftNumberEvent extends BaseModel {
private String mCount;
public String getmCount() {
return mCount;
}
public GiftNumberEvent setmCount(String mCount) {
this.mCount = mCount;
return this;
}
}

View File

@ -336,6 +336,18 @@ public class ImgLoader {
builder.into(imageView); builder.into(imageView);
} }
public static void displayBlurLive(Context context, int url, ImageView imageView) {
if (!contextIsExist(context)) {
return;
}
RequestBuilder<Drawable> builder = Glide.with(context)
.load(url)
.thumbnail(thumbnail)
.apply(RequestOptions.bitmapTransform(new BlurTransformation(20)))
.placeholder(R.mipmap.live_bg);
builder.into(imageView);
}
private static boolean contextIsExist(Context context) { private static boolean contextIsExist(Context context) {
if (context == null) { if (context == null) {
return false; return false;

View File

@ -19,13 +19,13 @@ import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.APKManager; import com.yunbao.common.manager.APKManager;
import com.yunbao.common.manager.GiftQuantityManager;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.LiveClassManager; import com.yunbao.common.manager.LiveClassManager;
import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.manager.NewLevelManager;
import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.MD5Util;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.VersionUtil; import com.yunbao.common.utils.VersionUtil;
@ -231,6 +231,10 @@ public class CommonHttpUtil {
if (obj.containsKey("defaultBubbleUrl")) { if (obj.containsKey("defaultBubbleUrl")) {
IMLoginManager.get(context).setDefaultBubbleUrl(obj.getString("defaultBubbleUrl")); IMLoginManager.get(context).setDefaultBubbleUrl(obj.getString("defaultBubbleUrl"));
} }
if (obj.containsKey("gift_quantity")) {
JSONArray giftQuantity = obj.getJSONArray("gift_quantity");
new GiftQuantityManager(context).UpGiftQuantity(giftQuantity.toJSONString());
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage(); String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage();

View File

@ -829,4 +829,5 @@ public interface PDLiveApi {
@Query("stream") String stream, @Query("stream") String stream,
@Query("red_packet_id") String redPacketId @Query("red_packet_id") String redPacketId
); );
} }

View File

@ -0,0 +1,53 @@
package com.yunbao.common.manager;
import android.content.Context;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.yunbao.common.bean.GiftQuantityModel;
import com.yunbao.common.bean.LiveClassBean;
import com.yunbao.common.manager.base.BaseCacheManager;
import java.util.List;
public class GiftQuantityManager extends BaseCacheManager {
private final static String KEY_GIFT_QUANTITY = "GiftQuantity";
private static GiftQuantityManager manager;
private Context context;
private List<GiftQuantityModel> giftQuantityModels;
public GiftQuantityManager(Context context) {
super(context);
}
/**
* 获取指导员备注信息
*
* @return
*/
public List<GiftQuantityModel> getGiftQuantity() {
List<GiftQuantityModel> giftQuantityModels = getList(KEY_GIFT_QUANTITY, new TypeToken<List<GiftQuantityModel>>() {
}.getType());
if (giftQuantityModels == null || giftQuantityModels.size() == 0) {
giftQuantityModels.add(new GiftQuantityModel().setGiftQuantity("1").setFontColour("#ffffff"));
giftQuantityModels.add(new GiftQuantityModel().setGiftQuantity("10").setFontColour("#ffffff"));
giftQuantityModels.add(new GiftQuantityModel().setGiftQuantity("66").setFontColour("#ffffff"));
giftQuantityModels.add(new GiftQuantityModel().setGiftQuantity("88").setFontColour("#FA62A1"));
giftQuantityModels.add(new GiftQuantityModel().setGiftQuantity("100").setFontColour("#9B62FF"));
giftQuantityModels.add(new GiftQuantityModel().setGiftQuantity("520").setFontColour("#65BFFB"));
giftQuantityModels.add(new GiftQuantityModel().setGiftQuantity("1314").setFontColour("#05F3EC"));
}
return giftQuantityModels;
}
/**
* 缓存等级图标
*
* @param json
*/
public void UpGiftQuantity(String json) {
giftQuantityModels = new Gson().fromJson(json, new TypeToken<List<GiftQuantityModel>>() {
}.getType());
put(KEY_GIFT_QUANTITY, giftQuantityModels);
}
}

View File

@ -0,0 +1,56 @@
package com.yunbao.common.utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
/**
* Created by L on 2017/10/12.
*/
public class BlurBitmapUtil {
/**
* 图片缩放比例
*/
private static final float BITMAP_SCALE = 0.4f;
/**
* 最大模糊度(在0.0到25.0之间)
*/
private static final float BLUR_RADIUS = 25f;
/**
* 模糊图片的具体方法
*
* @param context 上下文对象
* @param image 需要模糊的图片
* @return 模糊处理后的图片
*/
public static Bitmap blur(Context context, Bitmap image) {
// 计算图片缩小后的长宽
int width = Math.round(image.getWidth() * BITMAP_SCALE);
int height = Math.round(image.getHeight() * BITMAP_SCALE);
// 将缩小后的图片做为预渲染的图片
Bitmap inputBitmap = Bitmap.createScaledBitmap(image, width, height, false);
// 创建一张渲染后的输出图片
Bitmap outputBitmap = Bitmap.createBitmap(inputBitmap);
// 创建RenderScript内核对象
RenderScript rs = RenderScript.create(context);
// 创建一个模糊效果的RenderScript的工具对象
ScriptIntrinsicBlur blurScript = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
// 由于RenderScript并没有使用VM来分配内存,所以需要使用Allocation类来创建和分配内存空间
// 创建Allocation对象的时候其实内存是空的,需要使用copyTo()将数据填充进去
Allocation tmpIn = Allocation.createFromBitmap(rs, inputBitmap);
Allocation tmpOut = Allocation.createFromBitmap(rs, outputBitmap);
// 设置渲染的模糊程度, 25f是最大模糊度
blurScript.setRadius(BLUR_RADIUS);
// 设置blurScript对象的输入内存
blurScript.setInput(tmpIn);
// 将输出数据保存到输出内存中
blurScript.forEach(tmpOut);
// 将数据填充到Allocation中
tmpOut.copyTo(outputBitmap);
return outputBitmap;
}
}

View File

@ -139,7 +139,7 @@ public class CustomDrawerPopupView extends DrawerPopupView {
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.online), new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.online), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.more_menu)); XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.diamond_linear));
builder.hasShadowBg(false) builder.hasShadowBg(false)
.isDestroyOnDismiss(true) .isDestroyOnDismiss(true)
.isLightStatusBar(false) .isLightStatusBar(false)

View File

@ -0,0 +1,34 @@
package com.yunbao.common.views;
import android.graphics.Color;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.GiftQuantityModel;
import com.yunbao.common.event.GiftNumberEvent;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
public class GiftNumber extends RecyclerView.ViewHolder {
private TextView customQuantity;
public GiftNumber(@NonNull View itemView) {
super(itemView);
customQuantity = itemView.findViewById(R.id.custom_quantity);
}
public void showData(GiftQuantityModel quantityModel) {
customQuantity.setText(quantityModel.getGiftQuantity());
customQuantity.setTextColor(Color.parseColor(quantityModel.getFontColour()));
ViewClicksAntiShake.clicksAntiShake(customQuantity, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
Bus.get().post(new GiftNumberEvent().setmCount(quantityModel.getGiftQuantity()));
}
});
}
}

View File

@ -0,0 +1,59 @@
package com.yunbao.common.views;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.core.BottomPopupView;
import com.yunbao.common.R;
import com.yunbao.common.adapter.GiftNumberAdapter;
import com.yunbao.common.event.GiftNumberEvent;
import com.yunbao.common.manager.GiftQuantityManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
public class GiftNumberPopup extends BottomPopupView {
public GiftNumberPopup(@NonNull Context context) {
super(context);
}
// 返回自定义弹窗的布局
@Override
protected int getImplLayoutId() {
return R.layout.view_live_gift_number;
}
// 执行初始化操作比如findView设置点击或者任何你弹窗内的业务逻辑
@Override
protected void onCreate() {
Bus.getOn(this);
super.onCreate();
RecyclerView giftList = findViewById(R.id.gift_list);
giftList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
GiftNumberAdapter giftNumberAdapter = new GiftNumberAdapter(new GiftQuantityManager(getContext()).getGiftQuantity());
giftList.setAdapter(giftNumberAdapter);
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.to_can), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
dismiss();
}
});
}
@Override
protected void onDismiss() {
super.onDismiss();
Bus.getOff(this);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onGiftNumberEvent(GiftNumberEvent event) {
dismiss();
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:topLeftRadius="8dp"
android:topRightRadius="8dp" />
<gradient
android:angle="90"
android:endColor="#000000"
android:startColor="#9000" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="4dp" />
<solid android:color="#5C607D" />
<stroke
android:width="0.2dp"
android:color="#EAEAEA" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="17dp" />
<solid android:color="#2A2C3B" />
</shape>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:bottomLeftRadius="16dp"
android:topLeftRadius="16dp" />
<solid android:color="#2A2C3B" />
</shape>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="8dp" />
<solid android:color="#130F25" />
<stroke android:width="0.6dp" android:color="#AEAEB2" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true">
<shape>
<corners android:radius="18dp" />
<gradient android:angle="180" android:endColor="#FF7C25" android:startColor="#FFB323" />
</shape>
</item>
<item android:state_enabled="false">
<shape>
<corners android:radius="18dp" />
<solid android:color="#282518" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp"/>
<solid android:color="#3B3D52"/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!--设置ProgressBar背景色-->
<item android:id="@android:id/background">
<shape>
<!--设置ProgressBar进度条圆角半径-->
<corners android:radius="5dp" />
<solid android:color="#E6E6E6" />
</shape>
</item>
<!--设置ProgressBar进度条颜色-->
<item android:id="@android:id/progress">
<clip android:clipOrientation="horizontal">
<shape>
<corners android:radius="5dp" />
<solid android:color="#FFC722" />
</shape>
</clip>
</item>
</layer-list>

View File

@ -0,0 +1,357 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical">
<FrameLayout
android:id="@+id/blind_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:visibility="invisible">
<include
layout="@layout/view_blind_box" />
</FrameLayout>
<RelativeLayout
android:id="@+id/gift_list"
android:layout_width="match_parent"
android:layout_height="351dp"
android:animateLayoutChanges="true"
android:orientation="vertical">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/git_background2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/backgroud_custom_gift2"
app:riv_corner_radius_bottom_left="0dp"
app:riv_corner_radius_bottom_right="0dp"
app:riv_corner_radius_top_left="10dp"
app:riv_corner_radius_top_right="10dp" />
<LinearLayout
android:id="@+id/git_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:animateLayoutChanges="true">
<LinearLayout
android:id="@+id/leveling_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="gone">
<FrameLayout
android:layout_width="40dp"
android:layout_height="22dp"
android:layout_marginStart="17dp"
android:layout_marginTop="9dp"
android:background="@mipmap/icon_grade_angle_mark">
<TextView
android:id="@+id/lv_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Lv.8"
android:textColor="@color/white"
android:textSize="12sp" />
</FrameLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="18dp"
android:layout_weight="1"
android:orientation="vertical">
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="4dp"
android:max="100"
android:progress="0"
android:progressDrawable="@drawable/progress_bg_user" />
<TextView
android:id="@+id/leave_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="@string/leveling_points"
android:textColor="#BBBBBB"
android:textSize="9sp" />
</LinearLayout>
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginTop="14dp"
android:layout_marginEnd="14dp"
android:background="@mipmap/icon_right" />
</LinearLayout>
<com.yunbao.common.views.weight.MarqueeTextView
android:id="@+id/gift_description"
android:layout_width="0dp"
android:background="@drawable/background_gift_description"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="15dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textColor="#FFFFFFFF"
android:textSize="12sp" />
<FrameLayout
android:id="@+id/btn_luck_gift_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<include layout="@layout/view_nobility" />
</FrameLayout>
</LinearLayout>
<RelativeLayout
android:id="@+id/gift_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="17dp"
android:paddingStart="16dp">
<LinearLayout
android:id="@+id/diamond_linear"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:background="@drawable/background_gift_money"
android:gravity="center_vertical"
android:paddingStart="4dp"
android:paddingTop="7dp"
android:paddingBottom="7dp">
<ImageView
android:layout_width="18dp"
android:layout_height="18dp"
android:clickable="false"
android:focusable="false"
android:src="@mipmap/diamond" />
<TextView
android:id="@+id/diamond_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:clickable="false"
android:focusable="false"
android:text="0"
android:textColor="@color/white"
android:textSize="12sp" />
<ImageView
android:layout_width="8dp"
android:layout_height="8dp"
android:layout_marginEnd="4dp"
android:background="@mipmap/icon_right" />
</LinearLayout>
<LinearLayout
android:id="@+id/gold_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_toRightOf="@id/diamond_linear"
android:gravity="center_vertical">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:clickable="false"
android:focusable="false"
android:src="@mipmap/gold_coin" />
<TextView
android:id="@+id/gold_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:clickable="false"
android:focusable="false"
android:text="10000000"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
<FrameLayout
android:id="@+id/gift_send_layout"
android:layout_width="130dp"
android:layout_height="32dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="14dp">
<FrameLayout
android:id="@+id/gift_number_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="42dp"
android:background="@drawable/background_gift_money2">
<TextView
android:id="@+id/gift_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="15dp"
android:text="1"
android:textColor="#F5C05A"
android:textSize="14sp" />
<ImageView
android:id="@+id/icon_arrow"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="30dp"
android:src="@mipmap/icon_arrow_right" />
</FrameLayout>
<TextView
android:id="@+id/live_gift_send"
android:layout_width="62dp"
android:layout_height="32dp"
android:layout_gravity="end"
android:background="@drawable/bg_live_gift_send_new"
android:gravity="center"
android:text="@string/live_gift_send"
android:textColor="@color/white"
android:textSize="14sp" />
</FrameLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/gift_bottom"
android:layout_below="@id/git_title"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="18dp">
<FrameLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/gift_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="8dp" />
<ImageView
android:layout_width="27dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:background="@drawable/icon_covering_layer"
android:scaleType="centerCrop" />
</FrameLayout>
<View
android:layout_width="1dp"
android:layout_height="11dp"
android:layout_gravity="center_vertical"
android:background="@color/white" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="10dp">
<TextView
android:id="@+id/live_wrap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="8dp"
android:text="@string/live_wrap"
android:textColor="#CCCDCE"
android:textSize="16sp" />
</FrameLayout>
</LinearLayout>
<FrameLayout
android:id="@+id/context_layout_gift"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="12dp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/btn_send_lian"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp"
android:background="@mipmap/icon_live_gift_lian"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="@string/live_gift_send_lian"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:id="@+id/lian_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:textColor="#fff"
android:textSize="14sp" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="26dp">
<TextView
android:id="@+id/custom_quantity"
android:layout_width="match_parent"
android:layout_height="26dp"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="@string/custom_quantity"
android:textColor="#FFFFFF"
android:textSize="14sp" />
</LinearLayout>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="351dp"
android:background="@color/transparent"
android:orientation="vertical"
tools:ignore="MissingDefaultResource">
<View
android:id="@+id/to_can"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="80dp"
android:layout_height="212dp"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="48dp"
android:layout_marginBottom="50dp"
android:background="@drawable/bg_selection_quantity"
android:orientation="vertical">
<TextView
android:clickable="true"
android:id="@+id/custom_quantity"
android:layout_width="match_parent"
android:layout_height="28dp"
android:gravity="center"
android:layout_marginTop="2dp"
android:text="@string/custom_quantity"
android:textColor="#FFFFFF"
android:textSize="14sp"
android:focusable="true" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/gift_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</RelativeLayout>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:ignore="MissingDefaultResource">
<FrameLayout
android:id="@+id/no_nobility"
android:layout_width="67dp"
android:layout_height="24dp"
android:layout_marginTop="5dp"
android:background="@mipmap/icon_aristocrat_tip"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="2dp"
android:text="@string/live_ktgz"
android:textColor="#FFC008"
android:textSize="10sp" />
</FrameLayout>
<LinearLayout
android:id="@+id/established_nobility"
android:layout_width="78dp"
android:layout_height="26dp"
android:background="@mipmap/icon_established_nobility"
android:orientation="horizontal">
<ImageView
android:id="@+id/nobility_icon"
android:layout_width="24dp"
android:layout_height="24dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="1dp"
android:orientation="vertical">
<TextView
android:id="@+id/vipGoldTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="贵族"
android:textColor="#FFC722"
android:textSize="10sp"
android:textStyle="bold" />
<TextView
android:id="@+id/vipGoldDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="贵族"
android:textColor="#CCFFFFFF"
android:textSize="8sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</FrameLayout>

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 233 B

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1250,4 +1250,8 @@ Limited ride And limited avatar frame</string>
<string name="lucky_red_envelope">%s drew %s in the lucky red envelope</string> <string name="lucky_red_envelope">%s drew %s in the lucky red envelope</string>
<string name="lucky_red_envelope_amount">number</string> <string name="lucky_red_envelope_amount">number</string>
<string name="red_envelope_released_successfully">>Red successfully</string> <string name="red_envelope_released_successfully">>Red successfully</string>
<string name="leveling_points">升級還需%s經驗值升至%s即可領取獎勵</string>
<string name="nothing_in_the_package_yet">包裹中暫無物品哦</string>
<string name="reach_the_top">恭喜,你已達到最高等級</string>
<string name="custom_quantity">自定義數量</string>
</resources> </resources>

View File

@ -9,9 +9,9 @@ ext {
] ]
manifestPlaceholders = [ manifestPlaceholders = [
// //
serverHost : "https://napi.yaoulive.com", // serverHost : "https://napi.yaoulive.com",
// //
// serverHost : "https://ceshi.yaoulive.com", serverHost : "https://ceshi.yaoulive.com",

View File

@ -91,6 +91,7 @@ import com.yunbao.live.bean.LiveChatBean;
import com.yunbao.live.dialog.LiveFansFragment; import com.yunbao.live.dialog.LiveFansFragment;
import com.yunbao.live.dialog.LiveGameDialogFragment; import com.yunbao.live.dialog.LiveGameDialogFragment;
import com.yunbao.live.dialog.LiveGiftDialogFragment; import com.yunbao.live.dialog.LiveGiftDialogFragment;
import com.yunbao.live.dialog.LiveGiftPopup;
import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LiveInputDialogFragment; import com.yunbao.live.dialog.LiveInputDialogFragment;
import com.yunbao.live.dialog.LiveMicUserDialogFragment; import com.yunbao.live.dialog.LiveMicUserDialogFragment;
@ -443,18 +444,16 @@ public class LiveAudienceActivity extends LiveActivity {
*/ */
public void openGiftWindow() { public void openGiftWindow() {
new Handler(Looper.getMainLooper()).post(() -> { new Handler(Looper.getMainLooper()).post(() -> {
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) { if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) {
return; return;
} }
LiveGiftDialogFragment fragment = new LiveGiftDialogFragment(); Bus.get().post(new LiveAudienceEvent()
fragment.setPkStatus(isPk); .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
fragment.setLiveGuardInfo(mLiveGuardInfo); .setmLiveUid(mLiveUid)
Bundle bundle = new Bundle(); .setmStream(mStream)
bundle.putString(Constants.LIVE_UID, mLiveUid); .setPk(isPk)
bundle.putString(Constants.LIVE_STREAM, mStream); .setLiveGuardInfo(mLiveGuardInfo));
fragment.setArguments(bundle);
fragment.setOnDismissListener(dialog -> checkMsgRed());
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
}); });
} }
@ -462,16 +461,13 @@ public class LiveAudienceActivity extends LiveActivity {
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) { if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) {
return; return;
} }
LiveGiftDialogFragment fragment = new LiveGiftDialogFragment(); Bus.get().post(new LiveAudienceEvent()
fragment.setPkStatus(isPk); .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
fragment.setLiveGuardInfo(mLiveGuardInfo); .setmLiveUid(mLiveUid)
Bundle bundle = new Bundle(); .setmStream(mStream)
bundle.putString(Constants.LIVE_UID, mLiveUid); .setPk(isPk)
bundle.putString(Constants.LIVE_STREAM, mStream); .setLiveGuardInfo(mLiveGuardInfo)
bundle.putString(Constants.LIVE_WISH_GIFTID, giftId); .setmWishGiftId(giftId));
fragment.setArguments(bundle);
fragment.setOnDismissListener(dialog -> checkMsgRed());
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
} }
public void openGiftWindow(String giftId, String for_by) { public void openGiftWindow(String giftId, String for_by) {
@ -479,19 +475,15 @@ public class LiveAudienceActivity extends LiveActivity {
return; return;
} }
new Handler(Looper.getMainLooper()).post(() -> { new Handler(Looper.getMainLooper()).post(() -> {
LiveGiftDialogFragment fragment = new LiveGiftDialogFragment();
fragment.setPkStatus(isPk); Bus.get().post(new LiveAudienceEvent()
fragment.setLiveGuardInfo(mLiveGuardInfo); .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
Bundle bundle = new Bundle(); .setmLiveUid(mLiveUid)
bundle.putString(Constants.LIVE_UID, mLiveUid); .setmStream(mStream)
bundle.putString(Constants.LIVE_STREAM, mStream); .setPk(isPk)
bundle.putString(Constants.LIVE_WISH_GIFTID, giftId); .setLiveGuardInfo(mLiveGuardInfo)
if (for_by.equals("1")) { .setmWishGiftId(giftId)
bundle.putString("by", "1"); .setUname("1"));//setUname==by
}
fragment.setArguments(bundle);
fragment.setOnDismissListener(dialog -> checkMsgRed());
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
}); });
} }
@ -1023,18 +1015,29 @@ public class LiveAudienceActivity extends LiveActivity {
break; break;
case GIFT_POPUP: case GIFT_POPUP:
LiveGiftPopup liveGiftPopup = new LiveGiftPopup();
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) { bundle.putString("mLiveUid", mLiveUid);
return; bundle.putString("mStream", mStream);
} bundle.putString("WishGiftId", event.getmWishGiftId());
LiveGiftDialogFragment liveGiftDialogFragment = new LiveGiftDialogFragment(); bundle.putBoolean("ContactGift", event.getIsContactGift());
liveGiftDialogFragment.setPkStatus(isPk); bundle.putParcelable("GuardInfo", event.getLiveGuardInfo());
liveGiftDialogFragment.setLiveGuardInfo(mLiveGuardInfo); bundle.putBoolean("pk", event.isPk());
bundle.putString(Constants.LIVE_UID, mLiveUid); liveGiftPopup.setArguments(bundle);
bundle.putString(Constants.LIVE_STREAM, mStream); liveGiftPopup.show(getSupportFragmentManager(), "LiveGiftPopup");
liveGiftDialogFragment.setArguments(bundle); // new XPopup.Builder(mContext)
liveGiftDialogFragment.setOnDismissListener(dialog -> checkMsgRed()); // .asCustom(new LiveGiftPopup(mContext, this))
liveGiftDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment"); // .show();
// if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) {
// return;
// }
// LiveGiftDialogFragment liveGiftDialogFragment = new LiveGiftDialogFragment();
// liveGiftDialogFragment.setPkStatus(isPk);
// liveGiftDialogFragment.setLiveGuardInfo(mLiveGuardInfo);
// bundle.putString(Constants.LIVE_UID, mLiveUid);
// bundle.putString(Constants.LIVE_STREAM, mStream);
// liveGiftDialogFragment.setArguments(bundle);
// liveGiftDialogFragment.setOnDismissListener(dialog -> checkMsgRed());
// liveGiftDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
break; break;
case CURRENT_ACTIVITY: case CURRENT_ACTIVITY:
String type = event.getModel().getActiveId(); String type = event.getModel().getActiveId();

View File

@ -0,0 +1,69 @@
package com.yunbao.live.adapter;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.utils.Bus;
import com.yunbao.live.R;
import com.yunbao.live.event.LiveGiftItemEvent;
import com.yunbao.live.views.FrameGiftViewHolder;
import java.util.ArrayList;
import java.util.List;
public class FrameGiftAdapter extends RecyclerView.Adapter {
private List<LiveGiftBean> giftJson = new ArrayList<>();
private int contextLayoutGiftHeight = 0;
private String mStream, mLiveUid, wishGiftId;
public FrameGiftAdapter(int contextLayoutGiftHeight, List<LiveGiftBean> giftJson, String mStream, String mLiveUid, String wishGiftId) {
this.contextLayoutGiftHeight = contextLayoutGiftHeight;
this.giftJson = giftJson;
this.mStream = mStream;
this.mLiveUid = mLiveUid;
this.wishGiftId = wishGiftId;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_frame_gift, parent, false);
return new FrameGiftViewHolder(herdView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (!TextUtils.isEmpty(wishGiftId) && TextUtils.equals(giftJson.get(position).getId() + "", wishGiftId)) {
Bus.get().post(new LiveGiftItemEvent().setLiveGiftModel(giftJson.get(position)));
}
FrameGiftViewHolder frameGiftViewHolder = (FrameGiftViewHolder) holder;
frameGiftViewHolder.showData(contextLayoutGiftHeight, giftJson.get(position));
frameGiftViewHolder.giftSelect(giftJson.get(position), position, mStream, mLiveUid, new FrameGiftViewHolder.FrameGiftClickListener() {
@Override
public void onCallBack(int position, LiveGiftBean model) {
Bus.get().post(new LiveGiftItemEvent().setLiveGiftModel(model));
wishGiftId = null;
}
});
}
public void giftSelect(LiveGiftBean model) {
for (int i = 0; i < giftJson.size(); i++) {
giftJson.get(i).setChecked(giftJson.get(i).getId() == model.getId());
}
notifyDataSetChanged();
}
@Override
public int getItemCount() {
return giftJson.size();
}
}

View File

@ -0,0 +1,60 @@
package com.yunbao.live.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.live.R;
import com.yunbao.live.bean.GiftTopBean;
import com.yunbao.live.views.GiftTitleViewHolder;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class GiftTitleAdapter extends RecyclerView.Adapter {
List<GiftTopBean> name = new ArrayList<>();
private int index = 0;
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_gift_top_new, parent, false);
return new GiftTitleViewHolder(herdView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
GiftTitleViewHolder itemViewHolder = (GiftTitleViewHolder) holder;
itemViewHolder.showData(name.get(position), position, new GiftTitleViewHolder.ClicksCallBack() {
@Override
public void onViewClicks(int mPosition) {
index = mPosition;
notifyDataSetChanged();
}
});
itemViewHolder.selectData(index == position);
}
@Override
public int getItemCount() {
return name.size();
}
public void addAllData(List<GiftTopBean> giftTopBeans) {
name.clear();
name.addAll(giftTopBeans);
notifyDataSetChanged();
}
public void uncheck() {
index = -1;
notifyDataSetChanged();
}
}

View File

@ -0,0 +1,33 @@
package com.yunbao.live.adapter;
import android.content.Context;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import java.util.List;
public class LiveGiftFragmentPagerAdapter extends FragmentPagerAdapter {
private List<Fragment> fragmentList;
public LiveGiftFragmentPagerAdapter(FragmentManager fm, Context mContext, List<Fragment> fragmentList) {
super(fm);
this.fragmentList = fragmentList;
}
@Override
public Fragment getItem(int i) {
return fragmentList.get(i);
}
@Override
public int getCount() {
return fragmentList.size();
}
}

View File

@ -0,0 +1,85 @@
package com.yunbao.live.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.utils.Bus;
import com.yunbao.live.R;
import com.yunbao.live.event.LiveGiftItemEvent;
import com.yunbao.live.views.LiveParcelItemViewHolder;
import java.util.ArrayList;
import java.util.List;
public class LiveParcelItemAdapter extends RecyclerView.Adapter {
private List<LiveGiftBean> giftJson = new ArrayList<>();
private int contextLayoutGiftHeight = 0;
private String mStream, mLiveUid;
public LiveParcelItemAdapter(int contextLayoutGiftHeight, List<LiveGiftBean> giftJson, String mStream, String mLiveUid) {
this.contextLayoutGiftHeight = contextLayoutGiftHeight;
this.giftJson = giftJson;
this.mStream = mStream;
this.mLiveUid = mLiveUid;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_live_parcel, parent, false);
return new LiveParcelItemViewHolder(herdView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
LiveParcelItemViewHolder frameGiftViewHolder = (LiveParcelItemViewHolder) holder;
frameGiftViewHolder.showData(contextLayoutGiftHeight, giftJson.get(position));
frameGiftViewHolder.giftSelect(giftJson.get(position), position, mStream, mLiveUid, new LiveParcelItemViewHolder.FrameGiftClickListener() {
@Override
public void onCallBack(int position, LiveGiftBean model) {
Bus.get().post(new LiveGiftItemEvent().setLiveGiftModel(model));
}
});
}
public void giftSelect(LiveGiftBean model) {
for (int i = 0; i < giftJson.size(); i++) {
giftJson.get(i).setChecked(giftJson.get(i).getId() == model.getId());
}
notifyDataSetChanged();
}
public void refreshWrapListAfterSend(LiveGiftBean model) {
for (int i = 0; i < giftJson.size(); i++) {
if (giftJson.get(i).getId() == model.getId()) {
String giftNum = giftJson.get(i).getGiftNum();
int number = 0;
try {
number = Integer.parseInt(giftNum);
} catch (NumberFormatException e) {
e.printStackTrace();
number = 0;
}
if (number == 1) {
giftJson.remove(i);
} else {
giftJson.get(i).setGiftNum(String.valueOf(number - 1));
}
}
}
notifyDataSetChanged();
}
@Override
public int getItemCount() {
return giftJson.size();
}
}

View File

@ -0,0 +1,115 @@
package com.yunbao.live.bean;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.bean.BaseModel;
public class CoinModel extends BaseModel {
//钻石余额
@SerializedName("coin")
private String coin;
//金豆余额
@SerializedName("gold")
private String gold;
@SerializedName("uid")
private String uid;
//平台最大等级
@SerializedName("user_level_max")
private String userLevelMax;
//当前用户等级
@SerializedName("user_level")
private String userLevel;
//升级下一级需要的经验
@SerializedName("user_next_level_rewards")
private String userNextLevelRewards;
//当前已经获取到的经验值
@SerializedName("user_level_current_consumption")
private String userLevelCurrentConsumption;
//升级需要的经验值(总的
@SerializedName("user_level_upgrades")
private String userLevelUpgrades;
//包裹红点
@SerializedName("users_pack_red_dot")
private String usersPackRedDot;
public String getCoin() {
return coin;
}
public CoinModel setCoin(String coin) {
this.coin = coin;
return this;
}
public String getGold() {
return gold;
}
public CoinModel setGold(String gold) {
this.gold = gold;
return this;
}
public String getUid() {
return uid;
}
public CoinModel setUid(String uid) {
this.uid = uid;
return this;
}
public String getUserLevelMax() {
return userLevelMax;
}
public CoinModel setUserLevelMax(String userLevelMax) {
this.userLevelMax = userLevelMax;
return this;
}
public String getUserLevel() {
return userLevel;
}
public CoinModel setUserLevel(String userLevel) {
this.userLevel = userLevel;
return this;
}
public String getUserNextLevelRewards() {
return userNextLevelRewards;
}
public CoinModel setUserNextLevelRewards(String userNextLevelRewards) {
this.userNextLevelRewards = userNextLevelRewards;
return this;
}
public String getUserLevelCurrentConsumption() {
return userLevelCurrentConsumption;
}
public CoinModel setUserLevelCurrentConsumption(String userLevelCurrentConsumption) {
this.userLevelCurrentConsumption = userLevelCurrentConsumption;
return this;
}
public String getUserLevelUpgrades() {
return userLevelUpgrades;
}
public CoinModel setUserLevelUpgrades(String userLevelUpgrades) {
this.userLevelUpgrades = userLevelUpgrades;
return this;
}
public String getUsersPackRedDot() {
return usersPackRedDot;
}
public CoinModel setUsersPackRedDot(String usersPackRedDot) {
this.usersPackRedDot = usersPackRedDot;
return this;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
package com.yunbao.live.event;
import com.yunbao.common.bean.BaseModel;
public class GiftTitleEvent extends BaseModel {
private String giftTitle;
private int mPosition;
public int getmPosition() {
return mPosition;
}
public GiftTitleEvent setmPosition(int mPosition) {
this.mPosition = mPosition;
return this;
}
public String getGiftTitle() {
return giftTitle;
}
public GiftTitleEvent setGiftTitle(String giftTitle) {
this.giftTitle = giftTitle;
return this;
}
}

View File

@ -14,6 +14,7 @@ import com.yunbao.common.bean.WishModel;
import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.bean.XydCompleteModel;
import com.yunbao.common.event.AllServerNotifyEvent; import com.yunbao.common.event.AllServerNotifyEvent;
import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.live.bean.LiveGuardInfo;
import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LivePKUserListBean;
import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.LiveReceiveGiftBean;
import com.yunbao.live.bean.OpenParametersModel; import com.yunbao.live.bean.OpenParametersModel;
@ -49,6 +50,75 @@ public class LiveAudienceEvent extends BaseModel {
private RedPacketModel redPacketModel; private RedPacketModel redPacketModel;
private RedPacketInfoModel redPacketInfoModel; private RedPacketInfoModel redPacketInfoModel;
private OlineUserlistModel olineUserlistModel; private OlineUserlistModel olineUserlistModel;
private LiveGuardInfo liveGuardInfo;
private String mWishGiftId;
private boolean isContactGift;
private boolean isPk;
public String mStream;
public String mLiveUid,giftId;
public String getGiftId() {
return giftId;
}
public LiveAudienceEvent setGiftId(String giftId) {
this.giftId = giftId;
return this;
}
public String getmStream() {
return mStream;
}
public LiveAudienceEvent setmStream(String mStream) {
this.mStream = mStream;
return this;
}
public String getmLiveUid() {
return mLiveUid;
}
public LiveAudienceEvent setmLiveUid(String mLiveUid) {
this.mLiveUid = mLiveUid;
return this;
}
public boolean isPk() {
return isPk;
}
public LiveAudienceEvent setPk(boolean pk) {
isPk = pk;
return this;
}
public boolean getIsContactGift() {
return isContactGift;
}
public LiveAudienceEvent setIsContactGift(boolean isContactGift) {
this.isContactGift = isContactGift;
return this;
}
public String getmWishGiftId() {
return mWishGiftId;
}
public LiveAudienceEvent setmWishGiftId(String mWishGiftId) {
this.mWishGiftId = mWishGiftId;
return this;
}
public LiveGuardInfo getLiveGuardInfo() {
return liveGuardInfo;
}
public LiveAudienceEvent setLiveGuardInfo(LiveGuardInfo liveGuardInfo) {
this.liveGuardInfo = liveGuardInfo;
return this;
}
public OlineUserlistModel getOlineUserlistModel() { public OlineUserlistModel getOlineUserlistModel() {
return olineUserlistModel; return olineUserlistModel;

View File

@ -0,0 +1,20 @@
package com.yunbao.live.event;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.LiveGiftBean;
/**
* 选中的礼物
*/
public class LiveGiftItemEvent extends BaseModel {
private LiveGiftBean liveGiftModel;
public LiveGiftBean getLiveGiftModel() {
return liveGiftModel;
}
public LiveGiftItemEvent setLiveGiftModel(LiveGiftBean liveGiftModel) {
this.liveGiftModel = liveGiftModel;
return this;
}
}

View File

@ -0,0 +1,17 @@
package com.yunbao.live.event;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.LiveGiftBean;
public class LiveParcelItemRefreshEvent extends BaseModel {
private LiveGiftBean liveGiftModel;
public LiveGiftBean getLiveGiftModel() {
return liveGiftModel;
}
public LiveParcelItemRefreshEvent setLiveGiftModel(LiveGiftBean liveGiftModel) {
this.liveGiftModel = liveGiftModel;
return this;
}
}

View File

@ -6,7 +6,6 @@ import android.animation.ObjectAnimator;
import android.animation.ValueAnimator; import android.animation.ValueAnimator;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.CountDownTimer; import android.os.CountDownTimer;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
@ -46,6 +45,7 @@ import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.GiftCacheUtil;
import com.yunbao.common.utils.HtmlTagHandler; import com.yunbao.common.utils.HtmlTagHandler;
@ -53,12 +53,11 @@ import com.yunbao.common.utils.L;
import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveGiftPrizePoolWinBean;
import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean;
import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.LiveReceiveGiftBean;
import com.yunbao.live.custom.FrameImageView; import com.yunbao.live.custom.FrameImageView;
import com.yunbao.live.dialog.LiveGiftDialogFragment; import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.utils.AllMsgTextRender; import com.yunbao.live.utils.AllMsgTextRender;
@ -339,14 +338,12 @@ public class LiveGiftAnimPresenter {
new Handler().postDelayed(new Runnable() { new Handler().postDelayed(new Runnable() {
@Override @Override
public void run() { public void run() {
LiveGiftDialogFragment fragment = new LiveGiftDialogFragment(); Bus.get().post(new LiveAudienceEvent()
Bundle bundle = new Bundle(); .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
bundle.putString(Constants.LIVE_UID, mLiveUid); .setmLiveUid(mLiveUid)
bundle.putString(Constants.LIVE_STREAM, mStream); .setmStream(mStream)
bundle.putString(Constants.LIVE_WISH_GIFTID, blindBox.getEvent().getBlindBoxId() + ""); .setmWishGiftId(blindBox.getEvent().getBlindBoxId() + "")
bundle.putBoolean("isContactGift", true); .setIsContactGift(true));
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
} }
}, 1000); }, 1000);
} else { } else {

View File

@ -0,0 +1,158 @@
package com.yunbao.live.views;
import android.content.Context;
import android.graphics.Color;
import android.util.TypedValue;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.view.animation.ScaleAnimation;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
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.bean.LiveGiftBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.GiftCacheUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.dialog.SendRendPacketPopup;
import com.yunbao.live.event.LiveGiftDialogEvent;
import java.io.File;
public class FrameGiftViewHolder extends RecyclerView.ViewHolder {
private ImageView giftIcon, mPayIco, cornerMark;
private Context mContext;
private TextView giftName, mPrice;
private RelativeLayout giftLayout;
private ScaleAnimation mAnimation;
private LinearLayout mLoadingLayout;
private ImageView mLoading;
public FrameGiftViewHolder(@NonNull View itemView) {
super(itemView);
mContext = itemView.getContext();
giftIcon = itemView.findViewById(R.id.gift_icon);
giftName = itemView.findViewById(R.id.gift_name);
mPayIco = itemView.findViewById(R.id.pay_ico);
mPrice = itemView.findViewById(R.id.price);
cornerMark = itemView.findViewById(R.id.corner_mark);
giftLayout = itemView.findViewById(R.id.gift_layout);
mLoadingLayout = itemView.findViewById(R.id.gift_loading_layout);
mLoading = itemView.findViewById(R.id.gift_loading);
mAnimation = new ScaleAnimation(0.9f, 1.1f, 0.9f, 1.1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
mAnimation.setDuration(400);
mAnimation.setRepeatMode(Animation.REVERSE);
mAnimation.setRepeatCount(-1);
}
public void showData(int contextLayoutGiftHeight, LiveGiftBean model) {
//设置高度
itemView.post(new Runnable() {
@Override
public void run() {
GridLayoutManager.LayoutParams linearParams = (GridLayoutManager.LayoutParams) itemView.getLayoutParams();
linearParams.height = contextLayoutGiftHeight / 2;
itemView.setLayoutParams(linearParams);
}
});
giftLayout.setSelected(model.isChecked());
if (model.isChecked()) {
giftIcon.startAnimation(mAnimation);
}
ImgLoader.display(mContext, model.getIcon(), giftIcon);
ImgLoader.display(mContext, model.getCornerMark(), cornerMark);
giftName.setText(model.getName());
//特殊礼物红包
if (model.getType() == 9999999) {
mPayIco.setVisibility(View.GONE);
mPrice.setText(mContext.getString(R.string.build_up_popularity));
mPrice.setTextColor(Color.parseColor("#db8c4a"));
mPrice.setTextSize(TypedValue.COMPLEX_UNIT_SP, 8);
} else {
mPrice.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11);
mPrice.setTextColor(Color.parseColor("#c8c8c8"));
mPayIco.setVisibility(View.VISIBLE);
//普通礼物
if (model.getSendType() != null && model.getSendType().equals("1")) {
mPayIco.setImageResource(R.mipmap.gold_coin);
} else {
mPayIco.setImageResource(R.mipmap.diamond);
}
mPrice.setText(model.getPrice());
}
if (model.getSwf() != null && model.getSwf().isEmpty()) {
mLoadingLayout.setVisibility(View.GONE);
} else {
mLoadingLayout.setVisibility(GiftCacheUtil.checkGiftIsDownload(model.getId()) ? View.GONE : View.VISIBLE);
}
}
public void giftSelect(LiveGiftBean model, int position, String mStream, String mLiveUid, FrameGiftClickListener frameGiftClickListener) {
ViewClicksAntiShake.clicksAntiShake(mLoadingLayout, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
mLoading.setImageResource(R.mipmap.icon_loading_gift);
Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.anim_loading_gift);
animation.setRepeatMode(Animation.RESTART);
animation.setRepeatCount(Animation.INFINITE);
animation.setInterpolator(new LinearInterpolator());
mLoading.startAnimation(animation);
GiftCacheUtil.getInstance().pause();
GiftCacheUtil.getInstance().downloadGiftForId(mContext, model, new CommonCallback<File>() {
@Override
public void callback(File bean) {
if (bean == null) {
ToastUtil.show(mContext.getString(R.string.load_failure_2));
mLoading.setImageResource(R.mipmap.icon_download_gift);
animation.setRepeatCount(0);
animation.setDuration(0);
animation.cancel();
mLoading.setAnimation(animation);
} else {
mLoadingLayout.setVisibility(View.GONE);
}
GiftCacheUtil.getInstance().restart();
}
});
}
});
ViewClicksAntiShake.clicksAntiShake(giftLayout, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (model.getType() == 9999999) {
Bus.get().post(new LiveGiftDialogEvent());
new XPopup.Builder(mContext)
.asCustom(new SendRendPacketPopup(mContext, mLiveUid))
.show();
} else {
if (frameGiftClickListener != null) {
frameGiftClickListener.onCallBack(position, model);
}
}
}
});
}
public interface FrameGiftClickListener {
void onCallBack(int position, LiveGiftBean model);
}
}

View File

@ -0,0 +1,50 @@
package com.yunbao.live.views;
import android.graphics.Typeface;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.custom.DrawableTextView;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.bean.GiftTopBean;
import com.yunbao.live.event.GiftTitleEvent;
public class GiftTitleViewHolder extends RecyclerView.ViewHolder {
private DrawableTextView name;
public GiftTitleViewHolder(@NonNull View itemView) {
super(itemView);
name = itemView.findViewById(R.id.name);
}
public void showData(GiftTopBean giftTopBean, int mPosition, ClicksCallBack callBack) {
name.setText(giftTopBean.getName());
ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (callBack != null) {
callBack.onViewClicks(mPosition);
Bus.get().post(new GiftTitleEvent().setmPosition(mPosition).setGiftTitle(giftTopBean.getName()));
}
}
});
}
public void selectData(boolean isSelect) {
if (isSelect) {
name.setAlpha(1.0f);
name.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
} else {
name.setAlpha(0.5f);
name.setTypeface(Typeface.SANS_SERIF, Typeface.NORMAL);
}
}
public interface ClicksCallBack {
void onViewClicks(int mPosition);
}
}

View File

@ -10,7 +10,6 @@ import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Vibrator; import android.os.Vibrator;
import android.text.TextUtils;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -20,16 +19,12 @@ import android.view.ViewGroup;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ViewFlipper; import android.widget.ViewFlipper;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import com.opensource.svgaplayer.SVGADrawable; import com.lxj.xpopup.XPopup;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.bean.NewPeopleInfo; import com.yunbao.common.bean.NewPeopleInfo;
@ -39,11 +34,10 @@ import com.yunbao.common.http.API;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.dialog.LiveGiftPopup;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
@ -200,6 +194,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
ViewClicksAntiShake.clicksAntiShake(giftImage, new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(giftImage, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)); .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP));
} }
@ -382,6 +377,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
} else if (i == R.id.btn_gift) { } else if (i == R.id.btn_gift) {
openGiftWindow(); openGiftWindow();
//全屏 //全屏
} else if (i == R.id.btn_more) { } else if (i == R.id.btn_more) {
((LiveActivity) mContext).openMoreWindow(); ((LiveActivity) mContext).openMoreWindow();

View File

@ -0,0 +1,149 @@
package com.yunbao.live.views;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import com.alibaba.fastjson.JSON;
import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.fragment.BaseFragment;
import com.yunbao.live.R;
import com.yunbao.live.adapter.LiveGiftFragmentPagerAdapter;
import java.util.ArrayList;
import java.util.List;
/**
* 礼物列表
*/
public class LiveGiftFragment extends BaseFragment {
private ViewPager fragmentViewpager;
private int pageCount;
private static final int GIFT_COUNT = 8;//每页8个礼物
private RadioGroup mRadioGroup;
private LiveGiftFragmentPagerAdapter giftFragmentPagerAdapter;
private ArrayList<Fragment> ViewList = new ArrayList<>(); //页卡视图集合
private List<LiveGiftBean> giftJson = new ArrayList<>();
private int contextLayoutGiftHeight = 0;
private String mStream, mLiveUid, wishGiftId, type;
private int currentPage = 0;
@Override
public View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) {
return layoutInflater.inflate(R.layout.fragment_live_gift, viewGroup, false);
}
@Override
protected void initVariables(Bundle bundle) {
giftJson = JSON.parseArray(bundle.getString("giftJson"), LiveGiftBean.class);
contextLayoutGiftHeight = bundle.getInt("contextLayoutGiftHeight");
mStream = bundle.getString("mStream");
wishGiftId = bundle.getString("wishGiftId");
mLiveUid = bundle.getString("mLiveUid");
type = bundle.getString("type");
pageCount = giftJson.size() / GIFT_COUNT;
if (giftJson.size() % GIFT_COUNT > 0) {
pageCount++;
}
}
@Override
protected void initViews(Bundle savedInstanceState, View contentView) {
fragmentViewpager = contentView.findViewById(R.id.context_layout);
mRadioGroup = contentView.findViewById(R.id.radio_group);
fragmentViewpager.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
contextLayoutGiftHeight = fragmentViewpager.getHeight();
Log.e("giftJson", "height=" + contextLayoutGiftHeight);
int fromIndex = 0;
int size = giftJson.size();
for (int i = 0; i < pageCount; i++) {
int endIndex = fromIndex + GIFT_COUNT;
if (endIndex > size) {
endIndex = size;
}
List<LiveGiftBean> liveGiftBeans = new ArrayList<>();
for (int j = fromIndex; j < endIndex; j++) {
LiveGiftBean bean = giftJson.get(j);
bean.setPage(i);
liveGiftBeans.add(bean);
if (!TextUtils.isEmpty(wishGiftId) && TextUtils.equals(bean.getId() + "", wishGiftId)) {
currentPage = i;
Log.e("LiveGiftItemFragment", type);
}
}
fromIndex = endIndex;
ViewList.add(LiveGiftItemFragment.newInstance(JSON.toJSONString(liveGiftBeans), contextLayoutGiftHeight, mStream, mLiveUid, wishGiftId));
}
giftFragmentPagerAdapter = new LiveGiftFragmentPagerAdapter(getChildFragmentManager(), getActivity(), ViewList);
fragmentViewpager.setAdapter(giftFragmentPagerAdapter);
LayoutInflater inflater = LayoutInflater.from(getContext());
for (int i = 0, size2 = ViewList.size(); i < size2; i++) {
RadioButton radioButton = (RadioButton) inflater.inflate(R.layout.view_gift_indicator, mRadioGroup, false);
radioButton.setId(i + 10000);
if (i == 0) {
radioButton.setChecked(true);
}
mRadioGroup.addView(radioButton);
}
fragmentViewpager.setCurrentItem(currentPage);
//移除监听
fragmentViewpager.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
fragmentViewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
if (mRadioGroup != null && mRadioGroup.getChildAt(position) != null) {
((RadioButton) mRadioGroup.getChildAt(position)).setChecked(true);
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
@Override
protected void loadData() {
}
public static LiveGiftFragment newInstance(String giftJson, String type,
String mStream, String mLiveUid, String wishGiftId) {
LiveGiftFragment liveGiftFragment = new LiveGiftFragment();
Bundle bundle = new Bundle();
bundle.putString("giftJson", giftJson);
bundle.putString("type", type);
bundle.putString("mStream", mStream);
bundle.putString("mLiveUid", mLiveUid);
bundle.putString("wishGiftId", wishGiftId);
liveGiftFragment.setArguments(bundle);
return liveGiftFragment;
}
}

View File

@ -0,0 +1,82 @@
package com.yunbao.live.views;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.fragment.BaseFragment;
import com.yunbao.common.utils.Bus;
import com.yunbao.live.R;
import com.yunbao.live.adapter.FrameGiftAdapter;
import com.yunbao.live.event.LiveGiftItemEvent;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
public class LiveGiftItemFragment extends BaseFragment {
private List<LiveGiftBean> giftJson = new ArrayList<>();
private RecyclerView frameGiftList;
private int contextLayoutGiftHeight = 0;
private FrameGiftAdapter frameGiftAdapter;
private String mStream, mLiveUid, wishGiftId;
@Override
public View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) {
return layoutInflater.inflate(R.layout.fragment_live_gift_item, viewGroup, false);
}
@Override
protected void initVariables(Bundle bundle) {
giftJson = JSON.parseArray(bundle.getString("giftJson"), LiveGiftBean.class);
contextLayoutGiftHeight = bundle.getInt("contextLayoutGiftHeight");
mStream = bundle.getString("mStream");
mLiveUid = bundle.getString("mLiveUid");
wishGiftId = bundle.getString("wishGiftId");
Log.e("giftJson", giftJson.toString());
}
@Override
protected void initViews(Bundle savedInstanceState, View contentView) {
frameGiftList = contentView.findViewById(R.id.frame_gift_list);
frameGiftList.setHasFixedSize(true);
frameGiftList.setLayoutManager(new GridLayoutManager(getActivity(), 4, GridLayoutManager.VERTICAL, false));
frameGiftAdapter = new FrameGiftAdapter(contextLayoutGiftHeight, giftJson, mStream, mLiveUid, wishGiftId);
frameGiftList.setAdapter(frameGiftAdapter);
}
@Override
protected void loadData() {
}
public static LiveGiftItemFragment newInstance(String giftJson, int contextLayoutGiftHeight,
String mStream, String mLiveUid, String wishGiftId) {
LiveGiftItemFragment liveGiftFragment = new LiveGiftItemFragment();
Bundle bundle = new Bundle();
bundle.putString("giftJson", giftJson);
bundle.putInt("contextLayoutGiftHeight", contextLayoutGiftHeight);
bundle.putString("mStream", mStream);
bundle.putString("mLiveUid", mLiveUid);
bundle.putString("wishGiftId", wishGiftId);
liveGiftFragment.setArguments(bundle);
return liveGiftFragment;
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveGiftItemEvent(LiveGiftItemEvent event) {
frameGiftAdapter.giftSelect(event.getLiveGiftModel());
}
}

View File

@ -0,0 +1,162 @@
package com.yunbao.live.views;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.fragment.BaseFragment;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.GiftCacheUtil;
import com.yunbao.live.R;
import com.yunbao.live.adapter.LiveGiftFragmentPagerAdapter;
import com.yunbao.live.http.LiveHttpUtil;
import java.util.ArrayList;
import java.util.List;
public class LiveParcelFragment extends BaseFragment {
private ViewPager fragmentViewpager;
private int pageCount;
private static final int GIFT_COUNT = 8;//每页8个礼物
private RadioGroup mRadioGroup;
private LiveGiftFragmentPagerAdapter giftFragmentPagerAdapter;
private ArrayList<Fragment> ViewList = new ArrayList<>(); //页卡视图集合
private List<LiveGiftBean> giftJson = new ArrayList<>();
private int contextLayoutGiftHeight = 0;
private String mStream, mLiveUid;
private LinearLayout parcelDataList, parcelDataNo;
@Override
public View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) {
return layoutInflater.inflate(R.layout.fragment_live_parcel, viewGroup, false);
}
@Override
protected void initVariables(Bundle bundle) {
mStream = bundle.getString("mStream");
mLiveUid = bundle.getString("mLiveUid");
}
@Override
protected void initViews(Bundle savedInstanceState, View contentView) {
fragmentViewpager = contentView.findViewById(R.id.context_layout);
mRadioGroup = contentView.findViewById(R.id.radio_group);
parcelDataList = contentView.findViewById(R.id.parcel_data_list);
parcelDataNo = contentView.findViewById(R.id.parcel_data_no);
fragmentViewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
if (mRadioGroup != null && mRadioGroup.getChildAt(position) != null) {
((RadioButton) mRadioGroup.getChildAt(position)).setChecked(true);
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
@Override
protected void loadData() {
LiveHttpUtil.getWrapList(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
JSONObject obj = JSON.parseObject(info[0]);
String giftJson = obj.getString("giftlist");
List<LiveGiftBean> list = JSON.parseArray(giftJson, LiveGiftBean.class);
GiftCacheUtil.getInstance().addDownloadList(list);
if (!GiftCacheUtil.getInstance().isDownloading()) {
GiftCacheUtil.getInstance().downloadAllGift();
}
if (list.size() == 0) {
parcelDataNo.setVisibility(View.VISIBLE);
parcelDataList.setVisibility(View.GONE);
} else {
parcelDataList.setVisibility(View.VISIBLE);
parcelDataNo.setVisibility(View.GONE);
pageCount = list.size() / GIFT_COUNT;
if (list.size() % GIFT_COUNT > 0) {
pageCount++;
}
fragmentViewpager.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
contextLayoutGiftHeight = fragmentViewpager.getHeight();
Log.e("giftJson", "height=" + contextLayoutGiftHeight);
int fromIndex = 0;
int size = list.size();
for (int i = 0; i < pageCount; i++) {
int endIndex = fromIndex + GIFT_COUNT;
if (endIndex > size) {
endIndex = size;
}
List<LiveGiftBean> liveGiftBeans = new ArrayList<>();
for (int j = fromIndex; j < endIndex; j++) {
LiveGiftBean bean = list.get(j);
bean.setPage(i);
liveGiftBeans.add(bean);
}
fromIndex = endIndex;
ViewList.add(LiveParcelItemFragment.newInstance(JSON.toJSONString(liveGiftBeans), contextLayoutGiftHeight, mStream, mLiveUid));
}
giftFragmentPagerAdapter = new LiveGiftFragmentPagerAdapter(getChildFragmentManager(), getActivity(), ViewList);
fragmentViewpager.setAdapter(giftFragmentPagerAdapter);
LayoutInflater inflater = LayoutInflater.from(getContext());
for (int i = 0, size2 = ViewList.size(); i < size2; i++) {
RadioButton radioButton = (RadioButton) inflater.inflate(R.layout.view_gift_indicator, mRadioGroup, false);
radioButton.setId(i + 10000);
if (i == 0) {
radioButton.setChecked(true);
}
mRadioGroup.addView(radioButton);
}
//移除监听
fragmentViewpager.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
}
}
}
@Override
public void onFinish() {
// if (mLoading != null) {
// mLoading.setVisibility(View.INVISIBLE);
// }
}
});
}
public static LiveParcelFragment newInstance(String mStream, String mLiveUid) {
LiveParcelFragment liveParcelFragment = new LiveParcelFragment();
Bundle bundle = new Bundle();
bundle.putString("mStream", mStream);
bundle.putString("mLiveUid", mLiveUid);
liveParcelFragment.setArguments(bundle);
return liveParcelFragment;
}
}

View File

@ -0,0 +1,82 @@
package com.yunbao.live.views;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.fragment.BaseFragment;
import com.yunbao.live.R;
import com.yunbao.live.adapter.LiveParcelItemAdapter;
import com.yunbao.live.event.LiveGiftItemEvent;
import com.yunbao.live.event.LiveParcelItemRefreshEvent;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
public class LiveParcelItemFragment extends BaseFragment {
private List<LiveGiftBean> giftJson = new ArrayList<>();
private RecyclerView frameGiftList;
private int contextLayoutGiftHeight = 0;
private LiveParcelItemAdapter frameGiftAdapter;
private String mStream, mLiveUid;
@Override
public View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) {
return layoutInflater.inflate(R.layout.fragment_live_gift_item, viewGroup, false);
}
@Override
protected void initVariables(Bundle bundle) {
giftJson = JSON.parseArray(bundle.getString("giftJson"), LiveGiftBean.class);
contextLayoutGiftHeight = bundle.getInt("contextLayoutGiftHeight");
mStream = bundle.getString("mStream");
mLiveUid = bundle.getString("mLiveUid");
Log.e("giftJson", giftJson.toString());
}
@Override
protected void initViews(Bundle savedInstanceState, View contentView) {
frameGiftList = contentView.findViewById(R.id.frame_gift_list);
frameGiftList.setHasFixedSize(true);
frameGiftList.setLayoutManager(new GridLayoutManager(getActivity(), 4, GridLayoutManager.VERTICAL, false));
frameGiftAdapter = new LiveParcelItemAdapter(contextLayoutGiftHeight, giftJson, mStream, mLiveUid);
frameGiftList.setAdapter(frameGiftAdapter);
}
@Override
protected void loadData() {
}
public static LiveParcelItemFragment newInstance(String giftJson, int contextLayoutGiftHeight, String mStream, String mLiveUid) {
LiveParcelItemFragment liveGiftFragment = new LiveParcelItemFragment();
Bundle bundle = new Bundle();
bundle.putString("giftJson", giftJson);
bundle.putInt("contextLayoutGiftHeight", contextLayoutGiftHeight);
bundle.putString("mStream", mStream);
bundle.putString("mLiveUid", mLiveUid);
liveGiftFragment.setArguments(bundle);
return liveGiftFragment;
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveGiftItemEvent(LiveGiftItemEvent event) {
frameGiftAdapter.giftSelect(event.getLiveGiftModel());
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveParcelItemRefreshEvent(LiveParcelItemRefreshEvent event) {
frameGiftAdapter.refreshWrapListAfterSend(event.getLiveGiftModel());
}
}

View File

@ -0,0 +1,138 @@
package com.yunbao.live.views;
import android.content.Context;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.view.animation.ScaleAnimation;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
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.bean.LiveGiftBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.GiftCacheUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.dialog.SendRendPacketPopup;
import com.yunbao.live.event.LiveGiftDialogEvent;
import java.io.File;
public class LiveParcelItemViewHolder extends RecyclerView.ViewHolder {
private ImageView giftIcon, cornerMark;
private Context mContext;
private TextView giftName, mPrice, giftNumber;
private RelativeLayout giftLayout;
private ScaleAnimation mAnimation;
private LinearLayout mLoadingLayout;
private ImageView mLoading;
public LiveParcelItemViewHolder(@NonNull View itemView) {
super(itemView);
mContext = itemView.getContext();
giftIcon = itemView.findViewById(R.id.gift_icon);
giftName = itemView.findViewById(R.id.gift_name);
mPrice = itemView.findViewById(R.id.price);
giftLayout = itemView.findViewById(R.id.gift_layout);
giftNumber = itemView.findViewById(R.id.gift_number);
cornerMark = itemView.findViewById(R.id.corner_mark);
mLoadingLayout = itemView.findViewById(R.id.gift_loading_layout);
mLoading = itemView.findViewById(R.id.gift_loading);
mAnimation = new ScaleAnimation(0.9f, 1.1f, 0.9f, 1.1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
mAnimation.setDuration(400);
mAnimation.setRepeatMode(Animation.REVERSE);
mAnimation.setRepeatCount(-1);
}
public void showData(int contextLayoutGiftHeight, LiveGiftBean model) {
//设置高度
itemView.post(new Runnable() {
@Override
public void run() {
GridLayoutManager.LayoutParams linearParams = (GridLayoutManager.LayoutParams) itemView.getLayoutParams();
linearParams.height = contextLayoutGiftHeight / 2;
itemView.setLayoutParams(linearParams);
}
});
giftLayout.setSelected(model.isChecked());
if (model.isChecked()) {
giftIcon.startAnimation(mAnimation);
}
ImgLoader.display(mContext, model.getIcon(), giftIcon);
ImgLoader.display(mContext, model.getCornerMark(), cornerMark);
giftName.setText(model.getName());
mPrice.setText(model.getEnd_time());
giftNumber.setText(model.getGiftNum());
if (model.getSwf() != null && model.getSwf().isEmpty()) {
mLoadingLayout.setVisibility(View.GONE);
} else {
mLoadingLayout.setVisibility(GiftCacheUtil.checkGiftIsDownload(model.getId()) ? View.GONE : View.VISIBLE);
}
}
public void giftSelect(LiveGiftBean model, int position, String mStream, String mLiveUid, FrameGiftClickListener frameGiftClickListener) {
ViewClicksAntiShake.clicksAntiShake(mLoadingLayout, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
mLoading.setImageResource(R.mipmap.icon_loading_gift);
Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.anim_loading_gift);
animation.setRepeatMode(Animation.RESTART);
animation.setRepeatCount(Animation.INFINITE);
animation.setInterpolator(new LinearInterpolator());
mLoading.startAnimation(animation);
GiftCacheUtil.getInstance().pause();
GiftCacheUtil.getInstance().downloadGiftForId(mContext, model, new CommonCallback<File>() {
@Override
public void callback(File bean) {
if (bean == null) {
ToastUtil.show(mContext.getString(R.string.load_failure_2));
mLoading.setImageResource(R.mipmap.icon_download_gift);
animation.setRepeatCount(0);
animation.setDuration(0);
animation.cancel();
mLoading.setAnimation(animation);
} else {
mLoadingLayout.setVisibility(View.GONE);
}
GiftCacheUtil.getInstance().restart();
}
});
}
});
ViewClicksAntiShake.clicksAntiShake(giftLayout, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (model.getType() == 9999999) {
Bus.get().post(new LiveGiftDialogEvent());
new XPopup.Builder(mContext)
.asCustom(new SendRendPacketPopup(mContext, mLiveUid))
.show();
} else {
if (frameGiftClickListener != null) {
frameGiftClickListener.onCallBack(position, model);
}
}
}
});
}
public interface FrameGiftClickListener {
void onCallBack(int position, LiveGiftBean model);
}
}

View File

@ -150,7 +150,6 @@ import com.yunbao.live.custom.TopGradual;
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment; import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
import com.yunbao.live.dialog.LiveFansMedalDialogFragment; import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
import com.yunbao.live.dialog.LiveGameDialogFragment; import com.yunbao.live.dialog.LiveGameDialogFragment;
import com.yunbao.live.dialog.LiveGiftDialogFragment;
import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog; import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog;
import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveUserDialogFragment;
@ -5069,23 +5068,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override @Override
public void onSuccess(LiveAnchorCallMeModel data) { public void onSuccess(LiveAnchorCallMeModel data) {
if (data.getIsGet() == 1) { loading.dismiss();
new LiveUserAnchorMailBoxWebInfoPopDialog(mContext, mAnchorName, data.getLink()) Bus.get().post(new LiveAudienceEvent()
.setOnDismissListener(dialog -> loading.dismiss()) .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
.showDialog(); .setmLiveUid(mLiveUid)
return; .setmStream(mStream)
} .setmWishGiftId(data.getGiftId() + "")
LiveGiftDialogFragment fragment = new LiveGiftDialogFragment(); .setIsContactGift(true));
fragment.setOnDismissListener(dialog -> checkNewLetter()
);
fragment.setOnShowListener(dialog -> mHandler.postDelayed(loading::dismiss, 500));
Bundle bundle = new Bundle();
bundle.putString(Constants.LIVE_UID, mLiveUid);
bundle.putString(Constants.LIVE_STREAM, mStream);
bundle.putString(Constants.LIVE_WISH_GIFTID, data.getGiftId() + "");
bundle.putBoolean("isContactGift", true);
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
} }
@Override @Override
@ -5147,23 +5136,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override @Override
public void onSuccess(LiveAnchorCallMeModel data) { public void onSuccess(LiveAnchorCallMeModel data) {
if (data.getIsGet() == 1) { loading.dismiss();
new LiveUserAnchorMailBoxWebInfoPopDialog(mContext, mAnchorName, data.getLink())
.setOnDismissListener(dialog -> loading.dismiss()) Bus.get().post(new LiveAudienceEvent()
.showDialog(); .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
return; .setmLiveUid(mLiveUid)
} .setmStream(mStream)
LiveGiftDialogFragment fragment = new LiveGiftDialogFragment(); .setmWishGiftId(data.getGiftId() + "")
fragment.setOnDismissListener(dialog -> checkNewLetter() .setIsContactGift(true));
);
fragment.setOnShowListener(dialog -> mHandler.postDelayed(loading::dismiss, 500));
Bundle bundle = new Bundle();
bundle.putString(Constants.LIVE_UID, mLiveUid);
bundle.putString(Constants.LIVE_STREAM, mStream);
bundle.putString(Constants.LIVE_WISH_GIFTID, data.getGiftId() + "");
bundle.putBoolean("isContactGift", true);
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
} }
@Override @Override

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="#e6272C42" />
<stroke android:width="0.6dp" android:color="#AEAEB2" />
</shape>
</item>
<item android:state_selected="false">
<shape android:shape="rectangle"></shape>
</item>
</selector>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.viewpager.widget.ViewPager
android:id="@+id/context_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="1" />
<RadioGroup
android:id="@+id/radio_group"
android:layout_width="wrap_content"
android:layout_height="6dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginTop="7dp"
android:layout_marginBottom="9dp"
android:orientation="horizontal" />
</LinearLayout>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/frame_gift_list"
android:layout_width="match_parent"
android:overScrollMode="never"
android:layout_height="match_parent" />
</LinearLayout>

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/parcel_data_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone">
<androidx.viewpager.widget.ViewPager
android:id="@+id/context_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="1" />
<RadioGroup
android:id="@+id/radio_group"
android:layout_width="wrap_content"
android:layout_height="6dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginTop="7dp"
android:layout_marginBottom="9dp"
android:orientation="horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/parcel_data_no"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="112dp"
android:layout_height="90dp"
android:src="@mipmap/icon_empty_parcel" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/nothing_in_the_package_yet"
android:textColor="#717375"
android:textSize="12sp" />
</LinearLayout>
</FrameLayout>

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gift_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_gift_select"
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/gift_icon"
android:layout_width="55dp"
android:layout_height="55dp" />
<TextView
android:id="@+id/gift_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:textColor="@color/white"
android:textSize="11sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/pay_ico"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginEnd="2dp" />
<TextView
android:id="@+id/price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="10sp" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/corner_mark"
android:layout_width="wrap_content"
android:layout_height="11dp"
android:layout_gravity="end"
android:layout_marginEnd="2dp" />
</FrameLayout>
<LinearLayout
android:id="@+id/gift_loading_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#C0000000"
android:gravity="center"
android:visibility="visible">
<ImageView
android:id="@+id/gift_loading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="30dp"
android:src="@mipmap/icon_download_gift" />
</LinearLayout>
</RelativeLayout>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<com.yunbao.common.custom.DrawableTextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:gravity="center_vertical"
android:text="@string/live_wrap"
android:textStyle="bold"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gift_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_gift_select"
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="55dp">
<ImageView
android:id="@+id/gift_icon"
android:layout_width="55dp"
android:layout_height="55dp" />
<TextView
android:id="@+id/gift_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:background="@drawable/bg_parcel_point"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:text="11"
android:textColor="@color/white"
android:textSize="8sp" />
</RelativeLayout>
<TextView
android:id="@+id/gift_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:textColor="@color/white"
android:textSize="11sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/pay_ico"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginEnd="2dp"
android:visibility="gone" />
<TextView
android:id="@+id/price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="10sp" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/corner_mark"
android:layout_width="wrap_content"
android:layout_height="11dp"
android:layout_gravity="end"
android:layout_marginEnd="2dp" />
</FrameLayout>
<LinearLayout
android:id="@+id/gift_loading_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#C0000000"
android:gravity="center"
android:visibility="visible">
<ImageView
android:id="@+id/gift_loading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="30dp"
android:src="@mipmap/icon_download_gift" />
</LinearLayout>
</RelativeLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 357 B