diff --git a/common/src/main/java/com/yunbao/common/adapter/LiveSystemMessageAdapter.java b/common/src/main/java/com/yunbao/common/adapter/LiveSystemMessageAdapter.java new file mode 100644 index 000000000..2fb288925 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/LiveSystemMessageAdapter.java @@ -0,0 +1,52 @@ +package com.yunbao.common.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.bean.ListInfoMessageModel; +import com.yunbao.common.views.LiveSystemMessageViewHolder; + +import java.util.ArrayList; +import java.util.List; + +/** + * 主播消息中心适配器 + */ +public class LiveSystemMessageAdapter extends RecyclerView.Adapter { + private Context mContext; + private LayoutInflater mInflater; + private List 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/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index dee1a5e78..fc686a611 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -12,6 +12,7 @@ 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.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; @@ -542,4 +543,9 @@ public interface PDLiveApi { 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); } 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 a1aa6c25d..fcdcbb48f 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,6 +14,7 @@ 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.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; @@ -1075,6 +1076,18 @@ public class LiveNetManager { }).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(); + } + /** * 直播间取消网络请求 */ 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..ff91ff65a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/LiveAnchorMessageCustomPopup.java @@ -0,0 +1,72 @@ +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 java.util.List; + +/** + * 主播消息中心 + */ +public class LiveAnchorMessageCustomPopup extends BottomPopupView { + private LiveSystemMessageAdapter adapter; + private RecyclerView liveMessage; + + 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()) + .getListInfo("1", 1, new HttpCallback>() { + @Override + public void onSuccess(List data) { + adapter.addData(data); + } + + @Override + public void onError(String error) { + ToastUtil.show(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); + } + + @Override + public void onDestroy() { + super.onDestroy(); + } +} 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..e1ffea244 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/LiveSystemMessageViewHolder.java @@ -0,0 +1,47 @@ +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; + +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); + } + } +} 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/layout/dialog_live_anchor_message.xml b/common/src/main/res/layout/dialog_live_anchor_message.xml new file mode 100644 index 000000000..1c017ccf9 --- /dev/null +++ b/common/src/main/res/layout/dialog_live_anchor_message.xml @@ -0,0 +1,21 @@ + + + + + + + \ 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..6a9271e98 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,433 @@ - - - - + 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/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/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/values-en/strings.xml b/common/src/main/res/values-en/strings.xml index 4b0d7b828..653ff127a 100644 --- a/common/src/main/res/values-en/strings.xml +++ b/common/src/main/res/values-en/strings.xml @@ -938,14 +938,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,52 +955,54 @@ 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. - phone + 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 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index bcfe413f2..af39ae8b1 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -785,6 +785,7 @@ 暫時還沒有人給予作者鼓勵T_T 點擊查看更多 + 客服 設定 每日13:00PM-1:00AM @@ -1023,4 +1024,6 @@ 無法選擇,該主播未開啟高清直播。 抱歉,該功能暫停使用中。 手機號 + 開播數據 + 點擊查看 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..f022040d8 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java @@ -1,6 +1,16 @@ 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.view.Gravity; @@ -10,10 +20,11 @@ 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.ToastUtil; +import com.yunbao.common.views.LiveAnchorMessageCustomPopup; import com.yunbao.live.R; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.interfaces.LiveFunctionClickListener; @@ -92,6 +103,8 @@ 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.live_tool_robot).setOnClickListener(this); if (leave == 0) { @@ -146,9 +159,14 @@ 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())) + .show(); + dismiss(); } } }