diff --git a/Share/.gitignore b/Share/.gitignore
new file mode 100644
index 000000000..42afabfd2
--- /dev/null
+++ b/Share/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/Share/build.gradle b/Share/build.gradle
new file mode 100644
index 000000000..039fa8b89
--- /dev/null
+++ b/Share/build.gradle
@@ -0,0 +1,73 @@
+apply plugin: 'com.android.library'
+apply plugin: 'img-optimizer'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+
+android {
+ compileSdkVersion rootProject.ext.android.compileSdkVersion
+ buildToolsVersion rootProject.ext.android.buildToolsVersion
+ packagingOptions {
+ pickFirst "lib/armeabi/libyuvutils.so"
+ pickFirst "lib/arm64-v8a/libyuvutils.so"
+ pickFirst "lib/armeabi-v7a/libyuvutils.so"
+ pickFirst "lib/armeabi/libyuvtools.so"
+ pickFirst "lib/arm64-v8a/libyuvtools.so"
+ pickFirst "lib/armeabi-v7a/libyuvtools.so"
+ exclude "lib/arm64-v8a/libmmcv_api_handgesture.so"
+ exclude "lib/arm64-v8a/libmmcv_api_express.so"
+ exclude "lib/arm64-v8a/libMediaEncoder.so"
+ exclude "lib/arm64-v8a/libarcore_sdk_c.so"
+ exclude "lib/arm64-v8a/libmediadecoder.so"
+ exclude "lib/arm64-v8a/libMediaMuxer.so"
+ exclude "lib/arm64-v8a/libarcore_sdk_jni.so"
+ exclude "lib/arm64-v8a/libMediaUtils.so"
+ exclude "lib/arm64-v8a/libcosmosffmpeg.so"
+
+ }
+
+ defaultConfig {
+ minSdkVersion rootProject.ext.android.minSdkVersion
+ targetSdkVersion rootProject.ext.android.targetSdkVersion
+ versionCode rootProject.ext.android.versionCode
+ versionName rootProject.ext.android.versionName
+ manifestPlaceholders = rootProject.ext.manifestPlaceholders
+ ndk {
+ abiFilters "armeabi-v7a", "arm64-v8a"
+ }
+ }
+ aaptOptions {
+ cruncherEnabled = false
+ useNewCruncher = false
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+repositories {
+ flatDir {
+ dirs 'libs', '../libs'
+ }
+}
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation rootProject.ext.dependencies["appcompat-androidx"]
+ implementation rootProject.ext.dependencies["recyclerview-androidx"]
+ //common
+ implementation project(path: ':common')
+ //Twitter
+ implementation 'com.twitter.sdk.android:twitter:3.1.1'
+ //facebook & Messenger
+ implementation 'com.facebook.android:facebook-share:15.2.0'
+
+
+
+}
diff --git a/Share/consumer-rules.pro b/Share/consumer-rules.pro
new file mode 100644
index 000000000..e69de29bb
diff --git a/Share/proguard-rules.pro b/Share/proguard-rules.pro
new file mode 100644
index 000000000..481bb4348
--- /dev/null
+++ b/Share/proguard-rules.pro
@@ -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
\ No newline at end of file
diff --git a/Share/src/androidTest/java/com/yunbao/share/ExampleInstrumentedTest.java b/Share/src/androidTest/java/com/yunbao/share/ExampleInstrumentedTest.java
new file mode 100644
index 000000000..73039a6f1
--- /dev/null
+++ b/Share/src/androidTest/java/com/yunbao/share/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package com.yunbao.share;
+
+import android.content.Context;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.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 Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ assertEquals("com.yunbao.share.test", appContext.getPackageName());
+ }
+}
\ No newline at end of file
diff --git a/Share/src/main/AndroidManifest.xml b/Share/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..e0f407337
--- /dev/null
+++ b/Share/src/main/AndroidManifest.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Share/src/main/java/com/yunbao/share/AbsShareInterface.java b/Share/src/main/java/com/yunbao/share/AbsShareInterface.java
new file mode 100644
index 000000000..618643b15
--- /dev/null
+++ b/Share/src/main/java/com/yunbao/share/AbsShareInterface.java
@@ -0,0 +1,25 @@
+package com.yunbao.share;
+
+import android.content.Context;
+import android.net.Uri;
+
+import androidx.core.content.FileProvider;
+
+import java.io.File;
+
+public abstract class AbsShareInterface {
+ protected final Context mContext;
+
+ public AbsShareInterface(Context context) {
+ this.mContext = context;
+ }
+
+ public abstract void share(ShareBuilder builder,ICallback callback);
+
+ public Uri fileToUri(File file){
+ return FileProvider.getUriForFile(mContext,
+ mContext.getPackageName() + ".fileprovider",
+ file
+ );
+ }
+}
diff --git a/Share/src/main/java/com/yunbao/share/ICallback.java b/Share/src/main/java/com/yunbao/share/ICallback.java
new file mode 100644
index 000000000..777da4d81
--- /dev/null
+++ b/Share/src/main/java/com/yunbao/share/ICallback.java
@@ -0,0 +1,6 @@
+package com.yunbao.share;
+
+public interface ICallback {
+ void onSuccess();
+ void onFailure();
+}
diff --git a/Share/src/main/java/com/yunbao/share/ShareBuilder.java b/Share/src/main/java/com/yunbao/share/ShareBuilder.java
new file mode 100644
index 000000000..96b4d0f51
--- /dev/null
+++ b/Share/src/main/java/com/yunbao/share/ShareBuilder.java
@@ -0,0 +1,40 @@
+package com.yunbao.share;
+
+import java.io.File;
+
+public class ShareBuilder {
+ private String text;
+ private String link;
+ private File file;
+
+ public static ShareBuilder builder(){
+ return new ShareBuilder();
+ }
+
+ public ShareBuilder setText(String text) {
+ this.text = text;
+ return this;
+ }
+
+ public ShareBuilder setLink(String link) {
+ this.link = link;
+ return this;
+ }
+
+ public ShareBuilder setFile(File file) {
+ this.file = file;
+ return this;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public File getFile() {
+ return file;
+ }
+}
diff --git a/Share/src/main/java/com/yunbao/share/ShareManager.java b/Share/src/main/java/com/yunbao/share/ShareManager.java
new file mode 100644
index 000000000..01c72b3b9
--- /dev/null
+++ b/Share/src/main/java/com/yunbao/share/ShareManager.java
@@ -0,0 +1,67 @@
+package com.yunbao.share;
+
+import android.content.Context;
+import android.content.IntentFilter;
+
+import com.twitter.sdk.android.tweetcomposer.TweetUploadService;
+import com.yunbao.share.platform.FacebookShare;
+import com.yunbao.share.platform.Instagram;
+import com.yunbao.share.platform.Line;
+import com.yunbao.share.platform.MessengerShare;
+import com.yunbao.share.platform.TwitterShare;
+import com.yunbao.share.platform.WhatsApp;
+import com.yunbao.share.receiver.TwitterResultReceiver;
+
+public class ShareManager {
+ public static final int SHARE_Twitter = 0;
+ public static final int SHARE_Facebook = 1;
+ public static final int SHARE_Instagram = 2;
+ public static final int SHARE_WhatsApp = 3;
+ public static final int SHARE_Line = 4;
+ public static final int SHARE_Messenger = 5;
+
+ private static ShareManager manager = null;
+
+ public static ShareManager getInstance(Context context) {
+ if (manager == null) {
+ manager = new ShareManager(context);
+ }
+ return manager;
+
+ }
+
+ private ShareManager(Context context) {
+ IntentFilter filter = new IntentFilter(TweetUploadService.UPLOAD_SUCCESS);
+ filter.addAction(TweetUploadService.UPLOAD_FAILURE);
+ filter.addAction(TweetUploadService.TWEET_COMPOSE_CANCEL);
+ context.registerReceiver(new TwitterResultReceiver(), filter);
+ }
+
+ public void createShare(ShareBuilder builder, Context context, int type, ICallback callback) {
+ AbsShareInterface share = null;
+ switch (type) {
+ case SHARE_Twitter:
+ share = new TwitterShare(context);
+ break;
+ case SHARE_Facebook:
+ share = new FacebookShare(context);
+ break;
+ case SHARE_Instagram:
+ share = new Instagram(context);
+ break;
+ case SHARE_WhatsApp:
+ share = new WhatsApp(context);
+ break;
+ case SHARE_Line:
+ share = new Line(context);
+ break;
+ case SHARE_Messenger:
+ share = new MessengerShare(context);
+ break;
+ }
+ if (share != null) {
+ share.share(builder, callback);
+ }
+ }
+
+}
diff --git a/Share/src/main/java/com/yunbao/share/platform/FacebookShare.java b/Share/src/main/java/com/yunbao/share/platform/FacebookShare.java
new file mode 100644
index 000000000..b5877f33a
--- /dev/null
+++ b/Share/src/main/java/com/yunbao/share/platform/FacebookShare.java
@@ -0,0 +1,52 @@
+package com.yunbao.share.platform;
+
+import android.app.Activity;
+import android.content.Context;
+import android.net.Uri;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+
+import com.facebook.CallbackManager;
+import com.facebook.FacebookCallback;
+import com.facebook.FacebookException;
+import com.facebook.share.Sharer;
+import com.facebook.share.model.ShareLinkContent;
+import com.facebook.share.widget.ShareDialog;
+import com.yunbao.common.utils.ToastUtil;
+import com.yunbao.share.AbsShareInterface;
+import com.yunbao.share.ICallback;
+import com.yunbao.share.ShareBuilder;
+
+public class FacebookShare extends AbsShareInterface {
+ public static CallbackManager callbackManager;
+ public FacebookShare(Context context) {
+ super(context);
+ }
+
+ @Override
+ public void share(ShareBuilder builder, ICallback callback) {
+ callbackManager= CallbackManager.Factory.create();
+ ShareLinkContent content = new ShareLinkContent.Builder()
+ .setContentUrl(Uri.parse(builder.getLink()))
+ .build();
+ ShareDialog dialog=new ShareDialog((Activity) mContext);
+ dialog.registerCallback(callbackManager, new FacebookCallback() {
+ @Override
+ public void onSuccess(Sharer.Result result) {
+ ToastUtil.show("Facebook分享成功");
+ }
+
+ @Override
+ public void onCancel() {
+ ToastUtil.show("Facebook分享取消");
+ }
+
+ @Override
+ public void onError(@NonNull FacebookException e) {
+ ToastUtil.show("Facebook分享失败:"+e.toString());
+ }
+ });
+ dialog.show(content);
+ }
+}
diff --git a/Share/src/main/java/com/yunbao/share/platform/Instagram.java b/Share/src/main/java/com/yunbao/share/platform/Instagram.java
new file mode 100644
index 000000000..34dd61e20
--- /dev/null
+++ b/Share/src/main/java/com/yunbao/share/platform/Instagram.java
@@ -0,0 +1,29 @@
+package com.yunbao.share.platform;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+
+import androidx.core.content.FileProvider;
+
+import com.yunbao.share.AbsShareInterface;
+import com.yunbao.share.ICallback;
+import com.yunbao.share.ShareBuilder;
+
+public class Instagram extends AbsShareInterface {
+ public Instagram(Context context) {
+ super(context);
+ }
+
+ @Override
+ public void share(ShareBuilder builder, ICallback callback) {
+ String type = "image/*";
+ Intent share = new Intent(Intent.ACTION_SEND);
+ Uri uri = fileToUri(builder.getFile());
+ share.setType(type);
+ share.putExtra(Intent.EXTRA_STREAM, uri);
+ share.setPackage("com.instagram.android");
+ mContext.startActivity(Intent.createChooser(share, "Share to"));
+ callback.onSuccess();
+ }
+}
diff --git a/Share/src/main/java/com/yunbao/share/platform/Line.java b/Share/src/main/java/com/yunbao/share/platform/Line.java
new file mode 100644
index 000000000..d3a081b47
--- /dev/null
+++ b/Share/src/main/java/com/yunbao/share/platform/Line.java
@@ -0,0 +1,33 @@
+package com.yunbao.share.platform;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+
+import com.yunbao.share.AbsShareInterface;
+import com.yunbao.share.ICallback;
+import com.yunbao.share.ShareBuilder;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.nio.charset.Charset;
+
+public class Line extends AbsShareInterface {
+
+ public Line(Context context) {
+ super(context);
+ }
+
+ @Override
+ public void share(ShareBuilder builder, ICallback callback) {
+ try {
+ Intent share = new Intent(Intent.ACTION_VIEW, Uri.parse("https://line.me/R/share?text=" + URLEncoder.encode(builder.getLink(), "UTF-8")));
+ mContext.startActivity(share);
+ callback.onSuccess();
+ } catch (UnsupportedEncodingException e) {
+ callback.onFailure();
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/Share/src/main/java/com/yunbao/share/platform/MessengerShare.java b/Share/src/main/java/com/yunbao/share/platform/MessengerShare.java
new file mode 100644
index 000000000..2d482fb85
--- /dev/null
+++ b/Share/src/main/java/com/yunbao/share/platform/MessengerShare.java
@@ -0,0 +1,63 @@
+package com.yunbao.share.platform;
+
+import android.app.Activity;
+import android.content.Context;
+import android.net.Uri;
+
+import androidx.annotation.NonNull;
+
+import com.facebook.CallbackManager;
+import com.facebook.FacebookCallback;
+import com.facebook.FacebookException;
+import com.facebook.share.Sharer;
+import com.facebook.share.model.ShareLinkContent;
+import com.facebook.share.model.SharePhoto;
+import com.facebook.share.model.SharePhotoContent;
+import com.facebook.share.widget.MessageDialog;
+import com.facebook.share.widget.ShareDialog;
+import com.yunbao.common.utils.ToastUtil;
+import com.yunbao.share.AbsShareInterface;
+import com.yunbao.share.ICallback;
+import com.yunbao.share.ShareBuilder;
+
+public class MessengerShare extends AbsShareInterface {
+ public static CallbackManager callbackManager;
+
+ public MessengerShare(Context context) {
+ super(context);
+ }
+
+ @Override
+ public void share(ShareBuilder builder, ICallback callback) {
+ callbackManager = CallbackManager.Factory.create();
+ /* ShareLinkContent content = new ShareLinkContent.Builder()
+ .setContentUrl(Uri.parse(builder.getLink()))
+ .build();*/
+ SharePhoto photo = new SharePhoto.Builder()
+ .setImageUrl(fileToUri(builder.getFile()))
+ .build();
+ SharePhotoContent content=new SharePhotoContent.Builder()
+ .addPhoto(photo)
+ .build();
+ MessageDialog dialog = new MessageDialog((Activity) mContext);
+ dialog.registerCallback(callbackManager, new FacebookCallback() {
+ @Override
+ public void onSuccess(Sharer.Result result) {
+ ToastUtil.show("Messenger分享成功");
+ }
+
+ @Override
+ public void onCancel() {
+ ToastUtil.show("Messenger分享取消");
+ }
+
+ @Override
+ public void onError(@NonNull FacebookException e) {
+ ToastUtil.show("Messenger分享失败:" + e.toString());
+ e.printStackTrace();
+ }
+ });
+ ToastUtil.show(dialog.canShow(content)+" <");
+ dialog.show(content);
+ }
+}
diff --git a/Share/src/main/java/com/yunbao/share/platform/TwitterShare.java b/Share/src/main/java/com/yunbao/share/platform/TwitterShare.java
new file mode 100644
index 000000000..3e15977b4
--- /dev/null
+++ b/Share/src/main/java/com/yunbao/share/platform/TwitterShare.java
@@ -0,0 +1,60 @@
+package com.yunbao.share.platform;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+
+import com.twitter.sdk.android.core.Callback;
+import com.twitter.sdk.android.core.Result;
+import com.twitter.sdk.android.core.Twitter;
+import com.twitter.sdk.android.core.TwitterApiClient;
+import com.twitter.sdk.android.core.TwitterAuthToken;
+import com.twitter.sdk.android.core.TwitterCore;
+import com.twitter.sdk.android.core.TwitterException;
+import com.twitter.sdk.android.core.TwitterSession;
+import com.twitter.sdk.android.core.identity.TwitterAuthClient;
+import com.twitter.sdk.android.core.services.AccountService;
+import com.twitter.sdk.android.tweetcomposer.ComposerActivity;
+import com.twitter.sdk.android.tweetcomposer.TweetComposer;
+import com.yunbao.share.AbsShareInterface;
+import com.yunbao.share.ICallback;
+import com.yunbao.share.ShareBuilder;
+
+public class TwitterShare extends AbsShareInterface {
+ public TwitterShare(Context context) {
+ super(context);
+ Twitter.initialize(context);
+
+ }
+
+ @Override
+ public void share(ShareBuilder date, ICallback callback) {
+
+/*
+ new TwitterAuthClient().authorize((Activity) mContext, new Callback() {
+ @Override
+ public void success(Result result) {
+ //获取以下登录成功返回信息进行登录验证
+
+ //获取登录用户信息
+ final TwitterSession activeSession=TwitterCore.getInstance().getSessionManager().getActiveSession();
+ Intent intent = new ComposerActivity.Builder(mContext)
+ .session(activeSession)
+ .image(fileToUri(date.getFile()))
+ .text(date.getText())
+ .hashtags("#twitter")
+ .createIntent();
+ mContext.startActivity(intent);
+
+ }
+ @Override
+ public void failure(TwitterException e) {
+ }
+ });*/
+
+ TweetComposer.Builder builder = new TweetComposer.Builder(mContext)
+ .text(date.getText())
+ .image(fileToUri(date.getFile()));
+ builder.show();
+ }
+}
diff --git a/Share/src/main/java/com/yunbao/share/platform/WhatsApp.java b/Share/src/main/java/com/yunbao/share/platform/WhatsApp.java
new file mode 100644
index 000000000..d8002d32c
--- /dev/null
+++ b/Share/src/main/java/com/yunbao/share/platform/WhatsApp.java
@@ -0,0 +1,24 @@
+package com.yunbao.share.platform;
+
+import android.content.Context;
+import android.content.Intent;
+
+import com.yunbao.share.AbsShareInterface;
+import com.yunbao.share.ICallback;
+import com.yunbao.share.ShareBuilder;
+
+public class WhatsApp extends AbsShareInterface {
+ public WhatsApp(Context context) {
+ super(context);
+ }
+
+ @Override
+ public void share(ShareBuilder builder, ICallback callback) {
+ Intent sendIntent = new Intent();
+ sendIntent.setAction(Intent.ACTION_SEND);
+ sendIntent.putExtra(Intent.EXTRA_TEXT, builder.getText());
+ sendIntent.setType("text/plain");
+ sendIntent.setPackage("com.whatsapp");
+ mContext.startActivity(sendIntent);
+ }
+}
diff --git a/Share/src/main/java/com/yunbao/share/receiver/TwitterResultReceiver.java b/Share/src/main/java/com/yunbao/share/receiver/TwitterResultReceiver.java
new file mode 100644
index 000000000..0ff6d9eb9
--- /dev/null
+++ b/Share/src/main/java/com/yunbao/share/receiver/TwitterResultReceiver.java
@@ -0,0 +1,28 @@
+package com.yunbao.share.receiver;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+import com.twitter.sdk.android.tweetcomposer.TweetUploadService;
+import com.yunbao.common.utils.ToastUtil;
+
+public class TwitterResultReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.i("分享log", "onReceive: "+intent.getAction());
+ if (TweetUploadService.UPLOAD_SUCCESS.equals(intent.getAction())) {
+ ToastUtil.show("推特分享成功");
+ // success
+ final Long tweetId = intent.getExtras().getLong(TweetUploadService.EXTRA_TWEET_ID);
+ } else if (TweetUploadService.UPLOAD_FAILURE.equals(intent.getAction())) {
+ // failure
+ ToastUtil.show("推特分享失败");
+ final Intent retryIntent = intent.getExtras().getParcelable(TweetUploadService.EXTRA_RETRY_INTENT);
+ } else if (TweetUploadService.TWEET_COMPOSE_CANCEL.equals(intent.getAction())) {
+ // cancel
+ ToastUtil.show("推特分享取消");
+ }
+ }
+}
diff --git a/Share/src/main/res/values/strings.xml b/Share/src/main/res/values/strings.xml
new file mode 100644
index 000000000..56f090ba5
--- /dev/null
+++ b/Share/src/main/res/values/strings.xml
@@ -0,0 +1,4 @@
+
+ ZWRrZnRUNlBlcHVxMXpsMzVmb2k6MTpjaQ
+ aq0eV4R1pqMK_AAeKRWnjPr7ErGMGgTPGgZJdm73WeRY-Kluws
+
\ No newline at end of file
diff --git a/Share/src/test/java/com/yunbao/share/ExampleUnitTest.java b/Share/src/test/java/com/yunbao/share/ExampleUnitTest.java
new file mode 100644
index 000000000..633872460
--- /dev/null
+++ b/Share/src/test/java/com/yunbao/share/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.yunbao.share;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/main/build.gradle b/main/build.gradle
index 7f44838fc..09093d9dc 100644
--- a/main/build.gradle
+++ b/main/build.gradle
@@ -73,6 +73,7 @@ dependencies {
api project(':video')
api project(':common')
api project(':FaceUnity')//新娱美颜
+ api project(':Share')//分享
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
diff --git a/main/src/main/java/com/yunbao/main/activity/TestActivity.java b/main/src/main/java/com/yunbao/main/activity/TestActivity.java
index d4094b529..b2ebdd7c7 100644
--- a/main/src/main/java/com/yunbao/main/activity/TestActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/TestActivity.java
@@ -1,23 +1,106 @@
package com.yunbao.main.activity;
+import android.content.Intent;
import android.os.Bundle;
+import android.os.Environment;
import android.text.SpannableStringBuilder;
+import android.util.Log;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.yunbao.main.R;
+import com.yunbao.share.ICallback;
+import com.yunbao.share.ShareBuilder;
+import com.yunbao.share.ShareManager;
+import com.yunbao.share.platform.FacebookShare;
+import com.yunbao.share.platform.MessengerShare;
+
+import java.io.File;
public class TestActivity extends AppCompatActivity {
private TextView contextLayout;
+ private ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_test);
- contextLayout = findViewById(R.id.context_layout);
- SpannableStringBuilder builder = new SpannableStringBuilder();
+ listView = new ListView(this);
+ setContentView(listView);
+ String[] strs = new String[]{
+ "Twitter",
+ "Facebook",
+ "Instagram",
+ "WhatsApp",
+ "Messenger",
+ "Line"
+ };
+ String filename = "/ztest/myPhoto.jpg";
+ String mediaPath = Environment.getExternalStorageDirectory() + filename;
+ File media = new File(mediaPath);
+ ShareBuilder builder = new ShareBuilder()
+ .setFile(media)
+ .setLink("http://blog.yutou233.cn")
+ .setText("测试Test http://blog.yutou233.cn");
+ ICallback callback = new ICallback() {
+ @Override
+ public void onSuccess() {
+ }
+
+ @Override
+ public void onFailure() {
+
+ }
+ };
+ listView.setAdapter(new ArrayAdapter(this, android.R.layout.simple_expandable_list_item_1, strs));
+ listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ switch (position) {
+ case 0:
+ ShareManager.getInstance(TestActivity.this)
+ .createShare(builder, TestActivity.this, ShareManager.SHARE_Twitter, callback);
+ break;
+ case 1:
+ ShareManager.getInstance(TestActivity.this)
+ .createShare(builder, TestActivity.this, ShareManager.SHARE_Facebook, callback);
+ break;
+ case 4:
+ ShareManager.getInstance(TestActivity.this)
+ .createShare(builder, TestActivity.this, ShareManager.SHARE_Messenger, callback);
+ break;
+ case 2:
+ ShareManager.getInstance(TestActivity.this)
+ .createShare(builder, TestActivity.this, ShareManager.SHARE_Instagram, callback);
+ break;
+ case 3:
+ ShareManager.getInstance(TestActivity.this)
+ .createShare(builder, TestActivity.this, ShareManager.SHARE_WhatsApp, callback);
+ break;
+ case 5:
+ ShareManager.getInstance(TestActivity.this)
+ .createShare(builder, TestActivity.this, ShareManager.SHARE_Line, callback);
+ break;
+
+ }
+ }
+ });
+ }
+
+ @Override
+ protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ Log.i("分享log", "onActivityResult() called with: requestCode = [" + requestCode + "], resultCode = [" + resultCode + "], data = [" + data + "]");
+ if (FacebookShare.callbackManager != null) {
+ FacebookShare.callbackManager.onActivityResult(requestCode, resultCode, data);
+ } else if (MessengerShare.callbackManager != null) {
+ MessengerShare.callbackManager.onActivityResult(requestCode, resultCode, data);
+ }
}
}
\ No newline at end of file
diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java
index 2ffc00e7e..4b8688cb1 100644
--- a/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java
+++ b/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java
@@ -50,6 +50,7 @@ import com.yunbao.live.utils.LiveStorge;
import com.yunbao.live.views.LiveRoomViewHolder;
import com.yunbao.main.R;
import com.yunbao.main.activity.MainActivity;
+import com.yunbao.main.activity.TestActivity;
import com.yunbao.main.adapter.MainHomeLiveAdapter;
import com.yunbao.main.adapter.MainHomeLivesClassAdapter;
import com.yunbao.main.http.MainHttpConsts;
@@ -368,7 +369,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
@Override
public void onBannerClick(List datas, int p) {
if (true) {
- System.err.println("cache = " + mContext.getCacheDir().getAbsolutePath());
+ /* System.err.println("cache = " + mContext.getCacheDir().getAbsolutePath());
String type = "image/*";
String filename = "/ztest/myPhoto.jpg";
String mediaPath = Environment.getExternalStorageDirectory() + filename;
@@ -392,7 +393,8 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
// share.setPackage("com.whatsapp"); //WhatsApp
// share = new Intent(Intent.ACTION_VIEW, Uri.parse("https://line.me/R/share?text=test")); //Line
- mContext.startActivity(Intent.createChooser(share, "Share to"));
+ mContext.startActivity(Intent.createChooser(share, "Share to"));*/
+ mContext.startActivity(new Intent(mContext, TestActivity.class));
return;
}
if (mBannerList != null) {
diff --git a/settings.gradle b/settings.gradle
index 80fd1059a..d78bfefaf 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,4 +1,6 @@
include ':app', ':video', ':common', ':main', ':baidu', ':live', ':lib_country_code'
include ':FaceUnity'
//include ':baidu'
-//include ':recognizer'//融云语音转文字模块
\ No newline at end of file
+//include ':recognizer'//融云语音转文字模块
+include ':Share'
+include ':Share'