package io.rong.imkit.conversation.extension.component.plugin;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;

import androidx.fragment.app.Fragment;

import com.alibaba.android.arouter.launcher.ARouter;
import com.cooleshow.base.router.RouterPath;

import io.rong.imkit.R;
import io.rong.imkit.conversation.extension.RongExtension;
import io.rong.imkit.picture.config.PictureConfig;
import io.rong.imlib.model.Conversation;

/**
 * 创建日期：2022/6/10 14:26
 *
 * @author Ryan
 * 类说明：
 */
public class ScorePlugin implements IPluginModule {
    Conversation.ConversationType conversationType;
    String targetId;
    Context context;
    private int mRequestCode = -1;

    @Override
    public Drawable obtainDrawable(Context context) {
        this.context = context;
        return context.getResources().getDrawable(R.drawable.rc_ext_plugin_score_selector);
    }

    @Override
    public String obtainTitle(Context context) {
        return "曲谱";
    }

    @Override
    public void onClick(Fragment currentFragment, RongExtension extension, int index) {
        conversationType = extension.getConversationType();
        targetId = extension.getTargetId();
        mRequestCode = ((index + 1) << 8) + (PictureConfig.CHOOSE_REQUEST & 0xff);

        ARouter.getInstance().build(RouterPath.ChatCenter.CHAT_SELECT_SCORE)
                .withString("targetId", targetId)
                .withInt("conversationType", conversationType.getValue())
                .navigation();

    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {

    }


}