Merge branch 'dev_share'
# Conflicts: # main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java
This commit is contained in:
@@ -162,8 +162,8 @@ dependencies {
|
||||
api 'cn.rongcloud.sdk:im_kit:5.2.5.4' // 即时通讯 UI 基础组件
|
||||
//融云小视频模块
|
||||
api 'cn.rongcloud.sdk:sight:5.2.5.4'
|
||||
api 'com.facebook.android:facebook-android-sdk:15.0.1'
|
||||
implementation 'com.facebook.android:facebook-android-sdk:15.0.1'
|
||||
api 'com.facebook.android:facebook-android-sdk:15.2.0'
|
||||
implementation 'com.facebook.android:facebook-android-sdk:15.2.0'
|
||||
|
||||
api('com.twitter.sdk.android:twitter-core:3.1.1@aar') {
|
||||
transitive = true
|
||||
|
||||
@@ -21,6 +21,8 @@ public class CustomDrawerPopupEvent extends BaseModel {
|
||||
private boolean reportLayout = false;
|
||||
//刷新
|
||||
private boolean refresh = false;
|
||||
//特效設置
|
||||
private boolean effects = false;
|
||||
|
||||
public boolean isRefresh() {
|
||||
return refresh;
|
||||
@@ -102,4 +104,13 @@ public class CustomDrawerPopupEvent extends BaseModel {
|
||||
isDisMiss = disMiss;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isEffects() {
|
||||
return effects;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupEvent setEffects(boolean effects) {
|
||||
this.effects = effects;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yunbao.common.server;
|
||||
|
||||
import static android.content.Intent.EXTRA_CHOSEN_COMPONENT;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
public class ShareBroadcastReceiver extends BroadcastReceiver {
|
||||
public static final int REQUEST_CODE = 888;
|
||||
private static final String TAG = "分享log";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.i(TAG, "onReceive");
|
||||
Log.i(TAG, intent.getAction() + " | " + intent.getParcelableExtra(EXTRA_CHOSEN_COMPONENT));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -497,4 +497,13 @@ public class JavascriptInterfaceUtils {
|
||||
mWebView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
}
|
||||
@JavascriptInterface
|
||||
public void androidCommunityShare(String avatar,String link){
|
||||
JSONObject json=new JSONObject();
|
||||
json.put("avatar",avatar);
|
||||
json.put("link",link);
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidCommunityShare")
|
||||
.setData(json.toJSONString()));
|
||||
}
|
||||
}
|
||||
|
||||
53
common/src/main/java/com/yunbao/common/utils/ShareUtil.java
Normal file
53
common/src/main/java/com/yunbao/common/utils/ShareUtil.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import static android.app.PendingIntent.FLAG_IMMUTABLE;
|
||||
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
|
||||
import static android.content.Intent.EXTRA_CHOSEN_COMPONENT;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.yunbao.common.server.ShareBroadcastReceiver;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* 分享工具
|
||||
*/
|
||||
public class ShareUtil {
|
||||
|
||||
public static void share(Context context, String content) {
|
||||
share(context, content, null);
|
||||
}
|
||||
|
||||
public static void share(Context context, File image) {
|
||||
share(context, null, image);
|
||||
}
|
||||
|
||||
public static void share(Context context, String content, File image) {
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
|
||||
if (image != null) {
|
||||
Uri uri = Uri.fromFile(image);
|
||||
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
|
||||
shareIntent.setType("image/*");
|
||||
//当用户选择短信时使用sms_body取得文字
|
||||
shareIntent.putExtra("sms_body", content);
|
||||
} else {
|
||||
shareIntent.setType("text/plain");
|
||||
}
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, content);
|
||||
//自定义选择框的标题
|
||||
PendingIntent pi = PendingIntent.getBroadcast(context, ShareBroadcastReceiver.REQUEST_CODE,
|
||||
new Intent(context, ShareBroadcastReceiver.class), PendingIntent.FLAG_MUTABLE);
|
||||
context.registerReceiver(new ShareBroadcastReceiver(),new IntentFilter(EXTRA_CHOSEN_COMPONENT));
|
||||
shareIntent = Intent.createChooser(shareIntent, null, pi.getIntentSender());
|
||||
context.startActivity(Intent.createChooser(shareIntent, "Share"));
|
||||
//系统默认标题
|
||||
|
||||
}
|
||||
}
|
||||
@@ -93,13 +93,13 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
}
|
||||
}
|
||||
});
|
||||
//特效设置
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.effects_settings_layout), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
//分享
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.share_layout), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dismiss();
|
||||
if (callBack != null) {
|
||||
callBack.effectsSetting();
|
||||
callBack.share();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -203,6 +203,8 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
void online();
|
||||
|
||||
void reportLayout();
|
||||
|
||||
void share();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@@ -233,6 +235,10 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
dismiss();
|
||||
callBack.reportLayout();
|
||||
}
|
||||
if(event.isEffects()){
|
||||
dismiss();
|
||||
callBack.effectsSetting();
|
||||
}
|
||||
|
||||
}
|
||||
if (event.isRefresh()) {
|
||||
|
||||
@@ -22,6 +22,15 @@ public class MoreMenuPopupView extends AttachPopupView {
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
//特效设置
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.effects_settings_layout), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dismiss();
|
||||
Bus.get().post(new CustomDrawerPopupEvent()
|
||||
.setDisMiss(true).setEffects(true));
|
||||
}
|
||||
});
|
||||
//系统通知
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.system_notice), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
|
||||
@@ -41,27 +41,6 @@
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/effects_settings_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:src="@mipmap/live_more_icon_special_new" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/effects_settings"
|
||||
android:textColor="#FF9A9A9A"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/slide_settings_layout"
|
||||
@@ -85,6 +64,28 @@
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/share_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:src="@mipmap/ic_custom_share" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="分享設置"
|
||||
android:textColor="#FF9A9A9A"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/float_settings_layout"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="176dp"
|
||||
android:layout_width="220dp"
|
||||
android:layout_height="62dp"
|
||||
app:cardBackgroundColor="#0F0B14"
|
||||
app:cardCornerRadius="4dp"
|
||||
@@ -11,6 +11,27 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical">
|
||||
<LinearLayout
|
||||
android:id="@+id/effects_settings_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:src="@mipmap/live_more_icon_special_new" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/effects_settings"
|
||||
android:textColor="#FF9A9A9A"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/system_notice"
|
||||
|
||||
BIN
common/src/main/res/mipmap-xxhdpi/ic_custom_share.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/ic_custom_share.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Reference in New Issue
Block a user