diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 210add6e1..6f4878418 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -82,6 +82,10 @@ + + + + listInfoMessageModels = new ArrayList<>(); + + public LiveSystemMessageAdapter(Context mContext) { + this.mContext = mContext; + mInflater = LayoutInflater.from(mContext); + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new LiveSystemMessageViewHolder(mInflater.inflate(R.layout.view_live_system_message, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + LiveSystemMessageViewHolder messageViewHolder = (LiveSystemMessageViewHolder) holder; + messageViewHolder.setViewData(listInfoMessageModels.get(position)); + } + + @Override + public int getItemCount() { + return listInfoMessageModels.size(); + } + + public void addData(List list) { + listInfoMessageModels.addAll(list); + notifyDataSetChanged(); + + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/ListInfoMessageModel.java b/common/src/main/java/com/yunbao/common/bean/ListInfoMessageModel.java new file mode 100644 index 000000000..3261a8c1b --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/ListInfoMessageModel.java @@ -0,0 +1,96 @@ +package com.yunbao.common.bean; + +import android.text.TextUtils; + +import com.google.gson.annotations.SerializedName; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public class ListInfoMessageModel extends BaseModel { + @SerializedName("id") + private int id; + @SerializedName("title") + private String title; + @SerializedName("banner") + private String banner; + @SerializedName("content") + private String content; + @SerializedName("link") + private String link; + @SerializedName("addtime") + private String addtime; + + public int getId() { + return id; + } + + public ListInfoMessageModel setId(int id) { + this.id = id; + return this; + } + + public String getTitle() { + return title; + } + + public ListInfoMessageModel setTitle(String title) { + this.title = title; + return this; + } + + public String getBanner() { + return banner; + } + + public ListInfoMessageModel setBanner(String banner) { + this.banner = banner; + return this; + } + + public String getContent() { + return content; + } + + public ListInfoMessageModel setContent(String content) { + this.content = content; + return this; + } + + public String getLink() { + return link; + } + + public ListInfoMessageModel setLink(String link) { + this.link = link; + return this; + } + + public String getAddtime() { + return addtime; + } + + public ListInfoMessageModel setAddtime(String addtime) { + this.addtime = addtime; + return this; + } + + /** + * 会话列表展示时间 + */ + public String getLastDate(String type) { + if (!TextUtils.isEmpty(addtime) && !TextUtils.equals(addtime, "0")) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + Date currenTimeZone; + if (TextUtils.equals(type, "-1")) { + currenTimeZone = new Date(Long.parseLong(addtime)); + } else { + currenTimeZone = new Date(Long.parseLong(addtime + "000")); + } + return sdf.format(currenTimeZone); + } else { + return ""; + } + + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/LiveDataInfoModel.java b/common/src/main/java/com/yunbao/common/bean/LiveDataInfoModel.java new file mode 100644 index 000000000..a6c3b203e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LiveDataInfoModel.java @@ -0,0 +1,106 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +/** + * 直播数据 + */ +public class LiveDataInfoModel extends BaseModel{ + @SerializedName("totalCoin") + private long totalCoin;//钻石数量 + @SerializedName("totalGold") + private long totalGold;//金币数量 + @SerializedName("acceptNum") + private long acceptNum;//送礼人数 + @SerializedName("enterNum") + private long enterNum;//进场人数 + @SerializedName("attentionNum") + private long attentionNum;//关注人数 + @SerializedName("fanGroupNum") + private long fanGroupNum;//粉丝团人数 + @SerializedName("attentionNumRate") + private double attentionNumRate;//关注转化率 + @SerializedName("fanGroupNumRate") + private double fanGroupNumRate;//粉丝团转化率 + + public LiveDataInfoModel() { + } + + public long getTotalCoin() { + return totalCoin; + } + + public void setTotalCoin(long totalCoin) { + this.totalCoin = totalCoin; + } + + public long getTotalGold() { + return totalGold; + } + + public void setTotalGold(long totalGold) { + this.totalGold = totalGold; + } + + public long getAcceptNum() { + return acceptNum; + } + + public void setAcceptNum(long acceptNum) { + this.acceptNum = acceptNum; + } + + public long getEnterNum() { + return enterNum; + } + + public void setEnterNum(long enterNum) { + this.enterNum = enterNum; + } + + public long getAttentionNum() { + return attentionNum; + } + + public void setAttentionNum(long attentionNum) { + this.attentionNum = attentionNum; + } + + public long getFanGroupNum() { + return fanGroupNum; + } + + public void setFanGroupNum(long fanGroupNum) { + this.fanGroupNum = fanGroupNum; + } + + public double getAttentionNumRate() { + return attentionNumRate; + } + + public void setAttentionNumRate(double attentionNumRate) { + this.attentionNumRate = attentionNumRate; + } + + public double getFanGroupNumRate() { + return fanGroupNumRate; + } + + public void setFanGroupNumRate(double fanGroupNumRate) { + this.fanGroupNumRate = fanGroupNumRate; + } + + @Override + public String toString() { + return "LiveDataInfoModel{" + + "totalCoin=" + totalCoin + + ", totalGold=" + totalGold + + ", acceptNum=" + acceptNum + + ", enterNum=" + enterNum + + ", attentionNum=" + attentionNum + + ", fanGroupNum=" + fanGroupNum + + ", attentionNumRate=" + attentionNumRate + + ", fanGroupNumRate=" + fanGroupNumRate + + '}'; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/LiveTaskModel.java b/common/src/main/java/com/yunbao/common/bean/LiveTaskModel.java new file mode 100644 index 000000000..401be64fc --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LiveTaskModel.java @@ -0,0 +1,259 @@ +package com.yunbao.common.bean; + + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.R; +import com.yunbao.common.utils.StringUtil; +import com.yunbao.common.utils.WordUtil; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Locale; + +/** + * 直播任务 + */ +public class LiveTaskModel extends BaseModel { + public static final int TASK_TYPE_TIP = 0; + public static final int TASK_TYPE_ITEM = 1; + + int type; + @SerializedName("new") + NewUser user; + @SerializedName("list") + List> list; + + public LiveTaskModel() { + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public NewUser getUser() { + return user; + } + + public void setUser(NewUser user) { + this.user = user; + } + + public List> getList() { + if (user != null && user.isNew()) { + for (List tasks : list) { + for (Task task : tasks) { + task.isNewUser = true; + } + } + } + return list; + } + + public void setList(List> list) { + this.list = list; + } + + @Override + public String toString() { + return "LiveTaskModel{" + + "type=" + type + + ", user=" + user + + ", list=" + list + + '}'; + } + + public static class NewUser { + @SerializedName("isNew") + private int isNew; + @SerializedName("endTime") + private String endTime; + + public NewUser() { + } + + public boolean isNew() { + return isNew == 1; + } + + public void setNew(int aNew) { + isNew = aNew; + } + + public String getEndTime() { + if (!StringUtil.isEmpty(endTime)) { + endTime = WordUtil.getString(R.string.live_task_new_user_timer) + new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.getDefault()).format(new Date(Long.parseLong(endTime) * 1000)); + } + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + @Override + public String toString() { + return "NewUser{" + + "isNew=" + isNew + + ", endTime='" + endTime + '\'' + + '}'; + } + } + + public static class Task implements Serializable { + @SerializedName("id") + private int id; + @SerializedName("type") + private int type; + @SerializedName("task_type") + private int taskType; + @SerializedName("task_name") + private String taskName; + @SerializedName("task_num") + private int taskNum; + @SerializedName("hot") + private long hot; + @SerializedName("exp") + private long exp; + @SerializedName("new_hot") + private long newUserHot; + @SerializedName("new_exp") + private long newUserExp; + @SerializedName("sort") + private int sort; + @SerializedName("status") + private int status; + + @SerializedName("now_num") + private int nowValue; + + private boolean isNewUser = false; + + public Task() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public int getTaskType() { + return taskType; + } + + public void setTaskType(int taskType) { + this.taskType = taskType; + } + + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + + public int getTaskNum() { + return taskNum; + } + + public void setTaskNum(int taskNum) { + this.taskNum = taskNum; + } + + public long getHot() { + if (isNewUser) { + hot = newUserHot; + } + return hot; + } + + public void setHot(long hot) { + this.hot = hot; + } + + public long getExp() { + if (isNewUser) { + exp = newUserExp; + } + return exp; + } + + public void setExp(long exp) { + this.exp = exp; + } + + public long getNewUserHot() { + return newUserHot; + } + + public void setNewUserHot(long newUserHot) { + this.newUserHot = newUserHot; + } + + public long getNewUserExp() { + return newUserExp; + } + + public void setNewUserExp(long newUserExp) { + this.newUserExp = newUserExp; + } + + public int getSort() { + return sort; + } + + public void setSort(int sort) { + this.sort = sort; + } + + public boolean getStatus() { + return status == 1; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getNowValue() { + return nowValue; + } + + public void setNowValue(int nowValue) { + this.nowValue = nowValue; + } + + @Override + public String toString() { + return "Task{" + + "id=" + id + + ", type=" + type + + ", taskType=" + taskType + + ", taskName='" + taskName + '\'' + + ", taskNum=" + taskNum + + ", hot=" + hot + + ", exp=" + exp + + ", newUserHot=" + newUserHot + + ", newUserExp=" + newUserExp + + ", sort=" + sort + + ", status=" + status + + '}'; + } + } +} diff --git a/common/src/main/java/com/yunbao/common/custom/TabButtonGroup.java b/common/src/main/java/com/yunbao/common/custom/TabButtonGroup.java index 6f8d14c52..d2e0c7682 100644 --- a/common/src/main/java/com/yunbao/common/custom/TabButtonGroup.java +++ b/common/src/main/java/com/yunbao/common/custom/TabButtonGroup.java @@ -75,6 +75,9 @@ public class TabButtonGroup extends LinearLayout implements View.OnClickListener } } + public int getCurPosition() { + return mCurPosition; + } @Override public void onClick(View v) { diff --git a/common/src/main/java/com/yunbao/common/dialog/AbsDialogPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/AbsDialogPopupWindow.java new file mode 100644 index 000000000..150ca86e7 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/AbsDialogPopupWindow.java @@ -0,0 +1,33 @@ +package com.yunbao.common.dialog; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.lxj.xpopup.core.BottomPopupView; + + +public abstract class AbsDialogPopupWindow extends BottomPopupView { + private final Context mContext; + + public AbsDialogPopupWindow(@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); + buildDialog(builder); + builder.asCustom(this).show(); + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/YoursystemisolderDialog.java b/common/src/main/java/com/yunbao/common/dialog/YoursystemisolderDialog.java new file mode 100644 index 000000000..b3aa2ed28 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/YoursystemisolderDialog.java @@ -0,0 +1,74 @@ +package com.yunbao.common.dialog; + +import android.os.Bundle; +import android.text.TextUtils; +import android.view.Gravity; +import android.view.Window; +import android.view.WindowManager; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentManager; + +import com.yunbao.common.R; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class YoursystemisolderDialog extends AbsDialogFragment { + @Override + protected int getLayoutId() { + return R.layout.view_yoursystemisolder; + } + + @Override + protected int getDialogStyle() { + return R.style.dialog; + } + + @Override + protected boolean canCancel() { + return false; + } + + @Override + protected void setWindowAttributes(Window window) { + window.setWindowAnimations(R.style.bottomToTopAnim); + WindowManager.LayoutParams params = window.getAttributes(); + params.width = DpUtil.dp2px(277); + params.height = DpUtil.dp2px(134); + params.gravity = Gravity.CENTER; + window.setAttributes(params); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + TextView hint = (TextView) findViewById(R.id.hint); + TextView toSetUp = (TextView) findViewById(R.id.to_set_up); + TextView knowThe = (TextView) findViewById(R.id.know_the); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.know_the), () -> dismiss()); + } + + @Override + public void show(@NonNull FragmentManager manager, @Nullable String tag) { + try { + super.show(manager, tag); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private YoursystemisolderDialog.HintListener listener; + + public YoursystemisolderDialog setListener(YoursystemisolderDialog.HintListener listener) { + this.listener = listener; + return this; + } + + public interface HintListener { + void requestPermission(); + } +} diff --git a/common/src/main/java/com/yunbao/common/event/AnchorInfoEvent.java b/common/src/main/java/com/yunbao/common/event/AnchorInfoEvent.java index e15712cc0..f13719d78 100644 --- a/common/src/main/java/com/yunbao/common/event/AnchorInfoEvent.java +++ b/common/src/main/java/com/yunbao/common/event/AnchorInfoEvent.java @@ -44,4 +44,14 @@ public class AnchorInfoEvent { public void setClear(boolean clear) { this.clear = clear; } + + @Override + public String toString() { + return "AnchorInfoEvent{" + + "clear=" + clear + + ", id='" + id + '\'' + + ", userNiceName='" + userNiceName + '\'' + + ", avatar='" + avatar + '\'' + + '}'; + } } 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 50fd3d6a0..5d269d74e 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -12,10 +12,13 @@ import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LinkMicUserBeanV2; +import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.LiveAiRobotBean; +import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.LiveStetUpStatusModel; +import com.yunbao.common.bean.LiveTaskModel; import com.yunbao.common.bean.MsgSwitchDetailModel; import com.yunbao.common.bean.NewPeopleInfo; import com.yunbao.common.bean.NobleRankHideUserListModel; @@ -537,4 +540,39 @@ public interface PDLiveApi { Observable> getLiveStetUpStatus( @Query("liveuid") String liveUid ); + + @GET("/api/public/?service=live.jieshuDRPK") + Observable> jieshuDRPK( + @Query("roomid") String roomId, + @Query("uid") String uid); + + @GET("/api/public/?service=Message.getListInfo") + Observable>> getListInfo( + @Query("type") String type, + @Query("p") int p); + + /** + * 获取主播任务列表 + */ + @GET("/api/public/?service=Live.getLiveTaskStatus") + Observable> getLiveTaskList( + @Query("type") int type, + @Query("liveuid") String liveUid + ); + + /** + * 获取直播数据 + */ + @GET("/api/public/?service=Live.getLiveStatisticalData") + Observable> getLiveDataInfo( + @Query("liveuid") String liveUid + ); + + /** + * 获取直播数据 + */ + @GET("/api/public/?service=Message.getAnchorMsg") + Observable>> getAnchorMsg( + @Query("liveuid") String liveUid, @Query("page") int page, @Query("limit") int limit + ); } 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 fee7cbbc5..89ac477d5 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 @@ -14,10 +14,13 @@ import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LinkMicUserBeanV2; +import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.LiveAiRobotBean; +import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.LiveStetUpStatusModel; +import com.yunbao.common.bean.LiveTaskModel; import com.yunbao.common.bean.NobleRankHideUserListModel; import com.yunbao.common.bean.NobleTrumpetModel; import com.yunbao.common.bean.PkRankBean; @@ -1063,6 +1066,85 @@ public class LiveNetManager { }).isDisposed(); } + public void jieshuDRPK(String uID) { + API.get().pdLiveApi(mContext) + .jieshuDRPK(uID, uID) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(baseModelResponseModel -> { + + }, throwable -> { + + }).isDisposed(); + } + + public void getListInfo(String type, int p, HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .getListInfo(type, p) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + callback.onSuccess(listResponseModel.getData().getInfo()); + }, throwable -> { + callback.onError(throwable.getMessage()); + }).isDisposed(); + } + + /** + * 获取直播任务 + * + * @param type 1 直播任务 2粉丝任务 + */ + public void getLiveTask(int type, String liveUid, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getLiveTaskList(type, liveUid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + callback.onSuccess(listResponseModel.getData().getInfo()); + }, throwable -> { + callback.onError(throwable.getMessage()); + }).isDisposed(); + } + + /** + * 获取直播数据 + */ + public void getLiveData(String liveUid, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getLiveDataInfo(liveUid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + callback.onSuccess(listResponseModel.getData().getInfo()); + }, throwable -> { + callback.onError(throwable.getMessage()); + }).isDisposed(); + } + + /** + * 获取主播消息 + * + * @param liveUid 直播间id + * @param page 页码 + * @param callback 回调 + */ + public void getAnchorMsg(String liveUid, int page, HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .getAnchorMsg(liveUid, page, 10) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + }, throwable -> { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + }).isDisposed(); + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index 301dc6302..bede5737f 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -2,6 +2,7 @@ package com.yunbao.common.manager; import android.app.Activity; import android.content.Context; +import android.os.Build; import android.os.Handler; import android.text.TextUtils; @@ -40,7 +41,15 @@ public class IMLoginManager extends BaseCacheManager { private final String IS_HINT2 = "is_hint2"; private final String SELECT_CLARITY = "selectClarity"; private final String CLARITY = "clarity"; + private final String xiaJBG = "xiaJBG"; + public void setXiaJBG(boolean xjbg) { + put(xiaJBG, xjbg); + } + + public boolean IsXiaJBG() { + return getBoolean(xiaJBG, false); + } public void setClarity(String clarity) { put(CLARITY, clarity); @@ -276,11 +285,12 @@ public class IMLoginManager extends BaseCacheManager { } public boolean isMountEffect() { - return getBoolean(MountEffect, true); + + return getBoolean(MountEffect, !(Build.VERSION.SDK_INT < Build.VERSION_CODES.O)); } public boolean isGiftEffect() { - return getBoolean(GiftEffect, true); + return getBoolean(GiftEffect, !(Build.VERSION.SDK_INT < Build.VERSION_CODES.O)); } /** diff --git a/common/src/main/java/com/yunbao/common/manager/RandomPkManager.java b/common/src/main/java/com/yunbao/common/manager/RandomPkManager.java index cd4a847b5..da756f4c8 100644 --- a/common/src/main/java/com/yunbao/common/manager/RandomPkManager.java +++ b/common/src/main/java/com/yunbao/common/manager/RandomPkManager.java @@ -5,6 +5,7 @@ import android.os.Looper; import android.util.Log; import com.yunbao.common.CommonAppContext; +import com.yunbao.common.R; import com.yunbao.common.bean.RankPkInfoBean; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; @@ -341,7 +342,7 @@ public class RandomPkManager { @Override public void onError(String error) { - + ToastUtil.show(R.string.net_error); } }); } diff --git a/common/src/main/java/com/yunbao/common/utils/LogUtil.java b/common/src/main/java/com/yunbao/common/utils/LogUtil.java index 2d42b1b08..66d0c75d7 100644 --- a/common/src/main/java/com/yunbao/common/utils/LogUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/LogUtil.java @@ -1,11 +1,9 @@ package com.yunbao.common.utils; import static android.provider.Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION; -import static androidx.core.content.PermissionChecker.PERMISSION_GRANTED; import static java.text.DateFormat.DEFAULT; -import android.Manifest; -import android.app.Activity; +import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.net.Uri; @@ -14,10 +12,10 @@ import android.os.Environment; import android.text.TextUtils; import android.util.Log; -import androidx.core.app.ActivityCompat; +import androidx.annotation.NonNull; import androidx.core.content.FileProvider; -import androidx.core.content.PermissionChecker; +import com.alibaba.fastjson.JSONObject; import com.lzy.okgo.OkGo; import com.lzy.okgo.callback.StringCallback; import com.lzy.okgo.model.Progress; @@ -31,7 +29,6 @@ import com.yunbao.common.CommonAppConfig; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; @@ -42,11 +39,20 @@ import java.nio.file.Files; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; +import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.MediaType; +import okhttp3.MultipartBody; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; + /** * Created by cxf on 2019/6/20. */ @@ -150,13 +156,17 @@ public class LogUtil { public static void shareFile(Context context) { - if(true){ + try { + if (!new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "pdlive.debug").exists()) { + return; + } + } catch (Exception e) { return; } - if (PermissionChecker.checkCallingOrSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) { + /* if (PermissionChecker.checkCallingOrSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) { ActivityCompat.requestPermissions((Activity) context, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 100); return; - } + }*/ String title = "[PDLIVE]" + CommonAppConfig.getInstance().getUid() + "_"; String today = title + SimpleDateFormat.getDateInstance(DEFAULT, Locale.CHINA).format(new Date()); File dir = new File(context.getDir("files", Context.MODE_PRIVATE).getAbsolutePath() + File.separator); @@ -184,33 +194,90 @@ public class LogUtil { e.printStackTrace(); } if (zip.exists()) { - Intent share = new Intent(Intent.ACTION_SEND); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - Uri contentUri = FileProvider.getUriForFile(context, context.getPackageName() + ".fileprovider", zip); - share.putExtra(Intent.EXTRA_STREAM, contentUri); - share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - } else { - share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(zip)); - } - share.setType("application/vnd.ms-excel"); - share.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - context.startActivity(Intent.createChooser(share, "分享文件")); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && !CommonAppConfig.IS_GOOGLE_PLAY) { - if (!Environment.isExternalStorageManager()) { - Intent intent = new Intent(ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION); - context.startActivity(intent); + DialogUitl.showSimpleDialog(context, "上报日志", new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + new Thread(new Runnable() { + @Override + public void run() { + uploadLog(zip); + } + }).start(); + dialog.dismiss(); + ToastUtil.show("OK"); + Intent share = new Intent(Intent.ACTION_SEND); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + Uri contentUri = FileProvider.getUriForFile(context, context.getPackageName() + ".fileprovider", zip); + share.putExtra(Intent.EXTRA_STREAM, contentUri); + share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + } else { + share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(zip)); + } + share.setType("application/vnd.ms-excel"); + share.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + context.startActivity(Intent.createChooser(share, "分享文件")); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && !CommonAppConfig.IS_GOOGLE_PLAY) { + if (!Environment.isExternalStorageManager()) { + Intent intent = new Intent(ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION); + context.startActivity(intent); + } + } + File out = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + zip.getName()); + try { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + Files.copy(zip.toPath(), out.toPath()); + } + } catch (Exception e) { + e.printStackTrace(); + } } - } - File out = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + zip.getName()); - try { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - Files.copy(zip.toPath(), out.toPath()); - } - } catch (Exception e) { - e.printStackTrace(); - } + }); + } } + private static String TAG="Upload"; + private static void uploadLog(File log) { + + JSONObject body = new JSONObject(); + + MultipartBody requestBody = new MultipartBody.Builder() + .addFormDataPart("uid", CommonAppConfig.getInstance().getUid()) + .addFormDataPart("time", new SimpleDateFormat("yyyy-DD-mm HH:mm:ss", Locale.getDefault()).format(new Date())) + .addFormDataPart("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY+"") + .addFormDataPart("appVersion", CommonAppConfig.getInstance().getVersion()) + .addFormDataPart("file","file", RequestBody.create(MediaType.parse("application/octet-stream"),log)) //上报日志文件 + .build(); + + body.put("uid", CommonAppConfig.getInstance().getUid()); + body.put("time", new SimpleDateFormat("yyyy-DD-mm HH:mm:ss", Locale.getDefault()).format(new Date())); + body.put("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY); + body.put("appVersion", CommonAppConfig.getInstance().getVersion()); + + OkHttpClient client = new OkHttpClient.Builder() + .connectTimeout(3, TimeUnit.SECONDS) + .build(); + Request request = new Request.Builder() + //.url("https://newht.yaoulive.com/index.php/api/error_log/report") //无法接受文件 + .url("https://tools.yutou233.cn/public/file/request.do")//临时上报地址,可接受文件 + .post(requestBody) + .build(); + client.newCall(request) + .enqueue(new Callback() { + @Override + public void onFailure(@NonNull Call call, @NonNull IOException e) { + Log.e(TAG, "error",e ); + } + + @Override + public void onResponse(Call call, okhttp3.Response response) throws IOException { + String body = response.body().string(); + Log.i(TAG, "onResponse: "+body); + } + + + }); + } + } diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index 34a1be8cd..c8a3c2645 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -75,6 +75,15 @@ public class RouteUtil { .withBoolean("forwardEntry", true) .navigation(); } + /** + * 只回到登录页,不提示东西 + */ + public static void forwardEntry2() { + ARouter.getInstance().build(PATH_ENTRY) + .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + .navigation(); + } /** * 跳转到个人主页 diff --git a/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java b/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java index 9abff4007..2f155a71e 100644 --- a/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java +++ b/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java @@ -164,7 +164,7 @@ public class CustomDrawerPopupView extends DrawerPopupView { @Override public void onError(String error) { - ToastUtil.show(error); + ToastUtil.show(R.string.net_error); } }); } diff --git a/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java index f8aa7ee0f..5da6b3b3f 100644 --- a/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java @@ -100,7 +100,7 @@ public class DrawerTaskChildViewHolder extends RecyclerView.ViewHolder { @Override public void onError(String error) { - ToastUtil.show(error); + ToastUtil.show( R.string.net_error); } }); } else { diff --git a/common/src/main/java/com/yunbao/common/views/LiveAnchorMessageCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveAnchorMessageCustomPopup.java new file mode 100644 index 000000000..15e9c34c4 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/LiveAnchorMessageCustomPopup.java @@ -0,0 +1,99 @@ +package com.yunbao.common.views; + +import android.content.Context; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.lxj.xpopup.core.BottomPopupView; +import com.yunbao.common.R; +import com.yunbao.common.adapter.LiveSystemMessageAdapter; +import com.yunbao.common.bean.ListInfoMessageModel; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.views.weight.OnRecyclerViewScrollListener; + +import java.util.List; + +/** + * 主播消息中心 + */ +public class LiveAnchorMessageCustomPopup extends BottomPopupView { + private LiveSystemMessageAdapter adapter; + private RecyclerView liveMessage; + private String liveUid; + private int page = 1, size = 0; + + public LiveAnchorMessageCustomPopup(@NonNull Context context, String liveUid) { + super(context); + this.liveUid = liveUid; + } + + public LiveAnchorMessageCustomPopup(@NonNull Context context) { + super(context); + } + + // 返回自定义弹窗的布局 + @Override + protected int getImplLayoutId() { + return R.layout.dialog_live_anchor_message; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + initView(); + initDate(); + } + + private void initDate() { + LiveNetManager.get(getContext()) + .getAnchorMsg(liveUid, page, new HttpCallback>() { + @Override + public void onSuccess(List data) { + size = data.size(); + + if (page == 1 && size == 0) { + liveMessage.setVisibility(GONE); + findViewById(R.id.img_no_new).setVisibility(VISIBLE); + } else { + findViewById(R.id.img_no_new).setVisibility(GONE); + liveMessage.setVisibility(VISIBLE); + adapter.addData(data); + } + } + + @Override + public void onError(String error) { + ToastUtil.show( R.string.net_error); + } + }); + + } + + private void initView() { + liveMessage = findViewById(R.id.live_message); + liveMessage.setHasFixedSize(false); + liveMessage.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); + adapter = new LiveSystemMessageAdapter(getContext()); + liveMessage.setAdapter(adapter); + liveMessage.addOnScrollListener(new OnRecyclerViewScrollListener() { + @Override + public void onBottom() { + if (size > 0) { + page = page + 1; + initDate(); + } + + } + }); + } + + @Override + public void onDestroy() { + super.onDestroy(); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java index 784fd7004..b3f6cd9d6 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java @@ -142,7 +142,7 @@ public class LiveOpenCustomPopup extends CenterPopupView { @Override public void onError(String error) { - ToastUtil.show(error); + ToastUtil.show( R.string.net_error); } }); diff --git a/common/src/main/java/com/yunbao/common/views/LiveRobotMessageCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveRobotMessageCustomPopup.java index 7a84549d7..ea727fba8 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveRobotMessageCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveRobotMessageCustomPopup.java @@ -181,7 +181,7 @@ public class LiveRobotMessageCustomPopup extends BottomPopupView { @Override public void onError(String error) { - + ToastUtil.show( R.string.net_error); } }); } diff --git a/common/src/main/java/com/yunbao/common/views/LiveRobotSayHelloCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveRobotSayHelloCustomPopup.java index a76fcadef..a04d91c13 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveRobotSayHelloCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveRobotSayHelloCustomPopup.java @@ -121,7 +121,7 @@ public class LiveRobotSayHelloCustomPopup extends BottomPopupView { @Override public void onError(String error) { - + ToastUtil.show( R.string.net_error); } }); } diff --git a/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java index e8e195c49..be5d489f2 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java @@ -251,7 +251,7 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View @Override public void onError(String error) { - ToastUtil.show(error); + ToastUtil.show( R.string.net_error); } }); diff --git a/common/src/main/java/com/yunbao/common/views/LiveSystemMessageViewHolder.java b/common/src/main/java/com/yunbao/common/views/LiveSystemMessageViewHolder.java new file mode 100644 index 000000000..76a478112 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/LiveSystemMessageViewHolder.java @@ -0,0 +1,54 @@ +package com.yunbao.common.views; + +import android.text.TextUtils; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.bean.ListInfoMessageModel; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.RouteUtil; + +public class LiveSystemMessageViewHolder extends RecyclerView.ViewHolder { + private TextView titleText, timeText, contextLayout, toView; + private CardView bannerCard; + private ImageView bannerImage; + + public LiveSystemMessageViewHolder(@NonNull View itemView) { + super(itemView); + titleText = itemView.findViewById(R.id.title_text); + timeText = itemView.findViewById(R.id.time_text); + contextLayout = itemView.findViewById(R.id.context_layout); + toView = itemView.findViewById(R.id.to_view); + bannerCard = itemView.findViewById(R.id.banner_card); + bannerImage = itemView.findViewById(R.id.banner_image); + } + + public void setViewData(ListInfoMessageModel model) { + titleText.setText(model.getTitle()); + timeText.setText(model.getLastDate("1")); + if (TextUtils.isEmpty(model.getBanner())) { + bannerCard.setVisibility(View.GONE); + } else { + bannerCard.setVisibility(View.VISIBLE); + ImgLoader.display(itemView.getContext(), model.getBanner(), bannerImage); + } + contextLayout.setText(model.getContent()); + if (TextUtils.isEmpty(model.getLink())) { + toView.setVisibility(View.GONE); + } else { + toView.setVisibility(View.VISIBLE); + toView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + RouteUtil.forwardLiveZhuangBanActivity(model.getLink(), false); + } + }); + } + } +} diff --git a/common/src/main/java/com/yunbao/common/views/RobotMessageViewHolder.java b/common/src/main/java/com/yunbao/common/views/RobotMessageViewHolder.java index c14de79f2..34eb112d9 100644 --- a/common/src/main/java/com/yunbao/common/views/RobotMessageViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/RobotMessageViewHolder.java @@ -44,7 +44,7 @@ public class RobotMessageViewHolder extends RecyclerView.ViewHolder { @Override public void onError(String error) { - ToastUtil.show(error); + ToastUtil.show( R.string.net_error); } }); } diff --git a/common/src/main/java/com/yunbao/common/views/RobotSayHelloViewHoler.java b/common/src/main/java/com/yunbao/common/views/RobotSayHelloViewHoler.java index 75ee2e293..2b2951c06 100644 --- a/common/src/main/java/com/yunbao/common/views/RobotSayHelloViewHoler.java +++ b/common/src/main/java/com/yunbao/common/views/RobotSayHelloViewHoler.java @@ -44,7 +44,7 @@ public class RobotSayHelloViewHoler extends RecyclerView.ViewHolder { @Override public void onError(String error) { - ToastUtil.show(error); + ToastUtil.show( R.string.net_error); } }); } diff --git a/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java b/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java index 251818e8e..0f9efc7de 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java +++ b/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java @@ -105,9 +105,9 @@ public class LiveFloatView implements Function1 { @Override public void onNetStatus(Bundle bundle) { + } }); - ViewClicksAntiShake.clicksAntiShake(magnetView.findViewById(R.id.btn_close), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { diff --git a/common/src/main/res/drawable/bg_live_anchor.xml b/common/src/main/res/drawable/bg_live_anchor.xml new file mode 100644 index 000000000..97e93b52b --- /dev/null +++ b/common/src/main/res/drawable/bg_live_anchor.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/common/src/main/res/drawable/bg_live_anchor_message.xml b/common/src/main/res/drawable/bg_live_anchor_message.xml new file mode 100644 index 000000000..9ff74fedd --- /dev/null +++ b/common/src/main/res/drawable/bg_live_anchor_message.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/common/src/main/res/drawable/selector_protocol_check.xml b/common/src/main/res/drawable/selector_protocol_check.xml new file mode 100644 index 000000000..a4042e2f1 --- /dev/null +++ b/common/src/main/res/drawable/selector_protocol_check.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_live_anchor_message.xml b/common/src/main/res/layout/dialog_live_anchor_message.xml new file mode 100644 index 000000000..a2c1db4bb --- /dev/null +++ b/common/src/main/res/layout/dialog_live_anchor_message.xml @@ -0,0 +1,30 @@ + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_live_new_function.xml b/common/src/main/res/layout/dialog_live_new_function.xml index 4182a2fc9..431285898 100644 --- a/common/src/main/res/layout/dialog_live_new_function.xml +++ b/common/src/main/res/layout/dialog_live_new_function.xml @@ -1,329 +1,458 @@ - - - - + android:layout_marginBottom="8dp" + android:orientation="horizontal"> + android:layout_marginStart="10dp" + android:background="@drawable/bg_live_anchor" + android:gravity="center" + android:paddingStart="6dp" + android:paddingTop="4dp" + android:paddingEnd="6dp" + android:paddingBottom="4dp"> - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_marginStart="5dp" + android:text="00:00" + android:textColor="@color/white" + android:textSize="12sp" /> - - - - - + + android:layout_marginStart="10dp" + android:background="@drawable/bg_live_anchor" + android:gravity="center_vertical" + android:paddingStart="6dp" + android:paddingTop="4dp" - + + + + + - - - - - - - - - - - - - - - - - - - - + android:layout_marginStart="6dp" + android:text="@string/broadcast_data" + android:textColor="@color/white" + android:textSize="10sp" /> - - - - + + + + + + + + + + + + android:layout_marginTop="30dp" + android:text="@string/value_added_benefits" + android:textColor="@color/white" + android:textSize="14sp" /> + + + android:layout_marginStart="16dp" + android:layout_marginTop="10dp" + android:paddingEnd="16dp"> - - - + android:gravity="center" + android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:layout_marginStart="16dp" + android:layout_marginTop="10dp" + android:layout_marginBottom="20dp" + android:paddingEnd="16dp"> - - - - - + android:gravity="center" + android:orientation="vertical"> - + - + + + + android:layout_marginStart="23dp" + android:gravity="center" + android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + android:layout_marginStart="16dp" + android:layout_marginTop="10dp" + android:layout_marginBottom="20dp" + android:paddingEnd="16dp"> - - - - + android:gravity="center" + android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - \ No newline at end of file diff --git a/common/src/main/res/layout/view_live_system_message.xml b/common/src/main/res/layout/view_live_system_message.xml new file mode 100644 index 000000000..968f41186 --- /dev/null +++ b/common/src/main/res/layout/view_live_system_message.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_yoursystemisolder.xml b/common/src/main/res/layout/view_yoursystemisolder.xml new file mode 100644 index 000000000..ef06d5cba --- /dev/null +++ b/common/src/main/res/layout/view_yoursystemisolder.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/mipmap-xhdpi/icon_more.png b/common/src/main/res/mipmap-xxhdpi/icon_more.png similarity index 100% rename from live/src/main/res/mipmap-xhdpi/icon_more.png rename to common/src/main/res/mipmap-xxhdpi/icon_more.png diff --git a/common/src/main/res/mipmap-xxhdpi/icon_protocol_check.png b/common/src/main/res/mipmap-xxhdpi/icon_protocol_check.png new file mode 100644 index 000000000..07d294e38 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_protocol_check.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_protocol_uncheck.png b/common/src/main/res/mipmap-xxhdpi/icon_protocol_uncheck.png new file mode 100644 index 000000000..bb1b4754a Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_protocol_uncheck.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/live_icon_data.png b/common/src/main/res/mipmap-xxhdpi/live_icon_data.png new file mode 100644 index 000000000..f23f08440 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/live_icon_data.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/live_icon_news.png b/common/src/main/res/mipmap-xxhdpi/live_icon_news.png new file mode 100644 index 000000000..0f2cebfec Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/live_icon_news.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/live_more_icon_task.png b/common/src/main/res/mipmap-xxhdpi/live_more_icon_task.png new file mode 100644 index 000000000..6265b8b3a Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/live_more_icon_task.png differ diff --git a/common/src/main/res/values-en/strings.xml b/common/src/main/res/values-en/strings.xml index 2bcde64f0..ba779e04e 100644 --- a/common/src/main/res/values-en/strings.xml +++ b/common/src/main/res/values-en/strings.xml @@ -168,6 +168,9 @@ Open guard Renewal Guardian My + Become the guardian of %s + Open a guard for your favorite anchor + The guardian date expires at: %s GET Only one can be given away~ Guard @@ -845,8 +848,8 @@ Limited ride And limited avatar frame Contact a mentor now! Withdrawal succeeded normal barrage - floating screen - Whole station horn + Float barrage + Total speaker quote Available times: %s Note: Update times at 4:00 am on the 1st of each month Content cannot be empty @@ -882,7 +885,8 @@ Limited ride And limited avatar frame Notice Online Service Hot Ticket - + Register and log in + Sign up for PD LIVE 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! @@ -895,13 +899,13 @@ Limited ride And limited avatar frame onlookers The live broadcast studio was opened - baron - viscount - The marquis DE - The duke - The king - The emperor - Super huang + Baron + Viscount + Marquis + Duke + King + Emperor + Super king Please wait... The slide set Slide up and down to switch the broadcast room @@ -916,16 +920,26 @@ Limited ride And limited avatar frame %sStar challenge Congratulations %s, completed %s %s star challenge, go to meet the host face! star + Join your favorite host fan club Small window play Settings Small window to play Minimize Play + Continue to guard + Join Fan club + Daemon list + You are the weekly guardian of the current anchor + You are the monthly guardian of the current anchor + You are the annual guardian of the current anchor Show when exiting the live room ALL Minimize Play + Anchor is waiting for you to become the guardian of TA, \n escort for TA! + Open a guard for your favorite anchor Show on other apps and pages \n Need to open the display Go to open Don\'t like the small window play?\n You can turn it off in [Personal Center] - [Settings] Go to Settings Got it + Open noble, enjoy a lot of privileges! Personal Settings Rewards Change password @@ -938,14 +952,14 @@ Limited ride And limited avatar frame In a batch 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 group %s people - receive - To complete - Already collected - Image quality selection - More Settings + 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 group %s people + receive + To complete + Already collected + Image quality selection + More Settings view more The gift is on the way... The gift is on the way @@ -955,51 +969,124 @@ Limited ride And limited avatar frame End \nPK Time %s - accept - refuse - Persist in refusing - Random PK hint + accept + refuse + Persist in refusing + Random PK hint - Automatic speech robot setup - Robot switch - Robot name setting - The word limit is 2 to 8 word - Automatic greeting setting - Number of configured items - Set automatic message sending - Go to set - Thank you for sending gifts, PK start, PK end automatic robot message, \n does not support customization. - Add content - At regular intervals, the robot automatically says the following sentence at random。 - Fill in the content recommendation, such as: send wish list, add fan group, etc - Automatic speech interval (minutes) - At least once every 5 minutes - When a user enters the studio, the robot will @the user and automatically - The following sentence is random. Set a minimum of 1 to a maximum of 20. - Robot setup - High definition - fluency - Ultra hd - After determining the definition of the broadcast, you need to restart the broadcast to change - Confirmation of broadcast Settings - clarity - Live channel - broadcast - robot - set - Not set - no - yes - Ultra HD hint - In the case of unstable network speed, the selection of ultra HD may lead to the delay of the picture in the broadcast room. Do you confirm the selection? - Stick to choice - Network prompt - The system detects that your network is unstable and insufficient device memory will affect the fluency of your live broadcast. Therefore, it is recommended that you choose fluency and clarity. - check version - Update - Latest Version - updating - 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. + Automatic speech robot setup + Robot switch + Robot name setting + The word limit is 2 to 8 word + Automatic greeting setting + Number of configured items + Set automatic message sending + Go to set + Thank you for sending gifts, PK start, PK end automatic robot message, \n does not support customization. + Add content + At regular intervals, the robot automatically says the following sentence at random。 + Fill in the content recommendation, such as: send wish list, add fan group, etc + Automatic speech interval (minutes) + At least once every 5 minutes + When a user enters the studio, the robot will @the user and automatically + The following sentence is random. Set a minimum of 1 to a maximum of 20. + Robot setup + High definition + fluency + Ultra hd + After determining the definition of the broadcast, you need to restart the broadcast to change + Confirmation of broadcast Settings + clarity + Live channel + broadcast + robot + set + Not set + no + yes + Ultra HD hint + In the case of unstable network speed, the selection of ultra HD may lead to the delay of the picture in the broadcast room. Do you confirm the selection? + Stick to choice + Network prompt + The system detects that your network is unstable and insufficient device memory will affect the fluency of your live broadcast. Therefore, it is recommended that you choose fluency and clarity. + check version + Update + Latest Version + updating + 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 + Broadcast + Click To View + Anchor Task + I have read and agreed to the + Please read and agree to the PDLIVE Host Agreement + PDLIVE Host Agreement + The statute of limitations for new anchors expires + coin + gold + Number of gifts + Number of entry + New attention + Follow the conversion rate + New fan group + Fan group conversion rate + loading… + Gift and seat effects have been turned off and can be turned on manually in "Settings". + i \'m sorry! An error occurred. + Congratulations on getting it! + You have accumulated sign-ups this month %s Heaven + Sign in for 1 more day to get extra bonus. + Sign in to the center」 + Go to the「Sign-in Center」to get extra rewards! + Sign-in Center + Back to top + 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 + 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. + In order to provide you with one-click sharing service, our product integrates Mob+U-Share SDK, The Mob+SDK needs to collect your device Mac address, unique device identifier (1MEIandroid IDIDFAOPENUDIDGUID, SIM card IMSI information), and public social account information that you need to share in order to complete the one-click sharing service. And through the geographical location calibration report data accuracy, provide basic anti-cheating services. For the sake of your information security, we have made data security and confidentiality agreements with third-party SDK service providers, and these companies will strictly abide by our data privacy and security requirements. We will not share your personally identifiable information with them unless we have your consent. To facilitate you better understand/Mob + data types and USES, and how to protect your personal information, you can log on to https:www.mob.com aboutpolicy understand [Mob +] privacy policy). + Clicking Agree means you have read and agree to all of the above.。 + agreement + Welcome to PD LIVE. + gift + User service agreement + 一 Fan privilege 一 + Gift name + True love ranking + and + Speech memo + Privacy policy + Daily gift pack + To one\'s liking + Opened a pair of + guard + I bought a ride + Purchased a beautiful number + VIP + Random PK + VIP seating + True love ranking + Please enter the number + You are the current anchor whose weekly guardian \n guardian date is up + My %1$s: + Top-up instructions + Registration means consent + One-time gift ≥2000 diamonds), can obtain fan privilege yo + Top up + User level + aristocracy + Fan club + Voice connection is not enabled + Wall of honor + Get a fan badge for giving gifts + Whether to clear unread messages + The application collects location data to support login and registration functions. diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index f3b7113f3..7d686fd4a 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -701,6 +701,13 @@ 消息中心 所屬公會 開通貴族 + 快為您喜歡的主播開通守護吧 + 守護列表 + 主播正在等待您成為TA的守護,\n為TA保駕護航! + 快加入您喜歡的主播粉絲團吧 + 加入粉絲團 + 繼續守護 + 確認支付 確認支付(¥%1$s) 支付方式 @@ -720,16 +727,26 @@ 購買了座騎 購買了靚號 VIP + 随机PK 心願單 娛樂整蠱 多人PK - 随机PK 語音連麥 周星榜 暫時離開 恢復直播 請輸入數字 您是當前主播的周守護\n守護日期截止到 + 您是當前主播的周守護 + 您是當前主播的月守護 + 您是當前主播的年守護 + 守護日期截止到:%s + + 快为您喜欢的主播开通守护吧 + 成爲%s的守護 + + + 我的%1$s: 充值説明 注冊即代表同意 @@ -739,22 +756,22 @@ 禮物 用戶服務協議 一 粉絲特權 一 - 包裹 - 許下心願,觀衆幫你實現 禮物名稱 - 心願單 真愛排行 發言微章 - 生成心願 隱私政策 每日禮包 - 添加禮物和數量 貴賓座席 - 當日設置的心願,會在當天24:00失效 真爱排行 - 複製 送禮獲得粉絲微章 + 當日設置的心願,會在當天24:00失效 + 添加禮物和數量 + 包裹 + 許下心願,觀衆幫你實現 + 複製 + 心願單 + 生成心願 直播中 休息中 @@ -785,6 +802,7 @@ 暫時還沒有人給予作者鼓勵T_T 點擊查看更多 + 客服 設定 每日13:00PM-1:00AM @@ -958,14 +976,14 @@ 換一批 聊聊天 想在其他APP上方也顯示小窗,\n可前往設置進行授權。 - 恭喜 %s 在幸運天使中抽中 %s!下一個幸運天使就是你哦! - 恭喜 %s 在好運百分百中抽中 %s!快去接力好運吧~ - 守護團%s人 - 領取 - 去完成 - 已領取 - 畫質選擇 - 更多設置 + 恭喜 %s 在幸運天使中抽中 %s!下一個幸運天使就是你哦! + 恭喜 %s 在好運百分百中抽中 %s!快去接力好運吧~ + 守護團%s人 + 領取 + 去完成 + 已領取 + 畫質選擇 + 更多設置 查看更多 礼物正在获取中... 開始PK @@ -975,51 +993,99 @@ 結束\nPK 時間 %s - 接受 - 拒绝 - 坚持拒绝 - 随机PK提示 + 接受 + 拒绝 + 坚持拒绝 + 随机PK提示 + + 自動發言機器人設置 + 機器人開關 + 機器人名字設置 + 字數限制2-8個字 + 自動打招呼設置 + 已配置條數 + 自動發消息設置 + 前往設置 + 感謝送禮、PK開始、PK結束的自動機器人消息,\n暫不支持自定義。 + 添加內容 + 每隔一段時間,機器人自動隨機以下一句話發出。 + 填寫內容推薦,如:求送心願單、加粉絲團等 + 自動發言間隔時間(分鐘) + 最少間隔5分鐘1次 + 當有用戶進入直播間時,機器人會@該用戶並自動 + 隨機以下一句話。最少設置1條,最多20條。 + 機器人設置 + 高清 + 流暢 + 超高清 + 確定清晰度開播後,需要重新開播才能更改 + 開播設置確認 + 清晰度 + 直播頻道 + 開播 + 機器人 + 已設置 + 未設置 + + + 超高清提示 + 在網速不穩定的情況下,選擇超高清將會有可能導致直播間畫面卡頓,是否確認選擇? + 堅持選擇 + 網絡提示 + 系統監測到您的網絡不穩定,設備內存不足將會影響到您的直播流暢度,因此建議您選擇流暢清晰度。 + 检查新版本 + 發現新版本,點此更新 + 已是最新版本 + 更新中 + 無法選擇,該主播未開啟超高清直播。 + 無法選擇,該主播未開啟高清直播。 + 抱歉,該功能暫停使用中。 + 手機號 + 開播數據 + 點擊查看 + 主播任務 + 我已閱讀並同意 + 請閱讀並同意《PDLIVE主播協議》 + 《PDLIVE主播協議》 + 新秀主播時效截止至 + 鑽石收禮 + 金豆收禮 + 收禮人數 + 進場人數 + 新增關注 + 關注轉化率 + 新增粉絲團 + 粉絲團轉化率 + 加载中… + 由於您的系統較老,我們自動為您屏蔽了禮物及座駕特效,可在「設置中心」手動打開。 + 抱歉!出錯了! + + 恭喜你獲得了 + 本月您已累積簽到%s天 + 再簽到1天即可獲得額外獎勵。 + 「簽到中心」 + 快前往「簽到中心」獲得額外獎勵吧! + 签到中心 + 返回首页 + 前往签到中心 + 確認領取 + 無法登陸?點此聯繫客服 + 進入下一步即代表同意 + 用户協議 + + 隱私條款 + 條款和政策 + 歡迎來到PD LIVE,對於您的個人信息及隱私,我們將採用最高標準對待和保護。 + 詳情請您閱讀以下安裝應用程序的消息: + 為了向您提供一鍵分享服務,我們的產品集成Mob+U-Share SDK,Mob+SDK需要收集您的設備Mac地址、唯一設備識別碼(1MEI/android ID/IDFA/OPENUDID/GUID、 SIM卡IMSI信息)以及您需要分享的社交賬號公開信息,以便完成一鍵分享服務。並通過地理位置校準報表數據準確性,提供基礎反作弊服務。為了您的信息安全,我們已與第三方SDK服務商進行數據安全保密約定,這些公司會嚴格遵守我們的數據隱私和安全要求。 除非得到您的同意,我們不會與其共享您的個人身份信息。為便於您更好地了解[Mob+]采集的數據類型及用途,以及何保護您的個人信息,您可以登陸https://www.mob.com/about/policy了解[Mob+]隱私權政)。 + 同意 + 點擊同意後即代表您已閱讀並同意以上所有內容。 + 本應用會收集位置數據以支持登錄和註冊的功能使用。 + 歡迎來到PD LIVE。 + 註冊PD LIVE + 註冊並登錄 + 開通貴族,尊享超多特權! + + - 自動發言機器人設置 - 機器人開關 - 機器人名字設置 - 字數限制2-8個字 - 自動打招呼設置 - 已配置條數 - 自動發消息設置 - 前往設置 - 感謝送禮、PK開始、PK結束的自動機器人消息,\n暫不支持自定義。 - 添加內容 - 每隔一段時間,機器人自動隨機以下一句話發出。 - 填寫內容推薦,如:求送心願單、加粉絲團等 - 自動發言間隔時間(分鐘) - 最少間隔5分鐘1次 - 當有用戶進入直播間時,機器人會@該用戶並自動 - 隨機以下一句話。最少設置1條,最多20條。 - 機器人設置 - 高清 - 流暢 - 超高清 - 確定清晰度開播後,需要重新開播才能更改 - 開播設置確認 - 清晰度 - 直播頻道 - 開播 - 機器人 - 已設置 - 未設置 - - - 超高清提示 - 在網速不穩定的情況下,選擇超高清將會有可能導致直播間畫面卡頓,是否確認選擇? - 堅持選擇 - 網絡提示 - 系統監測到您的網絡不穩定,設備內存不足將會影響到您的直播流暢度,因此建議您選擇流暢清晰度。 - 检查新版本 - 發現新版本,點此更新 - 已是最新版本 - 更新中 - 無法選擇,該主播未開啟超高清直播。 - 無法選擇,該主播未開啟高清直播。 - 抱歉,該功能暫停使用中。 diff --git a/config.gradle b/config.gradle index 980717524..f1f6158a2 100644 --- a/config.gradle +++ b/config.gradle @@ -4,14 +4,13 @@ ext { buildToolsVersion: "29.0.2", minSdkVersion : 21, targetSdkVersion : 31, - versionCode : 405, - versionName : "6.4.8" + versionCode : 413, + versionName : "6.4.9" ] manifestPlaceholders = [ - //正式 - + //正式、 // serverHost : "https://napi.yaoulive.com", -// + //测试 serverHost : "https://ceshi.yaoulive.com", //腾讯地图 @@ -23,7 +22,6 @@ ext { baiduAppId : "23774720", baiduAppKey : "zgCgFhUKEOV7I3ZXDFpTfnRB", baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", - // true表示谷歌支付 false isGooglePlay : false, //是否上报异常日志 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 9ec322ca1..cc565e6ec 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -866,7 +866,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL private void showTaskDialog() { final Dialog dialog = new Dialog(LiveActivity.this, com.yunbao.live.R.style.dialog); - dialog.setContentView(R.layout.dialog_task); + dialog.setContentView(R.layout.dialog_live_task); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); @@ -1288,6 +1288,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL @Override public void onError(String error) { Log.e("LiveUserMoreDialog", error); + ToastUtil.show( R.string.net_error); } }); } else { 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 aa96bdef8..5ead5be28 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -5,6 +5,7 @@ import android.app.Dialog; import android.content.Intent; import android.content.res.Configuration; import android.media.AudioManager; +import android.os.Build; import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; @@ -20,6 +21,7 @@ import androidx.annotation.NonNull; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; import androidx.core.view.WindowInsetsControllerCompat; +import androidx.fragment.app.FragmentActivity; import androidx.viewpager.widget.ViewPager; import com.alibaba.android.arouter.facade.annotation.Route; @@ -52,6 +54,7 @@ import com.yunbao.common.dialog.EffectsSettingsDialog; import com.yunbao.common.dialog.FloatSettingsDialog; import com.yunbao.common.dialog.LiveChargeDialogFragment; import com.yunbao.common.dialog.SlideSettingsDialog; +import com.yunbao.common.dialog.YoursystemisolderDialog; import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.event.FollowEvent; import com.yunbao.common.glide.ImgLoader; @@ -183,6 +186,11 @@ public class LiveAudienceActivity extends LiveActivity { mStream = mLiveBean.getStream(); initData(); MicStatusManager.getInstance().addOnMicListener(onMicStatusListener); + if (!IMLoginManager.get(mContext).IsXiaJBG() && (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)) { + YoursystemisolderDialog fragment = new YoursystemisolderDialog(); + fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "YoursystemisolderDialog"); + IMLoginManager.get(mContext).setXiaJBG(true); + } } private final MicStatusManager.OnMicStatusListener onMicStatusListener = new MicStatusManager.OnMicStatusListener() { @@ -690,28 +698,26 @@ public class LiveAudienceActivity extends LiveActivity { @Subscribe(threadMode = ThreadMode.MAIN) public void onLiveRoomChangeEvent(LiveRoomChangeEvent e) { - if (verticalViewPager.ismEnableScroll()) { - LiveBean liveBean = e.getLiveBean(); - if (e.isLiveEnd()) { - manager.removeLiveEnd(); - } - if (liveBean != null) { - LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE); - LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM); - LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE); - manager.onRemove(false); - mLiveType = e.getLiveType(); - mLiveTypeVal = e.getLiveTypeVal(); - mLiveBean = liveBean; - mLiveUid = liveBean.getUid(); - mStream = liveBean.getStream(); - mAncherName = liveBean.getUserNiceName(); - mAncherIcon = liveBean.getAvatar(); - manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK); - } - } else { - verticalViewPager.setEnableScroll(IMLoginManager.get(mContext).isSlide()); + + LiveBean liveBean = e.getLiveBean(); + if (e.isLiveEnd()) { + manager.removeLiveEnd(); } + if (liveBean != null) { + LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE); + LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM); + LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE); + manager.onRemove(false); + mLiveType = e.getLiveType(); + mLiveTypeVal = e.getLiveTypeVal(); + mLiveBean = liveBean; + mLiveUid = liveBean.getUid(); + mStream = liveBean.getStream(); + mAncherName = liveBean.getUserNiceName(); + mAncherIcon = liveBean.getAvatar(); + manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK); + } + } @Override @@ -1246,15 +1252,18 @@ public class LiveAudienceActivity extends LiveActivity { } break; case SOCKET_LIVE_DRPK_SET_PK_VIEW: - ToastUtil.show("setPkView"); if (manager.getmLivePlayViewHolder() != null) { manager.getmLivePlayViewHolder().setPkview(); } break; case SOCKET_LIVE_DRPK_SET_PK_END_VIEW: - ToastUtil.show("setPkEndview"); if (manager.getmLivePlayViewHolder() != null) { manager.getmLivePlayViewHolder().setPkEndview(); + manager.setPkStatus(false); + + } + if (manager != null) { + manager.removeDetailView(); } break; @@ -1349,6 +1358,7 @@ public class LiveAudienceActivity extends LiveActivity { @Override public void onError(String error) { + ToastUtil.show(R.string.net_error); } }); 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 06dd88fe3..ae017e117 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -163,6 +163,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl public static int backIndex = 0;//0=未判断,1=已判断 private FaceManager manager; private ImageView leave_img; + private final RandomPkManager.OnRandomPkTimer onRandomPkTimer = new RandomPkManager.OnRandomPkTimer() { @Override public void onTimer(String time) { @@ -422,6 +423,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl public void onSuccess(Message message) { isDRPK = 1; btn_start_dr_pk_view.setVisibility(View.VISIBLE); + mLiveRyLinkMicPkPresenter.setDRInitiator(true); } @Override @@ -671,7 +673,9 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl } bundle.putBoolean(Constants.HAS_GAME, hasGame); bundle.putInt("leave", leave); + bundle.putString("liveUid", mLiveUid); bundle.putBoolean("isPk", isDRPK == 1 || PKing || mLivePushViewHolder.isPking()); + bundle.putLong("liveTime", mLiveAnchorViewHolder.getmAnchorLiveTime()); bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen()); fragment.setArguments(bundle); fragment.setFunctionClickListener(this); @@ -935,9 +939,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl if (code == 0) { JSONObject obj = JSON.parseObject(info[0]); JSONObject datas = obj.getJSONObject("data"); - - SocketRyChatUtil.closeLive(datas.getString("votes"), datas.getString("length"), datas.getString("nums"), mLiveUid, mSocketRyClient); - + try { + SocketRyChatUtil.closeLive(datas.getString("votes"), datas.getString("length"), datas.getString("nums"), mLiveUid, mSocketRyClient); + } catch (Exception e) { + e.printStackTrace(); + } if (mLiveEndViewHolder == null) { mLiveEndViewHolder = new LiveEndViewHolder(mContext, mRoot, mLiveBean.getUid()); @@ -1560,11 +1566,17 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl if (mLiveRyLinkMicPkPresenter != null) { mLiveRyLinkMicPkPresenter.leaveDRRoom(); } + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.hotAddVisibility(false); + } break; case LEAVE_PK_SCORE: if (mLiveRyLinkMicPkPresenter != null) { mLiveRyLinkMicPkPresenter.upDataPkScore(event.getPkScores(), event.getUid(), event.getTime()); } + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.hotAddVisibility(true); + } break; case PK_TIME_COUNT: if (mLiveRoomViewHolder != null) { @@ -1669,7 +1681,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl @Override public void onError(String error) { - ToastUtil.show(error); + ToastUtil.show(R.string.net_error); } }); } diff --git a/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java index 57b0f377b..f4e095de7 100644 --- a/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java @@ -163,7 +163,7 @@ public class FreePkRecyclerAdapter extends RefreshAdapter { @Override public void onError(String error) { - + ToastUtil.show(R.string.net_error); } }); }); diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveDataInfoRecyclerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveDataInfoRecyclerAdapter.java new file mode 100644 index 000000000..5bf22b60a --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/LiveDataInfoRecyclerAdapter.java @@ -0,0 +1,67 @@ +package com.yunbao.live.adapter; + +import android.content.Context; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.live.R; +import com.yunbao.live.bean.LiveDataInfoModel; + +import java.util.ArrayList; +import java.util.List; + +public class LiveDataInfoRecyclerAdapter extends RecyclerView.Adapter { + private Context mContext; + private List list=new ArrayList<>(); + + public LiveDataInfoRecyclerAdapter(Context mContext) { + this.mContext = mContext; + } + + public void setList(List list) { + this.list = list; + notifyDataSetChanged(); + } + + @NonNull + @Override + public LiveDataHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new LiveDataHolder(LayoutInflater.from(mContext).inflate(R.layout.item_live_data, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull LiveDataHolder holder, int position) { + holder.setData(list.get(position)); + } + + @Override + public int getItemCount() { + return list.size(); + } + + public static class LiveDataHolder extends RecyclerView.ViewHolder { + private TextView title, data; + + public LiveDataHolder(@NonNull View itemView) { + super(itemView); + title = itemView.findViewById(R.id.item_title); + data = itemView.findViewById(R.id.item_data); + } + + public void setData(LiveDataInfoModel model) { + if (model.getColor() != null) { + data.setText(Html.fromHtml("" + model.getData() + "")); + } else { + data.setText(model.getData()); + } + title.setText(model.getTitle()); + } + + } +} diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveTaskRecyclerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveTaskRecyclerAdapter.java new file mode 100644 index 000000000..86b1408b8 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/LiveTaskRecyclerAdapter.java @@ -0,0 +1,117 @@ +package com.yunbao.live.adapter; + +import android.content.Context; +import android.graphics.Color; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.bean.LiveTaskModel; +import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.R; + +import java.util.ArrayList; +import java.util.List; + +public class LiveTaskRecyclerAdapter extends RecyclerView.Adapter { + + private Context mContext; + private List tasks = new ArrayList<>(); + + public LiveTaskRecyclerAdapter(Context mContext) { + this.mContext = mContext; + } + + public void setTasks(List tasks) { + this.tasks = tasks; + notifyDataSetChanged(); + } + + @NonNull + @Override + public TaskHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + if (viewType == LiveTaskModel.TASK_TYPE_TIP) { + return new TaskHolder(new TextView(mContext)); + } else { + return new TaskHolder(LayoutInflater.from(mContext).inflate(R.layout.item_live_task, parent, false)); + } + } + + @Override + public int getItemViewType(int position) { + return tasks.get(position).getType(); + + } + + @Override + public void onBindViewHolder(@NonNull TaskHolder holder, int position) { + holder.setDate(tasks.get(position)); + } + + @Override + public int getItemCount() { + return tasks.size(); + } + + + public static class TaskHolder extends RecyclerView.ViewHolder { + private TextView title; + private TextView complete; + private TextView hot; + private TextView xp; + private ImageView hotIcon; + private ImageView xpIcon; + + public TaskHolder(@NonNull View itemView) { + super(itemView); + if (itemView instanceof TextView) { + title = (TextView) itemView; + title.setTextColor(Color.parseColor("#B3B3B3")); + title.setTextSize(12); + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + params.setMarginStart(DpUtil.dp2px(27)); + params.setMargins(DpUtil.dp2px(27), DpUtil.dp2px(16), 0, DpUtil.dp2px(16)); + title.setLayoutParams(params); + } else { + title = itemView.findViewById(R.id.item_task_title); + complete = itemView.findViewById(R.id.item_task_complete); + hot = itemView.findViewById(R.id.item_task_hot); + xp = itemView.findViewById(R.id.item_task_xp); + hotIcon = itemView.findViewById(R.id.item_task_hot_img); + xpIcon = itemView.findViewById(R.id.item_task_xp_img); + hotIcon.setImageResource(R.mipmap.dialog_task_hot); + xpIcon.setImageResource(R.mipmap.dialog_task_star); + } + } + + public void setDate(LiveTaskModel.Task task) { + title.setText(task.getTaskName()); + if (task.getType() == LiveTaskModel.TASK_TYPE_TIP) { + return; + } + if (task.getStatus() || task.getNowValue() >= task.getTaskNum()) { + task.setNowValue(task.getTaskNum()); + } + title.setText(String.format("%s (%s/%s)", + task.getTaskName(), + task.getNowValue(), + task.getTaskNum()) + ); + if (task.getNowValue() == task.getTaskNum()) { + task.setStatus(1); + } + complete.setText(task.getStatus() ? R.string.live_task_item_complete_true : R.string.live_task_item_complete_false); + complete.setBackgroundResource(task.getStatus() ? R.drawable.background_6cbe53 : R.drawable.background_595959); + hot.setText(Html.fromHtml("" + WordUtil.getString(R.string.live_task_item_hot) + "  " + task.getHot() + "")); + xp.setText(Html.fromHtml("" + WordUtil.getString(R.string.live_task_item_xp) + "  " + task.getExp() + "")); + } + } +} diff --git a/live/src/main/java/com/yunbao/live/bean/LiveDataInfoModel.java b/live/src/main/java/com/yunbao/live/bean/LiveDataInfoModel.java new file mode 100644 index 000000000..81a65ec4e --- /dev/null +++ b/live/src/main/java/com/yunbao/live/bean/LiveDataInfoModel.java @@ -0,0 +1,47 @@ +package com.yunbao.live.bean; + +import com.yunbao.common.bean.BaseModel; + +public class LiveDataInfoModel extends BaseModel { + private String color; + private String title; + private String data; + + public LiveDataInfoModel(String color, String title, String data) { + this.color = color; + this.title = title; + this.data = data; + } + + public LiveDataInfoModel(String title, String data) { + this.title = title; + this.data = data; + } + + public LiveDataInfoModel() { + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } +} 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 a52e33fb1..fc25a82b2 100644 --- a/live/src/main/java/com/yunbao/live/dialog/FreePkDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/FreePkDialogFragment.java @@ -26,6 +26,7 @@ import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.StringUtil; +import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordsTypeUtil; import com.yunbao.live.R; import com.yunbao.live.adapter.FreePkRecyclerAdapter; @@ -170,7 +171,7 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl @Override public void onError(String error) { - + ToastUtil.show(com.yunbao.common.R.string.net_error); } }); } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveDataInfoDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveDataInfoDialog.java new file mode 100644 index 000000000..9d4dad966 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveDataInfoDialog.java @@ -0,0 +1,97 @@ +package com.yunbao.live.dialog; + +import android.content.Context; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.R; +import com.yunbao.live.adapter.LiveDataInfoRecyclerAdapter; +import com.yunbao.live.bean.LiveDataInfoModel; + + +import java.util.ArrayList; +import java.util.List; + +public class LiveDataInfoDialog extends AbsDialogPopupWindow { + private ImageView img; + private RecyclerView recyclerView; + private LiveDataInfoRecyclerAdapter adapter; + private List list; + private String liveUid; + + public LiveDataInfoDialog(@NonNull Context context) { + super(context); + } + + public LiveDataInfoDialog(@NonNull Context context, String liveUid) { + super(context); + this.liveUid = liveUid; + } + + public void setLiveUid(String liveUid) { + this.liveUid = liveUid; + } + + @Override + public void buildDialog(XPopup.Builder builder) { + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_live_data; + } + + @Override + protected void onCreate() { + super.onCreate(); + img = findViewById(R.id.live_data_img); + img.setImageResource(R.mipmap.icon_free_pk_waring); + recyclerView = findViewById(R.id.live_data_list); + adapter = new LiveDataInfoRecyclerAdapter(getContext()); + recyclerView.setAdapter(adapter); + initData(); + } + + private void initData() { + list = new ArrayList<>(); + list.add(new LiveDataInfoModel("#00FFFF", WordUtil.getString(R.string.live_data_coin), WordUtil.getString(R.string.live_data_loading))); + list.add(new LiveDataInfoModel("#FFF69F", WordUtil.getString(R.string.live_data_gold), WordUtil.getString(R.string.live_data_loading))); + list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_accept), WordUtil.getString(R.string.live_data_loading))); + list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_enter), WordUtil.getString(R.string.live_data_loading))); + list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_attention), WordUtil.getString(R.string.live_data_loading))); + list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_attention_rate), WordUtil.getString(R.string.live_data_loading))); + list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_fan_group), WordUtil.getString(R.string.live_data_loading))); + list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_fan_group_rate), WordUtil.getString(R.string.live_data_loading))); + adapter.setList(list); + LiveNetManager.get(getContext()) + .getLiveData(liveUid, new HttpCallback() { + @Override + public void onSuccess(com.yunbao.common.bean.LiveDataInfoModel data) { + list.clear(); + list.add(new LiveDataInfoModel("#00FFFF", WordUtil.getString(R.string.live_data_coin), data.getTotalCoin() + "")); + list.add(new LiveDataInfoModel("#FFF69F", WordUtil.getString(R.string.live_data_gold), data.getTotalGold() + "")); + list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_accept), data.getAcceptNum() + "")); + list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_enter), data.getEnterNum() + "")); + list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_attention), data.getAttentionNum() + "")); + list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_attention_rate), data.getAttentionNumRate() + "")); + list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_fan_group), data.getFanGroupNum() + "")); + list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_fan_group_rate), data.getFanGroupNumRate() + "")); + adapter.setList(list); + } + + @Override + public void onError(String error) { + ToastUtil.show(com.yunbao.common.R.string.net_error); + } + }); + + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java index 750f56dc7..4f7ae5a6f 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java @@ -202,7 +202,7 @@ public class LiveGameDialogFragment extends AbsDialogFragment { @Override public void onError(String error) { Log.i("debug", "onError: " + error); - ToastUtil.show(error); + ToastUtil.show( R.string.net_error); dismiss(); } }); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java index ec4a32d78..ee23dd050 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java @@ -218,19 +218,19 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O .nobleUseTrumpet(trumpetMsg, mLiveUid, new HttpCallback>() { @Override public void onSuccess(List data) { - dismiss(); + // dismiss(); ToastUtil.show(getResources().getString(R.string.use_successfully)); } @Override public void onError(String error) { - dismiss(); + // dismiss(); ToastUtil.show(error); } }); } else { ToastUtil.show(R.string.enough_speakers); - dismiss(); + // dismiss(); } break; @@ -240,10 +240,10 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O case GENERALMESSAGE: ((LiveActivity) mContext).sendChatMessage(content, atTextWatcher.getAtUserID(), atTextWatcher.getAtUserName()); atTextWatcher.clearMsg(); - if (imm != null) { + /* if (imm != null) {//收软键盘 imm.hideSoftInputFromWindow(mInput.getWindowToken(), 0); - } - dismiss(); + }*/ + // dismiss(); break; } mInput.setText(""); @@ -367,6 +367,7 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O @Override public void onError(String error) { + ToastUtil.show( R.string.net_error); } }); } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java index 48e7168ef..3fc60e1a5 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java @@ -1,8 +1,21 @@ package com.yunbao.live.dialog; -import static com.yunbao.common.Constants.*; +import static com.yunbao.common.Constants.LIVE_FUNC_BEAUTY; +import static com.yunbao.common.Constants.LIVE_FUNC_CAMERA; +import static com.yunbao.common.Constants.LIVE_FUNC_DR; +import static com.yunbao.common.Constants.LIVE_FUNC_LINK_MIC; +import static com.yunbao.common.Constants.LIVE_FUNC_MIC; +import static com.yunbao.common.Constants.LIVE_FUNC_RANDOM_PK; +import static com.yunbao.common.Constants.LIVE_FUNC_WISHLIST; +import static com.yunbao.common.Constants.LIVE_FUNC_WKS; +import static com.yunbao.common.Constants.LIVE_FUNC_ZG; +import static com.yunbao.common.Constants.LIVE_FUNC_ZSLK; +import static com.yunbao.common.Constants.LIVE_ROBOT; import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.os.SystemClock; import android.view.Gravity; import android.view.View; import android.view.Window; @@ -10,10 +23,12 @@ import android.view.WindowManager; import android.widget.ImageView; import android.widget.TextView; +import com.lxj.xpopup.XPopup; import com.yunbao.common.Constants; import com.yunbao.common.dialog.AbsDialogFragment; -import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.views.LiveAnchorMessageCustomPopup; import com.yunbao.live.R; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.interfaces.LiveFunctionClickListener; @@ -29,7 +44,9 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements private LiveFunctionClickListener mFunctionClickListener; private int leave = 0; private boolean isPk; + private TextView mLiveTimeTextView;//主播的直播时长 + private String liveUid; // boolean isRy = false; @Override @@ -70,6 +87,8 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements leave = bundle.getInt("leave", 0); isPk = bundle.getBoolean("isPk", false); // isRy = bundle.getBoolean("isRy", false); + mAnchorLiveTime = bundle.getLong("liveTime"); + liveUid = bundle.getString("liveUid"); } mWishView = findViewById(R.id.live_tool_wish); mPrankView = findViewById(R.id.live_tool_prank); @@ -81,7 +100,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements mMultiPkView = findViewById(R.id.live_tool_multi_pk); mMicView = findViewById(R.id.live_tool_mic); mRandomPk = findViewById(R.id.live_tool_random_pk); - + mLiveTimeTextView = (TextView) findViewById(R.id.live_time); mWishView.setOnClickListener(this); mPrankView.setOnClickListener(this); mWksView.setOnClickListener(this); @@ -92,6 +111,10 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements mMultiPkView.setOnClickListener(this); mMicView.setOnClickListener(this); mRandomPk.setOnClickListener(this); + findViewById(R.id.message_linear).setOnClickListener(this); + findViewById(R.id.broadcast_data).setOnClickListener(this); + findViewById(R.id.anchor_task).setOnClickListener(this); + findViewById(R.id.live_tool_robot).setOnClickListener(this); if (leave == 0) { @@ -101,7 +124,9 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements ((ImageView) mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave_p); ((TextView) mLeaveView.findViewById(R.id.live_tool_leave_text)).setText(R.string.live_zslk1); } - + mLiveRoomHandler = new LiveRoomHandler(); + mLiveTimeTextView.setText(StringUtil.getDurationText(mAnchorLiveTime)); + startAnchorLiveTime(); } public void setFunctionClickListener(LiveFunctionClickListener functionClickListener) { @@ -146,9 +171,74 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements mFunctionClickListener.onClick(LIVE_FUNC_MIC); } else if (id == R.id.live_tool_random_pk) { mFunctionClickListener.onClick(LIVE_FUNC_RANDOM_PK); - }else if (id==R.id.live_tool_robot){ + } else if (id == R.id.live_tool_robot) { mFunctionClickListener.onClick(LIVE_ROBOT); dismiss(); + } else if (id == R.id.message_linear) { + new XPopup.Builder(getContext()) + .asCustom(new LiveAnchorMessageCustomPopup(getContext(), liveUid)) + .show(); + dismiss(); + } else if (id == R.id.broadcast_data) { + //主播数据 + new LiveDataInfoDialog(mContext, liveUid).showDialog(); + dismiss(); + } else if (id == R.id.anchor_task) { + //主播任务 + taskDialog = new LiveTaskDialog(mContext); + taskDialog.setLiveUid(liveUid); + taskDialog.updateLiveTimer(mAnchorLiveTime); + taskDialog.showDialog(); + } } + + private final int WHAT_ANCHOR_LIVE_TIME = 3;//直播间主播计时 + private LiveRoomHandler mLiveRoomHandler; + private long mAnchorLiveTime;//主播直播时间 + private LiveTaskDialog taskDialog; + + /** + * 主播显示直播时间 + */ + private void showAnchorLiveTime() { + if (mLiveTimeTextView != null) { + mAnchorLiveTime += 1000; + mLiveTimeTextView.setText(StringUtil.getDurationText(mAnchorLiveTime)); + startAnchorLiveTime(); + } + } + + public void startAnchorLiveTime() { + if (mLiveRoomHandler != null) { + mLiveRoomHandler.sendEmptyMessageAtTime(WHAT_ANCHOR_LIVE_TIME, getNextTime(1000)); + } + } + + private class LiveRoomHandler extends Handler { + @Override + public void handleMessage(Message msg) { + + switch (msg.what) { + + case WHAT_ANCHOR_LIVE_TIME: + showAnchorLiveTime(); + break; + + + } + } + + public void release() { + removeCallbacksAndMessages(null); + } + } + + private long getNextTime(int time) { + long now = SystemClock.uptimeMillis(); + if (time < 1000) { + return now + time; + } + return now + time + -now % 1000; + } } 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 273f208cf..ac7877b56 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java @@ -82,7 +82,7 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements private LiveNewGuardBuyItemsAdapter buyItemsAdapter; private GuardRightAdapter mGuardRightAdapter; - private boolean isEmpty,showBuyView; + private boolean isEmpty, showBuyView; private ImageView mBack; private RelativeLayout relativeLayout; @@ -169,13 +169,13 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements mAncherName = bundle.getString(Constants.LIVE_ANCHER_NAME); mAncherIcon = bundle.getString(Constants.LIVE_ANCHER_ICON); mUserIcon = bundle.getString(Constants.USER_ICON); - showBuyView = bundle.getBoolean("showBuyView",true); + showBuyView = bundle.getBoolean("showBuyView", true); String coinName = WordUtil.getString(R.string.diamond); mCoinName = coinName; - isEmpty=bundle.getBoolean("guard",true); + isEmpty = bundle.getBoolean("guard", true); // mCoinNameTextView.setText(WordUtil.getString(R.string.guard_my) + coinName + ":"); - mCoinNameTextView.setText("快为您喜欢的主播开通守护吧"); - anchorName.setText(String.format("成爲%s的守護", mAncherName)); + mCoinNameTextView.setText(R.string.favoriteanchor); + anchorName.setText(String.format(mContext.getString(R.string.theguardianof), mAncherName)); } LiveHttpUtil.getGuardBuyList(new HttpCallback() { @Override @@ -211,11 +211,11 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements private void initView() { int guardType = mLiveGuardInfo.getMyGuardType(); if (guardType == Constants.GUARD_TYPE_NONE) { - if(isEmpty){ + if (isEmpty) { iconCover.setImageResource(R.drawable.guardian_img_wings); userIconOne.setVisibility(View.GONE); userIconTwo.setVisibility(View.GONE); - }else{ + } else { mBack.setVisibility(View.VISIBLE); ImgLoader.display(mContext, mAncherIcon, userIconOne); ImgLoader.display(mContext, mUserIcon, userIconTwo); @@ -223,7 +223,7 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements userIconTwo.setVisibility(View.VISIBLE); } - // iconCover.setBackgroundResource(R.drawable.guardian_img_wings); + // iconCover.setBackgroundResource(R.drawable.guardian_img_wings); buy1.setVisibility(View.VISIBLE); @@ -240,19 +240,19 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements String title = ""; switch (guardType) { case Constants.GUARD_TYPE_DAY: - title = "您是當前主播的周守護"; + title = mContext.getString(R.string.guard_tip_day1); break; case Constants.GUARD_TYPE_MONTH: - title = "您是當前主播的月守護"; + title = mContext.getString(R.string.guard_tip_day2); break; case Constants.GUARD_TYPE_YEAR: - title = "您是當前主播的年守護"; + title = mContext.getString(R.string.guard_tip_day3); break; } anchorName.setText(title); - guard_tips.setText("守護日期截止到:"+ mLiveGuardInfo.getMyGuardEndTime()); + guard_tips.setText(String.format(mContext.getString(R.string.guardiandate), mLiveGuardInfo.getMyGuardEndTime())); } - if(!showBuyView){ + if (!showBuyView) { relativeLayout.setVisibility(View.GONE); } @@ -267,12 +267,12 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements bean.setChecked(false); } for (int i : guardBuyBean.getPrivilege()) { - if(i= guardBuyBean.getCoin()); + // mBtnBuy.setEnabled(mCoinVal >= guardBuyBean.getCoin()); } } @@ -286,13 +286,14 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements } else if (i == R.id.guard_buy) { forwardMyCoin(); - }else if (i==R.id.guard_back){ + } else if (i == R.id.guard_back) { gotoBack(); } } - private void gotoBack(){ + + private void gotoBack() { dismiss(); - ((LiveActivity)mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity); + ((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity); } /** diff --git a/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java index d3e63b0d5..110932759 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java @@ -260,7 +260,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O @Override public void onError(String error) { - + ToastUtil.show( R.string.net_error); } }); } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveTaskDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveTaskDialog.java new file mode 100644 index 000000000..d09fba828 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveTaskDialog.java @@ -0,0 +1,269 @@ +package com.yunbao.live.dialog; + +import android.app.Dialog; +import android.content.Context; +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.viewpager2.adapter.FragmentStateAdapter; +import androidx.viewpager2.widget.ViewPager2; + +import com.google.android.material.tabs.TabLayout; +import com.google.android.material.tabs.TabLayoutMediator; +import com.lxj.xpopup.XPopup; +import com.yunbao.common.bean.LiveTaskModel; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.R; +import com.yunbao.live.adapter.LiveTaskRecyclerAdapter; + +import java.util.ArrayList; +import java.util.List; + +/** + * 主播直播任务弹框 + */ +public class LiveTaskDialog extends AbsDialogPopupWindow { + private TextView newStarTime; + private ImageView newStarImg; + private ImageView taskInfoImg; + private ImageView tipImg; + private TabLayout tabLayout; + + private ViewPager2 viewPager; + + + private TabLayoutMediator mediator; + + + private Context mContext; + String liveUid; + int liveTimer; + + public LiveTaskDialog(Context context) { + super(context); + this.mContext = context; + } + + @Override + public void buildDialog(XPopup.Builder builder) { + builder.enableDrag(false); + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_live_task; + } + + @Override + protected void onCreate() { + super.onCreate(); + initView(); + } + + public void setLiveUid(String liveUid) { + this.liveUid = liveUid; + } + + private void initView() { + newStarTime = findViewById(R.id.task_new_star_time); + newStarImg = findViewById(R.id.live_task_banner1); + taskInfoImg = findViewById(R.id.live_task_banner2); + tipImg = findViewById(R.id.live_task_tip); + tabLayout = findViewById(R.id.live_task_menu); + viewPager = findViewById(R.id.live_task_viewpager); + initImgView(); + createTask(); + + } + + private void initImgView() { + newStarImg.setImageResource(R.mipmap.dialog_task_new_star); + taskInfoImg.setImageResource(R.mipmap.dialog_task_info); + tipImg.setImageResource(R.mipmap.icon_guize); + tipImg.setOnClickListener(v -> new LiveTaskInfoDialog(mContext).showDialog()); + } + + private void initTabLayout(LiveTaskModel model) { + TabLayout.Tab liveTaskTag = tabLayout.newTab(); + TabLayout.Tab userTaskTag = tabLayout.newTab(); + liveTaskTag.setText(R.string.live_task_tab1); + userTaskTag.setText(R.string.live_task_tab2); + tabLayout.addTab(liveTaskTag); + tabLayout.addTab(userTaskTag); + + viewPager.setAdapter(new FragmentStateAdapter(((AppCompatActivity) mContext).getSupportFragmentManager(), getLifecycle()) { + + @Override + public int getItemCount() { + return 2; + } + + @NonNull + @Override + public Fragment createFragment(int position) { + TaskFragment fragment = new TaskFragment(); + Bundle bundle = new Bundle(); + bundle.putInt("position", position + 1); + bundle.putInt("liveTimer", liveTimer); + bundle.putString("liveUid", liveUid); + bundle.putSerializable("data", model); + fragment.setArguments(bundle); + return fragment; + } + + }); + + mediator = new TabLayoutMediator(tabLayout, viewPager, true, new TabLayoutMediator.TabConfigurationStrategy() { + @Override + public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) { + if (position == 0) { + tab.setText(R.string.live_task_tab1); + } else { + tab.setText(R.string.live_task_tab2); + } + } + + }); + mediator.attach(); + } + + private void updateMainUi(LiveTaskModel.NewUser task) { + if (task.isNew()) { + newStarImg.setVisibility(VISIBLE); + newStarTime.setVisibility(VISIBLE); + newStarTime.setText(task.getEndTime()); + } + } + + private Dialog loadDialog; + + private void createTask() { + loadDialog = DialogUitl.loadingDialog(getContext()); + loadDialog.show(); + LiveNetManager.get(getContext()) + .getLiveTask(1, liveUid, new HttpCallback() { + @Override + public void onSuccess(LiveTaskModel data) { + Log.i("直播任务", "onSuccess: " + data); + updateMainUi(data.getUser()); + initTabLayout(data); + if (loadDialog != null) { + loadDialog.dismiss(); + } + } + + @Override + public void onError(String error) { + Log.e("直播任务", "onError: " + error); + if (loadDialog != null) { + loadDialog.dismiss(); + } + ToastUtil.show(R.string.net_error); + } + }); + } + + public void updateLiveTimer(long time) { + liveTimer = (int) time / (1000 * 60); + /*TaskFragment fragment = (TaskFragment) ((AppCompatActivity) mContext).getSupportFragmentManager().findFragmentByTag("f0"); + if (fragment != null) { + fragment.adapter.updateTimer(liveTimer); + }*/ + } + + public static class TaskFragment extends Fragment { + private RecyclerView taskList; + private LiveTaskRecyclerAdapter adapter; + private int position; + private int liveTimer; + private String liveUid; + + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return new RecyclerView(getActivity()); + } + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + this.position = getArguments().getInt("position", -1); + this.liveTimer = getArguments().getInt("liveTimer", -1); + this.liveUid = getArguments().getString("liveUid", "0"); + taskList = (RecyclerView) view; + initTaskList(); + if (position == 2) { + createTask(position); + } else { + update((LiveTaskModel) getArguments().getSerializable("data"), 1); + } + } + + private void initTaskList() { + adapter = new LiveTaskRecyclerAdapter(getContext()); + taskList.setAdapter(adapter); + taskList.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false)); + } + + private void createTask(int type) { + LiveNetManager.get(getContext()) + .getLiveTask(type, liveUid, new HttpCallback() { + + @Override + public void onSuccess(LiveTaskModel data) { + Log.i("直播任务", "onSuccess: " + data); + update(data, type); + } + + @Override + public void onError(String error) { + Log.e("直播任务", "onError: " + error); + } + }); + } + + private void update(LiveTaskModel data, int type) { + LiveTaskModel.Task task = new LiveTaskModel.Task(); + LiveTaskModel.Task task2 = new LiveTaskModel.Task(); + if (type == 1) { + task.setTaskName(WordUtil.getString(R.string.live_task_no1)); + task2.setTaskName(WordUtil.getString(R.string.live_task_no2)); + } else { + task.setTaskName(WordUtil.getString(R.string.live_task_fans_no1)); + task2.setTaskName(WordUtil.getString(R.string.live_task_fans_no2)); + } + task.setType(LiveTaskModel.TASK_TYPE_TIP); + task2.setType(LiveTaskModel.TASK_TYPE_TIP); + List task1 = new ArrayList<>(); + task1.add(task); + task1.addAll(data.getList().get(0)); + if (type == 1) { + for (LiveTaskModel.Task tk : task1) { + tk.setNowValue(liveTimer); + } + } + task1.add(task2); + task1.addAll(data.getList().get(1)); + adapter.setTasks(task1); + } + + } + +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveTaskInfoDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveTaskInfoDialog.java new file mode 100644 index 000000000..1b6423f49 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveTaskInfoDialog.java @@ -0,0 +1,34 @@ +package com.yunbao.live.dialog; + +import android.content.Context; +import android.widget.ImageView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.live.R; + +public class LiveTaskInfoDialog extends AbsDialogPopupWindow { + public LiveTaskInfoDialog(@NonNull Context context) { + super(context); + } + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_live_task_info; + } + + @Override + protected void onCreate() { + super.onCreate(); + ImageView back = findViewById(R.id.live_task_info_back); + back.setImageResource(R.mipmap.icon_back); + back.setOnClickListener(v -> dismiss()); + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveTotalDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveTotalDialog.java index 67f10500c..ba776b875 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveTotalDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveTotalDialog.java @@ -19,6 +19,7 @@ import com.yunbao.common.dialog.AbsDialogFragment; 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.views.weight.ViewClicksAntiShake; import com.yunbao.live.adapter.FunGamesAdapter; import com.yunbao.live.event.LiveAudienceEvent; @@ -92,6 +93,7 @@ public class LiveTotalDialog extends AbsDialogFragment { @Override public void onError(String error) { + ToastUtil.show( R.string.net_error); } }); } else { diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java index 93ca57183..801cbfe57 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java @@ -25,6 +25,7 @@ import com.blankj.utilcode.util.GsonUtils; import com.google.gson.reflect.TypeToken; import com.yunbao.common.Constants; import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.LiveUserRankBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserRankModel; @@ -38,7 +39,6 @@ import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.adapter.UserMoreInfoAdapter; import com.yunbao.live.bean.LiveGuardInfo; -import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.live.http.LiveHttpUtil; import java.util.ArrayList; @@ -68,7 +68,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie private RelativeLayout bottom_msg;//底部信息的布局,在榜单列表下不需要显示底部信息 private String Tips = "1"; private String type = "guanzhong"; - private boolean isOnly, noble,showBuyView; + private boolean isOnly, noble, showBuyView; ImageView no_more; private List outRankHide = new ArrayList<>(); @@ -115,7 +115,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie stream = bundle.getString(Constants.STREAM); isOnly = bundle.getBoolean("only", false); noble = bundle.getBoolean("noble", false); - showBuyView = bundle.getBoolean("showBuyView",true); + showBuyView = bundle.getBoolean("showBuyView", true); String outRankHideString = bundle.getString("outRankHide"); outRankHide = GsonUtils.fromJson(outRankHideString, new TypeToken>() { }.getType()); @@ -373,27 +373,27 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mRefreshView.getLayoutParams(); params.bottomMargin = DpUtil.dp2px(65); if (Tips.equals("1")) { - tags.setText("開通貴族,尊享超多特權!"); + tags.setText(R.string.enjoy_a_lot); btn.setBackgroundResource(R.mipmap.btn_openvip); - btn.setText("開通貴族"); + btn.setText(R.string.live_ktgz); setTextColor(audience_btn, guard_btn, fans_btn, weekRank, dayRank); gz_view.setVisibility(View.GONE); userMoreInfoAdapter.type = "1"; type = "guanzhong"; } else if (Tips.equals("2")) { - tags.setText("快為您喜歡的主播開通守護吧"); + tags.setText(R.string.guard_for_your); btn.setBackgroundResource(R.mipmap.btn_openprotection); - btn.setText("守護列表"); + btn.setText(R.string.daemon_list); setTextColor(guard_btn, audience_btn, fans_btn, dayRank, weekRank); gz_view.setVisibility(View.GONE); userMoreInfoAdapter.type = "2"; no_more.setImageResource(R.mipmap.ic_guard_not); - noMoreText.setText("主播正在等待您成為TA的守護,\n為TA保駕護航!"); + noMoreText.setText(R.string.waiting_for_you); noMoreText.setVisibility(View.VISIBLE); type = "guard"; } else if (Tips.equals("3")) { - tags.setText("快加入您喜歡的主播粉絲團吧"); - btn.setText("加入粉絲團"); + tags.setText(R.string.favorite_host_fan); + btn.setText(R.string.Join_a_fan_club); btn.setBackgroundResource(R.mipmap.btn_joinfans); setTextColor(fans_btn, audience_btn, guard_btn, dayRank, weekRank); gz_view.setVisibility(View.GONE); @@ -421,7 +421,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie setTextColor(weekRank, audience_btn, guard_btn, fans_btn, gz_view, dayRank); noMoreText.setVisibility(View.VISIBLE); } - if(!showBuyView){ + if (!showBuyView) { bottom_msg.setVisibility(View.GONE); params.bottomMargin = DpUtil.dp2px(0); } diff --git a/live/src/main/java/com/yunbao/live/dialog/RandomPkDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/RandomPkDialogFragment.java index 2503ee80a..021e83403 100644 --- a/live/src/main/java/com/yunbao/live/dialog/RandomPkDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/RandomPkDialogFragment.java @@ -194,7 +194,7 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On @Override public void onError(String error) { - + ToastUtil.show( R.string.net_error); } }); } 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 efa31c2e4..78c0b0f8e 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -4,6 +4,7 @@ import static com.lzy.okgo.utils.HttpUtils.runOnUiThread; import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK; import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK; import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK; +import static com.yunbao.live.views.LivePushRyViewHolder.btn_close; import static com.yunbao.live.views.LivePushRyViewHolder.contexts; import static com.yunbao.live.views.LivePushRyViewHolder.rcrtcLiveInfo; import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom; @@ -155,6 +156,12 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { public static List inputStreamList = new ArrayList<>(); public static List inputStreamList1 = new ArrayList<>(); + private boolean DRInitiator = false;//是否是duorenPK发起人 + + public LiveRyLinkMicPkPresenter setDRInitiator(boolean DRInitiator) { + this.DRInitiator = DRInitiator; + return this; + } private IRCRTCOtherRoomEventsListener otherRoomEventsListener = new IRCRTCOtherRoomEventsListener() { @@ -1131,6 +1138,9 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { Log.e("ry", "退出多人OKKK" + inputStreamList.size()); isDRPK = 0; + if (btn_close != null) { + btn_close.setVisibility(View.GONE); + } for (int i = 0; i < inputStreamList.size(); i++) { //退出副房间 RCRTCEngine.getInstance().leaveOtherRoom(inputStreamList.get(i).getUserId(), true, new IRCRTCResultCallback() { @@ -1679,7 +1689,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onError(String error) { - + ToastUtil.show( R.string.net_error); } }); @@ -2668,6 +2678,9 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT)); // endDRGif(); + if (DRInitiator) { + LiveNetManager.get(mContext).jieshuDRPK("" + IMLoginManager.get(mContext).getUserInfo().getId()); + } } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java index c4a4c2b1d..302a904d0 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java @@ -29,6 +29,7 @@ import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.StringUtil; +import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.AbsViewHolder; import com.yunbao.common.views.weight.ClipPathCircleImage; import com.yunbao.live.R; @@ -131,6 +132,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList @Override public void onError(String error) { + ToastUtil.show( R.string.net_error); } }); } diff --git a/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java index 9312232bc..1411da666 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java @@ -8,6 +8,7 @@ import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; import android.os.Looper; +import android.text.Html; import android.text.TextUtils; import android.util.Log; import android.view.View; @@ -25,6 +26,7 @@ import com.lxj.xpopup.core.BasePopupView; import com.lxj.xpopup.interfaces.XPopupCallback; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; +import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LiveClassBean; import com.yunbao.common.bean.LiveRoomTypeBean; import com.yunbao.common.bean.UserBean; @@ -38,6 +40,7 @@ import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.L; import com.yunbao.common.utils.ProcessImageUtil; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; @@ -63,6 +66,7 @@ import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import java.io.File; +import java.util.Locale; import cn.rongcloud.rtc.api.RCRTCEngine; import cn.rongcloud.rtc.api.stream.RCRTCCameraOutputStream; @@ -76,7 +80,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl private EditText mEditTitle; private ProcessImageUtil mImageUtil; private File mAvatarFile; - private TextView mLiveClass; + private TextView mLiveClass, anchorAgreement; private TextView mLiveTypeTextView, liveClarity;//房间类型TextView private TextView mLiveWishListTextView;//心愿单TextView private int mLiveClassID;//直播频道id @@ -88,9 +92,10 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl private LiveClassBean classBean; private FaceManager manager; private TextView faceTextView;//提示人脸未检测到的TextView - private ImageView imgClarity; + private ImageView imgClarity, selectorProtocol; private int selectClarity = 1; private LiveOpenCustomPopup liveOpenCustomPopup; + private boolean selector = true; public LiveNewReadyRyViewHolder(Context context, ViewGroup parentView, int liveSdk) { super(context, parentView, liveSdk); @@ -112,7 +117,9 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl public void init() { mRootView = (ConstraintLayout) findViewById(R.id.traceroute_rootview); imgClarity = (ImageView) findViewById(R.id.img_clarity); + selectorProtocol = (ImageView) findViewById(R.id.selector_protocol); liveClarity = (TextView) findViewById(R.id.live_clarity); + anchorAgreement = (TextView) findViewById(R.id.anchor_agreement); mRootView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -121,6 +128,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } }); + mAvatar = (ConstraintLayout) findViewById(R.id.avatar); mAvatar.setOnClickListener(this); UserBean u = CommonAppConfig.getInstance().getUserBean(); @@ -186,6 +194,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl findViewById(R.id.btn_start_live).setOnClickListener(this); findViewById(R.id.btn_wishlist).setOnClickListener(this); findViewById(R.id.btn_horizontally).setOnClickListener(this); + findViewById(R.id.anchor_agreement_layout).setOnClickListener(this); if (manager != null) { manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() { @@ -271,6 +280,19 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl .asCustom(liveClarityCustomPopup) .show(); }); + String keywordHtml2 = "" + mContext.getString(R.string.anchor_hint) + ""; + String contextHtml = "" + mContext.getString(R.string.anchor_agreement) + ""; + anchorAgreement.setText(Html.fromHtml(contextHtml + keywordHtml2)); + selectorProtocol.setPressed(true); + selectorProtocol.setSelected(true); + selector = selectorProtocol.isSelected(); + selectorProtocol.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + selector = !selector; + selectorProtocol.setSelected(selector); + } + }); } private void setSelectClarity(int selectClarity) { @@ -357,6 +379,10 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl } else if (i == R.id.btn_room_type) { chooseLiveType(); } else if (i == R.id.btn_start_live) { + if (!selector) { + ToastUtil.show(R.string.anchor_agreement_hint); + return; + } if (mLiveClassID == 0) { ToastUtil.show(R.string.live_choose_live_class); return; @@ -524,6 +550,21 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl new XPopup.Builder(mContext) .asCustom(new LiveRobotSettingCustomPopup(mContext)) .show(); + } else if (i == R.id.anchor_agreement_layout) { + String ct = Locale.getDefault().getLanguage(); + IMLoginModel model = IMLoginManager.get(mContext).getUserInfo(); + StringBuffer url = new StringBuffer(); + url.append(CommonAppConfig.HOST); + if (TextUtils.equals(ct, "zh")) { + url.append("/index.php?g=portal&m=page&a=index&id=671"); + } else { + url.append("/index.php?g=portal&m=page&a=index&id=672"); + } + url.append("&uid=") + .append(model.getId()) + .append("&token=") + .append(model.getToken()); + RouteUtil.forwardLiveZhuangBanActivity(url.toString(), false); } } 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 e4dedb4c0..0267d522b 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -1,13 +1,13 @@ package com.yunbao.live.views; import static com.lzy.okgo.utils.HttpUtils.runOnUiThread; -import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL; import android.Manifest; import android.app.Dialog; import android.content.Context; import android.graphics.Color; import android.media.AudioManager; +import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.SystemClock; @@ -35,6 +35,7 @@ import com.lxj.xpopup.core.BasePopupView; import com.lxj.xpopup.interfaces.XPopupCallback; import com.lzf.easyfloat.EasyFloat; import com.lzy.okserver.OkDownload; +import com.yunbao.common.Constants; import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; @@ -53,6 +54,7 @@ import com.yunbao.common.views.LiveClarityCustomPopup; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveAudienceActivity; +import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.utils.LiveExoPlayerManager; @@ -89,7 +91,6 @@ import cn.rongcloud.rtc.base.RCRTCRemoteVideoFrame; import cn.rongcloud.rtc.base.RCRTCRoomType; import cn.rongcloud.rtc.base.RCRTCStreamType; import cn.rongcloud.rtc.base.RTCErrorCode; -import cn.rongcloud.rtc.center.stream.RCRTCAudioInputStreamImpl; import cn.rongcloud.rtc.core.RendererCommon; public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { @@ -122,6 +123,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { private TextView debugView; private LiveExoPlayerManager mPlayer; private boolean isPk = false; + private boolean userJoinLinkMic = false;//用户是否已加入房间 //0未申请1申请中2连麦中 RCRTCRoom rcrtcRoom; @@ -393,7 +395,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { mVideoView.requestLayout(); RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams(); - params1.height = ViewGroup.LayoutParams.WRAP_CONTENT; + params1.height = ViewGroup.LayoutParams.WRAP_CONTENT; params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); params1.addRule(RelativeLayout.ALIGN_TOP); ry_view.setLayoutParams(params1); @@ -556,17 +558,17 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { params.addRule(RelativeLayout.ALIGN_TOP); mVideoView.requestLayout(); } - if (detailsView != null) { - mVideoView.removeView(detailsView); - detailsView = null; - } +// if (detailsView != null) { +// mVideoView.removeView(detailsView); +// detailsView = null; +// } } - public void removeDetailView(){ - if (detailsView != null) { - mVideoView.removeView(detailsView); - detailsView = null; - } + public void removeDetailView() { +// if (detailsView != null) { +// mVideoView.removeView(detailsView); +// detailsView = null; +// } } @Override @@ -730,9 +732,23 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { Log.e("ry", "下麦成功"); // 该用户切换为观众成功,可以以观众身份进行音视频 //退出rtc播放 + leaveRoom(); + } + + /** + * 当切换失败且不影响当前角色继续音视频时回调 + * @param errorCode 失败错误码 + */ + @Override + public void onFailed(RTCErrorCode errorCode) { + Log.e("ry", "下麦失败" + errorCode); + leaveRoom(); + } + private void leaveRoom(){ RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() { @Override public void onSuccess() { + userJoinLinkMic = false; Log.e("ry", "退出多人房间成功"); new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { @@ -758,21 +774,11 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { @Override public void onFailed(RTCErrorCode errorCode) { Log.e("ry", errorCode + "退出多人房间成功"); - + userJoinLinkMic = false; } }); } - - /** - * 当切换失败且不影响当前角色继续音视频时回调 - * @param errorCode 失败错误码 - */ - @Override - public void onFailed(RTCErrorCode errorCode) { - Log.e("ry", "下麦失败" + errorCode); - - } }); } } else if ("Debug".equals(str)) { @@ -882,6 +888,10 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { public void UsertoRY() { userinputStreamList.clear(); Log.e("ry", "主播同意了UsertoRY"); + if (userJoinLinkMic) {//已经在房间内,不再joinRoom直接去连麦 + subscribeMic(rcrtcRoom); + return; + } RCRTCRoomConfig roomConfig = RCRTCRoomConfig.Builder.create() // 根据实际场景,选择音视频直播:LIVE_AUDIO_VIDEO 或音频直播:LIVE_AUDIO .setRoomType(RCRTCRoomType.LIVE_AUDIO_VIDEO) @@ -892,59 +902,32 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { @Override public void onSuccess(RCRTCRoom data) { + userJoinLinkMic = true; rcrtcRoom = data; - runOnUiThread(new Runnable() { - @Override - public void run() { - RCRTCEngine.getInstance().enableSpeaker(true); - //遍历远端用户发布的资源列表 - for (RCRTCInputStream stream : data.getLiveStreams()) { - if (stream.getMediaType() == RCRTCMediaType.VIDEO) { - //暂停播放 - mPlayer.stop(); - //如果远端用户发布的是视频流,创建显示视图RCRTCVideoView,并添加到布局中显示 - - //如果远端用户发布的是视频流,创建显示视图RCRTCVideoView,并添加到布局中显示 - RCRTCVideoView remoteView = new RCRTCVideoView(contexts); - ((RCRTCVideoInputStream) stream).setVideoView(remoteView); - //todo 本demo只演示添加1个远端用户的视图 - remoteView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); - remoteView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT); - ry_view.addView(remoteView); - Log.e("ry", stream.getMediaType() + "rcrtcOtherRoom成功 :" + data.getLiveStreams().size()); - } - userinputStreamList.add(stream); - } - rcrtcRoom.getLocalUser().subscribeStreams(userinputStreamList, new IRCRTCResultCallback() { - - @Override - public void onFailed(RTCErrorCode errorCode) { - Log.e("ry", userinputStreamList.size() + LiveActivity.mLiveUid + "订阅失败" + errorCode.toString()); - - } - - @Override - public void onSuccess() { - Log.e("ry", "订阅资源成功"); -// new Handler().postDelayed(new Runnable() { -// @Override -// public void run() { - toMic(); -// } -// }, 3000); - - } - }); - } - }); - + subscribeMic(data); } @Override public void onFailed(RTCErrorCode errorCode) { Log.e("ry", LiveActivity.mLiveUid + errorCode + ""); - ToastUtil.show("房间失败" + errorCode); + if (errorCode.getValue() == 50007) {//userJoinLinkMic可能失效,直接leaveRoom + userJoinLinkMic = false; + RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() { + + @Override + public void onFailed(RTCErrorCode errorCode) { + + } + + @Override + public void onSuccess() { + UsertoRY(); + } + }); + }else{ + ToastUtil.show("房间失败" + errorCode); + } } }); @@ -952,6 +935,55 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } + private void subscribeMic(RCRTCRoom data) { + runOnUiThread(new Runnable() { + @Override + public void run() { + RCRTCEngine.getInstance().enableSpeaker(true); + //遍历远端用户发布的资源列表 + Log.i(TAG, "软件资源数量:"+data.getLiveStreams().size()); + for (RCRTCInputStream stream : data.getLiveStreams()) { + Log.i(TAG, "资源流 type: "+stream.getMediaType()); + if (stream.getMediaType() == RCRTCMediaType.VIDEO) { + //暂停播放 + mPlayer.stop(); + //如果远端用户发布的是视频流,创建显示视图RCRTCVideoView,并添加到布局中显示 + + //如果远端用户发布的是视频流,创建显示视图RCRTCVideoView,并添加到布局中显示 + RCRTCVideoView remoteView = new RCRTCVideoView(contexts); + ((RCRTCVideoInputStream) stream).setVideoView(remoteView); + //todo 本demo只演示添加1个远端用户的视图 + remoteView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + remoteView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT); + ry_view.addView(remoteView); + Log.e("ry", stream.getMediaType() + "rcrtcOtherRoom成功 :" + data.getLiveStreams().size()); + } + userinputStreamList.add(stream); + } + rcrtcRoom.getLocalUser().subscribeStreams(userinputStreamList, new IRCRTCResultCallback() { + + @Override + public void onFailed(RTCErrorCode errorCode) { + Log.e("ry", userinputStreamList.size() + LiveActivity.mLiveUid + "订阅失败" + errorCode.toString()); + + } + + @Override + public void onSuccess() { + Log.e("ry", "订阅资源成功"); +// new Handler().postDelayed(new Runnable() { +// @Override +// public void run() { + toMic(); +// } +// }, 3000); + + } + }); + } + }); + } + /** * 主房间事件监听 * 详细说明请参考文档:https://www.rongcloud.cn/docs/api/android/rtclib_v4/cn/rongcloud/rtc/api/callback/IRCRTCRoomEventsListener.html @@ -1221,129 +1253,28 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } } } - private int mPkTimeCount = 0; - private Handler countdownHandler = new Handler(); - private View detailsView = null; - private FrameLayout timeTitle; - private TextView textTime; - private TextView textPkName1, textPkName2, textPkName3, textPkName4; - private TextView textGrade1, textGrade2, textGrade3, textGrade4; - private ImageView imageGrade1, imageGrade2, imageGrade3, imageGrade4; - private LinearLayout linearGrade1, linearGrade2, linearGrade3, linearGrade4; - /** - * PK倒计时 - */ - public void upDataPkScore(JSONArray pkScores, int time) { + private int mPkTimeCount = 0; - if (detailsView == null) { - detailsView = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null); - timeTitle = detailsView.findViewById(R.id.time_title); - textTime = detailsView.findViewById(R.id.text_time); - linearGrade1 = detailsView.findViewById(R.id.lin_pk1); - linearGrade2 = detailsView.findViewById(R.id.lin_pk2); - linearGrade3 = detailsView.findViewById(R.id.lin_pk3); - linearGrade4 = detailsView.findViewById(R.id.lin_pk4); - textPkName1 = detailsView.findViewById(R.id.text_pk_name1); - textPkName2 = detailsView.findViewById(R.id.text_pk_name2); - textPkName3 = detailsView.findViewById(R.id.text_pk_name3); - textPkName4 = detailsView.findViewById(R.id.text_pk_name4); - textGrade1 = detailsView.findViewById(R.id.text_grade1); - textGrade2 = detailsView.findViewById(R.id.text_grade2); - textGrade3 = detailsView.findViewById(R.id.text_grade3); - textGrade4 = detailsView.findViewById(R.id.text_grade4); - imageGrade1 = detailsView.findViewById(R.id.image_grade1); - imageGrade2 = detailsView.findViewById(R.id.image_grade2); - imageGrade3 = detailsView.findViewById(R.id.image_grade3); - imageGrade4 = detailsView.findViewById(R.id.image_grade4); - linearGrade1.setVisibility(View.GONE); - linearGrade2.setVisibility(View.GONE); - linearGrade3.setVisibility(View.GONE); - linearGrade4.setVisibility(View.GONE); - mVideoView.addView(detailsView); - } + public interface PlayViewLayoutInterface { + void playViewLayout(int width, int height); + } - for (int i = 0; i < pkScores.size(); i++) { - JSONObject score = pkScores.getJSONObject(i); - String userNiceName = score.getString("user_nicename"); - long userScore = score.getLong("score"); - int resScore = R.mipmap.icon_livepk_no1; - if (userScore == 0 && !score.containsKey("paiming")) { - resScore = R.mipmap.icon_livepk_no1; - } else { - if (score.containsKey("paiming")) { - int ranking = score.getIntValue("paiming"); - switch (ranking) { - case 1: - resScore = R.mipmap.icon_livepk_no1; - break; - case 2: - resScore = R.mipmap.icon_livepk_no2; - break; - case 3: - resScore = R.mipmap.icon_livepk_no3; - break; - case 4: - resScore = R.mipmap.icon_livepk_no4; - break; - } + private PlayViewLayoutInterface layoutInterface; + + public void setLayoutInterface(PlayViewLayoutInterface layoutInterface) { + mVideoView.post(new Runnable() { + @Override + public void run() { + int width = mVideoView.getMeasuredWidth(); + int height = mVideoView.getMeasuredHeight(); + if (layoutInterface != null) { + layoutInterface.playViewLayout(width, height); } } - if (i == 0) { - linearGrade1.setVisibility(View.VISIBLE); - textPkName1.setText(userNiceName); - ImgLoader.display(mContext, resScore, imageGrade1); - textGrade1.setText(String.valueOf(userScore)); - } else if (i == 1) { - linearGrade2.setVisibility(View.VISIBLE); - textPkName2.setText(userNiceName); - ImgLoader.display(mContext, resScore, imageGrade2); - textGrade2.setText(String.valueOf(userScore)); - } else if (i == 2) { - linearGrade4.setVisibility(View.VISIBLE); - textPkName4.setText(userNiceName); - ImgLoader.display(mContext, resScore, imageGrade4); - textGrade4.setText(String.valueOf(userScore)); - } else if (i == 3) { - linearGrade3.setVisibility(View.VISIBLE); - textPkName3.setText(userNiceName); - ImgLoader.display(mContext, resScore, imageGrade3); - textGrade3.setText(String.valueOf(userScore)); - - } - } - - if (time > 0) { - mPkTimeCount = time; - timeTitle.setVisibility(View.VISIBLE); - countdownHandler.postAtTime(countdownRunnable, getNextSecondTime()); - } - + }); } - private Runnable countdownRunnable = new Runnable() { - @Override - public void run() { - mPkTimeCount--; - if (mPkTimeCount > 0) {// - String s1 = StringUtil.getDurationText(mPkTimeCount * 1000); - textTime.setText(String.format(mContext.getString(R.string.pk_time), s1)); - countdownHandler.postAtTime(countdownRunnable, getNextSecondTime()); - } else { - timeTitle.setVisibility(View.GONE); - countdownHandler.removeCallbacks(countdownRunnable); - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT)); - } - } - }; - /** - * 获取下一秒钟的时间 - */ - private long getNextSecondTime() { - long now = SystemClock.uptimeMillis(); - return now + (1000 - now % 1000); - } } 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 488a16729..631374fb3 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java @@ -116,8 +116,9 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX //修改上面主播的头像 @Subscribe(threadMode = ThreadMode.MAIN) public void onUPAnchorInfo(AnchorInfoEvent e) { + Log.i(TAG, "onUPAnchorInfo: "+e); if (e != null) { - if (e.isClear() == false) { + if (!e.isClear()) { tv_avatarOther_name.setText(e.getUserNiceName()); ImgLoader.displayAvatar(mContext, e.getAvatar(), avatarOther); goto_room_view.setVisibility(View.VISIBLE); @@ -355,7 +356,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX @Override public void onError(String error) { - + ToastUtil.show( R.string.net_error); } }); @@ -460,6 +461,9 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX inputStreamList.clear(); inputStreamList1.clear(); changeToBig(); + //清理PK上面对方的头像 + EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", "")); + closeButtonGone(); } }); } @@ -691,14 +695,15 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX params.topMargin = 0; camera.setLayoutParams(params); } - if (mPreView1.getVisibility()==View.VISIBLE){ + if (mPreView1.getVisibility() == View.VISIBLE) { mPreView1.removeAllViews(); mPreView1.setVisibility(View.GONE); inputStreamList.clear(); inputStreamList1.clear(); } } - public void closeButtonGone(){ + + public void closeButtonGone() { btn_close.setVisibility(View.GONE); } 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 2c630a09f..604304be3 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1,6 +1,7 @@ package com.yunbao.live.views; import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY; +import static com.yunbao.live.views.LivePushRyViewHolder.btn_close; import android.app.Activity; import android.app.Dialog; @@ -36,7 +37,6 @@ import androidx.annotation.Nullable; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import androidx.recyclerview.widget.SimpleItemAnimator; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; @@ -80,6 +80,7 @@ import com.yunbao.common.bean.RewardAllModel; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.TaskModel; import com.yunbao.common.bean.UserBean; +import com.yunbao.common.event.AnchorInfoEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.API; @@ -116,7 +117,6 @@ import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.ZhuangBanActivity; import com.yunbao.live.adapter.LiveChatAdapter; -import com.yunbao.live.adapter.LiveChatRecyclerViewLayoutManager; import com.yunbao.live.adapter.LiveRoomFastMessageRecyclerViewAdapter; import com.yunbao.live.adapter.LiveUserAdapter; import com.yunbao.live.bean.DrPkbean; @@ -463,13 +463,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } + private static boolean visibility = false; + public void hotAddVisibility(boolean visibility) { + this.visibility = visibility; ft_hot_add.setVisibility(visibility ? View.GONE : View.VISIBLE); } public void endDRGif() { if (dr_pk_end_gif.getVisibility() == View.GONE) { dr_pk_end_gif.setVisibility(View.VISIBLE); + visibility = false; RequestOptions options = new RequestOptions().skipMemoryCache(true);//配置 Glide.with(mContext).asGif() .apply(options)//应用配置 @@ -1218,6 +1222,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis */ public void resetView() { resetViewGone(); + visibility = false; mBannerList1.clear(); mBannerList2.clear(); mBannerList3.clear(); @@ -1820,7 +1825,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void onError(String error) { - + ToastUtil.show( R.string.net_error); } }); @@ -2088,10 +2093,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis //双人pk关闭 public void closePkTwo() { + Log.e("LiveRoomViewHolder", "closePkTwo: 隐藏PK信息" + goto_room_view.getVisibility()); mPkRankTopIcon.setVisibility(View.GONE); lt_pk_line.setVisibility(View.GONE); - livePKUserListBean = new LivePKUserListBean(); pkUid = ""; + if (btn_close != null) { + btn_close.setVisibility(View.GONE); + } + goto_room_view.setVisibility(View.GONE); + livePKUserListBean = new LivePKUserListBean(); } /** @@ -3156,7 +3166,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { - if ("1".equals(info[0])) { + if ("1".equals(info[0]) && !visibility) { ft_hot_add.setVisibility(View.VISIBLE); } else { ft_hot_add.setVisibility(View.GONE); @@ -3169,9 +3179,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis /** * 获取是否有热度卡加成 */ - public static void getIsHot(String isUseHotCard) { + public void getIsHot(String isUseHotCard) { ImgLoader.display2(Contexts, "https://downs.yaoulive.com/img_hot_gif.gif", img_hot_gif); - if ("1".equals(isUseHotCard)) { + if ("1".equals(isUseHotCard) && !visibility) { ft_hot_add.setVisibility(View.VISIBLE); } else { ft_hot_add.setVisibility(View.GONE); @@ -3904,10 +3914,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mLiveChatAdapter.insertItem(bean); } } + /** * 幸运100%活动 */ - public void lucky100(MsgModel model){ + public void lucky100(MsgModel model) { if (mLiveChatAdapter != null) { LiveChatBean bean = new LiveChatBean(); bean.setType(LiveChatBean.LUCKY_100_CHECK); @@ -3931,17 +3942,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis new Handler(Looper.getMainLooper()).postDelayed(this::initPkRank, 300); break; case PK_TWO_END: + EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", "")); closePkTwo(); break; case CUSTOM_FULL_SERVICE_NOTIFY: customFullServiceNotify(event.getCustomFullServiceNotifyEvent()); break; case PK_TIME_COUNT: - endDRGif(); +// endDRGif(); break; case UP_PK_TWO: pkUid = (String) event.getObject(); - ToastUtil.show("对方UID=" + pkUid); UpPkTwo(); break; case CHANGE_VIEW: @@ -4009,4 +4020,172 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } }; + private Handler countdownHandler = new Handler(); + private View detailsView = null; + private FrameLayout timeTitle; + private TextView textTime; + private TextView textPkName1, textPkName2, textPkName3, textPkName4; + private TextView textGrade1, textGrade2, textGrade3, textGrade4; + private ImageView imageGrade1, imageGrade2, imageGrade3, imageGrade4; + private LinearLayout linearGrade1, linearGrade2, linearGrade3, linearGrade4; + /** + * PK倒计时 + */ + private String userId2, userId3 = "", userId4; + + public void upDataPkScore(JSONArray pkScores, int time) { + if (detailsView == null) { + detailsView = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null); + timeTitle = detailsView.findViewById(R.id.time_title); + textTime = detailsView.findViewById(R.id.text_time); + linearGrade1 = detailsView.findViewById(R.id.lin_pk1); + linearGrade2 = detailsView.findViewById(R.id.lin_pk2); + linearGrade3 = detailsView.findViewById(R.id.lin_pk3); + linearGrade4 = detailsView.findViewById(R.id.lin_pk4); + textPkName1 = detailsView.findViewById(R.id.text_pk_name1); + textPkName2 = detailsView.findViewById(R.id.text_pk_name2); + textPkName3 = detailsView.findViewById(R.id.text_pk_name3); + textPkName4 = detailsView.findViewById(R.id.text_pk_name4); + textGrade1 = detailsView.findViewById(R.id.text_grade1); + textGrade2 = detailsView.findViewById(R.id.text_grade2); + textGrade3 = detailsView.findViewById(R.id.text_grade3); + textGrade4 = detailsView.findViewById(R.id.text_grade4); + imageGrade1 = detailsView.findViewById(R.id.image_grade1); + imageGrade2 = detailsView.findViewById(R.id.image_grade2); + imageGrade3 = detailsView.findViewById(R.id.image_grade3); + imageGrade4 = detailsView.findViewById(R.id.image_grade4); + linearGrade1.setVisibility(View.GONE); + linearGrade2.setVisibility(View.GONE); + linearGrade3.setVisibility(View.GONE); + linearGrade4.setVisibility(View.GONE); + mRoot.addView(detailsView); + mRoot.post(new Runnable() { + @Override + public void run() { + int mScreenWdith = ScreenDimenUtil.getInstance().getScreenWdith(); + int vHeight = mScreenWdith * 720 / 960; + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) detailsView.getLayoutParams(); + params.height = vHeight; + params.width = mScreenWdith; + params.topMargin = DpUtil.dp2px(105); + params.addRule(RelativeLayout.ALIGN_TOP); + detailsView.setLayoutParams(params); + } + }); + + + } + + for (int i = 0; i < pkScores.size(); i++) { + JSONObject score = pkScores.getJSONObject(i); + String userNiceName = score.getString("user_nicename"); + long userScore = score.getLong("score"); + String userId = score.getString("id"); + int resScore = R.mipmap.icon_livepk_no1; + if (userScore == 0 && !score.containsKey("paiming")) { + resScore = R.mipmap.icon_livepk_no1; + } else { + if (score.containsKey("paiming")) { + int ranking = score.getIntValue("paiming"); + switch (ranking) { + case 1: + resScore = R.mipmap.icon_livepk_no1; + break; + case 2: + resScore = R.mipmap.icon_livepk_no2; + break; + case 3: + resScore = R.mipmap.icon_livepk_no3; + break; + case 4: + resScore = R.mipmap.icon_livepk_no4; + break; + } + } + } + if (i == 0) { + linearGrade1.setVisibility(View.VISIBLE); + textPkName1.setText(userNiceName); + ImgLoader.display(mContext, resScore, imageGrade1); + textGrade1.setText(String.valueOf(userScore)); + + } else if (i == 1) { + linearGrade2.setVisibility(View.VISIBLE); + textPkName2.setText(userNiceName); + ImgLoader.display(mContext, resScore, imageGrade2); + textGrade2.setText(String.valueOf(userScore)); + userId2 = userId; + } else if (i == 2) { + if (pkScores.size() == 3) { + linearGrade4.setVisibility(View.VISIBLE); + textPkName4.setText(userNiceName); + ImgLoader.display(mContext, resScore, imageGrade4); + textGrade4.setText(String.valueOf(userScore)); + userId4 = userId; + } else { + linearGrade3.setVisibility(View.VISIBLE); + textPkName3.setText(userNiceName); + ImgLoader.display(mContext, resScore, imageGrade3); + textGrade3.setText(String.valueOf(userScore)); + userId3 = userId; + } + + } else if (i == 3) { + linearGrade4.setVisibility(View.VISIBLE); + textPkName4.setText(userNiceName); + ImgLoader.display(mContext, resScore, imageGrade4); + textGrade4.setText(String.valueOf(userScore)); + userId4 = userId; + } + } + + if (time > 0) { + mPkTimeCount = time; + timeTitle.setVisibility(View.VISIBLE); + countdownHandler.postAtTime(countdownRunnable, getNextSecondTime()); + } + textPkName2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + showUserDialog(userId2); + } + }); + textPkName4.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + showUserDialog(userId4); + } + }); + textPkName3.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + showUserDialog(userId3); + } + }); + } + + private Runnable countdownRunnable = new Runnable() { + @Override + public void run() { + mPkTimeCount--; + if (mPkTimeCount > 0) {// + String s1 = StringUtil.getDurationText(mPkTimeCount * 1000); + textTime.setText(String.format(mContext.getString(R.string.pk_time), s1)); + countdownHandler.postAtTime(countdownRunnable, getNextSecondTime()); + } else { + timeTitle.setVisibility(View.GONE); + countdownHandler.removeCallbacks(countdownRunnable); + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT)); + } + } + }; + + public void removeDetailView() { + if (detailsView != null) { + mRoot.removeView(detailsView); + detailsView = null; + } + } + } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java index 5a48591af..873947716 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java @@ -87,6 +87,9 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { super(context, parentView); } + public long getmAnchorLiveTime() { + return mAnchorLiveTime; + } @Override protected int getLayoutId() { @@ -345,6 +348,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { @Override public void onError(String error) { Log.e("PortraitLiveManager", error); + ToastUtil.show( R.string.net_error); } }); } 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 9e47a6884..5d1c3e7b7 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -256,6 +256,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) { isEnterRoom = false; openParametersModel = new OpenParametersModel(); + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.UpPkTwo(); + } mContext.runOnUiThread(new Runnable() { @Override @@ -578,6 +581,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe upDataPkScore(pkInfo.getJSONArray("userlist"), pkInfo.getIntValue("drpk_time")); } +// mLivePlayViewHolder.setLayoutInterface(new LivePlayRyViewHolder.PlayViewLayoutInterface() { +// @Override +// public void playViewLayout(int width, int height) { +// Log.e("播放器的宽高", "宽:" + width + " 高:" + height); +// ScreenDimenUtil util = ScreenDimenUtil.getInstance(); +// int mScreenWdith = util.getScreenWdith(); +// Log.e("播放器的宽高", "mScreenWdith:" + mScreenWdith + " mScreenheight :" + mScreenWdith * 720 / 960); +// } +// }); //守护相关 mLiveGuardInfo = new LiveGuardInfo(); int guardNum = Integer.parseInt(data.getEnterRoomInfo().getGuardNums()); @@ -614,7 +626,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onError(String error) { - ToastUtil.show(error); + ToastUtil.show(R.string.net_error); //直播间上部轮播【新人特惠】【趣味游戏】【幸运天使】 轮播接口 mLiveRoomViewHolder.showLiveRoomActivityBanner(); } @@ -1827,7 +1839,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe * @param time */ public void upDataPkScore(JSONArray pkScores, int time) { - if (mLivePlayViewHolder != null) { + if (mLiveRoomViewHolder != null) { String liveId = mLiveBean.getUid(); JSONObject liveModel = null; //调整数据 @@ -1841,8 +1853,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } pkScores.remove(index); pkScores.add(0, liveModel); - mLivePlayViewHolder.upDataPkScore(pkScores, time); - + mLiveRoomViewHolder.upDataPkScore(pkScores, time); + setPkStatus(true); } } @@ -1852,4 +1864,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } + public void removeDetailView() { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.removeDetailView(); + } + } + } diff --git a/live/src/main/res/drawable/background_151515.xml b/live/src/main/res/drawable/background_151515.xml new file mode 100644 index 000000000..cd3ed4522 --- /dev/null +++ b/live/src/main/res/drawable/background_151515.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/live/src/main/res/drawable/background_595959.xml b/live/src/main/res/drawable/background_595959.xml new file mode 100644 index 000000000..c90524801 --- /dev/null +++ b/live/src/main/res/drawable/background_595959.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/background_6cbe53.xml b/live/src/main/res/drawable/background_6cbe53.xml new file mode 100644 index 000000000..47302db9d --- /dev/null +++ b/live/src/main/res/drawable/background_6cbe53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_blowkiss.xml b/live/src/main/res/layout/dialog_live_blowkiss.xml index ad93e1823..6c409e76c 100644 --- a/live/src/main/res/layout/dialog_live_blowkiss.xml +++ b/live/src/main/res/layout/dialog_live_blowkiss.xml @@ -195,6 +195,9 @@ + android:layout_weight="1.2" /> diff --git a/live/src/main/res/layout/dialog_live_data.xml b/live/src/main/res/layout/dialog_live_data.xml new file mode 100644 index 000000000..d38297bab --- /dev/null +++ b/live/src/main/res/layout/dialog_live_data.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_task.xml b/live/src/main/res/layout/dialog_live_task.xml new file mode 100644 index 000000000..00747b60d --- /dev/null +++ b/live/src/main/res/layout/dialog_live_task.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_task_info.xml b/live/src/main/res/layout/dialog_live_task_info.xml new file mode 100644 index 000000000..178791b53 --- /dev/null +++ b/live/src/main/res/layout/dialog_live_task_info.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_new_guard_buy.xml b/live/src/main/res/layout/dialog_new_guard_buy.xml index 5820fb6ba..b2bdcef04 100644 --- a/live/src/main/res/layout/dialog_new_guard_buy.xml +++ b/live/src/main/res/layout/dialog_new_guard_buy.xml @@ -171,8 +171,10 @@ @@ -231,7 +233,7 @@ android:layout_height="35dp" android:layout_marginTop="2dp" android:background="@drawable/bg_new_guard_but" - android:text="繼續守護" + android:text="@string/Continue_to_guard" android:textColor="#FFFFFF" android:textSize="16sp" /> diff --git a/live/src/main/res/layout/dialog_new_guard_list.xml b/live/src/main/res/layout/dialog_new_guard_list.xml index f168cda42..692c0c5c4 100644 --- a/live/src/main/res/layout/dialog_new_guard_list.xml +++ b/live/src/main/res/layout/dialog_new_guard_list.xml @@ -146,7 +146,7 @@ @@ -170,7 +170,7 @@ android:layout_marginRight="20dp" android:background="@mipmap/btn_openvip" android:gravity="center" - android:text="開通貴族" + android:text="@string/live_ktgz" android:textSize="13sp" /> diff --git a/live/src/main/res/layout/item_live_data.xml b/live/src/main/res/layout/item_live_data.xml new file mode 100644 index 000000000..f46e318f4 --- /dev/null +++ b/live/src/main/res/layout/item_live_data.xml @@ -0,0 +1,44 @@ + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/item_live_task.xml b/live/src/main/res/layout/item_live_task.xml new file mode 100644 index 000000000..8208faf8f --- /dev/null +++ b/live/src/main/res/layout/item_live_task.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_pk_details.xml b/live/src/main/res/layout/view_live_pk_details.xml index 3b856255d..926203165 100644 --- a/live/src/main/res/layout/view_live_pk_details.xml +++ b/live/src/main/res/layout/view_live_pk_details.xml @@ -37,7 +37,7 @@ android:layout_marginEnd="6.76dp" android:text="000" android:textColor="@color/white" - android:textSize="8sp" /> + android:textSize="12sp" /> + android:textSize="12sp" /> + android:textSize="12sp" /> + android:textSize="12sp" /> + android:textSize="12sp" /> + android:textSize="12sp" /> @@ -190,16 +187,15 @@ android:layout_marginEnd="5.33dp" android:layout_marginBottom="3.3dp" android:background="@drawable/background_pk_time" + android:clickable="true" android:maxLines="1" - android:ellipsize="end" - android:maxWidth="50dp" android:paddingStart="6dp" android:paddingTop="4.33dp" android:paddingEnd="6dp" android:paddingBottom="4.33dp" android:text="我方" android:textColor="@color/white" - android:textSize="8sp" /> + android:textSize="12sp" /> + android:textSize="12sp" /> diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index b22fafbf0..063e7d89a 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -2116,6 +2116,7 @@ android:layout_width="18dp" android:layout_height="18dp" android:layout_alignParentBottom="true" + android:layout_centerHorizontal="true" android:src="@mipmap/voice" /> @@ -2306,6 +2307,7 @@ \ No newline at end of file diff --git a/live/src/main/res/layout/view_new_live_ready.xml b/live/src/main/res/layout/view_new_live_ready.xml index eadb2a80c..43961a227 100644 --- a/live/src/main/res/layout/view_new_live_ready.xml +++ b/live/src/main/res/layout/view_new_live_ready.xml @@ -267,7 +267,7 @@ android:layout_width="30dp" android:layout_height="30dp" android:layout_marginStart="50dp" - android:layout_marginBottom="53dp" + android:layout_marginBottom="83dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:srcCompat="@mipmap/icon_beauty" /> @@ -276,7 +276,7 @@ android:id="@+id/btn_start_live" android:layout_width="189dp" android:layout_height="42dp" - android:layout_marginBottom="47dp" + android:layout_marginBottom="77dp" android:background="@drawable/bg_live_ready_btn" android:text="@string/live_start" android:textColor="@color/white" @@ -303,9 +303,36 @@ android:layout_width="30dp" android:layout_height="30dp" android:layout_marginEnd="50dp" - android:layout_marginBottom="53dp" + android:layout_marginBottom="83dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:srcCompat="@mipmap/icon_robot" /> + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_noble_seat.xml b/live/src/main/res/layout/view_noble_seat.xml index 78524a409..dc53e7d07 100644 --- a/live/src/main/res/layout/view_noble_seat.xml +++ b/live/src/main/res/layout/view_noble_seat.xml @@ -5,6 +5,7 @@ android:layout_height="wrap_content" android:orientation="vertical" tools:ignore="MissingDefaultResource"> + diff --git a/live/src/main/res/mipmap-xhdpi/dialog_task_hot.png b/live/src/main/res/mipmap-xhdpi/dialog_task_hot.png new file mode 100644 index 000000000..5f1599659 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/dialog_task_hot.png differ diff --git a/live/src/main/res/mipmap-xhdpi/dialog_task_info.png b/live/src/main/res/mipmap-xhdpi/dialog_task_info.png new file mode 100644 index 000000000..7627e345e Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/dialog_task_info.png differ diff --git a/live/src/main/res/mipmap-xhdpi/dialog_task_new_star.png b/live/src/main/res/mipmap-xhdpi/dialog_task_new_star.png new file mode 100644 index 000000000..6673b3e89 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/dialog_task_new_star.png differ diff --git a/live/src/main/res/mipmap-xhdpi/dialog_task_star.png b/live/src/main/res/mipmap-xhdpi/dialog_task_star.png new file mode 100644 index 000000000..fee098e1b Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/dialog_task_star.png differ diff --git a/live/src/main/res/values-en/strings.xml b/live/src/main/res/values-en/strings.xml index a6cc2d9aa..db75e2c0b 100644 --- a/live/src/main/res/values-en/strings.xml +++ b/live/src/main/res/values-en/strings.xml @@ -18,4 +18,53 @@ Only those who have the room code can watch Submit The number of voices has reached 3, and no more can be added. + Consecutive broadcast duration of the day (minutes) + PK count on the day (unlimited mode) + Accumulated new followers on that day + Cumulative new fan group members on that day + Live interaction + Fan growth + Special instructions for anchor tasks + After the broadcast, all anchors can get a series of tasks of the day. After completing the tasks according to the corresponding requirements, anchors can get the task reward of the previous day after the broadcast of the next day. + ● All task values will be calculated by the system in real time. If data errors occur due to personal, mobile, computer equipment problems, network problems or no normal downcasting, relevant anchors can contact relevant platform staff or online customer service for feedback. After confirmation by relevant part, compensation will be processed.\n● The normal settlement period of all mission data will be settled at 6:00 am every day. If the broadcast time is longer than 6:00 AM, the reward cannot be settled normally, please be noted.\n● When the anchor standard score is lower than 90, the anchor task center can only get 50% of all rewards. When the anchor standard score is lower than 80, the anchor task reward cannot be obtained. + success + incomplete + hot + exp + This live data statistics + Historical data can be viewed in the anchor center + * Non-real-time calculation of data + + Be TA\'s guardian, escort for TA! + return + Be praised + Open aristocracy + Enjoy exclusive privileges! + Head to the noble Center + Swipe up to cancel send + Release cancel send + No recording has been recognized in over 10 seconds + Identity privilege + Nobleman\'s seat + %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 + The request has been agreed and is awaiting acceptance by the user + Random PK + PK main rules: + Random PK qualifying time + 12:00~17:00、19:00~23:59 + 1. After matching, the system will automatically select opponents for PK; + 2. If you cannot match your opponent for a long time, you can try to match again; + 3. During the PK process, if there is any delay or delay, please check your personal device and network first, and then try to log in again and start broadcasting. + 4, the security department will be 24 hours of inspection, please civilized PK, strictly abide by the anchor rules; + Random PK switch: + Start matching + Match %s + Click again to cancel the match + Exiting match %s + It\'s also possible to match an opponent during the exit process + Please enter the anchor nickname or id you want to pk + The other team is engaged in a PK + The PK number is used up \ No newline at end of file diff --git a/live/src/main/res/values/strings.xml b/live/src/main/res/values/strings.xml index c994ee24a..cef5b3236 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -1,6 +1,6 @@ - 成爲TA的守護,爲TA保駕護航! - 返還 + 成爲TA的守護,爲TA保駕護航! + 返還 暫時無人上榜,快來成為第一位上榜的人吧! 主播正在等待您的守護! 未上榜 @@ -19,36 +19,50 @@ 所有人可觀看 僅擁有房間密碼的人可觀看 確認 - 開通貴族 - 享受專屬特權! - 前往貴族中心 - 手指上滑,取消發送 - 松開取消發送 - 已超过10秒未识别到录音 - 身份特權 - 貴族坐席 + 開通貴族 + 享受專屬特權! + 前往貴族中心 + 手指上滑,取消發送 + 松開取消發送 + 已超过10秒未识别到录音 + 身份特權 + 貴族坐席 當前連麥語音人數已達到3人,無法再添加。 - %s 申請連麥,是否查看 - 已踢下麥 - 已發出邀請,等待用戶接受 - 已同意請求,等待用戶接受 - 隨機PK - PK主要規則說明: - 隨機PK排位賽時間 - 12:00~17:00、19:00~23:59 - 1、開始匹配後,系統將自動挑選對手進行PK; - 2、若長時間無法匹配到對手,可嘗試重新匹配; - 3、PK過程中卡頓及延遲,可先檢查個人設備及網絡後,嘗試重新登錄並開播; - 4、安全部門將會24小時巡查,請文明PK,嚴格遵守主播守則; - 隨機PK開關: - 開始匹配 - 匹配中 %s - 再次點擊可取消匹配 - 正在退出匹配 %s - 退出過程中也有可能匹配到對手 - 請輸入您要pk的主播昵稱或id - 對方正在PK中 - PK次數已用完 - - + %s 申請連麥,是否查看 + 已踢下麥 + 已發出邀請,等待用戶接受 + 已同意請求,等待用戶接受 + 隨機PK + PK主要規則說明: + 隨機PK排位賽時間 + 12:00~17:00、19:00~23:59 + 1、開始匹配後,系統將自動挑選對手進行PK; + 2、若長時間無法匹配到對手,可嘗試重新匹配; + 3、PK過程中卡頓及延遲,可先檢查個人設備及網絡後,嘗試重新登錄並開播; + 4、安全部門將會24小時巡查,請文明PK,嚴格遵守主播守則; + 隨機PK開關: + 開始匹配 + 匹配中 %s + 再次點擊可取消匹配 + 正在退出匹配 %s + 退出過程中也有可能匹配到對手 + 請輸入您要pk的主播昵稱或id + 對方正在PK中 + PK次數已用完 + 當日連續開播時長(分鐘) + 當日累計PK次數(不限模式) + 當日累積新增關註粉絲 + 當日累積新增粉絲團成員 + 直播互動 + 粉絲增漲 + 主播任務特別說明 + 所有主播在開播後,即可獲得一系列的當日任務,當根據相應的要求完成任務後,主播即可在第二天開播後,獲得前一天的任務獎勵。 + ● 所有任務數值將由系統進行實時計算,如因個人手機電腦設備問題、網絡問題或是沒有正常進行下播導致數據出現錯誤等問題,為此相關主播可進行聯系相關平臺工作人員或是在線客服,進行反饋,待相關部分確認後,將會再進行補償處理。\n● 所有任務數據的正常結算周期將會在每日的淩晨6點進行結算,若開播時間超過淩晨6點,將會出現獎勵無法正常結算的情況,請知悉。\n● 當主播規範分低於90時,主播任務中心的所有獎勵,將僅能獲得50%的,當主播規範分低於80以下時,將無法獲得主播任務獎勵。 + 已完成 + 未完成 + 直播熱度 + 主播經驗 + 本場直播數據統計 + 歷史數據可在主播中心查看 + * 人數及新增相關數據非实时计算 diff --git a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java index 74fbdbd92..96e944f66 100644 --- a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java @@ -275,7 +275,7 @@ public class EntryActivity extends AppCompatActivity { @Override public void onError(String error) { - + ToastUtil.show( R.string.net_error); } }); @@ -608,10 +608,11 @@ public class EntryActivity extends AppCompatActivity { private void onLoginSuccess(int code, String msg, String[] info) { Log.e("他", code + "code" + info.toString()); if (code == 0 && info.length > 0) { + JSONObject obj = JSON.parseObject(info[0]); String uid = obj.getString("id"); String token = obj.getString("token"); - if (obj.getString("need_bind").equals("0")) { + if (obj.containsKey("need_bind") && obj.getString("need_bind").equals("0")) { mFirstLogin = obj.getIntValue("first_login") == 1; mShowInvite = obj.getIntValue("isagent") == 1; CommonAppConfig.getInstance().setLoginInfo(uid, token, true); @@ -687,7 +688,7 @@ public class EntryActivity extends AppCompatActivity { new LiveRoomCheckLivePresenter(activity, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { @Override public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { - RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); } @Override diff --git a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java index dae7de39c..17e9aaae5 100644 --- a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java @@ -121,7 +121,8 @@ public class LoginActivity extends AbsActivity { findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - finish(); + //finish(); + RouteUtil.forwardEntry2(); } }); @@ -379,4 +380,10 @@ public class LoginActivity extends AbsActivity { super.onDestroy(); } + + @Override + public void onBackPressed() { + super.onBackPressed(); + RouteUtil.forwardEntry2(); + } } 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 584273828..88bda75c5 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -312,6 +312,17 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene @Override public void onPageSelected(int position) { + if(mTabButtonGroup.getCurPosition()!=position){ + System.err.println("重连IM:"+IMLoginManager.isLogin(mContext)); + if(!IMLoginManager.isLogin(mContext)){ + //IMLoginManager.get(mContext).setupLoginUser(); + RouteUtil.forwardLoginInvalid("登錄失效"); + return; + } + RongcloudIMManager.connectIM(mContext.getApplication()); + position = 0; + mTabButtonGroup.setCurPosition(0); + } if (position != 0) { loadPageData(position, true); } @@ -530,6 +541,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene @Override public void onError(String error) { + ToastUtil.show(com.yunbao.live.R.string.net_error); } }); diff --git a/main/src/main/java/com/yunbao/main/activity/MainListActivity.java b/main/src/main/java/com/yunbao/main/activity/MainListActivity.java index afd5638cc..0bfb84862 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainListActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainListActivity.java @@ -176,7 +176,7 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener @Override public void onError(String error) { - Log.e("MainListActivity", error); + ToastUtil.show( R.string.net_error); } }); initView(); diff --git a/main/src/main/java/com/yunbao/main/activity/MsgSettActivity.java b/main/src/main/java/com/yunbao/main/activity/MsgSettActivity.java index f7a7a3e72..3eb1ce462 100644 --- a/main/src/main/java/com/yunbao/main/activity/MsgSettActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MsgSettActivity.java @@ -239,7 +239,7 @@ public class MsgSettActivity extends AbsActivity { @Override public void onError(String error) { - + ToastUtil.show(com.yunbao.live.R.string.net_error); } }); } diff --git a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java index 8c8297b59..8b97bf421 100644 --- a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java @@ -264,7 +264,7 @@ public class MyWebViewActivity extends AbsActivity { MicStatusManager.getInstance().showDownMicDialog(mContext); return; } - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal))); + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); } else { RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); } @@ -549,8 +549,8 @@ public class MyWebViewActivity extends AbsActivity { if (!TextUtils.isEmpty(event.getMethod())) { if (TextUtils.equals(event.getMethod(), "androidCommunityGift")) { Constants.nowPostsId = event.getPostsId(); - EncourageDialog fragment = new EncourageDialog(); + fragment.setId(event.getPostsId()); fragment.show(((MyWebViewActivity) mContext).getSupportFragmentManager(), "EncourageDialog"); } else if (TextUtils.equals(event.getMethod(), "modifyMydata")) { indexInto = event.getIndexInto(); diff --git a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java index e41463cbb..45764d357 100644 --- a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java @@ -443,7 +443,7 @@ public class PDLiveConversationListActivity extends AbsActivity implements View. @Override public void onError(String error) { - ToastUtil.show(error); + ToastUtil.show( R.string.net_error); } }); MessageIMManager.get(mContext).setSystemNumber(0); diff --git a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java index 916ace264..a56ccfc9f 100644 --- a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java @@ -190,9 +190,12 @@ public class RegisterActivity extends AbsActivity { allCountries.addAll(Country.getAll(mContext, null)); String ct = Locale.getDefault().getCountry(); + ct = TextUtils.equals("CN", ct) ? "HK" : ct; for (int i = 0; i < allCountries.size(); i++) { if (allCountries.get(i).locale.equals(ct)) { - mTvCountryCode.setText("+" + allCountries.get(i).code); + String countryName = allCountries.get(i).name; + countryName = countryName.length() > 4 ? countryName.substring(0, 4) : countryName; + mTvCountryCode.setText("+" + allCountries.get(i).code + " " + countryName); mCountryCode = allCountries.get(i).code; return; } @@ -260,7 +263,9 @@ public class RegisterActivity extends AbsActivity { CountryPicker.newInstance(null, new OnPick() { @Override public void onPick(Country country) { - mTvCountryCode.setText("+" + country.code); + String countryName = country.name; + countryName = countryName.length() > 4 ? countryName.substring(0, 4) + "..." : countryName; + mTvCountryCode.setText(" +" + country.code + " " + countryName); mCountryCode = country.code; } }).show(getSupportFragmentManager(), "country"); @@ -506,7 +511,7 @@ public class RegisterActivity extends AbsActivity { new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { @Override public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { - RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); NoviceInstructorManager.get(mContext).setFrist(false); } diff --git a/main/src/main/java/com/yunbao/main/activity/TestActivity.java b/main/src/main/java/com/yunbao/main/activity/TestActivity.java index 21ff40fd2..866d9d5cd 100644 --- a/main/src/main/java/com/yunbao/main/activity/TestActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/TestActivity.java @@ -1,14 +1,7 @@ package com.yunbao.main.activity; -import android.content.Intent; import android.os.Bundle; -import android.os.Environment; import android.text.SpannableStringBuilder; -import android.util.Log; -import android.view.View; -import android.widget.AdapterView; -import android.widget.ArrayAdapter; -import android.widget.ListView; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; diff --git a/main/src/main/java/com/yunbao/main/adapter/MsgFollowAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MsgFollowAdapter.java index 21574f708..74bbb5719 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MsgFollowAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MsgFollowAdapter.java @@ -21,6 +21,7 @@ import com.yunbao.common.http.ResponseData; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.main.MainNetManager; import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.main.R; @@ -113,7 +114,7 @@ public class MsgFollowAdapter extends RecyclerView.Adapter @Override public void onError(String error) { - + ToastUtil.show( R.string.net_error); } }); } diff --git a/main/src/main/java/com/yunbao/main/adapter/SearchResultsAdapter.java b/main/src/main/java/com/yunbao/main/adapter/SearchResultsAdapter.java index 93df73152..342c4d55f 100644 --- a/main/src/main/java/com/yunbao/main/adapter/SearchResultsAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/SearchResultsAdapter.java @@ -61,6 +61,7 @@ public class SearchResultsAdapter extends RecyclerView.Adapter { @Override public void onError(String error) { + ToastUtil.show(com.yunbao.live.R.string.net_error); } }); } diff --git a/main/src/main/java/com/yunbao/main/dialog/SigninDialog.java b/main/src/main/java/com/yunbao/main/dialog/SigninDialog.java index ed72b3b45..a7e1b7d58 100644 --- a/main/src/main/java/com/yunbao/main/dialog/SigninDialog.java +++ b/main/src/main/java/com/yunbao/main/dialog/SigninDialog.java @@ -2,6 +2,7 @@ package com.yunbao.main.dialog; import static com.yunbao.common.utils.RouteUtil.PATH_REWARD; +import android.annotation.SuppressLint; import android.os.Bundle; import android.view.Gravity; import android.view.View; @@ -44,6 +45,7 @@ public class SigninDialog extends AbsDialogFragment { window.setAttributes(params); } + @SuppressLint("StringFormatInvalid") @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); @@ -73,6 +75,7 @@ public class SigninDialog extends AbsDialogFragment { return; } gold.setText(bundle.getString("send_gold") + "金豆+" + bundle.getString("send_exp") + "EXP"); - sign_day.setText("本月您已累積簽到" + bundle.getString("sign_day") + "天,"); + + sign_day.setText(String.format(getString(R.string.this_month), bundle.getString("sign_day"))); } } diff --git a/main/src/main/java/com/yunbao/main/fragment/SearchRecommendFragment.java b/main/src/main/java/com/yunbao/main/fragment/SearchRecommendFragment.java index f0b0e53da..64741c9d8 100644 --- a/main/src/main/java/com/yunbao/main/fragment/SearchRecommendFragment.java +++ b/main/src/main/java/com/yunbao/main/fragment/SearchRecommendFragment.java @@ -85,6 +85,7 @@ public class SearchRecommendFragment extends BaseFragment { @Override public void onError(String error) { + ToastUtil.show( R.string.net_error); } }); } diff --git a/main/src/main/java/com/yunbao/main/fragment/SearchResultsItemFragment.java b/main/src/main/java/com/yunbao/main/fragment/SearchResultsItemFragment.java index 01d50d108..f90df4830 100644 --- a/main/src/main/java/com/yunbao/main/fragment/SearchResultsItemFragment.java +++ b/main/src/main/java/com/yunbao/main/fragment/SearchResultsItemFragment.java @@ -16,6 +16,7 @@ import com.yunbao.common.bean.SearchModel; import com.yunbao.common.fragment.BaseFragment; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.main.MainNetManager; +import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.weight.OnRecyclerViewScrollListener; import com.yunbao.main.R; import com.yunbao.main.adapter.SearchRecommendBodyAdapter; @@ -116,6 +117,7 @@ public class SearchResultsItemFragment extends BaseFragment { @Override public void onError(String error) { + ToastUtil.show( R.string.net_error); } }); } diff --git a/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java b/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java index 99df2a9aa..2c3cf3b0a 100644 --- a/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java +++ b/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java @@ -20,6 +20,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.InstructorRemarkManager; import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.activity.PDLIiveChatActivity; import com.yunbao.live.activity.PDLiveConversationActivity; import com.yunbao.live.bean.SearchUserBean; @@ -317,7 +318,7 @@ public class ConversationIMListManager { @Override public void onError(String error) { - + ToastUtil.show(com.yunbao.live.R.string.net_error); } }); } diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java index 2ff16a0d5..6fb5f18d4 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java @@ -1,6 +1,8 @@ package com.yunbao.main.views; import android.content.Context; +import android.content.Intent; +import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; @@ -10,6 +12,7 @@ import com.yunbao.common.utils.WordUtil; import com.yunbao.live.dialog.LiveRobotSettingDialogFragment; import com.yunbao.main.R; import com.yunbao.main.activity.MainActivity; +import com.yunbao.main.activity.TestActivity; /** * Created by cxf on 2018/9/22. @@ -37,6 +40,7 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder { super.init(); img_trophy = (ImageView) findViewById(R.id.img_trophy); + ImgLoader.display(mContext, "https://downs.yaoulive.com/gif_trophy.gif", img_trophy); diff --git a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java index fb8f59241..dd8f49e3a 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java @@ -302,8 +302,8 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi user_noble_time.setText(mContext.getResources().getString(R.string.open_noble_text)); } String singnature = u.getSignature(); - if (TextUtils.equals(singnature, "貴族") || TextUtils.equals(singnature, "贵族")) { - singnature = singnature + "中心"; + if (TextUtils.equals(singnature, "這個人很懶,什麼也沒留下") ||TextUtils.equals(singnature, "这家伙很懒,什么都没留下") || TextUtils.isEmpty(singnature)) { + singnature ="The guy was lazy and didn't write anything."; } signature.setText(singnature); CommonAppConfig appConfig = CommonAppConfig.getInstance(); diff --git a/main/src/main/java/com/yunbao/main/views/SearchRecommendBodyViewHolder.java b/main/src/main/java/com/yunbao/main/views/SearchRecommendBodyViewHolder.java index 1cc45937b..07a431e2d 100644 --- a/main/src/main/java/com/yunbao/main/views/SearchRecommendBodyViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/SearchRecommendBodyViewHolder.java @@ -53,6 +53,7 @@ public class SearchRecommendBodyViewHolder extends RecyclerView.ViewHolder { @Override public void onError(String error) { + ToastUtil.show( R.string.net_error); } }); } diff --git a/main/src/main/res/layout/activity_entry.xml b/main/src/main/res/layout/activity_entry.xml index d88c12418..a46ae684e 100644 --- a/main/src/main/res/layout/activity_entry.xml +++ b/main/src/main/res/layout/activity_entry.xml @@ -235,7 +235,7 @@ android:id="@+id/tv_customer" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="無法登陸?點此聯繫客服" + android:text="@string/customer_service2" android:textColor="@color/white" android:textSize="11sp" /> @@ -252,7 +252,7 @@ @@ -262,7 +262,7 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginLeft="1dp" - android:text="用户協議" + android:text="@string/user_protocol2" android:textColor="#ffb1b1b1" android:textSize="10sp" /> @@ -270,7 +270,7 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginLeft="1dp" - android:text="和" + android:text="@string/and" android:textColor="#ffb1b1b1" android:textSize="10sp" /> @@ -279,7 +279,7 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginLeft="1dp" - android:text="隱私條款" + android:text="privacy_terms" android:textColor="#ffb1b1b1" android:textSize="10sp" /> diff --git a/main/src/main/res/layout/activity_find_pwd.xml b/main/src/main/res/layout/activity_find_pwd.xml index d1add67c9..b59f57aaa 100644 --- a/main/src/main/res/layout/activity_find_pwd.xml +++ b/main/src/main/res/layout/activity_find_pwd.xml @@ -37,7 +37,7 @@ diff --git a/main/src/main/res/layout/activity_login.xml b/main/src/main/res/layout/activity_login.xml index d9cef6f52..c46ea6cbd 100644 --- a/main/src/main/res/layout/activity_login.xml +++ b/main/src/main/res/layout/activity_login.xml @@ -1,62 +1,60 @@ - - + android:orientation="vertical"> - + - - + + + + + android:textStyle="bold" /> + android:text="@string/come_to" + android:textColor="#ffb1b1b1" + android:textSize="20sp" /> - + android:layout_marginBottom="15dp" + android:background="@drawable/border_grey_50" + android:gravity="center_vertical" + android:orientation="horizontal"> + android:src="@mipmap/icon_phone" /> + android:id="@+id/edit_phone" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@null" + android:gravity="left|center" + android:hint="@string/login_input_phone" + android:maxLength="20" + android:singleLine="true" + android:textColor="#161616" + android:textColorHint="#B6B6B6" + android:textSize="16sp" /> + android:layout_marginBottom="15dp" + android:background="@drawable/border_grey_50" + android:gravity="center_vertical" + android:orientation="horizontal"> + android:src="@mipmap/icon_password" /> + android:layout_marginTop="10dp" + android:visibility="gone"> + android:textColor="@color/red" + android:textSize="8sp" /> diff --git a/main/src/main/res/layout/activity_register.xml b/main/src/main/res/layout/activity_register.xml index fa2fc5da6..a70f7261f 100644 --- a/main/src/main/res/layout/activity_register.xml +++ b/main/src/main/res/layout/activity_register.xml @@ -40,7 +40,7 @@ android:layout_marginLeft="41dp" android:layout_marginTop="30dp" android:layout_marginBottom="25dp" - android:text="註冊PD LIVE" + android:text="@string/sign_up_for" android:textColor="#ffff8d41" android:textSize="24sp" /> @@ -96,7 +96,7 @@ android:layout_height="match_parent" android:layout_marginLeft="15dp" android:background="@null" - android:hint="@string/reg_input_phone" + android:hint="@string/phone_number" android:inputType="number" android:maxLength="11" android:textColor="@color/textColor" @@ -246,7 +246,7 @@ android:gravity="center" android:clickable="true" android:onClick="registerClick" - android:text="註冊並登錄" + android:text="@string/register_and_log_in" android:textColor="@color/white" android:textSize="16sp" android:focusable="true" /> diff --git a/main/src/main/res/layout/dialog_login_tips.xml b/main/src/main/res/layout/dialog_login_tips.xml index 206fd5c09..5fb04e8cf 100644 --- a/main/src/main/res/layout/dialog_login_tips.xml +++ b/main/src/main/res/layout/dialog_login_tips.xml @@ -1,100 +1,105 @@ + android:background="@mipmap/login_ties_bg" + android:orientation="vertical"> - - - - - - + android:layout_marginLeft="24dp" + android:layout_marginRight="24dp" + android:layout_marginBottom="100dp" + android:gravity="center" + android:orientation="vertical"> - + - + - + + + + + + + + + + + -