From 02bc6046857a804695783a299c375a80bb66042c Mon Sep 17 00:00:00 2001 From: hch <16607480311@163.com> Date: Fri, 22 Mar 2024 13:53:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=8A=A8=E6=80=81=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/activity/CommunitySendActivity.java | 2 +- .../main/views/MainHomeComViewHolder.java | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java b/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java index 1aeaa0ad4..c1443734e 100644 --- a/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java @@ -236,8 +236,8 @@ public class CommunitySendActivity extends AbsActivity { CommonHttpUtil.pushCommunity(isImage, jsonObject.toString(), String.valueOf(talkId), imgUrl, videoUrl, tempTime, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { + ToastUtil.show(msg); if (code == 0) { - ToastUtil.show("发布成功"); finish(); } } diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeComViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeComViewHolder.java index 9d4ffdf99..c15445aa3 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeComViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeComViewHolder.java @@ -1,7 +1,9 @@ package com.yunbao.main.views; +import android.Manifest; import android.content.Context; import android.content.Intent; +import android.os.Build; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; @@ -10,7 +12,10 @@ import android.widget.TextView; import com.umeng.analytics.MobclickAgent; import com.yunbao.common.event.FloatWarOrderEvent; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.utils.ToastUtil; import com.yunbao.main.R; import com.yunbao.main.activity.CommunitySendActivity; @@ -44,6 +49,8 @@ public class MainHomeComViewHolder extends AbsMainHomeParentComViewHolder { return R.layout.view_main_home_com; } + private ProcessResultUtil mProcessResultUtil; + @Override public void init() { super.init(); @@ -51,6 +58,28 @@ public class MainHomeComViewHolder extends AbsMainHomeParentComViewHolder { btnSend.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + boolean isAnchor = IMLoginManager.get(mContext).getUserInfo().anchorUserType(); + if (isAnchor) { + String[] permissions; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + permissions = new String[]{ + Manifest.permission.READ_MEDIA_IMAGES, + Manifest.permission.CAMERA, + Manifest.permission.RECORD_AUDIO + }; + } else { + permissions = new String[]{ + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.WRITE_EXTERNAL_STORAGE, + Manifest.permission.CAMERA, + Manifest.permission.RECORD_AUDIO + }; + } + mProcessResultUtil.requestPermissions(permissions, mStartVideoRunnable); + } else { + ToastUtil.show(mContext.getResources().getString(R.string.only_open_anchor)); + } + Intent intent = new Intent(mContext, CommunitySendActivity.class); mContext.startActivity(intent); } @@ -64,6 +93,14 @@ public class MainHomeComViewHolder extends AbsMainHomeParentComViewHolder { }); } + private Runnable mStartVideoRunnable = new Runnable() { + @Override + public void run() { + Intent intent = new Intent(mContext, CommunitySendActivity.class); + mContext.startActivity(intent); + } + }; + public void setCurPosition(int position) { mViewPager.setCurrentItem(position); }