package com.bc_chat.im.messages.vibration;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;

import com.bc_chat.im.R;
import com.bc_chat.im.activity.SendVibrationDetailActivity;

import io.rong.imkit.RongExtension;
import io.rong.imkit.plugin.IPluginModule;
import io.rong.imlib.model.Conversation;

/**
 * author：Created by zhaohaoting on 2019/03/03
 * email：526309416@qq.com
 * desc：
 */
public class VibrationPlugin implements IPluginModule {

    private Context context;
    private Conversation.ConversationType conversationType;
    private String targetId;

    public VibrationPlugin() {
    }

    @Override
    public Drawable obtainDrawable(Context context) {
        return ContextCompat.getDrawable(context, R.drawable.rc_vibartion_plugin_icon);
    }

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

    @Override
    public void onClick(Fragment currentFragment, RongExtension extension) {
        context = currentFragment.getActivity();
        conversationType = extension.getConversationType();
        targetId = extension.getTargetId();
        Intent intent = new Intent(context, SendVibrationDetailActivity.class);
        intent.putExtra("conversationType", conversationType);
        intent.putExtra("targetId", targetId);
        context.startActivity(intent);
    }

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