发布动态限制

This commit is contained in:
hch 2024-03-22 13:53:32 +08:00
parent 5ebb97cd3c
commit 02bc604685
2 changed files with 38 additions and 1 deletions

View File

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

View File

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