diff --git a/app/src/main/java/com/shayu/phonelive/activity/LauncherActivity.java b/app/src/main/java/com/shayu/phonelive/activity/LauncherActivity.java index 5251deee9..0415e00e9 100644 --- a/app/src/main/java/com/shayu/phonelive/activity/LauncherActivity.java +++ b/app/src/main/java/com/shayu/phonelive/activity/LauncherActivity.java @@ -229,8 +229,11 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL } else { checkUidAndToken(); } + }else{ + ToastUtil.show(getString(R.string.net_error)); } } + }); } diff --git a/common/src/main/java/com/yunbao/common/bean/OpenAdModel.java b/common/src/main/java/com/yunbao/common/bean/OpenAdModel.java new file mode 100644 index 000000000..0189513be --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/OpenAdModel.java @@ -0,0 +1,169 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.StringUtil; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; + +public class OpenAdModel extends BaseModel { + public static final int TYPE_HOME = 1;//主页 + public static final int TYPE_LIVE = 2;//直播间 + public static final int TYPE_LIVE_DELAY = 3;//直播间延迟 + public static final int MODEL_SQUARE = 1;//正方形 + public static final int MODEL_RECTANGLE = 2;//长方形 + public static final int MODEL_BOTTOM = 3;//底部 + @SerializedName("id") + private int id; + @SerializedName("popup_location") + private int type = TYPE_HOME; + @SerializedName("activity_url") + private String url; + @SerializedName("image_url") + private String imageUrl; + @SerializedName("display_time") + private int showTime; //持续展示时间 + @SerializedName("delay_show_time") + private int delayShowTime;//延迟展示时间 + @SerializedName("popup_model") + private int model = MODEL_SQUARE; + @SerializedName("start_show_time") + private String startTime;//活动开始时间 + @SerializedName("end_show_time") + private String endTime;//活动结束时间 + @SerializedName("popup_permission") + private int permission; + + + public OpenAdModel() { + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getUrl() { + if (!url.startsWith("http://") || !url.startsWith("https://")) { + url = CommonAppConfig.HOST + url; + } + return url + "?t=" + System.currentTimeMillis() / 1000; + } + + public void setUrl(String url) { + this.url = url; + } + + public int getShowTime() { + return showTime * 1000; + } + + public void setShowTime(int showTime) { + this.showTime = showTime; + } + + public int getDelayShowTime() { + return delayShowTime * 1000; + } + + public void setDelayShowTime(int delayShowTime) { + this.delayShowTime = delayShowTime; + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public int getModel() { + return model; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public void setModel(int model) { + this.model = model; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getPermission() { + return permission; + } + + public void setPermission(int permission) { + this.permission = permission; + } + + public boolean isInTime() { + if (StringUtil.isEmpty(startTime, endTime)) { + return true; + } + Date startTime = null; + Date endTime = null; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); + + try { + startTime = sdf.parse(this.startTime); + endTime = sdf.parse(this.endTime); + } catch (ParseException e) { + e.printStackTrace(); + } + + long time = System.currentTimeMillis(); + return startTime.getTime() <= time && time <= endTime.getTime(); + } + + public boolean userIsPermission(boolean isGuard) { + if (permission == 4 && !isGuard) {//守护不可见 + return false; + } + return true; + } + + @Override + public String toString() { + return "OpenAdModel{" + + "id=" + id + + ", type=" + type + + ", url='" + url + '\'' + + ", imageUrl='" + imageUrl + '\'' + + ", showTime=" + showTime + + ", delayShowTime=" + delayShowTime + + ", model=" + model + + ", startTime='" + startTime + '\'' + + ", endTime='" + endTime + '\'' + + ", permission='" + permission + '\'' + + '}'; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/PkRankBean.java b/common/src/main/java/com/yunbao/common/bean/PkRankBean.java index dcff7de27..bd70bb03c 100644 --- a/common/src/main/java/com/yunbao/common/bean/PkRankBean.java +++ b/common/src/main/java/com/yunbao/common/bean/PkRankBean.java @@ -23,6 +23,8 @@ public class PkRankBean extends BaseModel { public String clickUrl; @SerializedName("vs_img") public String vsImgUrl; + @SerializedName("new_rank_name_en") + public String newRankNameEn; public int getId() { return id; @@ -94,6 +96,14 @@ public class PkRankBean extends BaseModel { this.vsImgUrl = vsImgUrl; } + public String getNewRankNameEn() { + return newRankNameEn; + } + + public void setNewRankNameEn(String newRankNameEn) { + this.newRankNameEn = newRankNameEn; + } + @Override public String toString() { return "PkRankBean{" + @@ -105,6 +115,7 @@ public class PkRankBean extends BaseModel { ", pkTopImgUrl='" + pkTopImgUrl + '\'' + ", clickUrl='" + clickUrl + '\'' + ", vsImgUrl='" + vsImgUrl + '\'' + + ", newRankNameEn='" + newRankNameEn + '\'' + '}'; } } diff --git a/common/src/main/java/com/yunbao/common/dialog/AbsDialogFullScreenPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/AbsDialogFullScreenPopupWindow.java new file mode 100644 index 000000000..76a7e48cb --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/AbsDialogFullScreenPopupWindow.java @@ -0,0 +1,39 @@ +package com.yunbao.common.dialog; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.lxj.xpopup.impl.FullScreenPopupView; + +/** + * 居中弹窗 + */ +public abstract class AbsDialogFullScreenPopupWindow extends FullScreenPopupView { + public final Context mContext; + + public AbsDialogFullScreenPopupWindow(@NonNull Context context) { + super(context); + this.mContext = context; + } + + /** + * 参考配置 + */ + public abstract void buildDialog(XPopup.Builder builder); + public abstract int bindLayoutId(); + + @Override + protected int getImplLayoutId() { + return bindLayoutId(); + } + + public void showDialog() { + XPopup.Builder builder = new XPopup.Builder(mContext); + builder.isDestroyOnDismiss(true); + builder.enableDrag(false); + buildDialog(builder); + builder.asCustom(this).show(); + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/OpenAdBottomDialogPopup.java b/common/src/main/java/com/yunbao/common/dialog/OpenAdBottomDialogPopup.java new file mode 100644 index 000000000..b4f0dc002 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/OpenAdBottomDialogPopup.java @@ -0,0 +1,70 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.widget.ImageView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.R; +import com.yunbao.common.activity.WebViewActivity; +import com.yunbao.common.bean.OpenAdModel; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.interfaces.OnItemClickListener; + +public class OpenAdBottomDialogPopup extends AbsDialogPopupWindow { + private ImageView mImageView; + private ImageView mClose; + private OpenAdModel model; + private OnItemClickListener mListener; + + public OpenAdBottomDialogPopup(@NonNull Context context, OpenAdModel model) { + super(context); + this.model = model; + } + + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_open_bottom_ad; + } + + @Override + public void dismiss() { + super.dismiss(); + if (mListener != null) { + mListener.onItemClick(model, 0); + mListener = null; + } + } + + public OpenAdBottomDialogPopup setListener(OnItemClickListener mListener) { + this.mListener = mListener; + return this; + } + + @Override + protected void onCreate() { + super.onCreate(); + mImageView = findViewById(R.id.img); + mClose = findViewById(R.id.close); + mImageView.setOnClickListener(v -> { + WebViewActivity.forward(mContext, model.getUrl(), model.getType() != OpenAdModel.TYPE_HOME); + if (mListener != null) { + mListener.onItemClick(model, 1); + mListener = null; + } + dismiss(); + }); + mClose.setOnClickListener(v -> dismiss()); + ImgLoader.display(mContext, model.getImageUrl(), mImageView); + if (model.getShowTime() > 0) { + mClose.postDelayed(this::dismiss, model.getShowTime()); + } + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/OpenAdCenterDialogPopup.java b/common/src/main/java/com/yunbao/common/dialog/OpenAdCenterDialogPopup.java new file mode 100644 index 000000000..5e92f5f10 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/OpenAdCenterDialogPopup.java @@ -0,0 +1,82 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.constraintlayout.widget.ConstraintLayout; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.R; +import com.yunbao.common.activity.WebViewActivity; +import com.yunbao.common.bean.OpenAdModel; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.ScreenDimenUtil; + +public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow { + private ImageView mImageView; + private ImageView mClose; + private OpenAdModel model; + private OnItemClickListener mListener; + + public OpenAdCenterDialogPopup(@NonNull Context context, OpenAdModel model) { + super(context); + this.model = model; + } + + public OpenAdCenterDialogPopup setListener(OnItemClickListener mListener) { + this.mListener = mListener; + return this; + } + + @Override + public void buildDialog(XPopup.Builder builder) { + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_open_center_ad; + } + + @Override + public void dismiss() { + super.dismiss(); + if (mListener != null) { + mListener.onItemClick(model, 0); + mListener = null; + } + } + + + @Override + protected void onCreate() { + super.onCreate(); + mImageView = findViewById(R.id.img); + mClose = findViewById(R.id.close); + findViewById(R.id.layout).setOnClickListener(v -> dismiss()); + mImageView.setOnClickListener(v -> { + WebViewActivity.forward(mContext, model.getUrl(), model.getType() != OpenAdModel.TYPE_HOME); + if (mListener != null) { + mListener.onItemClick(model, 1); + mListener = null; + } + dismiss(); + }); + mClose.setOnClickListener(v -> dismiss()); + ImgLoader.display(mContext, model.getImageUrl(), mImageView); + int width = ScreenDimenUtil.getInstance().getScreenWdith() - DpUtil.dp2px(40); + int height = (int) (width * 1.4); + if (model.getModel() == OpenAdModel.MODEL_SQUARE) { + height = width; + } + ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mImageView.getLayoutParams(); + params.width = width; + params.height = height; + mImageView.setLayoutParams(params); + if (model.getShowTime() > 0) { + mClose.postDelayed(this::dismiss, model.getShowTime()); + } + } +} diff --git a/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java b/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java index bb7a963c1..590a95912 100644 --- a/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java +++ b/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java @@ -21,6 +21,7 @@ import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.HintCustomPopup; import com.yunbao.common.views.LiveNewWishGiftPopup; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -149,7 +150,7 @@ public class LiveNewWishListFragment extends BaseFragment { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback() { @Override public void onSuccess(String data) { - ToastUtil.show("修改成功"); + ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success"); } @Override @@ -181,7 +182,7 @@ public class LiveNewWishListFragment extends BaseFragment { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback() { @Override public void onSuccess(String data) { - ToastUtil.show("修改成功"); + ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success"); } @Override @@ -200,7 +201,7 @@ public class LiveNewWishListFragment extends BaseFragment { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback() { @Override public void onSuccess(String data) { - ToastUtil.show("修改成功"); + ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success"); } @Override diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java index 7431a5d51..66ac11f22 100644 --- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java @@ -13,6 +13,7 @@ import com.lzy.okgo.callback.StringCallback; import com.lzy.okgo.model.Response; import com.lzy.okgo.request.PostRequest; import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.CommonAppContext; import com.yunbao.common.R; import com.yunbao.common.activity.ErrorActivity; import com.yunbao.common.bean.ConfigBean; @@ -260,6 +261,8 @@ public class CommonHttpUtil { AppManager.getInstance().AppExit(); } }).build().show(); + } else { + ToastUtil.show(CommonAppContext.getTopActivity().getString(R.string.net_error) + "code:" + code + " msg:" + msg); } } diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 1d283e0b8..94a9d834b 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -42,6 +42,7 @@ import com.yunbao.common.bean.MsgSwitchDetailModel; import com.yunbao.common.bean.NewPeopleInfo; import com.yunbao.common.bean.NobleRankHideUserListModel; import com.yunbao.common.bean.NobleTrumpetModel; +import com.yunbao.common.bean.OpenAdModel; import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.PrankGiftBean; import com.yunbao.common.bean.PrankHttpTurntableBean; @@ -1033,5 +1034,11 @@ public interface PDLiveApi { @Query("room_id") String roomId ); + /** + * 活动弹窗 + */ + @GET("/api/public/?service=Home.activityPopup") + Observable>> activityPopup(); + } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index aa3336c3e..83cff19e3 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -40,6 +40,7 @@ import com.yunbao.common.bean.LiveUserMailBoxModel; import com.yunbao.common.bean.MedalAchievementModel; import com.yunbao.common.bean.NobleRankHideUserListModel; import com.yunbao.common.bean.NobleTrumpetModel; +import com.yunbao.common.bean.OpenAdModel; import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.PrankGiftBean; import com.yunbao.common.bean.PrankHttpTurntableBean; @@ -2197,6 +2198,29 @@ public class LiveNetManager { }).isDisposed(); } + public void activityPopup(HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .activityPopup() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + public void getCode(HttpCallback> callback) { API.get().pdLiveApi(mContext) .getCode() diff --git a/common/src/main/java/com/yunbao/common/manager/IMRTCManager.java b/common/src/main/java/com/yunbao/common/manager/IMRTCManager.java index 4c3fc88ef..c1b85d3ab 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMRTCManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMRTCManager.java @@ -6,6 +6,7 @@ import android.os.Handler; import android.os.Looper; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import java.util.ArrayList; import java.util.List; @@ -100,7 +101,11 @@ public class IMRTCManager { public void onSuccess() { callback.onSuccess(); if (!RandomPkManager.getInstance().isRandomModel()) { - ToastUtil.show("发起邀请成功"); + if(WordUtil.isNewZh()) { + ToastUtil.show("发起邀请成功"); + }else{ + ToastUtil.show("successful"); + } } requestUid.add(liveUid); startRequestTimeoutTask(liveUid); @@ -109,7 +114,11 @@ public class IMRTCManager { @Override public void onFailed(RTCErrorCode errorCode) { if (!RandomPkManager.getInstance().isRandomModel()) { - ToastUtil.show("邀请失败 " + errorCode.getValue()); + if(WordUtil.isNewZh()) { + ToastUtil.show("邀请失败 " + errorCode.getValue()); + }else{ + ToastUtil.show("invite failed:" +errorCode.getValue()); + } } if (RandomPkManager.getInstance().isRequestPk()) { RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE); diff --git a/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java b/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java new file mode 100644 index 000000000..b9e967df9 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java @@ -0,0 +1,178 @@ +package com.yunbao.common.manager; + +import android.os.Handler; +import android.os.Looper; +import android.util.Log; + +import com.yunbao.common.CommonAppContext; +import com.yunbao.common.bean.OpenAdModel; +import com.yunbao.common.dialog.OpenAdBottomDialogPopup; +import com.yunbao.common.dialog.OpenAdCenterDialogPopup; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.ToastUtil; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +public class OpenAdManager { + public static final int TYPE_HOME = 1; + public static final int TYPE_LIVE = 2; + private static final String TAG = "-----弹窗-----"; + private Map showMap; + private List list = null; + private Handler handler = new Handler(Looper.getMainLooper()); + private Map runnableMap = new HashMap<>(); + private int showType; + + private OpenAdManager() { + showMap = new HashMap<>(); + init(false); + } + + public void reset() { + dismiss(); + runnableMap.clear(); + showMap.clear(); + list.clear(); + } + + private static final class MInstanceHolder { + static final OpenAdManager mInstance = new OpenAdManager(); + } + + public static OpenAdManager getInstance() { + return MInstanceHolder.mInstance; + } + + private void init(boolean isShow) { + if (list != null && list.isEmpty()) { + return; + } + if(CommonAppContext.getTopActivity()==null){ + return; + } + LiveNetManager.get(CommonAppContext.getTopActivity()) + .activityPopup(new HttpCallback>() { + @Override + public void onSuccess(List data) { + if (data == null || data.isEmpty()) { + Log.i(TAG, "onSuccess: 没有数据"); + list = new ArrayList<>(); + return; + } + list = data; + if (isShow) { + show(TYPE_HOME, false); + } + } + + @Override + public void onError(String error) { + System.err.println("弹框列表:" + error); + } + }); + } + + + public synchronized void show(int type, boolean isGuard) { + if (list == null) { + init(true); + return; + } + showType = type; + for (OpenAdModel model : list) { + if (model.getType() == type) { + if (type == OpenAdModel.TYPE_LIVE && !model.userIsPermission(isGuard)) { + continue; + } + if (runnableMap.containsKey(model.getId())) { + AdRunnable runnable = runnableMap.get(model.getId()); + if (runnable != null) { + Log.d(TAG, "reset: " + model); + handler.removeCallbacks(runnable); + runnableMap.remove(model.getId()); + } + } + + if (!isShow(model)) { + Log.i(TAG, "show: " + model); + handler.postDelayed(new AdRunnable(model), model.getDelayShowTime()); + } else { + Log.i(TAG, "notshow: " + model); + } + + } + } + Log.i(TAG, "------------------------------"); + + } + + public synchronized void dismiss() { + Log.d(TAG, "准备dismiss:" + runnableMap.size()); + for (Integer model : runnableMap.keySet()) { + AdRunnable runnable = runnableMap.get(model); + Log.d(TAG, "dismiss:" + runnable); + if (runnable != null) { + runnable.dismiss(); + handler.removeCallbacks(runnable); + } + } + runnableMap.clear(); + } + + private synchronized boolean isShow(OpenAdModel type) { + if (showMap.containsKey(type.getId()) && showMap.get(type.getId()) != null) { + return Boolean.TRUE.equals(showMap.get(type.getId())); + } + return false; + } + + private class AdRunnable implements Runnable { + OpenAdModel model; + + public AdRunnable(OpenAdModel model) { + this.model = model; + runnableMap.put(model.getId(), this); + } + + public void dismiss() { + Log.e(TAG, "dismiss: " + model); + } + + @Override + public synchronized void run() { + Log.i(TAG, "run: " + model); + if (model == null) { + ToastUtil.showDebug("model为空"); + return; + } + if (!model.isInTime()) { + ToastUtil.showDebug("不在展示时间内:" + model.getStartTime() + "|" + model.getEndTime()); + return; + } + if (isShow(model)) { + ToastUtil.showDebug(model.getId() + "|model展示过了"); + return; + } + if (model.getType() != showType) { + return; + } + showMap.put(model.getId(), true); + if (model.getModel() == OpenAdModel.MODEL_BOTTOM) { + new OpenAdBottomDialogPopup(CommonAppContext.getTopActivity(), model) + .setListener((bean, position) -> { + }) + .showDialog(); + } else { + new OpenAdCenterDialogPopup(CommonAppContext.getTopActivity(), model) + .setListener((bean, position) -> { + }) + .showDialog(); + } + } + } +} diff --git a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java index 3f853d460..62fc018f7 100644 --- a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java @@ -4,6 +4,7 @@ import static com.yunbao.common.CommonAppConfig.isGetNewWrap; import static com.yunbao.common.utils.RouteUtil.PATH_COIN; import android.app.Activity; +import android.app.Dialog; import android.os.Handler; import android.os.Looper; import android.view.View; @@ -643,4 +644,19 @@ public class JavascriptInterfaceUtils { Bus.get().post(new JavascriptInterfaceEvent() .setMethod("androidCancelAnchorAttention")); } + @JavascriptInterface + public void androidLnsufficientBalanceClick(String msg){ + DialogUitl.showSimpleDialog(mContext, msg, new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + dialog.dismiss(); + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }); + } } diff --git a/common/src/main/java/com/yunbao/common/utils/NobleUtil.java b/common/src/main/java/com/yunbao/common/utils/NobleUtil.java index afe0208c3..a1ec0f2c7 100644 --- a/common/src/main/java/com/yunbao/common/utils/NobleUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/NobleUtil.java @@ -30,7 +30,7 @@ public class NobleUtil { case 1:return "男爵"; case 2:return "子爵"; case 3:return "侯爵"; - case 4:return "公爵"; + case 4:return "公爵"; case 5:return "国王"; case 6:return "皇帝"; case 7:return "超皇"; @@ -39,15 +39,15 @@ public class NobleUtil { } public static String nobleIdToStringNameForEn(int id){ switch (id){ - case 1:return "baron"; - case 2:return "viscount"; - case 3:return "marquis"; - case 4:return "duke"; - case 5:return "king"; - case 6:return "emperor"; - case 7:return "SuperEmperor"; + case 1:return "Baron"; + case 2:return "Viscount"; + case 3:return "Marquis"; + case 4:return "Duke"; + case 5:return "King"; + case 6:return "Emperor"; + case 7:return "SuperKing"; } - return "Not Opened"; + return "Not opened"; } public static int getNobleBackgroundId(int id){ switch (id){ diff --git a/common/src/main/java/com/yunbao/common/utils/PluginManager.java b/common/src/main/java/com/yunbao/common/utils/PluginManager.java index 395dbee7c..17e723687 100644 --- a/common/src/main/java/com/yunbao/common/utils/PluginManager.java +++ b/common/src/main/java/com/yunbao/common/utils/PluginManager.java @@ -49,17 +49,17 @@ public class PluginManager { } public boolean isDownloadApk() { - if(!CommonAppConfig.IS_PLUGIN_MODEL){ + if (!CommonAppConfig.IS_PLUGIN_MODEL) { return true; } - return new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download" + File.separator + "anchorPlugin.apk").exists(); + return new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download" + File.separator + "anchorPlugin.apk.lock").exists(); } /** * 加载主播插件 */ public void loadAnchorPlugin(DialogInterface.OnDismissListener dismissListener) { - if(!CommonAppConfig.IS_PLUGIN_MODEL){ + if (!CommonAppConfig.IS_PLUGIN_MODEL) { dismissListener.onDismiss(null); return; } @@ -73,7 +73,8 @@ public class PluginManager { e.printStackTrace(); } File sdk = new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download" + File.separator + "anchorPlugin.apk"); - if (!sdk.exists()) { + if (!new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download" + File.separator + "anchorPlugin.apk.lock").exists() || !sdk.exists()) { + Log.i(TAG, "loadAnchorPlugin: 插件未下载"); if (StringUtil.isEmpty(anchorPluginDownloadUrl)) { Log.e(TAG, "主播下载地址为空"); return; @@ -97,8 +98,12 @@ public class PluginManager { * @param outDir 解压路径 */ private void loadFaceSo(File plugin, String outDir) { - if(!new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin"+File.separator+"lib").exists()) { - unzip(plugin.getAbsolutePath(), outDir, ".so"); + if (!new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin" + File.separator + "lib.lock").exists()) { + Log.i(TAG, "loadFaceSo: lib插件未解压"); + if (unzip(plugin.getAbsolutePath(), outDir, ".so")) { + new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin" + File.separator + "lib.lock").mkdirs(); + Log.i(TAG, "loadFaceSo: lib插件解压"); + } } String[] abis = Build.SUPPORTED_ABIS; String abi = Arrays.asList(abis).contains("arm64-v8a") ? "arm64-v8a" : "armeabi-v7a"; @@ -108,8 +113,8 @@ public class PluginManager { try { Field field = Class.forName("com.faceunity.wrapper.faceunity$LoadConfig").getDeclaredField("sLoadedLibrary"); field.setAccessible(true); - field.set(null,true); - }catch (Exception e){ + field.set(null, true); + } catch (Exception e) { e.printStackTrace(); } } @@ -121,8 +126,12 @@ public class PluginManager { * @param outDir 解压路径 */ private void loadFaceBundle(File plugin, String outDir) { - if(!new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin"+File.separator+"assets").exists()) { - unzip(plugin.getAbsolutePath(), outDir, ".bundle"); + if (!new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin" + File.separator + "assets.lock").exists()) { + Log.i(TAG, "loadFaceBundle: bundle未解压"); + if (unzip(plugin.getAbsolutePath(), outDir, ".bundle")) { + Log.i(TAG, "loadFaceBundle: bundle解压"); + new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin" + File.separator + "assets.lock").mkdirs(); + } } try { Object BUNDLE_AI_FACE = Class.forName("com.yunbao.faceunity.utils.FURenderer").getField("BUNDLE_AI_FACE").get(null); @@ -131,6 +140,7 @@ public class PluginManager { Class.forName("com.yunbao.faceunity.utils.FaceUnityConfig").getField("BUNDLE_FACE_BEAUTIFICATION").set(null, outDir + File.separator + "assets" + File.separator + BUNDLE_FACE_BEAUTIFICATION); } catch (Exception e) { e.printStackTrace(); + new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin" + File.separator + "assets.lock").delete(); } } @@ -143,10 +153,12 @@ public class PluginManager { private void loadSo(File dir, String file) { file += ".so"; if (new File(dir.getAbsolutePath() + File.separator + file).exists()) { + Log.d(TAG, "加载 " + dir.getAbsolutePath() + File.separator + file); System.load(dir + File.separator + file); Log.d(TAG, "加载成功 " + dir + File.separator + file); } else { Log.e(TAG, "不存在 " + dir + File.separator + file); + new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin" + File.separator + "lib.lock").delete(); } } @@ -159,6 +171,7 @@ public class PluginManager { @Override public void onSuccess(File file) { Log.d(TAG, "下载成功 " + file); + new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download" + File.separator + "anchorPlugin.apk.lock").mkdirs(); loadAnchorPlugin(dismissListener); } @@ -169,7 +182,7 @@ public class PluginManager { @Override public void onError(Throwable e) { - + downloadAnchorSdk(dismissListener); } }); } @@ -186,13 +199,14 @@ public class PluginManager { FileOutputStream out; byte buffer[] = new byte[1024]; try { + Log.i(TAG, "unzip: " + outDir); ZipInputStream zis = new ZipInputStream(new FileInputStream(zip)); ZipEntry entry = zis.getNextEntry(); while (entry != null) { String name = entry.getName(); if (entry.isDirectory()) { File newDir = new File(outDir + entry.getName()); - newDir.mkdir(); + newDir.mkdirs(); } else if (name.endsWith(suffix)) { File outputFile = new File(outDir + File.separator + name); String outputPath = outputFile.getCanonicalPath(); @@ -205,7 +219,7 @@ public class PluginManager { outputFile = new File(outputPath, name); outputFile.createNewFile(); out = new FileOutputStream(outputFile); - + Log.i(TAG, "unzip: >>" + outputFile.getAbsolutePath()); int tmp = 0; while ((tmp = zis.read(buffer)) > 0) { out.write(buffer, 0, tmp); diff --git a/common/src/main/java/com/yunbao/common/utils/ToastUtil.java b/common/src/main/java/com/yunbao/common/utils/ToastUtil.java index 3aa789611..35ada5438 100644 --- a/common/src/main/java/com/yunbao/common/utils/ToastUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/ToastUtil.java @@ -43,7 +43,7 @@ public class ToastUtil { public static void show(int res) { - show(WordUtil.getString(res)); + show(WordUtil.getNewString(res)); } /** @@ -80,7 +80,7 @@ public class ToastUtil { } public static void showDebug(String s){ if(BuildConfig.DEBUG){ - show(s); + show("开发模式:"+s); } } public static void showDebug(int s){ @@ -92,6 +92,7 @@ public class ToastUtil { if (TextUtils.isEmpty(s)) { return; } + Log.i("Toast", "Toast show: "+s); Log.i("ts","ll"); Toast.makeText(CommonAppContext.sInstance,s,Toast.LENGTH_SHORT).show(); Log.i("ts","22"); diff --git a/common/src/main/java/com/yunbao/common/views/InputCustomPopup.java b/common/src/main/java/com/yunbao/common/views/InputCustomPopup.java index 80b31e916..4aa99edb4 100644 --- a/common/src/main/java/com/yunbao/common/views/InputCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/InputCustomPopup.java @@ -14,6 +14,7 @@ import com.lxj.xpopup.animator.PopupAnimator; import com.lxj.xpopup.core.CenterPopupView; import com.yunbao.common.R; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; /** @@ -85,7 +86,7 @@ public class InputCustomPopup extends CenterPopupView { public void onViewClicks() { String textContent = content.getText().toString(); if (TextUtils.isEmpty(textContent)) { - ToastUtil.show("输入内容不可为空"); + ToastUtil.show(WordUtil.isNewZh()?"输入内容不可为空":"The input cannot be empty"); return; } if (listener != null) { diff --git a/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java b/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java index 4ca74750f..a4af32be8 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java @@ -32,6 +32,7 @@ import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import org.greenrobot.eventbus.Subscribe; @@ -332,7 +333,7 @@ public class LiveNewWishListPopup extends BottomPopupView { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback() { @Override public void onSuccess(String data) { - ToastUtil.show("修改成功"); + ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success"); } @Override diff --git a/common/src/main/res/layout/dialog_open_bottom_ad.xml b/common/src/main/res/layout/dialog_open_bottom_ad.xml new file mode 100644 index 000000000..192f2d295 --- /dev/null +++ b/common/src/main/res/layout/dialog_open_bottom_ad.xml @@ -0,0 +1,29 @@ + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_open_center_ad.xml b/common/src/main/res/layout/dialog_open_center_ad.xml new file mode 100644 index 000000000..217d47e2b --- /dev/null +++ b/common/src/main/res/layout/dialog_open_center_ad.xml @@ -0,0 +1,32 @@ + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/mipmap-mdpi/ic_open_ad_close.png b/common/src/main/res/mipmap-mdpi/ic_open_ad_close.png new file mode 100644 index 000000000..62d53f0ef Binary files /dev/null and b/common/src/main/res/mipmap-mdpi/ic_open_ad_close.png differ diff --git a/common/src/main/res/mipmap-mdpi/icon_rank_top_box.png b/common/src/main/res/mipmap-mdpi/icon_rank_top_box.png index 572bdb1b2..6241af885 100644 Binary files a/common/src/main/res/mipmap-mdpi/icon_rank_top_box.png and b/common/src/main/res/mipmap-mdpi/icon_rank_top_box.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 de92b6b82..8f01aacca 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -56,14 +56,14 @@ No QQ installed Replication link Replication success - Editing materials - Head portrait - Nickname + Edit + Photo + Name ModifyName Modify remarks Please enter comments~ Signature - autograph + Bio Binding phone TASK1 TASK2 @@ -242,8 +242,8 @@ Service and privacy terms Other login methods More exciting experience after registering! - Please enter your mobile number - Please input a password + Phone Number + Password Login immediately Logon Immediate registration @@ -254,9 +254,9 @@ privilege grant failed Authorization cancelled Live broadcast - Login + Log in shopmall - Recomm + Recommend CSD Anchor Live broadcast @@ -289,7 +289,7 @@ Trickster MultiplayerPK Voice Link - Start + billboard LeaveTemporarily ResumeLive Flash lamp @@ -491,11 +491,11 @@ register Please enter your mobile number Please enter the verification code - Please fill in the password - Please confirm the password - Fill in the invitation code (optional) + Password + Password Again + Invite Code(Optional) Register and log in - Get verification code + Get Code Regain Passwords are inconsistent In registration @@ -659,7 +659,7 @@ Preservation Register No one is currently in the voice link - Welcome to PDLIVE + Welcome to PDLive Newcomer Bonus EXP Complete newcomer tasks for more rewards @@ -683,7 +683,7 @@ Banned users List of forbidden users Live room of - Lifting of the ban + Remove Blacklist of users No banned users No blacklisted users @@ -829,8 +829,8 @@ You can only speak after completing the previous task - Heat addition - Hot & Time + HEATING + Heat & Time The popularity can increase the exposure to the anchor\'s room. The higher the live broadcast room, the more popular on the homepage, which will bring more users in the house and help the anchor to quickly increase the room heat in a period of time. Immediately after the delivery Effective. How to get the heat card? @@ -888,7 +888,7 @@ Limited ride And limited avatar frame Online Service Hot Ticket Register and log in - Sign up for PD LIVE + Sign in PDlive Tell the world! Tell the world! %s recommends anchor %s to everyone! Tell the world! %s recommends the anchor %s to everyone, and the splendid glance is amazing! @@ -956,7 +956,7 @@ Limited ride And limited avatar frame Chat Congratulations %s have won %s in the Lucky Angel! The next lucky angel will be you! Congratulations on %s winning %s in Luck 100 %%! Go pass on the good luck! - Guardian %s + guard %s receive To finish Already collected @@ -1018,7 +1018,7 @@ Limited ride And limited avatar frame There is no choice, the anchor is not turned on FHD live. There is no choice, the anchor is not turned on HD live. Sorry, this feature is on hold. - phone + Phone Number Broadcast Click To View Anchor Task @@ -1047,10 +1047,10 @@ Limited ride And limited avatar frame Go to the sign-in center Confirm pick up Unable to login? Click here to contact customer service - By logging in, you agree to the Terms of - Service - and - Privacy + By continuing, you are agree to our Terms of + use + & + Privacy Policy Terms and policies For details, please read the following message to install the application: Welcome to PD LIVE. For your personal information and privacy, we will adopt the highest standards of treatment and protection. @@ -1084,7 +1084,7 @@ Limited ride And limited avatar frame One-time gift ≥2000 diamonds), can obtain fan privilege yo Top up User level - aristocracy + Noble\nLevel Fan club Voice connection is not enabled Wall of honor @@ -1126,7 +1126,7 @@ Limited ride And limited avatar frame unfollow Where is the host doing badly~\nBrother, are you sure you want to unfollow? follow - Heat Add + Heating LOW DEFAULT HIGH @@ -1150,7 +1150,7 @@ Limited ride And limited avatar frame Do you want to delete the account After clicking delete, it will take effect immediately and cannot be restored. Are you sure you want to continue? Confirm deletion - Fill And gift + Fill for Gift Fill in the \'*\' option to complete True love powder\nPhoto Frame(7 days) 128 Golden Beans @@ -1211,6 +1211,7 @@ Limited ride And limited avatar frame None Return to account Popularity Red packet + Earn Cash Game Popular red packets amount @@ -1318,6 +1319,10 @@ Limited ride And limited avatar frame Whether to use trial coupons Use diamonds Join a fans club + Sorry, your network failed to pull the other party. + say something + No match was found + Add Interactive Games Room list Game: diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 982169216..962faba11 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1314,6 +1314,11 @@ 是否使用試用劵 使用鑽石 加入粉絲團 + + 抱歉,您的網絡不佳拉取對方畫面失敗 + 這家夥很懶,什麽都沒留下 + 沒有找到匹配結果~ + 確定添加 互動遊戲 房間列表 游戲: diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 93ced9b66..53b06b654 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1313,6 +1313,11 @@ 主播: 是否使用試用劵 使用鑽石 + + 抱歉,您的網絡不佳拉取對方畫面失敗 + 這家夥很懶,什麽都沒留下 + 沒有找到匹配結果~ + 確定添加 互動遊戲 房間列表 游戲: diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index a995b20e2..f4d0e5846 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1314,6 +1314,10 @@ 主播: 加入粉絲團 + 抱歉,您的網絡不佳拉取對方畫面失敗 + 這家夥很懶,什麽都沒留下 + 沒有找到匹配結果~ + 確定添加 互動遊戲 房間列表 游戲: diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index df52b524e..e8f767b91 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -56,14 +56,14 @@ No QQ installed Replication link Replication success - Editing materials - Head portrait - Nickname + Edit + Photo + Name ModifyName Modify remarks Please enter comments~ Signature - autograph + Bio Binding phone TASK1 TASK2 @@ -242,8 +242,8 @@ Service and privacy terms Other login methods More exciting experience after registering! - Please enter your mobile number - Please input a password + Phone Number + Password Login immediately Logon Immediate registration @@ -254,9 +254,9 @@ privilege grant failed Authorization cancelled Live broadcast - Login + Log in shopmall - Recomm + Recommend CSD Anchor Live broadcast @@ -289,7 +289,7 @@ Trickster MultiplayerPK Voice Link - Start + billboard LeaveTemporarily ResumeLive Flash lamp @@ -491,11 +491,11 @@ register Please enter your mobile number Please enter the verification code - Please fill in the password - Please confirm the password - Fill in the invitation code (optional) + Password + Password Again + Invite Code(Optional) Register and log in - Get verification code + Get Code Regain Passwords are inconsistent In registration @@ -659,7 +659,7 @@ Preservation Register No one is currently in the voice link - Welcome to PDLIVE + Welcome to PDLive Newcomer Bonus EXP Complete newcomer tasks for more rewards @@ -683,7 +683,7 @@ Banned users List of forbidden users Live room of - Lifting of the ban + Remove Blacklist of users No banned users No blacklisted users @@ -829,8 +829,8 @@ You can only speak after completing the previous task - Heat addition - Hot & Time + HEATING + Heat & Time The popularity can increase the exposure to the anchor\'s room. The higher the live broadcast room, the more popular on the homepage, which will bring more users in the house and help the anchor to quickly increase the room heat in a period of time. Immediately after the delivery Effective. How to get the heat card? @@ -888,7 +888,7 @@ Limited ride And limited avatar frame Online Service Hot Ticket Register and log in - Sign up for PD LIVE + Sign in PDlive Tell the world! Tell the world! %s recommends anchor %s to everyone! Tell the world! %s recommends the anchor %s to everyone, and the splendid glance is amazing! @@ -956,7 +956,7 @@ Limited ride And limited avatar frame Chat Congratulations %s have won %s in the Lucky Angel! The next lucky angel will be you! Congratulations on %s winning %s in Luck 100 %%! Go pass on the good luck! - Guardian %s + guard %s receive To finish Already collected @@ -1018,7 +1018,7 @@ Limited ride And limited avatar frame There is no choice, the anchor is not turned on FHD live. There is no choice, the anchor is not turned on HD live. Sorry, this feature is on hold. - phone + Phone Number Broadcast Click To View Anchor Task @@ -1047,10 +1047,10 @@ Limited ride And limited avatar frame Go to the sign-in center Confirm pick up Unable to login? Click here to contact customer service - By logging in, you agree to the Terms of - Service - and - Privacy + By continuing, you are agree to our Terms of + use + & + Privacy Policy Terms and policies For details, please read the following message to install the application: Welcome to PD LIVE. For your personal information and privacy, we will adopt the highest standards of treatment and protection. @@ -1084,7 +1084,7 @@ Limited ride And limited avatar frame One-time gift ≥2000 diamonds), can obtain fan privilege yo Top up User level - aristocracy + Noble\nLevel Fan club Voice connection is not enabled Wall of honor @@ -1126,7 +1126,7 @@ Limited ride And limited avatar frame unfollow Where is the host doing badly~\nBrother, are you sure you want to unfollow? follow - Heat Add + Heating LOW DEFAULT HIGH @@ -1168,7 +1168,7 @@ Limited ride And limited avatar frame VOTE %s
box disappears after %s seconds
Please complete the form. - Fill And gift + Fill for Gift Fill in the \'*\' option to complete True love powder\nPhoto Frame(7 days) 128 Golden Beans @@ -1212,6 +1212,7 @@ Limited ride And limited avatar frame None Return to account Popularity Red packet + Earn Cash Game Popular red packets amount @@ -1320,6 +1321,11 @@ Limited ride And limited avatar frame Anchor: Join a fans club + Sorry, your network failed to pull the other party. + + say something + No match was found + Add Interactive Games Room list Game: 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 b03fe4699..19b8ec9de 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -1,5 +1,7 @@ package com.yunbao.live.activity; +import static com.yunbao.common.utils.RouteUtil.PATH_COIN; + import android.app.Dialog; import android.content.ClipData; import android.content.ClipboardManager; @@ -15,6 +17,7 @@ import android.widget.TextView; import androidx.fragment.app.DialogFragment; +import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; @@ -36,6 +39,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.KeyBoardHeightChangeListener; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.KeyBoardHeightUtil2; import com.yunbao.common.utils.L; import com.yunbao.common.utils.ProcessImageUtil; @@ -899,7 +903,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL @Override public void onClick(View v) { String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=task&a=index&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&tabIndex=1"; - WebViewActivity.forward(mContext, url,true); + WebViewActivity.forward(mContext, url, true); dialog.dismiss(); } }); @@ -925,7 +929,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL if (!mIsAnchor) { UserBean u = CommonAppConfig.getInstance().getUserBean(); if (u != null && u.getLevel() < mDanMuLevel) { - ToastUtil.show(String.format(mContext.getString(R.string.live_level_danmu_limit), mDanMuLevel+"")); + ToastUtil.show(String.format(mContext.getString(R.string.live_level_danmu_limit), mDanMuLevel + "")); return; } } @@ -946,7 +950,20 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL onCoinChanged(coin); } String[] data = new String[]{obj.getString("barragetoken")}; - SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents,obj.getIntValue("level_fans")); + SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents, obj.getIntValue("level_fans")); + } else if (code==1001) { + DialogUitl.showSimpleDialog(mContext, msg, new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + dialog.dismiss(); + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }); } else { ToastUtil.show(msg); } @@ -962,7 +979,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL if (!mIsAnchor) { UserBean u = CommonAppConfig.getInstance().getUserBean(); if (u != null && u.getLevel() < mChatLevel) { - ToastUtil.show(String.format(mContext.getString(R.string.live_level_chat_limit), mChatLevel+"")); + ToastUtil.show(String.format(mContext.getString(R.string.live_level_chat_limit), mChatLevel + "")); return; } } @@ -1276,9 +1293,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL } else { bundle.putString(Constants.URL, CommonAppConfig.HOST + "/h5/live/fansClub.html" + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + uid); } - bundle.putString("liveUid",mLiveUid); - bundle.putString("anchorName",mAncherName); - bundle.putString("mStream",mStream); + bundle.putString("liveUid", mLiveUid); + bundle.putString("anchorName", mAncherName); + bundle.putString("mStream", mStream); fragment.setArguments(bundle); fragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment"); } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 30f9280ce..67871087c 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -80,6 +80,7 @@ import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.main.MainNetManager; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.manager.OpenAdManager; import com.yunbao.common.pay.PayCallback; import com.yunbao.common.pay.PayPresenter; import com.yunbao.common.utils.Bus; @@ -100,6 +101,7 @@ import com.yunbao.live.R; import com.yunbao.live.adapter.VerticalPagerAdapter; import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.bean.LiveChatBean; +import com.yunbao.live.bean.LiveGuardInfo; import com.yunbao.live.dialog.LiveFansFragment; import com.yunbao.live.dialog.LiveGameDialogFragment; import com.yunbao.live.dialog.LiveGiftPopup; @@ -561,6 +563,7 @@ public class LiveAudienceActivity extends LiveActivity { @Override public void onBackPressed() { MobclickAgent.onEvent(mContext, "live_room_close", "退出直播间"); + OpenAdManager.getInstance().dismiss(); try { manager.onBackPressed(); if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) { @@ -777,6 +780,10 @@ public class LiveAudienceActivity extends LiveActivity { } } GiftCacheUtil.getInstance().restart(); + if (manager.isEnterRoom()) { + new Handler(Looper.getMainLooper()).postDelayed(() -> OpenAdManager.getInstance().show(OpenAdManager.TYPE_LIVE, + LiveGuardInfo.isGuard(mLiveGuardInfo)), 400); + } } @Override diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index 72f87232f..4bf42650e 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -70,6 +70,7 @@ import com.yunbao.common.utils.LogUtil; import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.LiveNewWishListPopup; import com.yunbao.common.views.LiveRobotSettingCustomPopup; import com.yunbao.faceunity.FaceManager; @@ -1244,7 +1245,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl }); //todo 安卓端状态码说明文档:https://docs.rongcloud.cn/v4/views/rtc/call/code/android.html Log.e("ry", rtcErrorCode + "aaaaaa" + CommonAppConfig.getInstance().getUid() + "VDSSSS" + pkUid); - ToastUtil.show("邀请 " + pkUid + " 发送失败 :" + rtcErrorCode); + if(WordUtil.isNewZh()) { + ToastUtil.show("邀请 " + pkUid + " 发送失败 :" + rtcErrorCode); + }else{ + ToastUtil.show("invite " + pkUid + " failed:"+rtcErrorCode); + } } }); @@ -1293,7 +1298,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl @Override public void onSuccess() { if (!extra.equals(SOCKET_LIVE_DRPK_RANDOM)) { - ToastUtil.show("邀请 " + pkUid + " 发送成功"); + if(WordUtil.isNewZh()) { + ToastUtil.show("邀请 " + pkUid + " 发送成功"); + }else{ + ToastUtil.show("invite " + pkUid + " successful"); + } } runOnUiThread(new Runnable() { @Override diff --git a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java index c45181bbb..7202da106 100644 --- a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java @@ -221,9 +221,15 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter { } if (bean.getType() == TYPE_MIC_REQUEST) { mBtn.setText("同意"); + if(!WordUtil.isNewZh()){ + mBtn.setText("agree"); + } mBtn.setBackgroundResource(R.drawable.bg_anchor_mic_info_btn_ok); } else if (bean.getType() == TYPE_MIC_INVITE) { mBtn.setText("邀请"); + if (!WordUtil.isNewZh()) { + mBtn.setText("invite"); + } mBtn.setBackgroundResource(R.drawable.bg_anchor_mic_info_btn_invite); } ImgLoader.display(mContext, bean.getAvatar(), mAvatar); diff --git a/live/src/main/java/com/yunbao/live/bean/LiveGuardInfo.java b/live/src/main/java/com/yunbao/live/bean/LiveGuardInfo.java index 0e07e4734..1015a6de7 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveGuardInfo.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveGuardInfo.java @@ -3,6 +3,8 @@ package com.yunbao.live.bean; import android.os.Parcel; import android.os.Parcelable; +import com.yunbao.common.Constants; + /** * Created by cxf on 2018/11/14. */ @@ -72,5 +74,8 @@ public class LiveGuardInfo implements Parcelable { } }; + public static boolean isGuard(LiveGuardInfo info){ + return info != null && info.getMyGuardType() != Constants.GUARD_TYPE_NONE; + } } diff --git a/live/src/main/java/com/yunbao/live/dialog/FreePkDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/FreePkDialogFragment.java index b1395ffc9..ef52c9a21 100644 --- a/live/src/main/java/com/yunbao/live/dialog/FreePkDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/FreePkDialogFragment.java @@ -130,13 +130,13 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl } }); if(!WordUtil.isNewZh()){ - mPkNumText.setText("Free PK remaining number"); + mPkNumText.setText("Free PK number"); ((TextView)findViewById(R.id.tmp_text2)).setText("Updated daily at 6am"); } if (mDrPkNum != -1) { mPkNumText.setText("多人PK剩余次數"); if(!WordUtil.isNewZh()){ - mPkNumText.setText("multi-user PK remaining number"); + mPkNumText.setText("multi-user PK number"); } } initRecycler(); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java index 33da1cc69..6c9e9a5aa 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java @@ -1,5 +1,7 @@ package com.yunbao.live.dialog; +import static com.yunbao.common.utils.RouteUtil.PATH_COIN; + import android.app.Dialog; import android.os.Bundle; import android.text.Html; @@ -19,6 +21,7 @@ import androidx.annotation.Nullable; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.makeramen.roundedimageview.RoundedImageView; @@ -34,6 +37,7 @@ import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; @@ -462,7 +466,7 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements private void buy() { DialogUitl.showSimpleDialog(mContext, - String.format(mContext.getString(R.string.guard_buy_tip_3), mTargetBuyBean.getCoin(), mCoinName, mTargetBuyBean.getShopName(getContext())), + String.format(mContext.getString(R.string.guard_buy_tip_3), mTargetBuyBean.getCoin()+"", mCoinName, mTargetBuyBean.getShopName(getContext())), new DialogUitl.SimpleCallback() { @Override @@ -499,6 +503,20 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements } ((LiveActivity) mContext).sendBuyGuardMessage2(votes, guardNum, guardType, ancherName, liveuid); dismiss(); + }else if(code==1002){ + DialogUitl.showSimpleDialog(mContext, msg, new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + dialog.dismiss(); + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }); + return; } ToastUtil.show(msg); } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewWishListDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewWishListDialogFragment.java index f30c46085..b1a7905d0 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewWishListDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewWishListDialogFragment.java @@ -22,6 +22,7 @@ import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; @@ -118,7 +119,7 @@ public class LiveNewWishListDialogFragment extends AbsDialogFragment implements @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { - ToastUtil.show("修改成功"); + ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success"); dismiss(); } else { ToastUtil.show("修改失败" + (msg.isEmpty() ? "" : msg)); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveWishListDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveWishListDialogFragment.java index ca7bd3ae8..12eb62dd7 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveWishListDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveWishListDialogFragment.java @@ -18,6 +18,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; @@ -117,7 +118,7 @@ public class LiveWishListDialogFragment extends AbsDialogFragment implements OnI @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { - ToastUtil.show("修改成功"); + ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success"); dismiss(); } else { ToastUtil.show("修改失败" + (msg.isEmpty() ? "" : msg)); diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java index 8fa494aef..223419aa9 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -57,6 +57,7 @@ import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; @@ -642,6 +643,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onFailed(RTCErrorCode rtcErrorCode) { Log.i("ry", "订阅资源失败: " + rtcErrorCode.getReason()); + ToastUtil.show(mContext.getString(R.string.live_pk_link_error)); } }); } @@ -768,6 +770,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onFailed(RTCErrorCode rtcErrorCode) { Log.i("ry", "订阅资源失败: " + rtcErrorCode.getReason()); + ToastUtil.show(mContext.getString(R.string.live_pk_link_error)); } }); } @@ -855,7 +858,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onSuccess(RCRTCOtherRoom rcrtcOtherRoom) { rcrtcOtherRoom.registerOtherRoomEventsListener(otherRoomEventsListener); - ToastUtil.show("接受成功"); + ToastUtil.show(WordUtil.isNewZh()?"接受成功":"Success"); new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) { @@ -924,6 +927,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onFailed(RTCErrorCode rtcErrorCode) { Log.i("ry", "订阅资源失败: " + rtcErrorCode); + ToastUtil.show(mContext.getString(R.string.live_pk_link_error)); } }); } @@ -973,7 +977,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onSuccess(RCRTCOtherRoom rcrtcOtherRoom) { rcrtcOtherRoom.registerOtherRoomEventsListener(otherRoomEventsListener); - ToastUtil.show("接受成功"); + ToastUtil.show(WordUtil.isNewZh()?"接受成功":"Success"); new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { Log.e("ry", liveid + "来了!!!!" + rcrtcOtherRoom.getRemoteUsers().size()); @@ -1000,6 +1004,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onFailed(RTCErrorCode rtcErrorCode) { Log.e("ry", "订阅资源失败: " + rtcErrorCode); + ToastUtil.show(mContext.getString(R.string.live_pk_link_error)); } }); } @@ -1655,7 +1660,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { } Log.e("ry", "多人接受成功" + mApplyUid); - ToastUtil.show("接受成功"); + ToastUtil.show(WordUtil.isNewZh()?"接受成功":"Success"); //遍历远端用户列表 for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) { Log.e("ry", rcrtcOtherRoom.getRemoteUsers().get(i).getUserId() + "收到rcrtcOtherRoom" + rcrtcOtherRoom.getRemoteUsers().size()); @@ -1773,6 +1778,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onFailed(RTCErrorCode rtcErrorCode) { Log.i("ry", "订阅资源失败: " + rtcErrorCode.getReason()); + ToastUtil.show(mContext.getString(R.string.live_pk_link_error)); } }); //2. 合流画布设置 @@ -1963,6 +1969,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onFailed(RTCErrorCode rtcErrorCode) { Log.i("ry", "订阅资源失败: " + rtcErrorCode.getReason()); + ToastUtil.show(mContext.getString(R.string.live_pk_link_error)); } }); diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index 063d23e0d..5adf63ddc 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -650,6 +650,7 @@ public class SocketRyClient { pkRankBean.setId(Integer.parseInt(item.getString("new_rank_id"))); pkRankBean.setName(item.getString("new_rank_name")); pkRankBean.setImg(item.getString("new_rank_img")); + pkRankBean.setNewRankNameEn(item.getString("new_rank_name_en")); EventBus.getDefault().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.PK_RANK_UPDATE) .setObject(pkRankBean)); diff --git a/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java b/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java index b497b30d3..839be869d 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java @@ -1,10 +1,12 @@ package com.yunbao.live.utils; import android.content.Context; +import android.graphics.Color; import android.os.Handler; import android.os.Looper; import android.util.Log; import android.widget.RelativeLayout; +import android.widget.TextView; import androidx.annotation.NonNull; @@ -18,9 +20,14 @@ import com.google.android.exoplayer2.analytics.AnalyticsListener; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; import com.google.android.exoplayer2.ui.StyledPlayerView; import com.google.android.exoplayer2.video.VideoSize; +import com.lzf.easyfloat.EasyFloat; +import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.R; +import java.util.Timer; +import java.util.TimerTask; + /** * 直播间播放器管理器 * 通过预加载子播放器来实现无缝切换分辨率功能 @@ -40,6 +47,9 @@ public class LiveExoPlayerManager { private static double log_buffer_time = 0, log_buffer_max_time; private String url = ""; private Context mContext; + private TimerTask task; + + TextView debugText; public LiveExoPlayerManager(Context mContext) { this.mContext = mContext; @@ -59,6 +69,109 @@ public class LiveExoPlayerManager { handler = new Handler(Looper.getMainLooper()); setListener(); setAnalyticsListener(); + // createDeBugDialog(); + + } + + int index = 0; + + private void createTask() { + if (task != null) { + return; + } + task = new TimerTask() { + + + @Override + public void run() { + handler.post(new Runnable() { + @Override + public void run() { + try { + if (index > 5 && !player1.isPlaying() && !player2.isPlaying()) { + index = 0; + Log.i(TAG, "5秒内播放器没有播放,重新播放"); + ToastUtil.showDebug("强制重播"); + handler.removeCallbacks(buffRunnable); + replay(); + cancel(); + } else if (player1.isPlaying() || player2.isPlaying()) { + index = 0; + } else { + index++; + } + } catch (Exception e) { + e.printStackTrace(); + cancel(); + task = null; + } + + } + }); + + } + }; + new Timer().schedule(task, 0, 1000); + } + + private TimerTask debugTask; + + private void createDeBugDialog() { + debugText = new TextView(mContext); + debugText.setText(getDebugText()); + debugText.setBackgroundColor(Color.WHITE); + debugText.setTextColor(Color.BLACK); + EasyFloat.with(mContext) + .setTag("debug") + .setLayout(debugText) + .show(); + debugTask = new TimerTask() { + @Override + public void run() { + updateDebug(); + } + }; + new Timer().schedule(debugTask, 0, 500); + } + + private String getDebugText() { + StringBuilder sb = new StringBuilder(); + try { + sb.append("player1: ").append(getPlayStateText(player1)).append("|").append(player1.isPlaying()).append("\n"); + sb.append("player2: ").append(getPlayStateText(player2)).append("|").append(player2.isPlaying()).append("\n"); + sb.append("卡顿计数器:").append(playBufferIndex).append("\n"); + sb.append("强制播放计时器:").append(index).append("\n"); + } catch (Exception e) { + e.printStackTrace(); + EasyFloat.dismiss("debug"); + debugTask.cancel(); + } + + return sb.toString(); + } + + private void updateDebug() { + handler.post(new Runnable() { + @Override + public void run() { + debugText.setText(getDebugText()); + } + }); + } + + private String getPlayStateText(ExoPlayer player) { + switch (player.getPlaybackState()) { + case Player.STATE_READY: + return "STATE_READY"; + case Player.STATE_BUFFERING: + return "STATE_BUFFERING"; + case Player.STATE_ENDED: + return "STATE_ENDED"; + case Player.STATE_IDLE: + return "STATE_IDLE"; + default: + return player.getPlaybackState() + ""; + } } @@ -171,6 +284,7 @@ public class LiveExoPlayerManager { if (listener != null) { listener.onIsPlayingChanged(true); } + createTask(); } } @@ -245,6 +359,7 @@ public class LiveExoPlayerManager { if (listener != null) { listener.onIsPlayingChanged(true); } + createTask(); } } @@ -279,7 +394,12 @@ public class LiveExoPlayerManager { * @param url 地址 */ public void startUrl(String url) { - if (url != null && url.equals(this.url)) return; + if (!StringUtil.isEmpty(url) && url.equals(this.url)) return; + if (task != null) { + task.cancel(); + task = null; + } + Log.i(TAG, "startUrl: " + url + " > " + mainView.getResizeMode()); handler.removeCallbacks(buffRunnable); this.url = url; @@ -302,7 +422,11 @@ public class LiveExoPlayerManager { * @param url 地址 */ public void switchUrl(String url) { - if (url != null && url.equals(this.url)) return; + if (!StringUtil.isEmpty(url) && url.equals(this.url)) return; + if (task != null) { + task.cancel(); + task = null; + } Log.i(TAG, "switchUrl: " + url + " src : " + this.url); this.url = url; playBufferIndex = 0; @@ -351,6 +475,10 @@ public class LiveExoPlayerManager { if (getNextPlayer() != null && getNextPlayer().isPlaying()) { getNextPlayer().stop(); } + if (task != null) { + task.cancel(); + task = null; + } clearUrl(); } @@ -369,6 +497,14 @@ public class LiveExoPlayerManager { if (getNextPlayer() != null) { getNextPlayer().stop(); } + if (listener != null) { + listener.onPlaybackStateChanged(Player.STATE_IDLE); + } + handler.removeCallbacks(buffRunnable); + if (task != null) { + task.cancel(); + task = null; + } String tmp = url; url = null; startUrl(tmp); @@ -394,6 +530,13 @@ public class LiveExoPlayerManager { player2.clearVideoSurface(); player2.release(); } + if (task != null) { + task.cancel(); + task = null; + } + if (debugTask != null) { + debugTask.cancel(); + } player1 = null; player2 = null; mainView.setKeepContentOnPlayerReset(false); diff --git a/live/src/main/java/com/yunbao/live/views/LiveLinkMicPkViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveLinkMicPkViewHolder.java index 94487fe74..2d523138a 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveLinkMicPkViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveLinkMicPkViewHolder.java @@ -157,7 +157,7 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { Log.i("女神说", "倒计时状态:" + s); - if (mTime.getVisibility() == View.VISIBLE) { + if (mTime.getVisibility() == View.VISIBLE && !s.toString().contains(mContext.getString(R.string.live_pk_time_2))) { EventBus.getDefault().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.LIVE_PK_ING)); } @@ -218,7 +218,7 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder { if (mTime != null) { Log.i("vvvs", content); if (content.trim().equals("00:00")) { - mTime.setText("結算中"); + mTime.setText(WordUtil.isNewZh()?"結算中":"waiting"); } else { mTime.setText(content); } diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java index d450c23af..1cc6f6313 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -689,13 +689,13 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } }); } else if ("inviteMic".equals(str)) { - String content="邀請您進行語音連麥"; - String confirm="接受"; - String cancel="拒絕"; - if(!WordUtil.isNewZh()){ - content="You are invited to join the voice connection"; - confirm="accept"; - cancel="cancel"; + String content = "邀請您進行語音連麥"; + String confirm = "接受"; + String cancel = "拒絕"; + if (!WordUtil.isNewZh()) { + content = "You are invited to join the voice connection"; + confirm = "accept"; + cancel = "cancel"; } DialogUitl.Builder builder = new DialogUitl.Builder(mContext) .setContent(content) @@ -708,12 +708,12 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { public void onConfirmClick(Dialog dialog, String content) { String[] permissions; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - permissions=new String[]{ + permissions = new String[]{ Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.RECORD_AUDIO }; - }else{ - permissions=new String[]{ + } else { + permissions = new String[]{ Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO @@ -780,9 +780,9 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { onPrepared(); rcrtcRoom = null; MicStatusManager.getInstance().clear(); - if(WordUtil.isNewZh()) { + if (WordUtil.isNewZh()) { ToastUtil.show("已成功退出語音連麥"); - }else{ + } else { ToastUtil.show("You have successfully exited the voice connection"); } resumePlay(); @@ -867,10 +867,10 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } private void showToast() { - if(WordUtil.isNewZh()) { + if (WordUtil.isNewZh()) { DialogUitl.showToast(mContext, "設置成功\n" + "正在為你轉換中", 3000); - }else{ + } else { DialogUitl.showToast(mContext, "successful\n" + "It's being converted for you", 3000); } @@ -1007,7 +1007,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { @Override public void onFailed(RTCErrorCode errorCode) { Log.e("ry", userinputStreamList.size() + LiveActivity.mLiveUid + "订阅失败" + errorCode.toString()); - + ToastUtil.show(mContext.getString(R.string.live_pk_link_error)); } @Override @@ -1045,6 +1045,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { @Override public void onFailed(RTCErrorCode rtcErrorCode) { Log.e("ry", "远端失败" + list.size()); + ToastUtil.show(mContext.getString(R.string.live_pk_link_error)); } }); } @@ -1197,6 +1198,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { @Override public void onFailed(RTCErrorCode rtcErrorCode) { Log.e("ry", "订阅资源失败: " + rtcErrorCode.getReason()); + ToastUtil.show(mContext.getString(R.string.live_pk_link_error)); } }); } @@ -1285,6 +1287,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { Player.Listener.super.onIsPlayingChanged(isPlaying); if (isPlaying) { hideCover(); + mLoading.setVisibility(View.INVISIBLE); Log.i(TAG, "onIsPlayingChanged: 开始播放 | waitNextUrl = " + waitNextUrl); OkDownload.getInstance().startAll(); if (loadingListener != null) { diff --git a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java index daa33924a..36b819374 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java @@ -76,6 +76,7 @@ import cn.rongcloud.rtc.api.RCRTCMixConfig; import cn.rongcloud.rtc.api.RCRTCRemoteUser; import cn.rongcloud.rtc.api.RCRTCRoom; import cn.rongcloud.rtc.api.RCRTCRoomConfig; +import cn.rongcloud.rtc.api.callback.IRCRTCEngineEventListener; import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback; import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback; import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener; @@ -85,6 +86,7 @@ import cn.rongcloud.rtc.api.stream.RCRTCVideoStreamConfig; import cn.rongcloud.rtc.api.stream.RCRTCVideoView; import cn.rongcloud.rtc.base.RCRTCParamsType; import cn.rongcloud.rtc.base.RCRTCRoomType; +import cn.rongcloud.rtc.base.RCRTCVideoEventCode; import cn.rongcloud.rtc.base.RTCErrorCode; import cn.rongcloud.rtc.core.CameraVideoCapturer; import cn.rongcloud.rtc.core.RendererCommon; @@ -123,6 +125,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX private ImageView avatarOther; private LinearLayout goto_room_view; private boolean isPk = false; + private boolean isNeedOpenCamera = false; //修改上面主播的头像 @Subscribe(threadMode = ThreadMode.MAIN) @@ -175,7 +178,8 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX @Override public void onFailed(RTCErrorCode rtcErrorCode) { - Log.e("ry", "远端失败" + list.size()); + Log.e("ry", "远端失败" + list.size() + "|errorCode:" + rtcErrorCode.toString()); + ToastUtil.show(mContext.getString(R.string.live_pk_link_error)); } }); } @@ -494,9 +498,10 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX btn_close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - DialogUitl.showSimpleDialog(mContext, "是否要斷開連麥?", new DialogUitl.SimpleCallback() { + DialogUitl.showSimpleDialog(mContext, WordUtil.isNewZh() ? "是否要斷開連麥?" : "Do you want to disconnect Link?", new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { + Log.i("PK----->", "updateSub: " + isPk + "|"); aheadOfScheduleEndPK(mPkUid, CommonAppConfig.getInstance().getUserBean().getUserNiceName(), (String) tv_avatarOther_name.getTag()); //断开连麦 LiveRyAnchorActivity.isDRPK = 0; @@ -693,10 +698,34 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX //设置摄像头最大缩放比例 boolean zoom = RCRTCEngine.getInstance().getDefaultVideoStream().setCameraZoomFactor(1.0f); // ToastUtil.show("设置比例="+zoom); + Log.i("摄像头", "onSuccess: 打开摄像头"); + isNeedOpenCamera = false; } @Override public void onFailed(RTCErrorCode errorCode) { + Log.i("摄像头", "onFailed: 打开摄像头失败 " + errorCode); + } + }); + RCRTCEngine.getInstance().registerEventListener(new IRCRTCEngineEventListener() { + @Override + public void onKicked(String roomId, RCRTCParamsType.RCRTCKickedReason kickedReason) { + + } + + @Override + public void onError(RTCErrorCode errorCode) { + super.onError(errorCode); + Log.i("摄像头", "onError: 错误码" + errorCode); + } + + @Override + public void onLocalVideoEventNotify(RCRTCVideoEventCode event) { + super.onLocalVideoEventNotify(event); + Log.i("摄像头", "onLocalVideoEventNotify: 本地视频事件" + event.code); + if (event == RCRTCVideoEventCode.END_CAMERA_ERROR_UNKNOWN) { + isNeedOpenCamera = true; + } } }); //设置摄像头最大缩放比例 @@ -916,6 +945,24 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX @Override public void onResume() { mPaused = false; + Log.i("摄像头", "onResume: " + isNeedOpenCamera); + if(isNeedOpenCamera){ + RCRTCEngine.getInstance().getDefaultVideoStream().startCamera(new IRCRTCResultDataCallback() { + @Override + public void onSuccess(Boolean data) { + //设置摄像头最大缩放比例 + boolean zoom = RCRTCEngine.getInstance().getDefaultVideoStream().setCameraZoomFactor(1.0f); + // ToastUtil.show("设置比例="+zoom); + Log.i("摄像头", "onSuccess: 打开摄像头"); + isNeedOpenCamera = false; + } + + @Override + public void onFailed(RTCErrorCode errorCode) { + Log.i("摄像头", "onFailed: 打开摄像头失败 " + errorCode); + } + }); + } } @Override @@ -1055,5 +1102,6 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX } else if (event.getType() == LIVE_PK_ING) { isPk = true; } + Log.i("PK----->", "updateSub: " + isPk + "|" + event.getType()); } } diff --git a/live/src/main/java/com/yunbao/live/views/LivePushTxViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushTxViewHolder.java index 8cd662aef..e4213577c 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushTxViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushTxViewHolder.java @@ -36,6 +36,7 @@ import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.L; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.common.http.LiveHttpConsts; @@ -103,7 +104,7 @@ public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLi btn_close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - DialogUitl.showSimpleDialog(mContext, "是否要斷開連麥?", new DialogUitl.SimpleCallback() { + DialogUitl.showSimpleDialog(mContext, WordUtil.isNewZh()?"是否要斷開連麥?":"Do you want to disconnect Link?", new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { //断开连麦 diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 4e95f3d8d..268c5234f 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -462,7 +462,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } else if ("checkNewLetter".equals(str)) { checkNewLetter(); - }else if("exitFansGroup".equals(str)){ + } else if ("exitFansGroup".equals(str)) { setFansGroup("0"); } } @@ -1818,7 +1818,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis .append("&isZh=") .append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); } - if (htmlUrl.toString().contains("StarChallenge")){ + if (htmlUrl.toString().contains("StarChallenge")) { Map map_ekv = new HashMap(); map_ekv.put("link", htmlUrl.toString()); MobclickAgent.onEvent(mContext, "live_room_star", map_ekv); @@ -1890,7 +1890,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis .append("&isZh=") .append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); } - if (htmlUrl.toString().contains("StarChallenge")){ + if (htmlUrl.toString().contains("StarChallenge")) { Map map_ekv = new HashMap(); map_ekv.put("link", htmlUrl.toString()); MobclickAgent.onEvent(mContext, "live_room_star", map_ekv); @@ -2341,11 +2341,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } if (Integer.parseInt(bean.getRedVal()) > 2) { mRedVal.setVisibility(View.VISIBLE); - mRedVal.setText(bean.getRedVal() + "連勝"); + mRedVal.setText(bean.getRedVal() + (WordUtil.isNewZh()?"連勝":"Win")); } if (Integer.parseInt(bean.getBlueVal()) > 2) { mBlueVal.setVisibility(View.VISIBLE); - mBlueVal.setText(bean.getBlueVal() + "連勝"); + mBlueVal.setText(bean.getBlueVal() + (WordUtil.isNewZh()?"連勝":"Win")); } mPkRankTopIcon.setVisibility(View.VISIBLE); ImgLoader.display(mContext, bean.getPkTopImgUrl(), mPkRankTopIcon); @@ -2392,7 +2392,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } private void updatePkRank(PkRankBean bean) { - mPkRankText.setText(bean.getName()); + if (WordUtil.isNewZh()) { + mPkRankText.setText(bean.getName()); + } else { + mPkRankText.setText(bean.getNewRankNameEn()); + } ImgLoader.display(mContext, bean.getImg(), mPkRankIcon); } @@ -4160,7 +4164,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void onBannerClick(List datas, int p) { - if (TextUtils.equals("特惠首冲", mBannerList4.get(p).getName())){ + if (TextUtils.equals("特惠首冲", mBannerList4.get(p).getName())) { Map map_ekv = new HashMap(); map_ekv.put("link", mBannerList4.get(p).getLink()); diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 11b15b2ec..2973e84cb 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -64,6 +64,7 @@ import com.yunbao.common.http.LiveHttpConsts; import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.manager.OpenAdManager; import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; @@ -271,6 +272,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public void run() { loading.setVisibility(View.GONE); enterRoomLeaveHandler.post(enterRoomLeaveRunnable); + OpenAdManager.getInstance().show(OpenAdManager.TYPE_LIVE, LiveGuardInfo.isGuard(mLiveGuardInfo)); } }; final Runnable loadTimeoutRunnableGone = new Runnable() { @@ -302,7 +304,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRyLinkMicPkPresenter.release(); mLiveRyLinkMicPkPresenter = null; } - + OpenAdManager.getInstance().dismiss(); mLiveBean = data; mLiveSDK = liveSdk; mLiveType = liveType; @@ -690,7 +692,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } AppManager.runDebugCode(() -> { - liveHandler.postDelayed(loadTimeoutRunnableGone, 1_000); + // liveHandler.postDelayed(loadTimeoutRunnableGone, 1_000); }); liveHandler.postDelayed(loadTimeoutRunnableGone, 15_000); if (TextUtils.equals(data.getEnterRoomInfo().getIsconnection(), "1")) { @@ -2119,4 +2121,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.setGiftWall(giftWallLightenNumber, giftWallLightenTotal); } } + + public boolean isEnterRoom() { + return isEnterRoom; + } } diff --git a/live/src/main/res/layout/dialog_fans_group_buy.xml b/live/src/main/res/layout/dialog_fans_group_buy.xml index 88dde5508..6c933439d 100644 --- a/live/src/main/res/layout/dialog_fans_group_buy.xml +++ b/live/src/main/res/layout/dialog_fans_group_buy.xml @@ -48,15 +48,17 @@ + app:layout_constraintTop_toBottomOf="@+id/giftName" /> @@ -504,13 +504,15 @@ android:layout_width="24dp" android:layout_height="24dp" android:layout_marginEnd="5dp" - android:layout_marginStart="2dp" + android:layout_marginStart="7dp" android:src="@mipmap/img_fans_default" android:visibility="invisible" /> @@ -9,7 +10,7 @@ diff --git a/live/src/main/res/layout/view_link_mic_pk.xml b/live/src/main/res/layout/view_link_mic_pk.xml index bf94be235..1708a0dc5 100644 --- a/live/src/main/res/layout/view_link_mic_pk.xml +++ b/live/src/main/res/layout/view_link_mic_pk.xml @@ -1,6 +1,7 @@ @@ -159,17 +160,19 @@ + android:visibility="invisible" + tools:visibility="visible" /> diff --git a/live/src/main/res/layout/view_live_push_tx.xml b/live/src/main/res/layout/view_live_push_tx.xml index 7d844dd5b..c4cf37ed2 100644 --- a/live/src/main/res/layout/view_live_push_tx.xml +++ b/live/src/main/res/layout/view_live_push_tx.xml @@ -135,7 +135,7 @@ android:paddingTop="5dp" android:paddingRight="8dp" android:paddingBottom="5dp" - android:text="結束連麥" + android:text="@string/live_link_mic_3" android:textColor="@color/color_white" android:textSize="13sp" android:visibility="gone" /> diff --git a/live/src/main/res/layout/view_live_search_list_empty.xml b/live/src/main/res/layout/view_live_search_list_empty.xml index 6c4319be8..f0119cbb7 100644 --- a/live/src/main/res/layout/view_live_search_list_empty.xml +++ b/live/src/main/res/layout/view_live_search_list_empty.xml @@ -19,7 +19,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="25dp" - android:text="沒有找到匹配結果~" + android:text="@string/live_free_pk_empty_tips" android:textColor="#C4C4C4" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/live/src/main/res/layout/view_noble_seat.xml b/live/src/main/res/layout/view_noble_seat.xml index 0bafa7619..738e26e86 100644 --- a/live/src/main/res/layout/view_noble_seat.xml +++ b/live/src/main/res/layout/view_noble_seat.xml @@ -8,7 +8,7 @@ @@ -28,14 +28,13 @@ diff --git a/live/src/main/res/values-en/strings.xml b/live/src/main/res/values-en/strings.xml index f7a06979e..00b2440af 100644 --- a/live/src/main/res/values-en/strings.xml +++ b/live/src/main/res/values-en/strings.xml @@ -45,7 +45,7 @@ Release cancel send No recording has been recognized in over 10 seconds Identity privilege - Nobleman\'s seat + VIP seats %s applies for connected wheat. Check whether The wheat has been kicked off An invitation has been sent and is waiting for the user to accept 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 b53cdb8c4..1693facbf 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -88,6 +88,7 @@ import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.APKManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.NoviceInstructorManager; +import com.yunbao.common.manager.OpenAdManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; @@ -210,13 +211,14 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene @Override protected void onPause() { super.onPause(); - + OpenAdManager.getInstance().dismiss(); } @Override protected void main() { ActivityCompat.postponeEnterTransition(this); ConversationIMListManager.get(this); + OpenAdManager.getInstance(); //在请求一下这个接口给我后台版本号 CommonHttpUtil.getConfig(mContext, new CommonCallback() { @Override @@ -526,7 +528,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene //获取指导员账号 ConversationIMListManager.get(this).getUserInstructor(this); checkVersion(); - } @Override @@ -875,7 +876,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene NoviceInstructorManager.get(mContext).getNoviceInstructor(); NoviceInstructorManager.get(mContext).checktHomeZdyPop(); initAnchorRecommendBanner(); - + OpenAdManager.getInstance().show(OpenAdManager.TYPE_HOME, false); } /** @@ -1074,6 +1075,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene if (EasyFloat.isShow("LiveFloatView")) { EasyFloat.dismiss("LiveFloatView", true); } + OpenAdManager.getInstance().reset(); super.onBackPressed(); } } diff --git a/main/src/main/java/com/yunbao/main/dialog/EncourageDialog.java b/main/src/main/java/com/yunbao/main/dialog/EncourageDialog.java index f4d5a6cd7..3ba19ec60 100644 --- a/main/src/main/java/com/yunbao/main/dialog/EncourageDialog.java +++ b/main/src/main/java/com/yunbao/main/dialog/EncourageDialog.java @@ -1,11 +1,16 @@ package com.yunbao.main.dialog; +import static com.yunbao.common.utils.RouteUtil.PATH_COIN; + import android.annotation.SuppressLint; +import android.app.Dialog; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Bundle; + import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; + import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; @@ -16,12 +21,14 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.fastjson.JSON; import com.makeramen.roundedimageview.RoundedImageView; import com.yunbao.common.Constants; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.main.R; @@ -265,8 +272,23 @@ public class EncourageDialog extends AbsDialogFragment implements View.OnClickLi public void onSuccess(int code, String msg, String[] info) { if (code == 0) { dismiss(); + } else if (code == 1001) { + DialogUitl.showSimpleDialog(mContext, msg, new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + dialog.dismiss(); + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }); + } else { + ToastUtil.show(msg); } - ToastUtil.show(msg); + } }); diff --git a/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java b/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java index a1d00bb64..be982713c 100644 --- a/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java +++ b/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java @@ -244,7 +244,7 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O LiveHttpUtil.getLiveSdk(mGetLiveSdkCallback); }); } else { - String tips="需要下载开播插件,是否下载"; + String tips="需要下載開播插件,是否下載"; if(!WordUtil.isNewZh()){ tips="You need to download the plug-in, whether to download"; }