All Projects → shaohui10086 → Shareutil

shaohui10086 / Shareutil

Licence: apache-2.0
社会化登录分享工具库

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Shareutil

Rxtool
Android开发人员不得不收集的工具类集合 | 支付宝支付 | 微信支付(统一下单) | 微信分享 | Zip4j压缩(支持分卷压缩与加密) | 一键集成UCrop选择圆形头像 | 一键集成二维码和条形码的扫描与生成 | 常用Dialog | WebView的封装可播放视频 | 仿斗鱼滑动验证码 | Toast封装 | 震动 | GPS | Location定位 | 图片缩放 | Exif 图片添加地理位置信息(经纬度) | 蛛网等级 | 颜色选择器 | ArcGis | VTPK | 编译运行一下说不定会找到惊喜
Stars: ✭ 11,567 (+807.22%)
Mutual labels:  share, utils
Favicon Switcher
Make favicon react on media queries
Stars: ✭ 76 (-94.04%)
Mutual labels:  utils
Cfrs
Child Frame Read String
Stars: ✭ 46 (-96.39%)
Mutual labels:  utils
Freessr
【暂停更新】ssr 免费节点分享,每日更新
Stars: ✭ 69 (-94.59%)
Mutual labels:  share
Rambda
Faster and smaller alternative to Ramda
Stars: ✭ 1,066 (-16.39%)
Mutual labels:  utils
Schematics Utilities
🛠️ Useful exported utilities for working with Schematics
Stars: ✭ 73 (-94.27%)
Mutual labels:  utils
Pitaya
A simple general-purpose utility library for Java 6+
Stars: ✭ 38 (-97.02%)
Mutual labels:  utils
Notgif
Play & Share your GIFs in Photos
Stars: ✭ 84 (-93.41%)
Mutual labels:  share
Hr
A horizontal 📏 for your terminal
Stars: ✭ 1,195 (-6.27%)
Mutual labels:  utils
Ishare.js
iShare.js是一个小巧的分享插件,纯JS编写,不依赖任何第三方库,使用简便。
Stars: ✭ 67 (-94.75%)
Mutual labels:  share
Countdowntask
⌛️A countdown library for Android.
Stars: ✭ 64 (-94.98%)
Mutual labels:  utils
Bash Utils
utils for shell
Stars: ✭ 58 (-95.45%)
Mutual labels:  utils
Scritch
A small CLI to help you write sharable scripts for your team
Stars: ✭ 74 (-94.2%)
Mutual labels:  share
Sassyfication
💅Library with sass mixins to speed up your css workflow.
Stars: ✭ 51 (-96%)
Mutual labels:  utils
Night
Weekly Go Online Meetup via Bilibili|Go 夜读|通过 bilibili 在线直播的方式分享 Go 相关的技术话题,每天大家在微信/telegram/Slack 上及时沟通交流编程技术话题。
Stars: ✭ 10,058 (+688.86%)
Mutual labels:  share
Dnsforwarder
Just a DNS utility.
Stars: ✭ 1,029 (-19.29%)
Mutual labels:  utils
Share Selected Text
share selected text on twitter, buffer, and some others. Inspired by medium.com
Stars: ✭ 64 (-94.98%)
Mutual labels:  share
Imgursniper
📷 A quick and easy Image, Screenshot and Screen recording sharing tool
Stars: ✭ 69 (-94.59%)
Mutual labels:  share
Changelog Linker
[READ-ONLY] Make CHANGELOG.md Useful with Links
Stars: ✭ 85 (-93.33%)
Mutual labels:  utils
Mpermissionutils
Android6.0 运行时权限处理工具类
Stars: ✭ 84 (-93.41%)
Mutual labels:  utils

ShareUtil

ShareUtil是一个综合性的分享及登录工具库,支持微信分享,微博分享,QQ分享,QQ空间分享以及Android系统默认分享,支持微信登录,微博登录以及QQ登录并获取用户信息。

Preview

share login

Feature

  1. 多种分享方式:

  2. 支持分享图片本地链接,网络链接或者Bitmap, 不需要考虑各个平台的不一致性。

  3. 支持微信、QQ、微博登录并获取登录用户信息

Usage

添加依赖

免第三方Jar包配置

    compile 'me.shaohui.shareutil:shareutil:1.3.8'

手动添加第三方jar

	compile 'me.shaohui.shareutil:shareutil:1.3.8.no_jar'

使用配置

  1. build.gradle 配置 在defaultConfig节点下增加你的qq id信息

     defaultConfig {
     	...
     	
         manifestPlaceholders = [
                 //  替换成你的qq_id
                 qq_id: "123456789"
         ]
         
     }
    
  2. 在使用之前设置在各个平台申请的Id,以及分享的回调(推荐放在Application的onCreate方法中)

         // init
         ShareConfig config = ShareConfig.instance()
                 .qqId(QQ_ID)
                 .wxId(WX_ID)
                 .weiboId(WEIBO_ID)
                 // 下面两个,如果不需要登录功能,可不填写
                 .weiboRedirectUrl(REDIRECT_URL)
                 .wxSecret(WX_ID);
         ShareManager.init(config);
    

分享使用

    ShareUtil.shareImage(this, SharePlatform.QQ, "http://image.com", shareListener);
    ShareUtil.shareText(this, SharePlatform.WX, "分享文字", shareListener);
    ShareUtil.shareMedia(this, SharePlatform.QZONE, "title", "summary", "targetUrl", "thumb", shareListener);

登录使用

        // LoginPlatform.WEIBO  微博登录   
        // LoginPlatform.WX     微信登录
        // LoginPlatform.QQ     QQ登录 
        final LoginListener listener = new LoginListener() {
                @Override
                public void loginSuccess(LoginResult result) {
                    //登录成功, 如果你选择了获取用户信息,可以通过
                }
            
                @Override
                public void loginFailure(Exception e) {
                    Log.i("TAG", "登录失败");
                }
    
                @Override
                public void loginCancel() {
                    Log.i("TAG", "登录取消");
                }
            };
        LoginUtil.login(MainActivity.this, LoginPlatform.WEIBO, mLoginListener, isFetchUserInfo);

使用说明

  1. QQ不支持纯文字分享,会直接分享失败

  2. 使用Jar文件的版本如下:

     微信版本:3.1.1
     QQ版本:3.1.0 lite版
     微博版本: 3.1.4
    
  3. 分享的bitmap,会在分享之后被回收掉,所以分享之后最好不要再对该bitmap做任何操作。

  4. example 中的代码可以参考,但是不可运行,因为需要保证包名以及签名文件和你申请各个平台id所填写信息保持一致

  5. ShareListener的回调结果仅供参考,不可当做分享是否返回的依据,它并不是那么完全可靠,因为某些操作,例如微博分享取消,但是用户选择了保存草稿,这时候客户端并不会收到回调,所以也就不会调用ShareListener的onCancel

ChangeLog

1.3.8

  • 修复在低端设备上,可能导致的 NullPointException 问题

1.3.7

  • 修复微信分享大图没反应bug
  • 修复在5.0以下设备使用登录功能会意外收到登录取消回调

1.3.6

  • ShareUtil新增isInstalled方法,方便检查客户端是否安装

1.3.5

  • 修复QQ分享media类型错误
  • 完善log
  • 开放Application Context调用
  • 增加检查外部存储
  • 重构部分代码

1.3.3

  • 增加Debug模式

1.3.2

  • 修复若干分享相关的bug

1.3.1

  • 修复微博分享的bug

1.3.0

  • 重构使用方式,minSdkVersion - > 9

1.2.8

  • 增加分享失败Exception

1.2.7

  • 解决内存泄露的问题

TODO

  1. 微信内存泄露
  2. 图片加载失败,关闭Activity

Thanks

License

Copyright 2016 shaohui10086

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].