守护团新增红点

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,6 +62,23 @@ public class IMLoginManager extends BaseCacheManager {
public boolean getRedPoint() {
return !TextUtils.isEmpty(getString("RedPoint")) || !TextUtils.equals(getString("RedPoint"), "1");
}
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");
}
@ -511,7 +528,8 @@ public class IMLoginManager extends BaseCacheManager {
}
});
}
public void updateUserCoin(){
public void updateUserCoin() {
HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance")
.execute(new HttpCallback() {
@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")
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
JSONObject obj = JSONObject.parseObject(info[0]);
listener.onItemClick(obj,0);
listener.onItemClick(obj, 0);
String golds = obj.getString("gold");
String coins = obj.getString("coin");
String yuanbaos = obj.getString("yuanbao");

View File

@ -9,7 +9,6 @@ import android.app.Dialog;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.JavascriptInterface;
@ -378,6 +377,13 @@ public class JavascriptInterfaceUtils {
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
public void openWebViewTitle(String url) {
Constants.isTitle = true;
@ -694,10 +700,11 @@ public class JavascriptInterfaceUtils {
public void androidtoCommunityVideo() {
RouteUtil.forwardCommunityActivity();
}
@JavascriptInterface
public void getRewards(String checkUpgradesJson){
public void getRewards(String checkUpgradesJson) {
try {
CheckUpgradesModel upgradesModel = new Gson().fromJson(checkUpgradesJson,CheckUpgradesModel.class);
CheckUpgradesModel upgradesModel = new Gson().fromJson(checkUpgradesJson, CheckUpgradesModel.class);
if (!TextUtils.isEmpty(upgradesModel.getLevel()))
new XPopup.Builder(mWebView.getContext())
.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 {
private ImageView funGamePic;
private TextView funGameName;
private View total_image_red_point;
public FunGamesChildViewHolder(@NonNull View itemView) {
super(itemView);
funGamePic = itemView.findViewById(R.id.fun_game_pic);
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) {
@ -38,7 +40,11 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder {
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() {
@Override
public void onViewClicks() {
@ -59,7 +65,7 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder {
.append("&uid=")
.append(userInfo.getId())
.append("&token=")
.append(userInfo.getToken()) .append("&isZh=")
.append(userInfo.getToken()).append("&isZh=")
.append(WordUtil.isNewZh() ? "1" : 0);
} else {
htmlUrl.append(CommonAppConfig.HOST)
@ -68,7 +74,7 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder {
.append("?uid=")
.append(userInfo.getId())
.append("&token=")
.append(userInfo.getToken()) .append("&isZh=")
.append(userInfo.getToken()).append("&isZh=")
.append(WordUtil.isNewZh() ? "1" : 0);
}
Bus.get().post(new CustomDrawerPopupEvent()

View File

@ -26,13 +26,14 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder {
private TextView funGameName;
private View red_point;
private boolean showRed = false;
private View total_image_red_point;
public NewRoleFunGamesChildViewHolder(@NonNull View itemView, boolean showRed) {
super(itemView);
this.showRed = showRed;
funGamePic = itemView.findViewById(R.id.fun_game_pic);
funGameName = itemView.findViewById(R.id.fun_game_name);
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) {
@ -49,7 +50,11 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder {
}
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() {
@Override
public void onViewClicks() {

View File

@ -1,17 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:gravity="center"
android:orientation="vertical">
<RelativeLayout
android:layout_width="40dp"
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
android:id="@+id/fun_game_name"
android:layout_width="wrap_content"

View File

@ -13,12 +13,33 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="50dp"
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
android:id="@+id/red_point"
android:layout_width="10dp"

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

View File

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

View File

@ -185,6 +185,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
.setActivity(false)
.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) {

View File

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

View File

@ -465,6 +465,9 @@
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:layout_width="38dp"
android:layout_height="38dp">
<!--普通工具合集-->
<ImageView
android:id="@+id/total_image"
@ -473,6 +476,18 @@
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>

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");
ZhuangBanActivity.forward(mContext, url, false);
} else if (i == R.id.lt_guard) {
MobclickAgent.onEvent(mContext, "my_guard", "个人中心点守護");
MobclickAgent.onEvent(mContext, "my_guard_btn", "我的-守护点击次数及人数");
Constants.isTitle = true;
UserBean u = CommonAppConfig.getInstance().getUserBean();
String url = CommonAppConfig.HOST + "/h5/Guard/index.html?token=" + CommonAppConfig.getInstance().getToken()