本文整理汇总了Java中cn.sharesdk.onekeyshare.ShareCore类的典型用法代码示例。如果您正苦于以下问题:Java ShareCore类的具体用法?Java ShareCore怎么用?Java ShareCore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ShareCore类属于cn.sharesdk.onekeyshare包,在下文中一共展示了ShareCore类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AuthAdapter
import cn.sharesdk.onekeyshare.ShareCore; //导入依赖的package包/类
public AuthAdapter(Context context) {
this.context = context;
// 获取平台列表
Platform[] tmp = ShareSDK.getPlatformList();
platforms = new ArrayList<Platform>();
if (tmp == null) {
return;
}
for (Platform p : tmp) {
String name = p.getName();
if ((p instanceof CustomPlatform)
|| !ShareCore.canAuthorize(p.getContext(), name)) {
continue;
}
if (p.getName().equals(Wechat.NAME)){
continue;
}
platforms.add(p);
}
}
示例2: onClick
import cn.sharesdk.onekeyshare.ShareCore; //导入依赖的package包/类
public void onClick(View view) {
Integer position = ((ViewHolder) view.getTag()).position;
if (this.directOnlyPosition == -1 || position.intValue() == this.directOnlyPosition) {
boolean direct;
Object item = getItem(position.intValue());
if (item instanceof Platform) {
direct = ShareCore.isDirectShare((Platform) item);
} else {
direct = true;
}
if (!direct || this.directOnlyPosition != -1 || this.checkedPositionList.isEmpty()) {
if (this.checkedPositionList.contains(position)) {
this.checkedPositionList.remove(position);
if (direct) {
this.directOnlyPosition = -1;
}
} else {
this.checkedPositionList.add(position);
if (direct) {
this.directOnlyPosition = position.intValue();
}
}
notifyDataSetChanged();
}
}
}
示例3: AuthAdapter
import cn.sharesdk.onekeyshare.ShareCore; //导入依赖的package包/类
public AuthAdapter(AuthPage page) {
this.page = page;
// quests platform list
Platform[] tmp = ShareSDK.getPlatformList(page.menu.getContext());
platforms = new ArrayList<Platform>();
if (tmp == null) {
return;
}
for (Platform p : tmp) {
String name = p.getName();
if (!ShareCore.canAuthorize(p.getContext(), name)) {
continue;
}
platforms.add(p);
}
}
示例4: AuthAdapter
import cn.sharesdk.onekeyshare.ShareCore; //导入依赖的package包/类
public AuthAdapter(GetTokenPage page) {
this.page = page;
// request platform list
Platform[] tmp = ShareSDK.getPlatformList(page.activity);
platforms = new ArrayList<Platform>();
if (tmp == null) {
return;
}
for (Platform p : tmp) {
String name = p.getName();
if (!ShareCore.canAuthorize(p.getContext(), name)) {
continue;
}
platforms.add(p);
}
}
示例5: onClick
import cn.sharesdk.onekeyshare.ShareCore; //导入依赖的package包/类
@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();
}
示例6: getView
import cn.sharesdk.onekeyshare.ShareCore; //导入依赖的package包/类
public View getView(int position, View view, ViewGroup viewGroup) {
ViewHolder viewHolder;
Bitmap logo;
String label;
if (view == null) {
view = LayoutInflater.from(this.context).inflate(R.getLayoutRes(this.context, "skyblue_share_platform_list_item"), null);
viewHolder = new ViewHolder();
viewHolder.checkedImageView = (ImageView) view.findViewById(R.getIdRes(this.context, "checkedImageView"));
viewHolder.logoImageView = (ImageView) view.findViewById(R.getIdRes(this.context, "logoImageView"));
viewHolder.nameTextView = (TextView) view.findViewById(R.getIdRes(this.context, "nameTextView"));
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) view.getTag();
}
CustomerLogo item = getItem(position);
boolean disabled = this.directOnlyPosition == -1 ? !this.checkedPositionList.isEmpty() && (item instanceof Platform ? ShareCore.isDirectShare((Platform) item) : true) : position != this.directOnlyPosition;
if (item instanceof Platform) {
logo = getIcon((Platform) item, disabled ? "" : "_checked");
label = getName((Platform) item);
view.setOnClickListener(this);
} else {
CustomerLogo customerLogo = item;
logo = disabled ? customerLogo.disableLogo : customerLogo.enableLogo;
label = customerLogo.label;
view.setOnClickListener(this);
}
String checkedResName = (this.directOnlyPosition == -1 || this.directOnlyPosition == position) ? "skyblue_platform_checked" : "skyblue_platform_checked_disabled";
viewHolder.position = Integer.valueOf(position);
viewHolder.checkedImageView.setImageBitmap(BitmapFactory.decodeResource(this.context.getResources(), R.getBitmapRes(this.context, checkedResName)));
viewHolder.checkedImageView.setVisibility(this.checkedPositionList.contains(viewHolder.position) ? 0 : 8);
viewHolder.nameTextView.setText(label);
viewHolder.logoImageView.setImageBitmap(logo);
return view;
}
示例7: onCreate
import cn.sharesdk.onekeyshare.ShareCore; //导入依赖的package包/类
public void onCreate() {
if (this.shareParamMap == null || this.platforms == null || this.platforms.size() < 1) {
finish();
return;
}
genBackground();
this.activity.setContentView(getPageView());
onTextChanged(this.etContent.getText(), 0, this.etContent.length(), 0);
showThumb();
new Thread() {
public void run() {
try {
EditPage.this.platformList = ShareSDK.getPlatformList();
if (EditPage.this.platformList != null) {
ArrayList<Platform> list = new ArrayList();
for (Platform plat : EditPage.this.platformList) {
String name = plat.getName();
if (!((plat instanceof CustomPlatform) || ShareCore.isUseClientToShare(name))) {
list.add(plat);
}
}
EditPage.this.platformList = new Platform[list.size()];
for (int i = 0; i < EditPage.this.platformList.length; i++) {
EditPage.this.platformList[i] = (Platform) list.get(i);
}
UIHandler.sendEmptyMessage(1, new Callback() {
public boolean handleMessage(Message msg) {
EditPage.this.afterPlatformListGot();
return false;
}
});
}
} catch (Throwable t) {
t.printStackTrace();
}
}
}.start();
}
示例8: afterPlatformsGot
import cn.sharesdk.onekeyshare.ShareCore; //导入依赖的package包/类
private void afterPlatformsGot(Platform[] platforms) {
View pageView = getPage();
LinearLayout llList = (LinearLayout) pageView.findViewById(R.id.llList);
LinearLayout line = (LinearLayout) View.inflate(menu.getContext(),
R.layout.demo_page_item, null);
llList.addView(line);
int lineCount = 0;
for (Platform platform : platforms) {
String name = platform.getName();
if (ShareCore.isUseClientToShare(platform.getContext(), name)) {
continue;
}
if (lineCount >= 2) {
// place tow buttons in each line
line = (LinearLayout) View.inflate(menu.getContext(),
R.layout.demo_page_item, null);
llList.addView(line);
lineCount = 0;
}
// initiate buttons
int res = lineCount == 0 ? R.id.btnLeft : R.id.btnRight;
Button btn = (Button) line.findViewById(res);
btn.setSingleLine();
int platNameRes = cn.sharesdk.framework.utils.R.getStringRes(
menu.getContext(), name);
String platName = menu.getContext().getString(platNameRes);
String text = menu.getContext().getString(R.string.share_to_format, platName);
btn.setText(text);
btn.setTag(platform);
btn.setVisibility(View.VISIBLE);
btn.setOnClickListener(this);
lineCount++;
}
}
示例9: getView
import cn.sharesdk.onekeyshare.ShareCore; //导入依赖的package包/类
@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;
}
示例10: onCreate
import cn.sharesdk.onekeyshare.ShareCore; //导入依赖的package包/类
public void onCreate() {
if (shareParamMap == null || platforms == null || platforms.size() < 1) {
finish();
return;
}
genBackground();
activity.setContentView(getPageView());
onTextChanged(etContent.getText(), 0, etContent.length(), 0);
showThumb();
// requests platform list and remove platforms share in their clients
new Thread(){
public void run() {
try {
platformList = ShareSDK.getPlatformList();
if (platformList == null) {
return;
}
ArrayList<Platform> list = new ArrayList<Platform>();
for (Platform plat : platformList) {
String name = plat.getName();
if ((plat instanceof CustomPlatform)
|| ShareCore.isUseClientToShare(name)) {
continue;
}
list.add(plat);
}
platformList = new Platform[list.size()];
for (int i = 0; i < platformList.length; i++) {
platformList[i] = list.get(i);
}
UIHandler.sendEmptyMessage(1, new Callback() {
public boolean handleMessage(Message msg) {
afterPlatformListGot();
return false;
}
});
} catch (Throwable t) {
t.printStackTrace();
}
}
}.start();
}
示例11: getView
import cn.sharesdk.onekeyshare.ShareCore; //导入依赖的package包/类
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
ViewHolder viewHolder;
if(view == null) {
view = LayoutInflater.from(context).inflate(getLayoutRes(context, "ssdk_oks_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 ? "ssdk_oks_skyblue_platform_checked_disabled" : "ssdk_oks_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;
}
示例12: onCreate
import cn.sharesdk.onekeyshare.ShareCore; //导入依赖的package包/类
public void onCreate() {
if (shareParamMap == null || platforms == null || platforms.size() < 1) {
finish();
return;
}
getBackground();
activity.setContentView(getPageView());
onTextChanged(etContent.getText(), 0, etContent.length(), 0);
showThumb();
// requests platform list and remove platforms share in their clients
new Thread(){
public void run() {
try {
platformList = ShareSDK.getPlatformList();
if (platformList == null) {
return;
}
ArrayList<Platform> list = new ArrayList<Platform>();
for (Platform plat : platformList) {
String name = plat.getName();
if ((plat instanceof CustomPlatform)
|| ShareCore.isUseClientToShare(name)) {
continue;
}
list.add(plat);
}
platformList = new Platform[list.size()];
for (int i = 0; i < platformList.length; i++) {
platformList[i] = list.get(i);
}
UIHandler.sendEmptyMessage(1, new Callback() {
public boolean handleMessage(Message msg) {
afterPlatformListGot();
return false;
}
});
} catch (Throwable t) {
t.printStackTrace();
}
}
}.start();
}
示例13: onCreate
import cn.sharesdk.onekeyshare.ShareCore; //导入依赖的package包/类
public void onCreate() {
if (shareParamMap == null || platforms == null || platforms.size() < 1) {
finish();
return;
}
genBackground();
activity.setContentView(getPageView());
onTextChanged(etContent.getText(), 0, etContent.length(), 0);
showThumb();
// requests platform list and remove platforms share in their clients
new Thread(){
public void run() {
platformList = ShareSDK.getPlatformList();
if (platformList == null) {
return;
}
ArrayList<Platform> list = new ArrayList<Platform>();
for (Platform plat : platformList) {
String name = plat.getName();
if ((plat instanceof CustomPlatform)
|| ShareCore.isUseClientToShare(name)) {
continue;
}
list.add(plat);
}
platformList = new Platform[list.size()];
for (int i = 0; i < platformList.length; i++) {
platformList[i] = list.get(i);
}
UIHandler.sendEmptyMessage(1, new Callback() {
public boolean handleMessage(Message msg) {
afterPlatformListGot();
return false;
}
});
}
}.start();
}