├── README.md ├── .gitignore ├── ic_launcher-web.png ├── libs └── android-support-v4.jar ├── res ├── drawable-hdpi │ └── ic_launcher.png ├── drawable-mdpi │ └── ic_launcher.png ├── drawable-xhdpi │ └── ic_launcher.png ├── drawable-xxhdpi │ └── ic_launcher.png ├── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── values-v11 │ └── styles.xml ├── values-w820dp │ └── dimens.xml ├── values-v14 │ └── styles.xml ├── menu │ └── main.xml └── layout │ └── activity_main.xml ├── .classpath ├── project.properties ├── proguard-project.txt ├── .project ├── AndroidManifest.xml └── src └── com └── kevin └── share └── MainActivity.java /README.md: -------------------------------------------------------------------------------- 1 | # WeixinShare 2 | 微信分享到朋友圈及分享给朋友,不需要申请appid 直接分享 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .settings/ 2 | .gradle/ 3 | build/ 4 | bin/ 5 | gen/ 6 | proguard/ -------------------------------------------------------------------------------- /ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-app/WeiXinShare/HEAD/ic_launcher-web.png -------------------------------------------------------------------------------- /libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-app/WeiXinShare/HEAD/libs/android-support-v4.jar -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-app/WeiXinShare/HEAD/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-app/WeiXinShare/HEAD/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-app/WeiXinShare/HEAD/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-app/WeiXinShare/HEAD/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 微信分享 5 | 发送给朋友 6 | 发送到朋友圈 7 | 发送视频给朋友 8 | Hello world! 9 | 10 | -------------------------------------------------------------------------------- /res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 64dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | -------------------------------------------------------------------------------- /res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 13 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | WeiXinShare 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/com/kevin/share/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.kevin.share; 2 | 3 | import java.io.File; 4 | 5 | import android.app.Activity; 6 | import android.content.ComponentName; 7 | import android.content.Intent; 8 | import android.net.Uri; 9 | import android.os.Bundle; 10 | import android.os.Environment; 11 | import android.view.Menu; 12 | import android.view.MenuItem; 13 | 14 | public class MainActivity extends Activity { 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.activity_main); 20 | } 21 | 22 | @Override 23 | public boolean onCreateOptionsMenu(Menu menu) { 24 | getMenuInflater().inflate(R.menu.main, menu); 25 | return true; 26 | } 27 | 28 | @Override 29 | public boolean onOptionsItemSelected(MenuItem item) { 30 | 31 | File dir = Environment 32 | .getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM); 33 | 34 | File file = new File(dir, "/logo.png"); 35 | 36 | switch (item.getItemId()) { 37 | case R.id.action_share1: 38 | System.out.println(file.toURI()); 39 | 40 | shareToFriend(file); 41 | return true; 42 | case R.id.action_share2: 43 | 44 | System.out.println(file.toURI()); 45 | shareToTimeLine(file); 46 | 47 | return true; 48 | case R.id.action_share3: 49 | File video = new File(dir, "/test.mp4"); 50 | shareToFriendVideo(video); 51 | 52 | return true; 53 | default: 54 | return super.onOptionsItemSelected(item); 55 | 56 | } 57 | } 58 | 59 | private void shareToFriend(File file) { 60 | 61 | Intent intent = new Intent(); 62 | ComponentName comp = new ComponentName("com.tencent.mm", 63 | "com.tencent.mm.ui.tools.ShareImgUI"); 64 | intent.setComponent(comp); 65 | intent.setAction("android.intent.action.SEND"); 66 | intent.setType("image/*"); 67 | //intent.setFlags(0x3000001); 68 | intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); 69 | startActivity(intent); 70 | } 71 | 72 | private void shareToFriendVideo(File file) { 73 | 74 | Intent intent = new Intent(); 75 | ComponentName comp = new ComponentName("com.tencent.mm", 76 | "com.tencent.mm.ui.tools.ShareImgUI"); 77 | intent.setComponent(comp); 78 | intent.setAction("android.intent.action.SEND"); 79 | intent.setType("video/*"); 80 | //intent.setFlags(0x3000001); 81 | intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); 82 | startActivity(intent); 83 | } 84 | 85 | private void shareToTimeLine(File file) { 86 | Intent intent = new Intent(); 87 | ComponentName comp = new ComponentName("com.tencent.mm", 88 | "com.tencent.mm.ui.tools.ShareToTimeLineUI"); 89 | intent.setComponent(comp); 90 | intent.setAction("android.intent.action.SEND"); 91 | intent.setType("image/*"); 92 | //intent.setFlags(0x3000001); 93 | intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); 94 | startActivity(intent); 95 | } 96 | } 97 | --------------------------------------------------------------------------------