diff --git a/common/build.gradle b/common/build.gradle index d436ac07d..73f54e530 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -209,6 +209,8 @@ dependencies { // 多语言语音识别扩展库(可选) api 'tech.sud.mgp:SudASR:1.3.3.1158' + //侧滑删除 + api 'com.yanzhenjie.recyclerview:x:1.3.2' //华为支付插件包 //api project(':lib_huawei') diff --git a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java index 347023335..a297704d7 100644 --- a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java +++ b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java @@ -69,7 +69,8 @@ public class DialogUitl { } return dialog; } - public static void showToast(Context context,String content,long delayMillis){ + + public static void showToast(Context context, String content, long delayMillis) { Dialog dialog = new Dialog(context, R.style.dialog); dialog.setContentView(R.layout.dialog_toast); dialog.setCancelable(false); @@ -82,7 +83,7 @@ public class DialogUitl { } } dialog.show(); - new Handler(Looper.getMainLooper()).postDelayed(dialog::dismiss,delayMillis); + new Handler(Looper.getMainLooper()).postDelayed(dialog::dismiss, delayMillis); } @@ -121,6 +122,38 @@ public class DialogUitl { dialog.show(); } + + public static void showDelSysMsg(Context context, String content, SimpleCallback simpleCallback) { + if (context instanceof Activity) { + if (((Activity) context).isDestroyed() || ((Activity) context).isFinishing()) { + return; + } + } + final Dialog dialog = new Dialog(context, R.style.dialog2); + dialog.setContentView(R.layout.dialog_del_sys_msg); + dialog.setCancelable(true); + dialog.setCanceledOnTouchOutside(true); + if (!TextUtils.isEmpty(content)) { + TextView contentTextView = (TextView) dialog.findViewById(R.id.content); + contentTextView.setText(content); + } + dialog.findViewById(R.id.btn_cancel).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dialog.dismiss(); + } + }); + dialog.findViewById(R.id.btn_confirm).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + simpleCallback.onConfirmClick(dialog, ""); + dialog.dismiss(); + } + }); + dialog.show(); + } + + public static void showSimpleDialog(Context context, String content, SimpleCallback callback) { showSimpleDialog(context, content, false, callback); } @@ -135,13 +168,7 @@ public class DialogUitl { return; } } - new Builder(context) - .setTitle(title) - .setContent(content) - .setCancelable(cancelable) - .setClickCallback(callback) - .build() - .show(); + new Builder(context).setTitle(title).setContent(content).setCancelable(cancelable).setClickCallback(callback).build().show(); } public static void showSimpleDialog(Context context, String title, String content, boolean cancelable, SimpleCallback3 callback) { @@ -150,13 +177,7 @@ public class DialogUitl { return; } } - new Builder(context) - .setTitle(title) - .setContent(content) - .setCancelable(cancelable) - .setClickCallback3(callback) - .build() - .show(); + new Builder(context).setTitle(title).setContent(content).setCancelable(cancelable).setClickCallback3(callback).build().show(); } public static void showSimpleInputDialog(Context context, String title, String hint, int inputType, int length, SimpleCallback callback) { @@ -165,15 +186,7 @@ public class DialogUitl { return; } } - new Builder(context).setTitle(title) - .setCancelable(true) - .setInput(true) - .setHint(hint) - .setInputType(inputType) - .setLength(length) - .setClickCallback(callback) - .build() - .show(); + new Builder(context).setTitle(title).setCancelable(true).setInput(true).setHint(hint).setInputType(inputType).setLength(length).setClickCallback(callback).build().show(); } @@ -483,8 +496,8 @@ public class DialogUitl { mClickCallback3.onConfirmClick(dialog); } if (mSimpleCallbackView != null) { - mSimpleCallbackView.onConfirmClick(dialog,titleView, content, btnConfirm, btnCancel); - }else{ + mSimpleCallbackView.onConfirmClick(dialog, titleView, content, btnConfirm, btnCancel); + } else { dialog.dismiss(); } @@ -501,8 +514,8 @@ public class DialogUitl { ((SimpleCallback2) mClickCallback).onCancelClick(); } if (mSimpleCallbackView != null) { - mSimpleCallbackView.onCancel(dialog,titleView, content, btnConfirm, btnCancel); - }else{ + mSimpleCallbackView.onCancel(dialog, titleView, content, btnConfirm, btnCancel); + } else { dialog.dismiss(); } } @@ -510,17 +523,17 @@ public class DialogUitl { } } }; - if(btnConfirm!=null) { + if (btnConfirm != null) { btnConfirm.setOnClickListener(listener); } - if(btnCancel!=null) { + if (btnCancel != null) { btnCancel.setOnClickListener(listener); } dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialogInterface) { if (mSimpleCallbackView != null) { - mSimpleCallbackView.onShow(dialog,titleView, content, btnConfirm, btnCancel); + mSimpleCallbackView.onShow(dialog, titleView, content, btnConfirm, btnCancel); } } }); @@ -563,8 +576,7 @@ public class DialogUitl { /** * 城市选择 */ - public static void showCityChooseDialog(Activity activity, ArrayList list, - String province, String city, String district, AddressPicker.OnAddressPickListener listener) { + public static void showCityChooseDialog(Activity activity, ArrayList list, String province, String city, String district, AddressPicker.OnAddressPickListener listener) { AddressPicker picker = new AddressPicker(activity, list); picker.setTextColor(0xff323232); picker.setDividerColor(0xffdcdcdc); 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 203f2448a..127c31122 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -31,6 +31,8 @@ public class RouteUtil { public static final String PATH_MYWEBVIEWACTIVTITY = "/main/MyWebViewActivity"; public static final String PATH_ZHUANGBANACTIVITY = "/main/ZhuangBanActivity"; public static final String PATH_LiveZHUANGBANACTIVITY = "/live/ZhuangBanActivity"; + + public static final String PATH_COMPENSATE_ACTIVITY = "/live/CompensateActivity"; public static final String PATH_FACEBOOKACTIVITY = "/baidu/FacebookLoginActivity"; public static final String PATH_MAIN = "/main/MainActivity"; public static final String PATH_ENTRY = "/main/EntryActivity"; @@ -147,6 +149,16 @@ public class RouteUtil { .navigation(); } + /** + * 跳转到 + */ + public static void forwardLiveCompensateActivity(String url, boolean isFull) { + ARouter.getInstance().build(PATH_COMPENSATE_ACTIVITY) + .withString("url", url) + .withBoolean("isFull", isFull) + .navigation(); + } + /** * 跳转到装扮 */ diff --git a/common/src/main/res/layout/dialog_del_sys_msg.xml b/common/src/main/res/layout/dialog_del_sys_msg.xml new file mode 100644 index 000000000..3ef23ead4 --- /dev/null +++ b/common/src/main/res/layout/dialog_del_sys_msg.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/mipmap-mdpi/icon_del_sys_cancel.png b/common/src/main/res/mipmap-mdpi/icon_del_sys_cancel.png new file mode 100644 index 000000000..ff6f5715d Binary files /dev/null and b/common/src/main/res/mipmap-mdpi/icon_del_sys_cancel.png differ diff --git a/common/src/main/res/mipmap-mdpi/icon_del_sys_confirm.png b/common/src/main/res/mipmap-mdpi/icon_del_sys_confirm.png new file mode 100644 index 000000000..5482ab43c Binary files /dev/null and b/common/src/main/res/mipmap-mdpi/icon_del_sys_confirm.png differ diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index 025d7262b..dc02898f8 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1397,4 +1397,7 @@ Limited ride And limited avatar frame Payment cancellation Payment successful Payment failed + + The items inside have not been claimed yet.Are you sure to delete the message? + Are you sure to delete the message? diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 0fb1f8c32..81b093cf6 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1391,6 +1391,10 @@ 二、1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片; 三、觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。 + + 內含物品還未領取,是否確定刪除消息? + 是否確定刪除消息? + 支付取消 支付成功 支付失敗 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index c4bc7008b..7519e5317 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1390,6 +1390,10 @@ 二、1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片; 三、觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。 + + 內含物品還未領取,是否確定刪除消息? + 是否確定刪除消息? + 支付取消 支付成功 支付失敗 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 315c9f783..946f0142c 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1393,4 +1393,7 @@ 支付成功 支付失敗 + 內含物品還未領取,是否確定刪除消息? + 是否確定刪除消息? + diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 99586f337..b90049f19 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1397,6 +1397,10 @@ Limited ride And limited avatar frame 2.One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie; 3.Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities. + The items inside have not been claimed yet.Are you sure to delete the message? + Are you sure to delete the message? + + Payment cancellation Payment successful Payment failed diff --git a/config.gradle b/config.gradle index f7586a40c..0e6eac220 100644 --- a/config.gradle +++ b/config.gradle @@ -20,7 +20,7 @@ ext { baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", -// true表示谷歌支付 false 0 链接包 1 谷歌包 2华为包 3 samsung包 +// true表示谷歌支付 false 0 链接包 1 谷歌包 2华为包 3 samsung包 isGooglePlay : 3, //是否上报异常日志 isUploadLog : true, diff --git a/live/src/main/AndroidManifest.xml b/live/src/main/AndroidManifest.xml index dd65fbe2a..696d132c1 100644 --- a/live/src/main/AndroidManifest.xml +++ b/live/src/main/AndroidManifest.xml @@ -117,6 +117,10 @@ + + \ No newline at end of file diff --git a/live/src/main/java/com/yunbao/live/activity/CompensateActivity.java b/live/src/main/java/com/yunbao/live/activity/CompensateActivity.java new file mode 100644 index 000000000..ea6078fc2 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/activity/CompensateActivity.java @@ -0,0 +1,120 @@ +package com.yunbao.live.activity; + +import android.graphics.Outline; +import android.view.View; +import android.view.ViewOutlineProvider; +import android.widget.TextView; + +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.alibaba.fastjson.JSON; +import com.google.gson.Gson; +import com.ms.banner.Banner; +import com.ms.banner.BannerConfig; +import com.ms.banner.listener.OnBannerClickListener; +import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.Constants; +import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.bean.LiveGiftBean; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpUtil; +import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.R; +import com.yunbao.live.adapter.MsgSysGiftAdapter; +import com.yunbao.live.bean.MsgSysGiftInfoBean; +import com.yunbao.live.bean.SlideBean; +import com.yunbao.live.custom.TopGradual; +import com.yunbao.live.http.ImHttpUtil; +import com.yunbao.live.views.CustomMyViewHolder; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Route(path = RouteUtil.PATH_COMPENSATE_ACTIVITY) +public class CompensateActivity extends AbsActivity { + + Banner banner_me; + TextView content; + RecyclerView recyclerView; + + MsgSysGiftAdapter msgSysGiftAdapter; + + int msgId; + + @Override + protected int getLayoutId() { + return R.layout.activity_compensate; + } + + @Override + protected void main() { + + recyclerView = findViewById(R.id.hor_recycler); + recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false)); + recyclerView.addItemDecoration(new TopGradual()); + + msgSysGiftAdapter = new MsgSysGiftAdapter(mContext); + + recyclerView.setAdapter(msgSysGiftAdapter); + + msgId = getIntent().getIntExtra("msgid", -1); + + banner_me = (Banner) findViewById(R.id.banner_me); + banner_me.setOutlineProvider(new ViewOutlineProvider() { + @Override + public void getOutline(View view, Outline outline) { + outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10); + } + }); + getMessageGiftInfo(); + } + + private void getMessageGiftInfo() { + ImHttpUtil.getMessageGiftInfo(msgId, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + List list = new ArrayList<>(); + if (info != null) { + list = JSON.parseArray(info[0], MsgSysGiftInfoBean.class); + } + msgSysGiftAdapter.setList(list); + + List mBannerList = new ArrayList<>(); + SlideBean slideBean = new SlideBean(); + slideBean.setSlide_pic("https://downs.yaoulive.com/20231111/55ddbc06ffdd02e480f3513fdb31caf6.png"); + mBannerList.add(slideBean); + mBannerList.add(slideBean); + showBanner(mBannerList); + } + }); + } + + private void showBanner(List mBannerList) { + banner_me.setAutoPlay(true).setPages(mBannerList, new CustomMyViewHolder()).setDelayTime(3000).setBannerStyle(BannerConfig.NOT_INDICATOR).setOnBannerClickListener(new OnBannerClickListener() { + @Override + public void onBannerClick(List datas, int p) { + if (mBannerList != null) { + if (p >= 0 && p < mBannerList.size()) { + SlideBean bean = mBannerList.get(p); + if (!bean.getSlide_url().equals("")) { + Constants.isTitle = true; + String url = bean.getSlide_url() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"); + RouteUtil.forwardCustomerService(url); + + Map map_ekv = new HashMap(); + map_ekv.put("link", url); + MobclickAgent.onEvent(mContext, "my_banner", map_ekv); + } + } + } + } + }).start(); + } +} diff --git a/live/src/main/java/com/yunbao/live/adapter/MsgSysGiftAdapter.java b/live/src/main/java/com/yunbao/live/adapter/MsgSysGiftAdapter.java new file mode 100644 index 000000000..474e36881 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/MsgSysGiftAdapter.java @@ -0,0 +1,101 @@ +package com.yunbao.live.adapter; + +import android.content.Context; +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.recyclerview.widget.RecyclerView; + +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.live.R; +import com.yunbao.live.bean.MsgSysGiftInfoBean; + +import java.util.ArrayList; +import java.util.List; + +public class MsgSysGiftAdapter extends RecyclerView.Adapter { + private Context mContext; + private RecyclerView mRecyclerView; + private List mList; + private LayoutInflater mInflater; + + public MsgSysGiftAdapter(Context context) { + mContext = context; + mList = new ArrayList<>(); + mList.add(new MsgSysGiftInfoBean()); + mInflater = LayoutInflater.from(context); + + } + + public void setList(List list) { + if (list != null && list.size() > 0) { + mList.clear(); + mList.addAll(list); + notifyDataSetChanged(); + } + } + + @Override + public int getItemViewType(int position) { + return position; + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new Vh(mInflater.inflate(R.layout.item_msg_sys_gift, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position, @NonNull List payloads) { + Object payload = payloads.size() > 0 ? payloads.get(0) : null; + ((Vh) vh).setData(mList.get(position), position, payload); + } + + + @Override + public int getItemCount() { + return mList.size(); + } + + + class Vh extends RecyclerView.ViewHolder { + + ImageView mAvatar; + TextView mName, name_remarks; + + public Vh(View itemView) { + super(itemView); + mAvatar = (ImageView) itemView.findViewById(R.id.avatar); + mName = (TextView) itemView.findViewById(R.id.name); + name_remarks = (TextView) itemView.findViewById(R.id.name_remarks); + } + + void setData(MsgSysGiftInfoBean bean, int position, Object payload) { + itemView.setTag(position); + ImgLoader.display(mContext, bean.getItem_image(), mAvatar); + mName.setText(bean.getItem_name()); + name_remarks.setText(bean.getRestrict_time()); + } + } + + @Override + public void onAttachedToRecyclerView(RecyclerView recyclerView) { + super.onAttachedToRecyclerView(recyclerView); + mRecyclerView = recyclerView; + } + + public interface ActionListener { + void onItemClick(MsgSysGiftInfoBean bean); + } + +} diff --git a/live/src/main/java/com/yunbao/live/adapter/SystemMessageNewAdapter.java b/live/src/main/java/com/yunbao/live/adapter/SystemMessageNewAdapter.java index 915daf395..a7015f824 100644 --- a/live/src/main/java/com/yunbao/live/adapter/SystemMessageNewAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/SystemMessageNewAdapter.java @@ -14,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.ZhuangBanActivity; @@ -28,12 +29,13 @@ import java.util.Date; public class SystemMessageNewAdapter extends RefreshAdapter { - public SystemMessageNewAdapter(Context context) { + ItemLongListener itemLongListener; + + public SystemMessageNewAdapter(Context context, ItemLongListener itemLongListener) { super(context); - + this.itemLongListener = itemLongListener; } - @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { @@ -47,12 +49,13 @@ public class SystemMessageNewAdapter extends RefreshAdapter { class Vh extends RecyclerView.ViewHolder { TextView messageContext, messageTime; - LinearLayout layoutMore; + LinearLayout layoutMore, itemLayout; public Vh(View itemView) { super(itemView); messageContext = itemView.findViewById(R.id.message_context); layoutMore = itemView.findViewById(R.id.layout_more); + itemLayout = itemView.findViewById(R.id.itemLayout); messageTime = itemView.findViewById(R.id.message_time); } @@ -61,27 +64,38 @@ public class SystemMessageNewAdapter extends RefreshAdapter { Date currenTimeZone = new Date(Long.parseLong(bean.getAddtime() + "000")); messageTime.setText(sdf.format(currenTimeZone)); messageContext.setText(bean.getContent()); - layoutMore.setVisibility(TextUtils.isEmpty(bean.getLink()) ? View.GONE : View.VISIBLE); + if (bean.getSystem_message_type() == 1) { + layoutMore.setVisibility(View.VISIBLE); + } else { + layoutMore.setVisibility(TextUtils.isEmpty(bean.getLink()) ? View.GONE : View.VISIBLE); + } + itemLayout.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + itemLongListener.onItemLong(bean); + return false; + } + }); layoutMore.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (bean.getLink() != null && !bean.getLink().equals("")) { - IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); - StringBuffer urlBuffer = new StringBuffer(); - urlBuffer.append(bean.getLink()) - .append("&uid=") - .append(userInfo.getId()) - .append("&token=") - .append(userInfo.getToken()) .append("&isZh=") - .append(WordUtil.isNewZh() ? "1" : 0); - mContext.startActivity( - new Intent(mContext, ZhuangBanActivity.class) - .putExtra("url", urlBuffer.toString())); - + if (bean.getSystem_message_type() == 2) {//普通消息 + if (bean.getLink() != null && !bean.getLink().equals("")) { + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + StringBuffer urlBuffer = new StringBuffer(); + urlBuffer.append(bean.getLink()).append("&uid=").append(userInfo.getId()).append("&token=").append(userInfo.getToken()).append("&isZh=").append(WordUtil.isNewZh() ? "1" : 0); + mContext.startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url", urlBuffer.toString())); + } + } else if (bean.getSystem_message_type() == 1) {//礼包消息 + RouteUtil.forwardLiveCompensateActivity("", false); } } }); } } + public interface ItemLongListener { + void onItemLong(SystemMessageBean bean); + } + } diff --git a/live/src/main/java/com/yunbao/live/bean/MsgSysGiftInfoBean.java b/live/src/main/java/com/yunbao/live/bean/MsgSysGiftInfoBean.java new file mode 100644 index 000000000..72a74f1db --- /dev/null +++ b/live/src/main/java/com/yunbao/live/bean/MsgSysGiftInfoBean.java @@ -0,0 +1,40 @@ +package com.yunbao.live.bean; + +public class MsgSysGiftInfoBean { + int id; + String item_name; + String restrict_time; + String item_image; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getItem_name() { + return item_name; + } + + public void setItem_name(String item_name) { + this.item_name = item_name; + } + + public String getRestrict_time() { + return restrict_time; + } + + public void setRestrict_time(String restrict_time) { + this.restrict_time = restrict_time; + } + + public String getItem_image() { + return item_image; + } + + public void setItem_image(String item_image) { + this.item_image = item_image; + } +} diff --git a/live/src/main/java/com/yunbao/live/bean/SystemMessageBean.java b/live/src/main/java/com/yunbao/live/bean/SystemMessageBean.java index aa416c733..ee113ea60 100644 --- a/live/src/main/java/com/yunbao/live/bean/SystemMessageBean.java +++ b/live/src/main/java/com/yunbao/live/bean/SystemMessageBean.java @@ -19,6 +19,27 @@ public class SystemMessageBean { private String showImg; private String imgBanner; + private int system_message_type; //1 普通消息 2 礼包消息 + + private int get_status; // 1 已领取 2 未领取 + + + public int getSystem_message_type() { + return system_message_type; + } + + public void setSystem_message_type(int system_message_type) { + this.system_message_type = system_message_type; + } + + public int getGet_status() { + return get_status; + } + + public void setGet_status(int get_status) { + this.get_status = get_status; + } + @JSONField(name = "banner") public String getImgBanner() { return imgBanner; diff --git a/live/src/main/java/com/yunbao/live/http/ImHttpConsts.java b/live/src/main/java/com/yunbao/live/http/ImHttpConsts.java index 5f3812fed..ff0669945 100644 --- a/live/src/main/java/com/yunbao/live/http/ImHttpConsts.java +++ b/live/src/main/java/com/yunbao/live/http/ImHttpConsts.java @@ -11,4 +11,6 @@ public class ImHttpConsts { public static final String CHECK_BLACK = "checkBlack"; public static final String SEND_DYNAMICCOMMENT = "sendDynamicComment"; public static final String SET_BLACK = "setBlack"; + + public static final String GET_MESSAGEGIFTINFO = "getMessageGiftInfo"; } diff --git a/live/src/main/java/com/yunbao/live/http/ImHttpUtil.java b/live/src/main/java/com/yunbao/live/http/ImHttpUtil.java index 6fc4e6746..5a8403ad7 100644 --- a/live/src/main/java/com/yunbao/live/http/ImHttpUtil.java +++ b/live/src/main/java/com/yunbao/live/http/ImHttpUtil.java @@ -73,4 +73,14 @@ public class ImHttpUtil { .params("touid", touid) .execute(callback); } + + + /** + * 获取补偿消息详情 + */ + public static void getMessageGiftInfo(int msgid, HttpCallback callback) { + HttpClient.getInstance().get("Message.getMessageGiftInfo", ImHttpConsts.GET_MESSAGEGIFTINFO) + .params("message_id", msgid) + .execute(callback); + } } diff --git a/live/src/main/java/com/yunbao/live/views/CustomMyViewHolder.java b/live/src/main/java/com/yunbao/live/views/CustomMyViewHolder.java index a6aef2bd2..9cf67db55 100644 --- a/live/src/main/java/com/yunbao/live/views/CustomMyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/CustomMyViewHolder.java @@ -7,7 +7,6 @@ import android.widget.ImageView; import com.bumptech.glide.Glide; import com.ms.banner.holder.BannerViewHolder; -import com.yunbao.common.bean.BannerBean; import com.yunbao.live.bean.SlideBean; public class CustomMyViewHolder implements BannerViewHolder { diff --git a/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java b/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java index 4a0f83171..84317cf4d 100644 --- a/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java @@ -5,6 +5,7 @@ import static io.rong.imlib.RongIMClient.BlacklistStatus.NOT_IN_BLACK_LIST; import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; +import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; @@ -54,6 +55,8 @@ import com.yunbao.common.bean.ImageEntity; import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.interfaces.OnItemLongClickListener; +import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.AbsViewHolder; @@ -190,8 +193,7 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli } InputMethodManager methodManager = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); if (methodManager != null) { - methodManager.hideSoftInputFromWindow(feedback_edittext.getWindowToken(), - InputMethodManager.HIDE_NOT_ALWAYS); + methodManager.hideSoftInputFromWindow(feedback_edittext.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } feedback_edittext.clearFocus(); } @@ -259,8 +261,7 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli if (lt_controls.getVisibility() == View.GONE) { InputMethodManager methodManager = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); if (methodManager != null) { - methodManager.hideSoftInputFromWindow(feedback_edittext.getWindowToken(), - InputMethodManager.HIDE_NOT_ALWAYS); + methodManager.hideSoftInputFromWindow(feedback_edittext.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } Thread thread = new Thread(new Runnable() { @@ -285,61 +286,60 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli oldestMessageId = -1; } Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE; - RongIMClient.getInstance().getHistoryMessages(conversationType, SystemMessageActivity.nowUid, oldestMessageId, 20, - new RongIMClient.ResultCallback>() { - /** - * 成功时回调 - * @param messages 获取的消息列表 - */ - @Override - public void onSuccess(List messages) { - Collections.reverse(messages); - EventBus.getDefault().post(messages); - if (messages.size() > 0) { - if (messages.size() < 20) { - moretext = false; - } else { - moretext = true; - } - oldestMessageId = messages.get(0).getMessageId(); - Log.i("chatlist", "oldestMessageId = " + oldestMessageId); - if (messagesList.size() == 0) { - Message messageNo = new Message(); - messageNo.setSenderUserId("-1"); - messagesList.add(messageNo); + RongIMClient.getInstance().getHistoryMessages(conversationType, SystemMessageActivity.nowUid, oldestMessageId, 20, new RongIMClient.ResultCallback>() { + /** + * 成功时回调 + * @param messages 获取的消息列表 + */ + @Override + public void onSuccess(List messages) { + Collections.reverse(messages); + EventBus.getDefault().post(messages); + if (messages.size() > 0) { + if (messages.size() < 20) { + moretext = false; + } else { + moretext = true; + } + oldestMessageId = messages.get(0).getMessageId(); + Log.i("chatlist", "oldestMessageId = " + oldestMessageId); + if (messagesList.size() == 0) { + Message messageNo = new Message(); + messageNo.setSenderUserId("-1"); + messagesList.add(messageNo); - messagesList.addAll(messages); - } else { - if (moretext) { - messagesList.get(0).setSenderUserId("-1"); - } else { - messagesList.get(0).setSenderUserId("-2"); - } - messagesList.addAll(1, messages); - } - mHandler.sendEmptyMessageAtTime(1, 0); + messagesList.addAll(messages); + } else { + if (moretext) { + messagesList.get(0).setSenderUserId("-1"); } else { - moretext = false; - if (messagesList.size() == 0) { - Message messageNo = new Message(); - messageNo.setSenderUserId("-1"); - messagesList.add(messageNo); - messagesList.addAll(messages); - } messagesList.get(0).setSenderUserId("-2"); - mHandler.sendEmptyMessageAtTime(1, 0); } + messagesList.addAll(1, messages); } + mHandler.sendEmptyMessageAtTime(1, 0); + } else { + moretext = false; + if (messagesList.size() == 0) { + Message messageNo = new Message(); + messageNo.setSenderUserId("-1"); + messagesList.add(messageNo); + messagesList.addAll(messages); + } + messagesList.get(0).setSenderUserId("-2"); + mHandler.sendEmptyMessageAtTime(1, 0); + } + } - /** - * 错误时回调。 - * @param e 错误码 - */ - @Override - public void onError(RongIMClient.ErrorCode e) { - ToastUtil.show("消息获取失败"); - } - }); + /** + * 错误时回调。 + * @param e 错误码 + */ + @Override + public void onError(RongIMClient.ErrorCode e) { + ToastUtil.show("消息获取失败"); + } + }); } @@ -357,12 +357,22 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli mRefreshView.setDataHelper(new CommonRefreshView.DataHelper() { @Override public RefreshAdapter getAdapter() { - if (mAdapter == null && (SystemMessageActivity.type.equals("1"))) { + if (mAdapter == null && (SystemMessageActivity.type.equals("1"))) {//官方通知 mAdapter = new SystemMessageAdapter(mContext); } else if (mAdapter == null && SystemMessageActivity.type.equals("2")) { mAdapter = new InteractionMessageAdapter(mContext, SystemMessageViewHolder.this); - } else if (mAdapter == null && SystemMessageActivity.type.equals("4")) { - mAdapter = new SystemMessageNewAdapter(mContext); + } else if (mAdapter == null && SystemMessageActivity.type.equals("4")) {//系统消息 + mAdapter = new SystemMessageNewAdapter(mContext, new SystemMessageNewAdapter.ItemLongListener() { + @Override + public void onItemLong(SystemMessageBean bean) { + DialogUitl.showDelSysMsg(mContext, mContext.getString(com.yunbao.common.R.string.msg_del_sys01), new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + + } + }); + } + }); } return mAdapter; } @@ -582,8 +592,7 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli try { MediaMetadataRetriever mmr = new MediaMetadataRetriever(); mmr.setDataSource(url); - duration = Integer.parseInt(mmr.extractMetadata - (MediaMetadataRetriever.METADATA_KEY_DURATION)) / 1000;//除以 1000 返回是秒 + duration = Integer.parseInt(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION)) / 1000;//除以 1000 返回是秒 //时长(毫秒) // String duration = mmr.extractMetadata(android.media.MediaMetadataRetriever.METADATA_KEY_DURATION); // //宽 @@ -683,11 +692,11 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli //intoIndex 1=调用相机,2=照片选取,3=视频选取 public void choosePic(int intoIndex) { //选择图片 - String permission1=Manifest.permission.READ_EXTERNAL_STORAGE; - String permission2= Manifest.permission.WRITE_EXTERNAL_STORAGE; + String permission1 = Manifest.permission.READ_EXTERNAL_STORAGE; + String permission2 = Manifest.permission.WRITE_EXTERNAL_STORAGE; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - permission1=Manifest.permission.READ_MEDIA_IMAGES; - permission2=Manifest.permission.READ_MEDIA_VIDEO; + permission1 = Manifest.permission.READ_MEDIA_IMAGES; + permission2 = Manifest.permission.READ_MEDIA_VIDEO; } int isPermission1 = ContextCompat.checkSelfPermission(mContext, permission1); int isPermission2 = ContextCompat.checkSelfPermission(mContext, permission2); @@ -695,8 +704,7 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli startActivity(intoIndex); } else { //申请权限 - ActivityCompat.requestPermissions(nowActivity, new String[]{permission1, - permission2}, PERMISSION_REQUEST_CODE); + ActivityCompat.requestPermissions(nowActivity, new String[]{permission1, permission2}, PERMISSION_REQUEST_CODE); } } @@ -1050,8 +1058,7 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli */ @Override public ImMessageAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { - View view = mInflater.inflate(R.layout.item_chat_one, - viewGroup, false); + View view = mInflater.inflate(R.layout.item_chat_one, viewGroup, false); ImMessageAdapter.ViewHolder viewHolder = new ImMessageAdapter.ViewHolder(view); return viewHolder; @@ -1207,9 +1214,7 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli viewHolder.cv_chatcontent_img1.setVisibility(View.VISIBLE); viewHolder.rt_video_left.setVisibility(View.GONE); - Glide.with(mContext) - .load(imageMessage.getThumUri()) - .into(viewHolder.chatcontent_img1); + Glide.with(mContext).load(imageMessage.getThumUri()).into(viewHolder.chatcontent_img1); viewHolder.chatcontent_img1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -1225,9 +1230,7 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli viewHolder.cv_chatcontent_img.setVisibility(View.VISIBLE); viewHolder.rt_video_right.setVisibility(View.GONE); if (mDatas.get(position).getReceivedTime() == 0) { - Glide.with(mContext) - .load(imageMessage.getThumUri()) - .into(viewHolder.chatcontent_img); + Glide.with(mContext).load(imageMessage.getThumUri()).into(viewHolder.chatcontent_img); viewHolder.view_feed_suc.setVisibility(View.VISIBLE); viewHolder.view_feed_suc.setOnClickListener(new View.OnClickListener() { @Override @@ -1238,14 +1241,10 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli }); } else if (mDatas.get(position).getReceivedTime() < 100) { viewHolder.view_feed_suc.setVisibility(View.GONE); - Glide.with(mContext) - .load(imageMessage.getThumUri()) - .into(viewHolder.chatcontent_img); + Glide.with(mContext).load(imageMessage.getThumUri()).into(viewHolder.chatcontent_img); } else { viewHolder.view_feed_suc.setVisibility(View.GONE); - Glide.with(mContext) - .load(imageMessage.getThumUri()) - .into(viewHolder.chatcontent_img); + Glide.with(mContext).load(imageMessage.getThumUri()).into(viewHolder.chatcontent_img); viewHolder.chatcontent_img.setOnClickListener(new View.OnClickListener() { @Override @@ -1412,16 +1411,9 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli */ public static void loadCover(ImageView imageView, Uri uri, Context context) { imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); - Glide.with(context) - .setDefaultRequestOptions( - new RequestOptions() - .frame(1000000) - .centerCrop() - .error(R.drawable.anim_loading)//可以忽略 - .placeholder(R.drawable.anim_loading)//可以忽略 - ) - .load(uri) - .into(imageView); + Glide.with(context).setDefaultRequestOptions(new RequestOptions().frame(1000000).centerCrop().error(R.drawable.anim_loading)//可以忽略 + .placeholder(R.drawable.anim_loading)//可以忽略 + ).load(uri).into(imageView); } //互动消息回复 diff --git a/live/src/main/res/layout/activity_compensate.xml b/live/src/main/res/layout/activity_compensate.xml new file mode 100644 index 000000000..be2769dfa --- /dev/null +++ b/live/src/main/res/layout/activity_compensate.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +