-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9014cce
Showing
54 changed files
with
1,844 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
Binary file not shown.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# IntentShare | ||
这是一个关于本地分享的项目;提供使用Intent分享微信、QQ、QQ空间、新浪微博的一些方法。 | ||
|
||
|
||
[关于这个项目的一些简单介绍](https://www.jianshu.com/p/9522e24713e1) | ||
|
||
### 基本说明 | ||
关于微信分享 | ||
|
||
``` | ||
1.微信在6.6.7版本以后,已经不支持往朋友圈分享标题了 | ||
2.微信在6.7.3版本以后,已经不支持往朋友圈分享多图了 | ||
``` | ||
|
||
*** | ||
|
||
#### 这是Demo首页 | ||
<img src="https://github.com/gudd1991116/Raw/blob/master/ShareIntent/device-2019-06-11-100936.png" width="30%"/> | ||
|
||
### 使用方法 | ||
* 分享文本给微信好友 | ||
``` | ||
NativeShareTool.getInstance(this).shareWechatFriend("Test Test test!!!"); | ||
``` | ||
* 分享图片给微信好友 | ||
``` | ||
NativeShareTool.getInstance(this).shareWechatFriend(Resource.getInstance(mContext).getPicFile(),true); | ||
``` | ||
* 分享文件给微信好友 | ||
``` | ||
NativeShareTool.getInstance(this).shareWechatFriend(Resource.getInstance(mContext).getDocFile("contract.docx"),false); | ||
``` | ||
* 分享一张图片到微信朋友圈(朋友圈现已不支持分享多图和图文同时分享) | ||
``` | ||
NativeShareTool.getInstance(this).shareWechatMoment(Resource.getInstance(mContext).getPicFile()); | ||
``` | ||
* 分享文本给QQ好友 | ||
``` | ||
NativeShareTool.getInstance(this).shareQQ("Test test test!!!"); | ||
``` | ||
* 分享图片给QQ好友 | ||
``` | ||
NativeShareTool.getInstance(this).shareImageToQQ(getPicBit()); | ||
``` | ||
* 分享文件给QQ好友 | ||
``` | ||
NativeShareTool.getInstance(this).shareImageToQQ(Resource.getInstance(mContext).getDocFile("newpdf.pdf")); | ||
``` | ||
* 分享图片到QQ空间 | ||
``` | ||
NativeShareTool.getInstance(this).shareImageToQQZone(Resource.getInstance(mContext).getPicFile().getAbsolutePath()); | ||
``` | ||
* 分享图片到新浪好友 | ||
``` | ||
NativeShareTool.getInstance(this).shareToSinaFriends(MainActivity.this, true,Resource.getInstance(mContext).getPicFile().getAbsolutePath()); | ||
``` | ||
* 分享图片到新浪微博 | ||
``` | ||
NativeShareTool.getInstance(this).shareToSinaFriends(MainActivity.this, false,Resource.getInstance(mContext).getPicFile().getAbsolutePath()); | ||
``` | ||
### 将自己加入到QQ群 | ||
加入QQ群可以参考网站:https://qun.qq.com/join.html, 可以获取到QQ群相对应的key,使用提供的代码直接添加进入群 | ||
``` | ||
/**************** | ||
* 该群目前为我个人新建测试群,无聊的小盆友也可以加入进来壮大我的号,哈哈 | ||
* 发起添加群流程。群号:Android学习交流(610194891) 的 key 为: CXaQmSGNixYtgpaRuUlxd0CwyMhQYkd_ | ||
* 调用 joinQQGroup(CXaQmSGNixYtgpaRuUlxd0CwyMhQYkd_) 即可发起手Q客户端申请加群 Android学习交流(610194891) | ||
* | ||
* @param key 由官网生成的key | ||
* @return 返回true表示呼起手Q成功,返回fals表示呼起失败 | ||
******************/ | ||
public boolean joinQQGroup(String key) { | ||
Intent intent = new Intent(); | ||
intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D" + key)); | ||
// 此Flag可根据具体产品需要自定义,如设置,则在加群界面按返回,返回手Q主界面,不设置,按返回会返回到呼起产品界面 //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | ||
try { | ||
startActivity(intent); | ||
return true; | ||
} catch (Exception e) { | ||
// 未安装手Q或安装的版本不支持 | ||
return false; | ||
} | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 28 | ||
defaultConfig { | ||
applicationId "com.share.gudd.intentshare" | ||
minSdkVersion 15 | ||
targetSdkVersion 28 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation 'com.android.support:appcompat-v7:28.0.0' | ||
implementation 'com.android.support:recyclerview-v7:28.0.0' | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.3' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.2' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/share/gudd/intentshare/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.share.gudd.intentshare; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("com.share.gudd.intentshare", appContext.getPackageName()); | ||
} | ||
} |
Oops, something went wrong.