本文整理汇总了Java中com.umeng.socialize.media.UMImage类的典型用法代码示例。如果您正苦于以下问题:Java UMImage类的具体用法?Java UMImage怎么用?Java UMImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UMImage类属于com.umeng.socialize.media包,在下文中一共展示了UMImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseMediaType
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
private void parseMediaType() {
if (!TextUtils.isEmpty(this.mShareContent) && this.mShareMedia == null) {
this.mShareType = "text";
} else if (this.mShareMedia != null && (this.mShareMedia instanceof UMEmoji)) {
this.mShareType = TYPE_EMOJI;
} else if (TextUtils.isEmpty(this.mShareContent) && this.mShareMedia != null && (this
.mShareMedia instanceof UMImage)) {
this.mShareType = "image";
} else if (this.mShareMedia != null && (this.mShareMedia instanceof UMusic)) {
this.mShareType = TYPE_MUSIC;
} else if (this.mShareMedia != null && (this.mShareMedia instanceof UMVideo)) {
this.mShareType = TYPE_VIDEO;
} else if (!TextUtils.isEmpty(this.mShareContent) && this.mShareMedia != null && (this
.mShareMedia instanceof UMImage)) {
this.mShareType = TYPE_TEXT_IMAGE;
}
}
示例2: share
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
public void share(SharePlatform platform, ShareModel shareModel) {
if (platform == null) {
return;
}
UMImage umImage = shareModel.umImage == null ? new UMImage(activity, R.drawable.logo) : shareModel.umImage;
ShareAction shareAction = new ShareAction(activity)
.setPlatform(platform.media)
.setCallback(mUMShareListener)
.withTargetUrl(shareModel.targetUrl);
if (platform.media == SHARE_MEDIA.WEIXIN || platform.media == SHARE_MEDIA.QQ || platform.media == SHARE_MEDIA.QZONE) {
shareAction.withTitle(shareModel.title).withText(shareModel.content).withMedia(umImage);
} else if (platform.media == SHARE_MEDIA.WEIXIN_CIRCLE) {
shareAction.withTitle(shareModel.title + shareModel.content).withText(shareModel.targetUrl).withMedia(umImage);
} else if (platform.media == SHARE_MEDIA.SINA) {
shareAction.withText(shareModel.title + shareModel.content + shareModel.targetUrl).withMedia(umImage);
} else if (platform.media == SHARE_MEDIA.SMS) {
shareAction.withText(shareModel.title + shareModel.content + shareModel.urlPrefix + shareModel.targetUrl);
}
shareAction.share();
}
示例3: e
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
private void e() {
if (this.D != null) {
MediaType mediaType = this.D.getMediaType();
if (mediaType == MediaType.MUSIC || mediaType == MediaType.VEDIO) {
String str = "umeng_socialize_share_music";
if (mediaType == MediaType.VEDIO) {
str = "umeng_socialize_share_video";
}
this.a.setImageResource(ResContainer.getResourceId(this.t, ResType.DRAWABLE, str));
this.a.setVisibility(0);
this.j.setVisibility(0);
} else if (mediaType == MediaType.IMAGE) {
this.a.setImageDrawable(null);
int resourceId = ResContainer.getResourceId(this.t, ResType.DRAWABLE,
"umeng_socialize_share_pic");
UMImage uMImage = (UMImage) this.D;
this.s.setVisibility(0);
this.a.setVisibility(4);
new ah(this, uMImage, resourceId).execute();
}
}
}
示例4: getBitmapOptions
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
public static Options getBitmapOptions(byte[] bArr) {
Options options = new Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeByteArray(bArr, 0, bArr.length, options);
int ceil = (int) Math.ceil((double) (options.outWidth / UMImage.MAX_WIDTH));
int ceil2 = (int) Math.ceil((double) (options.outHeight / UMImage.MAX_HEIGHT));
if (ceil2 <= 1 || ceil <= 1) {
if (ceil2 > 2) {
options.inSampleSize = ceil2;
} else if (ceil > 2) {
options.inSampleSize = ceil;
}
} else if (ceil2 > ceil) {
options.inSampleSize = ceil2;
} else {
options.inSampleSize = ceil;
}
options.inJustDecodeBounds = false;
return options;
}
示例5: b
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
private static Intent b(Context context, String str, UMediaObject uMediaObject) {
Intent intent = new Intent("android.intent.action.SEND");
intent.setType("image/*;text/plain");
if (!TextUtils.isEmpty(str)) {
intent.putExtra("android.intent.extra.TEXT", str);
intent.putExtra("android.intent.extra.SUBJECT", str);
}
if (uMediaObject instanceof UMImage) {
String imageCachePath = ((UMImage) uMediaObject).getImageCachePath();
if (imageCachePath != null) {
Parcelable insertImage = SocializeUtils.insertImage(context, imageCachePath);
if (insertImage != null) {
intent.putExtra("android.intent.extra.STREAM", insertImage);
SocializeUtils.deleteUris.add(insertImage);
}
}
}
return intent;
}
示例6: shareToQQ
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
public void shareToQQ() {
if (validTencent()) {
this.mSocializeConfig.fireAllListenersOnStart(SnsPostListener.class);
String path = (String) this.mExtraData.get("image_path_local");
if (isLoadImageAsync()) {
loadImage(this.mContext, (String) this.mExtraData.get("image_path_url"));
return;
} else if (isUploadImageAsync(path, this.mShareType)) {
UMImage image = new UMImage(this.mContext, new File(path));
Log.w(TAG, "未安装QQ客户端的情况下,QQ不支持音频,图文是为本地图片的分享。此时将上传本地图片到相册,请确保在QQ互联申请了upload_pic权限" +
".");
authorize(this.mActivity, createUploadAuthListener(image));
return;
} else {
defaultShareToQQ();
return;
}
}
Log.d(TAG, "QQ平台还没有授权");
createAuthListener();
authorize(this.mActivity, this.mAuthListener);
}
示例7: buildParams
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
private void buildParams() {
this.mParams = new Bundle();
this.mParams.putString("summary", this.mShareContent);
if ((this.mShareMedia instanceof UMImage) && TextUtils.isEmpty(this.mShareContent)) {
this.mShareType = 5;
buildImageParams(this.mParams);
} else if ((this.mShareMedia instanceof UMusic) || (this.mShareMedia instanceof UMVideo)) {
this.mShareType = 2;
buildAudioParams(this.mParams);
} else {
buildTextImageParams(this.mParams);
}
this.mParams.putInt("req_type", this.mShareType);
if (TextUtils.isEmpty(this.mTitle)) {
this.mTitle = "分享到QQ";
}
if (TextUtils.isEmpty(this.mTargetUrl)) {
this.mTargetUrl = SocializeConstants.SOCIAL_LINK;
}
this.mParams.putString("targetUrl", this.mTargetUrl);
this.mParams.putString("title", this.mTitle);
this.mParams.putString("appName", getAppName());
}
示例8: shareToQZone
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
private void shareToQZone() {
if (initTencent()) {
Bundle bundle = buildParams(getShareMsg());
int type = bundle.getInt("req_type");
List<String> paths = bundle.getStringArrayList("imageUrl");
String imagePath = null;
if (paths != null && paths.size() > 0) {
imagePath = (String) paths.get(0);
}
if (isUploadImageAsync(imagePath, type)) {
authorize((Activity) this.mActivity.get(), createAuthListener(bundle, new UMImage
(this.mContext, imagePath)));
} else {
defaultQZoneShare(bundle);
}
mEntity.setShareType(ShareType.NORMAL);
}
}
示例9: addSelfParams
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
protected Map<String, Object> addSelfParams(Map<String, Object> map) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("usid", this.d);
} catch (JSONException e) {
e.printStackTrace();
}
Map<String, Object> packParamsMap = packParamsMap(TAG, addParamsToJson(jSONObject, map)
.toString());
if (this.e != null) {
if (this.e.isUrlMedia()) {
addMedia(this.e, packParamsMap);
} else if (this.e instanceof UMImage) {
a(this.e, packParamsMap);
}
}
return packParamsMap;
}
示例10: getFilePair
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
public Map<String, FilePair> getFilePair() {
if (this.e == null || this.e.isUrlMedia()) {
return super.getFilePair();
}
Map<String, FilePair> filePair = super.getFilePair();
if (this.e instanceof UMImage) {
byte[] fileToByte = fileToByte(((UMImage) this.e).getImageCachePath());
String checkFormat = ImageFormat.checkFormat(fileToByte);
if (TextUtils.isEmpty(checkFormat)) {
checkFormat = "png";
}
filePair.put(SocializeProtocolConstants.PROTOCOL_KEY_IMAGE, new FilePair((System
.currentTimeMillis() + "") + "." + checkFormat, fileToByte));
}
return filePair;
}
示例11: getFilePair
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
public Map<String, FilePair> getFilePair() {
if (this.e == null || this.e.getMedia() == null || this.e.getMedia().isUrlMedia()) {
return super.getFilePair();
}
Map<String, FilePair> filePair = super.getFilePair();
if (this.e.getMedia() instanceof UMImage) {
byte[] fileToByte = fileToByte(((UMImage) this.e.getMedia()).getImageCachePath());
String checkFormat = ImageFormat.checkFormat(fileToByte);
if (TextUtils.isEmpty(checkFormat)) {
checkFormat = "png";
}
filePair.put(SocializeProtocolConstants.PROTOCOL_KEY_IMAGE, new FilePair((System
.currentTimeMillis() + "") + "." + checkFormat, fileToByte));
}
return filePair;
}
示例12: getFilePair
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
public Map<String, FilePair> getFilePair() {
if (this.f == null || this.f.getMedia() == null || this.f.getMedia().isUrlMedia()) {
return super.getFilePair();
}
Map<String, FilePair> filePair = super.getFilePair();
if (this.f.getMedia() instanceof UMImage) {
byte[] fileToByte = fileToByte(((UMImage) this.f.getMedia()).getImageCachePath());
String checkFormat = ImageFormat.checkFormat(fileToByte);
if (TextUtils.isEmpty(checkFormat)) {
checkFormat = "png";
}
filePair.put(SocializeProtocolConstants.PROTOCOL_KEY_IMAGE, new FilePair((System
.currentTimeMillis() + "") + "." + checkFormat, fileToByte));
}
return filePair;
}
示例13: onCreate
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.custom_dialog);
setContentView(R.layout.activity_share_caption);
ButterKnife.bind(this);
image = new UMImage(mContext, BitmapFactory.decodeResource(getResources(), R.mipmap.icon_96));
mAccount = String.valueOf(AccountInfo.getInstance().loadAccount().getAccount());
// //获取对话框布局中的控件,并设置事件监听
// findViewById(R.id.share_wechat).setOnClickListener(this);
// findViewById(R.id.share_friends).setOnClickListener(this);
// findViewById(R.id.share_qq).setOnClickListener(this);
// findViewById(R.id.share_qzone).setOnClickListener(this);
// findViewById(R.id.share_weibo).setOnClickListener(this);
// findViewById(R.id.login_cancel).setOnClickListener(this);
// findViewById(R.id.dialog_layout).setOnClickListener(this);
showDialog();
}
示例14: onCreate
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_share_offical_catpion);
ButterKnife.bind(this);
shareInfo = (ShareInfo) getIntent().getParcelableExtra(KEY_SHARE_INFO);
mGUid = getIntent().getStringExtra(KEY_CAPTION_GUID);
Log.i("TAG", "---积分的guid" + mGUid);
Logger.d(shareInfo.toString());
shareTitle = shareInfo.getTitle();
shareContent = shareInfo.getContent();
shareImageUrl = shareInfo.getImageUrl();
targetUrl = shareInfo.getTargetUrl();
image = new UMImage(mContext, shareImageUrl);
showDialog();
}
示例15: share
import com.umeng.socialize.media.UMImage; //导入依赖的package包/类
public void share(View view) {
ShareModel model = new ShareModel();
model.setTitle("测试分享标题");
model.setContent("测试分享内容");
model.setImageMedia(new UMImage(this, R.mipmap.ic_launcher));
su.share(model, new IShareCallback() {
@Override
public void onSuccess() {
Toast.makeText(MainActivity.this, "分享成功", Toast.LENGTH_SHORT).show();
}
@Override
public void onFaild() {
Toast.makeText(MainActivity.this, "分享失败", Toast.LENGTH_SHORT).show();
}
@Override
public void onCancel() {
Toast.makeText(MainActivity.this, "取消分享", Toast.LENGTH_SHORT).show();
}
});
}