Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sd3970566 committed Oct 2, 2019
0 parents commit 9014cce
Show file tree
Hide file tree
Showing 54 changed files with 1,844 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
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 added .idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file added .idea/caches/gradle_models.ser
Binary file not shown.
113 changes: 113 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Pic/73C77BC738526A1E791A441427C23DE1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions README.md
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;
}
}
```

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
29 changes: 29 additions & 0 deletions app/build.gradle
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'
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
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
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());
}
}
Loading

0 comments on commit 9014cce

Please sign in to comment.