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


Java TextObject类代码示例

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


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

示例1: createMessage

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
@Override
protected WeiboMultiMessage createMessage() {
	WeiboMultiMessage message = new WeiboMultiMessage();
	TextObject object = new TextObject();
	object.text = getShareParams().getContent();
	object.title = getShareParams().getTitle();
	message.textObject = object;
	return message;
}
 
开发者ID:Joy-Whale,项目名称:EasyShare,代码行数:10,代码来源:SinaWeiboShareTextMessage.java

示例2: shareToWeibo

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
public static void shareToWeibo(String transaction, Activity activity, String title, String summary, Bitmap img) {
    ImageObject imageObject = new ImageObject();
    imageObject.imageData = bmpToByteArray(img);

    TextObject textObject = new TextObject();
    textObject.text = title + "\n" + summary + Constants.SUMMARY;

    WeiboMultiMessage message = new WeiboMultiMessage();
    message.textObject = textObject;
    message.imageObject = imageObject;

    SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
    request.transaction = transaction;
    request.multiMessage = message;

    AuthInfo authInfo = new AuthInfo(activity, Constants.WB_APP_ID, Constants.WB_REDIRECT_URL, Constants.WB_SCOPE);
    Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(APP_CONTEXT);
    String token = "";
    if (accessToken != null) {
        token = accessToken.getToken();
    }
    IWeiboShareAPI api = getWbApi();
    api.sendRequest(activity, request, authInfo, token, weiboAuthListener);
}
 
开发者ID:qiujuer,项目名称:UPMiss,代码行数:25,代码来源:Share.java

示例3: share

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
/**
 * 分享文章到新浪微博
 * 
 * @param title
 * @param url
 */
public void share(Activity activity, String title, String url) {
    WeiboMultiMessage weiboMessage = new WeiboMultiMessage();// 初始化微博的分享消息
    TextObject textObject = new TextObject();
    textObject.text = "《" + title + "》" + "这篇文章不错, 文章地址 : " + url
            + "。本文来自: 开发技术前线, http://www.devtf.cn 。";
    weiboMessage.textObject = textObject;
    ImageObject imageObject = new ImageObject();
    imageObject.setImageObject(BitmapFactory.decodeResource(activity.getResources(),
            R.drawable.ic_launcher));
    weiboMessage.imageObject = imageObject;
    SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
    request.transaction = String.valueOf(System.currentTimeMillis());
    request.multiMessage = weiboMessage;
    mWeiboShareAPI.sendRequest(activity, request); // 发送请求消息到微博,唤起微博分享界面
}
 
开发者ID:hehonghui,项目名称:the-tech-frontier-app,代码行数:22,代码来源:SharePresenter.java

示例4: sendText

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
public void sendText(String text) throws MalformedURLException, IOException {
	// String text = getData(json, "text");
	// String image_path = getData(json, "image");
	Log.d(TAG, "app key : " + appKey);
	mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(
			this.cordova.getActivity(), appKey);
	mWeiboShareAPI.registerApp(); // 将应用注册到微博客户端
	WeiboMultiMessage weiboMessage = new WeiboMultiMessage();// 初始化微博的分享消息
	if (text != null) {
		TextObject textObject = new TextObject();
		textObject.text = text;
		weiboMessage.textObject = textObject;
	}
	SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
	request.transaction = String.valueOf(System.currentTimeMillis());
	request.multiMessage = weiboMessage;
	mWeiboShareAPI.sendRequest(this.cordova.getActivity(), request); // 发送请求消息到微博,唤起微博分享界面
}
 
开发者ID:mrichie,项目名称:pg-weibo,代码行数:19,代码来源:QyWeibo.java

示例5: shareText

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
@Override
public void shareText(int platform, String text, Activity activity, ShareListener listener) {
    TextObject textObject = new TextObject();
    textObject.text = text;
    WeiboMultiMessage message = new WeiboMultiMessage();
    message.textObject = textObject;

    sendRequest(activity, message);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:WeiboShareInstance.java

示例6: shareTo

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
private static void shareTo(final Context context, final String appKey, final String redirectUrl, final String scop, final String title, final String desc,
                            final String imageUrl, final String shareUrl, final WeiboAuthListener listener) {
    new Thread(new Runnable() {
        @Override
        public void run() {
            WeiboMultiMessage msg = new WeiboMultiMessage();
            TextObject text = new TextObject();
            text.text = desc;
            msg.textObject = text;
            WebpageObject web = new WebpageObject();
            web.description = desc;
            byte[] thumb = SocialUtils.getHtmlByteArray(imageUrl);
            if (null != thumb)
                web.thumbData = SocialUtils.compressBitmap(thumb, 32);
            else
                web.thumbData = SocialUtils.compressBitmap(SocialUtils.getDefaultShareImage(context), 32);
            web.actionUrl = shareUrl;
            web.identify = imageUrl;
            web.title = title;
            msg.mediaObject = web;

            SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
            request.transaction = String.valueOf(System.currentTimeMillis());
            request.multiMessage = msg;

            AuthInfo authInfo = new AuthInfo(context, appKey, redirectUrl, scop);
            Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(context);
            String token = "";
            if (accessToken != null) {
                token = accessToken.getToken();
            }
            getInstance(context, appKey).sendRequest((Activity) context, request, authInfo, token, listener);
        }
    }).start();

}
 
开发者ID:yangjie127,项目名称:ESSocialSDK-master,代码行数:37,代码来源:WeiboShareProxy.java

示例7: shareText

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
/**
 * 文本分享
 *
 * @param content
 * @param activity
 */
public void shareText(WeiboSKShareContent content, Activity activity) {
    TextObject textObject = new TextObject();
    textObject.text = content.content;
    textObject.title = content.title;
    textObject.actionUrl = content.url;
    textObject.identify = Utility.generateGUID();
    send(textObject, activity);
}
 
开发者ID:jhwing,项目名称:SKShare,代码行数:15,代码来源:WeiboShare.java

示例8: getTextObj

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
/**
 * 创建文本消息对象。
 *
 * @return 文本消息对象。
 */
private TextObject getTextObj(ShareInfo info) {
    TextObject textObject = new TextObject();

    textObject.text = info.mContent;
    return textObject;
}
 
开发者ID:markzhai,项目名称:AndroidProjectFrom0,代码行数:12,代码来源:WeiboSharePlugin.java

示例9: shareSongtoWeibo

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
private void shareSongtoWeibo() {
    TextObject textObject = new TextObject();
    textObject.text = "推荐一首好歌:" + mInfo.getArtist() +
            "的《" + mInfo.getTitle() + "》," + " 来自@" + getResources().getString(R.string.app_name) + "安卓客户端";
    WeiboMultiMessage msg = new WeiboMultiMessage();
    msg.textObject  = textObject;
    SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
    request.transaction = String.valueOf(System.currentTimeMillis());
    request.multiMessage = msg;
    mWeiboApi.sendRequest(ShareDialog.this, request);
}
 
开发者ID:rRemix,项目名称:APlayer,代码行数:12,代码来源:ShareDialog.java

示例10: getTextObj

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
/**
 * 创建文本消息对象。
 *
 * @return 文本消息对象。
 */
private TextObject getTextObj(BaseShareParam params) {
    TextObject textObject = new TextObject();

    if (params != null) {
        textObject.title = params.getTitle();
        textObject.text = params.getContent();
        textObject.actionUrl = params.getTargetUrl();
        if (!TextUtils.isEmpty(textObject.actionUrl)) {
            textObject.text = String.format("%s %s", textObject.text, textObject.actionUrl);
        }
    }

    return textObject;
}
 
开发者ID:Bilibili,项目名称:BiliShare,代码行数:20,代码来源:SinaShareHandler.java

示例11: shareToWeibo

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
public static void shareToWeibo(Activity activity, MQuestion question) {
	sWeiboApi = WeiboShareSDK.createWeiboAPI(activity, AppConfig.WeiboAppKey);
	
	if (!sWeiboApi.isWeiboAppInstalled()) {
		ToastUtils.show(R.string.share_weibo_not_installed);
		return;
	}
	
	if (!sWeiboApi.isWeiboAppSupportAPI()) {
		ToastUtils.show(R.string.share_weibo_not_support_api);
		return;
	}
	
	sWeiboApi.registerApp();

	String text = UIUtils.getString(R.string.share_weibo, AppConfig.App_Weibo_Nickname, AppConfig.App_Website_Official);
	int length = 140 - text.length(); // 剩余字数
	int descLength = question.description.length();
	String questionTitle = descLength <= length ? question.description : question.description.substring(0, length - 1).concat("…");

	TextObject textObject = new TextObject();
	textObject.text = questionTitle + text;

	WeiboMultiMessage weiboMessage = new WeiboMultiMessage();
	weiboMessage.textObject = textObject;

	SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
	request.transaction = String.valueOf(System.currentTimeMillis());
	request.multiMessage = weiboMessage;

	sWeiboApi.sendRequest(request);
}
 
开发者ID:fengyanjava,项目名称:msb-android,代码行数:33,代码来源:ShareApis.java

示例12: onClickSinaShare

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
private void onClickSinaShare(){
    if(!AppInstallUtil.isWeiBoInstalled(getActivity())){
        Snackbar.with(getActivity()) // context
                .colorResource(R.color.app_main_theme_color_transparent)
                .duration(Snackbar.SnackbarDuration.LENGTH_SHORT)
                .text("请先安装新浪微博客户端") // text to display
                .show(getActivity());
        return;
    }else {
        Oauth2AccessToken mAccessToken = AccessTokenKeeper.readAccessToken(getActivity());
        if (!mAccessToken.isSessionValid()) {
            mSsoHandler.authorizeClientSso(new AuthListener());
        }else{
            Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
            ImageObject imageObject = new ImageObject();
            imageObject.identify = Utility.generateGUID();
            imageObject.imageData = WXBitmapConvertToByteUtil.bmpToByteArray(bmp, false);

            TextObject textObject = new TextObject();
            textObject.text = "这里没有浮躁与喧嚣,这里会让你静下心来感受生活的美好,一切精彩尽在NEW!";

            WeiboMultiMessage weiboMessage = new WeiboMultiMessage();
            weiboMessage.imageObject = imageObject;
            weiboMessage.textObject = textObject;

            // 2. 初始化从第三方到微博的消息请求
            SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
            // 用transaction唯一标识一个请求
            request.transaction = String.valueOf(System.currentTimeMillis());
            request.multiMessage = weiboMessage;

            mIWeiboShareAPI.sendRequest(getActivity(), request);
        }
    }
}
 
开发者ID:x251089003,项目名称:EveryXDay,代码行数:36,代码来源:FragmentSetting.java

示例13: onClickSinaShare

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
private void onClickSinaShare(){
    if(!AppInstallUtil.isWeiBoInstalled(this)){
        Snackbar.with(this) // context
                .colorResource(R.color.app_main_theme_color_transparent)
                .duration(Snackbar.SnackbarDuration.LENGTH_SHORT)
                .text("请先安装新浪微博客户端") // text to display
                .show(this);
        return;
    }else {
        Oauth2AccessToken mAccessToken = AccessTokenKeeper.readAccessToken(this);
        if (!mAccessToken.isSessionValid()) {
            mSsoHandler.authorizeClientSso(new AuthListener());
            Toast.makeText(this, "调用授权", Toast.LENGTH_SHORT).show();
        }else{
            Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
            ImageObject imageObject = new ImageObject();
            imageObject.identify = Utility.generateGUID();
            imageObject.imageData = WXBitmapConvertToByteUtil.bmpToByteArray(bmp, false);

            TextObject textObject = new TextObject();
            textObject.text = "这里没有浮躁与喧嚣,这里会让你静下心来感受生活的美好,一切精彩尽在NEW!";

            WeiboMultiMessage weiboMessage = new WeiboMultiMessage();
            weiboMessage.imageObject = imageObject;
            weiboMessage.textObject = textObject;

            // 2. 初始化从第三方到微博的消息请求
            SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
            // 用transaction唯一标识一个请求
            request.transaction = String.valueOf(System.currentTimeMillis());
            request.multiMessage = weiboMessage;

            mIWeiboShareAPI.sendRequest(this, request);
            Toast.makeText(this,"可以分享啦",Toast.LENGTH_SHORT).show();
        }
    }
}
 
开发者ID:x251089003,项目名称:EveryXDay,代码行数:38,代码来源:ToolbarControlDetailListViewActivity.java

示例14: getJokeMessage

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
private WeiboMultiMessage getJokeMessage() {
    TextObject textObject = new TextObject();
    textObject.text = "【" + jokeBean.title + "】\n"
            + jokeBean.content + "\n"
            + getString(R.string.share_from)
            + getString(R.string.app_name);

    WeiboMultiMessage weiboMessage = new WeiboMultiMessage();//初始化微博的分享消息
    weiboMessage.textObject = textObject;

    return weiboMessage;
}
 
开发者ID:CyanFlxy,项目名称:KnockKnock,代码行数:13,代码来源:WeiboAuthActivity.java

示例15: getTextObject

import com.sina.weibo.sdk.api.TextObject; //导入依赖的package包/类
private TextObject getTextObject(AbsShareMsg msg) {

TextObject textObject = new TextObject();

if (msg instanceof MsgText) {
	MsgText mt = (MsgText) msg;

	if(mt.title != null && mt.title.length() > 0){
		textObject.title = mt.title;
	}
	if(mt.summary != null && mt.summary.length() > 0){
		textObject.text = mt.summary;
	}
	if(mt.targetUrl != null && mt.targetUrl.length() > 0){
		textObject.actionUrl = mt.targetUrl;
	}
	
	if (msg instanceof MsgImageText) {
		String imgurl = ((MsgImageText) mt).imageUrl;
		if(imgurl != null && imgurl.length() > 0){
			if(imgurl.startsWith("http")){
				textObject.text += imgurl;
			}else{
				textObject.setThumbImage(BitmapFactory.decodeFile(imgurl));
			}
		}
	}
	
}
      
      return textObject;
  }
 
开发者ID:simplelifetian,项目名称:GomeOnline,代码行数:33,代码来源:ShareToSina.java


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