com.sina.weibo.sdk.utils.LogUtil Java Examples

The following examples show how to use com.sina.weibo.sdk.utils.LogUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VersionCheckHandler.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public boolean check(Context context, WeiboMultiMessage weibomultimessage)
{
    LogUtil.d("VersionCheckHandler", (new StringBuilder("check WeiboMultiMessage package : ")).append(mPackageName).toString());
    ApiUtils.WeiboInfo weiboinfo;
    if (mPackageName != null && mPackageName.length() != 0)
    {
        if ((weiboinfo = ApiUtils.queryWeiboInfoByPackage(context, mPackageName)) != null)
        {
            LogUtil.d("VersionCheckHandler", (new StringBuilder("check WeiboMultiMessage WeiboInfo supportApi : ")).append(weiboinfo.supportApi).toString());
            if (weiboinfo.supportApi >= 10351)
            {
                if (weiboinfo.supportApi < 10352 && weibomultimessage.mediaObject != null && (weibomultimessage.mediaObject instanceof CmdObject))
                {
                    weibomultimessage.mediaObject = null;
                }
                return true;
            }
        }
    }
    return false;
}
 
Example #2
Source File: WeiboShareAPIImpl.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
private void sendBroadcast(Context context, String s, String s1, String s2, Bundle bundle)
{
    Intent intent = new Intent(s);
    String s3 = context.getPackageName();
    intent.putExtra("_weibo_sdkVersion", 22);
    intent.putExtra("_weibo_appPackage", s3);
    intent.putExtra("_weibo_appKey", s1);
    intent.putExtra("_weibo_flag", 0x20130329);
    intent.putExtra("_weibo_sign", MD5.hexdigest(Utility.getSign(context, s3)));
    if (!TextUtils.isEmpty(s2))
    {
        intent.setPackage(s2);
    }
    if (bundle != null)
    {
        intent.putExtras(bundle);
    }
    LogUtil.d("WeiboApiImpl", (new StringBuilder("intent=")).append(intent).append(", extra=").append(intent.getExtras()).toString());
    context.sendBroadcast(intent, "com.sina.weibo.permission.WEIBO_SDK_PERMISSION");
}
 
Example #3
Source File: WeiboShareAPIImpl.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public WeiboShareAPIImpl(Context context, String s, boolean flag)
{
    mWeiboInfo = null;
    mNeedDownloadWeibo = true;
    mDownloadConfirmDialog = null;
    mContext = context;
    mAppKey = s;
    mNeedDownloadWeibo = flag;
    mWeiboInfo = ApiUtils.queryWeiboInfo(mContext);
    if (mWeiboInfo != null)
    {
        LogUtil.d("WeiboApiImpl", mWeiboInfo.toString());
        return;
    } else
    {
        LogUtil.d("WeiboApiImpl", "WeiboInfo: is null");
        return;
    }
}
 
Example #4
Source File: ApiUtils.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public static boolean containSign(Signature asignature[], String s)
{
    if (asignature != null && s != null)
    {
        int i = asignature.length;
        int j = 0;
        while (j < i) 
        {
            if (s.equals(MD5.hexdigest(asignature[j].toByteArray())))
            {
                LogUtil.d("ApiUtils", "check pass");
                return true;
            }
            j++;
        }
    }
    return false;
}
 
Example #5
Source File: VoiceObject.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public boolean checkArgs()
{
    if (!super.checkArgs())
    {
        return false;
    }
    if (dataUrl != null && dataUrl.length() > 512)
    {
        LogUtil.e("Weibo.VoiceObject", "checkArgs fail, dataUrl is invalid");
        return false;
    }
    if (dataHdUrl != null && dataHdUrl.length() > 512)
    {
        LogUtil.e("Weibo.VoiceObject", "checkArgs fail, dataHdUrl is invalid");
        return false;
    }
    if (duration <= 0)
    {
        LogUtil.e("Weibo.VoiceObject", "checkArgs fail, duration is invalid");
        return false;
    } else
    {
        return true;
    }
}
 
Example #6
Source File: MusicObject.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public boolean checkArgs()
{
    if (!super.checkArgs())
    {
        return false;
    }
    if (dataUrl != null && dataUrl.length() > 512)
    {
        LogUtil.e("Weibo.MusicObject", "checkArgs fail, dataUrl is invalid");
        return false;
    }
    if (dataHdUrl != null && dataHdUrl.length() > 512)
    {
        LogUtil.e("Weibo.MusicObject", "checkArgs fail, dataHdUrl is invalid");
        return false;
    }
    if (duration <= 0)
    {
        LogUtil.e("Weibo.MusicObject", "checkArgs fail, duration is invalid");
        return false;
    } else
    {
        return true;
    }
}
 
Example #7
Source File: WeiboShareAPIImpl.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public boolean sendRequest(BaseRequest baserequest)
{
    if (baserequest == null)
    {
        LogUtil.e("WeiboApiImpl", "sendRequest faild act == null or request == null");
    } else
    if (checkEnvironment(mNeedDownloadWeibo))
    {
        VersionCheckHandler versioncheckhandler = new VersionCheckHandler(mWeiboInfo.packageName);
        if (!baserequest.check(mContext, versioncheckhandler))
        {
            LogUtil.e("WeiboApiImpl", "sendRequest faild request check faild");
            return false;
        } else
        {
            Bundle bundle = new Bundle();
            baserequest.toBundle(bundle);
            return shareWithWeibo((Activity)mContext, "com.sina.weibo.sdk.action.ACTION_WEIBO_ACTIVITY", mWeiboInfo.packageName, mAppKey, bundle);
        }
    }
    return false;
}
 
Example #8
Source File: WeiboShareAPIImpl.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public boolean sendResponse(BaseResponse baseresponse)
{
    if (baseresponse == null)
    {
        LogUtil.e("WeiboApiImpl", "sendResponse failed response null");
        return false;
    }
    if (!baseresponse.check(mContext, new VersionCheckHandler()))
    {
        LogUtil.e("WeiboApiImpl", "sendResponse checkArgs fail");
        return false;
    } else
    {
        Bundle bundle = new Bundle();
        baseresponse.toBundle(bundle);
        sendBroadcast(mContext, "com.sina.weibo.sdk.Intent.ACTION_WEIBO_RESPONSE", mAppKey, baseresponse.reqPackageName, bundle);
        return true;
    }
}
 
Example #9
Source File: WbShareHandler.java    From LoginSharePay with Apache License 2.0 6 votes vote down vote up
private void startClientShare(WeiboMultiMessage message) {
    Bundle data = new Bundle();
    data.putInt("_weibo_command_type", 1);
    data.putString("_weibo_transaction", String.valueOf(System.currentTimeMillis()));
    data.putLong("callbackId", 0L);
    data.putAll(message.toBundle(data));
    Intent intent = new Intent();
    intent.setClass(this.context, WbShareTransActivity.class);
    intent.putExtra("startPackage", WeiboAppManager.getInstance(this.context).getWbAppInfo().getPackageName());
    intent.putExtra("startAction", "com.sina.weibo.sdk.action.ACTION_WEIBO_ACTIVITY");
    intent.putExtra("startFlag", 0);
    intent.putExtra("startActivity", this.context.getClass().getName());
    intent.putExtra("progressColor", this.progressColor);
    intent.putExtra("progressId", this.progressId);
    if(data != null) {
        intent.putExtras(data);
    }

    try {
        this.context.startActivity(intent);
    } catch (Exception var5) {
        LogUtil.v("weibo sdk error ", var5.toString());
    }

}
 
Example #10
Source File: VersionCheckHandler.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public boolean check(Context context, WeiboMessage weibomessage)
{
    LogUtil.d("VersionCheckHandler", (new StringBuilder("check WeiboMessage package : ")).append(mPackageName).toString());
    ApiUtils.WeiboInfo weiboinfo;
    if (mPackageName != null && mPackageName.length() != 0)
    {
        if ((weiboinfo = ApiUtils.queryWeiboInfoByPackage(context, mPackageName)) != null)
        {
            LogUtil.d("VersionCheckHandler", (new StringBuilder("check WeiboMessage WeiboInfo supportApi : ")).append(weiboinfo.supportApi).toString());
            if (weiboinfo.supportApi < 10351 && weibomessage.mediaObject != null && (weibomessage.mediaObject instanceof VoiceObject))
            {
                weibomessage.mediaObject = null;
            }
            if (weiboinfo.supportApi < 10352 && weibomessage.mediaObject != null && (weibomessage.mediaObject instanceof CmdObject))
            {
                weibomessage.mediaObject = null;
            }
            return true;
        }
    }
    return false;
}
 
Example #11
Source File: WeiboMessage.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public boolean checkArgs()
{
    if (mediaObject == null)
    {
        LogUtil.e("Weibo.WeiboMessage", "checkArgs fail, mediaObject is null");
        return false;
    }
    if (mediaObject != null && !mediaObject.checkArgs())
    {
        LogUtil.e("Weibo.WeiboMessage", "checkArgs fail, mediaObject is invalid");
        return false;
    } else
    {
        return true;
    }
}
 
Example #12
Source File: WeiboMultiMessage.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public boolean checkArgs()
{
    if (textObject != null && !textObject.checkArgs())
    {
        LogUtil.e("WeiboMultiMessage", "checkArgs fail, textObject is invalid");
        return false;
    }
    if (imageObject != null && !imageObject.checkArgs())
    {
        LogUtil.e("WeiboMultiMessage", "checkArgs fail, imageObject is invalid");
        return false;
    }
    if (mediaObject != null && !mediaObject.checkArgs())
    {
        LogUtil.e("WeiboMultiMessage", "checkArgs fail, mediaObject is invalid");
        return false;
    }
    if (textObject == null && imageObject == null && mediaObject == null)
    {
        LogUtil.e("WeiboMultiMessage", "checkArgs fail, textObject and imageObject and mediaObject is null");
        return false;
    } else
    {
        return true;
    }
}
 
Example #13
Source File: VideoObject.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public boolean checkArgs()
{
    if (!super.checkArgs())
    {
        return false;
    }
    if (dataUrl != null && dataUrl.length() > 512)
    {
        LogUtil.e("Weibo.VideoObject", "checkArgs fail, dataUrl is invalid");
        return false;
    }
    if (dataHdUrl != null && dataHdUrl.length() > 512)
    {
        LogUtil.e("Weibo.VideoObject", "checkArgs fail, dataHdUrl is invalid");
        return false;
    }
    if (duration <= 0)
    {
        LogUtil.e("Weibo.VideoObject", "checkArgs fail, duration is invalid");
        return false;
    } else
    {
        return true;
    }
}
 
Example #14
Source File: WeiboSdkBrowser.java    From letv with Apache License 2.0 6 votes vote down vote up
private boolean initDataFromIntent(Intent data) {
    Bundle bundle = data.getExtras();
    this.mRequestParam = createBrowserRequestParam(bundle);
    if (this.mRequestParam != null) {
        this.mUrl = this.mRequestParam.getUrl();
        this.mSpecifyTitle = this.mRequestParam.getSpecifyTitle();
    } else {
        String url = bundle.getString("key_url");
        String specifyTitle = bundle.getString("key_specify_title");
        if (!TextUtils.isEmpty(url) && url.startsWith(IDataSource.SCHEME_HTTP_TAG)) {
            this.mUrl = url;
            this.mSpecifyTitle = specifyTitle;
        }
    }
    if (TextUtils.isEmpty(this.mUrl)) {
        return false;
    }
    LogUtil.d(TAG, "LOAD URL : " + this.mUrl);
    return true;
}
 
Example #15
Source File: WeiboParameters.java    From letv with Apache License 2.0 6 votes vote down vote up
public String encodeUrl() {
    StringBuilder sb = new StringBuilder();
    boolean first = true;
    for (String key : this.mParams.keySet()) {
        if (first) {
            first = false;
        } else {
            sb.append("&");
        }
        String value = this.mParams.get(key);
        if (value instanceof String) {
            String param = value;
            if (!TextUtils.isEmpty(param)) {
                try {
                    sb.append(URLEncoder.encode(key, "UTF-8") + SearchCriteria.EQ + URLEncoder.encode(param, "UTF-8"));
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                }
            }
            LogUtil.i("encodeUrl", sb.toString());
        }
    }
    return sb.toString();
}
 
Example #16
Source File: AbsOpenAPI.java    From ESSocialSDK with Apache License 2.0 5 votes vote down vote up
/**
 */
protected String requestSync(String url, WeiboParameters params, String httpMethod) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)) {
        LogUtil.e(TAG, "Argument error!");
        return "";
    }

    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    return new AsyncWeiboRunner(mContext).request(url, params, httpMethod);
}
 
Example #17
Source File: BaseMediaObject.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
protected boolean checkArgs()
{
    if (actionUrl == null || actionUrl.length() > 512)
    {
        LogUtil.e("Weibo.BaseMediaObject", "checkArgs fail, actionUrl is invalid");
        return false;
    }
    if (identify == null || identify.length() > 512)
    {
        LogUtil.e("Weibo.BaseMediaObject", "checkArgs fail, identify is invalid");
        return false;
    }
    if (thumbData == null || thumbData.length > 32768)
    {
        LogUtil.e("Weibo.BaseMediaObject", (new StringBuilder("checkArgs fail, thumbData is invalid,size is ")).append(thumbData.length).append("! more then 32768.").toString());
        return false;
    }
    if (title == null || title.length() > 512)
    {
        LogUtil.e("Weibo.BaseMediaObject", "checkArgs fail, title is invalid");
        return false;
    }
    if (description == null || description.length() > 1024)
    {
        LogUtil.e("Weibo.BaseMediaObject", "checkArgs fail, description is invalid");
        return false;
    } else
    {
        return true;
    }
}
 
Example #18
Source File: TextObject.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public boolean checkArgs()
{
    if (text == null || text.length() == 0 || text.length() > 1024)
    {
        LogUtil.e("Weibo.TextObject", "checkArgs fail, text is invalid");
        return false;
    } else
    {
        return true;
    }
}
 
Example #19
Source File: WeiboAuth.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private void startDialog(WeiboAuthListener weiboauthlistener, int i)
{
    if (weiboauthlistener == null)
    {
        return;
    }
    LinkedHashMap linkedhashmap = new LinkedHashMap();
    linkedhashmap.put("client_id", mAuthInfo.mAppKey);
    linkedhashmap.put("redirect_uri", mAuthInfo.mRedirectUrl);
    linkedhashmap.put("scope", mAuthInfo.mScope);
    linkedhashmap.put("response_type", "code");
    linkedhashmap.put("display", "mobile");
    if (1 == i)
    {
        linkedhashmap.put("packagename", mAuthInfo.mPackageName);
        linkedhashmap.put("key_hash", mAuthInfo.mKeyHash);
    }
    String s = (new StringBuilder("https://open.weibo.cn/oauth2/authorize?")).append(Utility.packUrl(linkedhashmap)).toString();
    if (!NetworkHelper.hasInternetPermission(mContext))
    {
        UIUtils.showAlert(mContext, "Error", "Application requires permission to access the Internet");
        return;
    }
    if (NetworkHelper.isNetworkAvailable(mContext))
    {
        (new WeiboDialog(mContext, s, weiboauthlistener, this)).show();
        return;
    } else
    {
        String s1 = ResourceManager.getString(mContext, 2);
        LogUtil.i("Weibo_web_login", (new StringBuilder("String: ")).append(s1).toString());
        UIUtils.showToast(mContext, s1, 0);
        return;
    }
}
 
Example #20
Source File: WeiboShareAPIImpl.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public boolean handleWeiboResponse(Intent intent, IWeiboHandler.Response response)
{
    String s = intent.getStringExtra("_weibo_appPackage");
    if (s == null)
    {
        LogUtil.e("WeiboApiImpl", "responseListener() faild appPackage is null");
        return false;
    }
    if (!(response instanceof Activity))
    {
        LogUtil.e("WeiboApiImpl", "responseListener() faild handler is not Activity");
        return false;
    }
    String s1 = ((Activity)response).getCallingPackage();
    LogUtil.d("WeiboApiImpl", (new StringBuilder("responseListener() callPkg : ")).append(s1).toString());
    if (intent.getStringExtra("_weibo_transaction") == null)
    {
        LogUtil.e("WeiboApiImpl", "responseListener() faild intent TRAN is null");
        return false;
    }
    if (!ApiUtils.validateWeiboSign(mContext, s))
    {
        LogUtil.e("WeiboApiImpl", "responseListener() faild appPackage validateSign faild");
        return false;
    } else
    {
        response.onResponse(new SendMessageToWeiboResponse(intent.getExtras()));
        return true;
    }
}
 
Example #21
Source File: WeiboShareAPIImpl.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public boolean handleWeiboRequest(Intent intent, IWeiboHandler.Request request)
{
    if (intent == null || request == null)
    {
        return false;
    }
    String s = intent.getStringExtra("_weibo_appPackage");
    String s1 = intent.getStringExtra("_weibo_transaction");
    if (s == null)
    {
        LogUtil.e("WeiboApiImpl", "requestListener() faild appPackage validateSign faild");
        request.onRequest(null);
        return false;
    }
    if (s1 == null)
    {
        LogUtil.e("WeiboApiImpl", "requestListener() faild intent TRAN is null");
        request.onRequest(null);
        return false;
    }
    if (!ApiUtils.validateWeiboSign(mContext, s))
    {
        LogUtil.e("WeiboApiImpl", "requestListener() faild appPackage validateSign faild");
        request.onRequest(null);
        return false;
    } else
    {
        request.onRequest(new ProvideMessageForWeiboRequest(intent.getExtras()));
        return true;
    }
}
 
Example #22
Source File: WeiboShareAPIImpl.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private boolean shareWithWeibo(Activity activity, String s, String s1, String s2, Bundle bundle)
{
    if (activity == null || TextUtils.isEmpty(s) || TextUtils.isEmpty(s1) || TextUtils.isEmpty(s2))
    {
        LogUtil.e("ActivityHandler", "send fail, invalid arguments");
        return false;
    }
    Intent intent = new Intent();
    intent.setPackage(s1);
    intent.setAction(s);
    String s3 = activity.getPackageName();
    intent.putExtra("_weibo_sdkVersion", 22);
    intent.putExtra("_weibo_appPackage", s3);
    intent.putExtra("_weibo_appKey", s2);
    intent.putExtra("_weibo_flag", 0x20130329);
    intent.putExtra("_weibo_sign", MD5.hexdigest(Utility.getSign(activity, s3)));
    if (bundle != null)
    {
        intent.putExtras(bundle);
    }
    try
    {
        LogUtil.d("WeiboApiImpl", (new StringBuilder("intent=")).append(intent).append(", extra=").append(intent.getExtras()).toString());
        activity.startActivityForResult(intent, 765);
    }
    catch (ActivityNotFoundException activitynotfoundexception)
    {
        LogUtil.e("WeiboApiImpl", "Failed, target ActivityNotFound");
        return false;
    }
    return true;
}
 
Example #23
Source File: WeiboShareProxy.java    From ESSocialSDK with Apache License 2.0 5 votes vote down vote up
public static IWeiboShareAPI getInstance(Context context, String appKey) {
    LogUtil.enableLog();
    if (null == api) {
        api = WeiboShareSDK.createWeiboAPI(context, appKey);
        api.registerApp();
    }

    return api;
}
 
Example #24
Source File: AbsOpenAPI.java    From ESSocialSDK with Apache License 2.0 5 votes vote down vote up
/**
 */
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)
            || null == listener) {
        LogUtil.e(TAG, "Argument error!");
        return;
    }

    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener);
}
 
Example #25
Source File: InviteAPI.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
/**
 * 向好友发送邀请。支持登录用户向自己的微博互粉好友发送私信邀请、礼物。
 * 
 * @param uid      被邀请人的 Uid,需要为当前用户互粉好友
 * @param jsonData 邀请数据。以 {@link JSONObject} 数据填充
 * @param listener 邀请接口对应的回调
 */
public void sendInvite(String uid, JSONObject jsonData, RequestListener listener) {
    if (!TextUtils.isEmpty(uid) 
            && jsonData != null 
            && !TextUtils.isEmpty(jsonData.toString())) {
        
        WeiboParameters params = new WeiboParameters(mAppKey);
        params.put("uid", uid);
        params.put("data", jsonData.toString());
        requestAsync(INVITE_URL, params, HTTPMETHOD_POST, listener);
    } else {
        LogUtil.d(TAG, "Invite args error!");
    }
}
 
Example #26
Source File: AbsOpenAPI.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 异步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * @param listener   请求后的回调接口
 */
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)
            || null == listener) {
        LogUtil.e(TAG, "Argument error!");
        return;
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener);
}
 
Example #27
Source File: AbsOpenAPI.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 异步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * @param listener   请求后的回调接口
 */
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)
            || null == listener) {
        LogUtil.e(TAG, "Argument error!");
        return;
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener);
}
 
Example #28
Source File: AbsOpenAPI.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 同步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * 
 * @return 同步请求后,服务器返回的字符串。
 */
protected String requestSync(String url, WeiboParameters params, String httpMethod) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)) {
        LogUtil.e(TAG, "Argument error!");
        return "";
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    return new AsyncWeiboRunner(mContext).request(url, params, httpMethod);
}
 
Example #29
Source File: WeiboSdkBrowser.java    From letv with Apache License 2.0 5 votes vote down vote up
private void startShare() {
    LogUtil.d(TAG, "Enter startShare()............");
    final ShareRequestParam req = this.mRequestParam;
    if (req.hasImage()) {
        LogUtil.d(TAG, "loadUrl hasImage............");
        new AsyncWeiboRunner(this).requestAsync(ShareRequestParam.UPLOAD_PIC_URL, req.buildUploadPicParam(new WeiboParameters(req.getAppKey())), "POST", new RequestListener() {
            public void onWeiboException(WeiboException e) {
                LogUtil.d(WeiboSdkBrowser.TAG, "post onWeiboException " + e.getMessage());
                req.sendSdkErrorResponse(WeiboSdkBrowser.this, e.getMessage());
                WeiboSdkBrowser.this.finish();
            }

            public void onComplete(String response) {
                LogUtil.d(WeiboSdkBrowser.TAG, "post onComplete : " + response);
                UploadPicResult result = UploadPicResult.parse(response);
                if (result == null || result.getCode() != 1 || TextUtils.isEmpty(result.getPicId())) {
                    req.sendSdkErrorResponse(WeiboSdkBrowser.this, "upload pic faild");
                    WeiboSdkBrowser.this.finish();
                    return;
                }
                WeiboSdkBrowser.this.openUrl(req.buildUrl(result.getPicId()));
            }
        });
        return;
    }
    openUrl(this.mUrl);
}
 
Example #30
Source File: WeiboSdkBrowser.java    From letv with Apache License 2.0 5 votes vote down vote up
public void onPageStartedCallBack(WebView view, String url, Bitmap favicon) {
    LogUtil.d(TAG, "onPageStarted URL: " + url);
    this.mUrl = url;
    if (!isWeiboCustomScheme(url)) {
        this.mHtmlTitle = "";
    }
}