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); }