守护团新增红点

This commit is contained in:
18401019693 2024-03-22 14:53:33 +08:00
parent 61a966ea41
commit f94b3f27e3
12 changed files with 155 additions and 32 deletions

View File

@ -62,7 +62,24 @@ public class IMLoginManager extends BaseCacheManager {
public boolean getRedPoint() { public boolean getRedPoint() {
return !TextUtils.isEmpty(getString("RedPoint")) || !TextUtils.equals(getString("RedPoint"), "1"); return !TextUtils.isEmpty(getString("RedPoint")) || !TextUtils.equals(getString("RedPoint"), "1");
} }
public void setQuickGiftIfFirst() {
public void setGuardRedPoint() {
put("GuardRedPoint", "1");
}
public boolean getGuardRedPoint() {
String GuardRedPoint = getString("GuardRedPoint");
if (TextUtils.isEmpty(GuardRedPoint)) {
return true;
}
if (!TextUtils.equals(GuardRedPoint, "1")) {
return true;
}
return false;
}
public void setQuickGiftIfFirst() {
put("quick_gift_if_first", "1"); put("quick_gift_if_first", "1");
} }
@ -511,7 +528,8 @@ public class IMLoginManager extends BaseCacheManager {
} }
}); });
} }
public void updateUserCoin(){
public void updateUserCoin() {
HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance") HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance")
.execute(new HttpCallback() { .execute(new HttpCallback() {
@Override @Override
@ -528,14 +546,15 @@ public class IMLoginManager extends BaseCacheManager {
} }
}); });
} }
public void updateUserCoin(OnItemClickListener<JSONObject> listener){
public void updateUserCoin(OnItemClickListener<JSONObject> listener) {
HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance") HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance")
.execute(new HttpCallback() { .execute(new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0) { if (code == 0) {
JSONObject obj = JSONObject.parseObject(info[0]); JSONObject obj = JSONObject.parseObject(info[0]);
listener.onItemClick(obj,0); listener.onItemClick(obj, 0);
String golds = obj.getString("gold"); String golds = obj.getString("gold");
String coins = obj.getString("coin"); String coins = obj.getString("coin");
String yuanbaos = obj.getString("yuanbao"); String yuanbaos = obj.getString("yuanbao");

View File

@ -9,7 +9,6 @@ import android.app.Dialog;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.webkit.JavascriptInterface; import android.webkit.JavascriptInterface;
@ -378,6 +377,13 @@ public class JavascriptInterfaceUtils {
RouteUtil.forwardZhuangBanActivity(url); RouteUtil.forwardZhuangBanActivity(url);
} }
@JavascriptInterface
public void openWebViewNew(String url) {
Bus.get().post(new JavascriptInterfaceEvent().setMethod("openWebView").setData(url));
Constants.isTitle = false;
RouteUtil.forwardZhuangBanActivity(CommonAppConfig.HOST + url);
}
@JavascriptInterface @JavascriptInterface
public void openWebViewTitle(String url) { public void openWebViewTitle(String url) {
Constants.isTitle = true; Constants.isTitle = true;
@ -694,10 +700,11 @@ public class JavascriptInterfaceUtils {
public void androidtoCommunityVideo() { public void androidtoCommunityVideo() {
RouteUtil.forwardCommunityActivity(); RouteUtil.forwardCommunityActivity();
} }
@JavascriptInterface @JavascriptInterface
public void getRewards(String checkUpgradesJson){ public void getRewards(String checkUpgradesJson) {
try { try {
CheckUpgradesModel upgradesModel = new Gson().fromJson(checkUpgradesJson,CheckUpgradesModel.class); CheckUpgradesModel upgradesModel = new Gson().fromJson(checkUpgradesJson, CheckUpgradesModel.class);
if (!TextUtils.isEmpty(upgradesModel.getLevel())) if (!TextUtils.isEmpty(upgradesModel.getLevel()))
new XPopup.Builder(mWebView.getContext()) new XPopup.Builder(mWebView.getContext())
.asCustom(new GuardUpgradePopup(mWebView.getContext(), "", upgradesModel)) .asCustom(new GuardUpgradePopup(mWebView.getContext(), "", upgradesModel))

View File

@ -22,11 +22,13 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake;
public class FunGamesChildViewHolder extends RecyclerView.ViewHolder { public class FunGamesChildViewHolder extends RecyclerView.ViewHolder {
private ImageView funGamePic; private ImageView funGamePic;
private TextView funGameName; private TextView funGameName;
private View total_image_red_point;
public FunGamesChildViewHolder(@NonNull View itemView) { public FunGamesChildViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
funGamePic = itemView.findViewById(R.id.fun_game_pic); funGamePic = itemView.findViewById(R.id.fun_game_pic);
funGameName = itemView.findViewById(R.id.fun_game_name); funGameName = itemView.findViewById(R.id.fun_game_name);
total_image_red_point = itemView.findViewById(R.id.total_image_red_point);
} }
public void setData(CustomSidebarChildModel model, boolean rigts) { public void setData(CustomSidebarChildModel model, boolean rigts) {
@ -38,7 +40,11 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder {
funGameName.setText(model.getTitle()); funGameName.setText(model.getTitle());
if (TextUtils.equals(model.getTitle(), WordUtil.getNewString(com.yunbao.common.R.string.guard_guard)) && IMLoginManager.get(itemView.getContext()).getGuardRedPoint()) {
total_image_red_point.setVisibility(View.VISIBLE);
} else {
total_image_red_point.setVisibility(View.GONE);
}
ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
@ -59,7 +65,7 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder {
.append("&uid=") .append("&uid=")
.append(userInfo.getId()) .append(userInfo.getId())
.append("&token=") .append("&token=")
.append(userInfo.getToken()) .append("&isZh=") .append(userInfo.getToken()).append("&isZh=")
.append(WordUtil.isNewZh() ? "1" : 0); .append(WordUtil.isNewZh() ? "1" : 0);
} else { } else {
htmlUrl.append(CommonAppConfig.HOST) htmlUrl.append(CommonAppConfig.HOST)
@ -68,7 +74,7 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder {
.append("?uid=") .append("?uid=")
.append(userInfo.getId()) .append(userInfo.getId())
.append("&token=") .append("&token=")
.append(userInfo.getToken()) .append("&isZh=") .append(userInfo.getToken()).append("&isZh=")
.append(WordUtil.isNewZh() ? "1" : 0); .append(WordUtil.isNewZh() ? "1" : 0);
} }
Bus.get().post(new CustomDrawerPopupEvent() Bus.get().post(new CustomDrawerPopupEvent()

View File

@ -26,13 +26,14 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder {
private TextView funGameName; private TextView funGameName;
private View red_point; private View red_point;
private boolean showRed = false; private boolean showRed = false;
private View total_image_red_point;
public NewRoleFunGamesChildViewHolder(@NonNull View itemView, boolean showRed) { public NewRoleFunGamesChildViewHolder(@NonNull View itemView, boolean showRed) {
super(itemView); super(itemView);
this.showRed = showRed; this.showRed = showRed;
funGamePic = itemView.findViewById(R.id.fun_game_pic); funGamePic = itemView.findViewById(R.id.fun_game_pic);
funGameName = itemView.findViewById(R.id.fun_game_name); funGameName = itemView.findViewById(R.id.fun_game_name);
red_point = itemView.findViewById(R.id.red_point); red_point = itemView.findViewById(R.id.red_point);
total_image_red_point = itemView.findViewById(R.id.total_image_red_point);
} }
public void setData(CustomSidebarChildModel model, boolean rigts) { public void setData(CustomSidebarChildModel model, boolean rigts) {
@ -49,7 +50,11 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder {
} }
funGameName.setText(model.getTitle()); funGameName.setText(model.getTitle());
if (TextUtils.equals(model.getTitle(), WordUtil.getNewString(com.yunbao.common.R.string.guard_guard)) && IMLoginManager.get(itemView.getContext()).getGuardRedPoint()) {
total_image_red_point.setVisibility(View.VISIBLE);
} else {
total_image_red_point.setVisibility(View.GONE);
}
ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {

View File

@ -1,16 +1,37 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<ImageView
android:id="@+id/fun_game_pic" <RelativeLayout
android:layout_width="38dp" android:layout_width="40dp"
android:layout_height="38dp"
android:src="@mipmap/live_more_icon_guard" /> android:layout_height="40dp">
<!--普通工具合集-->
<ImageView
android:id="@+id/fun_game_pic"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/live_more_icon_guard" />
<View
android:id="@+id/total_image_red_point"
android:layout_width="6dp"
android:layout_height="6dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="3dp"
android:layout_marginEnd="5dp"
android:background="@drawable/bg_red_point"
tools:visibility="visible" />
</RelativeLayout>
<TextView <TextView
android:id="@+id/fun_game_name" android:id="@+id/fun_game_name"

View File

@ -13,11 +13,32 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<ImageView
android:id="@+id/fun_game_pic" <RelativeLayout
android:layout_width="48dp" android:layout_width="50dp"
android:layout_height="48dp"
android:src="@mipmap/live_more_icon_guard" /> android:layout_height="50dp">
<!--普通工具合集-->
<ImageView
android:id="@+id/fun_game_pic"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/live_more_icon_guard" />
<View
android:id="@+id/total_image_red_point"
android:layout_width="6dp"
android:layout_height="6dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="3dp"
android:layout_marginEnd="5dp"
android:background="@drawable/bg_red_point"
tools:visibility="visible" />
</RelativeLayout>
<View <View
android:id="@+id/red_point" android:id="@+id/red_point"

View File

@ -962,6 +962,8 @@ public class LiveAudienceActivity extends LiveActivity {
} else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.guard_guard))) { } else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.guard_guard))) {
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GUARD)); .setType(LiveAudienceEvent.LiveAudienceType.GUARD));
manager.onGuardRed();
//跳转粉丝团 //跳转粉丝团
} else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.fan_club))) { } else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.fan_club))) {
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
@ -1850,6 +1852,7 @@ public class LiveAudienceActivity extends LiveActivity {
} else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.guard_guard))) { } else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.guard_guard))) {
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GUARD)); .setType(LiveAudienceEvent.LiveAudienceType.GUARD));
manager.onGuardRed();
//跳转粉丝团 //跳转粉丝团
} else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.fan_club))) { } else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.fan_club))) {
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
@ -1898,7 +1901,7 @@ public class LiveAudienceActivity extends LiveActivity {
if (isShow) { if (isShow) {
manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.VISIBLE); manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.VISIBLE);
} else { } else {
if (IMLoginManager.get(mContext).getRedPoint()) { if (IMLoginManager.get(mContext).getRedPoint() || IMLoginManager.get(mContext).getGuardRedPoint()) {
manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.VISIBLE); manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.VISIBLE);
} else { } else {
manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.GONE); manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.GONE);
@ -1926,7 +1929,7 @@ public class LiveAudienceActivity extends LiveActivity {
@Override @Override
public void run() { public void run() {
new XPopup.Builder(mContext) new XPopup.Builder(mContext)
.asCustom(new DragonExpirePopup(mContext, mLiveUid, maturityDateRemindModel,mStream)) .asCustom(new DragonExpirePopup(mContext, mLiveUid, maturityDateRemindModel, mStream))
.show(); .show();
} }
}, 3000); }, 3000);

View File

@ -115,6 +115,7 @@ public class LiveGuardDialog extends AbsDialogPopupWindow {
guardIcon = findViewById(R.id.guard_imageView); guardIcon = findViewById(R.id.guard_imageView);
giftSvga = findViewById(R.id.gift_svga); giftSvga = findViewById(R.id.gift_svga);
btnGuardOpen = findViewById(R.id.btn_guard_open); btnGuardOpen = findViewById(R.id.btn_guard_open);
IMLoginManager.get(mContext).setGuardRedPoint();
if (WordUtil.isNewZh()) { if (WordUtil.isNewZh()) {
ViewGroup.LayoutParams layoutParams = guardian_task_view.getLayoutParams(); ViewGroup.LayoutParams layoutParams = guardian_task_view.getLayoutParams();
layoutParams.width = DpUtil.dp2px(50); layoutParams.width = DpUtil.dp2px(50);

View File

@ -185,6 +185,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
.setActivity(false) .setActivity(false)
.setType(LiveAudienceEvent.LiveAudienceType.BOTTOM_COLLECTION)); .setType(LiveAudienceEvent.LiveAudienceType.BOTTOM_COLLECTION));
} }
}); });
// //
@ -368,6 +369,25 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
} }
} }
}); });
if (IMLoginManager.get(mContext).getGuardRedPoint()) {
findViewById(R.id.total_image_red_point).setVisibility(View.VISIBLE);
} else {
findViewById(R.id.total_image_red_point).setVisibility(View.GONE);
}
}
public void onGuardRed() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (IMLoginManager.get(mContext).getGuardRedPoint()) {
findViewById(R.id.total_image_red_point).setVisibility(View.VISIBLE);
} else {
findViewById(R.id.total_image_red_point).setVisibility(View.GONE);
}
}
},1000);
} }
public void setGiftRemainingQuantity(String giftRemainingQuantity) { public void setGiftRemainingQuantity(String giftRemainingQuantity) {

View File

@ -2228,4 +2228,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.onSendMoneyLongEndEvent(moneyLongEndEvent); mLiveRoomViewHolder.onSendMoneyLongEndEvent(moneyLongEndEvent);
} }
} }
public void onGuardRed(){
if (mLiveAudienceViewHolder!=null){
mLiveAudienceViewHolder.onGuardRed();
}
}
} }

View File

@ -465,13 +465,28 @@
tools:visibility="visible" /> tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<!--普通工具合集--> <RelativeLayout
<ImageView android:layout_width="38dp"
android:id="@+id/total_image" android:layout_height="38dp">
android:layout_width="35dp" <!--普通工具合集-->
android:layout_height="35dp" <ImageView
android:layout_marginEnd="8dp" android:id="@+id/total_image"
android:src="@mipmap/icon_more_live_menu" /> android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginEnd="8dp"
android:src="@mipmap/icon_more_live_menu" />
<View
android:id="@+id/total_image_red_point"
android:layout_width="6dp"
android:layout_height="6dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="12dp"
android:layout_marginTop="3dp"
android:background="@drawable/bg_red_point"
tools:visibility="visible" />
</RelativeLayout>
</LinearLayout> </LinearLayout>

View File

@ -548,7 +548,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
String url = CommonAppConfig.HOST + "/h5/Noble/index.html?nickname=" + u.getUserNiceName() + "&usernobId=" + u.getNoble_id() + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"); String url = CommonAppConfig.HOST + "/h5/Noble/index.html?nickname=" + u.getUserNiceName() + "&usernobId=" + u.getNoble_id() + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0");
ZhuangBanActivity.forward(mContext, url, false); ZhuangBanActivity.forward(mContext, url, false);
} else if (i == R.id.lt_guard) { } else if (i == R.id.lt_guard) {
MobclickAgent.onEvent(mContext, "my_guard", "个人中心点守護"); MobclickAgent.onEvent(mContext, "my_guard_btn", "我的-守护点击次数及人数");
Constants.isTitle = true; Constants.isTitle = true;
UserBean u = CommonAppConfig.getInstance().getUserBean(); UserBean u = CommonAppConfig.getInstance().getUserBean();
String url = CommonAppConfig.HOST + "/h5/Guard/index.html?token=" + CommonAppConfig.getInstance().getToken() String url = CommonAppConfig.HOST + "/h5/Guard/index.html?token=" + CommonAppConfig.getInstance().getToken()