diff --git a/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java
index 82bf6df02..b51026f63 100644
--- a/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java
+++ b/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java
@@ -45,7 +45,6 @@ public class SudTitleSelectAdapter extends RecyclerView.Adapter {
}
}
});
-
}
@Override
diff --git a/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java b/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java
new file mode 100644
index 000000000..cf707a69f
--- /dev/null
+++ b/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java
@@ -0,0 +1,57 @@
+package com.yunbao.common.dialog;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.Context;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.TextView;
+
+import com.yunbao.common.R;
+import com.yunbao.common.utils.DialogUitl;
+
+public class GuardBuyTipsDialog {
+
+ /**
+ *
+ * @param context
+ * @param coin 钻石
+ * @param content 购买类型名称
+ * @param simpleCallback
+ */
+ public static void showBuyOrRenewDialog(Context context, String coin, String content, DialogUitl.SimpleCallback simpleCallback) {
+ if (context instanceof Activity) {
+ if (((Activity) context).isDestroyed() || ((Activity) context).isFinishing()) {
+ return;
+ }
+ }
+
+ final Dialog dialog = new Dialog(context, R.style.dialog2);
+ dialog.setContentView(R.layout.dialog_guard_buy_tips);
+ dialog.setCancelable(true);
+ dialog.setCanceledOnTouchOutside(true);
+ if (!TextUtils.isEmpty(coin)) {
+ TextView contentTextView = dialog.findViewById(R.id.content);
+ contentTextView.setText(context.getString(R.string.guard_buy_tips_1, coin));
+ }
+ if (!TextUtils.isEmpty(content)) {
+ TextView buyTypeTextView = dialog.findViewById(R.id.buyType);
+ buyTypeTextView.setText(content);
+ }
+ dialog.findViewById(R.id.btn_cancel).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ dialog.dismiss();
+ }
+ });
+ dialog.findViewById(R.id.btn_confirm).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ simpleCallback.onConfirmClick(dialog, "");
+ dialog.dismiss();
+ }
+ });
+ dialog.show();
+ }
+
+}
diff --git a/common/src/main/res/drawable/guard_buy_tips_bg.xml b/common/src/main/res/drawable/guard_buy_tips_bg.xml
new file mode 100644
index 000000000..66300b845
--- /dev/null
+++ b/common/src/main/res/drawable/guard_buy_tips_bg.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/common/src/main/res/drawable/guard_buy_tips_sure_bg.xml b/common/src/main/res/drawable/guard_buy_tips_sure_bg.xml
new file mode 100644
index 000000000..bafb39e8f
--- /dev/null
+++ b/common/src/main/res/drawable/guard_buy_tips_sure_bg.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/common/src/main/res/layout/dialog_guard_buy_tips.xml b/common/src/main/res/layout/dialog_guard_buy_tips.xml
new file mode 100644
index 000000000..e8c8ac40b
--- /dev/null
+++ b/common/src/main/res/layout/dialog_guard_buy_tips.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/res/mipmap-mdpi/icon_guard_buy_tips_close.png b/common/src/main/res/mipmap-mdpi/icon_guard_buy_tips_close.png
new file mode 100644
index 000000000..922738cf1
Binary files /dev/null and b/common/src/main/res/mipmap-mdpi/icon_guard_buy_tips_close.png differ
diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml
index b98e1dc22..90291a0e7 100644
--- a/common/src/main/res/values-en-rUS/string.xml
+++ b/common/src/main/res/values-en-rUS/string.xml
@@ -1450,4 +1450,8 @@ Limited ride And limited avatar frame
Are you sure to return?
Sure
+
+ 您將花費%s鑽石,為主播開通
+
+ 【星之守护】
diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml
index 2c04fb7e0..8e1ddf581 100644
--- a/common/src/main/res/values-zh-rHK/strings.xml
+++ b/common/src/main/res/values-zh-rHK/strings.xml
@@ -1449,4 +1449,8 @@
是否確認返回?
確定
+
+ 您將花費%s鑽石,為主播開通
+
+ 【星之守护】
diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml
index 6698c9652..3de1b90ae 100644
--- a/common/src/main/res/values-zh-rTW/strings.xml
+++ b/common/src/main/res/values-zh-rTW/strings.xml
@@ -1449,4 +1449,8 @@
確定
+ 您將花費%s鑽石,為主播開通
+
+ 【星之守护】
+
diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml
index 894b5492a..db88be30e 100644
--- a/common/src/main/res/values-zh/strings.xml
+++ b/common/src/main/res/values-zh/strings.xml
@@ -1446,4 +1446,8 @@
確定
+ 您將花費%s鑽石,為主播開通
+
+ 【星之守护】
+
diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml
index 015c07bf9..45b7f1cb1 100644
--- a/common/src/main/res/values/strings.xml
+++ b/common/src/main/res/values/strings.xml
@@ -1455,4 +1455,8 @@ Limited ride And limited avatar frame
Sure
+ 您將花費%s鑽石,為主播開通
+
+ 【星之守护】
+
diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java
index 791dd1829..24760589f 100644
--- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java
+++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java
@@ -69,6 +69,7 @@ import com.yunbao.live.dialog.LiveInputDialogFragment;
import com.yunbao.live.dialog.LiveMicAnchorDialogFragment;
import com.yunbao.live.dialog.LiveMoreDialogFragment;
import com.yunbao.live.dialog.LiveNewGuardBuyDialogFragment;
+import com.yunbao.live.dialog.LiveNewGuardDialogFragment;
import com.yunbao.live.dialog.LiveNewGuardListDialogFragment;
import com.yunbao.live.dialog.LiveRedPackListDialogFragment;
import com.yunbao.live.dialog.LiveRedPackSendDialogFragment;
@@ -1272,7 +1273,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
if (list.isEmpty()) {
openNewBuyGuardWindow(true);
} else {
- LiveNewGuardListDialogFragment fragment = new LiveNewGuardListDialogFragment();
+ LiveNewGuardDialogFragment fragment = new LiveNewGuardDialogFragment();
fragment.setList(list);
fragment.setLiveGuardInfo(mLiveGuardInfo);
Bundle bundle = new Bundle();
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardDialogFragment.java
new file mode 100644
index 000000000..936906683
--- /dev/null
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardDialogFragment.java
@@ -0,0 +1,239 @@
+package com.yunbao.live.dialog;
+
+import android.app.Dialog;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.view.Gravity;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.constraintlayout.widget.ConstraintLayout;
+import androidx.fragment.app.FragmentTransaction;
+import androidx.recyclerview.widget.LinearLayoutManager;
+
+import com.alibaba.fastjson.JSON;
+import com.opensource.svgaplayer.SVGAImageView;
+import com.yunbao.common.Constants;
+import com.yunbao.common.adapter.RefreshAdapter;
+import com.yunbao.common.custom.CommonRefreshView;
+import com.yunbao.common.dialog.AbsDialogFragment;
+import com.yunbao.common.dialog.GuardBuyTipsDialog;
+import com.yunbao.common.glide.ImgLoader;
+import com.yunbao.common.http.HttpCallback;
+import com.yunbao.common.http.LiveHttpUtil;
+import com.yunbao.common.utils.CommonIconUtil;
+import com.yunbao.common.utils.DialogUitl;
+import com.yunbao.common.utils.ToastUtil;
+import com.yunbao.common.utils.ToastUtils;
+import com.yunbao.live.R;
+import com.yunbao.live.activity.LiveActivity;
+import com.yunbao.live.adapter.GuardAdapter;
+import com.yunbao.live.bean.GuardUserBean;
+import com.yunbao.live.bean.LiveGuardInfo;
+import com.yunbao.live.utils.LiveTextRender;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 新版守护列表
+ * 2024/02/22
+ */
+public class LiveNewGuardDialogFragment extends AbsDialogFragment implements View.OnClickListener {
+ private ImageView guardIcon, userSex, userLevel;
+ private ConstraintLayout mRootLayout;
+ private CommonRefreshView mRefreshView;
+ private TextView mBtnBuy, userName, userGuard, tip1, tip2;
+ private SVGAImageView giftSvga;
+ private LinearLayout userLayout;
+
+ private GuardAdapter mGuardAdapter;
+ private LiveGuardInfo mLiveGuardInfo;
+ private String mLiveUid;
+ private boolean mIsAnchor;//是否是主播
+ private boolean showBuyView;
+ private List list = new ArrayList<>();
+ private RelativeLayout relativeLayout;
+
+ @Override
+ protected int getLayoutId() {
+ return R.layout.dialog_new_guard;
+ }
+
+ @Override
+ protected int getDialogStyle() {
+ return R.style.dialog2;
+ }
+
+ @Override
+ protected boolean canCancel() {
+ return true;
+ }
+
+ public void setLiveGuardInfo(LiveGuardInfo info) {
+ mLiveGuardInfo = info;
+ }
+
+ @Override
+ protected void setWindowAttributes(Window window) {
+ window.setWindowAnimations(R.style.bottomToTopAnim);
+ WindowManager.LayoutParams params = window.getAttributes();
+ params.width = WindowManager.LayoutParams.MATCH_PARENT;
+ params.height = WindowManager.LayoutParams.WRAP_CONTENT;
+ params.gravity = Gravity.BOTTOM;
+ window.setAttributes(params);
+ }
+
+ @Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ Bundle bundle = getArguments();
+ if (bundle == null) {
+ return;
+ }
+ mIsAnchor = bundle.getBoolean(Constants.ANCHOR, false);
+ mLiveUid = bundle.getString(Constants.LIVE_UID);
+ showBuyView = bundle.getBoolean("showBuyView", true);
+ guardIcon = mRootView.findViewById(R.id.guard_imageView);
+ mRootLayout = mRootView.findViewById(R.id.guard_constraintLayout);
+ mBtnBuy = mRootView.findViewById(R.id.guard_btn_buy);
+ giftSvga = mRootView.findViewById(R.id.gift_svga);
+ mRefreshView = mRootView.findViewById(R.id.refreshView);
+ userName = mRootView.findViewById(R.id.list_guard_list_user_name);
+ userGuard = mRootView.findViewById(R.id.list_guard_list_user_guard);
+ userLevel = mRootView.findViewById(R.id.list_guard_list_user_level);
+ userSex = mRootView.findViewById(R.id.list_guard_list_user_sex);
+ userLayout = mRootView.findViewById(R.id.guard_linearLayout);
+ tip1 = mRootView.findViewById(R.id.guard_tip1);
+ tip2 = mRootView.findViewById(R.id.guard_tip2);
+ relativeLayout = mRootView.findViewById(R.id.guard_relativeLayout);
+ mBtnBuy.setOnClickListener(this);
+ mBtnBuy.setEnabled(true);
+ mBtnBuy.setText(R.string.guard_buy_2);
+ initView();
+ }
+
+ private void initView() {
+ mRefreshView.setEmptyLayoutId(mIsAnchor ? R.layout.view_no_data_guard_anc : R.layout.view_no_data_guard_aud);
+ mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
+ mGuardAdapter = new GuardAdapter(mContext, true, false);
+ mGuardAdapter.setList(list);
+ setAdapterData();
+ mRefreshView.setDataHelper(new CommonRefreshView.DataHelper() {
+ @Override
+ public RefreshAdapter getAdapter() {
+ if (mGuardAdapter == null) {
+ mGuardAdapter = new GuardAdapter(mContext, true, false);
+ }
+ return mGuardAdapter;
+ }
+
+ @Override
+ public void loadData(int p, HttpCallback callback) {
+ LiveHttpUtil.getGuardList(mLiveUid, p, callback);
+ }
+
+ @Override
+ public List processData(String[] info) {
+ List list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class);
+ if (!list.isEmpty()) {
+ LiveNewGuardDialogFragment.this.list = list;
+ setAdapterData();
+ }
+ return list;
+ }
+
+ @Override
+ public void onRefreshSuccess(List list, int listCount) {
+
+ }
+
+ @Override
+ public void onRefreshFailure() {
+
+ }
+
+ @Override
+ public void onLoadMoreSuccess(List loadItemList, int loadItemCount) {
+
+ }
+
+ @Override
+ public void onLoadMoreFailure() {
+
+ }
+ });
+ mRefreshView.setRecyclerViewAdapter(mGuardAdapter);
+ mGuardAdapter.notifyDataSetChanged();
+ if (!showBuyView) {
+ relativeLayout.setVisibility(View.GONE);
+ }
+ }
+
+ @Override
+ public void onClick(View view) {
+ dismiss();
+ ((LiveActivity) mContext).openNewBuyGuardWindow(list.isEmpty());
+ }
+
+ @Override
+ public int show(@NonNull FragmentTransaction transaction, @Nullable String tag) {
+ int show = super.show(transaction, tag);
+ initView();
+ return show;
+ }
+
+ private void setAdapterData() {
+ if (list.isEmpty()) {
+ userLayout.setVisibility(View.INVISIBLE);
+ } else {
+ GuardUserBean bean = list.get(0);
+ giftSvga.setImageResource(R.mipmap.guardian_img_wings_p);
+ ImgLoader.display(mContext, bean.getAvatar(), guardIcon);
+ guardIcon.setVisibility(View.VISIBLE);
+ userName.setText(bean.getUserNiceName());
+ String guardString = mContext.getString(R.string.guard_week_con);
+ userGuard.setText(guardString + " " + bean.getContribute());
+ userSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
+
+ new LiveTextRender().getLevelImage(mContext, bean.getLevel(), new ImgLoader.DrawableCallback() {
+ @Override
+ public void onLoadSuccess(Drawable drawable) {
+ ImgLoader.display2(mContext, drawable, userLevel);
+ }
+
+ @Override
+ public void onLoadFailed() {
+
+ }
+ });
+ }
+ if (mLiveGuardInfo != null) {
+ int guardType = mLiveGuardInfo.getMyGuardType();
+ if (guardType == Constants.GUARD_TYPE_NONE) {
+ tip1.setText(R.string.guard_tip_0);
+ } else if (guardType == Constants.GUARD_TYPE_DAY) {
+ tip1.setText(mContext.getString(R.string.guard_tip_day) + mLiveGuardInfo.getMyGuardEndTime());
+ mBtnBuy.setText(R.string.guard_buy_3);
+ } else if (guardType == Constants.GUARD_TYPE_MONTH) {
+ tip1.setText(mContext.getString(R.string.guard_tip_1) + mLiveGuardInfo.getMyGuardEndTime());
+ mBtnBuy.setText(R.string.guard_buy_3);
+ } else if (guardType == Constants.GUARD_TYPE_YEAR) {
+ tip1.setText(mContext.getString(R.string.guard_tip_2) + mLiveGuardInfo.getMyGuardEndTime());
+ mBtnBuy.setText(R.string.guard_buy_3);
+ }
+ }
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ }
+}
diff --git a/live/src/main/res/drawable/guard_buy_bottom_bg.xml b/live/src/main/res/drawable/guard_buy_bottom_bg.xml
new file mode 100644
index 000000000..04bb75341
--- /dev/null
+++ b/live/src/main/res/drawable/guard_buy_bottom_bg.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/drawable/guard_buy_center_bg.xml b/live/src/main/res/drawable/guard_buy_center_bg.xml
new file mode 100644
index 000000000..5fd926d13
--- /dev/null
+++ b/live/src/main/res/drawable/guard_buy_center_bg.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/live/src/main/res/drawable/guard_buy_top_bg.xml b/live/src/main/res/drawable/guard_buy_top_bg.xml
new file mode 100644
index 000000000..7b46e52b4
--- /dev/null
+++ b/live/src/main/res/drawable/guard_buy_top_bg.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/live/src/main/res/layout/dialog_new_guard.xml b/live/src/main/res/layout/dialog_new_guard.xml
new file mode 100644
index 000000000..6130d180e
--- /dev/null
+++ b/live/src/main/res/layout/dialog_new_guard.xml
@@ -0,0 +1,213 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/layout/view_no_data_guard_anc.xml b/live/src/main/res/layout/view_no_data_guard_anc.xml
index 717fa1fca..f201d3b8b 100644
--- a/live/src/main/res/layout/view_no_data_guard_anc.xml
+++ b/live/src/main/res/layout/view_no_data_guard_anc.xml
@@ -1,28 +1,30 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/live/src/main/res/layout/view_no_data_guard_aud.xml b/live/src/main/res/layout/view_no_data_guard_aud.xml
index 5d30d73e1..b4047b1cb 100644
--- a/live/src/main/res/layout/view_no_data_guard_aud.xml
+++ b/live/src/main/res/layout/view_no_data_guard_aud.xml
@@ -1,28 +1,30 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/live/src/main/res/mipmap-mdpi/icon_guard_top_11.png b/live/src/main/res/mipmap-mdpi/icon_guard_top_11.png
new file mode 100644
index 000000000..741c0faba
Binary files /dev/null and b/live/src/main/res/mipmap-mdpi/icon_guard_top_11.png differ
diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java
index 776f08d8f..51e824c99 100644
--- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java
@@ -819,6 +819,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
}
}
});
+ new XPopup.Builder(mContext).isDestroyOnDismiss(true).dismissOnBackPressed(false) // 按返回键是否关闭弹窗,默认为true
+ .dismissOnTouchOutside(false) // 点击外部是否关闭弹窗,默认为true
+ .asCustom(new APKUpdateCustomPopup(mContext, false)).show();
}
/**