日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

团队冲刺二--3

發(fā)布時(shí)間:2025/5/22 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 团队冲刺二--3 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

劉晨將新聞的實(shí)現(xiàn)做出了大部分:

/*
* 官網(wǎng)地站:http://www.mob.com
* 技術(shù)支持QQ: 4006852216
* 官方微信:ShareSDK (如果發(fā)布新版本的話,我們將會(huì)第一時(shí)間通過微信將版本更新內(nèi)容推送給您。如果使用過程中有任何問題,也可以通過微信與我們?nèi)〉寐?lián)系,我們將會(huì)在24小時(shí)內(nèi)給予回復(fù))
*
* Copyright (c) 2013年 mob.com. All rights reserved.
*/

package cn.sharesdk.onekeyshare;

import static com.mob.tools.utils.BitmapHelper.captureView;

import java.util.ArrayList;
import java.util.HashMap;

import android.content.Context;
import android.graphics.Bitmap;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import cn.sharesdk.framework.Platform;
import cn.sharesdk.framework.PlatformActionListener;
import cn.sharesdk.framework.ShareSDK;
import com.mob.tools.utils.R;

/**
* 快捷分享的入口
* <p>
* 通過不同的setter設(shè)置參數(shù),然后調(diào)用{@link #show(Context)}方法啟動(dòng)快捷分享
*/
public class OnekeyShare {
private HashMap<String, Object> params;

public OnekeyShare() {
params = new HashMap<String, Object>();
params.put("customers", new ArrayList<CustomerLogo>());
params.put("hiddenPlatforms", new HashMap<String, String>());
}

/** address是接收人地址,僅在信息和郵件使用,否則可以不提供 */
public void setAddress(String address) {
params.put("address", address);
}

/**
* title標(biāo)題,在印象筆記、郵箱、信息、微信(包括好友、朋友圈和收藏)、
* 易信(包括好友、朋友圈)、人人網(wǎng)和QQ空間使用,否則可以不提供
*/
public void setTitle(String title) {
params.put("title", title);
}

/** titleUrl是標(biāo)題的網(wǎng)絡(luò)鏈接,僅在人人網(wǎng)和QQ空間使用,否則可以不提供 */
public void setTitleUrl(String titleUrl) {
params.put("titleUrl", titleUrl);
}

/** text是分享文本,所有平臺(tái)都需要這個(gè)字段 */
public void setText(String text) {
params.put("text", text);
}

/** 獲取text字段的值 */
public String getText() {
return params.containsKey("text") ? String.valueOf(params.get("text")) : null;
}

/** imagePath是本地的圖片路徑,除Linked-In外的所有平臺(tái)都支持這個(gè)字段 */
public void setImagePath(String imagePath) {
if(!TextUtils.isEmpty(imagePath))
params.put("imagePath", imagePath);
}

/** imageUrl是圖片的網(wǎng)絡(luò)路徑,新浪微博、人人網(wǎng)、QQ空間和Linked-In支持此字段 */
public void setImageUrl(String imageUrl) {
if (!TextUtils.isEmpty(imageUrl))
params.put("imageUrl", imageUrl);
}

/** url在微信(包括好友、朋友圈收藏)和易信(包括好友和朋友圈)中使用,否則可以不提供 */
public void setUrl(String url) {
params.put("url", url);
}

/** filePath是待分享應(yīng)用程序的本地路勁,僅在微信(易信)好友和Dropbox中使用,否則可以不提供 */
public void setFilePath(String filePath) {
params.put("filePath", filePath);
}

/** comment是我對(duì)這條分享的評(píng)論,僅在人人網(wǎng)和QQ空間使用,否則可以不提供 */
public void setComment(String comment) {
params.put("comment", comment);
}

/** site是分享此內(nèi)容的網(wǎng)站名稱,僅在QQ空間使用,否則可以不提供 */
public void setSite(String site) {
params.put("site", site);
}

/** siteUrl是分享此內(nèi)容的網(wǎng)站地址,僅在QQ空間使用,否則可以不提供 */
public void setSiteUrl(String siteUrl) {
params.put("siteUrl", siteUrl);
}

/** foursquare分享時(shí)的地方名 */
public void setVenueName(String venueName) {
params.put("venueName", venueName);
}

/** foursquare分享時(shí)的地方描述 */
public void setVenueDescription(String venueDescription) {
params.put("venueDescription", venueDescription);
}

/** 分享地緯度,新浪微博、騰訊微博和foursquare支持此字段 */
public void setLatitude(float latitude) {
params.put("latitude", latitude);
}

/** 分享地經(jīng)度,新浪微博、騰訊微博和foursquare支持此字段 */
public void setLongitude(float longitude) {
params.put("longitude", longitude);
}

/** 是否直接分享 */
public void setSilent(boolean silent) {
params.put("silent", silent);
}

/** 設(shè)置編輯頁的初始化選中平臺(tái) */
public void setPlatform(String platform) {
params.put("platform", platform);
}

/** 設(shè)置KakaoTalk的應(yīng)用下載地址 */
public void setInstallUrl(String installurl) {
params.put("installurl", installurl);
}

/** 設(shè)置KakaoTalk的應(yīng)用打開地址 */
public void setExecuteUrl(String executeurl) {
params.put("executeurl", executeurl);
}

/** 設(shè)置微信分享的音樂的地址 */
public void setMusicUrl(String musicUrl) {
params.put("musicUrl", musicUrl);
}

/** 設(shè)置自定義的外部回調(diào) */
public void setCallback(PlatformActionListener callback) {
params.put("callback", callback);
}

/** 返回操作回調(diào) */
public PlatformActionListener getCallback() {
return R.forceCast(params.get("callback"));
}

/** 設(shè)置用于分享過程中,根據(jù)不同平臺(tái)自定義分享內(nèi)容的回調(diào) */
public void setShareContentCustomizeCallback(ShareContentCustomizeCallback callback) {
params.put("customizeCallback", callback);
}

/** 自定義不同平臺(tái)分享不同內(nèi)容的回調(diào) */
public ShareContentCustomizeCallback getShareContentCustomizeCallback() {
return R.forceCast(params.get("customizeCallback"));
}

/** 設(shè)置自己圖標(biāo)和點(diǎn)擊事件,可以重復(fù)調(diào)用添加多次 */
public void setCustomerLogo(Bitmap logo, String label, OnClickListener ocl) {
CustomerLogo cl = new CustomerLogo();
cl.logo = logo;
cl.label = label;
cl.listener = ocl;
ArrayList<CustomerLogo> customers = R.forceCast(params.get("customers"));
customers.add(cl);
}

/** 設(shè)置一個(gè)總開關(guān),用于在分享前若需要授權(quán),則禁用sso功能 */
public void disableSSOWhenAuthorize() {
params.put("disableSSO", true);
}

/** 設(shè)置視頻網(wǎng)絡(luò)地址 */
public void setVideoUrl(String url) {
params.put("url", url);
params.put("shareType", Platform.SHARE_VIDEO);
}

/** 設(shè)置編輯頁面的顯示模式為Dialog模式 */
@Deprecated
public void setDialogMode() {
params.put("dialogMode", true);
}

/** 添加一個(gè)隱藏的platform */
public void addHiddenPlatform(String platform) {
HashMap<String, String> hiddenPlatforms = R.forceCast(params.get("hiddenPlatforms"));
hiddenPlatforms.put(platform, platform);
}

/** 設(shè)置一個(gè)將被截圖分享的View , surfaceView是截不了圖片的*/
public void setViewToShare(View viewToShare) {
try {
Bitmap bm = captureView(viewToShare, viewToShare.getWidth(), viewToShare.getHeight());
params.put("viewToShare", bm);
} catch (Throwable e) {
e.printStackTrace();
}
}

/** 騰訊微博分享多張圖片 */
public void setImageArray(String[] imageArray) {
params.put("imageArray", imageArray);
}

/** 設(shè)置在執(zhí)行分享到QQ或QZone的同時(shí),分享相同的內(nèi)容騰訊微博 */
public void setShareToTencentWeiboWhenPerformingQQOrQZoneSharing() {
params.put("isShareTencentWeibo", true);
}

/** 設(shè)置分享界面的樣式,目前只有一種,不需要設(shè)置 */
public void setTheme(OnekeyShareTheme theme) {
params.put("theme", theme.getValue());
}

@SuppressWarnings("unchecked")
public void show(Context context) {
HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
shareParamsMap.putAll(params);

ShareSDK.initSDK(context.getApplicationContext());

// 打開分享菜單的統(tǒng)計(jì)
ShareSDK.logDemoEvent(1, null);

int iTheme = 0;
try {
iTheme = R.parseInt(String.valueOf(shareParamsMap.remove("theme")));
} catch (Throwable t) {}
OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
OnekeyShareThemeImpl themeImpl = theme.getImpl();

themeImpl.setShareParamsMap(shareParamsMap);
themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
themeImpl.disableSSO();
}

themeImpl.show(context.getApplicationContext());
}

}

轉(zhuǎn)載于:https://www.cnblogs.com/xswl123/p/11015535.html

《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀

總結(jié)

以上是生活随笔為你收集整理的团队冲刺二--3的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。