Java Code Examples for com.sina.weibo.sdk.utils.LogUtil#e()

The following examples show how to use com.sina.weibo.sdk.utils.LogUtil#e() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
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 8
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 9
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 10
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 11
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 12
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 13
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 14
Source File: AbsOpenAPI.java    From QiQuYing 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 15
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 16
Source File: AbsOpenAPI.java    From Simpler 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 17
Source File: AbsOpenAPI.java    From Simpler 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 18
Source File: WeiboSdkBrowser.java    From letv with Apache License 2.0 5 votes vote down vote up
public void removeJavascriptInterface(WebView webView) {
    if (VERSION.SDK_INT < 11) {
        try {
            webView.getClass().getDeclaredMethod("removeJavascriptInterface", new Class[0]).invoke("searchBoxJavaBridge_", new Object[0]);
        } catch (Exception e) {
            LogUtil.e(TAG, e.toString());
        }
    }
}
 
Example 19
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 20
Source File: ImageObject.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public boolean checkArgs()
    {
label0:
        {
            if (imageData == null && imagePath == null)
            {
                LogUtil.e("Weibo.ImageObject", "imageData and imagePath are null");
                return false;
            }
            if (imageData != null && imageData.length > 0x200000)
            {
                LogUtil.e("Weibo.ImageObject", "imageData is too large");
                return false;
            }
            if (imagePath != null && imagePath.length() > 512)
            {
                LogUtil.e("Weibo.ImageObject", "imagePath is too length");
                return false;
            }
            if (imagePath == null)
            {
                break label0;
            }
            File file = new File(imagePath);
            try
            {
                if (file.exists() && file.length() != 0L && file.length() <= 0xa00000L)
                {
                    break label0;
                }
                LogUtil.e("Weibo.ImageObject", "checkArgs fail, image content is too large or not exists");
            }
            catch (SecurityException securityexception)
            {
                LogUtil.e("Weibo.ImageObject", "checkArgs fail, image content is too large or not exists");
                return false;
            }
            return false;
        }
        return true;
    }