diff --git a/app/libs/ShareSDK-Core-2.7.2.jar b/app/libs/ShareSDK-Core-2.7.2.jar deleted file mode 100644 index d247c0f7a1..0000000000 Binary files a/app/libs/ShareSDK-Core-2.7.2.jar and /dev/null differ diff --git a/app/libs/ShareSDK-ShortMessage-2.7.2.jar b/app/libs/ShareSDK-ShortMessage-2.7.2.jar deleted file mode 100644 index aaca604319..0000000000 Binary files a/app/libs/ShareSDK-ShortMessage-2.7.2.jar and /dev/null differ diff --git a/app/src/main/assets/ShareSDK.xml b/app/src/main/assets/ShareSDK.xml deleted file mode 100644 index c48475b81e..0000000000 --- a/app/src/main/assets/ShareSDK.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/java/com/gh/base/BaseActivity.java b/app/src/main/java/com/gh/base/BaseActivity.java index 3acf205daa..f6ab4f5a16 100644 --- a/app/src/main/java/com/gh/base/BaseActivity.java +++ b/app/src/main/java/com/gh/base/BaseActivity.java @@ -34,7 +34,6 @@ import com.gh.gamecenter.manager.SystemBarTintManager.SystemBarConfig; import java.lang.reflect.Field; import java.util.ArrayList; -import cn.sharesdk.framework.ShareSDK; import de.greenrobot.event.EventBus; public class BaseActivity extends Activity implements OnCallBackListener { @@ -142,8 +141,6 @@ public class BaseActivity extends Activity implements OnCallBackListener { //如果是游戏分享,newsTitle默认为空 public void showShare(String url, String gameName, String icon, String newsTitle, ArrayList tag, String entrance, String type) { - ShareSDK.initSDK(this); - //判断是否是官方版 boolean isPlugin = false; if (tag != null){ diff --git a/app/src/main/java/com/gh/base/BaseFragmentActivity.java b/app/src/main/java/com/gh/base/BaseFragmentActivity.java index 7988088d67..ae57e14869 100644 --- a/app/src/main/java/com/gh/base/BaseFragmentActivity.java +++ b/app/src/main/java/com/gh/base/BaseFragmentActivity.java @@ -33,7 +33,6 @@ import com.gh.gamecenter.manager.SystemBarTintManager.SystemBarConfig; import java.lang.reflect.Field; import java.util.ArrayList; -import cn.sharesdk.framework.ShareSDK; import de.greenrobot.event.EventBus; public class BaseFragmentActivity extends FragmentActivity { @@ -134,8 +133,6 @@ public class BaseFragmentActivity extends FragmentActivity { //如果是游戏分享,newsTitle默认为空 public void showShare(String url, String gameName, String icon, String newsTitle, ArrayList tag, String entrance, String type) { - ShareSDK.initSDK(this); - //判断是否是官方版 boolean isPlugin = false; if (tag != null){ diff --git a/app/src/main/java/com/gh/common/util/ShareUtils.java b/app/src/main/java/com/gh/common/util/ShareUtils.java index 01ba941c92..ea2a162e29 100644 --- a/app/src/main/java/com/gh/common/util/ShareUtils.java +++ b/app/src/main/java/com/gh/common/util/ShareUtils.java @@ -10,6 +10,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Matrix; +import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.support.v7.widget.GridLayoutManager; @@ -44,14 +45,8 @@ import com.tencent.tauth.UiError; import java.io.ByteArrayOutputStream; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import cn.sharesdk.framework.Platform; -import cn.sharesdk.framework.PlatformActionListener; -import cn.sharesdk.framework.ShareSDK; -import cn.sharesdk.system.text.ShortMessage; - /** * Created by khy on 2016/9/4. */ @@ -362,44 +357,22 @@ public class ShareUtils { //短信分享 private void shortMessageSahre(){ - ShortMessage.ShareParams shortMessageParams = new ShortMessage.ShareParams(); - + String smsBody; if (shareNewsTitle != null){ - shortMessageParams.setText(shareNewsTitle + shareUrl); + smsBody = shareNewsTitle + shareUrl; }else { if (isPlugin){ - shortMessageParams.setText("向你推荐:" + shareGameName + "(光环加速版)" + shareUrl); + smsBody = "向你推荐:" + shareGameName + "(光环加速版)" + shareUrl; }else { - shortMessageParams.setText("向你推荐:" + shareGameName + shareUrl); + smsBody = "向你推荐:" + shareGameName + shareUrl; } } - shortMessageParams.setUrl(shareUrl); - shortMessageParams.setTitleUrl(shareUrl); - sharePlatform(shortMessageParams, ShortMessage.NAME); - } + Intent sendIntent = new Intent(Intent.ACTION_VIEW, Uri.parse( "smsto:" )); + sendIntent.putExtra( "sms_body", smsBody); + sendIntent.setType( "vnd.android-dir/mms-sms" ); + context.startActivity(sendIntent); - //分享平台回调 - private void sharePlatform(Platform.ShareParams params, String name) { - Utils.toast(context,"分享跳转中..."); - Platform platform = ShareSDK.getPlatform(name); - platform.setPlatformActionListener(new PlatformActionListener() { - @Override - public void onComplete(Platform platform, int i, HashMap hashMap) { - Utils.log("分享成功"); - } - - @Override - public void onError(Platform platform, int i, Throwable throwable) { - Utils.log("分享失败"); - } - - @Override - public void onCancel(Platform platform, int i) { - Utils.log("取消分享"); - } - }); - platform.share(params); popupWindow.dismiss(); } diff --git a/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java b/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java index e5fa5f430b..8bc9327b73 100644 --- a/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java +++ b/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java @@ -140,15 +140,20 @@ public class GameDetailActivity extends DetailActivity implements View.OnClickLi String url = "http://www.ghzhushou.com/game/" + adapter.getGameDetailEntity().getShareCode(); showShare(url, gameEntity.getName(), gameEntity.getIcon(), null, gameEntity.getTag(), entrance, "游戏"); - } else if (v == actionbar_rl_back && InitChangeSkinUtils.isChecking) { - DialogUtils.showWarningDialog(GameDetailActivity.this, "退出提示", - "素材更新还在检测中,如果强行退出会中断所有进度,确定退出?", - "取消", "强行退出", new DialogUtils.ConfiremListener() { - @Override - public void onConfirem() { - finish(); - } - }, null); + } else if (v == actionbar_rl_back) { + if (InitChangeSkinUtils.isChecking) { + DialogUtils.showWarningDialog(GameDetailActivity.this, "退出提示", + "素材更新还在检测中,如果强行退出会中断所有进度,确定退出?", + "取消", "强行退出", new DialogUtils.ConfiremListener() { + @Override + public void onConfirem() { + finish(); + } + }, null); + } else { + finish(); + } + } } diff --git a/app/src/main/java/onekeyshare/CustomerLogo.java b/app/src/main/java/onekeyshare/CustomerLogo.java deleted file mode 100644 index 727479d479..0000000000 --- a/app/src/main/java/onekeyshare/CustomerLogo.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - -package onekeyshare; - -import android.graphics.Bitmap; -import android.view.View.OnClickListener; - -/** 九宫格自定义的图标对象 */ -public class CustomerLogo { - public String label; - public Bitmap logo; - public OnClickListener listener; -} diff --git a/app/src/main/java/onekeyshare/OnekeyShare.java b/app/src/main/java/onekeyshare/OnekeyShare.java deleted file mode 100644 index adb7e17c8e..0000000000 --- a/app/src/main/java/onekeyshare/OnekeyShare.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * 官网地站: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 onekeyshare.themes.classic.PlatformPage; - -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")); - themeImpl.setOnFinishListener((PlatformPage.OnFinishListener) shareParamsMap.remove("finishCallback")); - if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) { - themeImpl.disableSSO(); - } - - themeImpl.show(context); - } - - public void setOnFinishListener(PlatformPage.OnFinishListener listener) { - params.put("finishCallback", listener); - } - -} diff --git a/app/src/main/java/onekeyshare/OnekeySharePage.java b/app/src/main/java/onekeyshare/OnekeySharePage.java deleted file mode 100644 index 1c2ea4d6ce..0000000000 --- a/app/src/main/java/onekeyshare/OnekeySharePage.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 官网地站: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 deleted file mode 100644 index 54ad31c0bb..0000000000 --- a/app/src/main/java/onekeyshare/OnekeyShareTheme.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 官网地站: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 deleted file mode 100644 index e0826e33b9..0000000000 --- a/app/src/main/java/onekeyshare/OnekeyShareThemeImpl.java +++ /dev/null @@ -1,421 +0,0 @@ -/* - * 官网地站: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.R; -import com.mob.tools.utils.UIHandler; - -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; -import onekeyshare.themes.classic.PlatformPage; - -/** 快捷分享的主题样式的实现父类 */ -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; - - protected PlatformPage.OnFinishListener mOnFinishListener; - - public final void setOnFinishListener(PlatformPage.OnFinishListener listener) { - this.mOnFinishListener = listener; - } - - public PlatformPage.OnFinishListener getOnFinishListener() { - return mOnFinishListener; - } - - 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/onekeyshare/ShareContentCustomizeCallback.java b/app/src/main/java/onekeyshare/ShareContentCustomizeCallback.java deleted file mode 100644 index 350f7eb726..0000000000 --- a/app/src/main/java/onekeyshare/ShareContentCustomizeCallback.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - -package 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/onekeyshare/themes/classic/ClassicTheme.java b/app/src/main/java/onekeyshare/themes/classic/ClassicTheme.java deleted file mode 100644 index c70e6243c0..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/ClassicTheme.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 官网地站: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 deleted file mode 100644 index 5f66b5d900..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/EditPage.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * 官网地站: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 com.mob.tools.utils.R; - -import java.util.ArrayList; -import java.util.HashMap; - -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 deleted file mode 100644 index 87c10b382d..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/FriendAdapter.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * 官网地站: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 deleted file mode 100644 index 45b37a078d..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/FriendListItem.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 官网地站: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.graphics.Color; -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(Color.WHITE); - - 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 deleted file mode 100644 index 3435ed7e40..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/FriendListPage.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * 官网地站: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 deleted file mode 100644 index 954e6b1cf8..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/IndicatorView.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 官网地站: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.Color; -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(Color.WHITE); - 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 deleted file mode 100644 index 76048ae4f5..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/PRTHeader.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 官网地站: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 deleted file mode 100644 index cfae3b3a38..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/PicViewerPage.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 官网地站: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 deleted file mode 100644 index 1c81cf0242..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/PlatformPage.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * 官网地站:http://www.mob.com - * 技术支持QQ: 4006852216 - * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) - * - * Copyright (c) 2013年 mob.com. All rights reserved. - */ - -package onekeyshare.themes.classic; - -import android.annotation.TargetApi; -import android.os.Build; -import android.util.Log; -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.Window; -import android.view.WindowManager; -import android.view.animation.Animation; -import android.view.animation.ScaleAnimation; -import android.widget.LinearLayout; -import android.widget.TextView; - -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); - setOnFinishListener(impl.getOnFinishListener()); - this.impl = com.mob.tools.utils.R.forceCast(impl); - } - - @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); - } - - public void onCreate() { -// activity.getWindow().setBackgroundDrawable(new ColorDrawable(0x4c000000)); - initAnims(); - - llPage = new LinearLayout(activity); - llPage.setBackgroundColor(0x4c000000); - llPage.setOrientation(LinearLayout.VERTICAL); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - setTranslucentStatus(true); - } - - 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, adapter.getCellHeight() * 2); - Log.e("TAG", "lp = " + lp.height); - llPanel.addView(mvp, lp); - mvp.setOnTouchListener(new View.OnTouchListener() { - @Override - public boolean onTouch(View v, MotionEvent event) { - if (event.getAction() == MotionEvent.ACTION_DOWN) { - finish(); - } - 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) { - if (event.getAction() == MotionEvent.ACTION_DOWN) { - finish(); - } - return false; - } - }); - - llPanel.setVisibility(View.GONE); - runOnUIThread(new Runnable() { - @Override - public void run() { - llPanel.clearAnimation(); - llPanel.startAnimation(animShow); - llPanel.setVisibility(View.VISIBLE); - } - }, 50); - } - - 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 ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, - 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); - animShow.setDuration(300); - - 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); - if (mOnFinishListener != null) { - mOnFinishListener.onFinish(); - } - return true; - } - - private OnFinishListener mOnFinishListener; - - public void setOnFinishListener(OnFinishListener listener) { - mOnFinishListener = listener; - } - - public interface OnFinishListener { - void onFinish(); - } - -} diff --git a/app/src/main/java/onekeyshare/themes/classic/PlatformPageAdapter.java b/app/src/main/java/onekeyshare/themes/classic/PlatformPageAdapter.java deleted file mode 100644 index ca3e3510ab..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/PlatformPageAdapter.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * 官网地站: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 getCellHeight() { - return cellHeight; - } - - 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); - Log.e("TAG", "cellHeight = " + cellHeight); - Log.e("TAG", "panelHeight = " + panelHeight); - 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 < 4; 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 deleted file mode 100644 index 900c08d63b..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/RotateImageView.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 官网地站: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 deleted file mode 100644 index 3afdb54f48..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/XView.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 官网地站: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.Color; -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(Color.WHITE); - 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 deleted file mode 100644 index 8d610b8aa2..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/land/EditPageLand.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * 官网地站: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.graphics.Color; -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(Color.WHITE); - 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(Color.WHITE); - 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 deleted file mode 100644 index 56eb0f84cd..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/land/FriendListPageLand.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 官网地站: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 deleted file mode 100644 index a9157ecd8e..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/land/PlatformPageAdapterLand.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 官网地站: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 deleted file mode 100644 index 013d0e0561..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/land/PlatformPageLand.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 官网地站: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 deleted file mode 100644 index 4eabdb3131..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/port/EditPagePort.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * 官网地站: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.graphics.Color; -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(Color.WHITE); - 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(Color.WHITE); - 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 deleted file mode 100644 index bef0853246..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/port/FriendListPagePort.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 官网地站: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 deleted file mode 100644 index c51bb2e347..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/port/PlatformPageAdapterPort.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 官网地站: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 deleted file mode 100644 index b4e0911bf5..0000000000 --- a/app/src/main/java/onekeyshare/themes/classic/port/PlatformPagePort.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 官网地站: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); - } - -}