|
@@ -1,5 +1,6 @@
|
|
|
package com.cooleshow.teacher.ui.score;
|
|
|
|
|
|
+import android.content.Intent;
|
|
|
import android.content.res.Configuration;
|
|
|
import android.graphics.Bitmap;
|
|
|
import android.os.Bundle;
|
|
@@ -12,8 +13,10 @@ import androidx.fragment.app.Fragment;
|
|
|
import androidx.viewpager.widget.ViewPager;
|
|
|
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
|
|
+import com.alibaba.android.arouter.launcher.ARouter;
|
|
|
import com.cooleshow.base.router.RouterPath;
|
|
|
import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
|
+import com.cooleshow.base.utils.FileUtils;
|
|
|
import com.cooleshow.base.utils.ToastUtil;
|
|
|
import com.cooleshow.base.utils.ToastUtils;
|
|
|
import com.cooleshow.base.widgets.poplist.PopMenuBean;
|
|
@@ -25,10 +28,10 @@ import com.cooleshow.teacher.bean.QuerySubjectBean;
|
|
|
import com.cooleshow.teacher.constants.TeacherInfoConstants;
|
|
|
import com.cooleshow.teacher.contract.MineScoreActContract;
|
|
|
import com.cooleshow.teacher.databinding.ActivityMineScoreBinding;
|
|
|
+import com.cooleshow.teacher.helper.ShareHelper;
|
|
|
import com.cooleshow.teacher.presenter.score.MineScoreActPresenter;
|
|
|
import com.cooleshow.teacher.ui.web.HtmlActivity;
|
|
|
import com.cooleshow.teacher.widgets.DialogUtils;
|
|
|
-import com.cooleshow.teacher.widgets.FileUtils;
|
|
|
import com.cooleshow.usercenter.helper.UserHelper;
|
|
|
import com.google.android.material.tabs.TabLayout;
|
|
|
import com.umeng.socialize.ShareAction;
|
|
@@ -47,6 +50,8 @@ import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
import io.rong.imkit.utils.StatusBarUtil;
|
|
|
+import io.rong.imkit.utils.helper.OpenChatHelper;
|
|
|
+import io.rong.imlib.model.Conversation;
|
|
|
|
|
|
/**
|
|
|
* 创建日期:2022/5/20 16:34
|
|
@@ -56,6 +61,7 @@ import io.rong.imkit.utils.StatusBarUtil;
|
|
|
*/
|
|
|
@Route(path = RouterPath.ScoreCenter.TEACHER_MINE_SCORE)
|
|
|
public class MineScoreActivity extends BaseMVPActivity<ActivityMineScoreBinding, MineScoreActPresenter> implements MineScoreActContract.MineScoreActView, View.OnClickListener {
|
|
|
+ public static final int SHARE_CHAT_REQUEST_CODE = 500;
|
|
|
private String currentSubjectId = "";
|
|
|
private String currentSearchStr = "";
|
|
|
private TabLayout tabLayout;
|
|
@@ -64,6 +70,9 @@ public class MineScoreActivity extends BaseMVPActivity<ActivityMineScoreBinding,
|
|
|
private List<String> auditStatusList = new ArrayList<String>(Arrays.asList("PASS", "DOING", "UNPASS"));
|
|
|
private List<Fragment> fragments = new ArrayList<>();
|
|
|
private ArrayList<QuerySubjectBean> subjectBeanList = new ArrayList<>();
|
|
|
+ private ShareAction mShareAction;
|
|
|
+ private UMShareListener mShareListener;
|
|
|
+ private Bitmap targetBitmap;
|
|
|
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
@@ -207,23 +216,29 @@ public class MineScoreActivity extends BaseMVPActivity<ActivityMineScoreBinding,
|
|
|
DialogUtils.showScoreShare(this, data, bitmap -> share(bitmap));
|
|
|
}
|
|
|
|
|
|
- private ShareAction mShareAction;
|
|
|
- private UMShareListener mShareListener;
|
|
|
-
|
|
|
private void share(Bitmap bitmap) {
|
|
|
mShareAction = new ShareAction(MineScoreActivity.this).setDisplayList(
|
|
|
SHARE_MEDIA.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE, SHARE_MEDIA.SINA)
|
|
|
.setShareboardclickCallback(new ShareBoardlistener() {
|
|
|
@Override
|
|
|
public void onclick(SnsPlatform snsPlatform, SHARE_MEDIA share_media) {
|
|
|
- UMImage image = new UMImage(MineScoreActivity.this, bitmap);
|
|
|
- new ShareAction(MineScoreActivity.this).withMedia(image)
|
|
|
- .setPlatform(share_media)
|
|
|
- .setCallback(mShareListener)
|
|
|
- .share();
|
|
|
-
|
|
|
+ if (share_media == null) {
|
|
|
+ if (TextUtils.equals(snsPlatform.mKeyword, "chat")) {
|
|
|
+ //分享群聊
|
|
|
+ MineScoreActivity.this.targetBitmap = bitmap;
|
|
|
+ ARouter.getInstance().build(RouterPath.ChatCenter.CHAT_SELECT_CONTACT)
|
|
|
+ .navigation(MineScoreActivity.this, SHARE_CHAT_REQUEST_CODE);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ UMImage image = new UMImage(MineScoreActivity.this, bitmap);
|
|
|
+ new ShareAction(MineScoreActivity.this).withMedia(image)
|
|
|
+ .setPlatform(share_media)
|
|
|
+ .setCallback(mShareListener)
|
|
|
+ .share();
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
+ mShareAction.addButton("群聊", "chat", "icon_share_chat_group", "icon_share_chat_group");
|
|
|
mShareAction.open();
|
|
|
}
|
|
|
|
|
@@ -299,6 +314,34 @@ public class MineScoreActivity extends BaseMVPActivity<ActivityMineScoreBinding,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
|
|
+ super.onActivityResult(requestCode, resultCode, data);
|
|
|
+ if (resultCode == RESULT_OK) {
|
|
|
+ if (requestCode == SHARE_CHAT_REQUEST_CODE) {
|
|
|
+ //选择群聊
|
|
|
+ if (targetBitmap != null) {
|
|
|
+ String targetId = data.getStringExtra("targetId");
|
|
|
+ int conversationValue = data.getIntExtra("conversation", -1);
|
|
|
+ Conversation.ConversationType conversationType = OpenChatHelper.getConversationType(conversationValue);
|
|
|
+ ShareHelper.shareImgToChatGroup(targetBitmap, targetId, conversationType, new ShareHelper.ResultCallBack() {
|
|
|
+ @Override
|
|
|
+ public void onResult(boolean isSuccess) {
|
|
|
+ if (isSuccess) {
|
|
|
+ if (targetBitmap != null) {
|
|
|
+ targetBitmap.recycle();
|
|
|
+ targetBitmap = null;
|
|
|
+ }
|
|
|
+ ToastUtil.getInstance().showShort("分享成功啦");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public void onDestroy() {
|
|
|
super.onDestroy();
|
|
|
UMShareAPI.get(MineScoreActivity.this).release();
|