├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── libs │ ├── MobCommons-2017.0412.1554.jar │ ├── MobTools-2017.0412.1554.jar │ ├── ShareSDK-Core-2.8.3.jar │ ├── ShareSDK-Email-2.8.3.jar │ ├── ShareSDK-Facebook-2.8.3.jar │ ├── ShareSDK-QQ-2.8.3.jar │ ├── ShareSDK-QZone-2.8.3.jar │ ├── ShareSDK-ShortMessage-2.8.3.jar │ ├── ShareSDK-SinaWeibo-2.8.3.jar │ ├── ShareSDK-TencentWeibo-2.8.3.jar │ ├── ShareSDK-Twitter-2.8.3.jar │ ├── ShareSDK-Wechat-2.8.3.jar │ ├── ShareSDK-Wechat-Core-2.8.3.jar │ ├── ShareSDK-Wechat-Favorite-2.8.3.jar │ └── ShareSDK-Wechat-Moments-2.8.3.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── itheima │ │ └── sharesdkdemo │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── ShareSDK.xml │ ├── java │ │ ├── cn │ │ │ └── sharesdk │ │ │ │ ├── demo │ │ │ │ └── wxapi │ │ │ │ │ └── WXEntryActivity.java │ │ │ │ └── onekeyshare │ │ │ │ ├── CustomerLogo.java │ │ │ │ ├── OnekeyShare.java │ │ │ │ ├── OnekeySharePage.java │ │ │ │ ├── OnekeyShareTheme.java │ │ │ │ ├── OnekeyShareThemeImpl.java │ │ │ │ ├── ShareContentCustomizeCallback.java │ │ │ │ └── themes │ │ │ │ └── classic │ │ │ │ ├── ClassicTheme.java │ │ │ │ ├── EditPage.java │ │ │ │ ├── FriendAdapter.java │ │ │ │ ├── FriendListItem.java │ │ │ │ ├── FriendListPage.java │ │ │ │ ├── IndicatorView.java │ │ │ │ ├── PRTHeader.java │ │ │ │ ├── PicViewerPage.java │ │ │ │ ├── PlatformPage.java │ │ │ │ ├── PlatformPageAdapter.java │ │ │ │ ├── RotateImageView.java │ │ │ │ ├── XView.java │ │ │ │ ├── land │ │ │ │ ├── EditPageLand.java │ │ │ │ ├── FriendListPageLand.java │ │ │ │ ├── PlatformPageAdapterLand.java │ │ │ │ └── PlatformPageLand.java │ │ │ │ └── port │ │ │ │ ├── EditPagePort.java │ │ │ │ ├── FriendListPagePort.java │ │ │ │ ├── PlatformPageAdapterPort.java │ │ │ │ └── PlatformPagePort.java │ │ └── com │ │ │ └── itheima │ │ │ └── sharesdkdemo │ │ │ └── MainActivity.java │ └── res │ │ ├── drawable-hdpi │ │ └── ssdk_oks_ptr_ptr.png │ │ ├── drawable-xhdpi │ │ ├── ssdk_auth_title_back.png │ │ ├── ssdk_back_arr.png │ │ ├── ssdk_logo.png │ │ ├── ssdk_oks_classic_alipay.png │ │ ├── ssdk_oks_classic_alipaymoments.png │ │ ├── ssdk_oks_classic_bluetooth.png │ │ ├── ssdk_oks_classic_check_checked.png │ │ ├── ssdk_oks_classic_check_default.png │ │ ├── ssdk_oks_classic_dingding.png │ │ ├── ssdk_oks_classic_douban.png │ │ ├── ssdk_oks_classic_dropbox.png │ │ ├── ssdk_oks_classic_email.png │ │ ├── ssdk_oks_classic_evernote.png │ │ ├── ssdk_oks_classic_facebook.png │ │ ├── ssdk_oks_classic_facebookmessenger.png │ │ ├── ssdk_oks_classic_flickr.png │ │ ├── ssdk_oks_classic_foursquare.png │ │ ├── ssdk_oks_classic_googleplus.png │ │ ├── ssdk_oks_classic_instagram.png │ │ ├── ssdk_oks_classic_instapaper.png │ │ ├── ssdk_oks_classic_kaixin.png │ │ ├── ssdk_oks_classic_kakaostory.png │ │ ├── ssdk_oks_classic_kakaotalk.png │ │ ├── ssdk_oks_classic_laiwang.png │ │ ├── ssdk_oks_classic_laiwangmoments.png │ │ ├── ssdk_oks_classic_line.png │ │ ├── ssdk_oks_classic_linkedin.png │ │ ├── ssdk_oks_classic_meipai.png │ │ ├── ssdk_oks_classic_mingdao.png │ │ ├── ssdk_oks_classic_pinterest.png │ │ ├── ssdk_oks_classic_pocket.png │ │ ├── ssdk_oks_classic_qq.png │ │ ├── ssdk_oks_classic_qzone.png │ │ ├── ssdk_oks_classic_renren.png │ │ ├── ssdk_oks_classic_shortmessage.png │ │ ├── ssdk_oks_classic_sinaweibo.png │ │ ├── ssdk_oks_classic_tencentweibo.png │ │ ├── ssdk_oks_classic_tumblr.png │ │ ├── ssdk_oks_classic_twitter.png │ │ ├── ssdk_oks_classic_vkontakte.png │ │ ├── ssdk_oks_classic_wechat.png │ │ ├── ssdk_oks_classic_wechatfavorite.png │ │ ├── ssdk_oks_classic_wechatmoments.png │ │ ├── ssdk_oks_classic_whatsapp.png │ │ ├── ssdk_oks_classic_yixin.png │ │ ├── ssdk_oks_classic_yixinmoments.png │ │ ├── ssdk_oks_classic_youdao.png │ │ ├── ssdk_oks_classic_youtube.png │ │ └── ssdk_title_div.png │ │ ├── drawable │ │ ├── ssdk_oks_classic_platform_cell_back.xml │ │ └── ssdk_oks_classic_progressbar.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-en │ │ ├── ssdk_oks_strings.xml │ │ └── ssdk_strings.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── ssdk_instapaper_strings.xml │ │ ├── ssdk_oks_color_drawables.xml │ │ ├── ssdk_oks_strings.xml │ │ ├── ssdk_strings.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── itheima │ └── sharesdkdemo │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ShareSDK的使用 # 2 | [官网](http://www.mob.com) 3 | 4 | [Demo地址](https://github.com/uncleleonfan/ShareSDKDemo) 5 | 6 | 测试QQ号:3409609054 szdhm666 7 | 8 | # 集成步骤 # 9 | 10 | ## 1. 申请AppKey ## 11 | [如何在mod创建应用](http://bbs.mob.com/forum.php?mod=viewthread&tid=8212) 12 | 13 | 测试用AppKey 17a2846dca760 14 | 15 | ## 2. 下载SDK ## 16 | 17 | [下载SDK](http://www.mob.com/#/downloadDetail/ShareSDK/android) 18 | 19 | ## 3. 快速集成 ## 20 | [Android Studio集成](http://bbs.mob.com/forum.php?mod=viewthread&tid=22130) 21 | 22 | 23 | ### 注意 ### 24 | QQ的回调intent,实现QQ的分享必须要添加,并且保证您assets下的sharesdk.xml里配置的QQ的appid与这里的tencent后面的appid保持一致,否则QQ分享是没有回调的,注意替换的时候tencent保留,只替换后面的appid (不需要QQ或者微博可以不配置intent过滤,但是mobuishell这个activity必须要有) 25 | 26 | 33 | 34 | 35 | 36 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | ## 其他 ## 62 | [集成指南](http://wiki.mob.com/Android_%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E6%8C%87%E5%8D%97/) 63 | 64 | [各个社交平台申请流程](http://bbs.mob.com/forum.php?mod=viewthread&tid=30&extra=page%3D1) 65 | 66 | [腾讯开放平台](http://open.qq.com/) 67 | 68 | [微信开发平台](https://open.weixin.qq.com/) -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.itheima.sharesdkdemo" 9 | minSdkVersion 15 10 | targetSdkVersion 25 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:25.3.0' 26 | } 27 | -------------------------------------------------------------------------------- /app/libs/MobCommons-2017.0412.1554.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/MobCommons-2017.0412.1554.jar -------------------------------------------------------------------------------- /app/libs/MobTools-2017.0412.1554.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/MobTools-2017.0412.1554.jar -------------------------------------------------------------------------------- /app/libs/ShareSDK-Core-2.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/ShareSDK-Core-2.8.3.jar -------------------------------------------------------------------------------- /app/libs/ShareSDK-Email-2.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/ShareSDK-Email-2.8.3.jar -------------------------------------------------------------------------------- /app/libs/ShareSDK-Facebook-2.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/ShareSDK-Facebook-2.8.3.jar -------------------------------------------------------------------------------- /app/libs/ShareSDK-QQ-2.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/ShareSDK-QQ-2.8.3.jar -------------------------------------------------------------------------------- /app/libs/ShareSDK-QZone-2.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/ShareSDK-QZone-2.8.3.jar -------------------------------------------------------------------------------- /app/libs/ShareSDK-ShortMessage-2.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/ShareSDK-ShortMessage-2.8.3.jar -------------------------------------------------------------------------------- /app/libs/ShareSDK-SinaWeibo-2.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/ShareSDK-SinaWeibo-2.8.3.jar -------------------------------------------------------------------------------- /app/libs/ShareSDK-TencentWeibo-2.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/ShareSDK-TencentWeibo-2.8.3.jar -------------------------------------------------------------------------------- /app/libs/ShareSDK-Twitter-2.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/ShareSDK-Twitter-2.8.3.jar -------------------------------------------------------------------------------- /app/libs/ShareSDK-Wechat-2.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/ShareSDK-Wechat-2.8.3.jar -------------------------------------------------------------------------------- /app/libs/ShareSDK-Wechat-Core-2.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/ShareSDK-Wechat-Core-2.8.3.jar -------------------------------------------------------------------------------- /app/libs/ShareSDK-Wechat-Favorite-2.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/ShareSDK-Wechat-Favorite-2.8.3.jar -------------------------------------------------------------------------------- /app/libs/ShareSDK-Wechat-Moments-2.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/libs/ShareSDK-Wechat-Moments-2.8.3.jar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\software\AndroidStudio\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/itheima/sharesdkdemo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.itheima.sharesdkdemo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /app/src/main/assets/ShareSDK.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 57 | 58 | 60 | 61 | 62 | 70 | 71 | 78 | 79 | 85 | 86 | 98 | 105 | 106 | 113 | 114 | 120 | 121 | 122 | 129 | 130 | 137 | 138 | 145 | 146 | 153 | 154 | 161 | 162 | 166 | 167 | 171 | 172 | 179 | 180 | 188 | 189 | 199 | 207 | 208 | 215 | 216 | 223 | 224 | 231 | 232 | 237 | 238 | 245 | 246 | 253 | 254 | 261 | 262 | 267 | 268 | 275 | 276 | 288 | 294 | 295 | 301 | 302 | 309 | 310 | 314 | 315 | 320 | 321 | 326 | 327 | 331 | 332 | 336 | 337 | 342 | 343 | 349 | 350 | 355 | 356 | 361 | 362 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/demo/wxapi/WXEntryActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.demo.wxapi; 10 | 11 | import android.content.Intent; 12 | import android.widget.Toast; 13 | import cn.sharesdk.wechat.utils.WXAppExtendObject; 14 | import cn.sharesdk.wechat.utils.WXMediaMessage; 15 | import cn.sharesdk.wechat.utils.WechatHandlerActivity; 16 | 17 | /** 微信客户端回调activity示例 */ 18 | public class WXEntryActivity extends WechatHandlerActivity { 19 | 20 | /** 21 | * 处理微信发出的向第三方应用请求app message 22 | *

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

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

42 | * 本Demo只是将信息展示出来,但你可做点其他的事情,而不仅仅只是Toast 43 | */ 44 | public void onShowMessageFromWXReq(WXMediaMessage msg) { 45 | if (msg != null && msg.mediaObject != null 46 | && (msg.mediaObject instanceof WXAppExtendObject)) { 47 | WXAppExtendObject obj = (WXAppExtendObject) msg.mediaObject; 48 | Toast.makeText(this, obj.extInfo, Toast.LENGTH_SHORT).show(); 49 | } 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/CustomerLogo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare; 10 | 11 | import android.graphics.Bitmap; 12 | import android.view.View.OnClickListener; 13 | 14 | /** 九宫格自定义的图标对象 */ 15 | public class CustomerLogo { 16 | public String label; 17 | public Bitmap logo; 18 | public OnClickListener listener; 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/OnekeyShare.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare; 10 | 11 | import android.content.Context; 12 | import android.graphics.Bitmap; 13 | import android.text.TextUtils; 14 | import android.view.View; 15 | import android.view.View.OnClickListener; 16 | 17 | import com.mob.MobSDK; 18 | import com.mob.tools.utils.BitmapHelper; 19 | import com.mob.tools.utils.ResHelper; 20 | 21 | import java.util.ArrayList; 22 | import java.util.HashMap; 23 | 24 | import cn.sharesdk.framework.Platform; 25 | import cn.sharesdk.framework.PlatformActionListener; 26 | import cn.sharesdk.framework.ShareSDK; 27 | 28 | /** 29 | * 快捷分享的入口 30 | *

31 | * 通过不同的setter设置参数,然后调用{@link #show(Context)}方法启动快捷分享 32 | */ 33 | public class OnekeyShare { 34 | private HashMap params; 35 | 36 | public OnekeyShare() { 37 | params = new HashMap(); 38 | params.put("customers", new ArrayList()); 39 | params.put("hiddenPlatforms", new HashMap()); 40 | } 41 | 42 | /** address是接收人地址,仅在信息和邮件使用,否则可以不提供 */ 43 | public void setAddress(String address) { 44 | params.put("address", address); 45 | } 46 | 47 | /** 48 | * title标题,在印象笔记、邮箱、信息、微信(包括好友、朋友圈和收藏)、 49 | * 易信(包括好友、朋友圈)、人人网和QQ空间使用,否则可以不提供 50 | */ 51 | public void setTitle(String title) { 52 | params.put("title", title); 53 | } 54 | 55 | /** titleUrl是标题的网络链接,仅在人人网和QQ空间使用,否则可以不提供 */ 56 | public void setTitleUrl(String titleUrl) { 57 | params.put("titleUrl", titleUrl); 58 | } 59 | 60 | /** text是分享文本,所有平台都需要这个字段 */ 61 | public void setText(String text) { 62 | params.put("text", text); 63 | } 64 | 65 | /** 获取text字段的值 */ 66 | public String getText() { 67 | return params.containsKey("text") ? String.valueOf(params.get("text")) : null; 68 | } 69 | 70 | /** imagePath是本地的图片路径,除Linked-In外的所有平台都支持这个字段 */ 71 | public void setImagePath(String imagePath) { 72 | if(!TextUtils.isEmpty(imagePath)) { 73 | params.put("imagePath", imagePath); 74 | } 75 | } 76 | 77 | /** imageUrl是图片的网络路径,新浪微博、人人网、QQ空间和Linked-In支持此字段 */ 78 | public void setImageUrl(String imageUrl) { 79 | if (!TextUtils.isEmpty(imageUrl)) { 80 | params.put("imageUrl", imageUrl); 81 | } 82 | } 83 | 84 | /** url在微信(包括好友、朋友圈收藏)和易信(包括好友和朋友圈)中使用,否则可以不提供 */ 85 | public void setUrl(String url) { 86 | params.put("url", url); 87 | } 88 | 89 | /** filePath是待分享应用程序的本地路劲,仅在微信(易信)好友和Dropbox中使用,否则可以不提供 */ 90 | public void setFilePath(String filePath) { 91 | params.put("filePath", filePath); 92 | } 93 | 94 | /** comment是我对这条分享的评论,仅在人人网和QQ空间使用,否则可以不提供 */ 95 | public void setComment(String comment) { 96 | params.put("comment", comment); 97 | } 98 | 99 | /** site是分享此内容的网站名称,仅在QQ空间使用,否则可以不提供 */ 100 | public void setSite(String site) { 101 | params.put("site", site); 102 | } 103 | 104 | /** siteUrl是分享此内容的网站地址,仅在QQ空间使用,否则可以不提供 */ 105 | public void setSiteUrl(String siteUrl) { 106 | params.put("siteUrl", siteUrl); 107 | } 108 | 109 | /** foursquare分享时的地方名 */ 110 | public void setVenueName(String venueName) { 111 | params.put("venueName", venueName); 112 | } 113 | 114 | /** foursquare分享时的地方描述 */ 115 | public void setVenueDescription(String venueDescription) { 116 | params.put("venueDescription", venueDescription); 117 | } 118 | 119 | /** 分享地纬度,新浪微博、腾讯微博和foursquare支持此字段 */ 120 | public void setLatitude(float latitude) { 121 | params.put("latitude", latitude); 122 | } 123 | 124 | /** 分享地经度,新浪微博、腾讯微博和foursquare支持此字段 */ 125 | public void setLongitude(float longitude) { 126 | params.put("longitude", longitude); 127 | } 128 | 129 | /** 是否直接分享 */ 130 | public void setSilent(boolean silent) { 131 | params.put("silent", silent); 132 | } 133 | 134 | /** 设置编辑页的初始化选中平台 */ 135 | public void setPlatform(String platform) { 136 | params.put("platform", platform); 137 | } 138 | 139 | /** 设置KakaoTalk的应用下载地址 */ 140 | public void setInstallUrl(String installurl) { 141 | params.put("installurl", installurl); 142 | } 143 | 144 | /** 设置KakaoTalk的应用打开地址 */ 145 | public void setExecuteUrl(String executeurl) { 146 | params.put("executeurl", executeurl); 147 | } 148 | 149 | /** 设置微信分享的音乐的地址 */ 150 | public void setMusicUrl(String musicUrl) { 151 | params.put("musicUrl", musicUrl); 152 | } 153 | 154 | /** 设置自定义的外部回调 */ 155 | public void setCallback(PlatformActionListener callback) { 156 | params.put("callback", callback); 157 | } 158 | 159 | /** 返回操作回调 */ 160 | public PlatformActionListener getCallback() { 161 | return ResHelper.forceCast(params.get("callback")); 162 | } 163 | 164 | /** 设置用于分享过程中,根据不同平台自定义分享内容的回调 */ 165 | public void setShareContentCustomizeCallback(ShareContentCustomizeCallback callback) { 166 | params.put("customizeCallback", callback); 167 | } 168 | 169 | /** 自定义不同平台分享不同内容的回调 */ 170 | public ShareContentCustomizeCallback getShareContentCustomizeCallback() { 171 | return ResHelper.forceCast(params.get("customizeCallback")); 172 | } 173 | 174 | /** 设置自己图标和点击事件,可以重复调用添加多次 */ 175 | public void setCustomerLogo(Bitmap logo, String label, OnClickListener ocl) { 176 | CustomerLogo cl = new CustomerLogo(); 177 | cl.logo = logo; 178 | cl.label = label; 179 | cl.listener = ocl; 180 | ArrayList customers = ResHelper.forceCast(params.get("customers")); 181 | customers.add(cl); 182 | } 183 | 184 | /** 设置一个总开关,用于在分享前若需要授权,则禁用sso功能 */ 185 | public void disableSSOWhenAuthorize() { 186 | params.put("disableSSO", true); 187 | } 188 | 189 | /** 设置视频网络地址 */ 190 | public void setVideoUrl(String url) { 191 | params.put("url", url); 192 | params.put("shareType", Platform.SHARE_VIDEO); 193 | } 194 | 195 | /** 设置编辑页面的显示模式为Dialog模式 */ 196 | @Deprecated 197 | public void setDialogMode() { 198 | params.put("dialogMode", true); 199 | } 200 | 201 | /** 添加一个隐藏的platform */ 202 | public void addHiddenPlatform(String platform) { 203 | HashMap hiddenPlatforms = ResHelper.forceCast(params.get("hiddenPlatforms")); 204 | hiddenPlatforms.put(platform, platform); 205 | } 206 | 207 | /** 设置一个将被截图分享的View , surfaceView是截不了图片的*/ 208 | public void setViewToShare(View viewToShare) { 209 | try { 210 | Bitmap bm = BitmapHelper.captureView(viewToShare, viewToShare.getWidth(), viewToShare.getHeight()); 211 | params.put("viewToShare", bm); 212 | } catch (Throwable e) { 213 | e.printStackTrace(); 214 | } 215 | } 216 | 217 | /** 腾讯微博分享多张图片 */ 218 | public void setImageArray(String[] imageArray) { 219 | params.put("imageArray", imageArray); 220 | } 221 | 222 | /** 设置在执行分享到QQ或QZone的同时,分享相同的内容腾讯微博 */ 223 | public void setShareToTencentWeiboWhenPerformingQQOrQZoneSharing() { 224 | params.put("isShareTencentWeibo", true); 225 | } 226 | 227 | /** 设置分享界面的样式,目前只有一种,不需要设置 */ 228 | public void setTheme(OnekeyShareTheme theme) { 229 | params.put("theme", theme.getValue()); 230 | } 231 | 232 | @SuppressWarnings("unchecked") 233 | public void show(Context context) { 234 | HashMap shareParamsMap = new HashMap(); 235 | shareParamsMap.putAll(params); 236 | 237 | MobSDK.init(context.getApplicationContext()); 238 | ShareSDK.initSDK(context); 239 | 240 | // 打开分享菜单的统计 241 | ShareSDK.logDemoEvent(1, null); 242 | 243 | int iTheme = 0; 244 | try { 245 | iTheme = ResHelper.parseInt(String.valueOf(shareParamsMap.remove("theme"))); 246 | } catch (Throwable t) {} 247 | OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme); 248 | OnekeyShareThemeImpl themeImpl = theme.getImpl(); 249 | 250 | themeImpl.setShareParamsMap(shareParamsMap); 251 | themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false); 252 | themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false); 253 | themeImpl.setCustomerLogos((ArrayList) shareParamsMap.remove("customers")); 254 | themeImpl.setHiddenPlatforms((HashMap) shareParamsMap.remove("hiddenPlatforms")); 255 | themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback")); 256 | themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback")); 257 | if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) { 258 | themeImpl.disableSSO(); 259 | } 260 | 261 | themeImpl.show(context.getApplicationContext()); 262 | } 263 | 264 | } 265 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/OnekeySharePage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare; 10 | 11 | import java.util.ArrayList; 12 | import java.util.HashMap; 13 | 14 | import cn.sharesdk.framework.Platform; 15 | import cn.sharesdk.framework.Platform.ShareParams; 16 | import cn.sharesdk.framework.PlatformActionListener; 17 | 18 | import com.mob.tools.FakeActivity; 19 | 20 | /** 快捷分享的基类 */ 21 | public class OnekeySharePage extends FakeActivity { 22 | private OnekeyShareThemeImpl impl; 23 | 24 | public OnekeySharePage(OnekeyShareThemeImpl impl) { 25 | this.impl = impl; 26 | } 27 | 28 | /** 分享界面是否弹窗模式 */ 29 | protected final boolean isDialogMode() { 30 | return impl.dialogMode; 31 | } 32 | 33 | protected final HashMap getShareParamsMap() { 34 | return impl.shareParamsMap; 35 | } 36 | 37 | /** 静默分享开关(没有界面,直接分享 )*/ 38 | protected final boolean isSilent() { 39 | return impl.silent; 40 | } 41 | 42 | protected final ArrayList getCustomerLogos() { 43 | return impl.customerLogos; 44 | } 45 | 46 | protected final HashMap getHiddenPlatforms() { 47 | return impl.hiddenPlatforms; 48 | } 49 | 50 | protected final PlatformActionListener getCallback() { 51 | return impl.callback; 52 | } 53 | 54 | protected final ShareContentCustomizeCallback getCustomizeCallback() { 55 | return impl.customizeCallback; 56 | } 57 | 58 | protected final boolean isDisableSSO() { 59 | return impl.disableSSO; 60 | } 61 | 62 | protected final void shareSilently(Platform platform) { 63 | impl.shareSilently(platform); 64 | } 65 | 66 | protected final ShareParams formateShareData(Platform platform) { 67 | if (impl.formateShareData(platform)) { 68 | return impl.shareDataToShareParams(platform); 69 | } 70 | return null; 71 | } 72 | 73 | protected final boolean isUseClientToShare(Platform platform) { 74 | return impl.isUseClientToShare(platform); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/OnekeyShareTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare; 10 | 11 | import cn.sharesdk.onekeyshare.themes.classic.ClassicTheme; 12 | 13 | /** 快捷分享的主题样式 */ 14 | public enum OnekeyShareTheme { 15 | /** 九格宫的主题样式 ,对应的实现类ClassicTheme */ 16 | CLASSIC(0, new ClassicTheme()); 17 | 18 | private final int value; 19 | private final OnekeyShareThemeImpl impl; 20 | 21 | private OnekeyShareTheme(int value, OnekeyShareThemeImpl impl) { 22 | this.value = value; 23 | this.impl = impl; 24 | } 25 | 26 | public int getValue() { 27 | return value; 28 | } 29 | 30 | public OnekeyShareThemeImpl getImpl() { 31 | return impl; 32 | } 33 | 34 | public static OnekeyShareTheme fromValue(int value) { 35 | for (OnekeyShareTheme theme : OnekeyShareTheme.values()) { 36 | if (theme.value == value) { 37 | return theme; 38 | } 39 | } 40 | return CLASSIC; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/OnekeyShareThemeImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare; 10 | 11 | import java.io.File; 12 | import java.io.FileOutputStream; 13 | import java.util.ArrayList; 14 | import java.util.HashMap; 15 | 16 | import android.content.Context; 17 | import android.content.Intent; 18 | import android.content.pm.ResolveInfo; 19 | import android.graphics.Bitmap; 20 | import android.graphics.Bitmap.CompressFormat; 21 | import android.os.Handler.Callback; 22 | import android.os.Message; 23 | import android.text.TextUtils; 24 | import android.widget.Toast; 25 | import cn.sharesdk.framework.CustomPlatform; 26 | import cn.sharesdk.framework.Platform; 27 | import cn.sharesdk.framework.Platform.ShareParams; 28 | import cn.sharesdk.framework.PlatformActionListener; 29 | import cn.sharesdk.framework.ShareSDK; 30 | 31 | import com.mob.tools.utils.ResHelper; 32 | import com.mob.tools.utils.UIHandler; 33 | 34 | /** 快捷分享的主题样式的实现父类 */ 35 | public abstract class OnekeyShareThemeImpl implements PlatformActionListener, Callback { 36 | protected boolean dialogMode; 37 | protected HashMap shareParamsMap; 38 | protected boolean silent; 39 | protected ArrayList customerLogos; 40 | protected HashMap hiddenPlatforms; 41 | protected PlatformActionListener callback; 42 | protected ShareContentCustomizeCallback customizeCallback; 43 | protected boolean disableSSO; 44 | protected Context context; 45 | 46 | public OnekeyShareThemeImpl() { 47 | callback = this; 48 | } 49 | 50 | public final void setDialogMode(boolean dialogMode) { 51 | this.dialogMode = dialogMode; 52 | } 53 | 54 | public final void setShareParamsMap(HashMap shareParamsMap) { 55 | this.shareParamsMap = shareParamsMap; 56 | } 57 | 58 | public final void setSilent(boolean silent) { 59 | this.silent = silent; 60 | } 61 | 62 | public final void setCustomerLogos(ArrayList customerLogos) { 63 | this.customerLogos = customerLogos; 64 | } 65 | 66 | public final void setHiddenPlatforms(HashMap hiddenPlatforms) { 67 | this.hiddenPlatforms = hiddenPlatforms; 68 | } 69 | 70 | public final void setPlatformActionListener(PlatformActionListener callback) { 71 | this.callback = callback == null ? this : callback; 72 | } 73 | 74 | public final void setShareContentCustomizeCallback(ShareContentCustomizeCallback customizeCallback) { 75 | this.customizeCallback = customizeCallback; 76 | } 77 | 78 | public final void disableSSO() { 79 | disableSSO = true; 80 | } 81 | 82 | public final void show(Context context) { 83 | this.context = context; 84 | 85 | // 显示方式是由platform和silent两个字段控制的 86 | // 如果platform设置了,则无须显示九宫格,否则都会显示; 87 | // 如果silent为true,表示不进入编辑页面,否则会进入。 88 | if (shareParamsMap.containsKey("platform")) { 89 | String name = String.valueOf(shareParamsMap.get("platform")); 90 | Platform platform = ShareSDK.getPlatform(name); 91 | boolean isCustomPlatform = platform instanceof CustomPlatform; 92 | boolean isUseClientToShare = isUseClientToShare(platform); 93 | if (silent || isCustomPlatform || isUseClientToShare) { 94 | shareSilently(platform); 95 | } else { 96 | prepareForEditPage(platform); 97 | } 98 | } else { 99 | showPlatformPage(context); 100 | } 101 | } 102 | 103 | /** 判断指定平台是否只能使用客户端分享 */ 104 | final boolean isUseClientToShare(Platform platform) { 105 | String name = platform.getName(); 106 | if ("Wechat".equals(name) || "WechatMoments".equals(name) 107 | || "WechatFavorite".equals(name) || "ShortMessage".equals(name) 108 | || "Email".equals(name) || "Qzone".equals(name) 109 | || "QQ".equals(name) || "Pinterest".equals(name) 110 | || "Instagram".equals(name) || "Yixin".equals(name) 111 | || "YixinMoments".equals(name) || "QZone".equals(name) 112 | || "Mingdao".equals(name) || "Line".equals(name) 113 | || "KakaoStory".equals(name) || "KakaoTalk".equals(name) 114 | || "Bluetooth".equals(name) || "WhatsApp".equals(name) 115 | || "BaiduTieba".equals(name) || "Laiwang".equals(name) 116 | || "LaiwangMoments".equals(name) || "Alipay".equals(name) 117 | || "AlipayMoments".equals(name) || "FacebookMessenger".equals(name) 118 | || "GooglePlus".equals(name) || "Dingding".equals(name) 119 | || "Youtube".equals(name) || "Meipai".equals(name) 120 | ) { 121 | return true; 122 | } else if ("Evernote".equals(name)) { 123 | if ("true".equals(platform.getDevinfo("ShareByAppClient"))) { 124 | return true; 125 | } 126 | } else if ("SinaWeibo".equals(name)) { 127 | if ("true".equals(platform.getDevinfo("ShareByAppClient"))) { 128 | 129 | Intent test = new Intent(Intent.ACTION_SEND); 130 | test.setPackage("com.sina.weibo"); 131 | test.setType("image/*"); 132 | ResolveInfo ri = platform.getContext().getPackageManager().resolveActivity(test, 0); 133 | if(ri == null) { 134 | test = new Intent(Intent.ACTION_SEND); 135 | test.setPackage("com.sina.weibog3"); 136 | test.setType("image/*"); 137 | ri = platform.getContext().getPackageManager().resolveActivity(test, 0); 138 | } 139 | return (ri != null); 140 | } 141 | } 142 | 143 | return false; 144 | } 145 | 146 | final void shareSilently(Platform platform) { 147 | if (formateShareData(platform)) { 148 | ShareParams sp = shareDataToShareParams(platform); 149 | if (sp != null) { 150 | toast("ssdk_oks_sharing"); 151 | if (customizeCallback != null) { 152 | customizeCallback.onShare(platform, sp); 153 | } 154 | if (disableSSO) { 155 | platform.SSOSetting(disableSSO); 156 | } 157 | platform.setPlatformActionListener(callback); 158 | platform.share(sp); 159 | } 160 | } 161 | } 162 | 163 | private void prepareForEditPage(Platform platform) { 164 | if (formateShareData(platform)) { 165 | ShareParams sp = shareDataToShareParams(platform); 166 | if (sp != null) { 167 | // 编辑分享内容的统计 168 | ShareSDK.logDemoEvent(3, null); 169 | if (customizeCallback != null) { 170 | customizeCallback.onShare(platform, sp); 171 | } 172 | showEditPage(context, platform, sp); 173 | } 174 | } 175 | } 176 | 177 | final boolean formateShareData(Platform plat) { 178 | String name = plat.getName(); 179 | 180 | boolean isAlipay = "Alipay".equals(name) || "AlipayMoments".equals(name); 181 | if (isAlipay && !plat.isClientValid()) { 182 | toast("ssdk_alipay_client_inavailable"); 183 | return false; 184 | } 185 | 186 | boolean isKakaoTalk = "KakaoTalk".equals(name); 187 | if (isKakaoTalk && !plat.isClientValid()) { 188 | toast("ssdk_kakaotalk_client_inavailable"); 189 | return false; 190 | } 191 | 192 | boolean isKakaoStory = "KakaoStory".equals(name); 193 | if (isKakaoStory && !plat.isClientValid()) { 194 | toast("ssdk_kakaostory_client_inavailable"); 195 | return false; 196 | } 197 | 198 | boolean isLine = "Line".equals(name); 199 | if (isLine && !plat.isClientValid()) { 200 | toast("ssdk_line_client_inavailable"); 201 | return false; 202 | } 203 | 204 | boolean isWhatsApp = "WhatsApp".equals(name); 205 | if (isWhatsApp && !plat.isClientValid()) { 206 | toast("ssdk_whatsapp_client_inavailable"); 207 | return false; 208 | } 209 | 210 | boolean isPinterest = "Pinterest".equals(name); 211 | if (isPinterest && !plat.isClientValid()) { 212 | toast("ssdk_pinterest_client_inavailable"); 213 | return false; 214 | } 215 | 216 | if ("Instagram".equals(name) && !plat.isClientValid()) { 217 | toast("ssdk_instagram_client_inavailable"); 218 | return false; 219 | } 220 | 221 | if ("QZone".equals(name) && !plat.isClientValid()) { 222 | toast("ssdk_qq_client_inavailable"); 223 | return false; 224 | } 225 | 226 | boolean isLaiwang = "Laiwang".equals(name); 227 | boolean isLaiwangMoments = "LaiwangMoments".equals(name); 228 | if(isLaiwang || isLaiwangMoments){ 229 | if (!plat.isClientValid()) { 230 | toast("ssdk_laiwang_client_inavailable"); 231 | return false; 232 | } 233 | } 234 | 235 | boolean isYixin = "YixinMoments".equals(name) || "Yixin".equals(name); 236 | if (isYixin && !plat.isClientValid()) { 237 | toast("ssdk_yixin_client_inavailable"); 238 | return false; 239 | } 240 | 241 | boolean isWechat = "WechatFavorite".equals(name) || "Wechat".equals(name) || "WechatMoments".equals(name); 242 | if (isWechat && !plat.isClientValid()) { 243 | toast("ssdk_wechat_client_inavailable"); 244 | return false; 245 | } 246 | 247 | if ("FacebookMessenger".equals(name) && !plat.isClientValid()) { 248 | toast("ssdk_facebookmessenger_client_inavailable"); 249 | return false; 250 | } 251 | 252 | if (!shareParamsMap.containsKey("shareType")) { 253 | int shareType = Platform.SHARE_TEXT; 254 | String imagePath = String.valueOf(shareParamsMap.get("imagePath")); 255 | if (imagePath != null && (new File(imagePath)).exists()) { 256 | shareType = Platform.SHARE_IMAGE; 257 | if (imagePath.endsWith(".gif") && isWechat) { 258 | shareType = Platform.SHARE_EMOJI; 259 | } else if (shareParamsMap.containsKey("url") && !TextUtils.isEmpty(shareParamsMap.get("url").toString())) { 260 | shareType = Platform.SHARE_WEBPAGE; 261 | if (shareParamsMap.containsKey("musicUrl") && !TextUtils.isEmpty(shareParamsMap.get("musicUrl").toString()) && isWechat) { 262 | shareType = Platform.SHARE_MUSIC; 263 | } 264 | } 265 | } else { 266 | Bitmap viewToShare = ResHelper.forceCast(shareParamsMap.get("viewToShare")); 267 | if (viewToShare != null && !viewToShare.isRecycled()) { 268 | shareType = Platform.SHARE_IMAGE; 269 | if (shareParamsMap.containsKey("url") && !TextUtils.isEmpty(shareParamsMap.get("url").toString())) { 270 | shareType = Platform.SHARE_WEBPAGE; 271 | if (shareParamsMap.containsKey("musicUrl") && !TextUtils.isEmpty(shareParamsMap.get("musicUrl").toString()) && isWechat) { 272 | shareType = Platform.SHARE_MUSIC; 273 | } 274 | } 275 | } else { 276 | Object imageUrl = shareParamsMap.get("imageUrl"); 277 | if (imageUrl != null && !TextUtils.isEmpty(String.valueOf(imageUrl))) { 278 | shareType = Platform.SHARE_IMAGE; 279 | if (String.valueOf(imageUrl).endsWith(".gif") && isWechat) { 280 | shareType = Platform.SHARE_EMOJI; 281 | } else if (shareParamsMap.containsKey("url") && !TextUtils.isEmpty(shareParamsMap.get("url").toString())) { 282 | shareType = Platform.SHARE_WEBPAGE; 283 | if (shareParamsMap.containsKey("musicUrl") && !TextUtils.isEmpty(shareParamsMap.get("musicUrl").toString()) && isWechat) { 284 | shareType = Platform.SHARE_MUSIC; 285 | } 286 | } 287 | } 288 | } 289 | } 290 | shareParamsMap.put("shareType", shareType); 291 | } 292 | 293 | return true; 294 | } 295 | 296 | final ShareParams shareDataToShareParams(Platform plat) { 297 | if (plat == null || shareParamsMap == null) { 298 | toast("ssdk_oks_share_failed"); 299 | return null; 300 | } 301 | 302 | try { 303 | String imagePath = ResHelper.forceCast(shareParamsMap.get("imagePath")); 304 | Bitmap viewToShare = ResHelper.forceCast(shareParamsMap.get("viewToShare")); 305 | if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) { 306 | String path = ResHelper.getCachePath(plat.getContext(), "screenshot"); 307 | File ss = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg"); 308 | FileOutputStream fos = new FileOutputStream(ss); 309 | viewToShare.compress(CompressFormat.JPEG, 100, fos); 310 | fos.flush(); 311 | fos.close(); 312 | shareParamsMap.put("imagePath", ss.getAbsolutePath()); 313 | } 314 | } catch (Throwable t) { 315 | t.printStackTrace(); 316 | toast("ssdk_oks_share_failed"); 317 | return null; 318 | } 319 | 320 | return new ShareParams(shareParamsMap); 321 | } 322 | 323 | private void toast(final String resOrName) { 324 | UIHandler.sendEmptyMessage(0, new Callback() { 325 | public boolean handleMessage(Message msg) { 326 | int resId = ResHelper.getStringRes(context, resOrName); 327 | if (resId > 0) { 328 | Toast.makeText(context, resId, Toast.LENGTH_SHORT).show(); 329 | } else { 330 | Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show(); 331 | } 332 | return false; 333 | } 334 | }); 335 | } 336 | 337 | protected abstract void showPlatformPage(Context context); 338 | 339 | protected abstract void showEditPage(Context context, Platform platform, ShareParams sp); 340 | 341 | public final void onComplete(Platform platform, int action, 342 | HashMap res) { 343 | Message msg = new Message(); 344 | msg.arg1 = 1; 345 | msg.arg2 = action; 346 | msg.obj = platform; 347 | UIHandler.sendMessage(msg, this); 348 | } 349 | 350 | public final void onError(Platform platform, int action, Throwable t) { 351 | t.printStackTrace(); 352 | 353 | Message msg = new Message(); 354 | msg.arg1 = 2; 355 | msg.arg2 = action; 356 | msg.obj = t; 357 | UIHandler.sendMessage(msg, this); 358 | 359 | // 分享失败的统计 360 | ShareSDK.logDemoEvent(4, platform); 361 | } 362 | 363 | public final void onCancel(Platform platform, int action) { 364 | Message msg = new Message(); 365 | msg.arg1 = 3; 366 | msg.arg2 = action; 367 | msg.obj = platform; 368 | UIHandler.sendMessage(msg, this); 369 | 370 | // 分享失败的统计 371 | ShareSDK.logDemoEvent(5, platform); 372 | } 373 | 374 | public final boolean handleMessage(Message msg) { 375 | switch (msg.arg1) { 376 | case 1: { 377 | // 成功 378 | int resId = ResHelper.getStringRes(context, "ssdk_oks_share_completed"); 379 | if (resId > 0) { 380 | toast(context.getString(resId)); 381 | } 382 | } break; 383 | case 2: { 384 | // 失败 385 | String expName = msg.obj.getClass().getSimpleName(); 386 | if ("WechatClientNotExistException".equals(expName) 387 | || "WechatTimelineNotSupportedException".equals(expName) 388 | || "WechatFavoriteNotSupportedException".equals(expName)) { 389 | toast("ssdk_wechat_client_inavailable"); 390 | } else if ("GooglePlusClientNotExistException".equals(expName)) { 391 | toast("ssdk_google_plus_client_inavailable"); 392 | } else if ("QQClientNotExistException".equals(expName)) { 393 | toast("ssdk_qq_client_inavailable"); 394 | } else if ("YixinClientNotExistException".equals(expName) 395 | || "YixinTimelineNotSupportedException".equals(expName)) { 396 | toast("ssdk_yixin_client_inavailable"); 397 | } else if ("KakaoTalkClientNotExistException".equals(expName)) { 398 | toast("ssdk_kakaotalk_client_inavailable"); 399 | } else if ("KakaoStoryClientNotExistException".equals(expName)) { 400 | toast("ssdk_kakaostory_client_inavailable"); 401 | } else if("WhatsAppClientNotExistException".equals(expName)){ 402 | toast("ssdk_whatsapp_client_inavailable"); 403 | } else if("FacebookMessengerClientNotExistException".equals(expName)){ 404 | toast("ssdk_facebookmessenger_client_inavailable"); 405 | } else { 406 | toast("ssdk_oks_share_failed"); 407 | } 408 | } break; 409 | case 3: { 410 | // 取消 411 | toast("ssdk_oks_share_canceled"); 412 | } break; 413 | } 414 | return false; 415 | } 416 | 417 | } 418 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/ShareContentCustomizeCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare; 10 | 11 | import cn.sharesdk.framework.Platform; 12 | import cn.sharesdk.framework.Platform.ShareParams; 13 | 14 | /** 自定义不同平台分享不同内容的接口 */ 15 | public interface ShareContentCustomizeCallback { 16 | 17 | public void onShare(Platform platform, ShareParams paramsToShare); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/ClassicTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic; 10 | 11 | import android.content.Context; 12 | import android.content.res.Configuration; 13 | import cn.sharesdk.framework.Platform; 14 | import cn.sharesdk.framework.Platform.ShareParams; 15 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl; 16 | import cn.sharesdk.onekeyshare.themes.classic.land.EditPageLand; 17 | import cn.sharesdk.onekeyshare.themes.classic.land.PlatformPageLand; 18 | import cn.sharesdk.onekeyshare.themes.classic.port.EditPagePort; 19 | import cn.sharesdk.onekeyshare.themes.classic.port.PlatformPagePort; 20 | 21 | /** 九宫格经典主题样式的实现类*/ 22 | public class ClassicTheme extends OnekeyShareThemeImpl { 23 | 24 | /** 展示平台列表*/ 25 | protected void showPlatformPage(Context context) { 26 | PlatformPage page; 27 | int orientation = context.getResources().getConfiguration().orientation; 28 | if (orientation == Configuration.ORIENTATION_PORTRAIT) { 29 | page = new PlatformPagePort(this); 30 | } else { 31 | page = new PlatformPageLand(this); 32 | } 33 | page.show(context, null); 34 | } 35 | 36 | /** 展示编辑界面*/ 37 | protected void showEditPage(Context context, Platform platform, ShareParams sp) { 38 | EditPage page; 39 | int orientation = context.getResources().getConfiguration().orientation; 40 | if (orientation == Configuration.ORIENTATION_PORTRAIT) { 41 | page = new EditPagePort(this); 42 | } else { 43 | page = new EditPageLand(this); 44 | } 45 | page.setPlatform(platform); 46 | page.setShareParams(sp); 47 | page.show(context, null); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/EditPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic; 10 | 11 | import java.util.ArrayList; 12 | import java.util.HashMap; 13 | 14 | import android.app.Activity; 15 | import android.content.res.Configuration; 16 | import android.graphics.Bitmap; 17 | import android.graphics.drawable.ColorDrawable; 18 | import android.text.Editable; 19 | import android.text.TextUtils; 20 | import android.text.TextWatcher; 21 | import android.view.View; 22 | import android.view.View.OnClickListener; 23 | import android.view.ViewGroup.LayoutParams; 24 | import android.view.WindowManager; 25 | import android.widget.EditText; 26 | import android.widget.LinearLayout; 27 | import android.widget.RelativeLayout; 28 | import android.widget.ScrollView; 29 | import android.widget.TextView; 30 | import android.widget.Toast; 31 | import cn.sharesdk.framework.Platform; 32 | import cn.sharesdk.framework.Platform.ShareParams; 33 | import cn.sharesdk.framework.ShareSDK; 34 | import cn.sharesdk.onekeyshare.OnekeySharePage; 35 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl; 36 | import cn.sharesdk.onekeyshare.themes.classic.land.FriendListPageLand; 37 | import cn.sharesdk.onekeyshare.themes.classic.port.FriendListPagePort; 38 | 39 | import com.mob.tools.gui.AsyncImageView; 40 | import com.mob.tools.utils.DeviceHelper; 41 | import com.mob.tools.utils.ResHelper; 42 | 43 | public class EditPage extends OnekeySharePage implements OnClickListener, TextWatcher, Runnable { 44 | private OnekeyShareThemeImpl impl; 45 | protected Platform platform; 46 | protected ShareParams sp; 47 | 48 | protected LinearLayout llPage; 49 | protected RelativeLayout rlTitle; 50 | protected ScrollView svContent; 51 | protected EditText etContent; 52 | protected TextView tvCancel; 53 | protected TextView tvShare; 54 | protected RelativeLayout rlThumb; 55 | /** 异步加载图片的控件 */ 56 | protected AsyncImageView aivThumb; 57 | protected XView xvRemove; 58 | protected LinearLayout llBottom; 59 | protected TextView tvAt; 60 | protected TextView tvTextCouter; 61 | 62 | protected Bitmap thumb; 63 | protected int maxBodyHeight; 64 | 65 | public EditPage(OnekeyShareThemeImpl impl) { 66 | super(impl); 67 | this.impl = impl; 68 | } 69 | 70 | public void setPlatform(Platform platform) { 71 | this.platform = platform; 72 | } 73 | 74 | public void setShareParams(ShareParams sp) { 75 | this.sp = sp; 76 | } 77 | 78 | public void setActivity(Activity activity) { 79 | super.setActivity(activity); 80 | if (isDialogMode()) { 81 | // activity.setTheme(android.R.style.Theme_Dialog); 82 | // activity.requestWindowFeature(Window.FEATURE_NO_TITLE); 83 | // if (Build.VERSION.SDK_INT >= 11) { 84 | // try { 85 | // ReflectHelper.invokeInstanceMethod(activity, "setFinishOnTouchOutside", false); 86 | // } catch (Throwable e) {} 87 | // } 88 | } 89 | 90 | activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE 91 | | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); 92 | } 93 | 94 | public void onCreate() { 95 | activity.getWindow().setBackgroundDrawable(new ColorDrawable(0xfff3f3f3)); 96 | } 97 | 98 | /** 取消分享时,执行的方法 */ 99 | private void cancelAndFinish() { 100 | // 分享失败的统计 101 | ShareSDK.logDemoEvent(5, platform); 102 | finish(); 103 | } 104 | 105 | /** 执行分享时的方法 */ 106 | private void shareAndFinish() { 107 | int resId = ResHelper.getStringRes(activity, "ssdk_oks_sharing"); 108 | if (resId > 0) { 109 | Toast.makeText(activity, resId, Toast.LENGTH_SHORT).show(); 110 | } 111 | 112 | if (isDisableSSO()) { 113 | platform.SSOSetting(true); 114 | } 115 | platform.setPlatformActionListener(getCallback()); 116 | platform.share(sp); 117 | 118 | finish(); 119 | } 120 | 121 | /** 编辑界面,显示的图片 */ 122 | private void showThumb(Bitmap pic) { 123 | PicViewerPage page = new PicViewerPage(impl); 124 | page.setImageBitmap(pic); 125 | page.show(activity, null); 126 | } 127 | 128 | private void removeThumb() { 129 | sp.setImageArray(null); 130 | sp.setImageData(null); 131 | sp.setImagePath(null); 132 | sp.setImageUrl(null); 133 | } 134 | 135 | /** @ 好友时,展示的好友列表 */ 136 | private void showFriendList() { 137 | FriendListPage page; 138 | int orientation = activity.getResources().getConfiguration().orientation; 139 | if (orientation == Configuration.ORIENTATION_PORTRAIT) { 140 | page = new FriendListPagePort(impl); 141 | } else { 142 | page = new FriendListPageLand(impl); 143 | } 144 | page.setPlatform(platform); 145 | page.showForResult(platform.getContext(), null, this); 146 | } 147 | 148 | public void onResult(HashMap data) { 149 | String atText = getJoinSelectedUser(data); 150 | if(!TextUtils.isEmpty(atText)) { 151 | etContent.append(atText); 152 | } 153 | } 154 | 155 | private String getJoinSelectedUser(HashMap data) { 156 | if (data != null && data.containsKey("selected")) { 157 | @SuppressWarnings("unchecked") 158 | ArrayList selected = (ArrayList) data.get("selected"); 159 | String platform = ((Platform)data.get("platform")).getName(); 160 | if("FacebookMessenger".equals(platform)) { 161 | return null; 162 | } 163 | StringBuilder sb = new StringBuilder(); 164 | for (String sel : selected) { 165 | sb.append('@').append(sel).append(' '); 166 | } 167 | return sb.toString(); 168 | } 169 | return null; 170 | } 171 | 172 | protected boolean isShowAtUserLayout(String platformName) { 173 | return "SinaWeibo".equals(platformName) 174 | || "TencentWeibo".equals(platformName) 175 | || "Facebook".equals(platformName) 176 | || "Twitter".equals(platformName); 177 | } 178 | 179 | public void onClick(View v) { 180 | if (v.equals(tvCancel)) { 181 | cancelAndFinish(); 182 | } else if (v.equals(tvShare)) { 183 | sp.setText(etContent.getText().toString().trim()); 184 | shareAndFinish(); 185 | } else if (v.equals(aivThumb)) { 186 | showThumb(thumb); 187 | } else if (v.equals(xvRemove)) { 188 | maxBodyHeight = 0; 189 | rlThumb.setVisibility(View.GONE); 190 | llPage.measure(0, 0); 191 | onTextChanged(etContent.getText(), 0, 0, 0); 192 | removeThumb(); 193 | } else if (v.equals(tvAt)) { 194 | showFriendList(); 195 | } 196 | } 197 | 198 | public void onTextChanged(CharSequence s, int start, int before, int count) { 199 | tvTextCouter.setText(String.valueOf(s.length())); 200 | 201 | if (maxBodyHeight == 0) { 202 | maxBodyHeight = llPage.getHeight() - rlTitle.getHeight() - llBottom.getHeight(); 203 | } 204 | 205 | if (maxBodyHeight > 0) { 206 | svContent.post(this); 207 | } 208 | } 209 | 210 | /** 动态适配编辑界面的高度 */ 211 | public void run() { 212 | int height = svContent.getChildAt(0).getHeight(); 213 | RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams()); 214 | if (height > maxBodyHeight && lp.height != maxBodyHeight) { 215 | lp.height = maxBodyHeight; 216 | svContent.setLayoutParams(lp); 217 | } else if (height < maxBodyHeight && lp.height == maxBodyHeight) { 218 | lp.height = LayoutParams.WRAP_CONTENT; 219 | svContent.setLayoutParams(lp); 220 | } 221 | } 222 | 223 | public void afterTextChanged(Editable s) { 224 | 225 | } 226 | 227 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { 228 | 229 | } 230 | 231 | public void onPause() { 232 | DeviceHelper.getInstance(activity).hideSoftInput(getContentView()); 233 | super.onPause(); 234 | } 235 | 236 | } 237 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/FriendAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic; 10 | 11 | import java.util.ArrayList; 12 | import java.util.HashMap; 13 | 14 | import android.graphics.drawable.ColorDrawable; 15 | import android.os.Handler.Callback; 16 | import android.os.Message; 17 | import android.view.View; 18 | import android.view.ViewGroup; 19 | import android.widget.AdapterView.OnItemClickListener; 20 | import android.widget.LinearLayout; 21 | import cn.sharesdk.framework.Platform; 22 | import cn.sharesdk.framework.PlatformActionListener; 23 | 24 | import com.mob.tools.gui.PullToRequestListAdapter; 25 | import com.mob.tools.gui.PullToRequestView; 26 | import com.mob.tools.utils.UIHandler; 27 | 28 | /** 好友列表的适配器 */ 29 | public class FriendAdapter extends PullToRequestListAdapter implements PlatformActionListener { 30 | private FriendListPage activity; 31 | private boolean hasNext; 32 | private Platform platform; 33 | /** 请求好友列表时,每页15个 */ 34 | private final int pageCount = 15; 35 | /** 当前的好友列表是第几页 */ 36 | private int curPage; 37 | /** 好友列表数据 */ 38 | private ArrayList follows; 39 | /** 判断当前的好友列表数据与请求的新数据是否有重复 */ 40 | private HashMap map; 41 | /** 好友列表的头部View */ 42 | private PRTHeader llHeader; 43 | /** 根据设计,按照比例来布局,以此来适配所有手机 */ 44 | private float ratio; 45 | 46 | public FriendAdapter(FriendListPage activity, PullToRequestView view) { 47 | super(view); 48 | this.activity = activity; 49 | 50 | curPage = -1; 51 | hasNext = true; 52 | map = new HashMap(); 53 | follows = new ArrayList(); 54 | 55 | getListView().setDivider(new ColorDrawable(0xffeaeaea)); 56 | } 57 | 58 | public void setRatio(float ratio) { 59 | this.ratio = ratio; 60 | getListView().setDividerHeight((int) (ratio < 1 ? 1 : ratio)); 61 | } 62 | 63 | public void setOnItemClickListener(OnItemClickListener listener) { 64 | getListView().setOnItemClickListener(listener); 65 | } 66 | 67 | public void setPlatform(Platform platform) { 68 | this.platform = platform; 69 | platform.setPlatformActionListener(this); 70 | } 71 | 72 | private void next() { 73 | if (hasNext) { 74 | platform.listFriend(pageCount, curPage + 1, null); 75 | } 76 | } 77 | 78 | public void onComplete(Platform plat, int action, HashMap res) { 79 | final FollowersResult followersResult = parseFollowers(platform.getName(), res, map); 80 | if (followersResult == null) { 81 | UIHandler.sendEmptyMessage(0, new Callback() { 82 | public boolean handleMessage(Message msg) { 83 | notifyDataSetChanged(); 84 | return false; 85 | } 86 | }); 87 | return; 88 | } 89 | 90 | hasNext = followersResult.hasNextPage; 91 | if (followersResult.list != null && followersResult.list.size() > 0) { 92 | curPage++; 93 | Message msg = new Message(); 94 | msg.what = 1; 95 | msg.obj = followersResult.list; 96 | UIHandler.sendMessage(msg, new Callback() { 97 | public boolean handleMessage(Message msg) { 98 | if (curPage <= 0) { 99 | follows.clear(); 100 | } 101 | follows.addAll(followersResult.list); 102 | notifyDataSetChanged(); 103 | return false; 104 | } 105 | }); 106 | } 107 | } 108 | 109 | private FollowersResult parseFollowers(String platform, HashMap res, HashMap uidMap) { 110 | if (res == null || res.size() <= 0) { 111 | return null; 112 | } 113 | 114 | boolean hasNext = false; 115 | ArrayList data = new ArrayList(); 116 | if ("SinaWeibo".equals(platform)) { 117 | // users[id, name, description] 118 | @SuppressWarnings("unchecked") 119 | ArrayList> users = (ArrayList>) res.get("users"); 120 | for (HashMap user : users) { 121 | String uid = String.valueOf(user.get("id")); 122 | if (!uidMap.containsKey(uid)) { 123 | Following following = new Following(); 124 | following.uid = uid; 125 | following.screenName = String.valueOf(user.get("name")); 126 | following.description = String.valueOf(user.get("description")); 127 | following.icon = String.valueOf(user.get("profile_image_url")); 128 | following.atName = following.screenName; 129 | uidMap.put(following.uid, true); 130 | data.add(following); 131 | } 132 | } 133 | hasNext = (Integer) res.get("total_number") > uidMap.size(); 134 | } else if ("TencentWeibo".equals(platform)) { 135 | hasNext = ((Integer)res.get("hasnext") == 0); 136 | // info[nick, name, tweet[text]] 137 | @SuppressWarnings("unchecked") 138 | ArrayList> infos = (ArrayList>) res.get("info"); 139 | for (HashMap info : infos) { 140 | String uid = String.valueOf(info.get("name")); 141 | if (!uidMap.containsKey(uid)) { 142 | Following following = new Following(); 143 | following.screenName = String.valueOf(info.get("nick")); 144 | following.uid = uid; 145 | following.atName = uid; 146 | @SuppressWarnings("unchecked") 147 | ArrayList> tweets = (ArrayList>) info.get("tweet"); 148 | for (HashMap tweet : tweets) { 149 | following.description = String.valueOf(tweet.get("text")); 150 | break; 151 | } 152 | following.icon = String.valueOf(info.get("head")) + "/100"; 153 | uidMap.put(following.uid, true); 154 | data.add(following); 155 | } 156 | } 157 | } else if ("Facebook".equals(platform)) { 158 | // data[id, name] 159 | @SuppressWarnings("unchecked") 160 | ArrayList> datas = (ArrayList>) res.get("data"); 161 | for (HashMap d : datas) { 162 | String uid = String.valueOf(d.get("id")); 163 | if (!uidMap.containsKey(uid)) { 164 | Following following = new Following(); 165 | following.uid = uid; 166 | following.atName = "[" + uid + "]"; 167 | following.screenName = String.valueOf(d.get("name")); 168 | @SuppressWarnings("unchecked") 169 | HashMap picture = (HashMap) d.get("picture"); 170 | if (picture != null) { 171 | @SuppressWarnings("unchecked") 172 | HashMap pData = (HashMap) picture.get("data"); 173 | following.icon = String.valueOf(pData.get("url")); 174 | } 175 | uidMap.put(following.uid, true); 176 | data.add(following); 177 | } 178 | } 179 | @SuppressWarnings("unchecked") 180 | HashMap paging = (HashMap) res.get("paging"); 181 | hasNext = paging.containsKey("next"); 182 | } else if ("Twitter".equals(platform)) { 183 | // users[screen_name, name, description] 184 | @SuppressWarnings("unchecked") 185 | ArrayList> users = (ArrayList>) res.get("users"); 186 | for (HashMap user : users) { 187 | String uid = String.valueOf(user.get("screen_name")); 188 | if (!uidMap.containsKey(uid)) { 189 | Following following = new Following(); 190 | following.uid = uid; 191 | following.atName = uid; 192 | following.screenName = String.valueOf(user.get("name")); 193 | following.description = String.valueOf(user.get("description")); 194 | following.icon = String.valueOf(user.get("profile_image_url")); 195 | uidMap.put(following.uid, true); 196 | data.add(following); 197 | } 198 | } 199 | } 200 | 201 | FollowersResult ret = new FollowersResult(); 202 | ret.list = data; 203 | ret.hasNextPage = hasNext; 204 | return ret; 205 | } 206 | 207 | public void onError(Platform plat, int action, Throwable t) { 208 | t.printStackTrace(); 209 | } 210 | 211 | public void onCancel(Platform plat, int action) { 212 | UIHandler.sendEmptyMessage(0, new Callback() { 213 | public boolean handleMessage(Message msg) { 214 | activity.finish(); 215 | return false; 216 | } 217 | }); 218 | } 219 | 220 | public Following getItem(int position) { 221 | return follows.get(position); 222 | } 223 | 224 | public long getItemId(int position) { 225 | return position; 226 | } 227 | 228 | public int getCount() { 229 | return follows == null ? 0 : follows.size(); 230 | } 231 | 232 | public View getHeaderView() { 233 | if (llHeader == null) { 234 | llHeader = new PRTHeader(getContext()); 235 | } 236 | return llHeader; 237 | } 238 | 239 | public void onPullDown(int percent) { 240 | llHeader.onPullDown(percent); 241 | } 242 | 243 | public void onRefresh() { 244 | llHeader.onRequest(); 245 | curPage = -1; 246 | hasNext = true; 247 | map.clear(); 248 | next(); 249 | } 250 | 251 | public void onReversed() { 252 | llHeader.reverse(); 253 | } 254 | 255 | public View getView(int position, View convertView, ViewGroup parent) { 256 | if (convertView == null) { 257 | FriendListItem llItem = new FriendListItem(parent.getContext(), ratio); 258 | convertView = llItem; 259 | } 260 | FriendListItem llItem = (FriendListItem) convertView; 261 | llItem.update(getItem(position), isFling()); 262 | 263 | if (position == getCount() - 1) { 264 | next(); 265 | } 266 | return convertView; 267 | } 268 | 269 | public static class Following { 270 | public boolean checked; 271 | public String screenName; 272 | public String description; 273 | public String uid; 274 | public String icon; 275 | //@Name 用于微博等提示或关联某个人 276 | public String atName; 277 | } 278 | 279 | private static class FollowersResult { 280 | public ArrayList list; 281 | public boolean hasNextPage = false; 282 | } 283 | 284 | public View getFooterView() { 285 | LinearLayout footerView = new LinearLayout(getContext()); 286 | footerView.setMinimumHeight(10); 287 | return footerView; 288 | } 289 | 290 | } 291 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/FriendListItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic; 10 | 11 | import android.content.Context; 12 | import android.graphics.Bitmap; 13 | import android.graphics.BitmapFactory; 14 | import android.util.TypedValue; 15 | import android.view.Gravity; 16 | import android.widget.ImageView; 17 | import android.widget.LinearLayout; 18 | import android.widget.TextView; 19 | import cn.sharesdk.onekeyshare.themes.classic.FriendAdapter.Following; 20 | 21 | import com.mob.tools.gui.AsyncImageView; 22 | import com.mob.tools.gui.BitmapProcessor; 23 | import com.mob.tools.utils.ResHelper; 24 | 25 | /** 好友列表的item */ 26 | public class FriendListItem extends LinearLayout { 27 | private static final int DESIGN_AVATAR_WIDTH = 64; 28 | private static final int DESIGN_AVATAR_PADDING = 24; 29 | private static final int DESIGN_ITEM_HEIGHT = 96; 30 | private static final int DESIGN_ITEM_PADDING = 20; 31 | 32 | private ImageView ivCheck; 33 | private AsyncImageView aivIcon; 34 | private TextView tvName; 35 | /** 好友列表中,被选中的checkbox图标 */ 36 | private Bitmap bmChd; 37 | /** 好友列表中,没选中的checkbox图标 */ 38 | private Bitmap bmUnch; 39 | 40 | public FriendListItem(Context context, float ratio) { 41 | super(context); 42 | int itemPadding = (int) (ratio * DESIGN_ITEM_PADDING); 43 | setPadding(itemPadding, 0, itemPadding, 0); 44 | setMinimumHeight((int) (ratio * DESIGN_ITEM_HEIGHT)); 45 | setBackgroundColor(0xffffffff); 46 | 47 | ivCheck = new ImageView(context); 48 | LayoutParams lp = new LayoutParams( 49 | LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); 50 | lp.gravity = Gravity.CENTER_VERTICAL; 51 | addView(ivCheck, lp); 52 | 53 | aivIcon = new AsyncImageView(context); 54 | int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); 55 | lp = new LayoutParams(avatarWidth, avatarWidth); 56 | lp.gravity = Gravity.CENTER_VERTICAL; 57 | int avatarMargin = (int) (ratio * DESIGN_AVATAR_PADDING); 58 | lp.setMargins(avatarMargin, 0, avatarMargin, 0); 59 | addView(aivIcon, lp); 60 | 61 | tvName = new TextView(context); 62 | tvName.setTextColor(0xff000000); 63 | tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); 64 | tvName.setSingleLine(); 65 | lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); 66 | lp.gravity = Gravity.CENTER_VERTICAL; 67 | lp.weight = 1; 68 | addView(tvName, lp); 69 | 70 | int resId = ResHelper.getBitmapRes(context, "ssdk_oks_classic_check_checked"); 71 | if (resId > 0) { 72 | bmChd = BitmapFactory.decodeResource(context.getResources(), resId); 73 | } 74 | resId = ResHelper.getBitmapRes(getContext(), "ssdk_oks_classic_check_default"); 75 | if (resId > 0) { 76 | bmUnch = BitmapFactory.decodeResource(context.getResources(), resId); 77 | } 78 | } 79 | 80 | public void update(Following following, boolean fling) { 81 | tvName.setText(following.screenName); 82 | ivCheck.setImageBitmap(following.checked ? bmChd : bmUnch); 83 | if (aivIcon != null) { 84 | if (fling) { 85 | Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon); 86 | if (bm != null && !bm.isRecycled()) { 87 | aivIcon.setImageBitmap(bm); 88 | } else { 89 | aivIcon.execute(null, 0); 90 | } 91 | } else { 92 | aivIcon.execute(following.icon, 0); 93 | } 94 | } 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/FriendListPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic; 10 | 11 | import java.util.ArrayList; 12 | import java.util.HashMap; 13 | 14 | import android.graphics.drawable.ColorDrawable; 15 | import android.util.TypedValue; 16 | import android.view.Gravity; 17 | import android.view.View; 18 | import android.view.View.OnClickListener; 19 | import android.view.ViewGroup.LayoutParams; 20 | import android.widget.AdapterView; 21 | import android.widget.AdapterView.OnItemClickListener; 22 | import android.widget.FrameLayout; 23 | import android.widget.LinearLayout; 24 | import android.widget.RelativeLayout; 25 | import android.widget.TextView; 26 | import cn.sharesdk.framework.Platform; 27 | import cn.sharesdk.onekeyshare.OnekeySharePage; 28 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl; 29 | import cn.sharesdk.onekeyshare.themes.classic.FriendAdapter.Following; 30 | 31 | import com.mob.tools.gui.PullToRequestView; 32 | import com.mob.tools.utils.ResHelper; 33 | 34 | /** 编辑界面,@好友时,弹出的好友列表 */ 35 | public abstract class FriendListPage extends OnekeySharePage implements OnClickListener, OnItemClickListener { 36 | private static final int DESIGN_LEFT_PADDING = 40; 37 | 38 | private Platform platform; 39 | private LinearLayout llPage; 40 | private RelativeLayout rlTitle; 41 | private TextView tvCancel; 42 | private TextView tvConfirm; 43 | private FriendAdapter adapter; 44 | private int lastPosition = -1; 45 | /** 展示好友列表时,已选择要‘@’的好友个数 */ 46 | private int checkNum = 0; 47 | 48 | public FriendListPage(OnekeyShareThemeImpl impl) { 49 | super(impl); 50 | } 51 | 52 | public void setPlatform(Platform platform) { 53 | this.platform = platform; 54 | } 55 | 56 | public void onCreate() { 57 | activity.getWindow().setBackgroundDrawable(new ColorDrawable(0xfff3f3f3)); 58 | 59 | llPage = new LinearLayout(activity); 60 | llPage.setOrientation(LinearLayout.VERTICAL); 61 | activity.setContentView(llPage); 62 | 63 | rlTitle = new RelativeLayout(activity); 64 | float ratio = getRatio(); 65 | int titleHeight = (int) (getDesignTitleHeight() * ratio); 66 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( 67 | LayoutParams.MATCH_PARENT, titleHeight); 68 | llPage.addView(rlTitle, lp); 69 | initTitle(rlTitle, ratio); 70 | 71 | View line = new View(activity); 72 | LinearLayout.LayoutParams lpline = new LinearLayout.LayoutParams( 73 | LayoutParams.MATCH_PARENT, (int) (ratio < 1 ? 1 : ratio)); 74 | line.setBackgroundColor(0xffdad9d9); 75 | llPage.addView(line, lpline); 76 | 77 | FrameLayout flPage = new FrameLayout(getContext()); 78 | LinearLayout.LayoutParams lpFl = new LinearLayout.LayoutParams( 79 | LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); 80 | lpFl.weight = 1; 81 | flPage.setLayoutParams(lpFl); 82 | llPage.addView(flPage); 83 | 84 | // 关注(或朋友)列表 85 | PullToRequestView followList = new PullToRequestView(getContext()); 86 | FrameLayout.LayoutParams lpLv = new FrameLayout.LayoutParams( 87 | LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 88 | followList.setLayoutParams(lpLv); 89 | flPage.addView(followList); 90 | 91 | adapter = new FriendAdapter(this, followList); 92 | adapter.setPlatform(platform); 93 | adapter.setRatio(ratio); 94 | adapter.setOnItemClickListener(this); 95 | followList.setAdapter(adapter); 96 | 97 | // 请求数据 98 | followList.performPullingDown(true); 99 | } 100 | 101 | protected abstract float getRatio(); 102 | 103 | protected abstract int getDesignTitleHeight(); 104 | 105 | private void initTitle(RelativeLayout rlTitle, float ratio) { 106 | tvCancel = new TextView(activity); 107 | tvCancel.setTextColor(0xff3b3b3b); 108 | tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); 109 | tvCancel.setGravity(Gravity.CENTER); 110 | int resId = ResHelper.getStringRes(activity, "ssdk_oks_cancel"); 111 | if (resId > 0) { 112 | tvCancel.setText(resId); 113 | } 114 | int padding = (int) (DESIGN_LEFT_PADDING * ratio); 115 | tvCancel.setPadding(padding, 0, padding, 0); 116 | RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); 117 | rlTitle.addView(tvCancel, lp); 118 | tvCancel.setOnClickListener(this); 119 | 120 | TextView tvTitle = new TextView(activity); 121 | tvTitle.setTextColor(0xff3b3b3b); 122 | tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); 123 | tvTitle.setGravity(Gravity.CENTER); 124 | resId = ResHelper.getStringRes(activity, "ssdk_oks_contacts"); 125 | if (resId > 0) { 126 | tvTitle.setText(resId); 127 | } 128 | lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); 129 | lp.addRule(RelativeLayout.CENTER_IN_PARENT); 130 | rlTitle.addView(tvTitle, lp); 131 | 132 | tvConfirm = new TextView(activity); 133 | tvConfirm.setTextColor(0xffff6d11); 134 | tvConfirm.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); 135 | tvConfirm.setGravity(Gravity.CENTER); 136 | resId = ResHelper.getStringRes(activity, "ssdk_oks_confirm"); 137 | if (resId > 0) { 138 | tvConfirm.setText(resId); 139 | } 140 | tvConfirm.setPadding(padding, 0, padding, 0); 141 | lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); 142 | lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); 143 | rlTitle.addView(tvConfirm, lp); 144 | tvConfirm.setOnClickListener(this); 145 | } 146 | 147 | public void onClick(View v) { 148 | if (v.equals(tvCancel)) { 149 | finish(); 150 | } else { 151 | ArrayList selected = new ArrayList(); 152 | for (int i = 0, size = adapter.getCount(); i < size; i++) { 153 | if (adapter.getItem(i).checked) { 154 | selected.add(adapter.getItem(i).atName); 155 | } 156 | } 157 | 158 | HashMap res = new HashMap(); 159 | res.put("selected", selected); 160 | res.put("platform", platform); 161 | setResult(res); 162 | finish(); 163 | } 164 | } 165 | 166 | public void onItemClick(AdapterView parent, View view, int position, long id) { 167 | if ("FacebookMessenger".equals(platform.getName())) { 168 | if(lastPosition >= 0) { 169 | Following lastFollwing = adapter.getItem(lastPosition); 170 | lastFollwing.checked = false; 171 | } 172 | lastPosition = position; 173 | } 174 | Following following = adapter.getItem(position); 175 | following.checked = !following.checked; 176 | 177 | if(following.checked) { 178 | checkNum++; 179 | } else { 180 | checkNum--; 181 | } 182 | 183 | updateConfirmView(); 184 | adapter.notifyDataSetChanged(); 185 | } 186 | 187 | private void updateConfirmView() { 188 | int resId = ResHelper.getStringRes(activity, "ssdk_oks_confirm"); 189 | String confirm = "Confirm"; 190 | if(resId > 0) { 191 | confirm = getContext().getResources().getString(resId); 192 | } 193 | if(checkNum == 0) { 194 | tvConfirm.setText(confirm); 195 | } else if(checkNum > 0) { 196 | tvConfirm.setText(confirm + "(" + checkNum + ")"); 197 | } 198 | } 199 | 200 | } 201 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/IndicatorView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic; 10 | 11 | import android.content.Context; 12 | import android.graphics.Canvas; 13 | import android.graphics.Paint; 14 | import android.view.View; 15 | 16 | /** 九宫格滑动时,下面显示的圆圈 */ 17 | public class IndicatorView extends View { 18 | private static final int DESIGN_INDICATOR_RADIUS = 6; 19 | private static final int DESIGN_INDICATOR_DISTANCE = 14; 20 | private static final int DESIGN_BOTTOM_HEIGHT = 52; 21 | /** 九格宫有多少页数 */ 22 | private int count; 23 | /** 当前显示的是九格宫中的第几页 */ 24 | private int current; 25 | 26 | public IndicatorView(Context context) { 27 | super(context); 28 | } 29 | 30 | public void setScreenCount(int count) { 31 | this.count = count; 32 | } 33 | 34 | public void onScreenChange(int currentScreen, int lastScreen) { 35 | if (currentScreen != current) { 36 | current = currentScreen; 37 | postInvalidate(); 38 | } 39 | } 40 | 41 | protected void onDraw(Canvas canvas) { 42 | if (count <= 1) { 43 | this.setVisibility(View.GONE); 44 | return; 45 | } 46 | float height = getHeight(); 47 | float radius = height * DESIGN_INDICATOR_RADIUS / DESIGN_BOTTOM_HEIGHT; 48 | float distance = height * DESIGN_INDICATOR_DISTANCE / DESIGN_BOTTOM_HEIGHT; 49 | float windowWidth = radius * 2 * count + distance * (count - 1); 50 | float left = (getWidth() - windowWidth) / 2; 51 | float cy = height / 2; 52 | 53 | canvas.drawColor(0xffffffff); 54 | Paint paint = new Paint(); 55 | paint.setAntiAlias(true); 56 | for (int i = 0; i < count; i++) { 57 | if (i == current) { 58 | paint.setColor(0xff5d71a0); 59 | } else { 60 | paint.setColor(0xffafb1b7); 61 | } 62 | float cx = left + (radius * 2 + distance) * i; 63 | canvas.drawCircle(cx, cy, radius, paint); 64 | } 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/PRTHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic; 10 | 11 | import android.content.Context; 12 | import android.graphics.drawable.Drawable; 13 | import android.util.TypedValue; 14 | import android.view.Gravity; 15 | import android.view.View; 16 | import android.widget.LinearLayout; 17 | import android.widget.ProgressBar; 18 | import android.widget.TextView; 19 | 20 | import com.mob.tools.utils.ResHelper; 21 | 22 | /** 下拉刷新的头部控件 */ 23 | public class PRTHeader extends LinearLayout { 24 | private static final int DESIGN_SCREEN_WIDTH = 720; 25 | private static final int DESIGN_AVATAR_WIDTH = 64; 26 | private static final int DESIGN_AVATAR_PADDING = 24; 27 | 28 | private TextView tvHeader; 29 | private RotateImageView ivArrow; 30 | private ProgressBar pbRefreshing; 31 | 32 | public PRTHeader(Context context) { 33 | super(context); 34 | int[] size = ResHelper.getScreenSize(context); 35 | float screenWidth = size[0] < size[1] ? size[0] : size[1]; 36 | float ratio = screenWidth / DESIGN_SCREEN_WIDTH; 37 | 38 | setOrientation(VERTICAL); 39 | 40 | LinearLayout llInner = new LinearLayout(context); 41 | LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); 42 | lp.gravity = Gravity.CENTER_HORIZONTAL; 43 | addView(llInner, lp); 44 | 45 | ivArrow = new RotateImageView(context); 46 | int resId = ResHelper.getBitmapRes(context, "ssdk_oks_ptr_ptr"); 47 | if (resId > 0) { 48 | ivArrow.setImageResource(resId); 49 | } 50 | int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); 51 | lp = new LayoutParams(avatarWidth, avatarWidth); 52 | lp.gravity = Gravity.CENTER_VERTICAL; 53 | int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); 54 | lp.topMargin = lp.bottomMargin = avataPadding; 55 | llInner.addView(ivArrow, lp); 56 | 57 | pbRefreshing = new ProgressBar(context); 58 | resId = ResHelper.getBitmapRes(context, "ssdk_oks_classic_progressbar"); 59 | Drawable pbdrawable = context.getResources().getDrawable(resId); 60 | pbRefreshing.setIndeterminateDrawable(pbdrawable); 61 | llInner.addView(pbRefreshing, lp); 62 | pbRefreshing.setVisibility(View.GONE); 63 | 64 | tvHeader = new TextView(getContext()); 65 | tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); 66 | tvHeader.setPadding(avataPadding, 0, avataPadding, 0); 67 | tvHeader.setTextColor(0xff09bb07); 68 | lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); 69 | lp.gravity = Gravity.CENTER_VERTICAL; 70 | llInner.addView(tvHeader, lp); 71 | } 72 | 73 | public void onPullDown(int percent) { 74 | if (percent > 100) { 75 | int degree = (percent - 100) * 180 / 20; 76 | if (degree > 180) { 77 | degree = 180; 78 | } 79 | if (degree < 0) { 80 | degree = 0; 81 | } 82 | ivArrow.setRotation(degree); 83 | } else { 84 | ivArrow.setRotation(0); 85 | } 86 | 87 | if (percent < 100) { 88 | int resId = ResHelper.getStringRes(getContext(), "ssdk_oks_pull_to_refresh"); 89 | if (resId > 0) { 90 | tvHeader.setText(resId); 91 | } 92 | } else { 93 | int resId = ResHelper.getStringRes(getContext(), "ssdk_oks_release_to_refresh"); 94 | if (resId > 0) { 95 | tvHeader.setText(resId); 96 | } 97 | } 98 | } 99 | 100 | public void onRequest() { 101 | ivArrow.setVisibility(View.GONE); 102 | pbRefreshing.setVisibility(View.VISIBLE); 103 | int resId = ResHelper.getStringRes(getContext(), "ssdk_oks_refreshing"); 104 | if (resId > 0) { 105 | tvHeader.setText(resId); 106 | } 107 | } 108 | 109 | public void reverse() { 110 | pbRefreshing.setVisibility(View.GONE); 111 | ivArrow.setRotation(180); 112 | ivArrow.setVisibility(View.VISIBLE); 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/PicViewerPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic; 10 | 11 | import android.graphics.Bitmap; 12 | import android.graphics.drawable.ColorDrawable; 13 | import android.view.ViewTreeObserver.OnGlobalLayoutListener; 14 | import android.widget.ImageView.ScaleType; 15 | import cn.sharesdk.onekeyshare.OnekeySharePage; 16 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl; 17 | 18 | import com.mob.tools.gui.ScaledImageView; 19 | 20 | /** 图片浏览的视图类 */ 21 | public class PicViewerPage extends OnekeySharePage implements OnGlobalLayoutListener { 22 | private Bitmap pic; 23 | /** 图片浏览的缩放控件 */ 24 | private ScaledImageView sivViewer; 25 | 26 | public PicViewerPage(OnekeyShareThemeImpl impl) { 27 | super(impl); 28 | } 29 | 30 | /** 设置图片用于浏览 */ 31 | public void setImageBitmap(Bitmap pic) { 32 | this.pic = pic; 33 | } 34 | 35 | public void onCreate() { 36 | activity.getWindow().setBackgroundDrawable(new ColorDrawable(0x4c000000)); 37 | 38 | sivViewer = new ScaledImageView(activity); 39 | sivViewer.setScaleType(ScaleType.MATRIX); 40 | activity.setContentView(sivViewer); 41 | if (pic != null) { 42 | sivViewer.getViewTreeObserver().addOnGlobalLayoutListener(this); 43 | } 44 | } 45 | 46 | public void onGlobalLayout() { 47 | sivViewer.getViewTreeObserver().removeGlobalOnLayoutListener(this); 48 | sivViewer.post(new Runnable() { 49 | public void run() { 50 | sivViewer.setBitmap(pic); 51 | } 52 | }); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/PlatformPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic; 10 | 11 | import java.util.ArrayList; 12 | import java.util.HashMap; 13 | 14 | import android.graphics.drawable.ColorDrawable; 15 | import android.view.View; 16 | import android.view.View.OnClickListener; 17 | import android.view.ViewGroup.LayoutParams; 18 | import android.view.animation.Animation; 19 | import android.view.animation.TranslateAnimation; 20 | import android.widget.LinearLayout; 21 | import android.widget.TextView; 22 | import cn.sharesdk.framework.CustomPlatform; 23 | import cn.sharesdk.framework.Platform; 24 | import cn.sharesdk.framework.Platform.ShareParams; 25 | import cn.sharesdk.framework.ShareSDK; 26 | import cn.sharesdk.onekeyshare.CustomerLogo; 27 | import cn.sharesdk.onekeyshare.OnekeySharePage; 28 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl; 29 | 30 | import com.mob.tools.gui.MobViewPager; 31 | import com.mob.tools.utils.ResHelper; 32 | 33 | /** 九宫格的抽象类 */ 34 | public abstract class PlatformPage extends OnekeySharePage { 35 | private ClassicTheme impl; 36 | /** 点击九格宫,展示编辑界面,要执行的子线程 */ 37 | private Runnable beforeFinish; 38 | /** 九宫格显示时的动画 */ 39 | private Animation animShow; 40 | /** 九宫格隐藏时的动画 */ 41 | private Animation animHide; 42 | private LinearLayout llPanel; 43 | private boolean finished; 44 | 45 | public PlatformPage(OnekeyShareThemeImpl impl) { 46 | super(impl); 47 | this.impl = ResHelper.forceCast(impl); 48 | } 49 | 50 | public void onCreate() { 51 | activity.getWindow().setBackgroundDrawable(new ColorDrawable(0x4c000000)); 52 | initAnims(); 53 | 54 | LinearLayout llPage = new LinearLayout(activity); 55 | llPage.setOrientation(LinearLayout.VERTICAL); 56 | activity.setContentView(llPage); 57 | 58 | TextView vTop = new TextView(activity); 59 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( 60 | LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); 61 | lp.weight = 1; 62 | vTop.setOnClickListener(new OnClickListener() { 63 | public void onClick(View v) { 64 | finish(); 65 | } 66 | }); 67 | llPage.addView(vTop, lp); 68 | 69 | llPanel = new LinearLayout(activity); 70 | llPanel.setOrientation(LinearLayout.VERTICAL); 71 | lp = new LinearLayout.LayoutParams( 72 | LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); 73 | llPanel.setAnimation(animShow); 74 | llPage.addView(llPanel, lp); 75 | 76 | MobViewPager mvp = new MobViewPager(activity); 77 | ArrayList cells = collectCells(); 78 | PlatformPageAdapter adapter = newAdapter(cells); 79 | lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, adapter.getPanelHeight()); 80 | llPanel.addView(mvp, lp); 81 | 82 | IndicatorView vInd = new IndicatorView(activity); 83 | lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, adapter.getBottomHeight()); 84 | llPanel.addView(vInd, lp); 85 | 86 | vInd.setScreenCount(adapter.getCount()); 87 | vInd.onScreenChange(0, 0); 88 | adapter.setIndicator(vInd); 89 | mvp.setAdapter(adapter); 90 | } 91 | 92 | protected abstract PlatformPageAdapter newAdapter(ArrayList cells); 93 | 94 | protected ArrayList collectCells() { 95 | ArrayList cells = new ArrayList(); 96 | 97 | Platform[] platforms = ShareSDK.getPlatformList(); 98 | if (platforms == null) { 99 | platforms = new Platform[0]; 100 | } 101 | HashMap hides = getHiddenPlatforms(); 102 | if (hides == null) { 103 | hides = new HashMap(); 104 | } 105 | for (Platform p : platforms) { 106 | if (!hides.containsKey(p.getName())) { 107 | cells.add(p); 108 | } 109 | } 110 | 111 | ArrayList customers = getCustomerLogos(); 112 | if (customers != null && customers.size() > 0) { 113 | cells.addAll(customers); 114 | } 115 | 116 | return cells; 117 | } 118 | 119 | public final void showEditPage(final Platform platform) { 120 | beforeFinish = new Runnable() { 121 | public void run() { 122 | boolean isSilent = isSilent(); 123 | boolean isCustomPlatform = platform instanceof CustomPlatform; 124 | boolean isUseClientToShare = isUseClientToShare(platform); 125 | if (isSilent || isCustomPlatform || isUseClientToShare) { 126 | shareSilently(platform); 127 | } else { 128 | ShareParams sp = formateShareData(platform); 129 | if (sp != null) { 130 | // 编辑分享内容的统计 131 | ShareSDK.logDemoEvent(3, null); 132 | if (getCustomizeCallback() != null) { 133 | getCustomizeCallback().onShare(platform, sp); 134 | } 135 | impl.showEditPage(activity, platform, sp); 136 | } 137 | } 138 | } 139 | }; 140 | finish(); 141 | } 142 | 143 | public final void performCustomLogoClick(final View v, final CustomerLogo logo) { 144 | beforeFinish = new Runnable() { 145 | public void run() { 146 | logo.listener.onClick(v); 147 | } 148 | }; 149 | finish(); 150 | } 151 | 152 | private void initAnims() { 153 | animShow = new TranslateAnimation( 154 | Animation.RELATIVE_TO_SELF, 0, 155 | Animation.RELATIVE_TO_SELF, 0, 156 | Animation.RELATIVE_TO_SELF, 1, 157 | Animation.RELATIVE_TO_SELF, 0); 158 | animShow.setDuration(300); 159 | 160 | animHide = new TranslateAnimation( 161 | Animation.RELATIVE_TO_SELF, 0, 162 | Animation.RELATIVE_TO_SELF, 0, 163 | Animation.RELATIVE_TO_SELF, 0, 164 | Animation.RELATIVE_TO_SELF, 1); 165 | animHide.setDuration(300); 166 | } 167 | 168 | public boolean onFinish() { 169 | if (finished) { 170 | finished = false; 171 | return false; 172 | } 173 | 174 | animHide.setAnimationListener(new Animation.AnimationListener() { 175 | public void onAnimationStart(Animation animation) { 176 | 177 | } 178 | 179 | public void onAnimationRepeat(Animation animation) { 180 | 181 | } 182 | 183 | public void onAnimationEnd(Animation animation) { 184 | if (beforeFinish == null) { 185 | // 取消分享菜单的统计 186 | ShareSDK.logDemoEvent(2, null); 187 | } else { 188 | beforeFinish.run(); 189 | beforeFinish = null; 190 | } 191 | 192 | finished = true; 193 | finish(); 194 | } 195 | }); 196 | llPanel.clearAnimation(); 197 | llPanel.setAnimation(animHide); 198 | llPanel.setVisibility(View.GONE); 199 | return true; 200 | } 201 | 202 | } 203 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/PlatformPageAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic; 10 | 11 | import java.util.ArrayList; 12 | 13 | import android.content.Context; 14 | import android.util.TypedValue; 15 | import android.view.Gravity; 16 | import android.view.View; 17 | import android.view.View.OnClickListener; 18 | import android.view.ViewGroup; 19 | import android.view.ViewGroup.LayoutParams; 20 | import android.widget.ImageView; 21 | import android.widget.ImageView.ScaleType; 22 | import android.widget.LinearLayout; 23 | import android.widget.TextView; 24 | import cn.sharesdk.framework.Platform; 25 | import cn.sharesdk.onekeyshare.CustomerLogo; 26 | 27 | import com.mob.tools.gui.ViewPagerAdapter; 28 | import com.mob.tools.utils.ResHelper; 29 | 30 | /** 九宫格的适配器抽象类 */ 31 | public abstract class PlatformPageAdapter extends ViewPagerAdapter implements OnClickListener { 32 | /** 1秒内多次点击九格宫内的图标无效 */ 33 | protected static final int MIN_CLICK_INTERVAL = 1000; 34 | public static final int DESIGN_BOTTOM_HEIGHT = 52; 35 | 36 | /** 九格宫内图标排列的二维数组,一维对应平台,二维对应页数 */ 37 | protected Object[][] cells; 38 | private PlatformPage page; 39 | private IndicatorView vInd; 40 | 41 | protected int bottomHeight; 42 | protected int panelHeight; 43 | protected int cellHeight; 44 | protected int lineSize; 45 | protected int sepLineWidth; 46 | protected int paddingTop; 47 | protected int logoHeight; 48 | 49 | private long lastClickTime; 50 | 51 | public PlatformPageAdapter(PlatformPage page, ArrayList cells) { 52 | this.page = page; 53 | if (cells != null && !cells.isEmpty()) { 54 | calculateSize(page.getContext(), cells); 55 | collectCells(cells); 56 | } 57 | } 58 | 59 | /** 计算九宫格的格数,行数,格高,行高,图标大小 */ 60 | protected abstract void calculateSize(Context context, ArrayList plats); 61 | 62 | /** 计算九宫格的格数,行数 */ 63 | protected abstract void collectCells(ArrayList plats); 64 | 65 | public int getBottomHeight() { 66 | return bottomHeight; 67 | } 68 | 69 | public int getPanelHeight() { 70 | return panelHeight; 71 | } 72 | 73 | public int getCount() { 74 | return cells == null ? 0 : cells.length; 75 | } 76 | 77 | public void setIndicator(IndicatorView view) { 78 | vInd = view; 79 | } 80 | 81 | public void onScreenChange(int currentScreen, int lastScreen) { 82 | if (vInd != null) { 83 | vInd.setScreenCount(getCount()); 84 | vInd.onScreenChange(currentScreen, lastScreen); 85 | } 86 | } 87 | 88 | public View getView(int index, View convertView, ViewGroup parent) { 89 | if (convertView == null) { 90 | convertView = createPanel(parent.getContext()); 91 | } 92 | 93 | LinearLayout llPanel = ResHelper.forceCast(convertView); 94 | LinearLayout[] llCells = ResHelper.forceCast(llPanel.getTag()); 95 | refreshPanel(llCells, cells[index]); 96 | return convertView; 97 | } 98 | 99 | private View createPanel(Context context) { 100 | LinearLayout llPanel = new LinearLayout(context); 101 | llPanel.setOrientation(LinearLayout.VERTICAL); 102 | llPanel.setBackgroundColor(0xfff2f2f2); 103 | 104 | int lineCount = panelHeight / cellHeight; 105 | LinearLayout[] llCells = new LinearLayout[lineCount * lineSize]; 106 | llPanel.setTag(llCells); 107 | int cellBack = ResHelper.getBitmapRes(context, "ssdk_oks_classic_platform_cell_back"); 108 | LinearLayout.LayoutParams lp; 109 | for (int i = 0; i < lineCount; i++) { 110 | LinearLayout llLine = new LinearLayout(context); 111 | lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, cellHeight); 112 | llPanel.addView(llLine, lp); 113 | 114 | for (int j = 0; j < lineSize; j++) { 115 | llCells[i * lineSize + j] = new LinearLayout(context); 116 | llCells[i * lineSize + j].setBackgroundResource(cellBack); 117 | llCells[i * lineSize + j].setOrientation(LinearLayout.VERTICAL); 118 | lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, cellHeight); 119 | lp.weight = 1; 120 | llLine.addView(llCells[i * lineSize + j], lp); 121 | 122 | if (j < lineSize - 1) { 123 | View vSep = new View(context); 124 | lp = new LinearLayout.LayoutParams(sepLineWidth, LayoutParams.MATCH_PARENT); 125 | llLine.addView(vSep, lp); 126 | } 127 | } 128 | 129 | View vSep = new View(context); 130 | lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, sepLineWidth); 131 | llPanel.addView(vSep, lp); 132 | } 133 | 134 | for (LinearLayout llCell : llCells) { 135 | ImageView ivLogo = new ImageView(context); 136 | ivLogo.setScaleType(ScaleType.CENTER_INSIDE); 137 | lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, logoHeight); 138 | lp.topMargin = paddingTop; 139 | llCell.addView(ivLogo, lp); 140 | 141 | TextView tvName = new TextView(context); 142 | tvName.setTextColor(0xff646464); 143 | tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); 144 | tvName.setGravity(Gravity.CENTER); 145 | lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); 146 | lp.weight = 1; 147 | llCell.addView(tvName, lp); 148 | } 149 | 150 | return llPanel; 151 | } 152 | 153 | private void refreshPanel(LinearLayout[] llCells, Object[] logos) { 154 | int cellBack = ResHelper.getBitmapRes(page.getContext(), "ssdk_oks_classic_platform_cell_back"); 155 | int disableBack = ResHelper.getBitmapRes(page.getContext(), "ssdk_oks_classic_platfrom_cell_back_nor"); 156 | for (int i = 0; i < logos.length; i++) { 157 | ImageView ivLogo = ResHelper.forceCast(llCells[i].getChildAt(0)); 158 | TextView tvName = ResHelper.forceCast(llCells[i].getChildAt(1)); 159 | if (logos[i] == null) { 160 | ivLogo.setVisibility(View.INVISIBLE); 161 | tvName.setVisibility(View.INVISIBLE); 162 | llCells[i].setBackgroundResource(disableBack); 163 | llCells[i].setOnClickListener(null); 164 | } else { 165 | ivLogo.setVisibility(View.VISIBLE); 166 | tvName.setVisibility(View.VISIBLE); 167 | ivLogo.requestLayout(); 168 | tvName.requestLayout(); 169 | llCells[i].setBackgroundResource(cellBack); 170 | llCells[i].setOnClickListener(this); 171 | llCells[i].setTag(logos[i]); 172 | 173 | if (logos[i] instanceof CustomerLogo) { 174 | CustomerLogo logo = ResHelper.forceCast(logos[i]); 175 | if (logo.logo != null) { 176 | ivLogo.setImageBitmap(logo.logo); 177 | } else { 178 | ivLogo.setImageBitmap(null); 179 | } 180 | if (logo.label != null) { 181 | tvName.setText(logo.label); 182 | } else { 183 | tvName.setText(""); 184 | } 185 | } else { 186 | Platform plat = ResHelper.forceCast(logos[i]); 187 | String name = plat.getName().toLowerCase(); 188 | int resId = ResHelper.getBitmapRes(ivLogo.getContext(),"ssdk_oks_classic_" + name); 189 | if (resId > 0) { 190 | ivLogo.setImageResource(resId); 191 | } else { 192 | ivLogo.setImageBitmap(null); 193 | } 194 | resId = ResHelper.getStringRes(tvName.getContext(), "ssdk_" + name); 195 | if (resId > 0) { 196 | tvName.setText(resId); 197 | } else { 198 | tvName.setText(""); 199 | } 200 | } 201 | } 202 | } 203 | } 204 | 205 | public void onClick(View v) { 206 | long time = System.currentTimeMillis(); 207 | if (time - lastClickTime < MIN_CLICK_INTERVAL) { 208 | return; 209 | } 210 | lastClickTime = time; 211 | 212 | if (v.getTag() instanceof CustomerLogo) { 213 | CustomerLogo logo = ResHelper.forceCast(v.getTag()); 214 | page.performCustomLogoClick(v, logo); 215 | } else { 216 | Platform plat = ResHelper.forceCast(v.getTag()); 217 | page.showEditPage(plat); 218 | } 219 | } 220 | 221 | } 222 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/RotateImageView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic; 10 | 11 | import android.content.Context; 12 | import android.graphics.Canvas; 13 | import android.widget.ImageView; 14 | 15 | /** 在At好友页面中,下拉刷新列表头部的旋转箭头 */ 16 | public class RotateImageView extends ImageView { 17 | private float rotation; 18 | 19 | public RotateImageView(Context context) { 20 | super(context); 21 | } 22 | 23 | public void setRotation(float rotation) { 24 | this.rotation = rotation; 25 | invalidate(); 26 | } 27 | 28 | protected void onDraw(Canvas canvas) { 29 | canvas.rotate(rotation, getWidth() / 2, getHeight() / 2); 30 | super.onDraw(canvas); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/XView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic; 10 | 11 | import android.content.Context; 12 | import android.graphics.Canvas; 13 | import android.graphics.Paint; 14 | import android.view.View; 15 | 16 | /** 编辑页面中删除图片“X”按钮 */ 17 | public class XView extends View { 18 | private float ratio; 19 | 20 | public XView(Context context) { 21 | super(context); 22 | } 23 | 24 | public void setRatio(float ratio) { 25 | this.ratio = ratio; 26 | } 27 | 28 | protected void onDraw(Canvas canvas) { 29 | int width = getWidth() / 2; 30 | int height = getHeight() / 2; 31 | 32 | Paint paint = new Paint(); 33 | paint.setAntiAlias(true); 34 | paint.setColor(0xffa0a0a0); 35 | canvas.drawRect(width, 0, getWidth(), height, paint); 36 | 37 | paint = new Paint(); 38 | paint.setAntiAlias(true); 39 | paint.setStrokeWidth(3f * ratio); 40 | paint.setColor(0xffffffff); 41 | float left = 8f * ratio; 42 | canvas.drawLine(width + left, left, getWidth() - left, width - left, paint); 43 | canvas.drawLine(width + left, width - left, getWidth() - left, left, paint); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/land/EditPageLand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic.land; 10 | 11 | import java.io.File; 12 | 13 | import android.graphics.Bitmap; 14 | import android.text.TextUtils; 15 | import android.text.TextWatcher; 16 | import android.util.TypedValue; 17 | import android.view.Gravity; 18 | import android.view.View; 19 | import android.view.View.OnClickListener; 20 | import android.view.ViewGroup.LayoutParams; 21 | import android.widget.EditText; 22 | import android.widget.LinearLayout; 23 | import android.widget.RelativeLayout; 24 | import android.widget.ScrollView; 25 | import android.widget.TextView; 26 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl; 27 | import cn.sharesdk.onekeyshare.themes.classic.EditPage; 28 | import cn.sharesdk.onekeyshare.themes.classic.XView; 29 | 30 | import com.mob.tools.gui.AsyncImageView; 31 | import com.mob.tools.utils.BitmapHelper; 32 | import com.mob.tools.utils.ResHelper; 33 | 34 | /** 横屏的编辑页 */ 35 | public class EditPageLand extends EditPage implements OnClickListener, TextWatcher, Runnable { 36 | private static final int DESIGN_SCREEN_WIDTH= 720; 37 | private static final int DESIGN_BOTTOM_HEIGHT = 75; 38 | private static final int DESIGN_LEFT_PADDING = 40; 39 | private static final int DESIGN_TITLE_HEIGHT_L = 70; 40 | private static final int DESIGN_THUMB_HEIGHT_L = 280; 41 | private static final int DESIGN_REMOVE_THUMB_HEIGHT_L = 60; 42 | 43 | public EditPageLand(OnekeyShareThemeImpl impl) { 44 | super(impl); 45 | } 46 | 47 | public void onCreate() { 48 | super.onCreate(); 49 | 50 | int screenHeight = ResHelper.getScreenHeight(activity); 51 | float ratio = ((float) screenHeight) / DESIGN_SCREEN_WIDTH; 52 | 53 | maxBodyHeight = 0; 54 | 55 | llPage = new LinearLayout(activity); 56 | llPage.setOrientation(LinearLayout.VERTICAL); 57 | activity.setContentView(llPage); 58 | 59 | rlTitle = new RelativeLayout(activity); 60 | rlTitle.setBackgroundColor(0xffe6e9ec); 61 | int titleHeight = (int) (DESIGN_TITLE_HEIGHT_L * ratio); 62 | 63 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight); 64 | llPage.addView(rlTitle, lp); 65 | initTitle(rlTitle, ratio); 66 | 67 | RelativeLayout rlBody = new RelativeLayout(activity); 68 | rlBody.setBackgroundColor(0xffffffff); 69 | lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); 70 | llPage.addView(rlBody, lp); 71 | initBody(rlBody, ratio); 72 | 73 | LinearLayout llShadow = new LinearLayout(activity); 74 | llShadow.setOrientation(LinearLayout.VERTICAL); 75 | rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); 76 | initShadow(llShadow, ratio); 77 | 78 | llBottom = new LinearLayout(activity); 79 | llBottom.setOrientation(LinearLayout.VERTICAL); 80 | lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); 81 | llPage.addView(llBottom, lp); 82 | initBottom(llBottom, ratio); 83 | } 84 | 85 | private void initTitle(RelativeLayout rlTitle, float ratio) { 86 | tvCancel = new TextView(activity); 87 | tvCancel.setTextColor(0xff3b3b3b); 88 | tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); 89 | tvCancel.setGravity(Gravity.CENTER); 90 | int resId = ResHelper.getStringRes(activity, "ssdk_oks_cancel"); 91 | if (resId > 0) { 92 | tvCancel.setText(resId); 93 | } 94 | int padding = (int) (DESIGN_LEFT_PADDING * ratio); 95 | tvCancel.setPadding(padding, 0, padding, 0); 96 | RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); 97 | rlTitle.addView(tvCancel, lp); 98 | tvCancel.setOnClickListener(this); 99 | 100 | TextView tvTitle = new TextView(activity); 101 | tvTitle.setTextColor(0xff3b3b3b); 102 | tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); 103 | tvTitle.setGravity(Gravity.CENTER); 104 | resId = ResHelper.getStringRes(activity, "ssdk_oks_multi_share"); 105 | if (resId > 0) { 106 | tvTitle.setText(resId); 107 | } 108 | lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); 109 | lp.addRule(RelativeLayout.CENTER_IN_PARENT); 110 | rlTitle.addView(tvTitle, lp); 111 | 112 | tvShare = new TextView(activity); 113 | tvShare.setTextColor(0xffff6d11); 114 | tvShare.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); 115 | tvShare.setGravity(Gravity.CENTER); 116 | resId = ResHelper.getStringRes(activity, "ssdk_oks_share"); 117 | if (resId > 0) { 118 | tvShare.setText(resId); 119 | } 120 | tvShare.setPadding(padding, 0, padding, 0); 121 | lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); 122 | lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); 123 | rlTitle.addView(tvShare, lp); 124 | tvShare.setOnClickListener(this); 125 | } 126 | 127 | private void initBody(RelativeLayout rlBody, float ratio) { 128 | svContent = new ScrollView(activity); 129 | rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); 130 | 131 | LinearLayout llContent = new LinearLayout(activity); 132 | llContent.setOrientation(LinearLayout.HORIZONTAL); 133 | svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); 134 | 135 | etContent = new EditText(activity); 136 | int padding = (int) (DESIGN_LEFT_PADDING * ratio); 137 | etContent.setPadding(padding, padding, padding, padding); 138 | etContent.setBackgroundDrawable(null); 139 | etContent.setTextColor(0xff3b3b3b); 140 | etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); 141 | etContent.setText(sp.getText()); 142 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); 143 | lp.weight = 1; 144 | llContent.addView(etContent, lp); 145 | etContent.addTextChangedListener(this); 146 | 147 | rlThumb = new RelativeLayout(activity); 148 | rlThumb.setBackgroundColor(0xff313131); 149 | int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio); 150 | int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio); 151 | lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); 152 | lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; 153 | llContent.addView(rlThumb, lp); 154 | 155 | aivThumb = new AsyncImageView(activity) { 156 | public void onImageGot(String url, Bitmap bm) { 157 | thumb = bm; 158 | super.onImageGot(url, bm); 159 | } 160 | }; 161 | aivThumb.setScaleToCropCenter(true); 162 | RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); 163 | rlThumb.addView(aivThumb, rllp); 164 | aivThumb.setOnClickListener(this); 165 | initThumb(aivThumb); 166 | 167 | xvRemove = new XView(activity); 168 | xvRemove.setRatio(ratio); 169 | rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); 170 | rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); 171 | rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); 172 | rlThumb.addView(xvRemove, rllp); 173 | xvRemove.setOnClickListener(this); 174 | } 175 | 176 | private void initBottom(LinearLayout llBottom, float ratio) { 177 | LinearLayout llAt = new LinearLayout(activity); 178 | llAt.setPadding(0, 0, 0, 5); 179 | llAt.setBackgroundColor(0xffffffff); 180 | int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio); 181 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight); 182 | llBottom.addView(llAt, lp); 183 | 184 | tvAt = new TextView(activity); 185 | tvAt.setTextColor(0xff3b3b3b); 186 | tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); 187 | tvAt.setGravity(Gravity.BOTTOM); 188 | tvAt.setText("@"); 189 | int padding = (int) (DESIGN_LEFT_PADDING * ratio); 190 | tvAt.setPadding(padding, 0, padding, 0); 191 | lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); 192 | llAt.addView(tvAt, lp); 193 | tvAt.setOnClickListener(this); 194 | if (isShowAtUserLayout(platform.getName())) { 195 | tvAt.setVisibility(View.VISIBLE); 196 | } else { 197 | tvAt.setVisibility(View.INVISIBLE); 198 | } 199 | 200 | tvTextCouter = new TextView(activity); 201 | tvTextCouter.setTextColor(0xff3b3b3b); 202 | tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); 203 | tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT); 204 | onTextChanged(etContent.getText(), 0, 0, 0); 205 | tvTextCouter.setPadding(padding, 0, padding, 0); 206 | lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); 207 | lp.weight = 1; 208 | llAt.addView(tvTextCouter, lp); 209 | 210 | View v = new View(activity); 211 | v.setBackgroundColor(0xffcccccc); 212 | int px1 = ratio > 1 ? ((int) ratio) : 1; 213 | lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px1); 214 | llBottom.addView(v, lp); 215 | } 216 | 217 | private void initShadow(LinearLayout llShadow, float ratio) { 218 | int px1 = ratio > 1 ? ((int) ratio) : 1; 219 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px1); 220 | 221 | View v = new View(activity); 222 | v.setBackgroundColor(0x29000000); 223 | llShadow.addView(v, lp); 224 | 225 | v = new View(activity); 226 | v.setBackgroundColor(0x14000000); 227 | llShadow.addView(v, lp); 228 | 229 | v = new View(activity); 230 | v.setBackgroundColor(0x07000000); 231 | llShadow.addView(v, lp); 232 | } 233 | 234 | private void initThumb(AsyncImageView aivThumb) { 235 | String imageUrl = sp.getImageUrl(); 236 | String imagePath = sp.getImagePath(); 237 | String[] imageArray = sp.getImageArray(); 238 | 239 | Bitmap pic = null; 240 | rlThumb.setVisibility(View.VISIBLE); 241 | if(!TextUtils.isEmpty(imagePath) && new File(imagePath).exists()) { 242 | try { 243 | pic = BitmapHelper.getBitmap(imagePath); 244 | } catch (Throwable e) { 245 | e.printStackTrace(); 246 | } 247 | } 248 | 249 | if (pic != null) { 250 | thumb = pic; 251 | aivThumb.setBitmap(pic); 252 | } else if (imageArray != null && imageArray.length > 0) { 253 | if (!TextUtils.isEmpty(imageArray[0]) && new File(imageArray[0]).exists()) { 254 | try { 255 | pic = BitmapHelper.getBitmap(imagePath); 256 | } catch (Throwable e) { 257 | e.printStackTrace(); 258 | } 259 | } 260 | } 261 | 262 | if (pic != null) { 263 | thumb = pic; 264 | aivThumb.setBitmap(pic); 265 | } else if (pic == null && !TextUtils.isEmpty(imageUrl)) { 266 | aivThumb.execute(imageUrl, 0); 267 | } else { 268 | rlThumb.setVisibility(View.GONE); 269 | } 270 | } 271 | 272 | } 273 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/land/FriendListPageLand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic.land; 10 | 11 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl; 12 | import cn.sharesdk.onekeyshare.themes.classic.FriendListPage; 13 | 14 | import com.mob.tools.utils.ResHelper; 15 | 16 | /** 横屏的好友列表 */ 17 | public class FriendListPageLand extends FriendListPage { 18 | private static final int DESIGN_SCREEN_WIDTH = 1280; 19 | private static final int DESIGN_TITLE_HEIGHT = 70; 20 | 21 | public FriendListPageLand(OnekeyShareThemeImpl impl) { 22 | super(impl); 23 | } 24 | 25 | protected float getRatio() { 26 | float screenWidth = ResHelper.getScreenWidth(activity); 27 | return screenWidth / DESIGN_SCREEN_WIDTH; 28 | } 29 | 30 | protected int getDesignTitleHeight() { 31 | return DESIGN_TITLE_HEIGHT; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/land/PlatformPageAdapterLand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic.land; 10 | 11 | import java.util.ArrayList; 12 | 13 | import android.content.Context; 14 | import cn.sharesdk.onekeyshare.themes.classic.PlatformPage; 15 | import cn.sharesdk.onekeyshare.themes.classic.PlatformPageAdapter; 16 | 17 | import com.mob.tools.utils.ResHelper; 18 | 19 | /** 横屏的九宫格页面适配器 */ 20 | public class PlatformPageAdapterLand extends PlatformPageAdapter { 21 | private static final int DESIGN_SCREEN_WIDTH_L = 1280; 22 | private static final int DESIGN_CELL_WIDTH_L = 160; 23 | private static final int DESIGN_SEP_LINE_WIDTH = 1; 24 | private static final int DESIGN_LOGO_HEIGHT = 76; 25 | private static final int DESIGN_PADDING_TOP = 20; 26 | 27 | public PlatformPageAdapterLand(PlatformPage page, ArrayList cells) { 28 | super(page, cells); 29 | } 30 | 31 | protected void calculateSize(Context context, ArrayList plats) { 32 | int screenWidth = ResHelper.getScreenWidth(context); 33 | float ratio = ((float) screenWidth) / DESIGN_SCREEN_WIDTH_L; 34 | int cellWidth = (int) (DESIGN_CELL_WIDTH_L * ratio); 35 | lineSize = screenWidth / cellWidth; 36 | 37 | sepLineWidth = (int) (DESIGN_SEP_LINE_WIDTH * ratio); 38 | sepLineWidth = sepLineWidth < 1 ? 1 : sepLineWidth; 39 | logoHeight = (int) (DESIGN_LOGO_HEIGHT * ratio); 40 | paddingTop = (int) (DESIGN_PADDING_TOP * ratio); 41 | bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio); 42 | cellHeight = (screenWidth - sepLineWidth * 3) / (lineSize - 1); 43 | panelHeight = cellHeight + sepLineWidth; 44 | } 45 | 46 | protected void collectCells(ArrayList plats) { 47 | int count = plats.size(); 48 | if (count < lineSize) { 49 | int lineCount = (count / lineSize); 50 | if (count % lineSize != 0) { 51 | lineCount++; 52 | } 53 | cells = new Object[1][lineCount * lineSize]; 54 | } else { 55 | int pageCount = (count / lineSize); 56 | if (count % lineSize != 0) { 57 | pageCount++; 58 | } 59 | cells = new Object[pageCount][lineSize]; 60 | } 61 | 62 | for (int i = 0; i < count; i++) { 63 | int p = i / lineSize; 64 | cells[p][i - lineSize * p] = plats.get(i); 65 | } 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/land/PlatformPageLand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic.land; 10 | 11 | import java.util.ArrayList; 12 | 13 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl; 14 | import cn.sharesdk.onekeyshare.themes.classic.PlatformPage; 15 | import cn.sharesdk.onekeyshare.themes.classic.PlatformPageAdapter; 16 | 17 | /** 横屏的九宫格页面 */ 18 | public class PlatformPageLand extends PlatformPage { 19 | 20 | public PlatformPageLand(OnekeyShareThemeImpl impl) { 21 | super(impl); 22 | } 23 | 24 | public void onCreate() { 25 | requestLandscapeOrientation(); 26 | super.onCreate(); 27 | } 28 | 29 | protected PlatformPageAdapter newAdapter(ArrayList cells) { 30 | return new PlatformPageAdapterLand(this, cells); 31 | } 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/port/EditPagePort.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic.port; 10 | 11 | import java.io.File; 12 | 13 | import android.graphics.Bitmap; 14 | import android.text.TextUtils; 15 | import android.util.TypedValue; 16 | import android.view.Gravity; 17 | import android.view.View; 18 | import android.view.ViewGroup.LayoutParams; 19 | import android.widget.EditText; 20 | import android.widget.LinearLayout; 21 | import android.widget.RelativeLayout; 22 | import android.widget.ScrollView; 23 | import android.widget.TextView; 24 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl; 25 | import cn.sharesdk.onekeyshare.themes.classic.EditPage; 26 | import cn.sharesdk.onekeyshare.themes.classic.XView; 27 | 28 | import com.mob.tools.gui.AsyncImageView; 29 | import com.mob.tools.utils.BitmapHelper; 30 | import com.mob.tools.utils.ResHelper; 31 | 32 | /** 竖屏的编辑页 */ 33 | public class EditPagePort extends EditPage { 34 | private static final int DESIGN_SCREEN_HEIGHT= 1280; 35 | private static final int DESIGN_TITLE_HEIGHT = 96; 36 | private static final int DESIGN_BOTTOM_HEIGHT = 75; 37 | private static final int DESIGN_LEFT_PADDING = 40; 38 | private static final int DESIGN_THUMB_HEIGHT = 300; 39 | private static final int DESIGN_REMOVE_THUMB_HEIGHT = 70; 40 | 41 | public EditPagePort(OnekeyShareThemeImpl impl) { 42 | super(impl); 43 | } 44 | 45 | public void onCreate() { 46 | super.onCreate(); 47 | 48 | int screenHeight = ResHelper.getScreenHeight(activity); 49 | float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT; 50 | 51 | maxBodyHeight = 0; 52 | 53 | llPage = new LinearLayout(activity); 54 | llPage.setOrientation(LinearLayout.VERTICAL); 55 | activity.setContentView(llPage); 56 | 57 | rlTitle = new RelativeLayout(activity); 58 | rlTitle.setBackgroundColor(0xffe6e9ec); 59 | int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio); 60 | 61 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight); 62 | llPage.addView(rlTitle, lp); 63 | initTitle(rlTitle, ratio); 64 | 65 | RelativeLayout rlBody = new RelativeLayout(activity); 66 | rlBody.setBackgroundColor(0xffffffff); 67 | lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); 68 | llPage.addView(rlBody, lp); 69 | initBody(rlBody, ratio); 70 | 71 | LinearLayout llShadow = new LinearLayout(activity); 72 | llShadow.setOrientation(LinearLayout.VERTICAL); 73 | rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); 74 | initShadow(llShadow, ratio); 75 | 76 | llBottom = new LinearLayout(activity); 77 | llBottom.setOrientation(LinearLayout.VERTICAL); 78 | lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); 79 | llPage.addView(llBottom, lp); 80 | initBottom(llBottom, ratio); 81 | } 82 | 83 | private void initTitle(RelativeLayout rlTitle, float ratio) { 84 | tvCancel = new TextView(activity); 85 | tvCancel.setTextColor(0xff3b3b3b); 86 | tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); 87 | tvCancel.setGravity(Gravity.CENTER); 88 | int resId = ResHelper.getStringRes(activity, "ssdk_oks_cancel"); 89 | if (resId > 0) { 90 | tvCancel.setText(resId); 91 | } 92 | int padding = (int) (DESIGN_LEFT_PADDING * ratio); 93 | tvCancel.setPadding(padding, 0, padding, 0); 94 | RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); 95 | rlTitle.addView(tvCancel, lp); 96 | tvCancel.setOnClickListener(this); 97 | 98 | TextView tvTitle = new TextView(activity); 99 | tvTitle.setTextColor(0xff3b3b3b); 100 | tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); 101 | tvTitle.setGravity(Gravity.CENTER); 102 | resId = ResHelper.getStringRes(activity, "ssdk_oks_multi_share"); 103 | if (resId > 0) { 104 | tvTitle.setText(resId); 105 | } 106 | lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); 107 | lp.addRule(RelativeLayout.CENTER_IN_PARENT); 108 | rlTitle.addView(tvTitle, lp); 109 | 110 | tvShare = new TextView(activity); 111 | tvShare.setTextColor(0xffff6d11); 112 | tvShare.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); 113 | tvShare.setGravity(Gravity.CENTER); 114 | resId = ResHelper.getStringRes(activity, "ssdk_oks_share"); 115 | if (resId > 0) { 116 | tvShare.setText(resId); 117 | } 118 | tvShare.setPadding(padding, 0, padding, 0); 119 | lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); 120 | lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); 121 | rlTitle.addView(tvShare, lp); 122 | tvShare.setOnClickListener(this); 123 | } 124 | 125 | private void initBody(RelativeLayout rlBody, float ratio) { 126 | svContent = new ScrollView(activity); 127 | rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); 128 | 129 | LinearLayout llContent = new LinearLayout(activity); 130 | llContent.setOrientation(LinearLayout.VERTICAL); 131 | svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); 132 | 133 | etContent = new EditText(activity); 134 | int padding = (int) (DESIGN_LEFT_PADDING * ratio); 135 | etContent.setPadding(padding, padding, padding, padding); 136 | etContent.setBackgroundDrawable(null); 137 | etContent.setTextColor(0xff3b3b3b); 138 | etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); 139 | etContent.setText(sp.getText()); 140 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); 141 | llContent.addView(etContent, lp); 142 | etContent.addTextChangedListener(this); 143 | 144 | rlThumb = new RelativeLayout(activity); 145 | rlThumb.setBackgroundColor(0xff313131); 146 | int thumbWidth = (int) (DESIGN_THUMB_HEIGHT * ratio); 147 | int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT * ratio); 148 | lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); 149 | lp.leftMargin = lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; 150 | llContent.addView(rlThumb, lp); 151 | 152 | aivThumb = new AsyncImageView(activity) { 153 | public void onImageGot(String url, Bitmap bm) { 154 | thumb = bm; 155 | super.onImageGot(url, bm); 156 | } 157 | }; 158 | aivThumb.setScaleToCropCenter(true); 159 | RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); 160 | rlThumb.addView(aivThumb, rllp); 161 | aivThumb.setOnClickListener(this); 162 | initThumb(aivThumb); 163 | 164 | xvRemove = new XView(activity); 165 | xvRemove.setRatio(ratio); 166 | rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); 167 | rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); 168 | rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); 169 | rlThumb.addView(xvRemove, rllp); 170 | xvRemove.setOnClickListener(this); 171 | } 172 | 173 | private void initBottom(LinearLayout llBottom, float ratio) { 174 | LinearLayout llAt = new LinearLayout(activity); 175 | llAt.setPadding(0, 0, 0, 5); 176 | llAt.setBackgroundColor(0xffffffff); 177 | int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio); 178 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight); 179 | llBottom.addView(llAt, lp); 180 | 181 | tvAt = new TextView(activity); 182 | tvAt.setTextColor(0xff3b3b3b); 183 | tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); 184 | tvAt.setGravity(Gravity.BOTTOM); 185 | tvAt.setText("@"); 186 | int padding = (int) (DESIGN_LEFT_PADDING * ratio); 187 | tvAt.setPadding(padding, 0, padding, 0); 188 | lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); 189 | llAt.addView(tvAt, lp); 190 | tvAt.setOnClickListener(this); 191 | if (isShowAtUserLayout(platform.getName())) { 192 | tvAt.setVisibility(View.VISIBLE); 193 | } else { 194 | tvAt.setVisibility(View.INVISIBLE); 195 | } 196 | 197 | tvTextCouter = new TextView(activity); 198 | tvTextCouter.setTextColor(0xff3b3b3b); 199 | tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); 200 | tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT); 201 | onTextChanged(etContent.getText(), 0, 0, 0); 202 | tvTextCouter.setPadding(padding, 0, padding, 0); 203 | lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); 204 | lp.weight = 1; 205 | llAt.addView(tvTextCouter, lp); 206 | 207 | View v = new View(activity); 208 | v.setBackgroundColor(0xffcccccc); 209 | int px1 = ratio > 1 ? ((int) ratio) : 1; 210 | lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px1); 211 | llBottom.addView(v, lp); 212 | } 213 | 214 | private void initShadow(LinearLayout llShadow, float ratio) { 215 | int px1 = ratio > 1 ? ((int) ratio) : 1; 216 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px1); 217 | 218 | View v = new View(activity); 219 | v.setBackgroundColor(0x29000000); 220 | llShadow.addView(v, lp); 221 | 222 | v = new View(activity); 223 | v.setBackgroundColor(0x14000000); 224 | llShadow.addView(v, lp); 225 | 226 | v = new View(activity); 227 | v.setBackgroundColor(0x07000000); 228 | llShadow.addView(v, lp); 229 | } 230 | 231 | private void initThumb(AsyncImageView aivThumb) { 232 | String imageUrl = sp.getImageUrl(); 233 | String imagePath = sp.getImagePath(); 234 | String[] imageArray = sp.getImageArray(); 235 | 236 | Bitmap pic = null; 237 | rlThumb.setVisibility(View.VISIBLE); 238 | if(!TextUtils.isEmpty(imagePath) && new File(imagePath).exists()) { 239 | try { 240 | pic = BitmapHelper.getBitmap(imagePath); 241 | } catch (Throwable e) { 242 | e.printStackTrace(); 243 | } 244 | } 245 | 246 | if (pic != null) { 247 | thumb = pic; 248 | aivThumb.setBitmap(pic); 249 | } else if (imageArray != null && imageArray.length > 0) { 250 | if (!TextUtils.isEmpty(imageArray[0]) && new File(imageArray[0]).exists()) { 251 | try { 252 | pic = BitmapHelper.getBitmap(imagePath); 253 | } catch (Throwable e) { 254 | e.printStackTrace(); 255 | } 256 | } 257 | } 258 | 259 | if (pic != null) { 260 | thumb = pic; 261 | aivThumb.setBitmap(pic); 262 | } else if (pic == null && !TextUtils.isEmpty(imageUrl)) { 263 | aivThumb.execute(imageUrl, 0); 264 | } else { 265 | rlThumb.setVisibility(View.GONE); 266 | } 267 | } 268 | 269 | } 270 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/port/FriendListPagePort.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic.port; 10 | 11 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl; 12 | import cn.sharesdk.onekeyshare.themes.classic.FriendListPage; 13 | 14 | import com.mob.tools.utils.ResHelper; 15 | 16 | /** 竖屏的好友列表 */ 17 | public class FriendListPagePort extends FriendListPage { 18 | private static final int DESIGN_SCREEN_WIDTH = 720; 19 | private static final int DESIGN_TITLE_HEIGHT = 96; 20 | 21 | public FriendListPagePort(OnekeyShareThemeImpl impl) { 22 | super(impl); 23 | } 24 | 25 | protected float getRatio() { 26 | float screenWidth = ResHelper.getScreenWidth(activity); 27 | return screenWidth / DESIGN_SCREEN_WIDTH; 28 | } 29 | 30 | protected int getDesignTitleHeight() { 31 | return DESIGN_TITLE_HEIGHT; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/port/PlatformPageAdapterPort.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic.port; 10 | 11 | import java.util.ArrayList; 12 | 13 | import android.content.Context; 14 | import cn.sharesdk.onekeyshare.themes.classic.PlatformPage; 15 | import cn.sharesdk.onekeyshare.themes.classic.PlatformPageAdapter; 16 | 17 | import com.mob.tools.utils.ResHelper; 18 | 19 | /** 竖屏的九宫格页面适配器 */ 20 | public class PlatformPageAdapterPort extends PlatformPageAdapter { 21 | private static final int DESIGN_SCREEN_WIDTH_P = 720; 22 | private static final int DESIGN_SEP_LINE_WIDTH = 1; 23 | private static final int DESIGN_LOGO_HEIGHT = 76; 24 | private static final int DESIGN_PADDING_TOP = 20; 25 | private static final int PAGE_SIZE_P = 12; 26 | private static final int LINE_SIZE_P = 4; 27 | 28 | public PlatformPageAdapterPort(PlatformPage page, ArrayList cells) { 29 | super(page, cells); 30 | } 31 | 32 | protected void calculateSize(Context context, ArrayList plats) { 33 | int screenWidth = ResHelper.getScreenWidth(context); 34 | lineSize = LINE_SIZE_P; 35 | 36 | float ratio = ((float) screenWidth) / DESIGN_SCREEN_WIDTH_P; 37 | sepLineWidth = (int) (DESIGN_SEP_LINE_WIDTH * ratio); 38 | sepLineWidth = sepLineWidth < 1 ? 1 : sepLineWidth; 39 | logoHeight = (int) (DESIGN_LOGO_HEIGHT * ratio); 40 | paddingTop = (int) (DESIGN_PADDING_TOP * ratio); 41 | bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio); 42 | cellHeight = (screenWidth - sepLineWidth * 3) / 4; 43 | if (plats.size() <= lineSize) { 44 | panelHeight = cellHeight + sepLineWidth; 45 | } else if (plats.size() <= PAGE_SIZE_P - lineSize) { 46 | panelHeight = (cellHeight + sepLineWidth) * 2; 47 | } else { 48 | panelHeight = (cellHeight + sepLineWidth) * 3; 49 | } 50 | } 51 | 52 | protected void collectCells(ArrayList plats) { 53 | int count = plats.size(); 54 | if (count < PAGE_SIZE_P) { 55 | int lineCount = (count / lineSize); 56 | if (count % lineSize != 0) { 57 | lineCount++; 58 | } 59 | cells = new Object[1][lineCount * lineSize]; 60 | } else { 61 | int pageCount = (count / PAGE_SIZE_P); 62 | if (count % PAGE_SIZE_P != 0) { 63 | pageCount++; 64 | } 65 | cells = new Object[pageCount][PAGE_SIZE_P]; 66 | } 67 | 68 | for (int i = 0; i < count; i++) { 69 | int p = i / PAGE_SIZE_P; 70 | cells[p][i - PAGE_SIZE_P * p] = plats.get(i); 71 | } 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/cn/sharesdk/onekeyshare/themes/classic/port/PlatformPagePort.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 官网地站:http://www.mob.com 3 | * 技术支持QQ: 4006852216 4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复) 5 | * 6 | * Copyright (c) 2013年 mob.com. All rights reserved. 7 | */ 8 | 9 | package cn.sharesdk.onekeyshare.themes.classic.port; 10 | 11 | import java.util.ArrayList; 12 | 13 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl; 14 | import cn.sharesdk.onekeyshare.themes.classic.PlatformPage; 15 | import cn.sharesdk.onekeyshare.themes.classic.PlatformPageAdapter; 16 | 17 | /** 竖屏的九宫格页面 */ 18 | public class PlatformPagePort extends PlatformPage { 19 | 20 | public PlatformPagePort(OnekeyShareThemeImpl impl) { 21 | super(impl); 22 | } 23 | 24 | public void onCreate() { 25 | requestPortraitOrientation(); 26 | super.onCreate(); 27 | } 28 | 29 | protected PlatformPageAdapter newAdapter(ArrayList cells) { 30 | return new PlatformPageAdapterPort(this, cells); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/itheima/sharesdkdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.itheima.sharesdkdemo; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.view.View; 6 | 7 | import cn.sharesdk.framework.ShareSDK; 8 | import cn.sharesdk.onekeyshare.OnekeyShare; 9 | 10 | public class MainActivity extends AppCompatActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_main); 16 | ShareSDK.initSDK(this); 17 | } 18 | 19 | private void showShare() { 20 | 21 | OnekeyShare oks = new OnekeyShare(); 22 | //关闭sso授权 23 | oks.disableSSOWhenAuthorize(); 24 | 25 | // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间等使用 26 | oks.setTitle("标题"); 27 | // titleUrl是标题的网络链接,QQ和QQ空间等使用 28 | // oks.setTitleUrl("http://sharesdk.cn"); 29 | oks.setTitleUrl("http://www.toutiao.com/api/article/joke/a60662933718"); 30 | // text是分享文本,所有平台都需要这个字段 31 | oks.setText("我是分享文本"); 32 | // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数 33 | //oks.setImagePath("/sdcard/test.jpg");//确保SDcard下面存在此张图片 34 | // url仅在微信(包括好友和朋友圈)中使用 35 | oks.setUrl("http://sharesdk.cn"); 36 | // comment是我对这条分享的评论,仅在人人网和QQ空间使用 37 | oks.setComment("我是测试评论文本"); 38 | // site是分享此内容的网站名称,仅在QQ空间使用 39 | oks.setSite(getString(R.string.app_name)); 40 | // siteUrl是分享此内容的网站地址,仅在QQ空间使用 41 | oks.setSiteUrl("http://sharesdk.cn"); 42 | 43 | // 启动分享GUI 44 | oks.show(this); 45 | } 46 | 47 | public void onShare(View view) { 48 | showShare(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ssdk_oks_ptr_ptr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-hdpi/ssdk_oks_ptr_ptr.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_auth_title_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_auth_title_back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_back_arr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_back_arr.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_logo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_alipay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_alipay.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_alipaymoments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_alipaymoments.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_bluetooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_bluetooth.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_check_checked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_check_checked.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_check_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_check_default.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_dingding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_dingding.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_douban.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_douban.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_dropbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_dropbox.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_email.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_evernote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_evernote.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_facebook.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_facebookmessenger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_facebookmessenger.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_flickr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_flickr.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_foursquare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_foursquare.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_googleplus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_googleplus.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_instagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_instagram.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_instapaper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_instapaper.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kaixin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kaixin.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kakaostory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kakaostory.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kakaotalk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_kakaotalk.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_laiwang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_laiwang.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_laiwangmoments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_laiwangmoments.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_line.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_linkedin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_linkedin.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_meipai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_meipai.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_mingdao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_mingdao.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_pinterest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_pinterest.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_pocket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_pocket.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_qq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_qq.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_qzone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_qzone.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_renren.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_renren.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_shortmessage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_shortmessage.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_sinaweibo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_sinaweibo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_tencentweibo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_tencentweibo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_tumblr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_tumblr.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_twitter.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_vkontakte.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_vkontakte.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechat.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechatfavorite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechatfavorite.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechatmoments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_wechatmoments.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_whatsapp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_whatsapp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_yixin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_yixin.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_yixinmoments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_yixinmoments.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_youdao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_youdao.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_oks_classic_youtube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_oks_classic_youtube.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ssdk_title_div.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uncleleonfan/ShareSDKDemo/20bad46c9f6c04660ef0d9c5fa0b07eed98c3f0c/app/src/main/res/drawable-xhdpi/ssdk_title_div.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ssdk_oks_classic_platform_cell_back.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ssdk_oks_classic_progressbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 |