Java Code Examples for cn.sharesdk.onekeyshare.ShareCore#isDirectShare()

The following examples show how to use cn.sharesdk.onekeyshare.ShareCore#isDirectShare() . 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: PlatformGridViewAdapter.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View view) {
	ViewHolder viewHolder = (ViewHolder) view.getTag();
	Integer position = viewHolder.position;
	//直接分享平台选中后,其它的不可用
	if(directOnlyPosition != -1 && position != directOnlyPosition)
		return;

	Object item = getItem(position);
	boolean direct = false;
	//normal platform
	if(item instanceof Platform){
		direct = ShareCore.isDirectShare((Platform) item);
	}else{
		//自定义图标
		direct = true;
	}
	//EditPage Platforms only
	if(direct && directOnlyPosition == -1 && !checkedPositionList.isEmpty())
		return;

	if(checkedPositionList.contains(position)) {
		checkedPositionList.remove(position);
		if(direct)
			directOnlyPosition = -1;
	} else {
		checkedPositionList.add(position);
		if(direct)
			directOnlyPosition = position;
	}

	notifyDataSetChanged();
}
 
Example 2
Source File: PlatformGridViewAdapter.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View view) {
	ViewHolder viewHolder = (ViewHolder) view.getTag();
	Integer position = viewHolder.position;
	//直接分享平台选中后,其它的不可用
	if(directOnlyPosition != -1 && position != directOnlyPosition)
		return;

	Object item = getItem(position);
	boolean direct = false;
	//normal platform
	if(item instanceof Platform){
		direct = ShareCore.isDirectShare((Platform) item);
	}else{
		//自定义图标
		direct = true;
	}
	//EditPage Platforms only
	if(direct && directOnlyPosition == -1 && !checkedPositionList.isEmpty())
		return;

	if(checkedPositionList.contains(position)) {
		checkedPositionList.remove(position);
		if(direct)
			directOnlyPosition = -1;
	} else {
		checkedPositionList.add(position);
		if(direct)
			directOnlyPosition = position;
	}

	notifyDataSetChanged();
}
 
Example 3
Source File: PlatformGridViewAdapter.java    From BigApp_Discuz_Android with Apache License 2.0 4 votes vote down vote up
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
	ViewHolder viewHolder;
	if(view == null) {
		view = LayoutInflater.from(context).inflate(getLayoutRes(context, "skyblue_share_platform_list_item"), null);
		viewHolder = new ViewHolder();
		viewHolder.checkedImageView = (ImageView) view.findViewById(getIdRes(context, "checkedImageView"));
		viewHolder.logoImageView = (ImageView) view.findViewById(getIdRes(context, "logoImageView"));
		viewHolder.nameTextView = (TextView) view.findViewById(getIdRes(context, "nameTextView"));
		view.setTag(viewHolder);
	} else {
		viewHolder = (ViewHolder) view.getTag();
	}

	Bitmap logo;
	String label;
	Object item = getItem(position);
	boolean disabled;
	boolean isDirectShare = item instanceof Platform ? ShareCore.isDirectShare((Platform) item) : true;
	if(directOnlyPosition == -1) {
		disabled = !checkedPositionList.isEmpty() && isDirectShare;
	} else {
		disabled = position != directOnlyPosition;
	}

	if (item instanceof Platform) {
		logo = getIcon((Platform) item, disabled ? "" : "_checked");
		label = getName((Platform) item);
		view.setOnClickListener(this);
	} else {
		CustomerLogo customerLogo = (CustomerLogo) item;
		logo = disabled ? customerLogo.disableLogo : customerLogo.enableLogo;
		label = customerLogo.label;
		view.setOnClickListener(this);
		//TODO 需要整理
	//	view.setOnClickListener(((CustomerLogo) item).listener);
	}
	String checkedResName = directOnlyPosition != -1 && directOnlyPosition != position ? "skyblue_platform_checked_disabled" : "skyblue_platform_checked";
	viewHolder.position = position;
	viewHolder.checkedImageView.setImageBitmap(BitmapFactory.decodeResource(context.getResources(), getBitmapRes(context, checkedResName)));
	viewHolder.checkedImageView.setVisibility(checkedPositionList.contains(viewHolder.position) ? View.VISIBLE : View.GONE);
	viewHolder.nameTextView.setText(label);
	viewHolder.logoImageView.setImageBitmap(logo);

	return view;
}
 
Example 4
Source File: PlatformGridViewAdapter.java    From BigApp_WordPress_Android with Apache License 2.0 4 votes vote down vote up
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
	ViewHolder viewHolder;
	if(view == null) {
		view = LayoutInflater.from(context).inflate(getLayoutRes(context, "skyblue_share_platform_list_item"), null);
		viewHolder = new ViewHolder();
		viewHolder.checkedImageView = (ImageView) view.findViewById(getIdRes(context, "checkedImageView"));
		viewHolder.logoImageView = (ImageView) view.findViewById(getIdRes(context, "logoImageView"));
		viewHolder.nameTextView = (TextView) view.findViewById(getIdRes(context, "nameTextView"));
		view.setTag(viewHolder);
	} else {
		viewHolder = (ViewHolder) view.getTag();
	}

	Bitmap logo;
	String label;
	Object item = getItem(position);
	boolean disabled;
	boolean isDirectShare = item instanceof Platform ? ShareCore.isDirectShare((Platform) item) : true;
	if(directOnlyPosition == -1) {
		disabled = !checkedPositionList.isEmpty() && isDirectShare;
	} else {
		disabled = position != directOnlyPosition;
	}

	if (item instanceof Platform) {
		logo = getIcon((Platform) item, disabled ? "" : "_checked");
		label = getName((Platform) item);
		view.setOnClickListener(this);
	} else {
		CustomerLogo customerLogo = (CustomerLogo) item;
		logo = disabled ? customerLogo.disableLogo : customerLogo.enableLogo;
		label = customerLogo.label;
		view.setOnClickListener(this);
		//TODO 需要整理
	//	view.setOnClickListener(((CustomerLogo) item).listener);
	}
	String checkedResName = directOnlyPosition != -1 && directOnlyPosition != position ? "skyblue_platform_checked_disabled" : "skyblue_platform_checked";
	viewHolder.position = position;
	viewHolder.checkedImageView.setImageBitmap(BitmapFactory.decodeResource(context.getResources(), getBitmapRes(context, checkedResName)));
	viewHolder.checkedImageView.setVisibility(checkedPositionList.contains(viewHolder.position) ? View.VISIBLE : View.GONE);
	viewHolder.nameTextView.setText(label);
	viewHolder.logoImageView.setImageBitmap(logo);

	return view;
}