package com.sheep.gamegroup.view.activity;

import android.content.Intent;
import android.support.v4.app.Fragment;
import android.util.Log;

import com.sheep.gamegroup.absBase.BaseContainerActivity;
import com.sheep.gamegroup.util.LogUtil;
import com.sheep.gamegroup.view.fragment.FgtEveryDayShare;
import com.sheep.gamegroup.view.fragment.FgtFootprint;
import com.sheep.jiuyan.samllsheep.utils.G;
import com.umeng.socialize.UMShareAPI;
import com.umeng.socialize.UMShareListener;
import com.umeng.socialize.bean.SHARE_MEDIA;

/**
 * Created by realicing on 2018/11/23.
 * realicing@sina.com
 * 小绵羊3.4.5新增--每日分享
 */
public class ActEveryDayShare extends BaseContainerActivity implements UMShareListener {

    @Override
    protected Fragment initFragment() {
        return new FgtEveryDayShare();
    }

    @Override
    public void onStart(SHARE_MEDIA share_media) {
        LogUtil.println("UMShareListener", "start", share_media.getName());
    }

    @Override
    public void onResult(SHARE_MEDIA share_media) {
        LogUtil.println("UMShareListener", "result", share_media.getName());
    }

    @Override
    public void onError(SHARE_MEDIA share_media, Throwable throwable) {
        String msg = throwable.getMessage();
        G.showToast(msg != null && msg.contains("没有安装应用") ? "没有安装应用" : msg);
        LogUtil.println("UMShareListener", "error", share_media.getName() +
                ",msg:" + throwable.getMessage());
    }

    @Override
    public void onCancel(SHARE_MEDIA share_media) {
        LogUtil.println("UMShareListener", "delete", share_media.getName());
    }
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        try {
            UMShareAPI.get(this).onActivityResult(requestCode, resultCode, data);
        } catch (Exception e) {
            e.printStackTrace();
        }


    }


}
