diff --git a/app/libs/MobCommons-2016.0426.1819.jar b/app/libs/MobCommons-2016.0426.1819.jar new file mode 100644 index 0000000000..0d89338cbd Binary files /dev/null and b/app/libs/MobCommons-2016.0426.1819.jar differ diff --git a/app/libs/MobTools-2016.0426.1819.jar b/app/libs/MobTools-2016.0426.1819.jar new file mode 100644 index 0000000000..88e164e813 Binary files /dev/null and b/app/libs/MobTools-2016.0426.1819.jar differ diff --git a/app/libs/MobTools.jar b/app/libs/MobTools.jar deleted file mode 100644 index c27145ed4c..0000000000 Binary files a/app/libs/MobTools.jar and /dev/null differ diff --git a/app/libs/ShareSDK-Core-2.6.0.jar b/app/libs/ShareSDK-Core-2.6.0.jar deleted file mode 100644 index e809c414f9..0000000000 Binary files a/app/libs/ShareSDK-Core-2.6.0.jar and /dev/null differ diff --git a/app/libs/ShareSDK-Core-2.7.2.jar b/app/libs/ShareSDK-Core-2.7.2.jar new file mode 100644 index 0000000000..d247c0f7a1 Binary files /dev/null and b/app/libs/ShareSDK-Core-2.7.2.jar differ diff --git a/app/libs/ShareSDK-QQ-2.6.0.jar b/app/libs/ShareSDK-QQ-2.6.0.jar deleted file mode 100644 index a2a092b25d..0000000000 Binary files a/app/libs/ShareSDK-QQ-2.6.0.jar and /dev/null differ diff --git a/app/libs/ShareSDK-QQ-2.7.2.jar b/app/libs/ShareSDK-QQ-2.7.2.jar new file mode 100644 index 0000000000..a33586f01f Binary files /dev/null and b/app/libs/ShareSDK-QQ-2.7.2.jar differ diff --git a/app/libs/ShareSDK-QZone-2.6.0.jar b/app/libs/ShareSDK-QZone-2.6.0.jar deleted file mode 100644 index 9c3a501049..0000000000 Binary files a/app/libs/ShareSDK-QZone-2.6.0.jar and /dev/null differ diff --git a/app/libs/ShareSDK-QZone-2.7.2.jar b/app/libs/ShareSDK-QZone-2.7.2.jar new file mode 100644 index 0000000000..954f7ad6aa Binary files /dev/null and b/app/libs/ShareSDK-QZone-2.7.2.jar differ diff --git a/app/libs/ShareSDK-SinaWeibo-2.6.0.jar b/app/libs/ShareSDK-SinaWeibo-2.6.0.jar deleted file mode 100644 index 6afdd00fe1..0000000000 Binary files a/app/libs/ShareSDK-SinaWeibo-2.6.0.jar and /dev/null differ diff --git a/app/libs/ShareSDK-SinaWeibo-2.7.2.jar b/app/libs/ShareSDK-SinaWeibo-2.7.2.jar new file mode 100644 index 0000000000..d31d36360a Binary files /dev/null and b/app/libs/ShareSDK-SinaWeibo-2.7.2.jar differ diff --git a/app/libs/ShareSDK-Wechat-Core-2.7.2.jar b/app/libs/ShareSDK-Wechat-Core-2.7.2.jar new file mode 100644 index 0000000000..b10481cee6 Binary files /dev/null and b/app/libs/ShareSDK-Wechat-Core-2.7.2.jar differ diff --git a/app/libs/ShareSDK-Wechat-Moments-2.7.2.jar b/app/libs/ShareSDK-Wechat-Moments-2.7.2.jar new file mode 100644 index 0000000000..f113d631d6 Binary files /dev/null and b/app/libs/ShareSDK-Wechat-Moments-2.7.2.jar differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 61d2a3c05a..92c2c4083c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -99,6 +99,12 @@ + + // + diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/EditPageFakeActivity.java b/app/src/main/java/cn/sharesdk/onekeyshare/EditPageFakeActivity.java deleted file mode 100644 index 25c4087e1b..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/EditPageFakeActivity.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - -package cn.sharesdk.onekeyshare; - - -import android.graphics.Bitmap; -import android.os.AsyncTask; -import android.text.TextUtils; -import android.view.View; -import android.widget.Toast; - -import com.mob.tools.FakeActivity; -import com.mob.tools.utils.BitmapHelper; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import cn.sharesdk.framework.Platform; -import cn.sharesdk.framework.ShareSDK; - -import static com.mob.tools.utils.R.getStringRes; - -public class EditPageFakeActivity extends FakeActivity { - - protected List platforms; - - protected HashMap shareParamMap; - // 设置显示模式为Dialog模式 - protected boolean dialogMode; - protected View backgroundView; - protected ArrayList toFriendList; - private ArrayList shareImageList; - - public static class ImageInfo { - public String paramName; - public String srcValue; - public Bitmap bitmap; - } - - protected static interface ImageListResultsCallback { - void onFinish(ArrayList results); - } - - public void setShareData(HashMap data) { - shareParamMap = data; - } - - /** 设置显示模式为Dialog模式 */ - public void setDialogMode() { - dialogMode = true; - } - - /** - * @param bgView - */ - public void setBackgroundView(View bgView) { - this.backgroundView = bgView; - } - - public void setPlatforms(List supportEditPagePlatforms) { - this.platforms = supportEditPagePlatforms; - } - - public String getLogoName(String platform) { - if (platform == null) { - return ""; - } - - int resId = getStringRes(getContext(), platform); - return getContext().getString(resId); - } - - protected boolean isShowAtUserLayout(String platformName) { - return "SinaWeibo".equals(platformName) || "TencentWeibo".equals(platformName) - || "Facebook".equals(platformName) || "Twitter".equals(platformName) - || "FacebookMessenger".equals(platformName); - } - - protected String getAtUserButtonText(String platform) { - return "FacebookMessenger".equals(platform) ? "To" : "@"; - } - - protected String getJoinSelectedUser(HashMap data) { - if (data != null && data.containsKey("selected")) { - @SuppressWarnings("unchecked") - ArrayList selected = (ArrayList) data.get("selected"); - String platform = ((Platform)data.get("platform")).getName(); - if("FacebookMessenger".equals(platform)) { - toFriendList = selected; - return null; - } - StringBuilder sb = new StringBuilder(); - for (String sel : selected) { - sb.append('@').append(sel).append(' '); - } - return sb.toString(); - } - return null; - } - - public boolean haveImage(){ - String imageUrl = (String) shareParamMap.get("imageUrl"); - String imagePath = (String) shareParamMap.get("imagePath"); - Bitmap viewToShare = (Bitmap) shareParamMap.get("viewToShare"); - String[] imageArray = (String[]) shareParamMap.get("imageArray"); - - if(!TextUtils.isEmpty(imagePath) && new File(imagePath).exists()) { - return true; - } else if(viewToShare != null && !viewToShare.isRecycled()){ - return true; - } else if (!TextUtils.isEmpty(imageUrl)) { - return true; - } else if(imageArray != null && imageArray.length > 0) { - return true; - } - - return false; - } - - protected boolean initImageList(ImageListResultsCallback callback) { - String imageUrl = (String) shareParamMap.get("imageUrl"); - String imagePath = (String) shareParamMap.get("imagePath"); - Bitmap viewToShare = (Bitmap) shareParamMap.get("viewToShare"); - String[] imageArray = (String[]) shareParamMap.get("imageArray"); - - shareImageList = new ArrayList(); - if(!TextUtils.isEmpty(imagePath) && new File(imagePath).exists()) { - ImageInfo imageInfo = new ImageInfo(); - imageInfo.paramName = "imagePath"; - imageInfo.srcValue = imagePath; - shareImageList.add(imageInfo); - shareParamMap.remove("imagePath"); - } else if(viewToShare != null && !viewToShare.isRecycled()){ - ImageInfo imageInfo = new ImageInfo(); - imageInfo.paramName = "viewToShare"; - imageInfo.bitmap = viewToShare; - shareImageList.add(imageInfo); - shareParamMap.remove("viewToShare"); - } else if (!TextUtils.isEmpty(imageUrl)) { - ImageInfo imageInfo = new ImageInfo(); - imageInfo.paramName = "imageUrl"; - imageInfo.srcValue = imageUrl; - shareImageList.add(imageInfo); - shareParamMap.remove("imageUrl"); - } else if(imageArray != null && imageArray.length > 0) { - for(String imageUri : imageArray) { - if(TextUtils.isEmpty(imageUri)) - continue; - ImageInfo imageInfo = new ImageInfo(); - imageInfo.paramName = "imageArray"; - imageInfo.srcValue = imageUri; - shareImageList.add(imageInfo); - } - shareParamMap.remove("imageArray"); - } - - if(shareImageList.size() == 0) { - return false; - } - - new AsyncTask() { - @Override - protected ImageListResultsCallback doInBackground(Object... objects) { - for(ImageInfo imageInfo : shareImageList) { - if(imageInfo.bitmap == null) { - try{ - Bitmap bitmap; - String uri = imageInfo.srcValue; - if(uri.startsWith("http://") || uri.startsWith("https://")) { - uri = BitmapHelper.downloadBitmap(activity, uri); - } - bitmap = BitmapHelper.getBitmap(uri); - if(bitmap == null) - continue; - - imageInfo.bitmap = bitmap; - } catch (Throwable e) { - e.printStackTrace(); - } - } - } - return (ImageListResultsCallback) objects[0]; - } - - @Override - protected void onPostExecute(ImageListResultsCallback callback1) { - callback1.onFinish(shareImageList); - } - }.execute(callback); - return true; - } - - protected void removeImage(ImageInfo imageInfo) { - if(shareImageList == null || imageInfo == null) - return; - shareImageList.remove(imageInfo); - } - - protected void setResultAndFinish() { - ArrayList imageArray = new ArrayList(); - 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> editRes = new HashMap>(); - - for(Platform platform : platforms) { - - if("FacebookMessenger".equals(platform.getName())) { - HashMap param = new HashMap(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 res = new HashMap(); - res.put("editRes", editRes); - setResult(res); - finish(); - } - - @Override - public boolean onFinish() { - shareImageList = null; - return super.onFinish(); - } -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/FollowerListFakeActivity.java b/app/src/main/java/cn/sharesdk/onekeyshare/FollowerListFakeActivity.java deleted file mode 100644 index 02b2837d34..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/FollowerListFakeActivity.java +++ /dev/null @@ -1,168 +0,0 @@ -package cn.sharesdk.onekeyshare; - -import com.mob.tools.FakeActivity; - -import java.util.ArrayList; -import java.util.HashMap; - -import cn.sharesdk.framework.Platform; - -public class FollowerListFakeActivity extends FakeActivity { - protected Platform platform; - - public void setPlatform(Platform platform) { - this.platform = platform; - } - - public Platform getPlatform() { - return platform; - } - - public boolean isRadioMode(String platformName) { - return "FacebookMessenger".equals(platformName); - } - - public void setResultForChecked(ArrayList checked) { - HashMap res = new HashMap(); - res.put("selected", checked); - res.put("platform", platform); - setResult(res); - } - - public static class Following { - public boolean checked; - public String screenName; - public String description; - public String uid; - public String icon; - //@Name 用于微博等提示或关联某个人 - public String atName; - } - - public static class FollowersResult { - public ArrayList list; - public boolean hasNextPage = false; - } - - public static FollowersResult parseFollowers(String platformName, HashMap res, HashMap uidMap) { - if (res == null || res.size() <= 0) { - return null; - } - - boolean hasNext = false; - ArrayList data = new ArrayList(); - if ("SinaWeibo".equals(platformName)) { - // users[id, name, description] - @SuppressWarnings("unchecked") - ArrayList> users - = (ArrayList>) res.get("users"); - for (HashMap user : users) { - String uid = String.valueOf(user.get("id")); - if (!uidMap.containsKey(uid)) { - Following following = new Following(); - following.uid = uid; - following.screenName = String.valueOf(user.get("name")); - following.description = String.valueOf(user.get("description")); - following.icon = String.valueOf(user.get("profile_image_url")); - following.atName = following.screenName; - uidMap.put(following.uid, true); - data.add(following); - } - } - hasNext = (Integer) res.get("total_number") > uidMap.size(); - } - else if ("TencentWeibo".equals(platformName)) { - hasNext = ((Integer)res.get("hasnext") == 0); - // info[nick, name, tweet[text]] - @SuppressWarnings("unchecked") - ArrayList> infos - = (ArrayList>) res.get("info"); - for (HashMap info : infos) { - String uid = String.valueOf(info.get("name")); - if (!uidMap.containsKey(uid)) { - Following following = new Following(); - following.screenName = String.valueOf(info.get("nick")); - following.uid = uid; - following.atName = uid; - @SuppressWarnings("unchecked") - ArrayList> tweets = (ArrayList>) info.get("tweet"); - for (HashMap tweet : tweets) { - following.description = String.valueOf(tweet.get("text")); - break; - } - following.icon = String.valueOf(info.get("head")) + "/100"; - uidMap.put(following.uid, true); - data.add(following); - } - } - } - else if ("Facebook".equals(platformName)) { - // data[id, name] - @SuppressWarnings("unchecked") - ArrayList> datas - = (ArrayList>) res.get("data"); - for (HashMap d : datas) { - String uid = String.valueOf(d.get("id")); - if (!uidMap.containsKey(uid)) { - Following following = new Following(); - following.uid = uid; - following.atName = "["+uid+"]"; - following.screenName = String.valueOf(d.get("name")); - @SuppressWarnings("unchecked") - HashMap picture = (HashMap) d.get("picture"); - if (picture != null) { - @SuppressWarnings("unchecked") - HashMap pData = (HashMap) picture.get("data"); - following.icon = String.valueOf(pData.get("url")); - } - uidMap.put(following.uid, true); - data.add(following); - } - } - @SuppressWarnings("unchecked") - HashMap paging = (HashMap) res.get("paging"); - hasNext = paging.containsKey("next"); - } - else if ("Twitter".equals(platformName)) { - // users[screen_name, name, description] - @SuppressWarnings("unchecked") - ArrayList> users - = (ArrayList>) res.get("users"); - for (HashMap user : users) { - String uid = String.valueOf(user.get("screen_name")); - if (!uidMap.containsKey(uid)) { - Following following = new Following(); - following.uid = uid; - following.atName = uid; - following.screenName = String.valueOf(user.get("name")); - following.description = String.valueOf(user.get("description")); - following.icon = String.valueOf(user.get("profile_image_url")); - uidMap.put(following.uid, true); - data.add(following); - } - } - } - else if ("FacebookMessenger".equals(platformName)) { - @SuppressWarnings("unchecked") - ArrayList> users - = (ArrayList>) res.get("users"); - for (HashMap user : users) { - String userAddr = String.valueOf(user.get("jid")); - if (!uidMap.containsKey(userAddr)) { - Following following = new Following(); - following.uid = userAddr; - following.atName = userAddr; - following.screenName = String.valueOf(user.get("name")); - uidMap.put(following.uid, true); - data.add(following); - } - } - hasNext = false; - } - - FollowersResult ret = new FollowersResult(); - ret.list = data; - ret.hasNextPage = hasNext; - return ret; - } -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/OnekeyShare.java b/app/src/main/java/cn/sharesdk/onekeyshare/OnekeyShare.java deleted file mode 100644 index 12d1bd2eff..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/OnekeyShare.java +++ /dev/null @@ -1,602 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - -package cn.sharesdk.onekeyshare; - -import android.app.NotificationManager; -import android.content.Context; -import android.graphics.Bitmap; -import android.os.Handler.Callback; -import android.os.Message; -import android.text.TextUtils; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.Toast; - -import com.mob.tools.utils.UIHandler; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map.Entry; - -import cn.sharesdk.framework.CustomPlatform; -import cn.sharesdk.framework.Platform; -import cn.sharesdk.framework.PlatformActionListener; -import cn.sharesdk.framework.ShareSDK; - -import static com.mob.tools.utils.BitmapHelper.captureView; -import static com.mob.tools.utils.R.getStringRes; - -/** - * 快捷分享的入口 - *

- * 通过不同的setter设置参数,然后调用{@link #show(Context)}方法启动快捷分享 - */ -public class OnekeyShare implements PlatformActionListener, Callback { - private static final int MSG_TOAST = 1; - private static final int MSG_ACTION_CCALLBACK = 2; - private static final int MSG_CANCEL_NOTIFY = 3; - - private HashMap shareParamsMap; - private ArrayList customers; - private boolean silent; - private PlatformActionListener callback; - private ShareContentCustomizeCallback customizeCallback; - private boolean dialogMode = false; - private boolean disableSSO; - private HashMap hiddenPlatforms; - private View bgView; - private OnekeyShareTheme theme; - - private Context context; - private PlatformListFakeActivity.OnShareButtonClickListener onShareButtonClickListener; - - public OnekeyShare() { - shareParamsMap = new HashMap(); - customers = new ArrayList(); - callback = this; - hiddenPlatforms = new HashMap(); - } - - public void show(Context context) { - ShareSDK.initSDK(context); - this.context = context; - - // 打开分享菜单的统计 - ShareSDK.logDemoEvent(1, null); - - // 显示方式是由platform和silent两个字段控制的 - // 如果platform设置了,则无须显示九宫格,否则都会显示; - // 如果silent为true,表示不进入编辑页面,否则会进入。 - // 本类只判断platform,因为九宫格显示以后,事件交给PlatformGridView控制 - // 当platform和silent都为true,则直接进入分享; - // 当platform设置了,但是silent为false,则判断是否是“使用客户端分享”的平台, - // 若为“使用客户端分享”的平台,则直接分享,否则进入编辑页面 - if (shareParamsMap.containsKey("platform")) { - String name = String.valueOf(shareParamsMap.get("platform")); - Platform platform = ShareSDK.getPlatform(name); - - if (silent - || ShareCore.isUseClientToShare(name) - || platform instanceof CustomPlatform - ) { - HashMap> shareData - = new HashMap>(); - shareData.put(ShareSDK.getPlatform(name), shareParamsMap); - share(shareData); - return; - } - } - - PlatformListFakeActivity platformListFakeActivity; - try { - if(OnekeyShareTheme.SKYBLUE == theme){ - platformListFakeActivity = (PlatformListFakeActivity) Class.forName("cn.sharesdk.onekeyshare.theme.skyblue.PlatformListPage").newInstance(); - }else{ - platformListFakeActivity = (PlatformListFakeActivity) Class.forName("cn.sharesdk.onekeyshare.theme.classic.PlatformListPage").newInstance(); - } - } catch (Exception e) { - e.printStackTrace(); - return; - } - - platformListFakeActivity.setDialogMode(dialogMode); - platformListFakeActivity.setShareParamsMap(shareParamsMap); - platformListFakeActivity.setSilent(silent); - platformListFakeActivity.setCustomerLogos(customers); - platformListFakeActivity.setBackgroundView(bgView); - platformListFakeActivity.setHiddenPlatforms(hiddenPlatforms); - platformListFakeActivity.setOnShareButtonClickListener(onShareButtonClickListener); - platformListFakeActivity.setThemeShareCallback(new ThemeShareCallback() { - - @Override - public void doShare(HashMap> shareData) { - share(shareData); - } - }); - if (shareParamsMap.containsKey("platform")) { - String name = String.valueOf(shareParamsMap.get("platform")); - Platform platform = ShareSDK.getPlatform(name); - platformListFakeActivity.showEditPage(context, platform); - return; - } - platformListFakeActivity.show(context, null); - } - - public void setTheme(OnekeyShareTheme theme) { - this.theme = theme; - } - - /** address是接收人地址,仅在信息和邮件使用,否则可以不提供 */ - public void setAddress(String address) { - shareParamsMap.put("address", address); - } - - /** - * title标题,在印象笔记、邮箱、信息、微信(包括好友、朋友圈和收藏)、 - * 易信(包括好友、朋友圈)、人人网和QQ空间使用,否则可以不提供 - */ - public void setTitle(String title) { - shareParamsMap.put("title", title); - } - - /** titleUrl是标题的网络链接,仅在人人网和QQ空间使用,否则可以不提供 */ - public void setTitleUrl(String titleUrl) { - shareParamsMap.put("titleUrl", titleUrl); - } - - /** text是分享文本,所有平台都需要这个字段 */ - public void setText(String text) { - shareParamsMap.put("text", text); - } - - /** 获取text字段的值 */ - public String getText() { - return shareParamsMap.containsKey("text") ? String.valueOf(shareParamsMap.get("text")) : null; - } - - /** imagePath是本地的图片路径,除Linked-In外的所有平台都支持这个字段 */ - public void setImagePath(String imagePath) { - if(!TextUtils.isEmpty(imagePath)) - shareParamsMap.put("imagePath", imagePath); - } - - /** imageUrl是图片的网络路径,新浪微博、人人网、QQ空间和Linked-In支持此字段 */ - public void setImageUrl(String imageUrl) { - if (!TextUtils.isEmpty(imageUrl)) - shareParamsMap.put("imageUrl", imageUrl); - } - - /** url在微信(包括好友、朋友圈收藏)和易信(包括好友和朋友圈)中使用,否则可以不提供 */ - public void setUrl(String url) { - shareParamsMap.put("url", url); - } - - /** filePath是待分享应用程序的本地路劲,仅在微信(易信)好友和Dropbox中使用,否则可以不提供 */ - public void setFilePath(String filePath) { - shareParamsMap.put("filePath", filePath); - } - - /** comment是我对这条分享的评论,仅在人人网和QQ空间使用,否则可以不提供 */ - public void setComment(String comment) { - shareParamsMap.put("comment", comment); - } - - /** site是分享此内容的网站名称,仅在QQ空间使用,否则可以不提供 */ - public void setSite(String site) { - shareParamsMap.put("site", site); - } - - /** siteUrl是分享此内容的网站地址,仅在QQ空间使用,否则可以不提供 */ - public void setSiteUrl(String siteUrl) { - shareParamsMap.put("siteUrl", siteUrl); - } - - /** foursquare分享时的地方名 */ - public void setVenueName(String venueName) { - shareParamsMap.put("venueName", venueName); - } - - /** foursquare分享时的地方描述 */ - public void setVenueDescription(String venueDescription) { - shareParamsMap.put("venueDescription", venueDescription); - } - - /** 分享地纬度,新浪微博、腾讯微博和foursquare支持此字段 */ - public void setLatitude(float latitude) { - shareParamsMap.put("latitude", latitude); - } - - /** 分享地经度,新浪微博、腾讯微博和foursquare支持此字段 */ - public void setLongitude(float longitude) { - shareParamsMap.put("longitude", longitude); - } - - /** 是否直接分享 */ - public void setSilent(boolean silent) { - this.silent = silent; - } - - /** 设置编辑页的初始化选中平台 */ - public void setPlatform(String platform) { - shareParamsMap.put("platform", platform); - } - - /** 设置KakaoTalk的应用下载地址 */ - public void setInstallUrl(String installurl) { - shareParamsMap.put("installurl", installurl); - } - - /** 设置KakaoTalk的应用打开地址 */ - public void setExecuteUrl(String executeurl) { - shareParamsMap.put("executeurl", executeurl); - } - - /** 设置微信分享的音乐的地址 */ - public void setMusicUrl(String musicUrl) { - shareParamsMap.put("musicUrl", musicUrl); - } - - /** 设置自定义的外部回调 */ - public void setCallback(PlatformActionListener callback) { - this.callback = callback; - } - - /** 返回操作回调 */ - public PlatformActionListener getCallback() { - return callback; - } - - /** 设置用于分享过程中,根据不同平台自定义分享内容的回调 */ - public void setShareContentCustomizeCallback(ShareContentCustomizeCallback callback) { - customizeCallback = callback; - } - - /** 返回自定义分享内容的回调 */ - public ShareContentCustomizeCallback getShareContentCustomizeCallback() { - return customizeCallback; - } - - /** 设置自己图标和点击事件,可以重复调用添加多次 */ - public void setCustomerLogo(Bitmap enableLogo,Bitmap disableLogo, String label, OnClickListener ocListener) { - CustomerLogo cl = new CustomerLogo(); - cl.label = label; - cl.enableLogo = enableLogo; - cl.disableLogo = disableLogo; - cl.listener = ocListener; - customers.add(cl); - } - - /** 设置一个总开关,用于在分享前若需要授权,则禁用sso功能 */ - public void disableSSOWhenAuthorize() { - disableSSO = true; - } - - /** 设置编辑页面的显示模式为Dialog模式 */ - public void setDialogMode() { - dialogMode = true; - shareParamsMap.put("dialogMode", dialogMode); - } - - /** 添加一个隐藏的platform */ - public void addHiddenPlatform(String platform) { - hiddenPlatforms.put(platform, platform); - } - - /** 设置一个将被截图分享的View , surfaceView是截不了图片的*/ - public void setViewToShare(View viewToShare) { - try { - Bitmap bm = captureView(viewToShare, viewToShare.getWidth(), viewToShare.getHeight()); - shareParamsMap.put("viewToShare", bm); - } catch (Throwable e) { - e.printStackTrace(); - } - } - - /** 腾讯微博分享多张图片 */ - public void setImageArray(String[] imageArray) { - shareParamsMap.put("imageArray", imageArray); - } - - public void setEditPageBackground(View bgView) { - this.bgView = bgView; - } - - public void setOnShareButtonClickListener(PlatformListFakeActivity.OnShareButtonClickListener onShareButtonClickListener) { - this.onShareButtonClickListener = onShareButtonClickListener; - } - - /** 循环执行分享 */ - public void share(HashMap> shareData) { - boolean started = false; - for (Entry> ent : shareData.entrySet()) { - Platform plat = ent.getKey(); - plat.SSOSetting(disableSSO); - String name = plat.getName(); - -// boolean isGooglePlus = "GooglePlus".equals(name); -// if (isGooglePlus && !plat.isValid()) { -// Message msg = new Message(); -// msg.what = MSG_TOAST; -// int resId = getStringRes(context, "google_plus_client_inavailable"); -// msg.obj = context.getString(resId); -// UIHandler.sendMessage(msg, this); -// continue; -// } - - boolean isKakaoTalk = "KakaoTalk".equals(name); - if (isKakaoTalk && !plat.isClientValid()) { - Message msg = new Message(); - msg.what = MSG_TOAST; - int resId = getStringRes(context, "kakaotalk_client_inavailable"); - msg.obj = context.getString(resId); - UIHandler.sendMessage(msg, this); - continue; - } - - boolean isKakaoStory = "KakaoStory".equals(name); - if (isKakaoStory && !plat.isClientValid()) { - Message msg = new Message(); - msg.what = MSG_TOAST; - int resId = getStringRes(context, "kakaostory_client_inavailable"); - msg.obj = context.getString(resId); - UIHandler.sendMessage(msg, this); - continue; - } - - boolean isLine = "Line".equals(name); - if (isLine && !plat.isClientValid()) { - Message msg = new Message(); - msg.what = MSG_TOAST; - int resId = getStringRes(context, "line_client_inavailable"); - msg.obj = context.getString(resId); - UIHandler.sendMessage(msg, this); - continue; - } - - boolean isWhatsApp = "WhatsApp".equals(name); - if (isWhatsApp && !plat.isClientValid()) { - Message msg = new Message(); - msg.what = MSG_TOAST; - int resId = getStringRes(context, "whatsapp_client_inavailable"); - msg.obj = context.getString(resId); - UIHandler.sendMessage(msg, this); - continue; - } - - boolean isPinterest = "Pinterest".equals(name); - if (isPinterest && !plat.isClientValid()) { - Message msg = new Message(); - msg.what = MSG_TOAST; - int resId = getStringRes(context, "pinterest_client_inavailable"); - msg.obj = context.getString(resId); - UIHandler.sendMessage(msg, this); - continue; - } - - if ("Instagram".equals(name) && !plat.isClientValid()) { - Message msg = new Message(); - msg.what = MSG_TOAST; - int resId = getStringRes(context, "instagram_client_inavailable"); - msg.obj = context.getString(resId); - UIHandler.sendMessage(msg, this); - continue; - } - - boolean isLaiwang = "Laiwang".equals(name); - boolean isLaiwangMoments = "LaiwangMoments".equals(name); - if(isLaiwang || isLaiwangMoments){ - if (!plat.isClientValid()) { - Message msg = new Message(); - msg.what = MSG_TOAST; - int resId = getStringRes(context, "laiwang_client_inavailable"); - msg.obj = context.getString(resId); - UIHandler.sendMessage(msg, this); - continue; - } - } - - boolean isYixin = "YixinMoments".equals(name) || "Yixin".equals(name); - if (isYixin && !plat.isClientValid()) { - Message msg = new Message(); - msg.what = MSG_TOAST; - int resId = getStringRes(context, "yixin_client_inavailable"); - msg.obj = context.getString(resId); - UIHandler.sendMessage(msg, this); - continue; - } - - HashMap data = ent.getValue(); - int shareType = Platform.SHARE_TEXT; - String imagePath = String.valueOf(data.get("imagePath")); - if (imagePath != null && (new File(imagePath)).exists()) { - shareType = Platform.SHARE_IMAGE; - if (imagePath.endsWith(".gif")) { - shareType = Platform.SHARE_EMOJI; - } else if (data.containsKey("url") && !TextUtils.isEmpty(data.get("url").toString())) { - shareType = Platform.SHARE_WEBPAGE; - if (data.containsKey("musicUrl") && !TextUtils.isEmpty(data.get("musicUrl").toString())) { - shareType = Platform.SHARE_MUSIC; - } - } - } else { - Bitmap viewToShare = (Bitmap) data.get("viewToShare"); - if (viewToShare != null && !viewToShare.isRecycled()) { - shareType = Platform.SHARE_IMAGE; - if (data.containsKey("url") && !TextUtils.isEmpty(data.get("url").toString())) { - shareType = Platform.SHARE_WEBPAGE; - if (data.containsKey("musicUrl") && !TextUtils.isEmpty(data.get("musicUrl").toString())) { - shareType = Platform.SHARE_MUSIC; - } - } - } else { - Object imageUrl = data.get("imageUrl"); - if (imageUrl != null && !TextUtils.isEmpty(String.valueOf(imageUrl))) { - shareType = Platform.SHARE_IMAGE; - if (String.valueOf(imageUrl).endsWith(".gif")) { - shareType = Platform.SHARE_EMOJI; - } else if (data.containsKey("url") && !TextUtils.isEmpty(data.get("url").toString())) { - shareType = Platform.SHARE_WEBPAGE; - if (data.containsKey("musicUrl") && !TextUtils.isEmpty(data.get("musicUrl").toString())) { - shareType = Platform.SHARE_MUSIC; - } - } - } - } - } - data.put("shareType", shareType); - - if (!started) { - started = true; -// if (this == callback) { - int resId = getStringRes(context, "sharing"); - if (resId > 0) { - showNotification(context.getString(resId)); - } -// } - } - plat.setPlatformActionListener(callback); - ShareCore shareCore = new ShareCore(); - shareCore.setShareContentCustomizeCallback(customizeCallback); - shareCore.share(plat, data); - } - } - - public void onComplete(Platform platform, int action, - HashMap res) { - Message msg = new Message(); - msg.what = MSG_ACTION_CCALLBACK; - msg.arg1 = 1; - msg.arg2 = action; - msg.obj = platform; - UIHandler.sendMessage(msg, this); - } - - public void onError(Platform platform, int action, Throwable t) { - t.printStackTrace(); - - Message msg = new Message(); - msg.what = MSG_ACTION_CCALLBACK; - msg.arg1 = 2; - msg.arg2 = action; - msg.obj = t; - UIHandler.sendMessage(msg, this); - - // 分享失败的统计 - ShareSDK.logDemoEvent(4, platform); - } - - 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); - } - - public boolean handleMessage(Message msg) { - switch(msg.what) { - case MSG_TOAST: { - String text = String.valueOf(msg.obj); - Toast.makeText(context, text, Toast.LENGTH_SHORT).show(); - } - break; - case MSG_ACTION_CCALLBACK: { - switch (msg.arg1) { - case 1: { - // 成功 - int resId = getStringRes(context, "share_completed"); - if (resId > 0) { - showNotification(context.getString(resId)); - } - } - break; - case 2: { - // 失败 - String expName = msg.obj.getClass().getSimpleName(); - if ("WechatClientNotExistException".equals(expName) - || "WechatTimelineNotSupportedException".equals(expName) - || "WechatFavoriteNotSupportedException".equals(expName)) { - int resId = getStringRes(context, "wechat_client_inavailable"); - if (resId > 0) { - showNotification(context.getString(resId)); - } - } else if ("GooglePlusClientNotExistException".equals(expName)) { - int resId = getStringRes(context, "google_plus_client_inavailable"); - if (resId > 0) { - showNotification(context.getString(resId)); - } - } else if ("QQClientNotExistException".equals(expName)) { - int resId = getStringRes(context, "qq_client_inavailable"); - if (resId > 0) { - showNotification(context.getString(resId)); - } - } else if ("YixinClientNotExistException".equals(expName) - || "YixinTimelineNotSupportedException".equals(expName)) { - int resId = getStringRes(context, "yixin_client_inavailable"); - if (resId > 0) { - showNotification(context.getString(resId)); - } - } else if ("KakaoTalkClientNotExistException".equals(expName)) { - int resId = getStringRes(context, "kakaotalk_client_inavailable"); - if (resId > 0) { - showNotification(context.getString(resId)); - } - }else if ("KakaoStoryClientNotExistException".equals(expName)) { - int resId = getStringRes(context, "kakaostory_client_inavailable"); - if (resId > 0) { - showNotification(context.getString(resId)); - } - }else if("WhatsAppClientNotExistException".equals(expName)){ - int resId = getStringRes(context, "whatsapp_client_inavailable"); - if (resId > 0) { - showNotification(context.getString(resId)); - } - }else { - int resId = getStringRes(context, "share_failed"); - if (resId > 0) { - showNotification(context.getString(resId)); - } - } - } - break; - case 3: { - // 取消 - int resId = getStringRes(context, "share_canceled"); - if (resId > 0) { - showNotification(context.getString(resId)); - } - } - break; - } - } - break; - case MSG_CANCEL_NOTIFY: { - NotificationManager nm = (NotificationManager) msg.obj; - if (nm != null) { - nm.cancel(msg.arg1); - } - } - break; - } - return false; - } - - // 在状态栏提示分享操作 - private void showNotification(String text) { - Toast.makeText(context, text, Toast.LENGTH_SHORT).show(); - } - - /** 是否支持QQ,QZone授权登录后发微博 */ - public void setShareFromQQAuthSupport(boolean shareFromQQLogin) - { - shareParamsMap.put("isShareTencentWeibo", shareFromQQLogin); - } -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/OnekeyShareTheme.java b/app/src/main/java/cn/sharesdk/onekeyshare/OnekeyShareTheme.java deleted file mode 100644 index 248ada51a9..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/OnekeyShareTheme.java +++ /dev/null @@ -1,3 +0,0 @@ -package cn.sharesdk.onekeyshare; - -public enum OnekeyShareTheme {CLASSIC, SKYBLUE} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/PicViewer.java b/app/src/main/java/cn/sharesdk/onekeyshare/PicViewer.java deleted file mode 100644 index 333995fde9..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/PicViewer.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - - -package cn.sharesdk.onekeyshare; - -import android.graphics.Bitmap; -import android.graphics.Matrix; -import android.graphics.PointF; -import android.graphics.RectF; -import android.util.DisplayMetrics; -import android.view.MotionEvent; -import android.view.View; -import android.view.View.OnTouchListener; -import android.widget.ImageView; -import android.widget.ImageView.ScaleType; - -import com.mob.tools.FakeActivity; - -/** 查看编辑页面中图片的例子 */ -public class PicViewer extends FakeActivity implements OnTouchListener { - private ImageView ivViewer; - private Bitmap pic; - - Matrix matrix = new Matrix(); - Matrix savedMatrix = new Matrix(); - DisplayMetrics dm; - - /** 最小缩放比例*/ - float minScaleR = 1f; - /** 最大缩放比例*/ - static final float MAX_SCALE = 10f; - - /** 初始状态*/ - static final int NONE = 0; - /** 拖动*/ - static final int DRAG = 1; - /** 缩放*/ - static final int ZOOM = 2; - - /** 当前模式*/ - int mode = NONE; - - PointF prev = new PointF(); - PointF mid = new PointF(); - float dist = 1f; - - /** 设置图片用于浏览 */ - public void setImageBitmap(Bitmap pic) { - this.pic = pic; - if (ivViewer != null) { - ivViewer.setImageBitmap(pic); - } - } - - public void onCreate() { - ivViewer = new ImageView(activity); - ivViewer.setScaleType(ScaleType.MATRIX); - ivViewer.setBackgroundColor(0xc0000000); - ivViewer.setOnTouchListener(this); - if (pic != null && !pic.isRecycled()) { - ivViewer.setImageBitmap(pic); - } - dm = new DisplayMetrics(); - activity.getWindowManager().getDefaultDisplay().getMetrics(dm);// 获取分辨率 - minZoom(); - CheckView(); - ivViewer.setImageMatrix(matrix); - activity.setContentView(ivViewer); - - } - - - - /** - * 触屏监听 - */ - public boolean onTouch(View v, MotionEvent event) { - - switch (event.getAction() & MotionEvent.ACTION_MASK) { - // 主点按下 - case MotionEvent.ACTION_DOWN: - savedMatrix.set(matrix); - prev.set(event.getX(), event.getY()); - mode = DRAG; - break; - // 副点按下 - case MotionEvent.ACTION_POINTER_DOWN: - dist = spacing(event); - // 如果连续两点距离大于10,则判定为多点模式 - if (spacing(event) > 10f) { - savedMatrix.set(matrix); - midPoint(mid, event); - mode = ZOOM; - } - break; - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_POINTER_UP: - mode = NONE; - break; - case MotionEvent.ACTION_MOVE: - if (mode == DRAG) { - matrix.set(savedMatrix); - matrix.postTranslate(event.getX() - prev.x, event.getY() - - prev.y); - } else if (mode == ZOOM) { - float newDist = spacing(event); - if (newDist > 10f) { - matrix.set(savedMatrix); - float tScale = newDist / dist; - matrix.postScale(tScale, tScale, mid.x, mid.y); - } - } - break; - } - ivViewer.setImageMatrix(matrix); - CheckView(); - return true; - } - - /** - * 限制最大最小缩放比例,自动居中 - */ - private void CheckView() { - float p[] = new float[9]; - matrix.getValues(p); - if (mode == ZOOM) { - if (p[0] < minScaleR) { -// Log.d("", "当前缩放级别:"+p[0]+",最小缩放级别:"+minScaleR); - matrix.setScale(minScaleR, minScaleR); - } - if (p[0] > MAX_SCALE) { -// Log.d("", "当前缩放级别:"+p[0]+",最大缩放级别:"+MAX_SCALE); - matrix.set(savedMatrix); - } - } - center(); - } - - /** - * 最小缩放比例,最大为100% - */ - private void minZoom() { - minScaleR = Math.min( - (float) dm.widthPixels / (float) pic.getWidth(), - (float) dm.heightPixels / (float) pic.getHeight()); - //以最小缩放比例显示 - matrix.setScale(minScaleR, minScaleR); - } - - private void center() { - center(true, true); - } - - /** - * 横向、纵向居中 - */ - protected void center(boolean horizontal, boolean vertical) { - - Matrix m = new Matrix(); - m.set(matrix); - RectF rect = new RectF(0, 0, pic.getWidth(), pic.getHeight()); - m.mapRect(rect); - - float height = rect.height(); - float width = rect.width(); - - float deltaX = 0, deltaY = 0; - - if (vertical) { - // 图片小于屏幕大小,则居中显示。大于屏幕,上方留空则往上移,下方留空则往下移 - int screenHeight = dm.heightPixels; - if (height < screenHeight) { - deltaY = (screenHeight - height) / 2 - rect.top; - } else if (rect.top > 0) { - deltaY = -rect.top; - } else if (rect.bottom < screenHeight) { - deltaY = ivViewer.getHeight() - rect.bottom; - } - } - - if (horizontal) { - int screenWidth = dm.widthPixels; - if (width < screenWidth) { - deltaX = (screenWidth - width) / 2 - rect.left; - } else if (rect.left > 0) { - deltaX = -rect.left; - } else if (rect.right < screenWidth) { - deltaX = ivViewer.getWidth() - rect.right; - } - } - matrix.postTranslate(deltaX, deltaY); - } - - /** - * 两点的距离 - */ - private float spacing(MotionEvent event) { - float x = event.getX(0) - event.getX(1); - float y = event.getY(0) - event.getY(1); - return (float) Math.sqrt(x * x + y * y); - } - - /** - * 两点的中点 - */ - private void midPoint(PointF point, MotionEvent event) { - float x = event.getX(0) + event.getX(1); - float y = event.getY(0) + event.getY(1); - point.set(x / 2, y / 2); - } - -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/PlatformListFakeActivity.java b/app/src/main/java/cn/sharesdk/onekeyshare/PlatformListFakeActivity.java deleted file mode 100644 index 0605087c5c..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/PlatformListFakeActivity.java +++ /dev/null @@ -1,214 +0,0 @@ -package cn.sharesdk.onekeyshare; - -import android.content.Context; -import android.content.Intent; -import android.view.KeyEvent; -import android.view.View; - -import com.mob.tools.FakeActivity; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import cn.sharesdk.framework.Platform; -import cn.sharesdk.framework.ShareSDK; - -public class PlatformListFakeActivity extends FakeActivity { - protected HashMap shareParamsMap; - protected boolean silent; - protected ArrayList customerLogos; - protected HashMap hiddenPlatforms; - private boolean canceled = false; - protected View backgroundView; - - protected OnShareButtonClickListener onShareButtonClickListener; - protected boolean dialogMode = false; - protected ThemeShareCallback themeShareCallback; - - public static interface OnShareButtonClickListener { - void onClick(View v, List checkPlatforms); - } - - public void onCreate() { - super.onCreate(); - - canceled = false; - - if(themeShareCallback == null) { - finish(); - } - } - - public boolean onKeyEvent(int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_BACK) { - canceled = true; - } - return super.onKeyEvent(keyCode, event); - } - - protected void setCanceled(boolean canceled) { - this.canceled = canceled; - } - - public boolean onFinish() { - - // 取消分享菜单的统计 - if (canceled) { - ShareSDK.logDemoEvent(2, null); - } - - return super.onFinish(); - } - - @Override - public void show(Context context, Intent i) { - super.show(context, i); - } - - public HashMap getShareParamsMap() { - return shareParamsMap; - } - - public void setShareParamsMap(HashMap shareParamsMap) { - this.shareParamsMap = shareParamsMap; - } - - public boolean isSilent() { - return silent; - } - - public void setSilent(boolean silent) { - this.silent = silent; - } - - public ArrayList getCustomerLogos() { - return customerLogos; - } - - public void setCustomerLogos(ArrayList customerLogos) { - this.customerLogos = customerLogos; - } - - public HashMap getHiddenPlatforms() { - return hiddenPlatforms; - } - - public void setHiddenPlatforms(HashMap hiddenPlatforms) { - this.hiddenPlatforms = hiddenPlatforms; - } - - public View getBackgroundView() { - return backgroundView; - } - - public void setBackgroundView(View backgroundView) { - this.backgroundView = backgroundView; - } - - public OnShareButtonClickListener getOnShareButtonClickListener() { - return onShareButtonClickListener; - } - - public void setOnShareButtonClickListener(OnShareButtonClickListener onShareButtonClickListener) { - this.onShareButtonClickListener = onShareButtonClickListener; - } - - public boolean isDialogMode() { - return dialogMode; - } - - public void setDialogMode(boolean dialogMode) { - this.dialogMode = dialogMode; - } - - public ThemeShareCallback getThemeShareCallback() { - return themeShareCallback; - } - - public void setThemeShareCallback(ThemeShareCallback themeShareCallback) { - this.themeShareCallback = themeShareCallback; - } - - protected void onShareButtonClick(View v, List checkedPlatforms) { - - if(onShareButtonClickListener != null) { - onShareButtonClickListener.onClick(v, checkedPlatforms); - } - - HashMap> silentShareData = new HashMap>(); - final List supportEditPagePlatforms = new ArrayList(); - - Platform plat; - HashMap shareParam; - for(Object item : checkedPlatforms) { - if(item instanceof CustomerLogo){ - CustomerLogo customerLogo = (CustomerLogo)item; - customerLogo.listener.onClick(v); - continue; - } - - plat = (Platform)item; - String name = plat.getName(); - - // EditPage不支持微信平台、Google+、QQ分享、Pinterest、信息和邮件,总是执行直接分享 - if(silent || ShareCore.isDirectShare(plat)) { - shareParam = new HashMap(shareParamsMap); - shareParam.put("platform", name); - silentShareData.put(plat, shareParam); - } else { - supportEditPagePlatforms.add(plat); - } - } - if (silentShareData.size() > 0) { - themeShareCallback.doShare(silentShareData); - } - - // 跳转EditPage分享 - if(supportEditPagePlatforms.size() > 0) { - showEditPage(supportEditPagePlatforms); - } - - finish(); - } - - protected void showEditPage(List platforms) { - showEditPage(getContext(), platforms); - } - - public void showEditPage(Context context, Platform platform) { - ArrayList platforms = new ArrayList(1); - platforms.add(platform); - showEditPage(context, platforms); - } - - protected void showEditPage(Context context, List platforms) { - EditPageFakeActivity editPageFakeActivity; - String editPageClass = ((Object)this).getClass().getPackage().getName()+".EditPage"; - try { - editPageFakeActivity = (EditPageFakeActivity) Class.forName(editPageClass).newInstance(); - } catch (Exception e) { - e.printStackTrace(); - return; - } - - editPageFakeActivity.setBackgroundView(backgroundView); - editPageFakeActivity.setShareData(shareParamsMap); - editPageFakeActivity.setPlatforms(platforms); - if (dialogMode) { - editPageFakeActivity.setDialogMode(); - } - editPageFakeActivity.showForResult(context, null, new FakeActivity() { - public void onResult(HashMap data) { - if(data == null) - return; - if (data.containsKey("editRes")) { - @SuppressWarnings("unchecked") - HashMap> editRes - = (HashMap>) data.get("editRes"); - themeShareCallback.doShare(editRes); - } - } - }); - } -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/ReflectableShareContentCustomizeCallback.java b/app/src/main/java/cn/sharesdk/onekeyshare/ReflectableShareContentCustomizeCallback.java deleted file mode 100644 index f5684d5aba..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/ReflectableShareContentCustomizeCallback.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.sharesdk.onekeyshare; - -import android.os.Handler.Callback; -import android.os.Message; - -import com.mob.tools.utils.UIHandler; - -import cn.sharesdk.framework.Platform; -import cn.sharesdk.framework.Platform.ShareParams; - -/** - * 此类在Onekeyshare中并无用途,只是在Socialization中考虑到耦合度,需要通过反射的方式操作Onekeyshare, - *而原先的{@link ShareContentCustomizeCallback}无法完成此需求,故创建本类,以供外部设置操作回调。 - * - * @author Brook - */ -public class ReflectableShareContentCustomizeCallback implements ShareContentCustomizeCallback { - private int onShareWhat; - private Callback onShareCallback; - - public void setOnShareCallback(int what, Callback callback) { - onShareWhat = what; - onShareCallback = callback; - } - - @Override - public void onShare(Platform platform, ShareParams paramsToShare) { - if (onShareCallback != null) { - Message msg = new Message(); - msg.what = onShareWhat; - msg.obj = new Object[] {platform, paramsToShare}; - UIHandler.sendMessage(msg, onShareCallback); - } - } - -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/Shake2Share.java b/app/src/main/java/cn/sharesdk/onekeyshare/Shake2Share.java deleted file mode 100644 index 5d34e4fb9e..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/Shake2Share.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - -package cn.sharesdk.onekeyshare; - -import android.app.Activity; -import android.content.Context; -import android.hardware.Sensor; -import android.hardware.SensorEvent; -import android.hardware.SensorEventListener; -import android.hardware.SensorManager; -import android.view.Window; -import android.widget.ImageView; -import android.widget.ImageView.ScaleType; -import android.widget.Toast; - -import com.mob.tools.FakeActivity; - -import static com.mob.tools.utils.R.getBitmapRes; -import static com.mob.tools.utils.R.getStringRes; - -/** 摇一摇启动分享的例子 */ -public class Shake2Share extends FakeActivity implements SensorEventListener { - // 检测的时间间隔 - private static final int UPDATE_INTERVAL = 100; - // 摇晃检测阈值,决定了对摇晃的敏感程度,越小越敏感 - private static final int SHAKE_THRESHOLD = 1500; - - private OnShakeListener listener; - private SensorManager mSensorManager; - private long mLastUpdateTime; - private float mLastX; - private float mLastY; - private float mLastZ; - private boolean shaken; - - public void setOnShakeListener(OnShakeListener listener) { - this.listener = listener; - } - - public void setActivity(Activity activity) { - super.setActivity(activity); - int resId = getBitmapRes(activity, "ssdk_oks_shake_to_share_back"); - if (resId > 0) { - activity.setTheme(android.R.style.Theme_Dialog); - activity.requestWindowFeature(Window.FEATURE_NO_TITLE); - Window win = activity.getWindow(); - win.setBackgroundDrawableResource(resId); - } - } - - public void onCreate() { - startSensor(); - - int resId = getBitmapRes(activity, "ssdk_oks_yaoyiyao"); - if (resId > 0) { - ImageView iv = new ImageView(activity); - iv.setScaleType(ScaleType.CENTER_INSIDE); - iv.setImageResource(resId); - activity.setContentView(iv); - } - - resId = getStringRes(activity, "shake2share"); - if (resId > 0) { - Toast.makeText(activity, resId, Toast.LENGTH_SHORT).show(); - } - } - - private void startSensor() { - mSensorManager = (SensorManager) activity.getSystemService(Context.SENSOR_SERVICE); - if (mSensorManager == null) { - throw new UnsupportedOperationException(); - } - Sensor sensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); - if (sensor == null) { - throw new UnsupportedOperationException(); - } - boolean success = mSensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_GAME); - if (!success) { - throw new UnsupportedOperationException(); - } - } - - public void onDestroy() { - stopSensor(); - } - - private void stopSensor() { - if (mSensorManager != null) { - mSensorManager.unregisterListener(this); - mSensorManager = null; - } - } - - public void onSensorChanged(SensorEvent event) { - long currentTime = System.currentTimeMillis(); - long diffTime = currentTime - mLastUpdateTime; - if (diffTime > UPDATE_INTERVAL) { - if(mLastUpdateTime != 0) { - float x = event.values[0]; - float y = event.values[1]; - float z = event.values[2]; - float deltaX = x - mLastX; - float deltaY = y - mLastY; - float deltaZ = z - mLastZ; - float delta = (float) (Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ) / diffTime * 10000); - if (delta > SHAKE_THRESHOLD) { - if (!shaken) { - shaken = true; - finish(); - } - - if (listener != null) { - listener.onShake(); - } - } - mLastX = x; - mLastY = y; - mLastZ = z; - } - mLastUpdateTime = currentTime; - } - } - - public void onAccuracyChanged(Sensor sensor, int accuracy) { - - } - - public static interface OnShakeListener { - public void onShake(); - } - -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/ShareContentCustomizeCallback.java b/app/src/main/java/cn/sharesdk/onekeyshare/ShareContentCustomizeCallback.java deleted file mode 100644 index 1498f8f59f..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/ShareContentCustomizeCallback.java +++ /dev/null @@ -1,10 +0,0 @@ -package cn.sharesdk.onekeyshare; - -import cn.sharesdk.framework.Platform; -import cn.sharesdk.framework.Platform.ShareParams; - -public interface ShareContentCustomizeCallback { - - public void onShare(Platform platform, ShareParams paramsToShare); - -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/ShareCore.java b/app/src/main/java/cn/sharesdk/onekeyshare/ShareCore.java deleted file mode 100644 index b9cccb9493..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/ShareCore.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - -package cn.sharesdk.onekeyshare; - -import android.content.Context; -import android.content.Intent; -import android.content.pm.ResolveInfo; -import android.graphics.Bitmap; -import android.graphics.Bitmap.CompressFormat; -import android.text.TextUtils; - -import com.mob.tools.utils.R; - -import java.io.File; -import java.io.FileOutputStream; -import java.util.HashMap; - -import cn.sharesdk.framework.CustomPlatform; -import cn.sharesdk.framework.Platform; -import cn.sharesdk.framework.Platform.ShareParams; -import cn.sharesdk.framework.ShareSDK; - -/** - * ShareCore是快捷分享的实际出口,此类使用了反射的方式,配合传递进来的HashMap, - *构造{@link ShareParams}对象,并执行分享,使快捷分享不再需要考虑目标平台 - */ -public class ShareCore { - private ShareContentCustomizeCallback customizeCallback; - - /** 设置用于分享过程中,根据不同平台自定义分享内容的回调 */ - public void setShareContentCustomizeCallback(ShareContentCustomizeCallback callback) { - customizeCallback = callback; - } - - /** - * 向指定平台分享内容 - *

- * 注意:
- * 参数data的键值需要严格按照{@link ShareParams}不同子类具体字段来命名, - *否则无法反射此字段,也无法设置其值。 - */ - public boolean share(Platform plat, HashMap data) { - if (plat == null || data == null) { - return false; - } - - try { - String imagePath = (String) data.get("imagePath"); - Bitmap viewToShare = (Bitmap) data.get("viewToShare"); - if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) { - String path = R.getCachePath(plat.getContext(), "screenshot"); - File ss = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg"); - FileOutputStream fos = new FileOutputStream(ss); - viewToShare.compress(CompressFormat.JPEG, 100, fos); - fos.flush(); - fos.close(); - data.put("imagePath", ss.getAbsolutePath()); - } - } catch (Throwable t) { - t.printStackTrace(); - return false; - } - - ShareParams sp = new ShareParams(data); - if (customizeCallback != null) { - customizeCallback.onShare(plat, sp); - } - plat.share(sp); - return true; - } - - /** 判断指定平台是否使用客户端分享 */ - public static boolean isUseClientToShare(String platform) { - if ("Wechat".equals(platform) || "WechatMoments".equals(platform) - || "WechatFavorite".equals(platform) || "ShortMessage".equals(platform) - || "Email".equals(platform) || "GooglePlus".equals(platform) - || "QQ".equals(platform) || "Pinterest".equals(platform) - || "Instagram".equals(platform) || "Yixin".equals(platform) - || "YixinMoments".equals(platform) || "QZone".equals(platform) - || "Mingdao".equals(platform) || "Line".equals(platform) - || "KakaoStory".equals(platform) || "KakaoTalk".equals(platform) - || "Bluetooth".equals(platform) || "WhatsApp".equals(platform) - || "BaiduTieba".equals(platform) || "Laiwang".equals(platform) - || "LaiwangMoments".equals(platform) - ) { - return true; - } else if ("Evernote".equals(platform)) { - Platform plat = ShareSDK.getPlatform(platform); - if ("true".equals(plat.getDevinfo("ShareByAppClient"))) { - return true; - } - } else if ("SinaWeibo".equals(platform)) { - Platform plat = ShareSDK.getPlatform(platform); - if ("true".equals(plat.getDevinfo("ShareByAppClient"))) { - Intent test = new Intent(Intent.ACTION_SEND); - test.setPackage("com.sina.weibo"); - test.setType("image/*"); - ResolveInfo ri = plat.getContext().getPackageManager().resolveActivity(test, 0); - return (ri != null); - } - } - - return false; - } - - /** 判断指定平台是否可以用来授权 */ - public static boolean canAuthorize(Context context, String platform) { - return !("WechatMoments".equals(platform) - || "WechatFavorite".equals(platform) || "ShortMessage".equals(platform) - || "Email".equals(platform) - || "Pinterest".equals(platform) || "Yixin".equals(platform) - || "YixinMoments".equals(platform) || "Line".equals(platform) - || "Bluetooth".equals(platform) || "WhatsApp".equals(platform) - || "BaiduTieba".equals(platform)) || "Laiwang".equals(platform) - || "LaiwangMoments".equals(platform); - } - - - /** 判断指定平台是否可以用来获取用户资料 */ - public static boolean canGetUserInfo(Context context, String platform) { - return !("WechatMoments".equals(platform) - || "WechatFavorite".equals(platform) || "ShortMessage".equals(platform) - || "Email".equals(platform) - || "Pinterest".equals(platform) || "Yixin".equals(platform) - || "YixinMoments".equals(platform) || "Line".equals(platform) - || "Bluetooth".equals(platform) || "WhatsApp".equals(platform) - || "Pocket".equals(platform) || "BaiduTieba".equals(platform) - || "Laiwang".equals(platform) || "LaiwangMoments".equals(platform)); - } - - /** 判断是否直接分享 */ - public static boolean isDirectShare(Platform platform) { - return platform instanceof CustomPlatform || isUseClientToShare(platform.getName()); - } -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/theme/classic/EditPage.java b/app/src/main/java/cn/sharesdk/onekeyshare/theme/classic/EditPage.java deleted file mode 100644 index d8cc1bf437..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/theme/classic/EditPage.java +++ /dev/null @@ -1,728 +0,0 @@ -/* - * Offical Website:http://www.mob.com - * Support QQ: 4006852216 - * Offical Wechat Account:ShareSDK (We will inform you our updated news at the first time by Wechat, if we release a new version. If you get any problem, you can also contact us with Wechat, we will reply you within 24 hours.) - * - * Copyright (c) 2013 mob.com. All rights reserved. - */ - -package cn.sharesdk.onekeyshare.theme.classic; - -import android.app.Activity; -import android.content.Context; -import android.content.res.Configuration; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.Typeface; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.ColorDrawable; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.LayerDrawable; -import android.os.Handler.Callback; -import android.os.Message; -import android.text.Editable; -import android.text.TextWatcher; -import android.util.TypedValue; -import android.view.Gravity; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.Window; -import android.view.WindowManager; -import android.view.inputmethod.InputMethodManager; -import android.widget.Button; -import android.widget.EditText; -import android.widget.FrameLayout; -import android.widget.HorizontalScrollView; -import android.widget.ImageView; -import android.widget.ImageView.ScaleType; -import android.widget.LinearLayout; -import android.widget.LinearLayout.LayoutParams; -import android.widget.ProgressBar; -import android.widget.RelativeLayout; -import android.widget.TextView; -import android.widget.Toast; - -import com.mob.tools.utils.UIHandler; - -import java.util.ArrayList; -import java.util.HashMap; - -import cn.sharesdk.framework.CustomPlatform; -import cn.sharesdk.framework.Platform; -import cn.sharesdk.framework.ShareSDK; -import cn.sharesdk.framework.TitleLayout; -import cn.sharesdk.onekeyshare.EditPageFakeActivity; -import cn.sharesdk.onekeyshare.PicViewer; -import cn.sharesdk.onekeyshare.ShareCore; - -import static com.mob.tools.utils.BitmapHelper.blur; -import static com.mob.tools.utils.BitmapHelper.captureView; -import static com.mob.tools.utils.R.dipToPx; -import static com.mob.tools.utils.R.getBitmapRes; -import static com.mob.tools.utils.R.getScreenWidth; -import static com.mob.tools.utils.R.getStringRes; - -/** - * Photo-text Sharing will be handling in this page - *

- * note: - * wechat, yixin, qzone, etc. are shared in their clients, not in this page - */ -public class EditPage extends EditPageFakeActivity implements OnClickListener, TextWatcher { - private static final int MAX_TEXT_COUNT = 140; - private static final int DIM_COLOR = 0x7f323232; - private RelativeLayout rlPage; - private TitleLayout llTitle; - private LinearLayout llBody; - private RelativeLayout rlThumb; - // share content editor - private EditText etContent; - // Words counter - private TextView tvCounter; - // the pin - private ImageView ivPin; - // the image info of share image - private ImageInfo imgInfo; - // shared image container - private ImageView ivImage; - private ProgressBar progressBar; - private Bitmap image; - private LinearLayout llPlat; -// private LinearLayout llAt; - private View[] views; - private Drawable background; - - private Platform[] platformList; - - public void setActivity(Activity activity) { - super.setActivity(activity); - Window win = activity.getWindow(); - int orientation = activity.getResources().getConfiguration().orientation; - if (orientation == Configuration.ORIENTATION_LANDSCAPE) { - win.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN - | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); - } else { - win.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE - | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); - } - } - - 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 list = new ArrayList(); - 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(); - } - - private RelativeLayout getPageView() { - rlPage = new RelativeLayout(getContext()); - rlPage.setBackgroundDrawable(background); - if (dialogMode) { - RelativeLayout rlDialog = new RelativeLayout(getContext()); - rlDialog.setBackgroundColor(0xc0323232); - int dp_8 = dipToPx(getContext(), 8); - int width = getScreenWidth(getContext()) - dp_8 * 2; - RelativeLayout.LayoutParams lpDialog = new RelativeLayout.LayoutParams( - width, LayoutParams.WRAP_CONTENT); - lpDialog.topMargin = dp_8; - lpDialog.bottomMargin = dp_8; - lpDialog.addRule(RelativeLayout.CENTER_IN_PARENT); - rlDialog.setLayoutParams(lpDialog); - rlPage.addView(rlDialog); - - rlDialog.addView(getPageTitle()); - rlDialog.addView(getPageBody()); - rlDialog.addView(getImagePin()); - } else { - rlPage.addView(getPageTitle()); - rlPage.addView(getPageBody()); - rlPage.addView(getImagePin()); - } - return rlPage; - } - - // title bar - @android.support.annotation.IdRes int id0 = 1; - private TitleLayout getPageTitle() { - llTitle = new TitleLayout(getContext()); - llTitle.setId(id0); - int resId = getBitmapRes(activity, "title_back"); - if (resId > 0) { - llTitle.setBackgroundResource(resId); - } - llTitle.getBtnBack().setOnClickListener(this); - resId = getStringRes(activity, "multi_share"); - if (resId > 0) { - llTitle.getTvTitle().setText(resId); - } - llTitle.getBtnRight().setVisibility(View.VISIBLE); - resId = getStringRes(activity, "share"); - if (resId > 0) { - llTitle.getBtnRight().setText(resId); - } - llTitle.getBtnRight().setOnClickListener(this); - RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT); - lp.addRule(RelativeLayout.ALIGN_PARENT_TOP); - lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); - llTitle.setLayoutParams(lp); - - return llTitle; - } - - // page body - @android.support.annotation.IdRes int id1 = 2; - private LinearLayout getPageBody() { - llBody = new LinearLayout(getContext()); - llBody.setId(id1); - int resId = getBitmapRes(activity, "edittext_back"); - if (resId > 0) { - llBody.setBackgroundResource(resId); - } - llBody.setOrientation(LinearLayout.VERTICAL); - RelativeLayout.LayoutParams lpBody = new RelativeLayout.LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpBody.addRule(RelativeLayout.ALIGN_LEFT, llTitle.getId()); - lpBody.addRule(RelativeLayout.BELOW, llTitle.getId()); - lpBody.addRule(RelativeLayout.ALIGN_RIGHT, llTitle.getId()); - if (!dialogMode) { - lpBody.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); - } - int dp_3 = dipToPx(getContext(), 3); - lpBody.setMargins(dp_3, dp_3, dp_3, dp_3); - llBody.setLayoutParams(lpBody); - - llBody.addView(getMainBody()); - llBody.addView(getSep()); - llBody.addView(getPlatformList()); - - return llBody; - } - - private LinearLayout getMainBody() { - LinearLayout llMainBody = new LinearLayout(getContext()); - llMainBody.setOrientation(LinearLayout.VERTICAL); - LayoutParams lpMain = new LayoutParams( - LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - lpMain.weight = 1; - int dp_4 = dipToPx(getContext(), 4); - lpMain.setMargins(dp_4, dp_4, dp_4, dp_4); - llMainBody.setLayoutParams(lpMain); - - LinearLayout llContent = new LinearLayout(getContext()); - LayoutParams lpContent = new LayoutParams( - LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - lpContent.weight = 1; - llMainBody.addView(llContent, lpContent); - - // share content editor - etContent = new EditText(getContext()); - etContent.setGravity(Gravity.LEFT | Gravity.TOP); - etContent.setBackgroundDrawable(null); - etContent.setText(String.valueOf(shareParamMap.get("text"))); - etContent.addTextChangedListener(this); - LayoutParams lpEt = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpEt.weight = 1; - etContent.setLayoutParams(lpEt); - llContent.addView(etContent); - - llContent.addView(getThumbView()); - llMainBody.addView(getBodyBottom()); - - return llMainBody; - } - - // shared image container - @android.support.annotation.IdRes int id3 = 1; - private RelativeLayout getThumbView() { - rlThumb = new RelativeLayout(getContext()); - rlThumb.setId(id3); - int dp_82 = dipToPx(getContext(), 82); - int dp_98 = dipToPx(getContext(), 98); - LayoutParams lpThumb - = new LayoutParams(dp_82, dp_98); - rlThumb.setLayoutParams(lpThumb); - - ivImage = new ImageView(getContext()); - int resId = getBitmapRes(activity, "btn_back_nor"); - if (resId > 0) { - ivImage.setBackgroundResource(resId); - } - ivImage.setScaleType(ScaleType.CENTER_INSIDE); - ivImage.setImageBitmap(image); - - int dp_4 = dipToPx(getContext(), 4); - ivImage.setPadding(dp_4, dp_4, dp_4, dp_4); - int dp_74 = dipToPx(getContext(), 74); - RelativeLayout.LayoutParams lpImage - = new RelativeLayout.LayoutParams(dp_74, dp_74); - int dp_16 = dipToPx(getContext(), 16); - int dp_8 = dipToPx(getContext(), 8); - lpImage.setMargins(0, dp_16, dp_8, 0); - ivImage.setLayoutParams(lpImage); - ivImage.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - if (image != null && !image.isRecycled()) { - PicViewer pv = new PicViewer(); - pv.setImageBitmap(image); - pv.show(activity, null); - } - } - }); - rlThumb.addView(ivImage); - - int dp_24 = dipToPx(getContext(), 24); - progressBar = new ProgressBar(getContext()); - progressBar.setPadding(dp_24, dp_24, dp_24, dp_24); - RelativeLayout.LayoutParams pb - = new RelativeLayout.LayoutParams(dp_74, dp_74); - pb.setMargins(0, dp_16, dp_8, 0); - progressBar.setLayoutParams(pb); - rlThumb.addView(progressBar); - - Button btn = new Button(getContext()); - btn.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - // remove the photo to share - rlThumb.setVisibility(View.GONE); - ivPin.setVisibility(View.GONE); - removeImage(imgInfo); - } - }); - resId = getBitmapRes(activity, "img_cancel"); - if (resId > 0) { - btn.setBackgroundResource(resId); - } - int dp_20 = dipToPx(getContext(), 20); - RelativeLayout.LayoutParams lpBtn - = new RelativeLayout.LayoutParams(dp_20, dp_20); - lpBtn.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); - lpBtn.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); - btn.setLayoutParams(lpBtn); - rlThumb.addView(btn); - - if(!haveImage()){ - rlThumb.setVisibility(View.GONE); - } - return rlThumb; - } - - private void showThumb() { - initImageList(new ImageListResultsCallback() { - @Override - public void onFinish(ArrayList results) { - if(results == null || results.size() == 0) - return; - //TODO: 支持多图 - imgInfo = results.get(0); - image = imgInfo.bitmap; - rlThumb.setVisibility(View.VISIBLE); - ivPin.setVisibility(View.VISIBLE); - progressBar.setVisibility(View.GONE); - ivImage.setImageBitmap(image); - } - }); - } - - private LinearLayout getBodyBottom() { - LinearLayout llBottom = new LinearLayout(getContext()); - llBottom.setLayoutParams(new LayoutParams( - LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); - - LinearLayout line = getAtLine(platforms.get(0).getName()); - if (line != null) { - llBottom.addView(line); - } - - // Words counter - tvCounter = new TextView(getContext()); - tvCounter.setText(String.valueOf(MAX_TEXT_COUNT)); - tvCounter.setTextColor(0xffcfcfcf); - tvCounter.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); - tvCounter.setTypeface(Typeface.DEFAULT_BOLD); - LayoutParams lpCounter = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpCounter.gravity = Gravity.CENTER_VERTICAL; - tvCounter.setLayoutParams(lpCounter); - llBottom.addView(tvCounter); - - return llBottom; - } - - // if platform selected form platform gridview is SinaWeibo, - // TencentWeibo, Facebook, or Twitter, there will be a button - // in the left-bottom of the page, which provides At-friends function - private LinearLayout getAtLine(String platform) { - if (!isShowAtUserLayout(platform)) { - return null; - } - LinearLayout llAt = new LinearLayout(getContext()); - LayoutParams lpAt = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpAt.rightMargin = dipToPx(getContext(), 4); - lpAt.gravity = Gravity.LEFT | Gravity.BOTTOM; - lpAt.weight = 1; - llAt.setLayoutParams(lpAt); - llAt.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - FollowListPage subPage = new FollowListPage(); - subPage.setPlatform(platforms.get(0)); - subPage.showForResult(activity, null, EditPage.this); - } - }); - - TextView tvAt = new TextView(getContext()); - int resId = getBitmapRes(activity, "btn_back_nor"); - if (resId > 0) { - tvAt.setBackgroundResource(resId); - } - int dp_32 = dipToPx(getContext(), 32); - tvAt.setLayoutParams(new LayoutParams(dp_32, dp_32)); - tvAt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); - tvAt.setText(getAtUserButtonText(platform)); - int dp_2 = dipToPx(getContext(), 2); - tvAt.setPadding(0, 0, 0, dp_2); - tvAt.setTypeface(Typeface.DEFAULT_BOLD); - tvAt.setTextColor(0xff000000); - tvAt.setGravity(Gravity.CENTER); - llAt.addView(tvAt); - - TextView tvName = new TextView(getContext()); - tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); - tvName.setTextColor(0xff000000); - resId = getStringRes(activity, "list_friends"); - String text = getContext().getString(resId, getName(platform)); - tvName.setText(text); - LayoutParams lpName = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpName.gravity = Gravity.CENTER_VERTICAL; - tvName.setLayoutParams(lpName); - llAt.addView(tvName); - - return llAt; - } - - private View getSep() { - View vSep = new View(getContext()); - vSep.setBackgroundColor(0xff000000); - int dp_1 = dipToPx(getContext(), 1); - LayoutParams lpSep = new LayoutParams( - LayoutParams.MATCH_PARENT, dp_1); - vSep.setLayoutParams(lpSep); - return vSep; - } - - // platform logos - private LinearLayout getPlatformList() { - LinearLayout llToolBar = new LinearLayout(getContext()); - LayoutParams lpTb = new LayoutParams( - LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - llToolBar.setLayoutParams(lpTb); - - TextView tvShareTo = new TextView(getContext()); - int resId = getStringRes(activity, "share_to"); - if (resId > 0) { - tvShareTo.setText(resId); - } - tvShareTo.setTextColor(0xffcfcfcf); - tvShareTo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); - int dp_9 = dipToPx(getContext(), 9); - LayoutParams lpShareTo = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpShareTo.gravity = Gravity.CENTER_VERTICAL; - lpShareTo.setMargins(dp_9, 0, 0, 0); - tvShareTo.setLayoutParams(lpShareTo); - llToolBar.addView(tvShareTo); - - HorizontalScrollView sv = new HorizontalScrollView(getContext()); - sv.setHorizontalScrollBarEnabled(false); - sv.setHorizontalFadingEdgeEnabled(false); - LayoutParams lpSv = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpSv.setMargins(dp_9, dp_9, dp_9, dp_9); - sv.setLayoutParams(lpSv); - llToolBar.addView(sv); - - llPlat = new LinearLayout(getContext()); - llPlat.setLayoutParams(new HorizontalScrollView.LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); - sv.addView(llPlat); - - return llToolBar; - } - - // the pin - private ImageView getImagePin() { - ivPin = new ImageView(getContext()); - int resId = getBitmapRes(activity, "pin"); - if (resId > 0) { - ivPin.setImageResource(resId); - } - int dp_80 = dipToPx(getContext(), 80); - int dp_36 = dipToPx(getContext(), 36); - RelativeLayout.LayoutParams lp - = new RelativeLayout.LayoutParams(dp_80, dp_36); - lp.topMargin = dipToPx(getContext(), 6); - lp.addRule(RelativeLayout.ALIGN_TOP, llBody.getId()); - lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); - ivPin.setLayoutParams(lp); - ivPin.setVisibility(View.GONE); - - return ivPin; - } - - private void genBackground() { - background = new ColorDrawable(DIM_COLOR); - if (backgroundView != null) { - try { - Bitmap bgBm = captureView(backgroundView, backgroundView.getWidth(), backgroundView.getHeight()); - bgBm = blur(bgBm, 20, 8); - BitmapDrawable blurBm = new BitmapDrawable(activity.getResources(), bgBm); - background = new LayerDrawable(new Drawable[] {blurBm, background}); - } catch (Throwable e) { - e.printStackTrace(); - } - } - } - - private String getName(String platform) { - if (platform == null) { - return ""; - } - - int resId = getStringRes(getContext(), platform.toLowerCase()); - return getContext().getString(resId); - } - - 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; - } - } - - // a statistics of Cancel-sharing - if (plat != null) { - ShareSDK.logDemoEvent(5, plat); - } - finish(); - return; - } - - if (v.equals(llTitle.getBtnRight())) { - String text = etContent.getText().toString(); - shareParamMap.put("text", text); - - platforms.clear(); - for (int i = 0; i < views.length; i++) { - if (views[i].getVisibility() != View.VISIBLE) { - platforms.add(platformList[i]); - } - } - - if (platforms.size() > 0) { - setResultAndFinish(); - } 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); - } - } - - /** display platform list */ - public void afterPlatformListGot() { - int size = platformList == null ? 0 : platformList.length; - views = new View[size]; - - final int dp_24 = dipToPx(getContext(), 24); - LayoutParams lpItem = new 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 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); - String platformName = platformList[i].getName(); - for(Platform plat : platforms) { - if(platformName.equals(plat.getName())) { - views[i].setVisibility(View.INVISIBLE); - selection = 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; - } - }); - } - - private Bitmap getPlatLogo(Platform plat) { - if (plat == null) { - return null; - } - - String name = plat.getName(); - if (name == null) { - return null; - } - - String resName = "logo_" + plat.getName(); - int resId = getBitmapRes(activity, resName.toLowerCase()); - if(resId > 0) { - return BitmapFactory.decodeResource(activity.getResources(), resId); - } - return null; - } - - public void beforeTextChanged(CharSequence s, int start, int count, - int after) { - - } - - public void onTextChanged(CharSequence s, int start, int before, int count) { - int remain = MAX_TEXT_COUNT - etContent.length(); - tvCounter.setText(String.valueOf(remain)); - tvCounter.setTextColor(remain > 0 ? 0xffcfcfcf : 0xffff0000); - } - - public void afterTextChanged(Editable s) { - - } - - public void onResult(HashMap data) { - String atText = getJoinSelectedUser(data); - if(atText != null) { - etContent.append(atText); - } - } - - private void hideSoftInput() { - try { - InputMethodManager imm = (InputMethodManager) activity.getSystemService( - Context.INPUT_METHOD_SERVICE); - imm.hideSoftInputFromWindow(etContent.getWindowToken(), 0); - } catch (Throwable t) { - t.printStackTrace(); - } - } - - public boolean onFinish() { - hideSoftInput(); - return super.onFinish(); - } - - public void onConfigurationChanged(Configuration newConfig) { - int orientation = activity.getResources().getConfiguration().orientation; - if (orientation == Configuration.ORIENTATION_LANDSCAPE) { - hideSoftInput(); - Window win = activity.getWindow(); - win.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN - | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); - rlPage.setBackgroundColor(DIM_COLOR); - rlPage.postDelayed(new Runnable() { - public void run() { - genBackground(); - rlPage.setBackgroundDrawable(background); - } - }, 1000); - } else { - hideSoftInput(); - Window win = activity.getWindow(); - win.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE - | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); - rlPage.setBackgroundColor(DIM_COLOR); - rlPage.postDelayed(new Runnable() { - public void run() { - genBackground(); - rlPage.setBackgroundDrawable(background); - } - }, 1000); - } - } - -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/theme/classic/FollowListPage.java b/app/src/main/java/cn/sharesdk/onekeyshare/theme/classic/FollowListPage.java deleted file mode 100644 index e0289bb43e..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/theme/classic/FollowListPage.java +++ /dev/null @@ -1,459 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - -package cn.sharesdk.onekeyshare.theme.classic; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.Canvas; -import android.os.Handler.Callback; -import android.os.Message; -import android.util.TypedValue; -import android.view.Gravity; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.LinearLayout.LayoutParams; -import android.widget.ProgressBar; -import android.widget.TextView; - -import com.mob.tools.gui.AsyncImageView; -import com.mob.tools.gui.BitmapProcessor; -import com.mob.tools.gui.PullToRefreshListAdapter; -import com.mob.tools.gui.PullToRefreshView; -import com.mob.tools.utils.UIHandler; - -import java.util.ArrayList; -import java.util.HashMap; - -import cn.sharesdk.framework.Platform; -import cn.sharesdk.framework.PlatformActionListener; -import cn.sharesdk.framework.TitleLayout; -import cn.sharesdk.onekeyshare.FollowerListFakeActivity; - -import static com.mob.tools.utils.R.dipToPx; -import static com.mob.tools.utils.R.getBitmapRes; -import static com.mob.tools.utils.R.getStringRes; - -/** 获取好友或关注列表 */ -public class FollowListPage extends FollowerListFakeActivity implements OnClickListener, OnItemClickListener { - private TitleLayout llTitle; - private FollowAdapter adapter; - private int lastPosition = -1; - - public void onCreate() { - LinearLayout llPage = new LinearLayout(getContext()); - llPage.setBackgroundColor(0xfff5f5f5); - llPage.setOrientation(LinearLayout.VERTICAL); - activity.setContentView(llPage); - - // 标题栏 - llTitle = new TitleLayout(getContext()); - int resId = getBitmapRes(getContext(), "title_back"); - if (resId > 0) { - llTitle.setBackgroundResource(resId); - } - llTitle.getBtnBack().setOnClickListener(this); - resId = getStringRes(getContext(), "multi_share"); - if (resId > 0) { - llTitle.getTvTitle().setText(resId); - } - llTitle.getBtnRight().setVisibility(View.VISIBLE); - resId = getStringRes(getContext(), "finish"); - if (resId > 0) { - llTitle.getBtnRight().setText(resId); - } - llTitle.getBtnRight().setOnClickListener(this); - llTitle.setLayoutParams(new LayoutParams( - LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); - llPage.addView(llTitle); - - FrameLayout flPage = new FrameLayout(getContext()); - LayoutParams lpFl = new LayoutParams( - LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - lpFl.weight = 1; - flPage.setLayoutParams(lpFl); - llPage.addView(flPage); - - // 关注(或朋友)列表 - PullToRefreshView followList = new PullToRefreshView(getContext()); - FrameLayout.LayoutParams lpLv = new FrameLayout.LayoutParams( - LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); - followList.setLayoutParams(lpLv); - flPage.addView(followList); - adapter = new FollowAdapter(followList); - adapter.setPlatform(platform); - followList.setAdapter(adapter); - adapter.getListView().setOnItemClickListener(this); - - ImageView ivShadow = new ImageView(getContext()); - resId = getBitmapRes(getContext(), "title_shadow"); - if (resId > 0) { - ivShadow.setBackgroundResource(resId); - } - FrameLayout.LayoutParams lpSd = new FrameLayout.LayoutParams( - LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - ivShadow.setLayoutParams(lpSd); - flPage.addView(ivShadow); - - // 请求数据 - followList.performPulling(true); - } - - public void onClick(View v) { - if (v.equals(llTitle.getBtnRight())) { - ArrayList selected = new ArrayList(); - for (int i = 0, size = adapter.getCount(); i < size; i++) { - if (adapter.getItem(i).checked) { - selected.add(adapter.getItem(i).atName); - } - } - - setResultForChecked(selected); - } - - finish(); - } - - public void onItemClick(AdapterView parent, View view, int position, long id) { - String name = platform.getName(); - if (isRadioMode(name)) { - if(lastPosition >= 0) { - Following lastFollwing = adapter.getItem(lastPosition); - lastFollwing.checked = false; - } - lastPosition = position; - } - Following following = adapter.getItem(position); - following.checked = !following.checked; - adapter.notifyDataSetChanged(); - } - - private static class FollowAdapter extends PullToRefreshListAdapter - implements PlatformActionListener, Callback { - private static final int FOLLOW_LIST_EMPTY = 2; - private int curPage; - private ArrayList follows; - private HashMap map; - private boolean hasNext; - private Platform platform; - private PRTHeader llHeader; - private Bitmap bmChd; - private Bitmap bmUnch; - - public FollowAdapter(PullToRefreshView view) { - super(view); - curPage = -1; - hasNext = true; - map = new HashMap(); - follows = new ArrayList(); - - llHeader = new PRTHeader(getContext()); - - int resId = getBitmapRes(getContext(), "auth_follow_cb_chd"); - if (resId > 0) { - bmChd = BitmapFactory.decodeResource(view.getResources(), resId); - } - resId = getBitmapRes(getContext(), "auth_follow_cb_unc"); - if (resId > 0) { - bmUnch = BitmapFactory.decodeResource(view.getResources(), resId); - } - } - - public void setPlatform(Platform platform) { - this.platform = platform; - platform.setPlatformActionListener(this); - } - - private void next() { - if (hasNext) { - platform.listFriend(15, curPage + 1, null); - } - } - - public View getView(int position, View convertView, ViewGroup parent) { - FollowListItem item = null; - boolean simpleMode = "FacebookMessenger".equals(platform.getName()); - if (convertView == null) { - LinearLayout llItem = new LinearLayout(parent.getContext()); - item = new FollowListItem(); - llItem.setTag(item); - convertView = llItem; - - int dp_52 = com.mob.tools.utils.R.dipToPx(getContext(), 52); - int dp_10 = com.mob.tools.utils.R.dipToPx(parent.getContext(), 10); - int dp_5 = com.mob.tools.utils.R.dipToPx(parent.getContext(), 5); - - if(!simpleMode) { - item.aivIcon = new AsyncImageView(getContext()); - LayoutParams lpIcon = new LayoutParams(dp_52, dp_52); - lpIcon.gravity = Gravity.CENTER_VERTICAL; - lpIcon.setMargins(dp_10, dp_5, dp_10, dp_5); - item.aivIcon.setLayoutParams(lpIcon); - llItem.addView(item.aivIcon); - } - - LinearLayout llText = new LinearLayout(parent.getContext()); - llText.setPadding(0, dp_10, dp_10, dp_10); - llText.setOrientation(LinearLayout.VERTICAL); - LayoutParams lpText = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpText.gravity = Gravity.CENTER_VERTICAL; - lpText.weight = 1; - llText.setLayoutParams(lpText); - llItem.addView(llText); - - item.tvName = new TextView(parent.getContext()); - item.tvName.setTextColor(0xff000000); - item.tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); - item.tvName.setSingleLine(); - if(simpleMode) { - item.tvName.setPadding(dp_10, 0, 0, 0); - } - llText.addView(item.tvName); - - if(!simpleMode) { - item.tvSign = new TextView(parent.getContext()); - item.tvSign.setTextColor(0x7f000000); - item.tvSign.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); - item.tvSign.setSingleLine(); - llText.addView(item.tvSign); - } - - item.ivCheck = new ImageView(parent.getContext()); - item.ivCheck.setPadding(0, 0, dp_10, 0); - LayoutParams lpCheck = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpCheck.gravity = Gravity.CENTER_VERTICAL; - item.ivCheck.setLayoutParams(lpCheck); - llItem.addView(item.ivCheck); - } else { - item = (FollowListItem) convertView.getTag(); - } - - Following following = getItem(position); - item.tvName.setText(following.screenName); - if(!simpleMode) { - item.tvSign.setText(following.description); - } - item.ivCheck.setImageBitmap(following.checked ? bmChd : bmUnch); - if(!simpleMode) { - if (isFling()) { - Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon); - if (bm != null && !bm.isRecycled()) { - item.aivIcon.setImageBitmap(bm); - } else { - item.aivIcon.execute(null, 0); - } - } else { - item.aivIcon.execute(following.icon,0); - } - } - - if (position == getCount() - 1) { - next(); - } - return convertView; - } - - public Following getItem(int position) { - return follows.get(position); - } - - public long getItemId(int position) { - return position; - } - - public int getCount() { - return follows == null ? 0 : follows.size(); - } - - public View getHeaderView() { - return llHeader; - } - - public void onPullDown(int percent) { - llHeader.onPullDown(percent); - } - - public void onRequest() { - llHeader.onRequest(); - curPage = -1; - hasNext = true; - map.clear(); - next(); - } - - public void onCancel(Platform plat, int action) { - UIHandler.sendEmptyMessage(-1, this); - } - - public void onComplete(Platform plat, int action, HashMap res) { - FollowersResult followersResult = parseFollowers(platform.getName(), res, map); - - if(followersResult == null) { - UIHandler.sendEmptyMessage(FOLLOW_LIST_EMPTY, this); - return; - } - hasNext = followersResult.hasNextPage; - if (followersResult.list != null && followersResult.list.size() > 0) { - curPage++; - Message msg = new Message(); - msg.what = 1; - msg.obj = followersResult.list; - UIHandler.sendMessage(msg, this); - } - } - - public void onError(Platform plat, int action, Throwable t) { - t.printStackTrace(); - } - - public boolean handleMessage(Message msg) { - if (msg.what < 0) { - ((Activity) getContext()).finish(); - } else if(msg.what == FOLLOW_LIST_EMPTY) { - notifyDataSetChanged(); - } else { - if (curPage <= 0) { - follows.clear(); - } - @SuppressWarnings("unchecked") - ArrayList data = (ArrayList) msg.obj; - follows.addAll(data); - notifyDataSetChanged(); - } - return false; - } - - public void onReversed() { - super.onReversed(); - llHeader.reverse(); - } - - } - - private static class FollowListItem { - public AsyncImageView aivIcon; - public TextView tvName; - public TextView tvSign; - public ImageView ivCheck; - } - - private static class PRTHeader extends LinearLayout { - private TextView tvHeader; - private RotateImageView ivArrow; - private ProgressBar pbRefreshing; - - public PRTHeader(Context context) { - super(context); - setOrientation(VERTICAL); - - LinearLayout llInner = new LinearLayout(context); - LayoutParams lpInner = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpInner.gravity = Gravity.CENTER_HORIZONTAL; - addView(llInner, lpInner); - - ivArrow = new RotateImageView(context); - int resId = getBitmapRes(context, "ssdk_oks_ptr_ptr"); - if (resId > 0) { - ivArrow.setImageResource(resId); - } - int dp_32 = dipToPx(context, 32); - LayoutParams lpIv = new LayoutParams(dp_32, dp_32); - lpIv.gravity = Gravity.CENTER_VERTICAL; - llInner.addView(ivArrow, lpIv); - - pbRefreshing = new ProgressBar(context); - llInner.addView(pbRefreshing, lpIv); - pbRefreshing.setVisibility(View.GONE); - - tvHeader = new TextView(getContext()); - tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); - tvHeader.setGravity(Gravity.CENTER); - int dp_10 = com.mob.tools.utils.R.dipToPx(getContext(), 10); - tvHeader.setPadding(dp_10, dp_10, dp_10, dp_10); - tvHeader.setTextColor(0xff000000); - LayoutParams lpTv = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpTv.gravity = Gravity.CENTER_VERTICAL; - llInner.addView(tvHeader, lpTv); - } - - public void onPullDown(int percent) { - if (percent > 100) { - int degree = (percent - 100) * 180 / 20; - if (degree > 180) { - degree = 180; - } - if (degree < 0) { - degree = 0; - } - ivArrow.setRotation(degree); - } else { - ivArrow.setRotation(0); - } - - if (percent < 100) { - int resId = getStringRes(getContext(), "pull_to_refresh"); - if (resId > 0) { - tvHeader.setText(resId); - } - } else { - int resId = getStringRes(getContext(), "release_to_refresh"); - if (resId > 0) { - tvHeader.setText(resId); - } - } - } - - public void onRequest() { - ivArrow.setVisibility(View.GONE); - pbRefreshing.setVisibility(View.VISIBLE); - int resId = getStringRes(getContext(), "refreshing"); - if (resId > 0) { - tvHeader.setText(resId); - } - } - - public void reverse() { - pbRefreshing.setVisibility(View.GONE); - ivArrow.setRotation(180); - ivArrow.setVisibility(View.VISIBLE); - } - - } - - private static class RotateImageView extends ImageView { - private int rotation; - - public RotateImageView(Context context) { - super(context); - } - - public void setRotation(int degree) { - rotation = degree; - invalidate(); - } - - protected void onDraw(Canvas canvas) { - canvas.rotate(rotation, getWidth() / 2, getHeight() / 2); - super.onDraw(canvas); - } - - } - -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/theme/classic/PlatformGridView.java b/app/src/main/java/cn/sharesdk/onekeyshare/theme/classic/PlatformGridView.java deleted file mode 100644 index a7c56a1dc5..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/theme/classic/PlatformGridView.java +++ /dev/null @@ -1,493 +0,0 @@ -/* - * Offical Website:http://www.mob.com - * Support QQ: 4006852216 - * Offical Wechat Account:ShareSDK (We will inform you our updated news at the first time by Wechat, if we release a new version. If you get any problem, you can also contact us with Wechat, we will reply you within 24 hours.) - * - * Copyright (c) 2013 mob.com. All rights reserved. - */ - -package cn.sharesdk.onekeyshare.theme.classic; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.os.Build; -import android.os.Handler.Callback; -import android.os.Message; -import android.util.AttributeSet; -import android.util.TypedValue; -import android.view.Gravity; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.ImageView.ScaleType; -import android.widget.LinearLayout; -import android.widget.TextView; - -import com.mob.tools.gui.ViewPagerAdapter; -import com.mob.tools.gui.ViewPagerClassic; -import com.mob.tools.utils.UIHandler; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; - -import cn.sharesdk.framework.Platform; -import cn.sharesdk.framework.ShareSDK; -import cn.sharesdk.onekeyshare.CustomerLogo; - -import static com.mob.tools.utils.R.getBitmapRes; - -/** platform logo list gridview */ -public class PlatformGridView extends LinearLayout implements - OnClickListener, Callback { - private static final int MIN_CLICK_INTERVAL = 1000; - private static final int MSG_PLATFORM_LIST_GOT = 1; - // grids in each line - private int LINE_PER_PAGE; - // lines in each page - private int COLUMN_PER_LINE; - // grids in each page - private int PAGE_SIZE; - // grids container - private ViewPagerClassic pager; - // indicators - private ImageView[] points; - private Bitmap grayPoint; - private Bitmap bluePoint; - // Determine whether don't jump editpage and share directly - private boolean silent; - // platforms - private Platform[] platformList; - // data to share - private HashMap reqData; - private PlatformListPage parent; - private ArrayList customers; - private HashMap hiddenPlatforms; - private View bgView; - private long lastClickTime; - - public PlatformGridView(Context context) { - super(context); - init(context); - } - - public PlatformGridView(Context context, AttributeSet attrs) { - super(context, attrs); - init(context); - } - - private void init(final Context context) { - calPageSize(); - setOrientation(VERTICAL); - - pager = new ViewPagerClassic(context); - disableOverScrollMode(pager); - pager.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); - addView(pager); - - // in order to have a better UI effect, opening a thread request the list of platforms - new Thread() { - public void run() { - try { - platformList = ShareSDK.getPlatformList(); - if (platformList == null) { - platformList = new Platform[0]; - } - UIHandler.sendEmptyMessage(MSG_PLATFORM_LIST_GOT, PlatformGridView.this); - } catch (Throwable t) { - t.printStackTrace(); - } - } - }.start(); - } - - private void calPageSize() { - float scrW = com.mob.tools.utils.R.getScreenWidth(getContext()); - float scrH = com.mob.tools.utils.R.getScreenHeight(getContext()); - float whR = scrW / scrH; - if (whR < 0.63) { - COLUMN_PER_LINE = 3; - LINE_PER_PAGE = 3; - } else if (whR < 0.75) { - COLUMN_PER_LINE = 3; - LINE_PER_PAGE = 2; - } else { - LINE_PER_PAGE = 1; - if (whR >= 1.75) { - COLUMN_PER_LINE = 6; - } else if (whR >= 1.5) { - COLUMN_PER_LINE = 5; - } else if (whR >= 1.3) { - COLUMN_PER_LINE = 4; - } else { - COLUMN_PER_LINE = 3; - } - } - COLUMN_PER_LINE = 2; - LINE_PER_PAGE = 2; - PAGE_SIZE = COLUMN_PER_LINE * LINE_PER_PAGE; - } - - public boolean handleMessage(Message msg) { - switch (msg.what) { - case MSG_PLATFORM_LIST_GOT: { - afterPlatformListGot(); - } - break; - } - return false; - } - - // initializes the girdview of platforms - public void afterPlatformListGot() { - PlatformAdapter adapter = new PlatformAdapter(this); - pager.setAdapter(adapter); - int pageCount = 0; - if (platformList != null) { - int cusSize = customers == null ? 0 : customers.size(); - int platSize = platformList == null ? 0 : platformList.length; - int hideSize = hiddenPlatforms == null ? 0 : hiddenPlatforms.size(); - platSize = platSize-hideSize; - int size = platSize + cusSize; - pageCount = size / PAGE_SIZE; - if (size % PAGE_SIZE > 0) { - pageCount++; - } - } - points = new ImageView[pageCount]; - if (points.length <= 0) { - return; - } - - Context context = getContext(); - LinearLayout llPoints = new LinearLayout(context); - // if the total number of pages exceeds 1, we set the page indicators - llPoints.setVisibility(pageCount > 1 ? View.VISIBLE: View.GONE); - LayoutParams lpLl = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpLl.gravity = Gravity.CENTER_HORIZONTAL; - llPoints.setLayoutParams(lpLl); - addView(llPoints); - - int dp_5 = com.mob.tools.utils.R.dipToPx(context, 5); - int resId = getBitmapRes(getContext(), "light_blue_point"); - if (resId > 0) { - grayPoint = BitmapFactory.decodeResource(getResources(), resId); - } - resId = getBitmapRes(getContext(), "blue_point"); - if (resId > 0) { - bluePoint = BitmapFactory.decodeResource(getResources(), resId); - } - for (int i = 0; i < pageCount; i++) { - points[i] = new ImageView(context); - points[i].setScaleType(ScaleType.CENTER_INSIDE); - points[i].setImageBitmap(grayPoint); - LayoutParams lpIv = new LayoutParams(dp_5, dp_5); - lpIv.setMargins(dp_5, dp_5, dp_5, 0); - points[i].setLayoutParams(lpIv); - llPoints.addView(points[i]); - } - int curPage = pager.getCurrentScreen(); - points[curPage].setImageBitmap(bluePoint); - } - - /** after the screen rotates, this method will be called to refresh the list of gridviews */ - public void onConfigurationChanged() { - int curFirst = pager.getCurrentScreen() * PAGE_SIZE; - calPageSize(); - int newPage = curFirst / PAGE_SIZE; - - removeViewAt(1); - afterPlatformListGot(); - - pager.setCurrentScreen(newPage); - } - - public void setData(HashMap data, boolean silent) { - reqData = data; - this.silent = silent; - } - - public void setHiddenPlatforms(HashMap hiddenPlatforms) { - this.hiddenPlatforms = hiddenPlatforms; - } - - /** Set the Click event of the custom icon */ - public void setCustomerLogos(ArrayList customers) { - this.customers = customers; - } - - public void setEditPageBackground(View bgView) { - this.bgView = bgView; - } - - /** Sets the callback page sharing operations */ - public void setParent(PlatformListPage parent) { - this.parent = parent; - } - - public void onClick(View v) { - long time = System.currentTimeMillis(); - if (time - lastClickTime < MIN_CLICK_INTERVAL) { - return; - } - lastClickTime = time; - - ArrayList platforms = new ArrayList(1); - platforms.add(v.getTag()); - parent.onPlatformIconClick(v, platforms); - } - - // Disable the flashing effect when viewpages sliding to left/right edge - private void disableOverScrollMode(View view) { - if (Build.VERSION.SDK_INT < 9) { - return; - } - try { - Method m = View.class.getMethod("setOverScrollMode", - new Class[] { Integer.TYPE }); - m.setAccessible(true); - m.invoke(view, new Object[] { Integer.valueOf(2) }); - } catch (Throwable t) { - t.printStackTrace(); - } - } - - /** gridview adapter */ - private static class PlatformAdapter extends ViewPagerAdapter { - private GridView[] girds; - private List logos; - private OnClickListener callback; - private int lines; - private PlatformGridView platformGridView; - - public PlatformAdapter(PlatformGridView platformGridView) { - this.platformGridView = platformGridView; - logos = new ArrayList(); - Platform[] platforms = platformGridView.platformList; - HashMap hiddenPlatforms = platformGridView.hiddenPlatforms; - if (platforms != null) { - if (hiddenPlatforms != null && hiddenPlatforms.size() > 0) { - ArrayList ps = new ArrayList(); - for (Platform p : platforms) { - if (hiddenPlatforms.containsKey(p.getName())) { - continue; - } - ps.add(p); - } - - platforms = new Platform[ps.size()]; - for (int i = 0; i < platforms.length; i++) { - platforms[i] = ps.get(i); - } - } - - logos.addAll(Arrays.asList(platforms)); - } - ArrayList customers = platformGridView.customers; - if (customers != null) { - logos.addAll(customers); - } - this.callback = platformGridView; - girds = null; - - if (logos != null) { - int size = logos.size(); - int PAGE_SIZE = platformGridView.PAGE_SIZE; - int pageCount = size / PAGE_SIZE; - if (size % PAGE_SIZE > 0) { - pageCount++; - } - girds = new GridView[pageCount]; - } - } - - public int getCount() { - return girds == null ? 0 : girds.length; - } - - public View getView(int position, ViewGroup parent) { - if (girds[position] == null) { - int pageSize = platformGridView.PAGE_SIZE; - int curSize = pageSize * position; - int listSize = logos == null ? 0 : logos.size(); - if (curSize + pageSize > listSize) { - pageSize = listSize - curSize; - } - Object[] gridBean = new Object[pageSize]; - for (int i = 0; i < pageSize; i++) { - gridBean[i] = logos.get(curSize + i); - } - - if (position == 0) { - int COLUMN_PER_LINE = platformGridView.COLUMN_PER_LINE; - lines = gridBean.length / COLUMN_PER_LINE; - if (gridBean.length % COLUMN_PER_LINE > 0) { - lines++; - } - } - girds[position] = new GridView(this); - girds[position].setData(lines, gridBean); - } - - return girds[position]; - } - - /** This method will be called after sliding the gridview */ - public void onScreenChange(int currentScreen, int lastScreen) { - ImageView[] points = platformGridView.points; - for (int i = 0; i < points.length; i++) { - points[i].setImageBitmap(platformGridView.grayPoint); - } - - points[currentScreen].setImageBitmap(platformGridView.bluePoint); - } - - } - - /** a simple gridview */ - private static class GridView extends LinearLayout { - private Object[] beans; - private OnClickListener callback; - private int lines; - private PlatformAdapter platformAdapter; - - public GridView(PlatformAdapter platformAdapter) { - super(platformAdapter.platformGridView.getContext()); - this.platformAdapter = platformAdapter; - this.callback = platformAdapter.callback; - } - - public void setData(int lines, Object[] beans) { - this.lines = lines; - this.beans = beans; - init(); - } - - private void init() { - int dp_5 = com.mob.tools.utils.R.dipToPx(getContext(), 5); - setPadding(0, dp_5, 0, dp_5); - setOrientation(VERTICAL); - - int size = beans == null ? 0 : beans.length; - int COLUMN_PER_LINE = platformAdapter.platformGridView.COLUMN_PER_LINE; - int lineSize = size / COLUMN_PER_LINE; - if (size % COLUMN_PER_LINE > 0) { - lineSize++; - } - LayoutParams lp = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lp.weight = 1; - for (int i = 0; i < lines; i++) { - LinearLayout llLine = new LinearLayout(getContext()); - llLine.setLayoutParams(lp); - llLine.setPadding(dp_5, 0, dp_5, 0); - addView(llLine); - - if (i >= lineSize) { - continue; - } - - for (int j = 0; j < COLUMN_PER_LINE; j++) { - final int index = i * COLUMN_PER_LINE + j; - if (index >= size) { - LinearLayout llItem = new LinearLayout(getContext()); - llItem.setLayoutParams(lp); - llLine.addView(llItem); - continue; - } - - final LinearLayout llItem = getView(index, callback, getContext()); - llItem.setTag(beans[index]); - llItem.setLayoutParams(lp); - llLine.addView(llItem); - } - } - } - - private LinearLayout getView(int position, OnClickListener ocL, Context context) { - Bitmap logo; - String label; - OnClickListener listener; - if (beans[position] instanceof Platform) { - logo = getIcon((Platform) beans[position]); - label = getName((Platform) beans[position]); - listener = ocL; - } else { - logo = ((CustomerLogo) beans[position]).enableLogo; - label = ((CustomerLogo) beans[position]).label; - listener = ocL; - } - - LinearLayout ll = new LinearLayout(context); - ll.setOrientation(LinearLayout.VERTICAL); - - ImageView iv = new ImageView(context); - int dp_5 = com.mob.tools.utils.R.dipToPx(context, 5); - iv.setPadding(dp_5, dp_5, dp_5, dp_5); - iv.setScaleType(ScaleType.CENTER_INSIDE); - LayoutParams lpIv = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpIv.setMargins(dp_5, dp_5, dp_5, dp_5); - lpIv.gravity = Gravity.CENTER_HORIZONTAL; - iv.setLayoutParams(lpIv); - iv.setImageBitmap(logo); - ll.addView(iv); - - TextView tv = new TextView(context); - tv.setTextColor(0xff000000); - tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); - tv.setSingleLine(); - tv.setIncludeFontPadding(false); - LayoutParams lpTv = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpTv.gravity = Gravity.CENTER_HORIZONTAL; - lpTv.weight = 1; - lpTv.setMargins(dp_5, 0, dp_5, dp_5); - tv.setLayoutParams(lpTv); - tv.setText(label); -// ll.addView(tv); - ll.setOnClickListener(listener); - - return ll; - } - - private Bitmap getIcon(Platform plat) { - if (plat == null) { - return null; - } - - String name = plat.getName(); - if (name == null) { - return null; - } - - String resName = "logo_" + plat.getName(); - int resId = getBitmapRes(getContext(), resName.toLowerCase()); - return BitmapFactory.decodeResource(getResources(), resId); - } - - private String getName(Platform plat) { - if (plat == null) { - return ""; - } - - String name = plat.getName(); - if (name == null) { - return ""; - } - - int resId = com.mob.tools.utils.R.getStringRes(getContext(), plat.getName().toLowerCase()); - if (resId > 0) { - return getContext().getString(resId); - } - return null; - } - - } - -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/theme/classic/PlatformListPage.java b/app/src/main/java/cn/sharesdk/onekeyshare/theme/classic/PlatformListPage.java deleted file mode 100644 index 87b0249443..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/theme/classic/PlatformListPage.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - -package cn.sharesdk.onekeyshare.theme.classic; - -import android.annotation.TargetApi; -import android.content.res.Configuration; -import android.graphics.drawable.ColorDrawable; -import android.os.Build; -import android.util.TypedValue; -import android.view.Gravity; -import android.view.MotionEvent; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.view.animation.Animation; -import android.view.animation.ScaleAnimation; -import android.widget.Button; -import android.widget.FrameLayout; -import android.widget.LinearLayout; - -import com.gh.common.util.DisplayUtils; -import com.gh.gamecenter.manager.SystemBarTintManager; - -import java.util.ArrayList; - -import cn.sharesdk.onekeyshare.PlatformListFakeActivity; - -import static com.mob.tools.utils.R.getBitmapRes; -import static com.mob.tools.utils.R.getStringRes; - -public class PlatformListPage extends PlatformListFakeActivity implements - View.OnClickListener { - // page container - private FrameLayout flPage; - // gridview of platform list - private PlatformGridView grid; - // cancel button - private Button btnCancel; - // sliding up animation - private Animation animShow; - // sliding down animation - private Animation animHide; - private boolean finishing; - private LinearLayout llPage; - - public void onCreate() { - super.onCreate(); - - finishing = false; - initPageView(); - initAnim(); - activity.setContentView(flPage); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - setTranslucentStatus(true); - SystemBarTintManager tintManager = new SystemBarTintManager( - activity); - tintManager.setStatusBarTintEnabled(true); - tintManager.setStatusBarTintColor(0xff106DA6); - } - - // set the data for platform gridview - grid.setData(shareParamsMap, silent); - grid.setHiddenPlatforms(hiddenPlatforms); - grid.setCustomerLogos(customerLogos); - grid.setParent(this); - btnCancel.setOnClickListener(this); - - // display gridviews - llPage.clearAnimation(); - llPage.startAnimation(animShow); - } - - @TargetApi(19) - protected void setTranslucentStatus(boolean status) { - Window window = activity.getWindow(); - WindowManager.LayoutParams winParams = window.getAttributes(); - final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; - if (status) { - winParams.flags |= bits; - } else { - winParams.flags &= ~bits; - } - window.setAttributes(winParams); - } - - private void initPageView() { - flPage = new FrameLayout(getContext()); - flPage.setOnClickListener(this); - flPage.setBackgroundDrawable(new ColorDrawable(0x55000000)); - - // container of the platform gridview - llPage = new LinearLayout(getContext()) { - public boolean onTouchEvent(MotionEvent event) { - return true; - } - }; - llPage.setOrientation(LinearLayout.VERTICAL); - llPage.setBackgroundDrawable(new ColorDrawable(0xffffffff)); - // FrameLayout.LayoutParams lpLl = new FrameLayout.LayoutParams( - // FrameLayout.LayoutParams.WRAP_CONTENT, - // FrameLayout.LayoutParams.WRAP_CONTENT); - FrameLayout.LayoutParams lpLl = new FrameLayout.LayoutParams( - DisplayUtils.dip2px(getContext(), 166), - FrameLayout.LayoutParams.WRAP_CONTENT); - lpLl.gravity = Gravity.CENTER; - llPage.setLayoutParams(lpLl); - flPage.addView(llPage); - - // gridview - grid = new PlatformGridView(getContext()); - grid.setEditPageBackground(getBackgroundView()); - LinearLayout.LayoutParams lpWg = new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT); - grid.setLayoutParams(lpWg); - llPage.addView(grid); - - // cancel button - btnCancel = new Button(getContext()); - // btnCancel.setTextColor(0xff3a65ff); - btnCancel.setTextColor(0xff1BA4FC); - btnCancel.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); - int resId = getStringRes(getContext(), "cancel"); - if (resId > 0) { - btnCancel.setText(resId); - } - btnCancel.setPadding(0, 0, 0, - com.mob.tools.utils.R.dipToPx(getContext(), 5)); - - resId = getBitmapRes(getContext(), "classic_platform_corners_bg"); - if (resId > 0) { - btnCancel.setBackgroundResource(resId); - } else { - btnCancel.setBackgroundDrawable(new ColorDrawable(0xffffffff)); - } - - LinearLayout.LayoutParams lpBtn = new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, - com.mob.tools.utils.R.dipToPx(getContext(), 45)); - int dp_10 = com.mob.tools.utils.R.dipToPx(getContext(), 10); - lpBtn.setMargins(dp_10, dp_10, dp_10, dp_10); - btnCancel.setLayoutParams(lpBtn); - // llPage.addView(btnCancel); - } - - private void initAnim() { -// animShow = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, -// Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1, -// Animation.RELATIVE_TO_SELF, 0); - animShow = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, - 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); - animShow.setDuration(300); - -// animHide = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, -// Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, -// Animation.RELATIVE_TO_SELF, 1); - animHide = new ScaleAnimation(1, 0, 1, 0, Animation.RELATIVE_TO_SELF, - 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); - animHide.setDuration(300); - } - - public void onConfigurationChanged(Configuration newConfig) { - if (grid != null) { - grid.onConfigurationChanged(); - } - } - - public boolean onFinish() { - if (finishing) { - return super.onFinish(); - } - - if (animHide == null) { - finishing = true; - return false; - } - - finishing = true; - animHide.setAnimationListener(new Animation.AnimationListener() { - public void onAnimationStart(Animation animation) { - - } - - public void onAnimationRepeat(Animation animation) { - - } - - public void onAnimationEnd(Animation animation) { - flPage.setVisibility(View.GONE); - finish(); - } - }); - llPage.clearAnimation(); - llPage.startAnimation(animHide); - // 中断finish操作 - return true; - } - - @Override - public void onClick(View v) { - if (v.equals(flPage) || v.equals(btnCancel)) { - setCanceled(true); - finish(); - } - } - - public void onPlatformIconClick(View v, ArrayList platforms) { - onShareButtonClick(v, platforms); - } -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/theme/skyblue/EditPage.java b/app/src/main/java/cn/sharesdk/onekeyshare/theme/skyblue/EditPage.java deleted file mode 100644 index 3322f3fe54..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/theme/skyblue/EditPage.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - -package cn.sharesdk.onekeyshare.theme.skyblue; - -import android.text.Editable; -import android.text.TextWatcher; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.EditText; -import android.widget.HorizontalScrollView; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; -import android.widget.TextView; - -import java.util.ArrayList; -import java.util.HashMap; - -import cn.sharesdk.framework.Platform; -import cn.sharesdk.framework.ShareSDK; -import cn.sharesdk.onekeyshare.EditPageFakeActivity; -import cn.sharesdk.onekeyshare.PicViewer; - -import static com.mob.tools.utils.R.getIdRes; -import static com.mob.tools.utils.R.getLayoutRes; -import static com.mob.tools.utils.R.getStringRes; - -/** 执行图文分享的页面,此页面不支持微信平台的分享 */ -public class EditPage extends EditPageFakeActivity implements OnClickListener, TextWatcher { - private static final int MAX_TEXT_COUNT = 140; - - // 字数计算器 - private TextView textCounterTextView; - private EditText titleEditText; - private EditText textEditText; - - public void onCreate() { - if (shareParamMap == null || platforms == null) { - finish(); - return; - } - - activity.setContentView(getLayoutRes(activity, "skyblue_editpage")); - initView(); - } - - private void initView() { - if(!dialogMode) { - RelativeLayout mainRelLayout = (RelativeLayout)findViewByResName("mainRelLayout"); - RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) mainRelLayout.getLayoutParams(); - lp.setMargins(0,0,0,0); - lp.height = RelativeLayout.LayoutParams.MATCH_PARENT; - mainRelLayout.setLayoutParams(lp); - } - initTitleView(); - initBodyView(); - initImageListView(); - } - - private void initTitleView() { - View backImageView = findViewByResName("backImageView"); - backImageView.setTag("close"); - backImageView.setOnClickListener(this); - - View okImageView = findViewByResName("okImageView"); - okImageView.setTag("ok"); - okImageView.setOnClickListener(this); - } - - private void initBodyView() { - View closeImageView = findViewByResName("closeImageView"); - closeImageView.setTag("close"); - closeImageView.setOnClickListener(this); - - if(shareParamMap.containsKey("title")) { - titleEditText = (EditText) findViewByResName("titleEditText"); - titleEditText.setText(String.valueOf(shareParamMap.get("title"))); - } - - textCounterTextView = (TextView) findViewByResName("textCounterTextView"); - textCounterTextView.setText(String.valueOf(MAX_TEXT_COUNT)); - - textEditText = (EditText) findViewByResName("textEditText"); - textEditText.addTextChangedListener(this); - textEditText.setText(String.valueOf(shareParamMap.get("text"))); - - initAtUserView(); - } - - private void initAtUserView() { - LinearLayout atLayout = (LinearLayout) findViewByResName("atLayout"); - for(Platform platform : platforms) { - String platformName = platform.getName(); - if (isShowAtUserLayout(platformName)) { - View view = LayoutInflater.from(activity).inflate(getLayoutRes(activity, "skyblue_editpage_at_layout"), null); - TextView atDescTextView = (TextView) view.findViewById(getIdRes(activity, "atDescTextView")); - TextView atTextView = (TextView) view.findViewById(getIdRes(activity, "atTextView")); - - OnClickListener atBtnClickListener = new OnClickListener() { - public void onClick(View v) { - FollowListPage subPage = new FollowListPage(); - subPage.setPlatform((Platform) v.getTag()); - subPage.showForResult(activity, null, EditPage.this); - } - }; - atTextView.setTag(platform); - atTextView.setOnClickListener(atBtnClickListener); - atDescTextView.setTag(platform); - atDescTextView.setOnClickListener(atBtnClickListener); - - atTextView.setText(getAtUserButtonText(platformName)); - atDescTextView.setText(getContext().getString(getStringRes(activity, "list_friends"), getLogoName(platformName))); - - atLayout.addView(view); - } - } - - } - - private void initImageListView() { - final HorizontalScrollView hScrollView = (HorizontalScrollView) findViewByResName("hScrollView"); - ImageListResultsCallback callback = new ImageListResultsCallback() { - - @Override - public void onFinish(ArrayList results) { - if(results == null) - return; - LinearLayout layout = (LinearLayout) findViewByResName("imagesLinearLayout"); - for(ImageInfo imageInfo : results) { - if(imageInfo.bitmap == null) - continue; - layout.addView(makeImageItemView(imageInfo)); - } - } - }; - if(!initImageList(callback)) { - hScrollView.setVisibility(View.GONE); - } - - } - - private View makeImageItemView(final ImageInfo imageInfo) { - final View view = LayoutInflater.from(activity).inflate(getLayoutRes(activity, "skyblue_editpage_inc_image_layout"), null); - - ImageView imageView = (ImageView) view.findViewById(getIdRes(activity, "imageView")); - imageView.setImageBitmap(imageInfo.bitmap); - imageView.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View view) { - PicViewer pv = new PicViewer(); - pv.setImageBitmap(imageInfo.bitmap); - pv.show(activity, null); - } - }); - - View removeBtn = view.findViewById(getIdRes(activity, "imageRemoveBtn")); - removeBtn.setTag(imageInfo); - removeBtn.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - view.setVisibility(View.GONE); - removeImage((ImageInfo) v.getTag()); - } - }); - - return view; - } - - public void onClick(View v) { - if(v.getTag() == null) - return; - String tag = (String) v.getTag(); - if (tag.equals("close")) { - // 取消分享的统计 - for(Platform plat : platforms) { - ShareSDK.logDemoEvent(5, plat); - } - finish(); - return; - } - - if (tag.equals("ok")) { - onShareButtonClick(v); - return; - } - } - - private void onShareButtonClick(View v) { - if(shareParamMap.containsKey("title")) { - String title = titleEditText.getText().toString().trim(); - shareParamMap.put("title", title); - } - - String text = textEditText.getText().toString().trim(); - shareParamMap.put("text", text); - - setResultAndFinish(); - } - - public void beforeTextChanged(CharSequence s, int start, int count, - int after) { - - } - - public void onTextChanged(CharSequence s, int start, int before, int count) { - int remain = MAX_TEXT_COUNT - textEditText.length(); - textCounterTextView.setText(String.valueOf(remain)); - textCounterTextView.setTextColor(remain > 0 ? 0xffcfcfcf : 0xffff0000); - } - - public void afterTextChanged(Editable s) { - - } - - public void onResult(HashMap data) { - String atText = getJoinSelectedUser(data); - if(atText != null) { - textEditText.append(atText); - } - } - - public boolean onFinish() { - textCounterTextView = null; - textEditText = null; - titleEditText = null; - return super.onFinish(); - } - -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/theme/skyblue/FollowListPage.java b/app/src/main/java/cn/sharesdk/onekeyshare/theme/skyblue/FollowListPage.java deleted file mode 100644 index a0880588a9..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/theme/skyblue/FollowListPage.java +++ /dev/null @@ -1,460 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - -package cn.sharesdk.onekeyshare.theme.skyblue; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.Canvas; -import android.os.Handler.Callback; -import android.os.Message; -import android.util.TypedValue; -import android.view.Gravity; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.LinearLayout.LayoutParams; -import android.widget.ProgressBar; -import android.widget.TextView; - -import com.mob.tools.gui.AsyncImageView; -import com.mob.tools.gui.BitmapProcessor; -import com.mob.tools.gui.PullToRefreshListAdapter; -import com.mob.tools.gui.PullToRefreshView; -import com.mob.tools.utils.UIHandler; - -import java.util.ArrayList; -import java.util.HashMap; - -import cn.sharesdk.framework.Platform; -import cn.sharesdk.framework.PlatformActionListener; -import cn.sharesdk.framework.TitleLayout; -import cn.sharesdk.onekeyshare.FollowerListFakeActivity; - -import static com.mob.tools.utils.R.dipToPx; -import static com.mob.tools.utils.R.getBitmapRes; -import static com.mob.tools.utils.R.getStringRes; - -/** 获取好友或关注列表 */ -public class FollowListPage extends FollowerListFakeActivity implements OnClickListener, OnItemClickListener { - private TitleLayout llTitle; - private FollowAdapter adapter; - private int lastPosition = -1; - - - public void onCreate() { - LinearLayout llPage = new LinearLayout(getContext()); - llPage.setBackgroundColor(0xfff5f5f5); - llPage.setOrientation(LinearLayout.VERTICAL); - activity.setContentView(llPage); - - // 标题栏 - llTitle = new TitleLayout(getContext()); - int resId = getBitmapRes(getContext(), "title_back"); - if (resId > 0) { - llTitle.setBackgroundResource(resId); - } - llTitle.getBtnBack().setOnClickListener(this); - resId = getStringRes(getContext(), "multi_share"); - if (resId > 0) { - llTitle.getTvTitle().setText(resId); - } - llTitle.getBtnRight().setVisibility(View.VISIBLE); - resId = getStringRes(getContext(), "finish"); - if (resId > 0) { - llTitle.getBtnRight().setText(resId); - } - llTitle.getBtnRight().setOnClickListener(this); - llTitle.setLayoutParams(new LayoutParams( - LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); - llPage.addView(llTitle); - - FrameLayout flPage = new FrameLayout(getContext()); - LayoutParams lpFl = new LayoutParams( - LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - lpFl.weight = 1; - flPage.setLayoutParams(lpFl); - llPage.addView(flPage); - - // 关注(或朋友)列表 - PullToRefreshView followList = new PullToRefreshView(getContext()); - FrameLayout.LayoutParams lpLv = new FrameLayout.LayoutParams( - LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); - followList.setLayoutParams(lpLv); - flPage.addView(followList); - adapter = new FollowAdapter(followList); - adapter.setPlatform(platform); - followList.setAdapter(adapter); - adapter.getListView().setOnItemClickListener(this); - - ImageView ivShadow = new ImageView(getContext()); - resId = getBitmapRes(getContext(), "title_shadow"); - if (resId > 0) { - ivShadow.setBackgroundResource(resId); - } - FrameLayout.LayoutParams lpSd = new FrameLayout.LayoutParams( - LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - ivShadow.setLayoutParams(lpSd); - flPage.addView(ivShadow); - - // 请求数据 - followList.performPulling(true); - } - - public void onClick(View v) { - if (v.equals(llTitle.getBtnRight())) { - ArrayList selected = new ArrayList(); - for (int i = 0, size = adapter.getCount(); i < size; i++) { - if (adapter.getItem(i).checked) { - selected.add(adapter.getItem(i).atName); - } - } - - setResultForChecked(selected); - } - - finish(); - } - - public void onItemClick(AdapterView parent, View view, int position, long id) { - String name = platform.getName(); - if (isRadioMode(name)) { - if(lastPosition >= 0) { - Following lastFollwing = adapter.getItem(lastPosition); - lastFollwing.checked = false; - } - lastPosition = position; - } - Following following = adapter.getItem(position); - following.checked = !following.checked; - adapter.notifyDataSetChanged(); - } - - private static class FollowAdapter extends PullToRefreshListAdapter - implements PlatformActionListener, Callback { - private static final int FOLLOW_LIST_EMPTY = 2; - private int curPage; - private ArrayList follows; - private HashMap map; - private boolean hasNext; - private Platform platform; - private PRTHeader llHeader; - private Bitmap bmChd; - private Bitmap bmUnch; - - public FollowAdapter(PullToRefreshView view) { - super(view); - curPage = -1; - hasNext = true; - map = new HashMap(); - follows = new ArrayList(); - - llHeader = new PRTHeader(getContext()); - - int resId = getBitmapRes(getContext(), "auth_follow_cb_chd"); - if (resId > 0) { - bmChd = BitmapFactory.decodeResource(view.getResources(), resId); - } - resId = getBitmapRes(getContext(), "auth_follow_cb_unc"); - if (resId > 0) { - bmUnch = BitmapFactory.decodeResource(view.getResources(), resId); - } - } - - public void setPlatform(Platform platform) { - this.platform = platform; - platform.setPlatformActionListener(this); - } - - private void next() { - if (hasNext) { - platform.listFriend(15, curPage + 1, null); - } - } - - public View getView(int position, View convertView, ViewGroup parent) { - FollowListItem item = null; - boolean simpleMode = "FacebookMessenger".equals(platform.getName()); - if (convertView == null) { - LinearLayout llItem = new LinearLayout(parent.getContext()); - item = new FollowListItem(); - llItem.setTag(item); - convertView = llItem; - - int dp_52 = com.mob.tools.utils.R.dipToPx(getContext(), 52); - int dp_10 = com.mob.tools.utils.R.dipToPx(parent.getContext(), 10); - int dp_5 = com.mob.tools.utils.R.dipToPx(parent.getContext(), 5); - - if(!simpleMode) { - item.aivIcon = new AsyncImageView(getContext()); - LayoutParams lpIcon = new LayoutParams(dp_52, dp_52); - lpIcon.gravity = Gravity.CENTER_VERTICAL; - lpIcon.setMargins(dp_10, dp_5, dp_10, dp_5); - item.aivIcon.setLayoutParams(lpIcon); - llItem.addView(item.aivIcon); - } - - LinearLayout llText = new LinearLayout(parent.getContext()); - llText.setPadding(0, dp_10, dp_10, dp_10); - llText.setOrientation(LinearLayout.VERTICAL); - LayoutParams lpText = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpText.gravity = Gravity.CENTER_VERTICAL; - lpText.weight = 1; - llText.setLayoutParams(lpText); - llItem.addView(llText); - - item.tvName = new TextView(parent.getContext()); - item.tvName.setTextColor(0xff000000); - item.tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); - item.tvName.setSingleLine(); - if(simpleMode) { - item.tvName.setPadding(dp_10, 0, 0, 0); - } - llText.addView(item.tvName); - - if(!simpleMode) { - item.tvSign = new TextView(parent.getContext()); - item.tvSign.setTextColor(0x7f000000); - item.tvSign.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); - item.tvSign.setSingleLine(); - llText.addView(item.tvSign); - } - - item.ivCheck = new ImageView(parent.getContext()); - item.ivCheck.setPadding(0, 0, dp_10, 0); - LayoutParams lpCheck = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpCheck.gravity = Gravity.CENTER_VERTICAL; - item.ivCheck.setLayoutParams(lpCheck); - llItem.addView(item.ivCheck); - } else { - item = (FollowListItem) convertView.getTag(); - } - - Following following = getItem(position); - item.tvName.setText(following.screenName); - if(!simpleMode) { - item.tvSign.setText(following.description); - } - item.ivCheck.setImageBitmap(following.checked ? bmChd : bmUnch); - if(!simpleMode) { - if (isFling()) { - Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon); - if (bm != null && !bm.isRecycled()) { - item.aivIcon.setImageBitmap(bm); - } else { - item.aivIcon.execute(null, 0); - } - } else { - item.aivIcon.execute(following.icon,0); - } - } - - if (position == getCount() - 1) { - next(); - } - return convertView; - } - - public Following getItem(int position) { - return follows.get(position); - } - - public long getItemId(int position) { - return position; - } - - public int getCount() { - return follows == null ? 0 : follows.size(); - } - - public View getHeaderView() { - return llHeader; - } - - public void onPullDown(int percent) { - llHeader.onPullDown(percent); - } - - public void onRequest() { - llHeader.onRequest(); - curPage = -1; - hasNext = true; - map.clear(); - next(); - } - - public void onCancel(Platform plat, int action) { - UIHandler.sendEmptyMessage(-1, this); - } - - public void onComplete(Platform plat, int action, HashMap res) { - FollowersResult followersResult = parseFollowers(platform.getName(), res, map); - - if(followersResult == null) { - UIHandler.sendEmptyMessage(FOLLOW_LIST_EMPTY, this); - return; - } - hasNext = followersResult.hasNextPage; - if (followersResult.list != null && followersResult.list.size() > 0) { - curPage++; - Message msg = new Message(); - msg.what = 1; - msg.obj = followersResult.list; - UIHandler.sendMessage(msg, this); - } - } - - public void onError(Platform plat, int action, Throwable t) { - t.printStackTrace(); - } - - public boolean handleMessage(Message msg) { - if (msg.what < 0) { - ((Activity) getContext()).finish(); - } else if(msg.what == FOLLOW_LIST_EMPTY) { - notifyDataSetChanged(); - } else { - if (curPage <= 0) { - follows.clear(); - } - @SuppressWarnings("unchecked") - ArrayList data = (ArrayList) msg.obj; - follows.addAll(data); - notifyDataSetChanged(); - } - return false; - } - - public void onReversed() { - super.onReversed(); - llHeader.reverse(); - } - - } - - private static class FollowListItem { - public AsyncImageView aivIcon; - public TextView tvName; - public TextView tvSign; - public ImageView ivCheck; - } - - private static class PRTHeader extends LinearLayout { - private TextView tvHeader; - private RotateImageView ivArrow; - private ProgressBar pbRefreshing; - - public PRTHeader(Context context) { - super(context); - setOrientation(VERTICAL); - - LinearLayout llInner = new LinearLayout(context); - LayoutParams lpInner = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpInner.gravity = Gravity.CENTER_HORIZONTAL; - addView(llInner, lpInner); - - ivArrow = new RotateImageView(context); - int resId = getBitmapRes(context, "ssdk_oks_ptr_ptr"); - if (resId > 0) { - ivArrow.setImageResource(resId); - } - int dp_32 = dipToPx(context, 32); - LayoutParams lpIv = new LayoutParams(dp_32, dp_32); - lpIv.gravity = Gravity.CENTER_VERTICAL; - llInner.addView(ivArrow, lpIv); - - pbRefreshing = new ProgressBar(context); - llInner.addView(pbRefreshing, lpIv); - pbRefreshing.setVisibility(View.GONE); - - tvHeader = new TextView(getContext()); - tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); - tvHeader.setGravity(Gravity.CENTER); - int dp_10 = com.mob.tools.utils.R.dipToPx(getContext(), 10); - tvHeader.setPadding(dp_10, dp_10, dp_10, dp_10); - tvHeader.setTextColor(0xff000000); - LayoutParams lpTv = new LayoutParams( - LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lpTv.gravity = Gravity.CENTER_VERTICAL; - llInner.addView(tvHeader, lpTv); - } - - public void onPullDown(int percent) { - if (percent > 100) { - int degree = (percent - 100) * 180 / 20; - if (degree > 180) { - degree = 180; - } - if (degree < 0) { - degree = 0; - } - ivArrow.setRotation(degree); - } else { - ivArrow.setRotation(0); - } - - if (percent < 100) { - int resId = getStringRes(getContext(), "pull_to_refresh"); - if (resId > 0) { - tvHeader.setText(resId); - } - } else { - int resId = getStringRes(getContext(), "release_to_refresh"); - if (resId > 0) { - tvHeader.setText(resId); - } - } - } - - public void onRequest() { - ivArrow.setVisibility(View.GONE); - pbRefreshing.setVisibility(View.VISIBLE); - int resId = getStringRes(getContext(), "refreshing"); - if (resId > 0) { - tvHeader.setText(resId); - } - } - - public void reverse() { - pbRefreshing.setVisibility(View.GONE); - ivArrow.setRotation(180); - ivArrow.setVisibility(View.VISIBLE); - } - - } - - private static class RotateImageView extends ImageView { - private int rotation; - - public RotateImageView(Context context) { - super(context); - } - - public void setRotation(int degree) { - rotation = degree; - invalidate(); - } - - protected void onDraw(Canvas canvas) { - canvas.rotate(rotation, getWidth() / 2, getHeight() / 2); - super.onDraw(canvas); - } - - } - -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/theme/skyblue/PlatformGridViewAdapter.java b/app/src/main/java/cn/sharesdk/onekeyshare/theme/skyblue/PlatformGridViewAdapter.java deleted file mode 100644 index 57c097320d..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/theme/skyblue/PlatformGridViewAdapter.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - -package cn.sharesdk.onekeyshare.theme.skyblue; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.BaseAdapter; -import android.widget.ImageView; -import android.widget.TextView; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; - -import cn.sharesdk.framework.Platform; -import cn.sharesdk.onekeyshare.CustomerLogo; -import cn.sharesdk.onekeyshare.ShareCore; - -import static com.mob.tools.utils.R.getBitmapRes; -import static com.mob.tools.utils.R.getIdRes; -import static com.mob.tools.utils.R.getLayoutRes; - -public class PlatformGridViewAdapter extends BaseAdapter implements View.OnClickListener { - - private final Context context; - private List logos = new ArrayList(); - private List checkedPositionList = new ArrayList(); - private int directOnlyPosition = -1; - - static class ViewHolder { - public Integer position; - public ImageView logoImageView; - public ImageView checkedImageView; - public TextView nameTextView; - } - - public PlatformGridViewAdapter(Context context) { - this.context = context; - } - - @Override - public int getCount() { - return logos.size(); - } - - @Override - public Object getItem(int i) { - return logos.get(i); - } - - @Override - public long getItemId(int i) { - return i; - } - - @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; - } - - @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(); - } - - public void setData(Platform[] platforms, HashMap hiddenPlatforms) { - if(platforms == null) - return; - if (hiddenPlatforms != null && hiddenPlatforms.size() > 0) { - ArrayList ps = new ArrayList(); - for (Platform p : platforms) { - if (hiddenPlatforms.containsKey(p.getName())) { - continue; - } - ps.add(p); - } - - logos.addAll(ps); - } else { - logos.addAll(Arrays.asList(platforms)); - } - checkedPositionList.clear(); - notifyDataSetChanged(); - } - - public void setCustomerLogos(ArrayList customers) { - if(customers == null || customers.size() == 0) - return; - logos.addAll(customers); - } - - public List getCheckedItems() { - ArrayList list = new ArrayList(); - - if(directOnlyPosition != -1) { - list.add(getItem(directOnlyPosition)); - return list; - } - - Object item; - for(Integer position : checkedPositionList) { - item = getItem(position); - list.add(item); - } - return list; - } - - private Bitmap getIcon(Platform plat, String subfix) { - String resName = "skyblue_logo_" + plat.getName() + subfix; - int resId = getBitmapRes(context, resName); - return BitmapFactory.decodeResource(context.getResources(), resId); - } - - private String getName(Platform plat) { - if (plat == null) { - return ""; - } - - String name = plat.getName(); - if (name == null) { - return ""; - } - - int resId = com.mob.tools.utils.R.getStringRes(context, plat.getName()); - if (resId > 0) { - return context.getString(resId); - } - return null; - } -} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/theme/skyblue/PlatformListPage.java b/app/src/main/java/cn/sharesdk/onekeyshare/theme/skyblue/PlatformListPage.java deleted file mode 100644 index 6e93c248cc..0000000000 --- a/app/src/main/java/cn/sharesdk/onekeyshare/theme/skyblue/PlatformListPage.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - -package cn.sharesdk.onekeyshare.theme.skyblue; - -import android.os.AsyncTask; -import android.view.View; -import android.widget.GridView; -import android.widget.Toast; - -import java.util.List; - -import cn.sharesdk.framework.Platform; -import cn.sharesdk.framework.ShareSDK; -import cn.sharesdk.onekeyshare.PlatformListFakeActivity; - -import static com.mob.tools.utils.R.getLayoutRes; -import static com.mob.tools.utils.R.getStringRes; - -public class PlatformListPage extends PlatformListFakeActivity implements View.OnClickListener { - private PlatformGridViewAdapter gridViewAdapter; - - public void onCreate() { - super.onCreate(); - activity.setContentView(getLayoutRes(activity, "skyblue_share_platform_list")); - - initView(); - } - - private void initView() { - View backImageView = findViewByResName("backImageView"); - backImageView.setTag(android.R.string.cancel); - backImageView.setOnClickListener(this); - - View okImageView = findViewByResName("okImageView"); - okImageView.setTag(android.R.string.ok); - okImageView.setOnClickListener(this); - - gridViewAdapter = new PlatformGridViewAdapter(activity); - gridViewAdapter.setCustomerLogos(customerLogos); - - GridView gridView = (GridView) findViewByResName("gridView"); - gridView.setAdapter(gridViewAdapter); - - new AsyncTask() { - - @Override - protected Platform[] doInBackground(Void... params) { - return ShareSDK.getPlatformList(); - } - - @Override - protected void onPostExecute(Platform[] platforms) { - gridViewAdapter.setData(platforms, hiddenPlatforms); - } - }.execute(); - } - - public void onClick(View v) { - Object tag = v.getTag(); - if(tag == null || !(tag instanceof Integer)) - return; - - switch ((Integer)tag) { - case android.R.string.cancel: - setCanceled(true); - finish(); - break; - case android.R.string.ok: - onShareButtonClick(v); - break; - } - } - - private void onShareButtonClick(View v) { - if(gridViewAdapter == null || "locked".equals(v.getTag())) - return; - - List checkedPlatforms = gridViewAdapter.getCheckedItems(); - if(checkedPlatforms.size() == 0){ - Toast.makeText(activity, getStringRes(activity, "select_one_plat_at_least"), Toast.LENGTH_SHORT).show(); - return; - } - - v.setTag("locked"); - onShareButtonClick(v, checkedPlatforms); - } - -} diff --git a/app/src/main/java/com/gh/base/BaseActivity.java b/app/src/main/java/com/gh/base/BaseActivity.java index dffbc6fadd..25e61e850f 100644 --- a/app/src/main/java/com/gh/base/BaseActivity.java +++ b/app/src/main/java/com/gh/base/BaseActivity.java @@ -34,9 +34,8 @@ import java.util.List; import java.util.Map; import cn.sharesdk.framework.ShareSDK; -import cn.sharesdk.onekeyshare.OnekeyShare; -import cn.sharesdk.onekeyshare.PlatformListFakeActivity.OnShareButtonClickListener; import de.greenrobot.event.EventBus; +import onekeyshare.OnekeyShare; public class BaseActivity extends Activity { private String LOG = this.getClass().getName(); @@ -183,13 +182,13 @@ public class BaseActivity extends Activity { map.put("from", entrance); map.put("createdOn", System.currentTimeMillis() / 1000); - oks.setOnShareButtonClickListener(new OnShareButtonClickListener() { - @Override - public void onClick(View v, List checkPlatforms) { - map.put("method", checkPlatforms.get(0).getClass().getSimpleName()); - DataCollectionManager.onEvent(BaseActivity.this, "share", map); - } - }); +// oks.setOnShareButtonClickListener(new OnShareButtonClickListener() { +// @Override +// public void onClick(View v, List checkPlatforms) { +// map.put("method", checkPlatforms.get(0).getClass().getSimpleName()); +// DataCollectionManager.onEvent(BaseActivity.this, "share", map); +// } +// }); // 启动分享GUI oks.show(this); diff --git a/app/src/main/java/com/gh/base/BaseFragmentActivity.java b/app/src/main/java/com/gh/base/BaseFragmentActivity.java index 09efa68396..6720981d18 100644 --- a/app/src/main/java/com/gh/base/BaseFragmentActivity.java +++ b/app/src/main/java/com/gh/base/BaseFragmentActivity.java @@ -34,9 +34,9 @@ import java.util.List; import java.util.Map; import cn.sharesdk.framework.ShareSDK; -import cn.sharesdk.onekeyshare.OnekeyShare; -import cn.sharesdk.onekeyshare.PlatformListFakeActivity.OnShareButtonClickListener; + import de.greenrobot.event.EventBus; +import onekeyshare.OnekeyShare; public class BaseFragmentActivity extends FragmentActivity { private String LOG = this.getClass().getName(); @@ -177,15 +177,15 @@ public class BaseFragmentActivity extends FragmentActivity { map.put("from", entrance); map.put("createdOn", System.currentTimeMillis() / 1000); - oks.setOnShareButtonClickListener(new OnShareButtonClickListener() { - @Override - public void onClick(View v, List checkPlatforms) { - map.put("method", checkPlatforms.get(0).getClass() - .getSimpleName()); - DataCollectionManager.onEvent(BaseFragmentActivity.this, - "share", map); - } - }); +// oks.setOnShareButtonClickListener(new OnShareButtonClickListener() { +// @Override +// public void onClick(View v, List checkPlatforms) { +// map.put("method", checkPlatforms.get(0).getClass() +// .getSimpleName()); +// DataCollectionManager.onEvent(BaseFragmentActivity.this, +// "share", map); +// } +// }); // 启动分享GUI oks.show(this); diff --git a/app/src/main/java/com/gh/download/DataWatcher.java b/app/src/main/java/com/gh/download/DataWatcher.java index 50334b32f4..393ef11fb9 100644 --- a/app/src/main/java/com/gh/download/DataWatcher.java +++ b/app/src/main/java/com/gh/download/DataWatcher.java @@ -1,8 +1,8 @@ package com.gh.download; -import java.util.HashMap; -import java.util.Observable; -import java.util.Observer; + import java.util.HashMap; + import java.util.Observable; + import java.util.Observer; public abstract class DataWatcher implements Observer{ @@ -13,6 +13,6 @@ public abstract class DataWatcher implements Observer{ } public abstract void onDataChanged(HashMap downloadingEntries); - - + + } diff --git a/app/src/main/java/com/gh/gamecenter/SearchNewActivity.java b/app/src/main/java/com/gh/gamecenter/SearchNewActivity.java new file mode 100644 index 0000000000..c9b8ab6ea8 --- /dev/null +++ b/app/src/main/java/com/gh/gamecenter/SearchNewActivity.java @@ -0,0 +1,313 @@ +package com.gh.gamecenter; + +import android.app.ActionBar; +import android.app.FragmentManager; +import android.app.FragmentTransaction; +import android.content.Context; +import android.os.Build; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.text.Editable; +import android.text.TextUtils; +import android.text.TextWatcher; +import android.view.KeyEvent; +import android.view.View; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import com.gh.base.BaseActivity; +import com.gh.common.constant.Config; +import com.gh.common.util.DisplayUtils; +import com.gh.gamecenter.db.SearchHistoryDao; +import com.gh.gamecenter.manager.DataCollectionManager; +import com.gh.gamecenter.manager.SystemBarTintManager; +import com.gh.gamecenter.search.SearchNewDetailFragment; +import com.gh.gamecenter.search.SearchNewGameFragment; +import com.gh.gamecenter.search.SearchNewHistoryAdapter; +import com.gh.gamecenter.search.SearchNewHistoryFragment; +import com.tendcloud.tenddata.TCAgent; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by khy on 2016/5/20. + */ +public class SearchNewActivity extends BaseActivity implements SearchNewHistoryAdapter.OnCallBackKeysListener{ + private RelativeLayout mSearchBack; + private ImageView mSearchCancel; + private TextView mSearchBtn; + private EditText mSearchInput; + + private SearchNewDetailFragment mSearchNewDetailFragment; + private SearchNewGameFragment mSearchNewGameFragment; + private SearchNewHistoryFragment mSearchNewHistoryFragment; + + private final static int HISTORY_TYPE = 0; + private final static int GAME_TYPE = 1; + private final static int DETAIL_TYPE = 2; + private final static int NOTHING_TYPE = 3; + + private FragmentManager fragmentManager; + private String searchKey; + private boolean isFromHome; + private String hint; + private SearchHistoryDao mDao; + public static boolean readyToSearch = true; + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + View contentView = View.inflate(this, R.layout.activity_search, null); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + setTheme(R.style.AppTheme); + setTranslucentStatus(true); + SystemBarTintManager tintManager = new SystemBarTintManager(this); + tintManager.setStatusBarTintEnabled(true); + tintManager.setStatusBarTintResource(R.color.search_theme_colors); + SystemBarTintManager.SystemBarConfig config = tintManager.getConfig(); + contentView.setPadding(0, config.getPixelInsetTop(false), 0, + config.getPixelInsetBottom()); + } + + setContentView(contentView); + fragmentManager = getFragmentManager(); + mDao = new SearchHistoryDao(this); + FindView(); + initSearch(); + setActionBarLayout(); + mSearchInput.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + if (s.length()>0){ + mSearchCancel.setVisibility(View.VISIBLE); + }else { + mSearchCancel.setVisibility(View.GONE); + } + } + + @Override + public void afterTextChanged(Editable s) { + searchKey = s.toString().trim(); + if(searchKey.length()<1){ + setResultPresentModel(HISTORY_TYPE,searchKey); + }else { + setResultPresentModel(GAME_TYPE,searchKey); + } + + } + }); + + } + public void setActionBarLayout() { + int actionbar_height = getSharedPreferences(Config.PREFERENCE, + Context.MODE_PRIVATE).getInt("actionbar_height", + DisplayUtils.dip2px(getApplicationContext(), 48)); + + LinearLayout reuse_actionbar = (LinearLayout) findViewById(R.id.search_actionbar); + LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams( + ActionBar.LayoutParams.MATCH_PARENT, actionbar_height); + reuse_actionbar.setLayoutParams(lparams); + + mSearchInput = (EditText) findViewById(R.id.etSearch); + mSearchInput.setOnEditorActionListener(new TextView.OnEditorActionListener() { + @Override + public boolean onEditorAction(TextView v, int actionId, + KeyEvent event) { + + if (actionId == EditorInfo.IME_ACTION_SEARCH) { + InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(v.getWindowToken(), 0); + searchKey = mSearchInput.getText().toString().trim(); + if (searchKey.length() < 1) { + if (!TextUtils.isEmpty(hint)) { + mSearchInput.setText(hint); + mSearchInput.setSelection(mSearchInput.getText() + .length()); + searchKey = mSearchInput.getHint().toString(); + } + } + if (!TextUtils.isEmpty(searchKey)) { + if (readyToSearch) { + readyToSearch = false; + setResultPresentModel(DETAIL_TYPE,searchKey); + } + // TODO: add new history + mDao.add(searchKey); + } else { + toast("请输入搜索内容"); + } + } + return false; + } + }); + + if (isFromHome && !TextUtils.isEmpty(hint)) { + mSearchInput.setText(hint); + mSearchInput.setSelection(mSearchInput.getText().length()); + } else if (!TextUtils.isEmpty(hint)) { + mSearchInput.setHint(hint); + } else { + mSearchInput.setHint("搜索游戏..."); + } + + mSearchBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(v.getWindowToken(), 0); + searchKey = mSearchInput.getText().toString().trim(); + if (searchKey.length() < 1) { + if (!TextUtils.isEmpty(hint)) { + mSearchInput.setText(hint); + mSearchInput + .setSelection(mSearchInput.getText().length()); + searchKey = mSearchInput.getHint().toString(); + } + } + if (!TextUtils.isEmpty(searchKey)) { + if (readyToSearch) { + readyToSearch = false; + setResultPresentModel(DETAIL_TYPE,searchKey); + } + // TODO: add new history + mDao.add(searchKey); + } else { + toast("请输入搜索内容"); + } + } + }); + } + + private void initSearch() { + isFromHome = getIntent().getExtras().getBoolean("clicked"); + hint = getIntent().getExtras().getString("hint"); + if (isFromHome && !TextUtils.isEmpty(hint)) { + searchKey = hint; + setResultPresentModel(DETAIL_TYPE,searchKey); + } else { + setResultPresentModel(HISTORY_TYPE,searchKey); + } + } + + private void setResultPresentModel(int type,String keys) { + FragmentTransaction transaction = fragmentManager.beginTransaction(); +// hideFragments(transaction); + switch (type) { + case DETAIL_TYPE: + TCAgent.onEvent(SearchNewActivity.this, "搜索页面", keys); + + Map map = new HashMap(); + map.put("key", keys); + map.put("from", "搜索页面"); + map.put("createdOn", System.currentTimeMillis() / 1000); + DataCollectionManager.onEvent(this, "search", map); + +// if (mSearchNewDetailFragment != null) { +// transaction.remove(mSearchNewDetailFragment); +// mSearchNewDetailFragment.clearSearchResult(); +// mSearchNewDetailFragment = null; +// } + + mSearchNewDetailFragment = new SearchNewDetailFragment(); + mSearchNewDetailFragment.SetKeys(keys); + transaction.replace(R.id.search_result, mSearchNewDetailFragment); + break; + + case HISTORY_TYPE: +// if (mSearchNewHistoryFragment != null) { +// transaction.remove(mSearchNewHistoryFragment); +//// mSearchNewHistoryFragment.clearSearchResult(); +// mSearchNewHistoryFragment = null; +// } + mSearchNewHistoryFragment = new SearchNewHistoryFragment(); + transaction.replace(R.id.search_result, mSearchNewHistoryFragment); + break; + + case GAME_TYPE: +// if (mSearchNewGameFragment != null) { +// transaction.remove(mSearchNewGameFragment); +//// mSearchNewGameFragment.clearSearchResult(); +// mSearchNewGameFragment = null; +// }else { + mSearchNewGameFragment = new SearchNewGameFragment(); + mSearchNewGameFragment.setKeys(keys); + transaction.replace(R.id.search_result, mSearchNewGameFragment); +// } + + break; + + case NOTHING_TYPE: + break; + default: + break; + } + transaction.commit(); + } + +// private void hideFragments(FragmentTransaction transaction) { +// if (mSearchNewDetailFragment != null) { +// transaction.hide(mSearchNewDetailFragment); +// } +// if (mSearchNewGameFragment != null) { +// transaction.hide(mSearchNewGameFragment); +// } +// if (mSearchNewHistoryFragment != null) { +// transaction.hide(mSearchNewHistoryFragment); +// } +// } + + private void FindView() { + mSearchBack = (RelativeLayout) this.findViewById(R.id.btnGoBack); + mSearchCancel = (ImageView) this.findViewById(R.id.ivDeleteText); + mSearchBtn = (TextView) this.findViewById(R.id.btnSearch); + mSearchInput = (EditText) this.findViewById(R.id.etSearch); + mSearchBack.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + }); + mSearchCancel.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mSearchCancel.setVisibility(View.GONE); + mSearchInput.setText(""); + } + + }); + } + + + @Override + protected void onDestroy() { + super.onDestroy(); + } + + @Override + public void OnCallBackKeys(String keys,int type) { + mSearchInput.setText(keys); + mSearchInput.setFocusable(true); + mSearchInput.setSelection(keys.length()); + mSearchInput.requestFocus(); + if(type == DETAIL_TYPE){ + setResultPresentModel(DETAIL_TYPE,keys); + mSearchInput.performClick(); + } + if(type == GAME_TYPE){ + setResultPresentModel(GAME_TYPE,keys); + } + + + } +} diff --git a/app/src/main/java/com/gh/gamecenter/WXEntryActivity.java b/app/src/main/java/com/gh/gamecenter/WXEntryActivity.java new file mode 100644 index 0000000000..73c458a54a --- /dev/null +++ b/app/src/main/java/com/gh/gamecenter/WXEntryActivity.java @@ -0,0 +1,56 @@ +package com.gh.gamecenter; + +/** + * Created by idea on 2016/4/6. + */ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +import cn.sharesdk.wechat.utils.WXMediaMessage; + +import android.content.Context; +import android.content.Intent; +import android.widget.Toast; + +import cn.sharesdk.wechat.utils.WXAppExtendObject; +import cn.sharesdk.wechat.utils.WXMediaMessage; +import cn.sharesdk.wechat.utils.WechatHandlerActivity; + +/** + * 微信客户端回调activity示例 + */ +public class WXEntryActivity extends WechatHandlerActivity { + /** + * 处理微信发出的向第三方应用请求app message + *

+ * 在微信客户端中的聊天页面有“添加工具”,可以将本应用的图标添加到其中 + * 此后点击图标,下面的代码会被执行。Demo仅仅只是打开自己而已,但你可 + * 做点其他的事情,包括根本不打开任何页面 + */ + public void onGetMessageFromWXReq(WXMediaMessage msg) { + Intent iLaunchMyself = getPackageManager().getLaunchIntentForPackage(getPackageName()); + startActivity(iLaunchMyself); + } + + /** + * 处理微信向第三方应用发起的消息 + *

+ * 此处用来接收从微信发送过来的消息,比方说本demo在wechatpage里面分享 + * 应用时可以不分享应用文件,而分享一段应用的自定义信息。接受方的微信 + * 客户端会通过这个方法,将这个信息发送回接收方手机上的本demo中,当作 + * 回调。 + *

+ * 本Demo只是将信息展示出来,但你可做点其他的事情,而不仅仅只是Toast + */ + public void onShowMessageFromWXReq(WXMediaMessage msg) { + if (msg != null && msg.mediaObject != null && (msg.mediaObject instanceof WXAppExtendObject)) { + WXAppExtendObject obj = (WXAppExtendObject) msg.mediaObject; + Toast.makeText(this, obj.extInfo, Toast.LENGTH_SHORT).show(); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/home/HomeFragment.java b/app/src/main/java/com/gh/gamecenter/home/HomeFragment.java index 37549eb20b..d4bf795f26 100644 --- a/app/src/main/java/com/gh/gamecenter/home/HomeFragment.java +++ b/app/src/main/java/com/gh/gamecenter/home/HomeFragment.java @@ -38,6 +38,7 @@ import com.gh.gamecenter.ConcernActivity; import com.gh.gamecenter.DownloadManagerActivity; import com.gh.gamecenter.R; import com.gh.gamecenter.SearchActivity; +import com.gh.gamecenter.SearchNewActivity; import com.gh.gamecenter.SettingActivity; import com.gh.gamecenter.entity.ApkEntity; import com.gh.gamecenter.entity.DismissEntity; @@ -311,8 +312,10 @@ public class HomeFragment extends Fragment implements OnClickListener { map.put("createOn", System.currentTimeMillis() / 1000); map.put("page", "主页"); DataCollectionManager.onEvent(getActivity(), "click-item", map); - - Intent goSearch = new Intent(getActivity(), SearchActivity.class); + /* + *修改 + */ + Intent goSearch = new Intent(getActivity(), SearchNewActivity.class); goSearch.putExtra("clicked", false); goSearch.putExtra("hint", hint); startActivity(goSearch); @@ -324,9 +327,11 @@ public class HomeFragment extends Fragment implements OnClickListener { map.put("createOn", System.currentTimeMillis() / 1000); map.put("page", "主页"); DataCollectionManager.onEvent(getActivity(), "click-item", map); - + /* + *修改 + */ Intent searchIntent = new Intent(getActivity(), - SearchActivity.class); + SearchNewActivity.class); searchIntent.putExtra("clicked", true); searchIntent.putExtra("hint", hint); startActivity(searchIntent); diff --git a/app/src/main/java/com/gh/gamecenter/plugin/PluginFragment.java b/app/src/main/java/com/gh/gamecenter/plugin/PluginFragment.java index 618351b504..d37ca912eb 100644 --- a/app/src/main/java/com/gh/gamecenter/plugin/PluginFragment.java +++ b/app/src/main/java/com/gh/gamecenter/plugin/PluginFragment.java @@ -34,6 +34,7 @@ import com.gh.gamecenter.DownloadManagerActivity; import com.gh.gamecenter.MainActivity; import com.gh.gamecenter.R; import com.gh.gamecenter.SearchActivity; +import com.gh.gamecenter.SearchNewActivity; import com.gh.gamecenter.SettingActivity; import com.gh.gamecenter.eventbus.EBRedDot; import com.gh.gamecenter.eventbus.EBSkipNewPlugin; @@ -276,7 +277,7 @@ public class PluginFragment extends Fragment implements OnClickListener, map.put("page", "主页"); DataCollectionManager.onEvent(getActivity(), "click-item", map); - Intent goSearch = new Intent(getActivity(), SearchActivity.class); + Intent goSearch = new Intent(getActivity(), SearchNewActivity.class); goSearch.putExtra("clicked", false); goSearch.putExtra("hint", hint); startActivity(goSearch); @@ -290,7 +291,7 @@ public class PluginFragment extends Fragment implements OnClickListener, DataCollectionManager.onEvent(getActivity(), "click-item", map); Intent searchIntent = new Intent(getActivity(), - SearchActivity.class); + SearchNewActivity.class); searchIntent.putExtra("clicked", true); searchIntent.putExtra("hint", hint); startActivity(searchIntent); diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchNewDetailFragment.java b/app/src/main/java/com/gh/gamecenter/search/SearchNewDetailFragment.java new file mode 100644 index 0000000000..bb26b5a127 --- /dev/null +++ b/app/src/main/java/com/gh/gamecenter/search/SearchNewDetailFragment.java @@ -0,0 +1,112 @@ +package com.gh.gamecenter.search; + +import android.app.Fragment; +import android.net.Uri; +import android.os.Bundle; +import android.os.Handler; +import android.support.annotation.Nullable; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Toast; + +import com.android.volley.NoConnectionError; +import com.android.volley.Response; +import com.android.volley.VolleyError; +import com.gh.base.AppController; +import com.gh.common.constant.Config; +import com.gh.common.constant.Constants; +import com.gh.common.util.TimestampUtils; +import com.gh.gamecenter.R; +import com.gh.gamecenter.SearchActivity; +import com.gh.gamecenter.entity.DismissEntity; +import com.gh.gamecenter.entity.GameEntity; +import com.gh.gamecenter.eventbus.EBPWDismiss; +import com.gh.gamecenter.volley.extended.JsonArrayExtendedRequest; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +import org.json.JSONArray; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by khy on 2016/5/20. + */ +public class SearchNewDetailFragment extends Fragment implements SearchNewDetailAdapter.OnIsLoadOverListener{ + private View mDetailView; + private RecyclerView mDetailRecyclerView; + private String searchKey; + private SearchNewDetailAdapter mNewDetailAdapter; + private DismissEntity dismissEntity; + private LinearLayoutManager layoutManager; + private int page = 2; + public void SetKeys(String key) { + this.searchKey = key; + } + public boolean isLoadOver = true; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + if (mDetailView == null){ + mDetailView = inflater.inflate(R.layout.search1_fragment,container,false); + mDetailRecyclerView = (RecyclerView) mDetailView.findViewById(R.id.search_detail); + layoutManager = new LinearLayoutManager(getActivity()); + mDetailRecyclerView.setLayoutManager(layoutManager); + dismissEntity = new DismissEntity(false); + mNewDetailAdapter = new SearchNewDetailAdapter(getActivity(),searchKey,dismissEntity,mDetailView,this); + mDetailRecyclerView.setAdapter(mNewDetailAdapter); + mDetailRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrollStateChanged(RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + if(layoutManager.findLastVisibleItemPosition()==mNewDetailAdapter.getItemCount()-1&&newState == RecyclerView.SCROLL_STATE_IDLE){ + if(isLoadOver){ + isLoadOver = false; + mNewDetailAdapter.LoadData(page); + page++; + } + + } + } + + }); + + } + return mDetailView ; + } + public void clearSearchResult() { + mNewDetailAdapter.clearSearchResult(); + } + public void onEvent(EBPWDismiss dismiss) { + if (dismissEntity != null) { + dismissEntity.setShow(false); + } + } + + @Override + public void onDestroy() { + super.onDestroy(); + AppController.canclePendingRequests( + Search2GameListFragment.class); + mNewDetailAdapter = null; + searchKey = null; + mDetailView = null; + dismissEntity = null; + } + + @Override + public void OnIsLoadOver(boolean LoadOver) { + isLoadOver = LoadOver; + } +} diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchNewGameAdapter.java b/app/src/main/java/com/gh/gamecenter/search/SearchNewGameAdapter.java new file mode 100644 index 0000000000..1279e3eb57 --- /dev/null +++ b/app/src/main/java/com/gh/gamecenter/search/SearchNewGameAdapter.java @@ -0,0 +1,325 @@ +package com.gh.gamecenter.search; + +/** + * Created by khy on 2016/5/21. + */ +import android.content.Context; +import android.content.Intent; +import android.net.Uri; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.ViewGroup; +import android.view.inputmethod.InputMethodManager; +import android.widget.TextView; + +import com.android.volley.NoConnectionError; +import com.android.volley.Response; +import com.android.volley.VolleyError; +import com.gh.base.AppController; +import com.gh.common.constant.Config; +import com.gh.common.constant.Constants; +import com.gh.common.util.GameViewUtils; +import com.gh.common.util.ImageUtils; +import com.gh.common.util.TimestampUtils; +import com.gh.common.view.DownloadDialog; +import com.gh.gamecenter.GameDetailsActivity; +import com.gh.gamecenter.R; +import com.gh.gamecenter.adapter.viewholder.FooterViewHolder; +import com.gh.gamecenter.adapter.viewholder.GameViewHolder; +import com.gh.gamecenter.entity.DismissEntity; +import com.gh.gamecenter.entity.GameEntity; +import com.gh.gamecenter.manager.DataCollectionManager; +import com.gh.gamecenter.volley.extended.JsonArrayExtendedRequest; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.tendcloud.tenddata.TCAgent; + +import org.json.JSONArray; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class SearchNewGameAdapter extends + RecyclerView.Adapter { + + private Context context; + + private static List gameList = null; + private List gameListALl = new ArrayList(); + + private final int LIST_ITEM = 0; + private final int DETAIL_ITEM = 1; + private final int BOTTOM_TYPE = 2; + private static final int LIST_COUNT = 20; + int page = 1; + private String key; + private DismissEntity dismissEntity; + private OnIsLoadOverListener isLoadOverListener; + + public SearchNewGameAdapter(Context context, String keys, + DismissEntity dEntity, SearchNewGameFragment searchNewGameFragment) { + this.context = context; + this.dismissEntity = dEntity; + searchGame(keys,page); + key = keys; + this.isLoadOverListener = (OnIsLoadOverListener) searchNewGameFragment; + } + + public void clearSearchResult() { + if (gameListALl != null) { + gameListALl.clear(); + } + notifyDataSetChanged(); + } + + public int getListSize() { + return gameListALl.size(); + } + + public void searchGame(String keys,int page) { + JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(TimestampUtils.addTimestamp( + Config.HOST + "v1d45/search/game?keyword=" + Uri.encode(keys)+"&limit=20&page="+page, + Constants.SEARCH_CD), new Response.Listener() { + + @Override + public void onResponse(JSONArray response) { + + Type listType = new TypeToken>() { + }.getType(); + Gson gson = new Gson(); + gameList = gson.fromJson(response.toString(), listType); + gameListALl.addAll(gameList); + isLoadOverListener.OnIsLoadOver(true); + if (gameList != null && gameList.size() > 0) { + notifyDataSetChanged(); + } + + } + + }, new Response.ErrorListener() { + + @Override + public void onErrorResponse(VolleyError error) { + + // 无网络连接 + if (error.getClass().equals(NoConnectionError.class)) { + + } + } + + }); + AppController.addToRequestQueue(request, Search2GameListAdapter.class); + } + + @Override + public int getItemCount() { + if (gameList == null) { + return 0; + } else if(LIST_COUNT == gameList.size()){ + return gameListALl.size()+1; + }else { + return gameListALl.size(); + } + } + + @Override + public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, + final int position) { + if (gameListALl != null&&gameListALl.size()>0) { + if (position == 0) { + + GameViewHolder holder = (GameViewHolder) viewHolder; + + holder.gameSeq.setText((position + 1) + ""); + + final GameEntity gameEntity = gameListALl.get(position); + + ImageUtils.getInstance(context).display(gameEntity.getIcon(), + holder.gameThumb); + if (gameEntity.getApk() == null + || gameEntity.getApk().isEmpty()) { + holder.gameNameAndSize.setText(gameEntity.getName()); + } else { + holder.gameNameAndSize.setText(gameEntity.getName() + + " | " + gameEntity.getApk().get(0).getSize()); + } + holder.gameDes.setText(gameEntity.getBrief()); + + GameViewUtils.setLabelList(context, holder.labelList, + gameEntity.getTag()); + + holder.itemView.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + + TCAgent.onEvent(context, "搜索页面", key); + + Map map = new HashMap(); + map.put("key", key); + map.put("from", "搜索页面"); + map.put("createdOn", System.currentTimeMillis() / 1000); + DataCollectionManager.onEvent(context, "search", map); + + Map kv = new HashMap(); + kv.put("入口", "搜索"); + TCAgent.onEvent(context, "游戏详情", gameEntity.getName(), + kv); + + Map map2 = new HashMap(); + map2.put("location", "搜索"); + map2.put("createOn", System.currentTimeMillis() / 1000); + map2.put("game", gameEntity.getName()); + map2.put("page", "搜索"); + DataCollectionManager.onEvent(context, "click-item", map2); + + AppController.put("GameEntity", gameEntity); + Intent intent = new Intent(context, + GameDetailsActivity.class); + intent.putExtra("entrance", "搜索"); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(intent); + } + }); + + if (gameEntity.getApk() == null + || gameEntity.getApk().isEmpty()) { + holder.downloadBtn.setVisibility(View.GONE); + } else { + holder.downloadBtn + .setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + InputMethodManager imm = (InputMethodManager) context + .getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow( + v.getWindowToken(), 0); + if (!dismissEntity.isShow()) { + dismissEntity.setShow(true); + DownloadDialog + .getInstance(context) + .showPopupWindow( + v, + gameEntity, + "搜索", + "搜索:" + + gameEntity + .getName()); + } + } + }); + } + + if (Config.isShow) { + holder.downloadBtn.setVisibility(View.VISIBLE); + } else { + holder.downloadBtn.setVisibility(View.GONE); + } + } else { + if(viewHolder instanceof GameListViewHolder){ + GameListViewHolder holder = (GameListViewHolder) viewHolder; + + holder.initEntity(gameListALl.get(position)); + holder.tv_gameName.setText(gameListALl.get(position).getName()); + } + + } + } + } + + @Override + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, + int viewType) { + if (viewType == DETAIL_ITEM) { + + View itemView = LayoutInflater.from(viewGroup.getContext()) + .inflate(R.layout.home_list_item_gamenormal_type, + viewGroup, false); + + return new GameViewHolder(itemView); + + } else if (viewType == LIST_ITEM) { + + View itemView = LayoutInflater.from(viewGroup.getContext()) + .inflate(R.layout.search2_gamelist_fragment_item, + viewGroup, false); + + return new GameListViewHolder(itemView); + + } else if(viewType == BOTTOM_TYPE){ + + return new FooterViewHolder(LayoutInflater.from(context).inflate(R.layout.refresh_footerview,viewGroup,false)); + }else { + return null; + } + + } + + @Override + public int getItemViewType(int position) { + if (position == 0) { + return DETAIL_ITEM; + } else if(getItemCount()==position+1&&gameList.size()==20){ + return BOTTOM_TYPE; + }else { + return LIST_ITEM; + } + } + + public class GameListViewHolder extends RecyclerView.ViewHolder implements + OnClickListener { + + public TextView tv_gameName; + + private View rootItem; + private GameEntity game; + + public GameListViewHolder(View v) { + super(v); + + rootItem = v; + tv_gameName = (TextView) v.findViewById(R.id.search_gamelist_name); + + rootItem.setOnClickListener(this); + } + + public void initEntity(GameEntity entity) { + this.game = entity; + } + + @Override + public void onClick(View v) { + if (v == rootItem) { + TCAgent.onEvent(context, "搜索页面", key); + + Map map = new HashMap(); + map.put("key", key); + map.put("from", "搜索页面"); + map.put("createdOn", System.currentTimeMillis() / 1000); + DataCollectionManager.onEvent(context, "search", map); + + Map map2 = new HashMap(); + map2.put("location", "搜索"); + map2.put("createOn", System.currentTimeMillis() / 1000); + map2.put("game", game.getName()); + map2.put("page", "搜索"); + DataCollectionManager.onEvent(context, "click-item", map2); + + AppController.put("GameEntity", game); + Intent intent = new Intent(context, GameDetailsActivity.class); + intent.putExtra("entrance", "搜索"); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(intent); + } + } + + } + public interface OnIsLoadOverListener{ + void OnIsLoadOver(boolean LoadOver); + } + +} diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchNewGameFragment.java b/app/src/main/java/com/gh/gamecenter/search/SearchNewGameFragment.java new file mode 100644 index 0000000000..73012b2c64 --- /dev/null +++ b/app/src/main/java/com/gh/gamecenter/search/SearchNewGameFragment.java @@ -0,0 +1,100 @@ +package com.gh.gamecenter.search; + +import android.app.Fragment; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Toast; + +import com.gh.base.AppController; +import com.gh.common.util.Utils; +import com.gh.gamecenter.R; +import com.gh.gamecenter.entity.DismissEntity; +import com.gh.gamecenter.eventbus.EBPWDismiss; + +import de.greenrobot.event.EventBus; + +/** + * Created by khy on 2016/5/20. + */ +public class SearchNewGameFragment extends Fragment implements SearchNewGameAdapter.OnIsLoadOverListener{ + + private RecyclerView bodyView; + private SearchNewGameAdapter adapter; + + private String keys; + private DismissEntity dismissEntity; + int page = 2;//上拉刷新,从第二页开始 + private boolean isLoadOver = true;//防止多次上拉造成的数据缺失 + + public void setKeys(String keys) { + this.keys = keys; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savadInstanceState) { + + View search2_gamelist_Layout = inflater.inflate( + R.layout.search2_gamelist_fragment, container, false); + bodyView = (RecyclerView) search2_gamelist_Layout + .findViewById(R.id.search_gamelist); + bodyView.setHasFixedSize(true); + final LinearLayoutManager llm = new LinearLayoutManager(getActivity()); + llm.setOrientation(LinearLayoutManager.VERTICAL); + dismissEntity = new DismissEntity(false); + bodyView.setLayoutManager(llm); + adapter = new SearchNewGameAdapter(getActivity(), keys, dismissEntity,this); + bodyView.setAdapter(adapter); + bodyView.setOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrollStateChanged(RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + if(newState == RecyclerView.SCROLL_STATE_IDLE&&adapter.getItemCount()==llm.findLastVisibleItemPosition()+1&&isLoadOver){ + isLoadOver =false; + adapter.searchGame(keys,page); + page++; + } + } + }); + + EventBus.getDefault().register(this); + + return search2_gamelist_Layout; + } + + public void onEvent(EBPWDismiss dismiss) { + if (dismissEntity != null) { + dismissEntity.setShow(false); + } + } + + public void clearSearchResult() { + if (adapter == null) { + Utils.log("adapter is null"); + } else { + adapter.clearSearchResult(); + } + } + + @Override + public void onDestroy() { + super.onDestroy(); + EventBus.getDefault().unregister(this); + AppController.canclePendingRequests( + Search2GameListFragment.class); + bodyView = null; + adapter = null; + keys = null; + dismissEntity = null; + } + + @Override + public void OnIsLoadOver(boolean LoadOver) { + this.isLoadOver = LoadOver; + } +} diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchNewHistoryFragment.java b/app/src/main/java/com/gh/gamecenter/search/SearchNewHistoryFragment.java new file mode 100644 index 0000000000..2e949dc5de --- /dev/null +++ b/app/src/main/java/com/gh/gamecenter/search/SearchNewHistoryFragment.java @@ -0,0 +1,40 @@ +package com.gh.gamecenter.search; + +import android.app.Fragment; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.gh.gamecenter.R; +import com.gh.gamecenter.db.SearchHistoryDao; + +/** + * Created by khy on 2016/5/20. + */ +public class SearchNewHistoryFragment extends Fragment { + private View mHistoryView; + private RecyclerView mHistoryRecyclerView; + private SearchNewHistoryAdapter mHistoryAdapter; + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + if(mHistoryView == null){ + mHistoryView = inflater.inflate(R.layout.search3_history_fragment,container,false); + mHistoryRecyclerView = (RecyclerView) mHistoryView.findViewById(R.id.search_history); + mHistoryRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); + mHistoryRecyclerView.setHasFixedSize(true); + mHistoryAdapter = new SearchNewHistoryAdapter(getActivity(),new SearchHistoryDao(getActivity())); + mHistoryRecyclerView.setAdapter(mHistoryAdapter); + } + return mHistoryView; + } +} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/CustomerLogo.java b/app/src/main/java/onekeyshare/CustomerLogo.java similarity index 87% rename from app/src/main/java/cn/sharesdk/onekeyshare/CustomerLogo.java rename to app/src/main/java/onekeyshare/CustomerLogo.java index 027653c8b4..727479d479 100644 --- a/app/src/main/java/cn/sharesdk/onekeyshare/CustomerLogo.java +++ b/app/src/main/java/onekeyshare/CustomerLogo.java @@ -6,7 +6,7 @@ * Copyright (c) 2013年 mob.com. All rights reserved. */ -package cn.sharesdk.onekeyshare; +package onekeyshare; import android.graphics.Bitmap; import android.view.View.OnClickListener; @@ -14,7 +14,6 @@ import android.view.View.OnClickListener; /** 九宫格自定义的图标对象 */ public class CustomerLogo { public String label; - public Bitmap enableLogo; - public Bitmap disableLogo; + public Bitmap logo; public OnClickListener listener; } diff --git a/app/src/main/java/onekeyshare/OnekeyShare.java b/app/src/main/java/onekeyshare/OnekeyShare.java new file mode 100644 index 0000000000..0186589397 --- /dev/null +++ b/app/src/main/java/onekeyshare/OnekeyShare.java @@ -0,0 +1,260 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare; + +import android.content.Context; +import android.graphics.Bitmap; +import android.text.TextUtils; +import android.view.View; +import android.view.View.OnClickListener; + +import com.mob.tools.utils.R; +import java.util.ArrayList; +import java.util.HashMap; + +import cn.sharesdk.framework.Platform; +import cn.sharesdk.framework.PlatformActionListener; +import cn.sharesdk.framework.ShareSDK; + +import static com.mob.tools.utils.BitmapHelper.captureView; + +/** +* 快捷分享的入口 +*

+* 通过不同的setter设置参数,然后调用{@link #show(Context)}方法启动快捷分享 +*/ +public class OnekeyShare { + private HashMap params; + + public OnekeyShare() { + params = new HashMap(); + params.put("customers", new ArrayList()); + params.put("hiddenPlatforms", new HashMap()); + } + + /** address是接收人地址,仅在信息和邮件使用,否则可以不提供 */ + public void setAddress(String address) { + params.put("address", address); + } + + /** + * title标题,在印象笔记、邮箱、信息、微信(包括好友、朋友圈和收藏)、 + * 易信(包括好友、朋友圈)、人人网和QQ空间使用,否则可以不提供 + */ + public void setTitle(String title) { + params.put("title", title); + } + + /** titleUrl是标题的网络链接,仅在人人网和QQ空间使用,否则可以不提供 */ + public void setTitleUrl(String titleUrl) { + params.put("titleUrl", titleUrl); + } + + /** text是分享文本,所有平台都需要这个字段 */ + 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外的所有平台都支持这个字段 */ + public void setImagePath(String imagePath) { + if(!TextUtils.isEmpty(imagePath)) + params.put("imagePath", imagePath); + } + + /** imageUrl是图片的网络路径,新浪微博、人人网、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是待分享应用程序的本地路劲,仅在微信(易信)好友和Dropbox中使用,否则可以不提供 */ + public void setFilePath(String filePath) { + params.put("filePath", filePath); + } + + /** comment是我对这条分享的评论,仅在人人网和QQ空间使用,否则可以不提供 */ + public void setComment(String comment) { + params.put("comment", comment); + } + + /** site是分享此内容的网站名称,仅在QQ空间使用,否则可以不提供 */ + public void setSite(String site) { + params.put("site", site); + } + + /** siteUrl是分享此内容的网站地址,仅在QQ空间使用,否则可以不提供 */ + public void setSiteUrl(String siteUrl) { + params.put("siteUrl", siteUrl); + } + + /** foursquare分享时的地方名 */ + public void setVenueName(String venueName) { + params.put("venueName", venueName); + } + + /** foursquare分享时的地方描述 */ + public void setVenueDescription(String venueDescription) { + params.put("venueDescription", venueDescription); + } + + /** 分享地纬度,新浪微博、腾讯微博和foursquare支持此字段 */ + public void setLatitude(float latitude) { + params.put("latitude", latitude); + } + + /** 分享地经度,新浪微博、腾讯微博和foursquare支持此字段 */ + public void setLongitude(float longitude) { + params.put("longitude", longitude); + } + + /** 是否直接分享 */ + public void setSilent(boolean silent) { + params.put("silent", silent); + } + + /** 设置编辑页的初始化选中平台 */ + public void setPlatform(String platform) { + params.put("platform", platform); + } + + /** 设置KakaoTalk的应用下载地址 */ + public void setInstallUrl(String installurl) { + params.put("installurl", installurl); + } + + /** 设置KakaoTalk的应用打开地址 */ + public void setExecuteUrl(String executeurl) { + params.put("executeurl", executeurl); + } + + /** 设置微信分享的音乐的地址 */ + public void setMusicUrl(String musicUrl) { + params.put("musicUrl", musicUrl); + } + + /** 设置自定义的外部回调 */ + public void setCallback(PlatformActionListener callback) { + params.put("callback", callback); + } + + /** 返回操作回调 */ + public PlatformActionListener getCallback() { + return R.forceCast(params.get("callback")); + } + + /** 设置用于分享过程中,根据不同平台自定义分享内容的回调 */ + public void setShareContentCustomizeCallback(ShareContentCustomizeCallback callback) { + params.put("customizeCallback", callback); + } + + /** 自定义不同平台分享不同内容的回调 */ + public ShareContentCustomizeCallback getShareContentCustomizeCallback() { + return R.forceCast(params.get("customizeCallback")); + } + + /** 设置自己图标和点击事件,可以重复调用添加多次 */ + public void setCustomerLogo(Bitmap logo, String label, OnClickListener ocl) { + CustomerLogo cl = new CustomerLogo(); + cl.logo = logo; + cl.label = label; + cl.listener = ocl; + ArrayList customers = R.forceCast(params.get("customers")); + customers.add(cl); + } + + /** 设置一个总开关,用于在分享前若需要授权,则禁用sso功能 */ + public void disableSSOWhenAuthorize() { + params.put("disableSSO", true); + } + + /** 设置视频网络地址 */ + public void setVideoUrl(String url) { + params.put("url", url); + params.put("shareType", Platform.SHARE_VIDEO); + } + + /** 设置编辑页面的显示模式为Dialog模式 */ + @Deprecated + public void setDialogMode() { + params.put("dialogMode", true); + } + + /** 添加一个隐藏的platform */ + public void addHiddenPlatform(String platform) { + HashMap hiddenPlatforms = R.forceCast(params.get("hiddenPlatforms")); + hiddenPlatforms.put(platform, platform); + } + + /** 设置一个将被截图分享的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); + } + + /** 设置在执行分享到QQ或QZone的同时,分享相同的内容腾讯微博 */ + public void setShareToTencentWeiboWhenPerformingQQOrQZoneSharing() { + params.put("isShareTencentWeibo", true); + } + + /** 设置分享界面的样式,目前只有一种,不需要设置 */ + public void setTheme(OnekeyShareTheme theme) { + params.put("theme", theme.getValue()); + } + + @SuppressWarnings("unchecked") + public void show(Context context) { + HashMap shareParamsMap = new HashMap(); + shareParamsMap.putAll(params); + + ShareSDK.initSDK(context); + + // 打开分享菜单的统计 + ShareSDK.logDemoEvent(1, null); + + int iTheme = 0; + try { + iTheme = com.mob.tools.utils.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) shareParamsMap.remove("customers")); + themeImpl.setHiddenPlatforms((HashMap) 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); + } + +} diff --git a/app/src/main/java/onekeyshare/OnekeySharePage.java b/app/src/main/java/onekeyshare/OnekeySharePage.java new file mode 100644 index 0000000000..1c2ea4d6ce --- /dev/null +++ b/app/src/main/java/onekeyshare/OnekeySharePage.java @@ -0,0 +1,77 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare; + +import com.mob.tools.FakeActivity; + +import java.util.ArrayList; +import java.util.HashMap; + +import cn.sharesdk.framework.Platform; +import cn.sharesdk.framework.Platform.ShareParams; +import cn.sharesdk.framework.PlatformActionListener; + +/** 快捷分享的基类 */ +public class OnekeySharePage extends FakeActivity { + private OnekeyShareThemeImpl impl; + + public OnekeySharePage(OnekeyShareThemeImpl impl) { + this.impl = impl; + } + + /** 分享界面是否弹窗模式 */ + protected final boolean isDialogMode() { + return impl.dialogMode; + } + + protected final HashMap getShareParamsMap() { + return impl.shareParamsMap; + } + + /** 静默分享开关(没有界面,直接分享 )*/ + protected final boolean isSilent() { + return impl.silent; + } + + protected final ArrayList getCustomerLogos() { + return impl.customerLogos; + } + + protected final HashMap getHiddenPlatforms() { + return impl.hiddenPlatforms; + } + + protected final PlatformActionListener getCallback() { + return impl.callback; + } + + protected final ShareContentCustomizeCallback getCustomizeCallback() { + return impl.customizeCallback; + } + + protected final boolean isDisableSSO() { + return impl.disableSSO; + } + + protected final void shareSilently(Platform platform) { + impl.shareSilently(platform); + } + + protected final ShareParams formateShareData(Platform platform) { + if (impl.formateShareData(platform)) { + return impl.shareDataToShareParams(platform); + } + return null; + } + + protected final boolean isUseClientToShare(Platform platform) { + return impl.isUseClientToShare(platform); + } + +} diff --git a/app/src/main/java/onekeyshare/OnekeyShareTheme.java b/app/src/main/java/onekeyshare/OnekeyShareTheme.java new file mode 100644 index 0000000000..54ad31c0bb --- /dev/null +++ b/app/src/main/java/onekeyshare/OnekeyShareTheme.java @@ -0,0 +1,44 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare; + + +import onekeyshare.themes.classic.ClassicTheme; + +/** 快捷分享的主题样式 */ +public enum OnekeyShareTheme { + /** 九格宫的主题样式 ,对应的实现类ClassicTheme */ + CLASSIC(0, new ClassicTheme()); + + private final int value; + private final OnekeyShareThemeImpl impl; + + private OnekeyShareTheme(int value, OnekeyShareThemeImpl impl) { + this.value = value; + this.impl = impl; + } + + public int getValue() { + return value; + } + + public OnekeyShareThemeImpl getImpl() { + return impl; + } + + public static OnekeyShareTheme fromValue(int value) { + for (OnekeyShareTheme theme : OnekeyShareTheme.values()) { + if (theme.value == value) { + return theme; + } + } + return CLASSIC; + } + +} diff --git a/app/src/main/java/onekeyshare/OnekeyShareThemeImpl.java b/app/src/main/java/onekeyshare/OnekeyShareThemeImpl.java new file mode 100644 index 0000000000..e5a203ca3a --- /dev/null +++ b/app/src/main/java/onekeyshare/OnekeyShareThemeImpl.java @@ -0,0 +1,409 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare; + +import android.content.Context; +import android.content.Intent; +import android.content.pm.ResolveInfo; +import android.graphics.Bitmap; +import android.graphics.Bitmap.CompressFormat; +import android.os.Handler.Callback; +import android.os.Message; +import android.text.TextUtils; +import android.widget.Toast; + +import com.mob.tools.utils.UIHandler; +import com.mob.tools.utils.R; +import java.io.File; +import java.io.FileOutputStream; +import java.util.ArrayList; +import java.util.HashMap; + +import cn.sharesdk.framework.CustomPlatform; +import cn.sharesdk.framework.Platform; +import cn.sharesdk.framework.Platform.ShareParams; +import cn.sharesdk.framework.PlatformActionListener; +import cn.sharesdk.framework.ShareSDK; + +/** 快捷分享的主题样式的实现父类 */ +public abstract class OnekeyShareThemeImpl implements PlatformActionListener, Callback { + protected boolean dialogMode; + protected HashMap shareParamsMap; + protected boolean silent; + protected ArrayList customerLogos; + protected HashMap hiddenPlatforms; + protected PlatformActionListener callback; + protected ShareContentCustomizeCallback customizeCallback; + protected boolean disableSSO; + protected Context context; + + public OnekeyShareThemeImpl() { + callback = this; + } + + public final void setDialogMode(boolean dialogMode) { + this.dialogMode = dialogMode; + } + + public final void setShareParamsMap(HashMap shareParamsMap) { + this.shareParamsMap = shareParamsMap; + } + + public final void setSilent(boolean silent) { + this.silent = silent; + } + + public final void setCustomerLogos(ArrayList customerLogos) { + this.customerLogos = customerLogos; + } + + public final void setHiddenPlatforms(HashMap hiddenPlatforms) { + this.hiddenPlatforms = hiddenPlatforms; + } + + public final void setPlatformActionListener(PlatformActionListener callback) { + this.callback = callback == null ? this : callback; + } + + public final void setShareContentCustomizeCallback(ShareContentCustomizeCallback customizeCallback) { + this.customizeCallback = customizeCallback; + } + + public final void disableSSO() { + disableSSO = true; + } + + public final void show(Context context) { + this.context = context; + + // 显示方式是由platform和silent两个字段控制的 + // 如果platform设置了,则无须显示九宫格,否则都会显示; + // 如果silent为true,表示不进入编辑页面,否则会进入。 + if (shareParamsMap.containsKey("platform")) { + String name = String.valueOf(shareParamsMap.get("platform")); + Platform platform = ShareSDK.getPlatform(name); + boolean isCustomPlatform = platform instanceof CustomPlatform; + boolean isUseClientToShare = isUseClientToShare(platform); + if (silent || isCustomPlatform || isUseClientToShare) { + shareSilently(platform); + } else { + prepareForEditPage(platform); + } + } else { + showPlatformPage(context); + } + } + + /** 判断指定平台是否只能使用客户端分享 */ + final boolean isUseClientToShare(Platform platform) { + String name = platform.getName(); + if ("Wechat".equals(name) || "WechatMoments".equals(name) + || "WechatFavorite".equals(name) || "ShortMessage".equals(name) + || "Email".equals(name) || "GooglePlus".equals(name) + || "QQ".equals(name) || "Pinterest".equals(name) + || "Instagram".equals(name) || "Yixin".equals(name) + || "YixinMoments".equals(name) || "QZone".equals(name) + || "Mingdao".equals(name) || "Line".equals(name) + || "KakaoStory".equals(name) || "KakaoTalk".equals(name) + || "Bluetooth".equals(name) || "WhatsApp".equals(name) + || "BaiduTieba".equals(name) || "Laiwang".equals(name) + || "LaiwangMoments".equals(name) || "Alipay".equals(name) + || "FacebookMessenger".equals(name) + ) { + return true; + } else if ("Evernote".equals(name)) { + if ("true".equals(platform.getDevinfo("ShareByAppClient"))) { + return true; + } + } else if ("SinaWeibo".equals(name)) { + if ("true".equals(platform.getDevinfo("ShareByAppClient"))) { + Intent test = new Intent(Intent.ACTION_SEND); + test.setPackage("com.sina.weibo"); + test.setType("image/*"); + ResolveInfo ri = platform.getContext().getPackageManager().resolveActivity(test, 0); + return (ri != null); + } + } + + return false; + } + + final void shareSilently(Platform platform) { + if (formateShareData(platform)) { + ShareParams sp = shareDataToShareParams(platform); + if (sp != null) { + toast("ssdk_oks_sharing"); + if (customizeCallback != null) { + customizeCallback.onShare(platform, sp); + } + if (disableSSO) { + platform.SSOSetting(disableSSO); + } + platform.setPlatformActionListener(callback); + platform.share(sp); + } + } + } + + 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); + } + } + } + + final boolean formateShareData(Platform plat) { + String name = plat.getName(); + + boolean isGooglePlus = "GooglePlus".equals(name); + if (isGooglePlus && !plat.isClientValid()) { + toast("ssdk_google_plus_client_inavailable"); + return false; + } + + boolean isAlipay = "Alipay".equals(name); + if (isAlipay && !plat.isClientValid()) { + toast("ssdk_alipay_client_inavailable"); + return false; + } + + boolean isKakaoTalk = "KakaoTalk".equals(name); + if (isKakaoTalk && !plat.isClientValid()) { + toast("ssdk_kakaotalk_client_inavailable"); + return false; + } + + boolean isKakaoStory = "KakaoStory".equals(name); + if (isKakaoStory && !plat.isClientValid()) { + toast("ssdk_kakaostory_client_inavailable"); + return false; + } + + boolean isLine = "Line".equals(name); + if (isLine && !plat.isClientValid()) { + toast("ssdk_line_client_inavailable"); + return false; + } + + boolean isWhatsApp = "WhatsApp".equals(name); + if (isWhatsApp && !plat.isClientValid()) { + toast("ssdk_whatsapp_client_inavailable"); + return false; + } + + boolean isPinterest = "Pinterest".equals(name); + if (isPinterest && !plat.isClientValid()) { + toast("ssdk_pinterest_client_inavailable"); + return false; + } + + if ("Instagram".equals(name) && !plat.isClientValid()) { + toast("ssdk_instagram_client_inavailable"); + return false; + } + + boolean isLaiwang = "Laiwang".equals(name); + boolean isLaiwangMoments = "LaiwangMoments".equals(name); + if(isLaiwang || isLaiwangMoments){ + if (!plat.isClientValid()) { + toast("ssdk_laiwang_client_inavailable"); + return false; + } + } + + boolean isYixin = "YixinMoments".equals(name) || "Yixin".equals(name); + if (isYixin && !plat.isClientValid()) { + toast("ssdk_yixin_client_inavailable"); + return false; + } + + boolean isWechat = "WechatFavorite".equals(name) || "Wechat".equals(name) || "WechatMoments".equals(name); + if (isWechat && !plat.isClientValid()) { + toast("ssdk_wechat_client_inavailable"); + return false; + } + + if ("FacebookMessenger".equals(name) && !plat.isClientValid()) { + toast("ssdk_facebookmessenger_client_inavailable"); + return false; + } + + if (!shareParamsMap.containsKey("shareType")) { + int shareType = Platform.SHARE_TEXT; + String imagePath = String.valueOf(shareParamsMap.get("imagePath")); + if (imagePath != null && (new File(imagePath)).exists()) { + shareType = Platform.SHARE_IMAGE; + if (imagePath.endsWith(".gif") && isWechat) { + shareType = Platform.SHARE_EMOJI; + } else if (shareParamsMap.containsKey("url") && !TextUtils.isEmpty(shareParamsMap.get("url").toString())) { + shareType = Platform.SHARE_WEBPAGE; + if (shareParamsMap.containsKey("musicUrl") && !TextUtils.isEmpty(shareParamsMap.get("musicUrl").toString()) && isWechat) { + shareType = Platform.SHARE_MUSIC; + } + } + } else { + Bitmap viewToShare = R.forceCast(shareParamsMap.get("viewToShare")); + if (viewToShare != null && !viewToShare.isRecycled()) { + shareType = Platform.SHARE_IMAGE; + if (shareParamsMap.containsKey("url") && !TextUtils.isEmpty(shareParamsMap.get("url").toString())) { + shareType = Platform.SHARE_WEBPAGE; + if (shareParamsMap.containsKey("musicUrl") && !TextUtils.isEmpty(shareParamsMap.get("musicUrl").toString()) && isWechat) { + shareType = Platform.SHARE_MUSIC; + } + } + } else { + Object imageUrl = shareParamsMap.get("imageUrl"); + if (imageUrl != null && !TextUtils.isEmpty(String.valueOf(imageUrl))) { + shareType = Platform.SHARE_IMAGE; + if (String.valueOf(imageUrl).endsWith(".gif") && isWechat) { + shareType = Platform.SHARE_EMOJI; + } else if (shareParamsMap.containsKey("url") && !TextUtils.isEmpty(shareParamsMap.get("url").toString())) { + shareType = Platform.SHARE_WEBPAGE; + if (shareParamsMap.containsKey("musicUrl") && !TextUtils.isEmpty(shareParamsMap.get("musicUrl").toString()) && isWechat) { + shareType = Platform.SHARE_MUSIC; + } + } + } + } + } + shareParamsMap.put("shareType", shareType); + } + + return true; + } + + final ShareParams shareDataToShareParams(Platform plat) { + if (plat == null || shareParamsMap == null) { + toast("ssdk_oks_share_failed"); + return null; + } + + try { + String imagePath = R.forceCast(shareParamsMap.get("imagePath")); + Bitmap viewToShare = R.forceCast(shareParamsMap.get("viewToShare")); + if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) { + String path = com.mob.tools.utils.R.getCachePath(plat.getContext(), "screenshot"); + File ss = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg"); + FileOutputStream fos = new FileOutputStream(ss); + viewToShare.compress(CompressFormat.JPEG, 100, fos); + fos.flush(); + fos.close(); + shareParamsMap.put("imagePath", ss.getAbsolutePath()); + } + } catch (Throwable t) { + t.printStackTrace(); + toast("ssdk_oks_share_failed"); + return null; + } + + return new ShareParams(shareParamsMap); + } + + private void toast(final String resOrName) { + UIHandler.sendEmptyMessage(0, new Callback() { + public boolean handleMessage(Message msg) { + int resId = com.mob.tools.utils.R.getStringRes(context, resOrName); + if (resId > 0) { + Toast.makeText(context, resId, Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show(); + } + return false; + } + }); + } + + protected abstract void showPlatformPage(Context context); + + protected abstract void showEditPage(Context context, Platform platform, ShareParams sp); + + public final void onComplete(Platform platform, int action, + HashMap res) { + Message msg = new Message(); + msg.arg1 = 1; + msg.arg2 = action; + msg.obj = platform; + UIHandler.sendMessage(msg, this); + } + + 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); + } + + 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); + } + + public final boolean handleMessage(Message msg) { + switch (msg.arg1) { + case 1: { + // 成功 + int resId = com.mob.tools.utils.R.getStringRes(context, "ssdk_oks_share_completed"); + if (resId > 0) { + toast(context.getString(resId)); + } + } break; + case 2: { + // 失败 + String expName = msg.obj.getClass().getSimpleName(); + if ("WechatClientNotExistException".equals(expName) + || "WechatTimelineNotSupportedException".equals(expName) + || "WechatFavoriteNotSupportedException".equals(expName)) { + toast("ssdk_wechat_client_inavailable"); + } else if ("GooglePlusClientNotExistException".equals(expName)) { + toast("ssdk_google_plus_client_inavailable"); + } else if ("QQClientNotExistException".equals(expName)) { + toast("ssdk_qq_client_inavailable"); + } else if ("YixinClientNotExistException".equals(expName) + || "YixinTimelineNotSupportedException".equals(expName)) { + toast("ssdk_yixin_client_inavailable"); + } else if ("KakaoTalkClientNotExistException".equals(expName)) { + toast("ssdk_kakaotalk_client_inavailable"); + } else if ("KakaoStoryClientNotExistException".equals(expName)) { + toast("ssdk_kakaostory_client_inavailable"); + } else if("WhatsAppClientNotExistException".equals(expName)){ + toast("ssdk_whatsapp_client_inavailable"); + } else if("FacebookMessengerClientNotExistException".equals(expName)){ + toast("ssdk_facebookmessenger_client_inavailable"); + } else { + toast("ssdk_oks_share_failed"); + } + } break; + case 3: { + // 取消 + toast("ssdk_oks_share_canceled"); + } break; + } + return false; + } + +} diff --git a/app/src/main/java/cn/sharesdk/onekeyshare/ThemeShareCallback.java b/app/src/main/java/onekeyshare/ShareContentCustomizeCallback.java similarity index 63% rename from app/src/main/java/cn/sharesdk/onekeyshare/ThemeShareCallback.java rename to app/src/main/java/onekeyshare/ShareContentCustomizeCallback.java index c84267833c..350f7eb726 100644 --- a/app/src/main/java/cn/sharesdk/onekeyshare/ThemeShareCallback.java +++ b/app/src/main/java/onekeyshare/ShareContentCustomizeCallback.java @@ -6,12 +6,14 @@ * Copyright (c) 2013年 mob.com. All rights reserved. */ -package cn.sharesdk.onekeyshare; - -import java.util.HashMap; +package onekeyshare; import cn.sharesdk.framework.Platform; +import cn.sharesdk.framework.Platform.ShareParams; + +/** 自定义不同平台分享不同内容的接口 */ +public interface ShareContentCustomizeCallback { + + public void onShare(Platform platform, ShareParams paramsToShare); -public interface ThemeShareCallback { - public void doShare(HashMap> shareData); } diff --git a/app/src/main/java/onekeyshare/themes/classic/ClassicTheme.java b/app/src/main/java/onekeyshare/themes/classic/ClassicTheme.java new file mode 100644 index 0000000000..c70e6243c0 --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/ClassicTheme.java @@ -0,0 +1,52 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic; + +import android.content.Context; +import android.content.res.Configuration; + +import cn.sharesdk.framework.Platform; +import cn.sharesdk.framework.Platform.ShareParams; +import onekeyshare.OnekeyShareThemeImpl; +import onekeyshare.themes.classic.land.EditPageLand; +import onekeyshare.themes.classic.land.PlatformPageLand; +import onekeyshare.themes.classic.port.EditPagePort; +import onekeyshare.themes.classic.port.PlatformPagePort; + + +/** 九宫格经典主题样式的实现类*/ +public class ClassicTheme extends OnekeyShareThemeImpl { + + /** 展示平台列表*/ + protected void showPlatformPage(Context context) { + PlatformPage page; + int orientation = context.getResources().getConfiguration().orientation; + if (orientation == Configuration.ORIENTATION_PORTRAIT) { + page = new PlatformPagePort(this); + } else { + page = new PlatformPageLand(this); + } + page.show(context, null); + } + + /** 展示编辑界面*/ + protected void showEditPage(Context context, Platform platform, ShareParams sp) { + EditPage page; + int orientation = context.getResources().getConfiguration().orientation; + if (orientation == Configuration.ORIENTATION_PORTRAIT) { + page = new EditPagePort(this); + } else { + page = new EditPageLand(this); + } + page.setPlatform(platform); + page.setShareParams(sp); + page.show(context, null); + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/EditPage.java b/app/src/main/java/onekeyshare/themes/classic/EditPage.java new file mode 100644 index 0000000000..8b8d990710 --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/EditPage.java @@ -0,0 +1,239 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic; + +import android.app.Activity; +import android.content.res.Configuration; +import android.graphics.Bitmap; +import android.graphics.drawable.ColorDrawable; +import android.text.Editable; +import android.text.TextUtils; +import android.text.TextWatcher; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.ViewGroup.LayoutParams; +import android.view.WindowManager; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import android.widget.Toast; + +import com.mob.tools.gui.AsyncImageView; +import com.mob.tools.utils.DeviceHelper; + +import java.util.ArrayList; +import java.util.HashMap; +import com.mob.tools.utils.R; +import cn.sharesdk.framework.Platform; +import cn.sharesdk.framework.Platform.ShareParams; +import cn.sharesdk.framework.ShareSDK; +import onekeyshare.OnekeySharePage; +import onekeyshare.OnekeyShareThemeImpl; +import onekeyshare.themes.classic.land.FriendListPageLand; +import onekeyshare.themes.classic.port.FriendListPagePort; + + +public class EditPage extends OnekeySharePage implements OnClickListener, TextWatcher, Runnable { + private OnekeyShareThemeImpl impl; + protected Platform platform; + protected ShareParams sp; + + protected LinearLayout llPage; + protected RelativeLayout rlTitle; + protected ScrollView svContent; + protected EditText etContent; + protected TextView tvCancel; + protected TextView tvShare; + protected RelativeLayout rlThumb; + /** 异步加载图片的控件 */ + protected AsyncImageView aivThumb; + protected XView xvRemove; + protected LinearLayout llBottom; + protected TextView tvAt; + protected TextView tvTextCouter; + + protected Bitmap thumb; + protected int maxBodyHeight; + + public EditPage(OnekeyShareThemeImpl impl) { + super(impl); + this.impl = impl; + } + + public void setPlatform(Platform platform) { + this.platform = platform; + } + + public void setShareParams(ShareParams sp) { + this.sp = sp; + } + + public void setActivity(Activity activity) { + super.setActivity(activity); + if (isDialogMode()) { + System.err.println("Theme classic does not support dialog mode!"); +// activity.setTheme(android.R.style.Theme_Dialog); +// activity.requestWindowFeature(Window.FEATURE_NO_TITLE); +// if (Build.VERSION.SDK_INT >= 11) { +// try { +// ReflectHelper.invokeInstanceMethod(activity, "setFinishOnTouchOutside", false); +// } catch (Throwable e) {} +// } + } + + activity.getWindow().setSoftInputMode( + WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE | + WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); + } + + public void onCreate() { + activity.getWindow().setBackgroundDrawable(new ColorDrawable(0xfff3f3f3)); + } + + /** 取消分享时,执行的方法 */ + private void cancelAndFinish() { + // 分享失败的统计 + ShareSDK.logDemoEvent(5, platform); + finish(); + } + + /** 执行分享时的方法 */ + private void shareAndFinish() { + int resId = com.mob.tools.utils.R.getStringRes(activity, "ssdk_oks_sharing"); + if (resId > 0) { + Toast.makeText(activity, resId, Toast.LENGTH_SHORT).show(); + } + + if (isDisableSSO()) { + platform.SSOSetting(true); + } + platform.setPlatformActionListener(getCallback()); + platform.share(sp); + + finish(); + } + + /** 编辑界面,显示的图片 */ + private void showThumb(Bitmap pic) { + PicViewerPage page = new PicViewerPage(impl); + page.setImageBitmap(pic); + page.show(activity, null); + } + + private void removeThumb() { + sp.setImageArray(null); + sp.setImageData(null); + sp.setImagePath(null); + sp.setImageUrl(null); + } + + /** @ 好友时,展示的好友列表 */ + private void showFriendList() { + FriendListPage page; + int orientation = activity.getResources().getConfiguration().orientation; + if (orientation == Configuration.ORIENTATION_PORTRAIT) { + page = new FriendListPagePort(impl); + } else { + page = new FriendListPageLand(impl); + } + page.setPlatform(platform); + page.showForResult(platform.getContext(), null, this); + } + + public void onResult(HashMap data) { + String atText = getJoinSelectedUser(data); + if(!TextUtils.isEmpty(atText)) { + etContent.append(atText); + } + } + + private String getJoinSelectedUser(HashMap data) { + if (data != null && data.containsKey("selected")) { + @SuppressWarnings("unchecked") + ArrayList selected = (ArrayList) data.get("selected"); + String platform = ((Platform)data.get("platform")).getName(); + if("FacebookMessenger".equals(platform)) { + return null; + } + StringBuilder sb = new StringBuilder(); + for (String sel : selected) { + sb.append('@').append(sel).append(' '); + } + return sb.toString(); + } + return null; + } + + protected boolean isShowAtUserLayout(String platformName) { + return "SinaWeibo".equals(platformName) + || "TencentWeibo".equals(platformName) + || "Facebook".equals(platformName) + || "Twitter".equals(platformName); + } + + public void onClick(View v) { + if (v.equals(tvCancel)) { + cancelAndFinish(); + } else if (v.equals(tvShare)) { + sp.setText(etContent.getText().toString().trim()); + shareAndFinish(); + } else if (v.equals(aivThumb)) { + showThumb(thumb); + } else if (v.equals(xvRemove)) { + maxBodyHeight = 0; + rlThumb.setVisibility(View.GONE); + llPage.measure(0, 0); + onTextChanged(etContent.getText(), 0, 0, 0); + removeThumb(); + } else if (v.equals(tvAt)) { + showFriendList(); + } + } + + public void onTextChanged(CharSequence s, int start, int before, int count) { + tvTextCouter.setText(String.valueOf(s.length())); + + if (maxBodyHeight == 0) { + maxBodyHeight = llPage.getHeight() - rlTitle.getHeight() - llBottom.getHeight(); + } + + if (maxBodyHeight > 0) { + svContent.post(this); + } + } + + /** 动态适配编辑界面的高度 */ + public void run() { + int height = svContent.getChildAt(0).getHeight(); + RelativeLayout.LayoutParams lp = R.forceCast(svContent.getLayoutParams()); + if (height > maxBodyHeight && lp.height != maxBodyHeight) { + lp.height = maxBodyHeight; + svContent.setLayoutParams(lp); + } else if (height < maxBodyHeight && lp.height == maxBodyHeight) { + lp.height = LayoutParams.WRAP_CONTENT; + svContent.setLayoutParams(lp); + } + } + + public void afterTextChanged(Editable s) { + + } + + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + public void onPause() { + DeviceHelper.getInstance(activity).hideSoftInput(getContentView()); + super.onPause(); + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/FriendAdapter.java b/app/src/main/java/onekeyshare/themes/classic/FriendAdapter.java new file mode 100644 index 0000000000..87c10b382d --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/FriendAdapter.java @@ -0,0 +1,284 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic; + +import android.graphics.drawable.ColorDrawable; +import android.os.Handler.Callback; +import android.os.Message; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView.OnItemClickListener; + +import com.mob.tools.gui.PullToRefreshListAdapter; +import com.mob.tools.gui.PullToRefreshView; +import com.mob.tools.utils.UIHandler; + +import java.util.ArrayList; +import java.util.HashMap; + +import cn.sharesdk.framework.Platform; +import cn.sharesdk.framework.PlatformActionListener; + +/** 好友列表的适配器 */ +public class FriendAdapter extends PullToRefreshListAdapter implements PlatformActionListener { + private FriendListPage activity; + private boolean hasNext; + private Platform platform; + /** 请求好友列表时,每页15个 */ + private final int pageCount = 15; + /** 当前的好友列表是第几页 */ + private int curPage; + /** 好友列表数据 */ + private ArrayList follows; + /** 判断当前的好友列表数据与请求的新数据是否有重复 */ + private HashMap map; + /** 好友列表的头部View */ + private PRTHeader llHeader; + /** 根据设计,按照比例来布局,以此来适配所有手机 */ + private float ratio; + + public FriendAdapter(FriendListPage activity, PullToRefreshView view) { + super(view); + this.activity = activity; + + curPage = -1; + hasNext = true; + map = new HashMap(); + follows = new ArrayList(); + + getListView().setDivider(new ColorDrawable(0xffeaeaea)); + } + + public void setRatio(float ratio) { + this.ratio = ratio; + getListView().setDividerHeight((int) (ratio < 1 ? 1 : ratio)); + } + + public void setOnItemClickListener(OnItemClickListener listener) { + getListView().setOnItemClickListener(listener); + } + + public void setPlatform(Platform platform) { + this.platform = platform; + platform.setPlatformActionListener(this); + } + + private void next() { + if (hasNext) { + platform.listFriend(pageCount, curPage + 1, null); + } + } + + public void onComplete(Platform plat, int action, HashMap res) { + final FollowersResult followersResult = parseFollowers(platform.getName(), res, map); + if (followersResult == null) { + UIHandler.sendEmptyMessage(0, new Callback() { + public boolean handleMessage(Message msg) { + notifyDataSetChanged(); + return false; + } + }); + return; + } + + hasNext = followersResult.hasNextPage; + if (followersResult.list != null && followersResult.list.size() > 0) { + curPage++; + Message msg = new Message(); + msg.what = 1; + msg.obj = followersResult.list; + UIHandler.sendMessage(msg, new Callback() { + public boolean handleMessage(Message msg) { + if (curPage <= 0) { + follows.clear(); + } + follows.addAll(followersResult.list); + notifyDataSetChanged(); + return false; + } + }); + } + } + + private FollowersResult parseFollowers(String platform, HashMap res, HashMap uidMap) { + if (res == null || res.size() <= 0) { + return null; + } + + boolean hasNext = false; + ArrayList data = new ArrayList(); + if ("SinaWeibo".equals(platform)) { + // users[id, name, description] + @SuppressWarnings("unchecked") + ArrayList> users = (ArrayList>) res.get("users"); + for (HashMap user : users) { + String uid = String.valueOf(user.get("id")); + if (!uidMap.containsKey(uid)) { + Following following = new Following(); + following.uid = uid; + following.screenName = String.valueOf(user.get("name")); + following.description = String.valueOf(user.get("description")); + following.icon = String.valueOf(user.get("profile_image_url")); + following.atName = following.screenName; + uidMap.put(following.uid, true); + data.add(following); + } + } + hasNext = (Integer) res.get("total_number") > uidMap.size(); + } else if ("TencentWeibo".equals(platform)) { + hasNext = ((Integer)res.get("hasnext") == 0); + // info[nick, name, tweet[text]] + @SuppressWarnings("unchecked") + ArrayList> infos = (ArrayList>) res.get("info"); + for (HashMap info : infos) { + String uid = String.valueOf(info.get("name")); + if (!uidMap.containsKey(uid)) { + Following following = new Following(); + following.screenName = String.valueOf(info.get("nick")); + following.uid = uid; + following.atName = uid; + @SuppressWarnings("unchecked") + ArrayList> tweets = (ArrayList>) info.get("tweet"); + for (HashMap tweet : tweets) { + following.description = String.valueOf(tweet.get("text")); + break; + } + following.icon = String.valueOf(info.get("head")) + "/100"; + uidMap.put(following.uid, true); + data.add(following); + } + } + } else if ("Facebook".equals(platform)) { + // data[id, name] + @SuppressWarnings("unchecked") + ArrayList> datas = (ArrayList>) res.get("data"); + for (HashMap d : datas) { + String uid = String.valueOf(d.get("id")); + if (!uidMap.containsKey(uid)) { + Following following = new Following(); + following.uid = uid; + following.atName = "["+uid+"]"; + following.screenName = String.valueOf(d.get("name")); + @SuppressWarnings("unchecked") + HashMap picture = (HashMap) d.get("picture"); + if (picture != null) { + @SuppressWarnings("unchecked") + HashMap pData = (HashMap) picture.get("data"); + following.icon = String.valueOf(pData.get("url")); + } + uidMap.put(following.uid, true); + data.add(following); + } + } + @SuppressWarnings("unchecked") + HashMap paging = (HashMap) res.get("paging"); + hasNext = paging.containsKey("next"); + } else if ("Twitter".equals(platform)) { + // users[screen_name, name, description] + @SuppressWarnings("unchecked") + ArrayList> users = (ArrayList>) res.get("users"); + for (HashMap user : users) { + String uid = String.valueOf(user.get("screen_name")); + if (!uidMap.containsKey(uid)) { + Following following = new Following(); + following.uid = uid; + following.atName = uid; + following.screenName = String.valueOf(user.get("name")); + following.description = String.valueOf(user.get("description")); + following.icon = String.valueOf(user.get("profile_image_url")); + uidMap.put(following.uid, true); + data.add(following); + } + } + } + + FollowersResult ret = new FollowersResult(); + ret.list = data; + ret.hasNextPage = hasNext; + return ret; + } + + public void onError(Platform plat, int action, Throwable t) { + t.printStackTrace(); + } + + public void onCancel(Platform plat, int action) { + UIHandler.sendEmptyMessage(0, new Callback() { + public boolean handleMessage(Message msg) { + activity.finish(); + return false; + } + }); + } + + public Following getItem(int position) { + return follows.get(position); + } + + public long getItemId(int position) { + return position; + } + + public int getCount() { + return follows == null ? 0 : follows.size(); + } + + public View getHeaderView() { + if (llHeader == null) { + llHeader = new PRTHeader(getContext()); + } + return llHeader; + } + + public void onPullDown(int percent) { + llHeader.onPullDown(percent); + } + + public void onRequest() { + llHeader.onRequest(); + curPage = -1; + hasNext = true; + map.clear(); + next(); + } + + public void onReversed() { + llHeader.reverse(); + } + + public View getView(int position, View convertView, ViewGroup parent) { + if (convertView == null) { + FriendListItem llItem = new FriendListItem(parent.getContext(), ratio); + convertView = llItem; + } + FriendListItem llItem = (FriendListItem) convertView; + llItem.update(getItem(position), isFling()); + + if (position == getCount() - 1) { + next(); + } + return convertView; + } + + public static class Following { + public boolean checked; + public String screenName; + public String description; + public String uid; + public String icon; + //@Name 用于微博等提示或关联某个人 + public String atName; + } + + private static class FollowersResult { + public ArrayList list; + public boolean hasNextPage = false; + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/FriendListItem.java b/app/src/main/java/onekeyshare/themes/classic/FriendListItem.java new file mode 100644 index 0000000000..cc8145a2ae --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/FriendListItem.java @@ -0,0 +1,96 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.util.TypedValue; +import android.view.Gravity; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import com.mob.tools.gui.AsyncImageView; +import com.mob.tools.gui.BitmapProcessor; + + +/** 好友列表的item */ +public class FriendListItem extends LinearLayout { + private static final int DESIGN_AVATAR_WIDTH = 64; + private static final int DESIGN_AVATAR_PADDING = 24; + private static final int DESIGN_ITEM_HEIGHT = 96; + private static final int DESIGN_ITEM_PADDING = 20; + + private ImageView ivCheck; + private AsyncImageView aivIcon; + private TextView tvName; + /** 好友列表中,被选中的checkbox图标 */ + private Bitmap bmChd; + /** 好友列表中,没选中的checkbox图标 */ + private Bitmap bmUnch; + + public FriendListItem(Context context, float ratio) { + super(context); + int itemPadding = (int) (ratio * DESIGN_ITEM_PADDING); + setPadding(itemPadding, 0, itemPadding, 0); + setMinimumHeight((int) (ratio * DESIGN_ITEM_HEIGHT)); + setBackgroundColor(0xffffffff); + + ivCheck = new ImageView(context); + LayoutParams lp = new LayoutParams( + LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); + lp.gravity = Gravity.CENTER_VERTICAL; + addView(ivCheck, lp); + + aivIcon = new AsyncImageView(context); + int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); + lp = new LayoutParams(avatarWidth, avatarWidth); + lp.gravity = Gravity.CENTER_VERTICAL; + int avatarMargin = (int) (ratio * DESIGN_AVATAR_PADDING); + lp.setMargins(avatarMargin, 0, avatarMargin, 0); + addView(aivIcon, lp); + + tvName = new TextView(context); + tvName.setTextColor(0xff000000); + tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); + tvName.setSingleLine(); + lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); + lp.gravity = Gravity.CENTER_VERTICAL; + lp.weight = 1; + addView(tvName, lp); + + int resId = com.mob.tools.utils.R.getBitmapRes(context, "ssdk_oks_classic_check_checked"); + if (resId > 0) { + bmChd = BitmapFactory.decodeResource(context.getResources(), resId); + } + resId = com.mob.tools.utils.R.getBitmapRes(getContext(), "ssdk_oks_classic_check_default"); + if (resId > 0) { + bmUnch = BitmapFactory.decodeResource(context.getResources(), resId); + } + } + + public void update(FriendAdapter.Following following, boolean fling) { + tvName.setText(following.screenName); + ivCheck.setImageBitmap(following.checked ? bmChd : bmUnch); + if (aivIcon != null) { + if (fling) { + Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon); + if (bm != null && !bm.isRecycled()) { + aivIcon.setImageBitmap(bm); + } else { + aivIcon.execute(null, 0); + } + } else { + aivIcon.execute(following.icon, 0); + } + } + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/FriendListPage.java b/app/src/main/java/onekeyshare/themes/classic/FriendListPage.java new file mode 100644 index 0000000000..3435ed7e40 --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/FriendListPage.java @@ -0,0 +1,200 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic; + +import android.graphics.drawable.ColorDrawable; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.ViewGroup.LayoutParams; +import android.widget.AdapterView; +import android.widget.AdapterView.OnItemClickListener; +import android.widget.FrameLayout; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import com.mob.tools.gui.PullToRefreshView; + +import java.util.ArrayList; +import java.util.HashMap; + +import cn.sharesdk.framework.Platform; +import onekeyshare.OnekeySharePage; +import onekeyshare.OnekeyShareThemeImpl; + + +/** 编辑界面,@好友时,弹出的好友列表 */ +public abstract class FriendListPage extends OnekeySharePage implements OnClickListener, OnItemClickListener { + private static final int DESIGN_LEFT_PADDING = 40; + + private Platform platform; + private LinearLayout llPage; + private RelativeLayout rlTitle; + private TextView tvCancel; + private TextView tvConfirm; + private FriendAdapter adapter; + private int lastPosition = -1; + /** 展示好友列表时,已选择要‘@’的好友个数 */ + private int checkNum = 0; + + public FriendListPage(OnekeyShareThemeImpl impl) { + super(impl); + } + + public void setPlatform(Platform platform) { + this.platform = platform; + } + + public void onCreate() { + activity.getWindow().setBackgroundDrawable(new ColorDrawable(0xfff3f3f3)); + + llPage = new LinearLayout(activity); + llPage.setOrientation(LinearLayout.VERTICAL); + activity.setContentView(llPage); + + rlTitle = new RelativeLayout(activity); + float ratio = getRatio(); + int titleHeight = (int) (getDesignTitleHeight() * ratio); + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( + LayoutParams.MATCH_PARENT, titleHeight); + llPage.addView(rlTitle, lp); + initTitle(rlTitle, ratio); + + View line = new View(activity); + LinearLayout.LayoutParams lpline = new LinearLayout.LayoutParams( + LayoutParams.MATCH_PARENT, (int) (ratio < 1 ? 1 : ratio)); + line.setBackgroundColor(0xffdad9d9); + llPage.addView(line, lpline); + + FrameLayout flPage = new FrameLayout(getContext()); + LinearLayout.LayoutParams lpFl = new LinearLayout.LayoutParams( + LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); + lpFl.weight = 1; + flPage.setLayoutParams(lpFl); + llPage.addView(flPage); + + // 关注(或朋友)列表 + PullToRefreshView followList = new PullToRefreshView(getContext()); + FrameLayout.LayoutParams lpLv = new FrameLayout.LayoutParams( + LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); + followList.setLayoutParams(lpLv); + flPage.addView(followList); + + adapter = new FriendAdapter(this, followList); + adapter.setPlatform(platform); + adapter.setRatio(ratio); + adapter.setOnItemClickListener(this); + followList.setAdapter(adapter); + + // 请求数据 + followList.performPulling(true); + } + + protected abstract float getRatio(); + + protected abstract int getDesignTitleHeight(); + + private void initTitle(RelativeLayout rlTitle, float ratio) { + tvCancel = new TextView(activity); + tvCancel.setTextColor(0xff3b3b3b); + tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); + tvCancel.setGravity(Gravity.CENTER); + int resId = com.mob.tools.utils.R.getStringRes(activity, "ssdk_oks_cancel"); + if (resId > 0) { + tvCancel.setText(resId); + } + int padding = (int) (DESIGN_LEFT_PADDING * ratio); + tvCancel.setPadding(padding, 0, padding, 0); + RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + rlTitle.addView(tvCancel, lp); + tvCancel.setOnClickListener(this); + + TextView tvTitle = new TextView(activity); + tvTitle.setTextColor(0xff3b3b3b); + tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); + tvTitle.setGravity(Gravity.CENTER); + resId = com.mob.tools.utils.R.getStringRes(activity, "ssdk_oks_contacts"); + if (resId > 0) { + tvTitle.setText(resId); + } + lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + lp.addRule(RelativeLayout.CENTER_IN_PARENT); + rlTitle.addView(tvTitle, lp); + + tvConfirm = new TextView(activity); + tvConfirm.setTextColor(0xffff6d11); + tvConfirm.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); + tvConfirm.setGravity(Gravity.CENTER); + resId = com.mob.tools.utils.R.getStringRes(activity, "ssdk_oks_confirm"); + if (resId > 0) { + tvConfirm.setText(resId); + } + tvConfirm.setPadding(padding, 0, padding, 0); + lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); + rlTitle.addView(tvConfirm, lp); + tvConfirm.setOnClickListener(this); + } + + public void onClick(View v) { + if (v.equals(tvCancel)) { + finish(); + } else { + ArrayList selected = new ArrayList(); + for (int i = 0, size = adapter.getCount(); i < size; i++) { + if (adapter.getItem(i).checked) { + selected.add(adapter.getItem(i).atName); + } + } + + HashMap res = new HashMap(); + res.put("selected", selected); + res.put("platform", platform); + setResult(res); + finish(); + } + } + + public void onItemClick(AdapterView parent, View view, int position, long id) { + if ("FacebookMessenger".equals(platform.getName())) { + if(lastPosition >= 0) { + FriendAdapter.Following lastFollwing = adapter.getItem(lastPosition); + lastFollwing.checked = false; + } + lastPosition = position; + } + FriendAdapter.Following following = adapter.getItem(position); + following.checked = !following.checked; + + if(following.checked) { + checkNum++; + } else { + checkNum--; + } + + updateConfirmView(); + adapter.notifyDataSetChanged(); + } + + private void updateConfirmView() { + int resId = com.mob.tools.utils.R.getStringRes(activity, "ssdk_oks_confirm"); + String confirm = "Confirm"; + if(resId > 0) { + confirm = getContext().getResources().getString(resId); + } + if(checkNum == 0) { + tvConfirm.setText(confirm); + } else if(checkNum > 0) { + tvConfirm.setText(confirm + "(" + checkNum + ")"); + } + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/IndicatorView.java b/app/src/main/java/onekeyshare/themes/classic/IndicatorView.java new file mode 100644 index 0000000000..c73c23b9c7 --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/IndicatorView.java @@ -0,0 +1,67 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.view.View; + +/** 九宫格滑动时,下面显示的圆圈 */ +public class IndicatorView extends View { + private static final int DESIGN_INDICATOR_RADIUS = 6; + private static final int DESIGN_INDICATOR_DISTANCE = 14; + private static final int DESIGN_BOTTOM_HEIGHT = 52; + /** 九格宫有多少页数 */ + private int count; + /** 当前显示的是九格宫中的第几页 */ + private int current; + + public IndicatorView(Context context) { + super(context); + } + + public void setScreenCount(int count) { + this.count = count; + } + + public void onScreenChange(int currentScreen, int lastScreen) { + if (currentScreen != current) { + current = currentScreen; + postInvalidate(); + } + } + + protected void onDraw(Canvas canvas) { + if (count <= 1) { + this.setVisibility(View.GONE); + return; + } + float height = getHeight(); + float radius = height * DESIGN_INDICATOR_RADIUS / DESIGN_BOTTOM_HEIGHT; + float distance = height * DESIGN_INDICATOR_DISTANCE / DESIGN_BOTTOM_HEIGHT; + float windowWidth = radius * 2 * count + distance * (count - 1); + float left = (getWidth() - windowWidth) / 2; + float cy = height / 2; + + canvas.drawColor(0xffffffff); + Paint paint = new Paint(); + paint.setAntiAlias(true); + for (int i = 0; i < count; i++) { + if (i == current) { + paint.setColor(0xff5d71a0); + } else { + paint.setColor(0xffafb1b7); + } + float cx = left + (radius * 2 + distance) * i; + canvas.drawCircle(cx, cy, radius, paint); + } + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/PRTHeader.java b/app/src/main/java/onekeyshare/themes/classic/PRTHeader.java new file mode 100644 index 0000000000..76048ae4f5 --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/PRTHeader.java @@ -0,0 +1,115 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic; + +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.View; +import android.widget.LinearLayout; +import android.widget.ProgressBar; +import android.widget.TextView; + +import static com.mob.tools.utils.R.getStringRes; + +/** 下拉刷新的头部控件 */ +public class PRTHeader extends LinearLayout { + private static final int DESIGN_SCREEN_WIDTH = 720; + private static final int DESIGN_AVATAR_WIDTH = 64; + private static final int DESIGN_AVATAR_PADDING = 24; + + private TextView tvHeader; + private RotateImageView ivArrow; + private ProgressBar pbRefreshing; + + public PRTHeader(Context context) { + super(context); + int[] size = com.mob.tools.utils.R.getScreenSize(context); + float screenWidth = size[0] < size[1] ? size[0] : size[1]; + float ratio = screenWidth / DESIGN_SCREEN_WIDTH; + + setOrientation(VERTICAL); + + LinearLayout llInner = new LinearLayout(context); + LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); + lp.gravity = Gravity.CENTER_HORIZONTAL; + addView(llInner, lp); + + ivArrow = new RotateImageView(context); + int resId = com.mob.tools.utils.R.getBitmapRes(context, "ssdk_oks_ptr_ptr"); + if (resId > 0) { + ivArrow.setImageResource(resId); + } + int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); + lp = new LayoutParams(avatarWidth, avatarWidth); + lp.gravity = Gravity.CENTER_VERTICAL; + int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); + lp.topMargin = lp.bottomMargin = avataPadding; + llInner.addView(ivArrow, lp); + + pbRefreshing = new ProgressBar(context); + resId = com.mob.tools.utils.R.getBitmapRes(context, "ssdk_oks_classic_progressbar"); + Drawable pbdrawable = context.getResources().getDrawable(resId); + pbRefreshing.setIndeterminateDrawable(pbdrawable); + llInner.addView(pbRefreshing, lp); + pbRefreshing.setVisibility(View.GONE); + + tvHeader = new TextView(getContext()); + tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); + tvHeader.setPadding(avataPadding, 0, avataPadding, 0); + tvHeader.setTextColor(0xff09bb07); + lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); + lp.gravity = Gravity.CENTER_VERTICAL; + llInner.addView(tvHeader, lp); + } + + public void onPullDown(int percent) { + if (percent > 100) { + int degree = (percent - 100) * 180 / 20; + if (degree > 180) { + degree = 180; + } + if (degree < 0) { + degree = 0; + } + ivArrow.setRotation(degree); + } else { + ivArrow.setRotation(0); + } + + if (percent < 100) { + int resId = getStringRes(getContext(), "ssdk_oks_pull_to_refresh"); + if (resId > 0) { + tvHeader.setText(resId); + } + } else { + int resId = getStringRes(getContext(), "ssdk_oks_release_to_refresh"); + if (resId > 0) { + tvHeader.setText(resId); + } + } + } + + public void onRequest() { + ivArrow.setVisibility(View.GONE); + pbRefreshing.setVisibility(View.VISIBLE); + int resId = getStringRes(getContext(), "ssdk_oks_refreshing"); + if (resId > 0) { + tvHeader.setText(resId); + } + } + + public void reverse() { + pbRefreshing.setVisibility(View.GONE); + ivArrow.setRotation(180); + ivArrow.setVisibility(View.VISIBLE); + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/PicViewerPage.java b/app/src/main/java/onekeyshare/themes/classic/PicViewerPage.java new file mode 100644 index 0000000000..cfae3b3a38 --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/PicViewerPage.java @@ -0,0 +1,57 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic; + +import android.graphics.Bitmap; +import android.graphics.drawable.ColorDrawable; +import android.view.ViewTreeObserver.OnGlobalLayoutListener; +import android.widget.ImageView.ScaleType; + +import com.mob.tools.gui.ScaledImageView; + +import onekeyshare.OnekeySharePage; +import onekeyshare.OnekeyShareThemeImpl; + + +/** 图片浏览的视图类 */ +public class PicViewerPage extends OnekeySharePage implements OnGlobalLayoutListener { + private Bitmap pic; + /** 图片浏览的缩放控件 */ + private ScaledImageView sivViewer; + + public PicViewerPage(OnekeyShareThemeImpl impl) { + super(impl); + } + + /** 设置图片用于浏览 */ + public void setImageBitmap(Bitmap pic) { + this.pic = pic; + } + + public void onCreate() { + activity.getWindow().setBackgroundDrawable(new ColorDrawable(0x4c000000)); + + sivViewer = new ScaledImageView(activity); + sivViewer.setScaleType(ScaleType.MATRIX); + activity.setContentView(sivViewer); + if (pic != null) { + sivViewer.getViewTreeObserver().addOnGlobalLayoutListener(this); + } + } + + public void onGlobalLayout() { + sivViewer.getViewTreeObserver().removeGlobalOnLayoutListener(this); + sivViewer.post(new Runnable() { + public void run() { + sivViewer.setBitmap(pic); + } + }); + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/PlatformPage.java b/app/src/main/java/onekeyshare/themes/classic/PlatformPage.java new file mode 100644 index 0000000000..a029d6992d --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/PlatformPage.java @@ -0,0 +1,243 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic; + +import android.graphics.drawable.ColorDrawable; +import android.view.Gravity; +import android.view.MotionEvent; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.ViewGroup.LayoutParams; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.view.animation.ScaleAnimation; +import android.view.animation.TranslateAnimation; +import android.widget.LinearLayout; +import android.widget.TextView; + +import com.gh.gamecenter.R; +import com.mob.tools.gui.MobViewPager; + +import java.util.ArrayList; +import java.util.HashMap; + +import cn.sharesdk.framework.CustomPlatform; +import cn.sharesdk.framework.Platform; +import cn.sharesdk.framework.Platform.ShareParams; +import cn.sharesdk.framework.ShareSDK; +import onekeyshare.CustomerLogo; +import onekeyshare.OnekeySharePage; +import onekeyshare.OnekeyShareThemeImpl; + +/** 九宫格的抽象类 */ +public abstract class PlatformPage extends OnekeySharePage { + private ClassicTheme impl; + /** 点击九格宫,展示编辑界面,要执行的子线程 */ + private Runnable beforeFinish; + /** 九宫格显示时的动画 */ + private Animation animShow; + /** 九宫格隐藏时的动画 */ + private Animation animHide; + private LinearLayout llPage,llPanel; + private boolean finished; + + public PlatformPage(OnekeyShareThemeImpl impl) { + super(impl); + this.impl = com.mob.tools.utils.R.forceCast(impl); + } + + public void onCreate() { +// activity.getWindow().setBackgroundDrawable(new ColorDrawable(0x4c000000)); + initAnims(); + + llPage = new LinearLayout(activity); + llPage.setBackgroundColor(0x4c000000); + llPage.setOrientation(LinearLayout.VERTICAL); + activity.setContentView(llPage); + TextView vTop = new TextView(activity); + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( + LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); + lp.weight = 1; + vTop.setOnClickListener(new OnClickListener() { + public void onClick(View v) { + finish(); + } + }); + llPage.addView(vTop, lp); + + llPanel = new LinearLayout(activity); + llPanel.setOrientation(LinearLayout.VERTICAL); + llPanel.setGravity(Gravity.CENTER); + lp = new LinearLayout.LayoutParams( + LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); + lp.gravity = Gravity.CENTER; + llPanel.setAnimation(animShow); + llPage.addView(llPanel, lp); + + MobViewPager mvp = new MobViewPager(activity); + ArrayList cells = collectCells(); + PlatformPageAdapter adapter = newAdapter(cells); +// lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, adapter.getPanelHeight()); + int heightPixels = getContext().getResources().getDisplayMetrics().heightPixels; + int widthPixels = getContext().getResources().getDisplayMetrics().widthPixels; + lp = new LinearLayout.LayoutParams(widthPixels/2,heightPixels/2-adapter.getPanelHeight()); + llPanel.addView(mvp, lp); + mvp.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent event) { + switch (event.getAction()){ + case MotionEvent.ACTION_DOWN: + finish(); + break; + } + return false; + } + }); + IndicatorView vInd = new IndicatorView(activity); + lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, adapter.getBottomHeight()); +// lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0); + llPanel.addView(vInd, lp); + + vInd.setScreenCount(adapter.getCount()); + vInd.onScreenChange(0, 0); + adapter.setIndicator(vInd); + mvp.setAdapter(adapter); + + llPage.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent event) { + switch (event.getAction()){ + case MotionEvent.ACTION_DOWN: + finish(); + break; + } + return false; + } + }); + } + + protected abstract PlatformPageAdapter newAdapter(ArrayList cells); + + protected ArrayList collectCells() { + ArrayList cells = new ArrayList(); + + Platform[] platforms = ShareSDK.getPlatformList(); + if (platforms == null) { + platforms = new Platform[0]; + } + HashMap hides = getHiddenPlatforms(); + if (hides == null) { + hides = new HashMap(); + } + for (Platform p : platforms) { + if (!hides.containsKey(p.getName())) { + cells.add(p); + } + } + + ArrayList customers = getCustomerLogos(); + if (customers != null && customers.size() > 0) { + cells.addAll(customers); + } + + return cells; + } + + 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(); + } + + public final void performCustomLogoClick(final View v, final CustomerLogo logo) { + beforeFinish = new Runnable() { + public void run() { + logo.listener.onClick(v); + } + }; + finish(); + } + + private void initAnims() { +// animShow = new TranslateAnimation( +// Animation.RELATIVE_TO_SELF, 0, +// Animation.RELATIVE_TO_SELF, 0, +// Animation.RELATIVE_TO_SELF, 1, +// Animation.RELATIVE_TO_SELF, 0); +// animShow.setDuration(300); +// animShow = AnimationUtils.loadAnimation(getContext(), R.anim.popshow_anim); + animShow = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, + 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); + animShow.setDuration(300); +// +// animHide = new TranslateAnimation( +// Animation.RELATIVE_TO_SELF, 0, +// Animation.RELATIVE_TO_SELF, 0, +// Animation.RELATIVE_TO_SELF, 0, +// Animation.RELATIVE_TO_SELF, 1); +// animHide.setDuration(300); +// animHide = AnimationUtils.loadAnimation(getContext(),R.anim.pophidden_anim); + animHide = new ScaleAnimation(1, 0, 1, 0, Animation.RELATIVE_TO_SELF, + 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); + animHide.setDuration(300); + } + + public boolean onFinish() { + if (finished) { + finished = false; + return false; + } + + animHide.setAnimationListener(new Animation.AnimationListener() { + public void onAnimationStart(Animation animation) { + + } + + public void onAnimationRepeat(Animation animation) { + + } + + public void onAnimationEnd(Animation animation) { + if (beforeFinish == null) { + // 取消分享菜单的统计 + ShareSDK.logDemoEvent(2, null); + } else { + beforeFinish.run(); + beforeFinish = null; + } + llPage.setVisibility(View.GONE); + finished = true; + finish(); + } + }); + llPanel.clearAnimation(); + llPanel.setAnimation(animHide); + llPanel.setVisibility(View.GONE); + return true; + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/PlatformPageAdapter.java b/app/src/main/java/onekeyshare/themes/classic/PlatformPageAdapter.java new file mode 100644 index 0000000000..b9b99e2cbe --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/PlatformPageAdapter.java @@ -0,0 +1,227 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic; + +import android.content.Context; +import android.util.Log; +import android.view.Gravity; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.ViewGroup; +import android.view.ViewGroup.LayoutParams; +import android.widget.ImageView; +import android.widget.ImageView.ScaleType; +import android.widget.LinearLayout; + +import com.mob.tools.gui.ViewPagerAdapter; + +import java.util.ArrayList; + +import cn.sharesdk.framework.Platform; +import onekeyshare.CustomerLogo; + +/** 九宫格的适配器抽象类 */ +public abstract class PlatformPageAdapter extends ViewPagerAdapter implements OnClickListener { + /** 1秒内多次点击九格宫内的图标无效 */ + protected static final int MIN_CLICK_INTERVAL = 1000; + public static final int DESIGN_BOTTOM_HEIGHT = 52; + + /** 九格宫内图标排列的二维数组,一维对应平台,二维对应页数 */ + protected Object[][] cells; + private PlatformPage page; + private IndicatorView vInd; + + protected int bottomHeight; + protected int panelHeight; + protected int cellHeight; + protected int lineSize; + protected int sepLineWidth; + protected int paddingTop; + protected int logoHeight; + + private long lastClickTime; + + public PlatformPageAdapter(PlatformPage page, ArrayList cells) { + this.page = page; + if (cells != null && !cells.isEmpty()) { + calculateSize(page.getContext(), cells); + collectCells(cells); + } + } + + /** 计算九宫格的格数,行数,格高,行高,图标大小 */ + protected abstract void calculateSize(Context context, ArrayList plats); + + /** 计算九宫格的格数,行数 */ + protected abstract void collectCells(ArrayList plats); + + public int getBottomHeight() { + return bottomHeight; + } + + public int getPanelHeight() { + return panelHeight; + } + + public int getCount() { + return cells == null? 0: cells.length; + } + + public void setIndicator(IndicatorView view) { + vInd = view; + } + + public void onScreenChange(int currentScreen, int lastScreen) { + if (vInd != null) { + vInd.setScreenCount(getCount()); + vInd.onScreenChange(currentScreen, lastScreen); + } + } + + public View getView(int index, View convertView, ViewGroup parent) { + if (convertView == null) { +// convertView = LayoutInflater.from(parent.getContext()).inflate(com.example.khy.sharedemo.R.layout.share_layout,parent,false); + convertView = createPanel(parent.getContext()); + } + + LinearLayout llPanel = com.mob.tools.utils.R.forceCast(convertView); + LinearLayout[] llCells = com.mob.tools.utils.R.forceCast(llPanel.getTag()); + refreshPanel(llCells, cells[index]); + return convertView; + } + + private View createPanel(Context context) { + LinearLayout llPanel = new LinearLayout(context); + + llPanel.setOrientation(LinearLayout.VERTICAL); +// llPanel.setBackgroundColor(0xfff2f2f2); +// llPanel.setBackgroundColor(Color.BLUE); + int lineCount = (panelHeight / cellHeight); + Log.e("TAG","lineCount:"+lineCount); + lineCount = 2; + lineSize = 2; + LinearLayout[] llCells = new LinearLayout[lineCount * lineSize]; + llPanel.setTag(llCells); +// llPanel.setGravity(Gravity.CENTER); + int cellBack = com.mob.tools.utils.R.getBitmapRes(context, "ssdk_oks_classic_platform_cell_back"); + LinearLayout.LayoutParams lp; + for (int i = 0; i < lineCount; i++) { + LinearLayout llLine = new LinearLayout(context); + lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, cellHeight); + llPanel.addView(llLine, lp); + + for (int j = 0; j < lineSize; j++) { + Log.e("TAG",lineSize+""); + llCells[i * lineSize + j] = new LinearLayout(context); + llCells[i * lineSize + j].setBackgroundResource(cellBack); + llCells[i * lineSize + j].setOrientation(LinearLayout.VERTICAL); + llCells[i * lineSize + j].setGravity(Gravity.CENTER); + lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, cellHeight); + lp.weight = 1; + llLine.addView(llCells[i * lineSize + j], lp); + +// if (j < lineSize - 1) { +// View vSep = new View(context); +// lp = new LinearLayout.LayoutParams(sepLineWidth, LayoutParams.MATCH_PARENT); +// llLine.addView(vSep, lp); +// } + } + +// View vSep = new View(context); +// lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, sepLineWidth); +// llPanel.addView(vSep, lp); + } + + for (LinearLayout llCell : llCells) { + ImageView ivLogo = new ImageView(context); + ivLogo.setScaleType(ScaleType.CENTER_INSIDE); + lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, logoHeight); + lp.topMargin = paddingTop; + llCell.addView(ivLogo, lp); + +// TextView tvName = new TextView(context); +// tvName.setTextColor(0xff646464); +// tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); +// tvName.setGravity(Gravity.CENTER); +// lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); +// lp.weight = 1; +// llCell.addView(tvName, lp); + } +// View llPanel = LayoutInflater.from(context).inflate(com.example.khy.sharedemo.R.layout.share_layout, null, false); + + return llPanel; + } + + private void refreshPanel(LinearLayout[] llCells, Object[] logos) { + int cellBack = com.mob.tools.utils.R.getBitmapRes(page.getContext(), "ssdk_oks_classic_platform_cell_back"); + int disableBack = com.mob.tools.utils.R.getBitmapRes(page.getContext(), "ssdk_oks_classic_platfrom_cell_back_nor"); + for (int i = 0; i < logos.length; i++) { + ImageView ivLogo = com.mob.tools.utils.R.forceCast(llCells[i].getChildAt(0)); +// TextView tvName = R.forceCast(llCells[i].getChildAt(1)); + if (logos[i] == null) { + ivLogo.setVisibility(View.INVISIBLE); +// tvName.setVisibility(View.INVISIBLE); + llCells[i].setBackgroundResource(disableBack); + llCells[i].setOnClickListener(null); + } else { + ivLogo.setVisibility(View.VISIBLE); +// tvName.setVisibility(View.VISIBLE); + llCells[i].setBackgroundResource(cellBack); + llCells[i].setOnClickListener(this); + llCells[i].setTag(logos[i]); + + if (logos[i] instanceof CustomerLogo) { + CustomerLogo logo = com.mob.tools.utils.R.forceCast(logos[i]); + if (logo.logo != null) { + ivLogo.setImageBitmap(logo.logo); + } else { + ivLogo.setImageBitmap(null); + } + if (logo.label != null) { +// tvName.setText(logo.label); + } else { +// tvName.setText(""); + } + } else { + Platform plat = com.mob.tools.utils.R.forceCast(logos[i]); + String name = plat.getName().toLowerCase(); + int resId = com.mob.tools.utils.R.getBitmapRes(ivLogo.getContext(),"ssdk_oks_classic_" + name); + if (resId > 0) { + ivLogo.setImageResource(resId); + } else { + ivLogo.setImageBitmap(null); + } +// resId = R.getStringRes(tvName.getContext(), "ssdk_" + name); +// if (resId > 0) { +// tvName.setText(resId); +// } else { +// tvName.setText(""); +// } + } + } + } + } + + public void onClick(View v) { + long time = System.currentTimeMillis(); + if (time - lastClickTime < MIN_CLICK_INTERVAL) { + return; + } + lastClickTime = time; + + if (v.getTag() instanceof CustomerLogo) { + CustomerLogo logo = com.mob.tools.utils.R.forceCast(v.getTag()); + page.performCustomLogoClick(v, logo); + } else { + Platform plat = com.mob.tools.utils.R.forceCast(v.getTag()); + page.showEditPage(plat); + } + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/RotateImageView.java b/app/src/main/java/onekeyshare/themes/classic/RotateImageView.java new file mode 100644 index 0000000000..900c08d63b --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/RotateImageView.java @@ -0,0 +1,33 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic; + +import android.content.Context; +import android.graphics.Canvas; +import android.widget.ImageView; + +/** 在At好友页面中,下拉刷新列表头部的旋转箭头 */ +public class RotateImageView extends ImageView { + private float rotation; + + public RotateImageView(Context context) { + super(context); + } + + public void setRotation(float rotation) { + this.rotation = rotation; + invalidate(); + } + + protected void onDraw(Canvas canvas) { + canvas.rotate(rotation, getWidth() / 2, getHeight() / 2); + super.onDraw(canvas); + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/XView.java b/app/src/main/java/onekeyshare/themes/classic/XView.java new file mode 100644 index 0000000000..eb71236b36 --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/XView.java @@ -0,0 +1,46 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.view.View; + +/** 编辑页面中删除图片“X”按钮 */ +public class XView extends View { + private float ratio; + + public XView(Context context) { + super(context); + } + + public void setRatio(float ratio) { + this.ratio = ratio; + } + + protected void onDraw(Canvas canvas) { + int width = getWidth() / 2; + int height = getHeight() / 2; + + Paint paint = new Paint(); + paint.setAntiAlias(true); + paint.setColor(0xffa0a0a0); + canvas.drawRect(width, 0, getWidth(), height, paint); + + paint = new Paint(); + paint.setAntiAlias(true); + paint.setStrokeWidth(3f * ratio); + paint.setColor(0xffffffff); + float left = 8f * ratio; + canvas.drawLine(width + left, left, getWidth() - left, width - left, paint); + canvas.drawLine(width + left, width - left, getWidth() - left, left, paint); + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/land/EditPageLand.java b/app/src/main/java/onekeyshare/themes/classic/land/EditPageLand.java new file mode 100644 index 0000000000..010664f858 --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/land/EditPageLand.java @@ -0,0 +1,275 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic.land; + +import android.graphics.Bitmap; +import android.text.TextUtils; +import android.text.TextWatcher; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.ViewGroup.LayoutParams; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.ScrollView; +import android.widget.TextView; + +import com.mob.tools.gui.AsyncImageView; +import com.mob.tools.utils.BitmapHelper; + +import java.io.File; + +import onekeyshare.OnekeyShareThemeImpl; +import onekeyshare.themes.classic.EditPage; +import onekeyshare.themes.classic.XView; + + +/** 横屏的编辑页 */ +public class EditPageLand extends EditPage implements OnClickListener, TextWatcher, Runnable { + private static final int DESIGN_SCREEN_WIDTH= 720; + private static final int DESIGN_BOTTOM_HEIGHT = 75; + private static final int DESIGN_LEFT_PADDING = 40; + private static final int DESIGN_TITLE_HEIGHT_L = 70; + private static final int DESIGN_THUMB_HEIGHT_L = 280; + private static final int DESIGN_REMOVE_THUMB_HEIGHT_L = 60; + + public EditPageLand(OnekeyShareThemeImpl impl) { + super(impl); + } + + public void onCreate() { + super.onCreate(); + + int screenHeight = com.mob.tools.utils.R.getScreenHeight(activity); + float ratio = ((float) screenHeight) / DESIGN_SCREEN_WIDTH; + + maxBodyHeight = 0; + + llPage = new LinearLayout(activity); + llPage.setOrientation(LinearLayout.VERTICAL); + activity.setContentView(llPage); + + rlTitle = new RelativeLayout(activity); + rlTitle.setBackgroundColor(0xffe6e9ec); + int titleHeight = (int) (DESIGN_TITLE_HEIGHT_L * ratio); + + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight); + llPage.addView(rlTitle, lp); + initTitle(rlTitle, ratio); + + RelativeLayout rlBody = new RelativeLayout(activity); + rlBody.setBackgroundColor(0xffffffff); + lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); + llPage.addView(rlBody, lp); + initBody(rlBody, ratio); + + LinearLayout llShadow = new LinearLayout(activity); + llShadow.setOrientation(LinearLayout.VERTICAL); + rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); + initShadow(llShadow, ratio); + + llBottom = new LinearLayout(activity); + llBottom.setOrientation(LinearLayout.VERTICAL); + lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); + llPage.addView(llBottom, lp); + initBottom(llBottom, ratio); + + + } + + private void initTitle(RelativeLayout rlTitle, float ratio) { + tvCancel = new TextView(activity); + tvCancel.setTextColor(0xff3b3b3b); + tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); + tvCancel.setGravity(Gravity.CENTER); + int resId = com.mob.tools.utils.R.getStringRes(activity, "ssdk_oks_cancel"); + if (resId > 0) { + tvCancel.setText(resId); + } + int padding = (int) (DESIGN_LEFT_PADDING * ratio); + tvCancel.setPadding(padding, 0, padding, 0); + RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + rlTitle.addView(tvCancel, lp); + tvCancel.setOnClickListener(this); + + TextView tvTitle = new TextView(activity); + tvTitle.setTextColor(0xff3b3b3b); + tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); + tvTitle.setGravity(Gravity.CENTER); + resId = com.mob.tools.utils.R.getStringRes(activity, "ssdk_oks_multi_share"); + if (resId > 0) { + tvTitle.setText(resId); + } + lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + lp.addRule(RelativeLayout.CENTER_IN_PARENT); + rlTitle.addView(tvTitle, lp); + + tvShare = new TextView(activity); + tvShare.setTextColor(0xffff6d11); + tvShare.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); + tvShare.setGravity(Gravity.CENTER); + resId = com.mob.tools.utils.R.getStringRes(activity, "ssdk_oks_share"); + if (resId > 0) { + tvShare.setText(resId); + } + tvShare.setPadding(padding, 0, padding, 0); + lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); + rlTitle.addView(tvShare, lp); + tvShare.setOnClickListener(this); + } + + private void initBody(RelativeLayout rlBody, float ratio) { + svContent = new ScrollView(activity); + rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); + + LinearLayout llContent = new LinearLayout(activity); + llContent.setOrientation(LinearLayout.HORIZONTAL); + svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); + + etContent = new EditText(activity); + int padding = (int) (DESIGN_LEFT_PADDING * ratio); + etContent.setPadding(padding, padding, padding, padding); + etContent.setBackgroundDrawable(null); + etContent.setTextColor(0xff3b3b3b); + etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); + etContent.setText(sp.getText()); + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); + lp.weight = 1; + llContent.addView(etContent, lp); + etContent.addTextChangedListener(this); + + rlThumb = new RelativeLayout(activity); + rlThumb.setBackgroundColor(0xff313131); + int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio); + int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio); + lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); + lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; + llContent.addView(rlThumb, lp); + + aivThumb = new AsyncImageView(activity) { + public void onImageGot(String url, Bitmap bm) { + thumb = bm; + super.onImageGot(url, bm); + } + }; + aivThumb.setScaleToCropCenter(true); + RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); + rlThumb.addView(aivThumb, rllp); + aivThumb.setOnClickListener(this); + initThumb(aivThumb); + + xvRemove = new XView(activity); + xvRemove.setRatio(ratio); + rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); + rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); + rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); + rlThumb.addView(xvRemove, rllp); + xvRemove.setOnClickListener(this); + } + + private void initBottom(LinearLayout llBottom, float ratio) { + LinearLayout llAt = new LinearLayout(activity); + llAt.setPadding(0, 0, 0, 5); + llAt.setBackgroundColor(0xffffffff); + int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio); + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight); + llBottom.addView(llAt, lp); + + tvAt = new TextView(activity); + tvAt.setTextColor(0xff3b3b3b); + tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); + tvAt.setGravity(Gravity.BOTTOM); + tvAt.setText("@"); + int padding = (int) (DESIGN_LEFT_PADDING * ratio); + tvAt.setPadding(padding, 0, padding, 0); + lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + llAt.addView(tvAt, lp); + tvAt.setOnClickListener(this); + if (isShowAtUserLayout(platform.getName())) { + tvAt.setVisibility(View.VISIBLE); + } else { + tvAt.setVisibility(View.INVISIBLE); + } + + tvTextCouter = new TextView(activity); + tvTextCouter.setTextColor(0xff3b3b3b); + tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); + tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT); + onTextChanged(etContent.getText(), 0, 0, 0); + tvTextCouter.setPadding(padding, 0, padding, 0); + lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + lp.weight = 1; + llAt.addView(tvTextCouter, lp); + + View v = new View(activity); + v.setBackgroundColor(0xffcccccc); + int px_1 = ratio > 1 ? ((int) ratio) : 1; + lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px_1); + llBottom.addView(v, lp); + } + + private void initShadow(LinearLayout llShadow, float ratio) { + int px_1 = ratio > 1 ? ((int) ratio) : 1; + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px_1); + + View v = new View(activity); + v.setBackgroundColor(0x29000000); + llShadow.addView(v, lp); + + v = new View(activity); + v.setBackgroundColor(0x14000000); + llShadow.addView(v, lp); + + v = new View(activity); + v.setBackgroundColor(0x07000000); + llShadow.addView(v, lp); + } + + private void initThumb(AsyncImageView aivThumb) { + String imageUrl = sp.getImageUrl(); + String imagePath = sp.getImagePath(); + String[] imageArray = sp.getImageArray(); + + Bitmap pic = null; + rlThumb.setVisibility(View.VISIBLE); + if(!TextUtils.isEmpty(imagePath) && new File(imagePath).exists()) { + try { + pic = BitmapHelper.getBitmap(imagePath); + } catch (Throwable e) { + e.printStackTrace(); + } + } + + if (pic != null) { + thumb = pic; + aivThumb.setBitmap(pic); + } else if (imageArray != null && imageArray.length > 0) { + if (!TextUtils.isEmpty(imageArray[0]) && new File(imageArray[0]).exists()) { + try { + pic = BitmapHelper.getBitmap(imagePath); + } catch (Throwable e) { + e.printStackTrace(); + } + } + } + + if (pic != null) { + thumb = pic; + aivThumb.setBitmap(pic); + } else if (pic == null && !TextUtils.isEmpty(imageUrl)) { + aivThumb.execute(imageUrl, 0); + } else { + rlThumb.setVisibility(View.GONE); + } + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/land/FriendListPageLand.java b/app/src/main/java/onekeyshare/themes/classic/land/FriendListPageLand.java new file mode 100644 index 0000000000..56eb0f84cd --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/land/FriendListPageLand.java @@ -0,0 +1,33 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic.land; + + +import onekeyshare.OnekeyShareThemeImpl; +import onekeyshare.themes.classic.FriendListPage; + +/** 横屏的好友列表 */ +public class FriendListPageLand extends FriendListPage { + private static final int DESIGN_SCREEN_WIDTH = 1280; + private static final int DESIGN_TITLE_HEIGHT = 70; + + public FriendListPageLand(OnekeyShareThemeImpl impl) { + super(impl); + } + + protected float getRatio() { + float screenWidth = com.mob.tools.utils.R.getScreenWidth(activity); + return screenWidth / DESIGN_SCREEN_WIDTH; + } + + protected int getDesignTitleHeight() { + return DESIGN_TITLE_HEIGHT; + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/land/PlatformPageAdapterLand.java b/app/src/main/java/onekeyshare/themes/classic/land/PlatformPageAdapterLand.java new file mode 100644 index 0000000000..a9157ecd8e --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/land/PlatformPageAdapterLand.java @@ -0,0 +1,70 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic.land; + +import android.content.Context; +import android.util.Log; + +import java.util.ArrayList; + +import onekeyshare.themes.classic.PlatformPage; +import onekeyshare.themes.classic.PlatformPageAdapter; + + +/** 横屏的九宫格页面适配器 */ +public class PlatformPageAdapterLand extends PlatformPageAdapter { + private static final int DESIGN_SCREEN_WIDTH_L = 1280; + private static final int DESIGN_CELL_WIDTH_L = 160; + private static final int DESIGN_SEP_LINE_WIDTH = 1; + private static final int DESIGN_LOGO_HEIGHT = 76; + private static final int DESIGN_PADDING_TOP = 20; + + public PlatformPageAdapterLand(PlatformPage page, ArrayList cells) { + super(page, cells); + } + + protected void calculateSize(Context context, ArrayList plats) { + int screenWidth = com.mob.tools.utils.R.getScreenWidth(context); + float ratio = ((float) screenWidth) / DESIGN_SCREEN_WIDTH_L; + int cellWidth = (int) (DESIGN_CELL_WIDTH_L * ratio); + lineSize = screenWidth / cellWidth; + Log.e("TAG","lineSize2"+lineSize+"screenWidth:"+screenWidth+"cellWidth"+cellWidth); + + sepLineWidth = (int) (DESIGN_SEP_LINE_WIDTH * ratio); + sepLineWidth = sepLineWidth < 1 ? 1 : sepLineWidth; + logoHeight = (int) (DESIGN_LOGO_HEIGHT * ratio); + paddingTop = (int) (DESIGN_PADDING_TOP * ratio); + bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio); + cellHeight = (screenWidth - sepLineWidth * 3) / (lineSize - 1); + panelHeight = cellHeight + sepLineWidth; + } + + protected void collectCells(ArrayList plats) { + int count = plats.size(); + if (count < lineSize) { + int lineCount = (count / lineSize); + if (count % lineSize != 0) { + lineCount++; + } + cells = new Object[1][lineCount * lineSize]; + } else { + int pageCount = (count / lineSize); + if (count % lineSize != 0) { + pageCount++; + } + cells = new Object[pageCount][lineSize]; + } + + for (int i = 0; i < count; i++) { + int p = i / lineSize; + cells[p][i - lineSize * p] = plats.get(i); + } + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/land/PlatformPageLand.java b/app/src/main/java/onekeyshare/themes/classic/land/PlatformPageLand.java new file mode 100644 index 0000000000..013d0e0561 --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/land/PlatformPageLand.java @@ -0,0 +1,35 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic.land; + +import java.util.ArrayList; + +import onekeyshare.OnekeyShareThemeImpl; +import onekeyshare.themes.classic.PlatformPage; +import onekeyshare.themes.classic.PlatformPageAdapter; + + +/** 横屏的九宫格页面 */ +public class PlatformPageLand extends PlatformPage { + + public PlatformPageLand(OnekeyShareThemeImpl impl) { + super(impl); + } + + public void onCreate() { + requestLandscapeOrientation(); + super.onCreate(); + } + + protected PlatformPageAdapter newAdapter(ArrayList cells) { + return new PlatformPageAdapterLand(this, cells); + } + +} + diff --git a/app/src/main/java/onekeyshare/themes/classic/port/EditPagePort.java b/app/src/main/java/onekeyshare/themes/classic/port/EditPagePort.java new file mode 100644 index 0000000000..a7f45fedea --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/port/EditPagePort.java @@ -0,0 +1,270 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic.port; + +import android.graphics.Bitmap; +import android.text.TextUtils; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup.LayoutParams; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.ScrollView; +import android.widget.TextView; + +import com.mob.tools.gui.AsyncImageView; +import com.mob.tools.utils.BitmapHelper; + +import java.io.File; + +import onekeyshare.OnekeyShareThemeImpl; +import onekeyshare.themes.classic.EditPage; +import onekeyshare.themes.classic.XView; + + +/** 竖屏的编辑页 */ +public class EditPagePort extends EditPage { + private static final int DESIGN_SCREEN_HEIGHT= 1280; + private static final int DESIGN_TITLE_HEIGHT = 96; + private static final int DESIGN_BOTTOM_HEIGHT = 75; + private static final int DESIGN_LEFT_PADDING = 40; + private static final int DESIGN_THUMB_HEIGHT = 300; + private static final int DESIGN_REMOVE_THUMB_HEIGHT = 70; + + public EditPagePort(OnekeyShareThemeImpl impl) { + super(impl); + } + + public void onCreate() { + super.onCreate(); + + int screenHeight = com.mob.tools.utils.R.getScreenHeight(activity); + float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT; + + maxBodyHeight = 0; + + llPage = new LinearLayout(activity); + llPage.setOrientation(LinearLayout.VERTICAL); + activity.setContentView(llPage); + + rlTitle = new RelativeLayout(activity); + rlTitle.setBackgroundColor(0xffe6e9ec); + int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio); + + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight); + llPage.addView(rlTitle, lp); + initTitle(rlTitle, ratio); + + RelativeLayout rlBody = new RelativeLayout(activity); + rlBody.setBackgroundColor(0xffffffff); + lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); + llPage.addView(rlBody, lp); + initBody(rlBody, ratio); + + LinearLayout llShadow = new LinearLayout(activity); + llShadow.setOrientation(LinearLayout.VERTICAL); + rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); + initShadow(llShadow, ratio); + + llBottom = new LinearLayout(activity); + llBottom.setOrientation(LinearLayout.VERTICAL); + lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); + llPage.addView(llBottom, lp); + initBottom(llBottom, ratio); + } + + private void initTitle(RelativeLayout rlTitle, float ratio) { + tvCancel = new TextView(activity); + tvCancel.setTextColor(0xff3b3b3b); + tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); + tvCancel.setGravity(Gravity.CENTER); + int resId = com.mob.tools.utils.R.getStringRes(activity, "ssdk_oks_cancel"); + if (resId > 0) { + tvCancel.setText(resId); + } + int padding = (int) (DESIGN_LEFT_PADDING * ratio); + tvCancel.setPadding(padding, 0, padding, 0); + RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + rlTitle.addView(tvCancel, lp); + tvCancel.setOnClickListener(this); + + TextView tvTitle = new TextView(activity); + tvTitle.setTextColor(0xff3b3b3b); + tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); + tvTitle.setGravity(Gravity.CENTER); + resId = com.mob.tools.utils.R.getStringRes(activity, "ssdk_oks_multi_share"); + if (resId > 0) { + tvTitle.setText(resId); + } + lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + lp.addRule(RelativeLayout.CENTER_IN_PARENT); + rlTitle.addView(tvTitle, lp); + + tvShare = new TextView(activity); + tvShare.setTextColor(0xffff6d11); + tvShare.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); + tvShare.setGravity(Gravity.CENTER); + resId = com.mob.tools.utils.R.getStringRes(activity, "ssdk_oks_share"); + if (resId > 0) { + tvShare.setText(resId); + } + tvShare.setPadding(padding, 0, padding, 0); + lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); + rlTitle.addView(tvShare, lp); + tvShare.setOnClickListener(this); + } + + private void initBody(RelativeLayout rlBody, float ratio) { + svContent = new ScrollView(activity); + rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); + + LinearLayout llContent = new LinearLayout(activity); + llContent.setOrientation(LinearLayout.VERTICAL); + svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); + + etContent = new EditText(activity); + int padding = (int) (DESIGN_LEFT_PADDING * ratio); + etContent.setPadding(padding, padding, padding, padding); + etContent.setBackgroundDrawable(null); + etContent.setTextColor(0xff3b3b3b); + etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); + etContent.setText(sp.getText()); + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); + llContent.addView(etContent, lp); + etContent.addTextChangedListener(this); + + rlThumb = new RelativeLayout(activity); + rlThumb.setBackgroundColor(0xff313131); + int thumbWidth = (int) (DESIGN_THUMB_HEIGHT * ratio); + int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT * ratio); + lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); + lp.leftMargin = lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; + llContent.addView(rlThumb, lp); + + aivThumb = new AsyncImageView(activity) { + public void onImageGot(String url, Bitmap bm) { + thumb = bm; + super.onImageGot(url, bm); + } + }; + aivThumb.setScaleToCropCenter(true); + RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); + rlThumb.addView(aivThumb, rllp); + aivThumb.setOnClickListener(this); + initThumb(aivThumb); + + xvRemove = new XView(activity); + xvRemove.setRatio(ratio); + rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); + rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); + rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); + rlThumb.addView(xvRemove, rllp); + xvRemove.setOnClickListener(this); + } + + private void initBottom(LinearLayout llBottom, float ratio) { + LinearLayout llAt = new LinearLayout(activity); + llAt.setPadding(0, 0, 0, 5); + llAt.setBackgroundColor(0xffffffff); + int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio); + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight); + llBottom.addView(llAt, lp); + + tvAt = new TextView(activity); + tvAt.setTextColor(0xff3b3b3b); + tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); + tvAt.setGravity(Gravity.BOTTOM); + tvAt.setText("@"); + int padding = (int) (DESIGN_LEFT_PADDING * ratio); + tvAt.setPadding(padding, 0, padding, 0); + lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + llAt.addView(tvAt, lp); + tvAt.setOnClickListener(this); + if (isShowAtUserLayout(platform.getName())) { + tvAt.setVisibility(View.VISIBLE); + } else { + tvAt.setVisibility(View.INVISIBLE); + } + + tvTextCouter = new TextView(activity); + tvTextCouter.setTextColor(0xff3b3b3b); + tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); + tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT); + onTextChanged(etContent.getText(), 0, 0, 0); + tvTextCouter.setPadding(padding, 0, padding, 0); + lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + lp.weight = 1; + llAt.addView(tvTextCouter, lp); + + View v = new View(activity); + v.setBackgroundColor(0xffcccccc); + int px_1 = ratio > 1 ? ((int) ratio) : 1; + lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px_1); + llBottom.addView(v, lp); + } + + private void initShadow(LinearLayout llShadow, float ratio) { + int px_1 = ratio > 1 ? ((int) ratio) : 1; + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px_1); + + View v = new View(activity); + v.setBackgroundColor(0x29000000); + llShadow.addView(v, lp); + + v = new View(activity); + v.setBackgroundColor(0x14000000); + llShadow.addView(v, lp); + + v = new View(activity); + v.setBackgroundColor(0x07000000); + llShadow.addView(v, lp); + } + + private void initThumb(AsyncImageView aivThumb) { + String imageUrl = sp.getImageUrl(); + String imagePath = sp.getImagePath(); + String[] imageArray = sp.getImageArray(); + + Bitmap pic = null; + rlThumb.setVisibility(View.VISIBLE); + if(!TextUtils.isEmpty(imagePath) && new File(imagePath).exists()) { + try { + pic = BitmapHelper.getBitmap(imagePath); + } catch (Throwable e) { + e.printStackTrace(); + } + } + + if (pic != null) { + thumb = pic; + aivThumb.setBitmap(pic); + } else if (imageArray != null && imageArray.length > 0) { + if (!TextUtils.isEmpty(imageArray[0]) && new File(imageArray[0]).exists()) { + try { + pic = BitmapHelper.getBitmap(imagePath); + } catch (Throwable e) { + e.printStackTrace(); + } + } + } + + if (pic != null) { + thumb = pic; + aivThumb.setBitmap(pic); + } else if (pic == null && !TextUtils.isEmpty(imageUrl)) { + aivThumb.execute(imageUrl, 0); + } else { + rlThumb.setVisibility(View.GONE); + } + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/port/FriendListPagePort.java b/app/src/main/java/onekeyshare/themes/classic/port/FriendListPagePort.java new file mode 100644 index 0000000000..bef0853246 --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/port/FriendListPagePort.java @@ -0,0 +1,33 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic.port; + + +import onekeyshare.OnekeyShareThemeImpl; +import onekeyshare.themes.classic.FriendListPage; + +/** 竖屏的好友列表 */ +public class FriendListPagePort extends FriendListPage { + private static final int DESIGN_SCREEN_WIDTH = 720; + private static final int DESIGN_TITLE_HEIGHT = 96; + + public FriendListPagePort(OnekeyShareThemeImpl impl) { + super(impl); + } + + protected float getRatio() { + float screenWidth = com.mob.tools.utils.R.getScreenWidth(activity); + return screenWidth / DESIGN_SCREEN_WIDTH; + } + + protected int getDesignTitleHeight() { + return DESIGN_TITLE_HEIGHT; + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/port/PlatformPageAdapterPort.java b/app/src/main/java/onekeyshare/themes/classic/port/PlatformPageAdapterPort.java new file mode 100644 index 0000000000..c51bb2e347 --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/port/PlatformPageAdapterPort.java @@ -0,0 +1,74 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic.port; + +import android.content.Context; + +import java.util.ArrayList; + +import onekeyshare.themes.classic.PlatformPage; +import onekeyshare.themes.classic.PlatformPageAdapter; + + +/** 竖屏的九宫格页面适配器 */ +public class PlatformPageAdapterPort extends PlatformPageAdapter { + private static final int DESIGN_SCREEN_WIDTH_P = 720; + private static final int DESIGN_SEP_LINE_WIDTH = 1; + private static final int DESIGN_LOGO_HEIGHT = 76; + private static final int DESIGN_PADDING_TOP = 20; + private static final int PAGE_SIZE_P = 12; + private static final int LINE_SIZE_P = 4; + + public PlatformPageAdapterPort(PlatformPage page, ArrayList cells) { + super(page, cells); + } + + protected void calculateSize(Context context, ArrayList plats) { + int screenWidth = com.mob.tools.utils.R.getScreenWidth(context); + lineSize = LINE_SIZE_P; + + float ratio = ((float) screenWidth) / DESIGN_SCREEN_WIDTH_P; + sepLineWidth = (int) (DESIGN_SEP_LINE_WIDTH * ratio); + sepLineWidth = sepLineWidth < 1 ? 1 : sepLineWidth; + logoHeight = (int) (DESIGN_LOGO_HEIGHT * ratio); + paddingTop = (int) (DESIGN_PADDING_TOP * ratio); + bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio); + cellHeight = (screenWidth - sepLineWidth * 3) / 4; + if (plats.size() <= lineSize) { + panelHeight = cellHeight + sepLineWidth; + } else if (plats.size() <= PAGE_SIZE_P - lineSize) { + panelHeight = (cellHeight + sepLineWidth) * 2; + } else { + panelHeight = (cellHeight + sepLineWidth) * 3; + } + } + + protected void collectCells(ArrayList plats) { + int count = plats.size(); + if (count < PAGE_SIZE_P) { + int lineCount = (count / lineSize); + if (count % lineSize != 0) { + lineCount++; + } + cells = new Object[1][lineCount * lineSize]; + } else { + int pageCount = (count / PAGE_SIZE_P); + if (count % PAGE_SIZE_P != 0) { + pageCount++; + } + cells = new Object[pageCount][PAGE_SIZE_P]; + } + + for (int i = 0; i < count; i++) { + int p = i / PAGE_SIZE_P; + cells[p][i - PAGE_SIZE_P * p] = plats.get(i); + } + } + +} diff --git a/app/src/main/java/onekeyshare/themes/classic/port/PlatformPagePort.java b/app/src/main/java/onekeyshare/themes/classic/port/PlatformPagePort.java new file mode 100644 index 0000000000..b4e0911bf5 --- /dev/null +++ b/app/src/main/java/onekeyshare/themes/classic/port/PlatformPagePort.java @@ -0,0 +1,34 @@ +/* + * 官网地站:http://www.mob.com + * 技术支持QQ: 4006852216 + * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) + * + * Copyright (c) 2013年 mob.com. All rights reserved. + */ + +package onekeyshare.themes.classic.port; + +import java.util.ArrayList; + +import onekeyshare.OnekeyShareThemeImpl; +import onekeyshare.themes.classic.PlatformPage; +import onekeyshare.themes.classic.PlatformPageAdapter; + + +/** 竖屏的九宫格页面 */ +public class PlatformPagePort extends PlatformPage { + + public PlatformPagePort(OnekeyShareThemeImpl impl) { + super(impl); + } + + public void onCreate() { + requestPortraitOrientation(); + super.onCreate(); + } + + protected PlatformPageAdapter newAdapter(ArrayList cells) { + return new PlatformPageAdapterPort(this, cells); + } + +} diff --git a/app/src/main/res/drawable-hdpi/ssdk_oks_ptr_ptr.png b/app/src/main/res/drawable-hdpi/ssdk_oks_ptr_ptr.png new file mode 100644 index 0000000000..f533541009 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ssdk_oks_ptr_ptr.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_back_arr.png b/app/src/main/res/drawable-xhdpi/ssdk_back_arr.png new file mode 100644 index 0000000000..24e07d6987 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_back_arr.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_alipay.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_alipay.png new file mode 100644 index 0000000000..4955f08ff0 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_alipay.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_bluetooth.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_bluetooth.png new file mode 100644 index 0000000000..11487e3c3b Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_bluetooth.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_check_checked.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_check_checked.png new file mode 100644 index 0000000000..280c2c6cf4 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_check_checked.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_check_default.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_check_default.png new file mode 100644 index 0000000000..55c791b6fd Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_check_default.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_douban.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_douban.png new file mode 100644 index 0000000000..32259855b7 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_douban.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_dropbox.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_dropbox.png new file mode 100644 index 0000000000..ffddf10e01 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_dropbox.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_email.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_email.png new file mode 100644 index 0000000000..9fde7a4b02 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_email.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_evernote.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_evernote.png new file mode 100644 index 0000000000..e621af5e77 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_evernote.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_facebook.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_facebook.png new file mode 100644 index 0000000000..5a9d07096d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_facebook.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_facebookmessenger.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_facebookmessenger.png new file mode 100644 index 0000000000..c769593c5b Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_facebookmessenger.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_flickr.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_flickr.png new file mode 100644 index 0000000000..3ddb4e3143 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_flickr.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_foursquare.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_foursquare.png new file mode 100644 index 0000000000..eaedd64ff4 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_foursquare.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_googleplus.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_googleplus.png new file mode 100644 index 0000000000..af2145a987 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_googleplus.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_instagram.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_instagram.png new file mode 100644 index 0000000000..3ae590a98c Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_instagram.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_instapaper.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_instapaper.png new file mode 100644 index 0000000000..20cb3b5cea Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_instapaper.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kaixin.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kaixin.png new file mode 100644 index 0000000000..621fb4ebd9 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kaixin.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kakaostory.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kakaostory.png new file mode 100644 index 0000000000..ba4745b72d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kakaostory.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kakaotalk.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kakaotalk.png new file mode 100644 index 0000000000..8c438871d1 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kakaotalk.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_laiwang.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_laiwang.png new file mode 100644 index 0000000000..bba9045116 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_laiwang.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_laiwangmoments.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_laiwangmoments.png new file mode 100644 index 0000000000..906c7c741e Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_laiwangmoments.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_line.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_line.png new file mode 100644 index 0000000000..589d18fa82 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_line.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_linkedin.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_linkedin.png new file mode 100644 index 0000000000..bf9ab94fdd Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_linkedin.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_mingdao.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_mingdao.png new file mode 100644 index 0000000000..9a9466f8c0 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_mingdao.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_pinterest.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_pinterest.png new file mode 100644 index 0000000000..d72cbd170c Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_pinterest.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_pocket.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_pocket.png new file mode 100644 index 0000000000..fba537227b Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_pocket.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_qq.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_qq.png new file mode 100644 index 0000000000..8f27c835d4 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_qq.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_qzone.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_qzone.png new file mode 100644 index 0000000000..6ae5afae68 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_qzone.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_renren.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_renren.png new file mode 100644 index 0000000000..cf511609a4 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_renren.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_shortmessage.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_shortmessage.png new file mode 100644 index 0000000000..da6328caec Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_shortmessage.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_sinaweibo.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_sinaweibo.png new file mode 100644 index 0000000000..e8524e6296 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_sinaweibo.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_tencentweibo.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_tencentweibo.png new file mode 100644 index 0000000000..087120eb47 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_tencentweibo.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_tumblr.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_tumblr.png new file mode 100644 index 0000000000..b139718942 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_tumblr.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_twitter.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_twitter.png new file mode 100644 index 0000000000..bc7d97c74e Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_twitter.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_vkontakte.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_vkontakte.png new file mode 100644 index 0000000000..6215950183 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_vkontakte.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechat.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechat.png new file mode 100644 index 0000000000..f79d75bc60 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechat.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechatfavorite.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechatfavorite.png new file mode 100644 index 0000000000..2ab8635b49 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechatfavorite.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechatmoments.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechatmoments.png new file mode 100644 index 0000000000..d9af2b4f35 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechatmoments.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_whatsapp.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_whatsapp.png new file mode 100644 index 0000000000..334283ddd2 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_whatsapp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_yixin.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_yixin.png new file mode 100644 index 0000000000..a35dc10420 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_yixin.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_yixinmoments.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_yixinmoments.png new file mode 100644 index 0000000000..407d019b0e Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_yixinmoments.png differ diff --git a/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_youdao.png b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_youdao.png new file mode 100644 index 0000000000..bddde0304f Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_youdao.png differ diff --git a/app/src/main/res/drawable/ssdk_oks_classic_platform_cell_back.xml b/app/src/main/res/drawable/ssdk_oks_classic_platform_cell_back.xml new file mode 100644 index 0000000000..44040c42c6 --- /dev/null +++ b/app/src/main/res/drawable/ssdk_oks_classic_platform_cell_back.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/ssdk_oks_classic_progressbar.xml b/app/src/main/res/drawable/ssdk_oks_classic_progressbar.xml new file mode 100644 index 0000000000..5e67f84ad0 --- /dev/null +++ b/app/src/main/res/drawable/ssdk_oks_classic_progressbar.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/app/src/main/res/layout/search1_fragment.xml b/app/src/main/res/layout/search1_fragment.xml index 1541afdc26..a6fa73f97e 100644 --- a/app/src/main/res/layout/search1_fragment.xml +++ b/app/src/main/res/layout/search1_fragment.xml @@ -7,7 +7,8 @@ + android:layout_height="match_parent" + android:scrollbars="vertical" /> + tools:context="com.gh.gamecenter.search.Search1DetailFragment"> + android:layout_height="match_parent" + android:scrollbars="vertical"> diff --git a/app/src/main/res/values-en/ssdk_oks_strings.xml b/app/src/main/res/values-en/ssdk_oks_strings.xml new file mode 100644 index 0000000000..de39dc9ac1 --- /dev/null +++ b/app/src/main/res/values-en/ssdk_oks_strings.xml @@ -0,0 +1,15 @@ + + + Share + Sharing operation is working in the background… + Operation failed + Operation succeeded + Operation canceled + Cancel + Photo Sharing + Confirm + Contacts + Pull down to refresh + Release to refresh + Refreshing… + diff --git a/app/src/main/res/values-en/ssdk_strings.xml b/app/src/main/res/values-en/ssdk_strings.xml new file mode 100644 index 0000000000..2ad9d216ff --- /dev/null +++ b/app/src/main/res/values-en/ssdk_strings.xml @@ -0,0 +1,74 @@ + + + Authorization + http://www.mob.com + 分享图片 + Wechat client not exists or the version is too low + Google+ client not exists or the version is too low + Mobile QQ client not exists or the version is too low + Pinterest client not exists or the version is too low + Instagram client not exists or the version is too low + Yixin client not exists or the version is too low + Line client not exists or the version is too low + KakaoTalk client not exists or the version is too low + KakaoStory client not exists or the version is too low + WhatsApp client not exists or the version is too low + Laiwangs client not exists or the version is too low + Alipay client not exists or the version is too low + Facebookmessenger client not exists or the version is too low + + Sina Weibo + Tencent Weibo + QZone + WeChat + WeChat Moments + WeChat Favorites + Facebook + Twitter + Renren + Kaixin + Email + Short Message + Sohu Microblog + Netease Microblog + Douban + Youdao + Evernote + Linked in + Google+ + FourSquare + QQ + Sohu Suishenkan + Pinterest + Flickr + Tumblr + Dropbox + VK + Instagram + Yixin + Yixin Moments + Mingdao + KakaoTalk + KakaoStory + Line + Bluetooth + WhatsApp + Pocket + Instapaper + Email + Password + Sign In + Sign In… + Email or Password incorrect + Facebook Messenger + Laiwang + Laiwang Moments + Alipay + + Share To QZone + Share To QQ + Share webpage + Share To Mingdao + Shared from %s + use login button instead + \ No newline at end of file diff --git a/app/src/main/res/values/ssdk_instapaper_strings.xml b/app/src/main/res/values/ssdk_instapaper_strings.xml new file mode 100644 index 0000000000..ca6c4ae59c --- /dev/null +++ b/app/src/main/res/values/ssdk_instapaper_strings.xml @@ -0,0 +1,70 @@ + + + + + + + + + +%s + + + + + +
+%s +
+ + + +
+

+
+ + +]]>
+
\ No newline at end of file diff --git a/app/src/main/res/values/ssdk_oks_color_drawables.xml b/app/src/main/res/values/ssdk_oks_color_drawables.xml new file mode 100644 index 0000000000..ae1181f37c --- /dev/null +++ b/app/src/main/res/values/ssdk_oks_color_drawables.xml @@ -0,0 +1,5 @@ + + + #ffffffff + #ffeeeeee + diff --git a/app/src/main/res/values/ssdk_oks_strings.xml b/app/src/main/res/values/ssdk_oks_strings.xml new file mode 100644 index 0000000000..548bf276d8 --- /dev/null +++ b/app/src/main/res/values/ssdk_oks_strings.xml @@ -0,0 +1,15 @@ + + + 分享 + 分享操作正在后台进行… + 分享失败 + 分享成功 + 分享已取消 + 取消 + 图文分享 + 确定 + 联系人 + 下拉刷新 + 松开刷新 + 刷新中… + diff --git a/app/src/main/res/values/ssdk_strings.xml b/app/src/main/res/values/ssdk_strings.xml index 5ec9b25387..4177cd24c1 100644 --- a/app/src/main/res/values/ssdk_strings.xml +++ b/app/src/main/res/values/ssdk_strings.xml @@ -1,74 +1,77 @@ - 应用授权 - http://www.mob.com - 分享图片 - 目前您的微信版本过低或未安装微信,需要安装微信才能使用 - Google+ 版本过低或者没有安装,需要升级或安装Google+才能使用! - QQ 版本过低或者没有安装,需要升级或安装QQ才能使用! - Pinterest版本过低或者没有安装,需要升级或安装Pinterest才能使用! - Instagram版本过低或者没有安装,需要升级或安装Instagram才能使用! - 目前您的易信版本过低或未安装,需要安装易信才能使用 - 目前您的Line版本过低或未安装,需要安装Line才能使用 - 目前您的KakaoTalk版本过低或未安装,需要安装KakaoTalk才能使用 - 目前您的KakaoStory版本过低或未安装,需要安装KakaoStory才能使用 - 目前您的WhatsApp版本过低或未安装,需要安装WhatsApp才能使用 - 目前您的百度贴吧版本过低或未安装,需要安装百度贴吧才能使用 - 目前您的来往版本过低或未安装,需要安装来往才能使用 + 应用授权 + http://www.mob.com + 分享图片 + 目前您的微信版本过低或未安装微信,需要安装微信才能使用 + Google+ 版本过低或者没有安装,需要升级或安装Google+才能使用! + QQ 版本过低或者没有安装,需要升级或安装QQ才能使用! + Pinterest版本过低或者没有安装,需要升级或安装Pinterest才能使用! + Instagram版本过低或者没有安装,需要升级或安装Instagram才能使用! + 目前您的易信版本过低或未安装,需要安装易信才能使用 + 目前您的Line版本过低或未安装,需要安装Line才能使用 + 目前您的KakaoTalk版本过低或未安装,需要安装KakaoTalk才能使用 + 目前您的KakaoStory版本过低或未安装,需要安装KakaoStory才能使用 + 目前您的WhatsApp版本过低或未安装,需要安装WhatsApp才能使用 + 目前您的百度贴吧版本过低或未安装,需要安装百度贴吧才能使用 + 目前您的来往版本过低或未安装,需要安装来往才能使用 + 目前您的支付宝版本过低或未安装,需要安装支付宝才能使用 + 目前您的FacebookMessenger版本过低或未安装,需要安装才能使用 - 新浪微博 - 腾讯微博 - QQ空间 - 微信好友 - 微信朋友圈 - 微信收藏 - Facebook - Twitter - 人人网 - 开心网 - 邮件 - 信息 - 搜狐微博 - 搜狐随身看 - 网易微博 - 豆瓣 - 有道云笔记 - 印象笔记 - 领英 - Google+ - FourSquare - QQ - Pinterest - Flickr - Tumblr - Dropbox - VK - Instagram - 易信 - 易信朋友圈 - 明道 - KakaoTalk - KakaoStory - Line - 蓝牙 - WhatsApp - Pocket - Instapaper - 邮箱 - 密码 - 登录 - 登录中… - Email或密码不正确 - Facebook Messenger - 百度贴吧 - 来往 - 来往动态 + 新浪微博 + 腾讯微博 + QQ空间 + 微信好友 + 微信朋友圈 + 微信收藏 + Facebook + Twitter + 人人网 + 开心网 + 邮件 + 信息 + 搜狐微博 + 搜狐随身看 + 网易微博 + 豆瓣 + 有道云笔记 + 印象笔记 + 领英 + Google+ + FourSquare + QQ + Pinterest + Flickr + Tumblr + Dropbox + VK + Instagram + 易信 + 易信朋友圈 + 明道 + KakaoTalk + KakaoStory + Line + 蓝牙 + WhatsApp + Pocket + Instapaper + 邮箱 + 密码 + 登录 + 登录中… + Email或密码不正确 + Facebook Messenger + 百度贴吧 + 来往 + 来往动态 + 支付宝好友 - 分享到百度贴吧 - 分享到QQ空间 - 分享到QQ - 网页分享 - 分享到明道 - 来自%s的分享 - 请改用“登录”按钮 + 分享到百度贴吧 + 分享到QQ空间 + 分享到QQ + 网页分享 + 分享到明道 + 来自%s的分享 + 请改用“登录”按钮 \ No newline at end of file