Java Code Examples for cn.sharesdk.framework.ShareSDK#logDemoEvent()

The following examples show how to use cn.sharesdk.framework.ShareSDK#logDemoEvent() . 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: PlatformPage.java    From LQRWeChat with MIT License 6 votes vote down vote up
public final void showEditPage(final Platform platform) {
	beforeFinish = new Runnable() {
		public void run() {
			boolean isSilent = isSilent();
			boolean isCustomPlatform = platform instanceof CustomPlatform;
			boolean isUseClientToShare = isUseClientToShare(platform);
			if (isSilent || isCustomPlatform || isUseClientToShare) {
				shareSilently(platform);
			} else {
				ShareParams sp = formateShareData(platform);
				if (sp != null) {
					// 编辑分享内容的统计
					ShareSDK.logDemoEvent(3, null);
					if (getCustomizeCallback() != null) {
						getCustomizeCallback().onShare(platform, sp);
					}
					impl.showEditPage(activity, platform, sp);
				}
			}
		}
	};
	finish();
}
 
Example 2
Source File: PlatformPage.java    From POCenter with MIT License 6 votes vote down vote up
public final void showEditPage(final Platform platform) {
	beforeFinish = new Runnable() {
		public void run() {
			boolean isSilent = isSilent();
			boolean isCustomPlatform = platform instanceof CustomPlatform;
			boolean isUseClientToShare = isUseClientToShare(platform);
			if (isSilent || isCustomPlatform || isUseClientToShare) {
				shareSilently(platform);
			} else {
				ShareParams sp = formateShareData(platform);
				if (sp != null) {
					// 编辑分享内容的统计
					ShareSDK.logDemoEvent(3, null);
					if (getCustomizeCallback() != null) {
						getCustomizeCallback().onShare(platform, sp);
					}
					impl.showEditPage(activity, platform, sp);
				}
			}
		}
	};
	finish();
}
 
Example 3
Source File: PlatformPage.java    From Mobike with Apache License 2.0 6 votes vote down vote up
public final void showEditPage(final Platform platform) {
	beforeFinish = new Runnable() {
		public void run() {
			boolean isSilent = isSilent();
			boolean isCustomPlatform = platform instanceof CustomPlatform;
			boolean isUseClientToShare = isUseClientToShare(platform);
			if (isSilent || isCustomPlatform || isUseClientToShare) {
				shareSilently(platform);
			} else {
				ShareParams sp = formateShareData(platform);
				if (sp != null) {
					// 编辑分享内容的统计
					ShareSDK.logDemoEvent(3, null);
					if (getCustomizeCallback() != null) {
						getCustomizeCallback().onShare(platform, sp);
					}
					impl.showEditPage(activity, platform, sp);
				}
			}
		}
	};
	finish();
}
 
Example 4
Source File: OnekeyShare.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
public void onCancel(Platform platform, int action) {
	Message msg = new Message();
	msg.what = MSG_ACTION_CCALLBACK;
	msg.arg1 = 3;
	msg.arg2 = action;
	msg.obj = platform;
	UIHandler.sendMessage(msg, this);

	// 分享失败的统计
	ShareSDK.logDemoEvent(5, platform);
}
 
Example 5
Source File: OnekeyShareThemeImpl.java    From enjoyshop with Apache License 2.0 5 votes vote down vote up
private void prepareForEditPage(Platform platform) {
	if (formateShareData(platform)) {
		ShareParams sp = shareDataToShareParams(platform);
		if (sp != null) {
			// 编辑分享内容的统计
			ShareSDK.logDemoEvent(3, null);
			if (customizeCallback != null) {
				customizeCallback.onShare(platform, sp);
			}
			showEditPage(context, platform, sp);
		}
	}
}
 
Example 6
Source File: OnekeyShareThemeImpl.java    From Social with Apache License 2.0 5 votes vote down vote up
private void prepareForEditPage(Platform platform) {
	if (formateShareData(platform)) {
		ShareParams sp = shareDataToShareParams(platform);
		if (sp != null) {
			// 编辑分享内容的统计
			ShareSDK.logDemoEvent(3, null);
			if (customizeCallback != null) {
				customizeCallback.onShare(platform, sp);
			}
			showEditPage(context, platform, sp);
		}
	}
}
 
Example 7
Source File: OnekeyShareThemeImpl.java    From BaoKanAndroid with MIT License 5 votes vote down vote up
private void prepareForEditPage(Platform platform) {
	if (formateShareData(platform)) {
		ShareParams sp = shareDataToShareParams(platform);
		if (sp != null) {
			// 编辑分享内容的统计
			ShareSDK.logDemoEvent(3, null);
			if (customizeCallback != null) {
				customizeCallback.onShare(platform, sp);
			}
			showEditPage(context, platform, sp);
		}
	}
}
 
Example 8
Source File: OnekeyShareThemeImpl.java    From LQRWeChat with MIT License 5 votes vote down vote up
public final void onError(Platform platform, int action, Throwable t) {
	t.printStackTrace();

	Message msg = new Message();
	msg.arg1 = 2;
	msg.arg2 = action;
	msg.obj = t;
	UIHandler.sendMessage(msg, this);

	// 分享失败的统计
	ShareSDK.logDemoEvent(4, platform);
}
 
Example 9
Source File: OnekeyShareThemeImpl.java    From Mobike with Apache License 2.0 5 votes vote down vote up
public final void onCancel(Platform platform, int action) {
	Message msg = new Message();
	msg.arg1 = 3;
	msg.arg2 = action;
	msg.obj = platform;
	UIHandler.sendMessage(msg, this);

	// 分享失败的统计
	ShareSDK.logDemoEvent(5, platform);
}
 
Example 10
Source File: OnekeyShare.java    From YiZhi with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void show(Context context) {
	HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
	shareParamsMap.putAll(params);

	if (!(context instanceof MobApplication)) {
		MobSDK.init(context.getApplicationContext());
	}

	// 打开分享菜单的统计
	ShareSDK.logDemoEvent(1, null);

	int iTheme = 0;
	try {
		iTheme = ResHelper.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());
}
 
Example 11
Source File: OnekeyShareThemeImpl.java    From BaoKanAndroid with MIT License 5 votes vote down vote up
public final void onCancel(Platform platform, int action) {
	Message msg = new Message();
	msg.arg1 = 3;
	msg.arg2 = action;
	msg.obj = platform;
	UIHandler.sendMessage(msg, this);

	// 分享失败的统计
	ShareSDK.logDemoEvent(5, platform);
}
 
Example 12
Source File: OnekeyShareThemeImpl.java    From enjoyshop with Apache License 2.0 5 votes vote down vote up
public final void onCancel(Platform platform, int action) {
	Message msg = new Message();
	msg.arg1 = 3;
	msg.arg2 = action;
	msg.obj = platform;
	UIHandler.sendMessage(msg, this);

	// 分享失败的统计
	ShareSDK.logDemoEvent(5, platform);
}
 
Example 13
Source File: OnekeyShareThemeImpl.java    From fingerpoetry-android with Apache License 2.0 5 votes vote down vote up
public final void onError(Platform platform, int action, Throwable t) {
	t.printStackTrace();

	Message msg = new Message();
	msg.arg1 = 2;
	msg.arg2 = action;
	msg.obj = t;
	UIHandler.sendMessage(msg, this);

	// 分享失败的统计
	ShareSDK.logDemoEvent(4, platform);
}
 
Example 14
Source File: OnekeyShareThemeImpl.java    From POCenter with MIT License 5 votes vote down vote up
public final void onError(Platform platform, int action, Throwable t) {
	t.printStackTrace();

	Message msg = new Message();
	msg.arg1 = 2;
	msg.arg2 = action;
	msg.obj = t;
	UIHandler.sendMessage(msg, this);

	// 分享失败的统计
	ShareSDK.logDemoEvent(4, platform);
}
 
Example 15
Source File: OnekeyShareThemeImpl.java    From BaoKanAndroid with MIT License 5 votes vote down vote up
public final void onError(Platform platform, int action, Throwable t) {
	t.printStackTrace();

	Message msg = new Message();
	msg.arg1 = 2;
	msg.arg2 = action;
	msg.obj = t;
	UIHandler.sendMessage(msg, this);

	// 分享失败的统计
	ShareSDK.logDemoEvent(4, platform);
}
 
Example 16
Source File: EditPage.java    From ShareSDKShareDifMsgDemo-Android with MIT License 4 votes vote down vote up
/** 显示平台列表 */
public void afterPlatformListGot() {
	String name = String.valueOf(reqData.get("platform"));
	int size = platformList == null ? 0 : platformList.length;
	views = new View[size];

	final int dp_24 = dipToPx(getContext(), 24);
	LinearLayout.LayoutParams lpItem = new LinearLayout.LayoutParams(dp_24, dp_24);
	final int dp_9 = dipToPx(getContext(), 9);
	lpItem.setMargins(0, 0, dp_9, 0);
	FrameLayout.LayoutParams lpMask = new FrameLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	lpMask.gravity = Gravity.LEFT | Gravity.TOP;
	int selection = 0;
	for (int i = 0; i < size; i++) {
		FrameLayout fl = new FrameLayout(getContext());
		fl.setLayoutParams(lpItem);
		if (i >= size - 1) {
			fl.setLayoutParams(new LinearLayout.LayoutParams(dp_24, dp_24));
		}
		llPlat.addView(fl);
		fl.setOnClickListener(this);

		ImageView iv = new ImageView(getContext());
		iv.setScaleType(ScaleType.CENTER_INSIDE);
		iv.setImageBitmap(getPlatLogo(platformList[i]));
		iv.setLayoutParams(new FrameLayout.LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
		fl.addView(iv);

		views[i] = new View(getContext());
		views[i].setBackgroundColor(0xcfffffff);
		views[i].setOnClickListener(this);
		if (name != null && name.equals(platformList[i].getName())) {
			views[i].setVisibility(View.INVISIBLE);
			selection = i;

			// 编辑分享内容的统计
			ShareSDK.logDemoEvent(3, platformList[i]);
		}
		views[i].setLayoutParams(lpMask);
		fl.addView(views[i]);
	}

	final int postSel = selection;
	UIHandler.sendEmptyMessageDelayed(0, 333, new Callback() {
		public boolean handleMessage(Message msg) {
			HorizontalScrollView hsv = (HorizontalScrollView)llPlat.getParent();
			hsv.scrollTo(postSel * (dp_24 + dp_9), 0);
			return false;
		}
	});
}
 
Example 17
Source File: EditPageFakeActivity.java    From BigApp_Discuz_Android with Apache License 2.0 4 votes vote down vote up
protected void setResultAndFinish() {
	ArrayList<String> imageArray = new ArrayList<String>();
	if(shareImageList != null) {
		for(ImageInfo imageInfo : shareImageList) {
			if("imagePath".equals(imageInfo.paramName) || "imageUrl".equals(imageInfo.paramName)) {
				shareParamMap.put(imageInfo.paramName, imageInfo.srcValue);
			} else if("viewToShare".equals(imageInfo.paramName)) {
				shareParamMap.put(imageInfo.paramName, imageInfo.bitmap);
			} else if("imageArray".equals(imageInfo.paramName)) {
				imageArray.add(imageInfo.srcValue);
			}
		}
		shareImageList.clear();
		if(imageArray.size() == 0) {
			shareParamMap.put("imageArray", null);
		} else {
			shareParamMap.put("imageArray", imageArray.toArray(new String[imageArray.size()]));
		}
	}

	HashMap<Platform, HashMap<String, Object>> editRes = new HashMap<Platform, HashMap<String,Object>>();

	for(Platform platform : platforms) {

		if("FacebookMessenger".equals(platform.getName())) {
			HashMap<String, Object> param = new HashMap<String, Object>(shareParamMap);
			if(toFriendList != null && toFriendList.size() > 0) {
				param.put("address", toFriendList.get(toFriendList.size() - 1));
			}
			if(param.get("address") == null) {
				int resId = getStringRes(activity, "select_a_friend");
				if (resId > 0) {
					Toast.makeText(getContext(), activity.getString(resId) + " - " + platform.getName(), Toast.LENGTH_SHORT).show();
				}
				return;
			}
			editRes.put(platform, param);
			// a statistics of Sharing
			ShareSDK.logDemoEvent(3, platform);
			continue;
		}
		// a statistics of Sharing
		ShareSDK.logDemoEvent(3, platform);
		editRes.put(platform, shareParamMap);
	}

	HashMap<String, Object> res = new HashMap<String, Object>();
	res.put("editRes", editRes);
	setResult(res);
	finish();
}
 
Example 18
Source File: EditPage.java    From Huochexing12306 with Apache License 2.0 4 votes vote down vote up
/** 显示平台列表 */
public void afterPlatformListGot() {
	String name = String.valueOf(reqData.get("platform"));
	int size = platformList == null ? 0 : platformList.length;
	views = new View[size];

	final int dp_24 = dipToPx(getContext(), 24);
	LinearLayout.LayoutParams lpItem = new LinearLayout.LayoutParams(dp_24, dp_24);
	final int dp_9 = dipToPx(getContext(), 9);
	lpItem.setMargins(0, 0, dp_9, 0);
	FrameLayout.LayoutParams lpMask = new FrameLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	lpMask.gravity = Gravity.LEFT | Gravity.TOP;
	int selection = 0;
	for (int i = 0; i < size; i++) {
		FrameLayout fl = new FrameLayout(getContext());
		fl.setLayoutParams(lpItem);
		if (i >= size - 1) {
			fl.setLayoutParams(new LinearLayout.LayoutParams(dp_24, dp_24));
		}
		llPlat.addView(fl);
		fl.setOnClickListener(this);

		ImageView iv = new ImageView(getContext());
		iv.setScaleType(ScaleType.CENTER_INSIDE);
		iv.setImageBitmap(getPlatLogo(platformList[i]));
		iv.setLayoutParams(new FrameLayout.LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
		fl.addView(iv);

		views[i] = new View(getContext());
		views[i].setBackgroundColor(0xcfffffff);
		views[i].setOnClickListener(this);
		if (name != null && name.equals(platformList[i].getName())) {
			views[i].setVisibility(View.INVISIBLE);
			selection = i;

			// 编辑分享内容的统计
			ShareSDK.logDemoEvent(3, platformList[i]);
		}
		views[i].setLayoutParams(lpMask);
		fl.addView(views[i]);
	}

	final int postSel = selection;
	UIHandler.sendEmptyMessageDelayed(0, 333, new Callback() {
		public boolean handleMessage(Message msg) {
			HorizontalScrollView hsv = (HorizontalScrollView)llPlat.getParent();
			hsv.scrollTo(postSel * (dp_24 + dp_9), 0);
			return false;
		}
	});
}
 
Example 19
Source File: EditPage.java    From -Android_ShareSDK_Example_Wechat with MIT License 4 votes vote down vote up
/** display platform list */
public void afterPlatformListGot() {
	String name = String.valueOf(reqData.get("platform"));
	int size = platformList == null ? 0 : platformList.length;
	views = new View[size];

	final int dp_36 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 36);
	LinearLayout.LayoutParams lpItem = new LinearLayout.LayoutParams(dp_36, dp_36);
	final int dp_9 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 9);
	lpItem.setMargins(0, 0, dp_9, 0);
	FrameLayout.LayoutParams lpMask = new FrameLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	lpMask.gravity = Gravity.LEFT | Gravity.TOP;
	int selection = 0;
	for (int i = 0; i < size; i++) {
		FrameLayout fl = new FrameLayout(getContext());
		fl.setLayoutParams(lpItem);
		if (i >= size - 1) {
			fl.setLayoutParams(new LinearLayout.LayoutParams(dp_36, dp_36));
		}
		llPlat.addView(fl);
		fl.setOnClickListener(this);

		ImageView iv = new ImageView(getContext());
		iv.setScaleType(ScaleType.CENTER_INSIDE);
		iv.setImageBitmap(getPlatLogo(platformList[i]));
		iv.setLayoutParams(new FrameLayout.LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
		fl.addView(iv);

		views[i] = new View(getContext());
		views[i].setBackgroundColor(0xcfffffff);
		views[i].setOnClickListener(this);
		if (name != null && name.equals(platformList[i].getName())) {
			views[i].setVisibility(View.INVISIBLE);
			selection = i;

			// a statistics of Sharing
			ShareSDK.logDemoEvent(3, platformList[i]);
		}
		views[i].setLayoutParams(lpMask);
		fl.addView(views[i]);
	}

	final int postSel = selection;
	UIHandler.sendEmptyMessageDelayed(0, 333, new Callback() {
		public boolean handleMessage(Message msg) {
			HorizontalScrollView hsv = (HorizontalScrollView)llPlat.getParent();
			hsv.scrollTo(postSel * (dp_36 + dp_9), 0);
			return false;
		}
	});
}
 
Example 20
Source File: EditPage.java    From ShareSDKShareDifMsgDemo-Android with MIT License 4 votes vote down vote up
public void onClick(View v) {
	if (v.equals(llTitle.getBtnBack())) {
		Platform plat = null;
		for (int i = 0; i < views.length; i++) {
			if (views[i].getVisibility() == View.INVISIBLE) {
				plat = platformList[i];
				break;
			}
		}

		// 取消分享的统计
		if (plat != null) {
			ShareSDK.logDemoEvent(5, plat);
		}
		finish();
		return;
	}

	// 取消分享的统计
	if (v.equals(llTitle.getBtnRight())) {
		String text = etContent.getText().toString();
		reqData.put("text", text);
		if(!shareImage){
			if (reqData.get("imagePath") == null) {
				reqData.put("viewToShare", null);
				reqData.put("imageUrl", null);
			} else if (reqData.get("imageUrl") == null) {
				reqData.put("imagePath", null);
				reqData.put("viewToShare", null);
			} else {
				reqData.put("imageUrl", null);
				reqData.put("imagePath", null);
			}
		}

		HashMap<Platform, HashMap<String, Object>> editRes
				= new HashMap<Platform, HashMap<String,Object>>();
		boolean selected = false;
		for (int i = 0; i < views.length; i++) {
			if (views[i].getVisibility() != View.VISIBLE) {
				editRes.put(platformList[i], reqData);
				selected = true;
			}
		}

		if (selected) {
			HashMap<String, Object> res = new HashMap<String, Object>();
			res.put("editRes", editRes);
			setResult(res);
			finish();
		} else {
			int resId = getStringRes(activity, "select_one_plat_at_least");
			if (resId > 0) {
				Toast.makeText(getContext(), resId, Toast.LENGTH_SHORT).show();
			}
		}
		return;
	}

	if (v instanceof FrameLayout) {
		((FrameLayout) v).getChildAt(1).performClick();
		return;
	}

	if (v.getVisibility() == View.INVISIBLE) {
		v.setVisibility(View.VISIBLE);
	} else {
		v.setVisibility(View.INVISIBLE);
	}
}