当前位置: 首页>>代码示例>>Java>>正文


Java Utility类代码示例

本文整理汇总了Java中com.sina.weibo.sdk.utils.Utility的典型用法代码示例。如果您正苦于以下问题:Java Utility类的具体用法?Java Utility怎么用?Java Utility使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Utility类属于com.sina.weibo.sdk.utils包,在下文中一共展示了Utility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildUrl

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
public String buildUrl(String picid) {
    Builder builder = Uri.parse(SHARE_URL).buildUpon();
    builder.appendQueryParameter("title", this.mShareContent);
    builder.appendQueryParameter("version", "0031105000");
    if (!TextUtils.isEmpty(this.mAppKey)) {
        builder.appendQueryParameter("source", this.mAppKey);
    }
    if (!TextUtils.isEmpty(this.mToken)) {
        builder.appendQueryParameter("access_token", this.mToken);
    }
    String aid = Utility.getAid(this.mContext, this.mAppKey);
    if (!TextUtils.isEmpty(aid)) {
        builder.appendQueryParameter("aid", aid);
    }
    if (!TextUtils.isEmpty(this.mAppPackage)) {
        builder.appendQueryParameter(REQ_PARAM_PACKAGENAME, this.mAppPackage);
    }
    if (!TextUtils.isEmpty(this.mHashKey)) {
        builder.appendQueryParameter(REQ_PARAM_KEY_HASH, this.mHashKey);
    }
    if (!TextUtils.isEmpty(picid)) {
        builder.appendQueryParameter(REQ_PARAM_PICINFO, picid);
    }
    return builder.build().toString();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:26,代码来源:ShareRequestParam.java

示例2: getMusicObj

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
/**
 * 创建多媒体(音乐)消息对象。
 *
 * @return 多媒体(音乐)消息对象。
 */
private MusicObject getMusicObj(ShareContent shareContent) {
    // 创建媒体消息
    MusicObject musicObject = new MusicObject();
    musicObject.identify = Utility.generateGUID();
    musicObject.title = shareContent.getTitle();
    musicObject.description = shareContent.getContent();

    // 设置 Bitmap 类型的图片到视频对象里
    Bitmap bmp = BitmapFactory.decodeFile(shareContent.getImageUrl());
    musicObject.setThumbImage(bmp);
    musicObject.actionUrl = shareContent.getURL();
    musicObject.dataUrl = REDIRECT_URL;
    musicObject.dataHdUrl = REDIRECT_URL;
    musicObject.duration = 10;
    musicObject.defaultText = shareContent.getContent();
    return musicObject;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:WeiboShareManager.java

示例3: getMusicObj

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
/**
 * 创建多媒体(音乐)消息对象。
 * 
 * @return 多媒体(音乐)消息对象。
 */
private MusicObject getMusicObj() {
    // 创建媒体消息
    MusicObject musicObject = new MusicObject();
    musicObject.identify = Utility.generateGUID();
    musicObject.title = mShareMusicView.getTitle();
    musicObject.description = mShareMusicView.getShareDesc();
    
    Bitmap  bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_logo);
    

    
    // 设置 Bitmap 类型的图片到视频对象里        设置缩略图。 注意:最终压缩过的缩略图大小不得超过 32kb。
    musicObject.setThumbImage(bitmap);
    musicObject.actionUrl = mShareMusicView.getShareUrl();
    musicObject.dataUrl = "www.weibo.com";
    musicObject.dataHdUrl = "www.weibo.com";
    musicObject.duration = 10;
    musicObject.defaultText = "Music 默认文案";
    return musicObject;
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:26,代码来源:WBShareActivity.java

示例4: getVoiceObj

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
/**
 * 创建多媒体(音频)消息对象。
 * 
 * @return 多媒体(音乐)消息对象。
 */
private VoiceObject getVoiceObj() {
    // 创建媒体消息
    VoiceObject voiceObject = new VoiceObject();
    voiceObject.identify = Utility.generateGUID();
    voiceObject.title = mShareVoiceView.getTitle();
    voiceObject.description = mShareVoiceView.getShareDesc();
    Bitmap  bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_logo);
    // 设置 Bitmap 类型的图片到视频对象里      设置缩略图。 注意:最终压缩过的缩略图大小不得超过 32kb。
    voiceObject.setThumbImage(bitmap);
    voiceObject.actionUrl = mShareVoiceView.getShareUrl();
    voiceObject.dataUrl = "www.weibo.com";
    voiceObject.dataHdUrl = "www.weibo.com";
    voiceObject.duration = 10;
    voiceObject.defaultText = "Voice 默认文案";
    return voiceObject;
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:22,代码来源:WBShareActivity.java

示例5: getMusicObj

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
/**
 * 创建多媒体(音乐)消息对象。
 * 
 * @return 多媒体(音乐)消息对象。
 */
private MusicObject getMusicObj() {
    // 创建媒体消息
    MusicObject musicObject = new MusicObject();
    musicObject.identify = Utility.generateGUID();
    musicObject.title = mShareMusicView.getTitle();
    musicObject.description = mShareMusicView.getShareDesc();
    
    // 设置 Bitmap 类型的图片到视频对象里
    musicObject.setThumbImage(mShareMusicView.getThumbBitmap());
    musicObject.actionUrl = mShareMusicView.getShareUrl();
    musicObject.dataUrl = "www.weibo.com";
    musicObject.dataHdUrl = "www.weibo.com";
    musicObject.duration = 10;
    musicObject.defaultText = "Music 默认文案";
    return musicObject;
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:22,代码来源:WBShareResponseActivity.java

示例6: getVideoObj

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
/**
 * 创建多媒体(视频)消息对象。
 * 
 * @return 多媒体(视频)消息对象。
 */
private VideoObject getVideoObj() {
    // 创建媒体消息
    VideoObject videoObject = new VideoObject();
    videoObject.identify = Utility.generateGUID();
    videoObject.title = mShareVideoView.getTitle();
    videoObject.description = mShareVideoView.getShareDesc();
    
    // 设置 Bitmap 类型的图片到视频对象里
    videoObject.setThumbImage(mShareVideoView.getThumbBitmap());
    videoObject.actionUrl = mShareVideoView.getShareUrl();
    videoObject.dataUrl = "www.weibo.com";
    videoObject.dataHdUrl = "www.weibo.com";
    videoObject.duration = 10;
    videoObject.defaultText = "Vedio 默认文案";
    return videoObject;
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:22,代码来源:WBShareResponseActivity.java

示例7: getVoiceObj

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
/**
 * 创建多媒体(音频)消息对象。
 * 
 * @return 多媒体(音乐)消息对象。
 */
private VoiceObject getVoiceObj() {
    // 创建媒体消息
    VoiceObject voiceObject = new VoiceObject();
    voiceObject.identify = Utility.generateGUID();
    voiceObject.title = mShareVoiceView.getTitle();
    voiceObject.description = mShareVoiceView.getShareDesc();
    
    // 设置 Bitmap 类型的图片到视频对象里
    voiceObject.setThumbImage(mShareVoiceView.getThumbBitmap());
    voiceObject.actionUrl = mShareVoiceView.getShareUrl();
    voiceObject.dataUrl = "www.weibo.com";
    voiceObject.dataHdUrl = "www.weibo.com";
    voiceObject.duration = 10;
    voiceObject.defaultText = "Voice 默认文案";
    return voiceObject;
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:22,代码来源:WBShareResponseActivity.java

示例8: startSingleSignOn

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
private boolean startSingleSignOn(String ssoPackageName, String ssoActivityName) {
    boolean bSucceed = true;
    Intent intent = new Intent();
    intent.setClassName(ssoPackageName, ssoActivityName);
    intent.putExtras(this.mWebAuthHandler.getAuthInfo().getAuthBundle());
    intent.putExtra("_weibo_command_type", 3);
    intent.putExtra("_weibo_transaction", String.valueOf(System.currentTimeMillis()));
    intent.putExtra("aid", Utility.getAid(this.mAuthActivity, this.mAuthInfo.getAppKey()));
    if (!SecurityHelper.validateAppSignatureForIntent(this.mAuthActivity, intent)) {
        return false;
    }
    String aid = Utility.getAid(this.mAuthActivity, this.mAuthInfo.getAppKey());
    if (!TextUtils.isEmpty(aid)) {
        intent.putExtra("aid", aid);
    }
    try {
        this.mAuthActivity.startActivityForResult(intent, this.mSSOAuthRequestCode);
    } catch (ActivityNotFoundException e) {
        bSucceed = false;
    }
    return bSucceed;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:23,代码来源:SsoHandler.java

示例9: shouldOverrideUrlLoading

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (this.mCallBack != null) {
        this.mCallBack.shouldOverrideUrlLoadingCallBack(view, url);
    }
    boolean needClose = url.startsWith(WeiboSdkBrowser.BROWSER_CLOSE_SCHEME);
    if (!url.startsWith(WeiboSdkBrowser.BROWSER_CLOSE_SCHEME) && !url.startsWith(WeiboSdkBrowser.BROWSER_WIDGET_SCHEME)) {
        return super.shouldOverrideUrlLoading(view, url);
    }
    Bundle bundle = Utility.parseUri(url);
    if (!(bundle.isEmpty() || this.mListener == null)) {
        this.mListener.onComplete(bundle);
    }
    if (this.mWidgetCallback != null) {
        this.mWidgetCallback.onWebViewResult(url);
    }
    if (needClose) {
        WeiboSdkBrowser.closeBrowser(this.mAct, this.mWidgetRequestParam.getAuthListenerKey(), this.mWidgetRequestParam.getWidgetRequestCallbackKey());
    }
    return true;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:21,代码来源:WidgetWeiboWebViewClient.java

示例10: shouldOverrideUrlLoading

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (this.mCallBack != null) {
        this.mCallBack.shouldOverrideUrlLoadingCallBack(view, url);
    }
    if (!url.startsWith(WeiboSdkBrowser.BROWSER_CLOSE_SCHEME)) {
        return super.shouldOverrideUrlLoading(view, url);
    }
    Bundle bundle = Utility.parseUri(url);
    if (!(bundle.isEmpty() || this.mListener == null)) {
        this.mListener.onComplete(bundle);
    }
    String errCode = bundle.getString("code");
    String errMsg = bundle.getString("msg");
    if (TextUtils.isEmpty(errCode)) {
        this.mShareRequestParam.sendSdkCancleResponse(this.mAct);
    } else if ("0".equals(errCode)) {
        this.mShareRequestParam.sendSdkOkResponse(this.mAct);
    } else {
        this.mShareRequestParam.sendSdkErrorResponse(this.mAct, errMsg);
    }
    WeiboSdkBrowser.closeBrowser(this.mAct, this.mShareRequestParam.getAuthListenerKey(), null);
    return true;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:24,代码来源:ShareWeiboWebViewClient.java

示例11: onCreateRequestParamBundle

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
public void onCreateRequestParamBundle(Bundle data) {
    this.mAppPackage = this.mContext.getPackageName();
    if (!TextUtils.isEmpty(this.mAppPackage)) {
        this.mHashKey = MD5.hexdigest(Utility.getSign(this.mContext, this.mAppPackage));
    }
    data.putString("access_token", this.mToken);
    data.putString("source", this.mAppKey);
    data.putString(ShareRequestParam.REQ_PARAM_PACKAGENAME, this.mAppPackage);
    data.putString(ShareRequestParam.REQ_PARAM_KEY_HASH, this.mHashKey);
    data.putString(REQ_PARAM_ATTENTION_FUID, this.mAttentionFuid);
    data.putString(REQ_PARAM_COMMENT_TOPIC, this.mCommentTopic);
    data.putString(REQ_PARAM_COMMENT_CONTENT, this.mCommentContent);
    data.putString(REQ_PARAM_COMMENT_CATEGORY, this.mCommentCategory);
    WeiboCallbackManager manager = WeiboCallbackManager.getInstance(this.mContext);
    if (this.mAuthListener != null) {
        this.mAuthListenerKey = manager.genCallbackKey();
        manager.setWeiboAuthListener(this.mAuthListenerKey, this.mAuthListener);
        data.putString(AuthRequestParam.EXTRA_KEY_LISTENER, this.mAuthListenerKey);
    }
    if (this.mWidgetRequestCallback != null) {
        this.mWidgetRequestCallbackKey = manager.genCallbackKey();
        manager.setWidgetRequestCallback(this.mWidgetRequestCallbackKey, this.mWidgetRequestCallback);
        data.putString(EXTRA_KEY_WIDGET_CALLBACK, this.mWidgetRequestCallbackKey);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:26,代码来源:WidgetRequestParam.java

示例12: onCreateRequestParamBundle

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
public void onCreateRequestParamBundle(Bundle data) {
    if (this.mBaseRequest != null) {
        this.mBaseRequest.toBundle(data);
    }
    if (!TextUtils.isEmpty(this.mAppPackage)) {
        this.mHashKey = MD5.hexdigest(Utility.getSign(this.mContext, this.mAppPackage));
    }
    data.putString("access_token", this.mToken);
    data.putString("source", this.mAppKey);
    data.putString(REQ_PARAM_PACKAGENAME, this.mAppPackage);
    data.putString(REQ_PARAM_KEY_HASH, this.mHashKey);
    data.putString("_weibo_appPackage", this.mAppPackage);
    data.putString("_weibo_appKey", this.mAppKey);
    data.putInt("_weibo_flag", 538116905);
    data.putString("_weibo_sign", this.mHashKey);
    if (this.mAuthListener != null) {
        WeiboCallbackManager manager = WeiboCallbackManager.getInstance(this.mContext);
        this.mAuthListenerKey = manager.genCallbackKey();
        manager.setWeiboAuthListener(this.mAuthListenerKey, this.mAuthListener);
        data.putString(AuthRequestParam.EXTRA_KEY_LISTENER, this.mAuthListenerKey);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:23,代码来源:ShareRequestParam.java

示例13: initWebView

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
@SuppressLint({"SetJavaScriptEnabled"})
private void initWebView() {
    this.mWebView.getSettings().setJavaScriptEnabled(true);
    if (isWeiboShareRequestParam(this.mRequestParam)) {
        this.mWebView.getSettings().setUserAgentString(Utility.generateUA(this));
    }
    this.mWebView.getSettings().setSavePassword(false);
    this.mWebView.setWebViewClient(this.mWeiboWebViewClient);
    this.mWebView.setWebChromeClient(new WeiboChromeClient());
    this.mWebView.requestFocus();
    this.mWebView.setScrollBarStyle(0);
    if (VERSION.SDK_INT >= 11) {
        this.mWebView.removeJavascriptInterface("searchBoxJavaBridge_");
    } else {
        removeJavascriptInterface(this.mWebView);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:18,代码来源:WeiboSdkBrowser.java

示例14: b

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
private BaseMediaObject b() {
    WebpageObject webpageObject = new WebpageObject();
    webpageObject.identify = Utility.generateGUID();
    webpageObject.title = f.getTitle();
    webpageObject.description = f.getText();
    try {
        this.b = 32768;
        if (f.getImageData() != null) {
            webpageObject.setThumbImage(a((Context) this, f.getImageData()));
        } else if (!TextUtils.isEmpty(f.getImagePath())) {
            webpageObject.setThumbImage(a((Context) this, f.getImagePath()));
        }
    } catch (Throwable th) {
        Ln.e(th);
        webpageObject.setThumbImage(null);
    }
    webpageObject.actionUrl = f.getUrl();
    webpageObject.defaultText = f.getText();
    return webpageObject;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:SinaActivity.java

示例15: getWebpageObj

import com.sina.weibo.sdk.utils.Utility; //导入依赖的package包/类
/**
 * 创建多媒体(网页)消息对象。
 *
 * @return 多媒体(网页)消息对象。
 */
private WebpageObject getWebpageObj(ShareInfo info) {
    WebpageObject mediaObject = new WebpageObject();
    mediaObject.identify = Utility.generateGUID();

    mediaObject.title = info.mTitle != null ? info.mTitle : "";
    mediaObject.description = info.mContent != null ? info.mContent : "";

    Bitmap thumbBitmap = null;
    if (info.mThumbResId > 0)
        thumbBitmap = BitmapFactory.decodeResource(getContext().getResources(), info.mThumbResId);
    else
        thumbBitmap = info.mThumbBmp;
    // 设置缩略图。 注意:最终压缩过的缩略图大小不得超过 32kb。
    if (thumbBitmap != null)
        mediaObject.setThumbImage(thumbBitmap);

    mediaObject.actionUrl = info.mUrl;
    String dt = !TextUtils.isEmpty(mediaObject.description) ? mediaObject.description : mediaObject.title;
    mediaObject.defaultText = dt;
    return mediaObject;
}
 
开发者ID:markzhai,项目名称:AndroidProjectFrom0,代码行数:27,代码来源:WeiboSharePlugin.java


注:本文中的com.sina.weibo.sdk.utils.Utility类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。