Compare commits
10 Commits
bdc7144cf8
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 10b2a06c90 | |||
| 145b015a71 | |||
| 0a69e7e496 | |||
| a93b7f33e1 | |||
| a7b7f38d31 | |||
| f1530a3173 | |||
| 821ac0bdc5 | |||
| 9be3406d52 | |||
| adba5618fd | |||
| 6c383a852b |
@@ -24,7 +24,7 @@ android {
|
||||
buildToolsVersion '33.0.0'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.jx.jyhd"
|
||||
applicationId "com.daoqi.lobby"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 32
|
||||
versionCode= 3
|
||||
|
||||
18
app/release/output-metadata.json
Normal file
18
app/release/output-metadata.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"version": 2,
|
||||
"artifactType": {
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "com.dq.jy",
|
||||
"variantName": "processReleaseResources",
|
||||
"elements": [
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"versionCode": 3,
|
||||
"versionName": "3.6.3",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -51,9 +51,9 @@ public class DouYinIntentShareHelper {
|
||||
douYinIntentShareUtil.setShareCallback(new DouYinIntentShareUtil.DouYinShareCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
((Activity) context).runOnUiThread(() ->
|
||||
Toast.makeText(context, "抖音分享成功", Toast.LENGTH_SHORT).show()
|
||||
);
|
||||
// ((Activity) context).runOnUiThread(() ->
|
||||
// Toast.makeText(context, "抖音分享成功", Toast.LENGTH_SHORT).show()
|
||||
// );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,15 +91,12 @@ public class DouYinIntentShareHelper {
|
||||
// }
|
||||
|
||||
// 根据分享目标类型执行不同的分享操作
|
||||
if ("private_message".equals(shareTarget)) {
|
||||
// 分享到私信
|
||||
shareToPrivateMessage(context, douYinIntentShareUtil, type, bean, imagePath);
|
||||
} else if ("group_chat".equals(shareTarget)) {
|
||||
// 分享到群聊
|
||||
shareToGroupChat(context, douYinIntentShareUtil, type, bean, imagePath);
|
||||
if (com.tsgame.tsgame_niuniu.util.EnvironmentUtil.isHarmonyOS()) {
|
||||
// 鸿蒙专属的抖音分享逻辑
|
||||
executeHarmonyDouYinShare(context, douYinIntentShareUtil, shareTarget, type, bean, imagePath);
|
||||
} else {
|
||||
// 默认分享到主页
|
||||
// shareToFeed(context, douYinIntentShareUtil, type, bean, imagePath);
|
||||
// 安卓的抖音分享逻辑
|
||||
executeAndroidDouYinShare(context, douYinIntentShareUtil, shareTarget, type, bean, imagePath);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -108,6 +105,23 @@ public class DouYinIntentShareHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private static void executeAndroidDouYinShare(Context context, DouYinIntentShareUtil douYinIntentShareUtil, String shareTarget, String type, sharetypeBean bean, String imagePath) {
|
||||
if ("private_message".equals(shareTarget)) {
|
||||
// 分享到私信
|
||||
shareToPrivateMessage(context, douYinIntentShareUtil, type, bean, imagePath);
|
||||
} else if ("group_chat".equals(shareTarget)) {
|
||||
// 分享到群聊
|
||||
shareToGroupChat(context, douYinIntentShareUtil, type, bean, imagePath);
|
||||
} else {
|
||||
// 默认分享到主页
|
||||
// shareToFeed(context, douYinIntentShareUtil, type, bean, imagePath);
|
||||
}
|
||||
}
|
||||
|
||||
private static void executeHarmonyDouYinShare(Context context, DouYinIntentShareUtil douYinIntentShareUtil, String shareTarget, String type, sharetypeBean bean, String imagePath) {
|
||||
// 当前默认调用通用的抖音分享,如需针对卓易通做鸿蒙定制分享可在此处扩展
|
||||
executeAndroidDouYinShare(context, douYinIntentShareUtil, shareTarget, type, bean, imagePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享到抖音私信
|
||||
@@ -201,8 +215,9 @@ public class DouYinIntentShareHelper {
|
||||
// 如果处理失败,退回到纯文本分享
|
||||
//douYinIntentShareUtil.shareToPrivateMessage((Activity) context, textContent, null, null);
|
||||
} else {
|
||||
// 只分享文本 - 直接使用Intent分享而不是复制粘贴方式
|
||||
shareWebPageDirectToDouYin((Activity) context, bean.getTitle(), bean.getDescription(), "");
|
||||
// 只分享文本 - 使用之前统一的弹窗引导方式
|
||||
DouYinIntentShareUtil util = DouYinIntentShareUtil.getInstance(context);
|
||||
util.shareWebpageToDouyin((Activity) context, "", bean.getTitle(), bean.getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,9 +351,9 @@ public class DouYinIntentShareHelper {
|
||||
douYinIntentShareUtil.setShareCallback(new DouYinIntentShareUtil.DouYinShareCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
((Activity) context).runOnUiThread(() ->
|
||||
Toast.makeText(context, "抖音分享成功", Toast.LENGTH_SHORT).show()
|
||||
);
|
||||
// ((Activity) context).runOnUiThread(() ->
|
||||
// Toast.makeText(context, "抖音分享成功", Toast.LENGTH_SHORT).show()
|
||||
// );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -357,8 +372,8 @@ public class DouYinIntentShareHelper {
|
||||
});
|
||||
|
||||
// 显示分享提示
|
||||
Toast.makeText(context, "正在分享到抖音", Toast.LENGTH_SHORT).show(); // 修改:直接调用Intent分享方法,而不是复制粘贴方式
|
||||
shareTextDirectToDouYin((Activity) context, text);
|
||||
Toast.makeText(context, "正在分享到抖音", Toast.LENGTH_SHORT).show(); // 修改:使用统一的引导弹窗方式
|
||||
douYinIntentShareUtil.shareTextToDouyin((Activity) context, text);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -417,11 +432,11 @@ public class DouYinIntentShareHelper {
|
||||
content.append(title).append("\n\n");
|
||||
}
|
||||
if (!TextUtils.isEmpty(description)) {
|
||||
content.append(description).append("\n\n");
|
||||
content.append(description);
|
||||
}
|
||||
if (!TextUtils.isEmpty(webUrl)) {
|
||||
content.append(webUrl);
|
||||
} String textContent = content.toString();
|
||||
// 用户要求不要链接的内容
|
||||
|
||||
String textContent = content.toString().trim();
|
||||
try {
|
||||
Context mContext = activity.getApplicationContext();
|
||||
// 设置缩略图 - 使用应用的启动图标 logo6 而不是 ic_launcher
|
||||
@@ -429,17 +444,19 @@ public class DouYinIntentShareHelper {
|
||||
mContext.getResources().getIdentifier("logo6", "drawable", mContext.getPackageName()));
|
||||
Uri imagePath = Base64ImageUtil.saveBitmapToFile(activity, thumbBmp, null);
|
||||
|
||||
// 方式1:尝试分享图文到私信(图片+文本)
|
||||
// 方式1:尝试分享图文
|
||||
if (imagePath != null) {
|
||||
shareImageWithTextDirectToDouYin(activity, textContent, imagePath);
|
||||
DouYinIntentShareUtil util = DouYinIntentShareUtil.getInstance(activity);
|
||||
util.shareToPrivateMessage(activity, textContent, imagePath, "image");
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 方式2:如果图片处理失败,使用纯文本直接分享
|
||||
shareTextDirectToDouYin(activity, textContent);
|
||||
// 方式2:如果图片处理失败,使用弹窗引导分享文本
|
||||
DouYinIntentShareUtil util = DouYinIntentShareUtil.getInstance(activity);
|
||||
util.shareWebpageToDouyin(activity, webUrl, title, description);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(activity, "网页分享出错: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
@@ -497,13 +514,11 @@ public class DouYinIntentShareHelper {
|
||||
content.append(title).append("\n\n");
|
||||
}
|
||||
if (!TextUtils.isEmpty(description)) {
|
||||
content.append(description).append("\n\n");
|
||||
}
|
||||
if (!TextUtils.isEmpty(webUrl)) {
|
||||
content.append(webUrl);
|
||||
content.append(description);
|
||||
}
|
||||
// 用户要求不要链接的内容
|
||||
|
||||
String textContent = content.toString();
|
||||
String textContent = content.toString().trim();
|
||||
|
||||
// 如果提供了预览图,先处理图片再分享
|
||||
if (!TextUtils.isEmpty(previewImageBase64)) {
|
||||
@@ -633,12 +648,6 @@ public class DouYinIntentShareHelper {
|
||||
*/
|
||||
public static void shareImageDirectToPrivateMessage(Activity activity, Bitmap bitmap) {
|
||||
try {
|
||||
// 检查抖音是否已安装 - HarmonyOS兼容性修改:移除强制检查
|
||||
// if (!isAppInstalled(activity, "com.ss.android.ugc.aweme")) {
|
||||
// Toast.makeText(activity, "抖音未安装,无法分享", Toast.LENGTH_SHORT).show();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 保存bitmap到文件
|
||||
File cacheDir = activity.getExternalCacheDir();
|
||||
if (cacheDir == null) {
|
||||
@@ -651,13 +660,18 @@ public class DouYinIntentShareHelper {
|
||||
fos.flush();
|
||||
fos.close();
|
||||
|
||||
// 获取图片URI
|
||||
Uri imageUri = FileProviderUtil.getUriForFile(activity, imageFile);
|
||||
if (imageUri != null) {
|
||||
// 创建专门用于私信分享的Intent
|
||||
shareImageToPrivateMessageIntent(activity, imageUri);
|
||||
if (!com.tsgame.tsgame_niuniu.util.EnvironmentUtil.isHarmonyOS()) {
|
||||
// 安卓环境:直接使用Util的shareImageToDouyin(与ref一致,Intent+setPackage拉起抖音)
|
||||
DouYinIntentShareUtil util = DouYinIntentShareUtil.getInstance(activity);
|
||||
util.shareImageToDouyin(activity, imageFile.getAbsolutePath());
|
||||
} else {
|
||||
Toast.makeText(activity, "获取图片文件失败", Toast.LENGTH_SHORT).show();
|
||||
// 鸿蒙/卓易通环境:使用剪贴板+引导弹窗
|
||||
Uri imageUri = FileProviderUtil.getUriForFile(activity, imageFile);
|
||||
if (imageUri != null) {
|
||||
shareImageToPrivateMessageIntent(activity, imageUri);
|
||||
} else {
|
||||
Toast.makeText(activity, "获取图片文件失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -672,8 +686,8 @@ public class DouYinIntentShareHelper {
|
||||
* @param imageUri 图片Uri
|
||||
*/
|
||||
/**
|
||||
* 使用剪贴板 + 弹窗引导的方式进行图片分享
|
||||
* 不再使用系统分享Intent,因为在鸿蒙/卓易通上兼容性问题较多
|
||||
* 鸿蒙/卓易通环境:使用剪贴板 + 弹窗引导的方式进行图片分享
|
||||
* 安卓环境应通过shareImageDirectToPrivateMessage直接调用Util的shareImageToDouyin
|
||||
*/
|
||||
private static void shareImageToPrivateMessageIntent(Activity activity, Uri imageUri) {
|
||||
try {
|
||||
@@ -855,216 +869,24 @@ public class DouYinIntentShareHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接分享网页到抖音(使用Intent方式,不是复制粘贴)
|
||||
*
|
||||
* @param activity 当前活动
|
||||
* @param title 网页标题
|
||||
* @param description 网页描述
|
||||
* @param webUrl 网页URL
|
||||
* 第一种方法:直接分享网页到抖音(废弃,接入工具类)
|
||||
*/
|
||||
public static void shareWebPageDirectToDouYin(Activity activity, String title, String description, String webUrl) {
|
||||
try {
|
||||
// 检查抖音是否已安装 - HarmonyOS兼容性修改:移除强制检查
|
||||
// if (!isAppInstalled(activity, "com.ss.android.ugc.aweme")) {
|
||||
// Toast.makeText(activity, "抖音未安装,无法分享", Toast.LENGTH_SHORT).show();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 构建要分享的文本内容
|
||||
StringBuilder content = new StringBuilder();
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
content.append(title).append("\n\n");
|
||||
}
|
||||
if (!TextUtils.isEmpty(description)) {
|
||||
content.append(description).append("\n\n");
|
||||
} if (!TextUtils.isEmpty(webUrl)) {
|
||||
content.append(webUrl);
|
||||
}
|
||||
|
||||
String textContent = content.toString();
|
||||
|
||||
// 方法1:先尝试直接启动抖音App
|
||||
if (tryLaunchDouyinDirectly(activity, textContent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 方法2:尝试使用多种MIME类型的分享Intent
|
||||
if (tryMultipleShareIntents(activity, textContent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 方法3:最后的备选方案 - 复制到剪贴板并引导用户
|
||||
fallbackCopyAndLaunch(activity, textContent);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(activity, "网页分享出错: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
DouYinIntentShareUtil util = DouYinIntentShareUtil.getInstance(activity);
|
||||
util.shareWebpageToDouyin(activity, webUrl, title, description);
|
||||
} /**
|
||||
* 直接分享图片和文本到抖音(使用Intent方式)
|
||||
* 直接分享图片和文本到抖音
|
||||
*/
|
||||
private static void shareImageWithTextDirectToDouYin(Activity activity, String text, Uri imageUri) {
|
||||
try {
|
||||
// 图片分享通常有更好的支持,先尝试图片分享
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("image/*");
|
||||
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, text);
|
||||
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
|
||||
// 检查抖音是否可以处理图片分享
|
||||
if (isIntentSafe(activity, shareIntent, "com.ss.android.ugc.aweme")) {
|
||||
shareIntent.setPackage("com.ss.android.ugc.aweme");
|
||||
// 添加额外参数尝试指定分享类型为私信
|
||||
shareIntent.putExtra("share_type", "private_message");
|
||||
shareIntent.putExtra("type", "private");
|
||||
|
||||
activity.startActivity(shareIntent);
|
||||
Toast.makeText(activity, "正在打开抖音图文分享...", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果直接分享失败,使用系统选择器
|
||||
Intent chooser = Intent.createChooser(shareIntent.setPackage(null), "分享图文");
|
||||
activity.startActivity(chooser);
|
||||
|
||||
new android.os.Handler(android.os.Looper.getMainLooper()).postDelayed(() -> {
|
||||
Toast.makeText(activity, "请选择抖音进行分享", Toast.LENGTH_LONG).show();
|
||||
}, 1000);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
// 如果图片分享失败,降级为纯文本分享
|
||||
Toast.makeText(activity, "图片分享失败,尝试文本分享", Toast.LENGTH_SHORT).show();
|
||||
shareTextDirectToDouYin(activity, text);
|
||||
}
|
||||
// 直接接入使用工具类分享图文的方法
|
||||
DouYinIntentShareUtil util = DouYinIntentShareUtil.getInstance(activity);
|
||||
util.shareToPrivateMessage(activity, text, imageUri, "image");
|
||||
}/**
|
||||
* 直接分享纯文本到抖音(使用Intent方式)
|
||||
* 直接分享纯文本到抖音(废弃,接入工具类)
|
||||
*/
|
||||
private static void shareTextDirectToDouYin(Activity activity, String text) {
|
||||
try {
|
||||
// 方法1:先尝试直接启动抖音App
|
||||
if (tryLaunchDouyinDirectly(activity, text)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 方法2:尝试使用多种MIME类型的分享Intent
|
||||
if (tryMultipleShareIntents(activity, text)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 方法3:最后的备选方案 - 复制到剪贴板并引导用户
|
||||
fallbackCopyAndLaunch(activity, text);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(activity, "文本分享失败: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法1:尝试直接启动抖音App并复制内容到剪贴板
|
||||
*/
|
||||
private static boolean tryLaunchDouyinDirectly(Activity activity, String content) {
|
||||
try {
|
||||
// 复制内容到剪贴板
|
||||
copyTextToClipboard(activity, content);
|
||||
|
||||
// 尝试直接启动抖音主页
|
||||
Intent launchIntent = activity.getPackageManager().getLaunchIntentForPackage("com.ss.android.ugc.aweme");
|
||||
if (launchIntent != null) {
|
||||
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.startActivity(launchIntent);
|
||||
|
||||
// 提示用户操作
|
||||
Toast.makeText(activity, "内容已复制到剪贴板,请在抖音中点击\"消息\"→选择联系人→粘贴发送", Toast.LENGTH_LONG).show();
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("DouYinShare", "直接启动抖音失败: " + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法2:尝试使用多种MIME类型创建分享Intent
|
||||
*/
|
||||
private static boolean tryMultipleShareIntents(Activity activity, String content) {
|
||||
// 尝试的MIME类型列表
|
||||
String[] mimeTypes = {
|
||||
"text/plain",
|
||||
"*/*",
|
||||
"application/octet-stream"
|
||||
};
|
||||
|
||||
for (String mimeType : mimeTypes) {
|
||||
try {
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType(mimeType);
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, content);
|
||||
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "网页分享");
|
||||
|
||||
// 检查是否有抖音可以处理这种Intent
|
||||
if (isIntentSafe(activity, shareIntent, "com.ss.android.ugc.aweme")) {
|
||||
shareIntent.setPackage("com.ss.android.ugc.aweme");
|
||||
activity.startActivity(shareIntent);
|
||||
Toast.makeText(activity, "正在打开抖音分享...", Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("DouYinShare", "MIME类型 " + mimeType + " 分享失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 如果直接分享失败,尝试使用系统分享选择器
|
||||
try {
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("text/plain");
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, content);
|
||||
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "网页分享");
|
||||
|
||||
Intent chooser = Intent.createChooser(shareIntent, "选择分享方式");
|
||||
activity.startActivity(chooser);
|
||||
|
||||
// 提示用户如果看不到抖音选项的解决方案
|
||||
new android.os.Handler(android.os.Looper.getMainLooper()).postDelayed(() -> {
|
||||
Toast.makeText(activity, "如果没有抖音选项,请选择\"复制\"然后手动打开抖音粘贴", Toast.LENGTH_LONG).show();
|
||||
}, 1000);
|
||||
return true;
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e("DouYinShare", "系统分享选择器失败: " + e.getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法3:备选方案 - 复制到剪贴板并引导用户手动操作
|
||||
*/
|
||||
private static void fallbackCopyAndLaunch(Activity activity, String content) {
|
||||
try {
|
||||
// 复制到剪贴板
|
||||
copyTextToClipboard(activity, content);
|
||||
|
||||
// 尝试启动抖音
|
||||
try {
|
||||
Intent launchIntent = activity.getPackageManager().getLaunchIntentForPackage("com.ss.android.ugc.aweme");
|
||||
if (launchIntent != null) {
|
||||
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.startActivity(launchIntent);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("DouYinShare", "启动抖音失败: " + e.getMessage());
|
||||
}
|
||||
|
||||
// 详细的操作指导
|
||||
Toast.makeText(activity, "内容已复制!请在抖音中:消息→选择好友→长按输入框→粘贴→发送", Toast.LENGTH_LONG).show();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(activity, "分享失败: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
DouYinIntentShareUtil util = DouYinIntentShareUtil.getInstance(activity);
|
||||
util.shareTextToDouyin(activity, text);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2279,9 +2279,11 @@ public class NewwebviewActivity extends AppCompatActivity implements
|
||||
sharetypeBean currentShareData = gson.fromJson(data, sharetypeBean.class);
|
||||
String scene = currentShareData.getSharefriend();
|
||||
if (scene.equals("2")){
|
||||
//朋友圈分享
|
||||
//直接调用微信分享
|
||||
WeChatShareHelper.doWeChatShare(NewwebviewActivity.this, data);
|
||||
//朋友圈分享: 抛弃 SDK,走重构后的无SDK统一流
|
||||
//com.tagmae.tsgame_erwang.WeChatShareHelper.doWeChatShare(NewwebviewActivity.this, data);
|
||||
// 直接在这里回调朋友圈分享成功
|
||||
Wxistrue.sharetype = 2;
|
||||
handler.sendEmptyMessage(2); // 2 为分享成功的状态码
|
||||
}else if (scene.equals("1")){
|
||||
//好友分享
|
||||
SharePanelHelper.showSharePanel(NewwebviewActivity.this, data);
|
||||
@@ -3474,13 +3476,7 @@ public class NewwebviewActivity extends AppCompatActivity implements
|
||||
|
||||
if (bean.getType().equals("1")) {
|
||||
|
||||
com.tsgame.tsgame_niuniu.util.WeChatIntentShareUtil.getInstance(this).shareWebPage(
|
||||
this,
|
||||
bean.getWebpageUrl(),
|
||||
bean.getTitle(),
|
||||
bean.getDescription(),
|
||||
com.tsgame.tsgame_niuniu.util.WeChatIntentShareUtil.SCENE_FRIENDS
|
||||
);
|
||||
WeChatShareHelper.doWeChatShare(this, new Gson().toJson(bean), false);
|
||||
|
||||
} else if (bean.getType().equals("2")) {
|
||||
|
||||
@@ -3597,69 +3593,12 @@ public class NewwebviewActivity extends AppCompatActivity implements
|
||||
}
|
||||
|
||||
private void photosharefriend() {
|
||||
// 使用新的微信分享辅助类替换原有的直接API调用
|
||||
// 废弃原先的 API 调用
|
||||
apputil.wxtype = 1;
|
||||
Wxistrue.sharetype = 2;
|
||||
|
||||
// 获取微信分享工具实例
|
||||
WeChatShareUtil weChatShareUtil = WeChatShareUtil.getInstance(this);
|
||||
|
||||
// 设置分享回调
|
||||
weChatShareUtil.setShareCallback(new WeChatShareUtil.WeChatShareCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
// 分享成功后的处理逻辑保持不变
|
||||
runOnUiThread(() -> {
|
||||
// 可以添加成功提示或其他逻辑
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String message) {
|
||||
// 分享失败后的处理逻辑
|
||||
runOnUiThread(() -> {
|
||||
// 可以添加失败提示或其他逻辑
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
// 分享取消后的处理逻辑
|
||||
runOnUiThread(() -> {
|
||||
// 可以添加取消提示或其他逻辑
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 使用getCanvasBase64FromWebView获取Canvas内容并分享
|
||||
WebViewScreenshotUtil.getCanvasBase64FromWebView(x5webview,null, new WebViewScreenshotUtil.CanvasToBase64Callback() { @Override
|
||||
public void onSuccess(String base64Data) {
|
||||
// getCanvasBase64FromWebView直接返回base64数据,不需要复杂的JSON解析
|
||||
try {
|
||||
if (base64Data != null && !base64Data.isEmpty()) {
|
||||
|
||||
|
||||
// 直接使用获取到的base64数据分享
|
||||
weChatShareUtil.shareImage(NewwebviewActivity.this, base64Data, 0);
|
||||
} else {
|
||||
|
||||
// 回退到原来的方法
|
||||
weChatShareUtil.shareImage(NewwebviewActivity.this, bitmappath, 0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
// 异常时回退到原来的方法
|
||||
weChatShareUtil.shareImage(NewwebviewActivity.this, bitmappath, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
// Toast.makeText(NewwebviewActivity.this, "截图失败成功"+error, Toast.LENGTH_SHORT).show();
|
||||
// Canvas获取失败,回退到原来的方法
|
||||
weChatShareUtil.shareImage(NewwebviewActivity.this, bitmappath, 0);
|
||||
}
|
||||
});
|
||||
// 组装bean并调用新的脱机Helper逻辑
|
||||
WeChatShareHelper.doWeChatShare(this, new Gson().toJson(bean), true);
|
||||
}
|
||||
|
||||
protected void sharefriends() {
|
||||
@@ -3669,13 +3608,7 @@ public class NewwebviewActivity extends AppCompatActivity implements
|
||||
|
||||
if (bean.getType().equals("1")) {
|
||||
System.out.println("hhhhhhh");
|
||||
com.tsgame.tsgame_niuniu.util.WeChatIntentShareUtil.getInstance(this).shareWebPage(
|
||||
this,
|
||||
bean.getWebpageUrl(),
|
||||
bean.getTitle(),
|
||||
bean.getDescription(),
|
||||
com.tsgame.tsgame_niuniu.util.WeChatIntentShareUtil.SCENE_MOMENTS
|
||||
);
|
||||
WeChatShareHelper.doWeChatShare(this, new Gson().toJson(bean), false);
|
||||
|
||||
} else if (bean.getType().equals("2")) {
|
||||
photosharefriends();
|
||||
@@ -3684,42 +3617,11 @@ public class NewwebviewActivity extends AppCompatActivity implements
|
||||
|
||||
}
|
||||
private void photosharefriends() {
|
||||
// 使用新的微信分享辅助类替换原有的直接API调用
|
||||
// 废弃原先的 API 调用
|
||||
apputil.wxtype = 1;
|
||||
Wxistrue.sharetype = 2;
|
||||
|
||||
// 获取微信分享工具实例
|
||||
WeChatShareUtil weChatShareUtil = WeChatShareUtil.getInstance(this);
|
||||
|
||||
// 设置分享回调
|
||||
weChatShareUtil.setShareCallback(new WeChatShareUtil.WeChatShareCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
// 分享成功后的处理逻辑保持不变
|
||||
runOnUiThread(() -> {
|
||||
// 可以添加成功提示或其他逻辑
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String message) {
|
||||
// 分享失败后的处理逻辑
|
||||
runOnUiThread(() -> {
|
||||
// 可以添加失败提示或其他逻辑
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
// 分享取消后的处理逻辑
|
||||
runOnUiThread(() -> {
|
||||
// 可以添加取消提示或其他逻辑
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 使用新的分享方法分享图片到微信朋友圈(scene = 1)
|
||||
weChatShareUtil.shareImage(this, bitmappath, 1);
|
||||
WeChatShareHelper.doWeChatShare(this, new Gson().toJson(bean), true);
|
||||
|
||||
System.out.println(bitmappath);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,17 @@ public class QQIntentShareHelper {
|
||||
|
||||
// 显示开始分享提示
|
||||
//Toast.makeText(context, "正在分享到QQ", Toast.LENGTH_SHORT).show();
|
||||
shareToQQ(context, qqIntentShareUtil, type, bean);
|
||||
|
||||
if (com.tsgame.tsgame_niuniu.util.EnvironmentUtil.isHarmonyOS()) {
|
||||
// 鸿蒙环境下的QQ分享逻辑
|
||||
// Toast.makeText(context, "isHarmonyOS", Toast.LENGTH_SHORT).show();
|
||||
shareToQQHarmony(context, qqIntentShareUtil, type, bean);
|
||||
} else {
|
||||
// 安卓环境下的QQ分享逻辑
|
||||
// Toast.makeText(context, "isAndroid", Toast.LENGTH_SHORT).show();
|
||||
shareToQQ(context, qqIntentShareUtil, type, bean);
|
||||
}
|
||||
|
||||
// 根据目标平台执行不同的分享操作
|
||||
// if ("2".equals(scene)) {
|
||||
// // 分享到QQ空间
|
||||
@@ -148,6 +158,73 @@ public class QQIntentShareHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 鸿蒙环境下的QQ分享处理逻辑
|
||||
*/
|
||||
private static void shareToQQHarmony(Context context, QQIntentShareUtil qqIntentShareUtil, String type, sharetypeBean bean) {
|
||||
|
||||
((Activity) context).runOnUiThread(() -> Toast.makeText(context, "shareToQQHarmony", Toast.LENGTH_SHORT).show());
|
||||
// 设置分享回调
|
||||
qqIntentShareUtil.setShareCallback(new QQIntentShareUtil.QQShareCallback() {
|
||||
@Override
|
||||
public void onSuccess() {}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {}
|
||||
|
||||
@Override
|
||||
public void onCancel() {}
|
||||
});
|
||||
|
||||
// 鸿蒙环境:直接调用 QQIntentShareUtil 内部封装的 _Harmony 方法
|
||||
if ("1".equals(type)) {
|
||||
// 纯文本分享
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String title = bean.getTitle();
|
||||
String description = bean.getDescription();
|
||||
if (!TextUtils.isEmpty(bean.getTitle())) {
|
||||
sb.append(title).append("\n\n");
|
||||
}
|
||||
if (!TextUtils.isEmpty(description)) {
|
||||
sb.append(description).append("\n\n");
|
||||
}
|
||||
String text = sb.toString().trim();
|
||||
|
||||
|
||||
// 因为 `shareTextToQQ` 内部已经通过 `EnvironmentUtil.isHarmonyOS()` 实现了分发!
|
||||
qqIntentShareUtil.shareTextToQQ((Activity) context, text);
|
||||
|
||||
} else if ("2".equals(type)) {
|
||||
// 图片分享 - 使用Canvas截图
|
||||
GlobalWebViewHelper.getCanvasBase64(new WebViewScreenshotUtil.CanvasToBase64Callback() {
|
||||
@Override
|
||||
public void onSuccess(String canvasBase64) {
|
||||
// 使用Canvas截图的base64数据
|
||||
Bitmap bitmap = Base64ImageUtil.base64ToBitmap(canvasBase64);
|
||||
// 同样,shareBitmapToQQ -> shareImageToQQ 内部也做了 isHarmonyOS() 分发
|
||||
qqIntentShareUtil.shareBitmapToQQ((Activity) context, bitmap, false);
|
||||
bitmap.recycle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
// 截图失败回调
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 网页链接分享
|
||||
// shareWebPageToQQ 内部最后调用的是 shareTextToQQ,同样具备 Harmony 分发能力
|
||||
qqIntentShareUtil.shareWebPageToQQ(
|
||||
(Activity) context,
|
||||
bean.getTitle(),
|
||||
bean.getDescription(),
|
||||
"",
|
||||
"",
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享到QQ空间
|
||||
*/
|
||||
|
||||
@@ -160,7 +160,8 @@ public class SharePanelHelper {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (currentShareData != null) {
|
||||
// 调用微信分享
|
||||
// 调用微信分享 (已脱离微信SDK)
|
||||
WeChatShareHelper.doWeChatShare(activity, new Gson().toJson(currentShareData));
|
||||
Toast.makeText(activity, "微信分享", Toast.LENGTH_SHORT).show();
|
||||
hideSharePanel(activity);
|
||||
}
|
||||
|
||||
@@ -2,34 +2,20 @@ package com.tagmae.tsgame_erwang;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Message;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.ImageRequest;
|
||||
import com.game.webgame.network.volleymanager;
|
||||
import com.google.gson.Gson;
|
||||
import com.jx.jyhd.simcpux.Util;
|
||||
import com.jx.jyhd.simcpux.Wxistrue;
|
||||
import com.jx.jyhd.simcpux.util.WeChatShareUtil;
|
||||
import com.tsgame.tsgame_niuniu.simcpux.bean.sharetypeBean;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.security.InvalidParameterException;
|
||||
import com.tsgame.tsgame_niuniu.util.WeChatIntentShareUtil;
|
||||
import com.tsgame.tsgame_niuniu.util.EnvironmentUtil;
|
||||
|
||||
/**
|
||||
* 微信分享辅助类
|
||||
* 微信分享辅助类(已脱离微信SDK重构版)
|
||||
*/
|
||||
public class WeChatShareHelper {
|
||||
|
||||
private static String bitmappath; /**
|
||||
* 微信分享
|
||||
/**
|
||||
* 微信分享(默认无Canvas)
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param jsonData 分享数据JSON字符串
|
||||
@@ -41,8 +27,8 @@ public class WeChatShareHelper {
|
||||
/**
|
||||
* 微信分享(支持Canvas截图)
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param jsonData 分享数据JSON字符串
|
||||
* @param context 上下文
|
||||
* @param jsonData 分享数据JSON字符串
|
||||
* @param useCanvas 是否使用Canvas截图(仅对图片分享type=2有效)
|
||||
*/
|
||||
public static void doWeChatShare(Context context, String jsonData, boolean useCanvas) {
|
||||
@@ -51,98 +37,131 @@ public class WeChatShareHelper {
|
||||
Gson gson = new Gson();
|
||||
sharetypeBean bean = gson.fromJson(jsonData, sharetypeBean.class);
|
||||
|
||||
// 初始化微信分享工具
|
||||
WeChatShareUtil weChatShareUtil = WeChatShareUtil.getInstance(context);
|
||||
// 初始化微信纯Intent分享工具
|
||||
WeChatIntentShareUtil weChatIntentShareUtil = WeChatIntentShareUtil.getInstance(context);
|
||||
|
||||
// 检查微信是否已安装
|
||||
if (!weChatShareUtil.isWeChatInstalled()) {
|
||||
if (!weChatIntentShareUtil.isWeChatInstalled()) {
|
||||
Toast.makeText(context, "微信未安装,无法进行微信分享", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置分享回调
|
||||
weChatShareUtil.setShareCallback(new WeChatShareUtil.WeChatShareCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
// ((Activity) context).runOnUiThread(() ->
|
||||
// Toast.makeText(context, "微信分享成功", Toast.LENGTH_SHORT).show()
|
||||
// );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String message) {
|
||||
// ((Activity) context).runOnUiThread(() ->
|
||||
// Toast.makeText(context, "微信分享失败: " + message, Toast.LENGTH_SHORT).show()
|
||||
// );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
// ((Activity) context).runOnUiThread(() ->
|
||||
// Toast.makeText(context, "微信分享已取消", Toast.LENGTH_SHORT).show()
|
||||
// );
|
||||
}
|
||||
});
|
||||
|
||||
// 处理分享类型字段
|
||||
if (bean.getType() == null) {
|
||||
bean.setType("");
|
||||
}
|
||||
|
||||
// 处理分享对象字段(朋友或朋友圈)
|
||||
if (bean.getSharefriend() == null) {
|
||||
bean.setSharefriend("");
|
||||
}
|
||||
|
||||
// 处理分享类型字段
|
||||
if (bean.getSharetype() == null) {
|
||||
bean.setSharetype("");
|
||||
}
|
||||
|
||||
// 确定分享场景(0:好友, 1:朋友圈)
|
||||
int scene = bean.getSharefriend().equals("1") ? 0 : 1; // 根据类型进行不同的分享处理
|
||||
if (bean.getType().equals("2")) {
|
||||
// 图片分享 - 使用Canvas截图
|
||||
GlobalWebViewHelper.getCanvasBase64(new WebViewScreenshotUtil.CanvasToBase64Callback() {
|
||||
@Override
|
||||
public void onSuccess(String canvasBase64) {
|
||||
// 使用Canvas截图的base64数据
|
||||
weChatShareUtil.shareImage(
|
||||
(Activity) context,
|
||||
canvasBase64, // Canvas截图的base64数据
|
||||
scene
|
||||
);
|
||||
}
|
||||
int scene = bean.getSharefriend().equals("1") ? WeChatIntentShareUtil.SCENE_FRIENDS
|
||||
: WeChatIntentShareUtil.SCENE_MOMENTS;
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
// Canvas截图失败,回退到原有的图片数据
|
||||
// String imagebitmapString = bean.getDescription();
|
||||
// weChatShareUtil.shareImage(
|
||||
// (Activity) context,
|
||||
// imagebitmapString, // 回退到原有数据
|
||||
// scene
|
||||
// );
|
||||
// 设置分享回调(区分朋友圈和好友场景)
|
||||
weChatIntentShareUtil.setShareCallback(new WeChatIntentShareUtil.WeChatShareCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
||||
// 如果仅需要通知前端朋友圈分享成功,可以在此处加 if(scene == WeChatIntentShareUtil.SCENE_MOMENTS) 判断
|
||||
if (scene == WeChatIntentShareUtil.SCENE_MOMENTS) {
|
||||
try {
|
||||
org.json.JSONObject json = new org.json.JSONObject();
|
||||
json.put("success", 2); // 2表示成功 1表示失败
|
||||
json.put("type", 2);
|
||||
|
||||
System.out.println("---分享成功回调JS: " + json.toString());
|
||||
((Activity) context).runOnUiThread(() -> {
|
||||
if (NewwebviewActivity.x5webview != null) {
|
||||
NewwebviewActivity.x5webview.callHandler("sharesuccess", json.toString(), new com.tagmae.jsbridge.CallBackFunction() {
|
||||
@Override
|
||||
public void onCallBack(String data) {
|
||||
//这里也是可以进行js回传的
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (org.json.JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
//Toast.makeText(context, "分享图片到微信" + (scene == 0 ? "好友" : "朋友圈"), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// 系统环境分流 (鸿蒙 vs 安卓)
|
||||
if (EnvironmentUtil.isHarmonyOS()) {
|
||||
executeHarmonyWeChatShare(context, weChatIntentShareUtil, bean, scene);
|
||||
} else {
|
||||
// 网页分享
|
||||
weChatShareUtil.shareWebPage(
|
||||
(Activity) context,
|
||||
bean.getWebpageUrl(), // 网页链接
|
||||
bean.getTitle(), // 标题
|
||||
bean.getDescription(), // 描述
|
||||
scene
|
||||
);
|
||||
// Toast.makeText(context, "分享网页到微信" + (scene == 0 ? "好友" : "朋友圈"), Toast.LENGTH_SHORT).show();
|
||||
executeAndroidWeChatShare(context, weChatIntentShareUtil, bean, scene);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//Toast.makeText(context, "微信分享异常: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行安卓环境下的微信分享
|
||||
*/
|
||||
private static void executeAndroidWeChatShare(Context context, WeChatIntentShareUtil util, sharetypeBean bean,
|
||||
int scene) {
|
||||
if (bean.getType().equals("2") || bean.getType().equals("3")) {
|
||||
if (scene == WeChatIntentShareUtil.SCENE_MOMENTS) {
|
||||
// 朋友圈分享:测试网络图片分享
|
||||
String testImageUrl = "https://tsgames.daoqi88.cn/image_download/download_cgmj.png";
|
||||
util.shareNetworkImage((Activity) context, testImageUrl, scene);
|
||||
} else {
|
||||
// 好友分享:原有的 Canvas 截图逻辑
|
||||
GlobalWebViewHelper.getCanvasBase64(new WebViewScreenshotUtil.CanvasToBase64Callback() {
|
||||
@Override
|
||||
public void onSuccess(String canvasBase64) {
|
||||
// canvasBase64转为Bitmap
|
||||
android.graphics.Bitmap bitmap = com.tagmae.tsgame_erwang.utils.Base64ImageUtil
|
||||
.base64ToBitmap(canvasBase64);
|
||||
util.shareBitmap((Activity) context, bitmap, scene);
|
||||
if (bitmap != null) {
|
||||
bitmap.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
// 截图失败处理
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 网页或文本分享
|
||||
util.shareWebPage(
|
||||
(Activity) context,
|
||||
bean.getWebpageUrl(),
|
||||
bean.getTitle(),
|
||||
bean.getDescription(),
|
||||
scene);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行鸿蒙环境下的微信分享
|
||||
*/
|
||||
private static void executeHarmonyWeChatShare(Context context, WeChatIntentShareUtil util, sharetypeBean bean,
|
||||
int scene) {
|
||||
// 由于已经使用了Intent分享工具,在工具内部也做了一定的鸿蒙兼容
|
||||
// 如果鸿蒙需要特殊的URI桥接、或者特殊的应用跳转方式,可以在此处定制鸿蒙代码
|
||||
// 目前暂时退化到通用Android方法或保持一致
|
||||
executeAndroidWeChatShare(context, util, bean, scene);
|
||||
}
|
||||
}
|
||||
@@ -3347,7 +3347,7 @@ public class webviewActivity extends AppCompatActivity implements
|
||||
|
||||
if (bean.getType().equals("1")) {
|
||||
|
||||
com.tsgame.tsgame_niuniu.util.WeChatIntentShareUtil.getInstance(this).shareWebPage(
|
||||
com.jx.jyhd.simcpux.util.WeChatShareUtil.getInstance(this).shareWebPage(
|
||||
this,
|
||||
bean.getWebpageUrl(),
|
||||
bean.getTitle(),
|
||||
@@ -3500,7 +3500,7 @@ public class webviewActivity extends AppCompatActivity implements
|
||||
Wxistrue.sharetype = 2;
|
||||
|
||||
if (bean.getType().equals("1")) {
|
||||
com.tsgame.tsgame_niuniu.util.WeChatIntentShareUtil.getInstance(this).shareWebPage(
|
||||
com.jx.jyhd.simcpux.util.WeChatShareUtil.getInstance(this).shareWebPage(
|
||||
this,
|
||||
bean.getWebpageUrl(),
|
||||
bean.getTitle(),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
package com.tsgame.tsgame_niuniu.util;
|
||||
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
public class EnvironmentUtil {
|
||||
|
||||
/**
|
||||
* 判断当前系统是否为鸿蒙系统 (HarmonyOS)
|
||||
* @return true=鸿蒙系统, false=安卓系统
|
||||
*/
|
||||
// public static boolean isHarmonyOS() {
|
||||
// try {
|
||||
// // 通过获取华为特定的构建类判断
|
||||
// Class<?> buildExClass = Class.forName("com.huawei.system.BuildEx");
|
||||
// Object osBrand = buildExClass.getMethod("getOsBrand").invoke(buildExClass);
|
||||
// if ("Harmony".equalsIgnoreCase(osBrand != null ? osBrand.toString() : null)) {
|
||||
// return true;
|
||||
// }
|
||||
// } catch (Throwable e) {
|
||||
// // ignore
|
||||
// }
|
||||
|
||||
// try {
|
||||
// // 备用判断:通过 ohos.system.version 判断
|
||||
// Class<?> clz = Class.forName("ohos.system.version.SystemVersion");
|
||||
// return clz != null;
|
||||
// } catch (Throwable e) {
|
||||
// // ignore
|
||||
// }
|
||||
|
||||
// return false;
|
||||
// }
|
||||
/**
|
||||
* 判断是否为鸿蒙系统
|
||||
*/
|
||||
public static boolean isHarmonyOS() {
|
||||
boolean isHarmony = false;
|
||||
try {
|
||||
Class<?> clz = Class.forName("com.huawei.system.BuildEx");
|
||||
java.lang.reflect.Method method = clz.getMethod("getOsBrand");
|
||||
String brand = (String) method.invoke(clz);
|
||||
if ("Harmony".equalsIgnoreCase(brand)) {
|
||||
isHarmony = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Ignored
|
||||
}
|
||||
if (!isHarmony) {
|
||||
try {
|
||||
Class<?> propertyClass = Class.forName("android.os.SystemProperties");
|
||||
java.lang.reflect.Method getMethod = propertyClass.getMethod("get", String.class);
|
||||
String version = (String) getMethod.invoke(propertyClass, "hw_sc.build.platform.version");
|
||||
isHarmony = !TextUtils.isEmpty(version);
|
||||
} catch (Exception e) {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
|
||||
return isHarmony;
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,24 @@ public class QQIntentShareUtil {
|
||||
private static final String QZONE_COMPONENT = "com.tencent.mobileqq.activity.QzonePublishMoodActivity";
|
||||
private static final String TIM_QZONE_COMPONENT = "com.tencent.tim.activity.QzonePublishMoodActivity";
|
||||
|
||||
/**
|
||||
* 动态获取分享组件(适配鸿蒙等定制系统)
|
||||
*/
|
||||
private ComponentName resolveShareComponent(Activity activity, Intent intent, String packageName) {
|
||||
try {
|
||||
List<android.content.pm.ResolveInfo> resolveInfoList =
|
||||
activity.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
if (resolveInfoList != null && !resolveInfoList.isEmpty()) {
|
||||
for (android.content.pm.ResolveInfo resolveInfo : resolveInfoList) {
|
||||
if (packageName.equals(resolveInfo.activityInfo.packageName)) {
|
||||
return new ComponentName(packageName, resolveInfo.activityInfo.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static QQIntentShareUtil instance;
|
||||
private final Context mContext;
|
||||
private QQShareCallback mCallback;
|
||||
@@ -208,56 +226,132 @@ public class QQIntentShareUtil {
|
||||
* @param text 要分享的文本
|
||||
*/
|
||||
public void shareTextToQQ(Activity activity, String text) {
|
||||
// 在鸿蒙卓易通环境下,不完全依赖isQQInstalled,尝试强制拉起
|
||||
boolean isPackageDetected = isQQInstalled();
|
||||
if (EnvironmentUtil.isHarmonyOS()) {
|
||||
shareTextToQQ_Harmony(activity, text);
|
||||
} else {
|
||||
shareTextToQQ_Android(activity, text);
|
||||
}
|
||||
}
|
||||
|
||||
/** Android环境:与ref一致的多级回退逻辑 */
|
||||
private void shareTextToQQ_Android(Activity activity, String text) {
|
||||
if (!isQQInstalled()) {
|
||||
handleNotInstalled(activity);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// 尝试复制文本到剪贴板,作为兜底
|
||||
try {
|
||||
copyToClipboard(activity, text);
|
||||
} catch (Exception e) {
|
||||
// 忽略剪贴板异常
|
||||
}
|
||||
// 1. 将文本复制到剪贴板
|
||||
copyToClipboard(activity, text);
|
||||
|
||||
// 2. 使用QQ的特定组件启动联系人选择界面
|
||||
String packageName = getInstalledQQPackage();
|
||||
boolean launched = false;
|
||||
|
||||
// 方法1: 尝试使用系统Chooser,这是最兼容的方式,特别适合鸿蒙环境
|
||||
try {
|
||||
// 方法1: 使用QQ的联系人选择器组件
|
||||
if (!launched) {
|
||||
try {
|
||||
Intent intent = new Intent();
|
||||
ComponentName comp = new ComponentName(packageName, "com.tencent.mobileqq.activity.contacts.SortContactsListActivity");
|
||||
intent.setComponent(comp);
|
||||
intent.putExtra("key_operation_type", 5);
|
||||
intent.putExtra("key_is_friend_chooser", 1);
|
||||
intent.putExtra("key_source_from", 12);
|
||||
intent.putExtra("isFromShare", true);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
activity.startActivity(intent);
|
||||
launched = true;
|
||||
Log.d(TAG, "成功使用联系人选择器组件启动QQ");
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "使用联系人选择器组件启动QQ失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 方法2: 使用与图片分享一致的规范Action拉起QQ分享组件
|
||||
if (!launched) {
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
ComponentName comp = new ComponentName(packageName, getQQShareComponent());
|
||||
intent.setComponent(comp);
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.startActivity(intent);
|
||||
launched = true;
|
||||
|
||||
// 提示用户文字已复制,手动粘贴分享
|
||||
Toast.makeText(activity, "已将内容复制到剪贴板,请选择好友后粘贴分享", Toast.LENGTH_LONG).show();
|
||||
|
||||
Log.d(TAG, "成功使用分享组件启动QQ");
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "使用分享组件启动QQ失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 方法3: 使用QQ的会话Activity
|
||||
if (!launched) {
|
||||
try {
|
||||
Intent intent = new Intent();
|
||||
ComponentName comp = new ComponentName(packageName, "com.tencent.mobileqq.activity.FriendlistActivity");
|
||||
intent.setComponent(comp);
|
||||
intent.putExtra("isFromShare", true);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.startActivity(intent);
|
||||
launched = true;
|
||||
// 提示用户文字已复制,手动粘贴分享
|
||||
Toast.makeText(activity, "已将内容复制到剪贴板,请选择好友后粘贴分享", Toast.LENGTH_LONG).show();
|
||||
Log.d(TAG, "成功使用好友列表Activity启动QQ");
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "使用好友列表Activity启动QQ失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 方法4: 使用通常的标准聊天组件
|
||||
if (!launched) {
|
||||
try {
|
||||
Intent intent = new Intent();
|
||||
ComponentName comp = new ComponentName(packageName, getQQChatComponent());
|
||||
intent.setComponent(comp);
|
||||
intent.putExtra("uinname", "");
|
||||
intent.putExtra("uintype", 0);
|
||||
intent.putExtra("isFromShare", true);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.startActivity(intent);
|
||||
launched = true;
|
||||
// 提示用户文字已复制,手动粘贴分享
|
||||
Toast.makeText(activity, "已将内容复制到剪贴板,请选择好友后粘贴分享", Toast.LENGTH_LONG).show();
|
||||
Log.d(TAG, "成功使用聊天组件启动QQ");
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "使用聊天组件启动QQ失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 如果以上方法都失败,回退到标准启动方法
|
||||
if (!launched) {
|
||||
try {
|
||||
Intent launchIntent = activity.getPackageManager().getLaunchIntentForPackage(packageName);
|
||||
if (launchIntent != null) {
|
||||
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.startActivity(launchIntent);
|
||||
launched = true;
|
||||
// 提示用户文字已复制,手动粘贴分享
|
||||
Toast.makeText(activity, "已将内容复制到剪贴板,请选择好友后粘贴分享", Toast.LENGTH_LONG).show();
|
||||
Log.d(TAG, "成功使用标准方式启动QQ");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "标准方式启动QQ失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 如果以上方法都失败,尝试系统分享
|
||||
if (!launched) {
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text);
|
||||
|
||||
// 鸿蒙/卓易通关键适配Flags
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
|
||||
// 如果检测到了包名,优先尝试指定包名,但不是必须的
|
||||
if (isPackageDetected) {
|
||||
intent.setPackage(packageName);
|
||||
activity.startActivity(intent);
|
||||
launched = true;
|
||||
} else {
|
||||
// 没有检测到包名,更需要使用Chooser,并提示用户选择QQ
|
||||
Intent chooser = Intent.createChooser(intent, "请选择QQ进行分享");
|
||||
chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.startActivity(chooser);
|
||||
launched = true;
|
||||
}
|
||||
|
||||
Log.d(TAG, "成功启动分享");
|
||||
activity.runOnUiThread(() -> Toast.makeText(activity, "已将内容复制到剪贴板,请在QQ中粘贴并分享", Toast.LENGTH_LONG).show());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "启动分享失败: " + e.getMessage());
|
||||
final String msg = "启动分享失败: " + e.getMessage();
|
||||
activity.runOnUiThread(() -> Toast.makeText(activity, msg, Toast.LENGTH_SHORT).show());
|
||||
}
|
||||
|
||||
// 方法2: 如果上面的方法失败,回退到原有的特定Intent启动逻辑
|
||||
if (!launched) {
|
||||
// 原有的逻辑保留作为备选...
|
||||
|
||||
// ... (原有代码可以保留在if (!launched)块中,或简化)
|
||||
Intent chooser = Intent.createChooser(intent, "分享到QQ");
|
||||
activity.startActivity(chooser);
|
||||
Toast.makeText(activity, "请从列表中选择QQ", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
// 假设分享过程启动成功
|
||||
@@ -268,9 +362,42 @@ public class QQIntentShareUtil {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "分享文本到QQ失败: " + e.getMessage(), e);
|
||||
handleShareException(activity, e);
|
||||
}
|
||||
}
|
||||
|
||||
// 最终兜底:提示手动分享
|
||||
Toast.makeText(activity, "暂无法直接拉起QQ,已复制内容,请手动打开QQ粘贴分享", Toast.LENGTH_LONG).show();
|
||||
/** 鸿蒙环境:使用系统分享面板 */
|
||||
private void shareTextToQQ_Harmony(Activity activity, String text) {
|
||||
// activity.runOnUiThread(() -> Toast.makeText(activity, "shareTextToQQ_Harmony", Toast.LENGTH_LONG).show());
|
||||
try {
|
||||
try {
|
||||
copyToClipboard(activity, text);
|
||||
} catch (Exception e) {
|
||||
// 忽略剪贴板异常
|
||||
}
|
||||
|
||||
// 鸿蒙系统下直接调用无针对性拦截的纯系统分享面板
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
|
||||
Intent chooser = Intent.createChooser(intent, "分享到...");
|
||||
chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.startActivity(chooser);
|
||||
|
||||
Log.d(TAG, "成功启动系统分享面板");
|
||||
// activity.runOnUiThread(() -> Toast.makeText(activity, "已将内容复制到剪贴板,请从列表中选择QQ并粘贴分享", Toast.LENGTH_LONG).show());
|
||||
|
||||
if (mCallback != null) {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
mCallback.onSuccess();
|
||||
}, 1000);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "分享文本到QQ失败: " + e.getMessage(), e);
|
||||
Toast.makeText(activity, "暂无法拉起分享,已复制内容", Toast.LENGTH_LONG).show();
|
||||
handleShareException(activity, e);
|
||||
}
|
||||
}
|
||||
@@ -316,15 +443,18 @@ public class QQIntentShareUtil {
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "分享文本到QQ空间失败: " + e.getMessage(), e);
|
||||
|
||||
// 尝试使用通用分享
|
||||
// 尝试使用通用系统分享
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
Intent chooser = Intent.createChooser(intent, "分享到QQ空间");
|
||||
// 在卓易通系统上,提前设置 package 会导致 createChooser 失效,因此改用排除法
|
||||
Intent chooser = createTargetedChooserIntent(activity, intent, "分享到QQ空间");
|
||||
chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.startActivity(chooser);
|
||||
Toast.makeText(activity, "已将内容复制到剪贴板,请从列表中选择QQ并粘贴分享", Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(activity, "已将内容复制到剪贴板,请从打开的界面中粘贴分享", Toast.LENGTH_LONG).show();
|
||||
|
||||
if (mCallback != null) {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
@@ -343,8 +473,19 @@ public class QQIntentShareUtil {
|
||||
* @param localImagePath 本地图片路径
|
||||
*/
|
||||
public void shareImageToQQ(Activity activity, String localImagePath) {
|
||||
// 在鸿蒙卓易通环境下,避免过早报错,尝试强制分享
|
||||
boolean isPackageDetected = isQQInstalled();
|
||||
if (EnvironmentUtil.isHarmonyOS()) {
|
||||
shareImageToQQ_Harmony(activity, localImagePath);
|
||||
} else {
|
||||
shareImageToQQ_Android(activity, localImagePath);
|
||||
}
|
||||
}
|
||||
|
||||
/** Android环境:与ref一致,使用JumpActivity直接拉起 */
|
||||
private void shareImageToQQ_Android(Activity activity, String localImagePath) {
|
||||
if (!isQQInstalled()) {
|
||||
handleNotInstalled(activity);
|
||||
return;
|
||||
}
|
||||
|
||||
File imageFile = new File(localImagePath);
|
||||
if (!imageFile.exists()) {
|
||||
@@ -358,73 +499,101 @@ public class QQIntentShareUtil {
|
||||
try {
|
||||
String packageName = getInstalledQQPackage();
|
||||
|
||||
// 创建分享Intent
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("image/*");
|
||||
|
||||
// 根据Android版本使用不同的Uri方式
|
||||
// 设置组件名称
|
||||
ComponentName comp = new ComponentName(packageName, getQQShareComponent());
|
||||
shareIntent.setComponent(comp);
|
||||
|
||||
Uri imageUri;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
// Android 7.0及以上使用FileProvider
|
||||
imageUri = FileProviderUtil.getUriForFile(activity, imageFile);
|
||||
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
} else {
|
||||
// Android 7.0以下直接使用文件Uri
|
||||
imageUri = Uri.fromFile(imageFile);
|
||||
}
|
||||
|
||||
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
|
||||
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
// 鸿蒙/卓易通关键适配Flags
|
||||
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
shareIntent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // 确保Flags也被设置在Intent上
|
||||
try {
|
||||
activity.startActivity(shareIntent);
|
||||
Log.d(TAG, "已发送分享图片Intent到QQ");
|
||||
|
||||
// 尝试直接拉起
|
||||
boolean launched = false;
|
||||
|
||||
if (isPackageDetected) {
|
||||
try {
|
||||
// 复制一份Intent用于尝试
|
||||
Intent directIntent = new Intent(shareIntent);
|
||||
ComponentName comp = new ComponentName(packageName, getQQShareComponent());
|
||||
directIntent.setComponent(comp);
|
||||
activity.startActivity(directIntent);
|
||||
launched = true;
|
||||
Log.d(TAG, "已发送分享图片Intent到QQ");
|
||||
activity.runOnUiThread(() -> Toast.makeText(activity, "已发送分享图片Intent到QQ", Toast.LENGTH_SHORT).show());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "直接分享到QQ失败: " + e.getMessage());
|
||||
final String failMsg = "直接分享失败: " + e.getMessage();
|
||||
activity.runOnUiThread(() -> Toast.makeText(activity, failMsg, Toast.LENGTH_SHORT).show());
|
||||
}
|
||||
}
|
||||
|
||||
// 如果直接拉起失败,或者未检测到包名,使用Chooser
|
||||
if (!launched) {
|
||||
try {
|
||||
Intent chooserIntent = Intent.createChooser(shareIntent, "分享到QQ");
|
||||
chooserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
chooserIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // 确保Chooser也有权限
|
||||
activity.startActivity(chooserIntent);
|
||||
launched = true;
|
||||
Log.d(TAG, "使用System Chooser分享图片");
|
||||
activity.runOnUiThread(() -> Toast.makeText(activity, "尝试使用System Chooser分享图片", Toast.LENGTH_SHORT).show());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Chooser分享失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if (launched) {
|
||||
if (mCallback != null) {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
mCallback.onSuccess();
|
||||
}, 1000);
|
||||
}
|
||||
} catch (android.content.ActivityNotFoundException e) {
|
||||
Log.e(TAG, "直接分享到QQ失败,尝试使用选择器: " + e.getMessage());
|
||||
|
||||
Intent chooserIntent = Intent.createChooser(shareIntent.setComponent(null), "分享到QQ");
|
||||
activity.startActivity(chooserIntent);
|
||||
Toast.makeText(activity, "请从列表中选择QQ", Toast.LENGTH_SHORT).show();
|
||||
|
||||
if (mCallback != null) {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
mCallback.onSuccess();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "分享图片到QQ失败: " + e.getMessage(), e);
|
||||
handleShareException(activity, e);
|
||||
}
|
||||
}
|
||||
|
||||
/** 鸿蒙环境:使用系统分享面板 */
|
||||
private void shareImageToQQ_Harmony(Activity activity, String localImagePath) {
|
||||
File imageFile = new File(localImagePath);
|
||||
if (!imageFile.exists()) {
|
||||
Toast.makeText(activity, "分享图片不存在", Toast.LENGTH_SHORT).show();
|
||||
if (mCallback != null) {
|
||||
mCallback.onError(-2, "图片文件不存在");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("image/*");
|
||||
|
||||
Uri imageUri;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
imageUri = FileProviderUtil.getUriForFile(activity, imageFile);
|
||||
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
} else {
|
||||
Toast.makeText(activity, "分享图片失败,请手动打开QQ分享", Toast.LENGTH_SHORT).show();
|
||||
imageUri = Uri.fromFile(imageFile);
|
||||
}
|
||||
|
||||
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
|
||||
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
shareIntent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
|
||||
try {
|
||||
// 鸿蒙系统下直接调用无针对性拦截的纯系统分享面板
|
||||
Intent chooserIntent = Intent.createChooser(shareIntent, "分享图片到...");
|
||||
chooserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
chooserIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
|
||||
activity.startActivity(chooserIntent);
|
||||
Log.d(TAG, "已发送分享图片Intent到纯系统面板");
|
||||
|
||||
activity.runOnUiThread(() -> Toast.makeText(activity, "请从列表中选择QQ进行分享", Toast.LENGTH_SHORT).show());
|
||||
|
||||
if (mCallback != null) {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
mCallback.onSuccess();
|
||||
}, 1000);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "启动分享图片到QQ系统面板失败: " + e.getMessage());
|
||||
final String failMsg = "分享失败: " + e.getMessage();
|
||||
activity.runOnUiThread(() -> Toast.makeText(activity, failMsg, Toast.LENGTH_SHORT).show());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "分享图片到QQ失败: " + e.getMessage(), e);
|
||||
handleShareException(activity, e);
|
||||
@@ -487,12 +656,12 @@ public class QQIntentShareUtil {
|
||||
}, 1000);
|
||||
}
|
||||
} catch (android.content.ActivityNotFoundException e) {
|
||||
Log.e(TAG, "直接分享到QQ空间失败,尝试使用选择器: " + e.getMessage());
|
||||
Log.e(TAG, "直接分享到QQ空间失败,尝试系统分享: " + e.getMessage());
|
||||
|
||||
// 如果直接分享失败,使用选择器
|
||||
Intent chooserIntent = Intent.createChooser(shareIntent.setComponent(null), "分享到QQ空间");
|
||||
// 采用调用系统分享,并排除其他组件以过滤出QQ
|
||||
Intent chooserIntent = createTargetedChooserIntent(activity, shareIntent, "分享到QQ空间");
|
||||
chooserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.startActivity(chooserIntent);
|
||||
Toast.makeText(activity, "请从列表中选择QQ", Toast.LENGTH_SHORT).show();
|
||||
|
||||
// 假设分享成功
|
||||
if (mCallback != null) {
|
||||
@@ -555,6 +724,20 @@ public class QQIntentShareUtil {
|
||||
* @param isQzone 是否分享到QQ空间
|
||||
*/
|
||||
public void shareImagesToQQ(Activity activity, ArrayList<String> imagePaths, boolean isQzone) {
|
||||
if (EnvironmentUtil.isHarmonyOS()) {
|
||||
shareImagesToQQ_Harmony(activity, imagePaths, isQzone);
|
||||
} else {
|
||||
shareImagesToQQ_Android(activity, imagePaths, isQzone);
|
||||
}
|
||||
}
|
||||
|
||||
/** Android环境:与ref一致 */
|
||||
private void shareImagesToQQ_Android(Activity activity, ArrayList<String> imagePaths, boolean isQzone) {
|
||||
if (!isQQInstalled()) {
|
||||
handleNotInstalled(activity);
|
||||
return;
|
||||
}
|
||||
|
||||
if (imagePaths == null || imagePaths.isEmpty()) {
|
||||
Toast.makeText(activity, "分享图片为空", Toast.LENGTH_SHORT).show();
|
||||
if (mCallback != null) {
|
||||
@@ -568,13 +751,10 @@ public class QQIntentShareUtil {
|
||||
for (String path : imagePaths) {
|
||||
File file = new File(path);
|
||||
if (file.exists()) {
|
||||
// 根据Android版本使用不同的Uri方式
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
// Android 7.0及以上使用FileProvider
|
||||
Uri fileUri = FileProviderUtil.getUriForFile(activity, file);
|
||||
imageUris.add(fileUri);
|
||||
} else {
|
||||
// Android 7.0以下直接使用文件Uri
|
||||
imageUris.add(Uri.fromFile(file));
|
||||
}
|
||||
}
|
||||
@@ -589,9 +769,84 @@ public class QQIntentShareUtil {
|
||||
}
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
|
||||
// 获取已安装的QQ包名
|
||||
String packageName = getInstalledQQPackage();
|
||||
//intent.setPackage(packageName); // 不再强制依赖包名
|
||||
intent.setPackage(packageName);
|
||||
intent.setType("image/*");
|
||||
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
|
||||
|
||||
// 设置组件名称
|
||||
if (isQzone) {
|
||||
ComponentName comp = new ComponentName(packageName, getQZoneShareComponent());
|
||||
intent.setComponent(comp);
|
||||
} else {
|
||||
ComponentName comp = new ComponentName(packageName, getQQShareComponent());
|
||||
intent.setComponent(comp);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
}
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
try {
|
||||
activity.startActivity(intent);
|
||||
Log.d(TAG, "已发送多图分享Intent到QQ");
|
||||
|
||||
if (mCallback != null) {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
mCallback.onSuccess();
|
||||
}, 1000);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "多图直接分享失败,使用系统分享: " + e.getMessage());
|
||||
Intent chooser = Intent.createChooser(intent.setComponent(null), isQzone ? "分享到QQ空间" : "分享到QQ");
|
||||
activity.startActivity(chooser);
|
||||
Toast.makeText(activity, "请从列表中选择QQ", Toast.LENGTH_SHORT).show();
|
||||
|
||||
if (mCallback != null) {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
mCallback.onSuccess();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleShareException(activity, e);
|
||||
}
|
||||
}
|
||||
|
||||
/** 鸿蒙环境:使用系统分享面板 */
|
||||
private void shareImagesToQQ_Harmony(Activity activity, ArrayList<String> imagePaths, boolean isQzone) {
|
||||
if (imagePaths == null || imagePaths.isEmpty()) {
|
||||
Toast.makeText(activity, "分享图片为空", Toast.LENGTH_SHORT).show();
|
||||
if (mCallback != null) {
|
||||
mCallback.onError(-1, "分享图片为空");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
ArrayList<Uri> imageUris = new ArrayList<>();
|
||||
for (String path : imagePaths) {
|
||||
File file = new File(path);
|
||||
if (file.exists()) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
Uri fileUri = FileProviderUtil.getUriForFile(activity, file);
|
||||
imageUris.add(fileUri);
|
||||
} else {
|
||||
imageUris.add(Uri.fromFile(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (imageUris.isEmpty()) {
|
||||
Toast.makeText(activity, "没有有效图片可分享", Toast.LENGTH_SHORT).show();
|
||||
if (mCallback != null) {
|
||||
mCallback.onError(-1, "没有有效图片可分享");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
|
||||
intent.setType("image/*");
|
||||
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
|
||||
|
||||
@@ -599,46 +854,26 @@ public class QQIntentShareUtil {
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
}
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); // 鸿蒙卓易通适配
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
|
||||
boolean launched = false;
|
||||
boolean isPackageDetected = isQQInstalled();
|
||||
|
||||
if (isPackageDetected) {
|
||||
try {
|
||||
Intent directIntent = new Intent(intent);
|
||||
// 设置组件名称
|
||||
if (isQzone) {
|
||||
ComponentName comp = new ComponentName(packageName, getQZoneShareComponent());
|
||||
directIntent.setComponent(comp);
|
||||
} else {
|
||||
ComponentName comp = new ComponentName(packageName, getQQShareComponent());
|
||||
directIntent.setComponent(comp);
|
||||
}
|
||||
activity.startActivity(directIntent);
|
||||
launched = true;
|
||||
Log.d(TAG, "已发送多图分享Intent到QQ");
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "直接分享多图到QQ失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if (!launched) {
|
||||
Intent chooser = Intent.createChooser(intent, isQzone ? "分享到QQ空间" : "分享到QQ");
|
||||
try {
|
||||
// 鸿蒙系统下直接调用无针对性拦截的纯系统分享面板
|
||||
Intent chooser = Intent.createChooser(intent, isQzone ? "分享到QQ空间" : "分享到...");
|
||||
chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
chooser.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
activity.startActivity(chooser);
|
||||
Log.d(TAG, "使用System Chooser分享多图");
|
||||
launched = true;
|
||||
}
|
||||
|
||||
if (launched) {
|
||||
// 延迟回调成功
|
||||
activity.startActivity(chooser);
|
||||
Log.d(TAG, "已打开纯系统分享面板进行多图分享");
|
||||
|
||||
activity.runOnUiThread(() -> Toast.makeText(activity, "请从列表中选择QQ进行分享", Toast.LENGTH_SHORT).show());
|
||||
|
||||
if (mCallback != null) {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
mCallback.onSuccess();
|
||||
}, 1000);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "开启系统多图分享到QQ失败: " + e.getMessage());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -734,6 +969,66 @@ public class QQIntentShareUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建排除特定组件(如抖音)的系统分享选择器
|
||||
* 在卓易通等环境下,给 intent setPackage 会导致 createChooser 直接失效不弹窗,
|
||||
* 所以我们通过原生的 intent 送入 createChooser,然后利用 EXTRA_EXCLUDE_COMPONENTS 排除抖音。
|
||||
*/
|
||||
private Intent createTargetedChooserIntent(Activity activity, Intent targetIntent, CharSequence title) {
|
||||
String packageName = getInstalledQQPackage();
|
||||
|
||||
// 清理现场:如果带有被隐式拦截的 package 再去查询,查出来的结果是空的。
|
||||
targetIntent.setPackage(null);
|
||||
targetIntent.setComponent(null);
|
||||
|
||||
PackageManager pm = activity.getPackageManager();
|
||||
|
||||
try {
|
||||
// 第一步:全局海选。不再限定包名,直接拿最原始的 intent 去查手机里【所有的】分享接收器。
|
||||
// 这样能避开卓易通对 setPackage 隐式意图的严格 API 拦截。
|
||||
List<android.content.pm.ResolveInfo> resInfo = pm.queryIntentActivities(targetIntent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
ComponentName selectedComponent = null;
|
||||
|
||||
if (resInfo != null && !resInfo.isEmpty()) {
|
||||
// 遍历系统诚实返回的列表,自己把 QQ 挑出来
|
||||
for (android.content.pm.ResolveInfo info : resInfo) {
|
||||
if (info.activityInfo != null && packageName.equals(info.activityInfo.packageName)) {
|
||||
// 抓到了!系统真正在当前操作(文字/图片分享)下分配的 QQ 接收组件名!
|
||||
selectedComponent = new ComponentName(info.activityInfo.packageName, info.activityInfo.name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedComponent != null) {
|
||||
// 找到完美的对应组件,走显式跳转,直接砸过去!不经过 Chooser,绝对没有抖音。
|
||||
targetIntent.setComponent(selectedComponent);
|
||||
return targetIntent;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "动态查找QQ专属分享组件失败", e);
|
||||
}
|
||||
|
||||
// 第二步 兜底防奔溃:
|
||||
// 如果上面的海选连 QQ 都查不到(或者某些变态系统彻底封禁了 queryIntentActivities 接口),
|
||||
// 如果我们这时候再去硬写 setComponent(JumpActivity),就会报您刚才看到的:
|
||||
// "Unable to find explicit activity class..." 的致命奔溃错误。
|
||||
// 所以,到了这一步,宁可向系统低头唤出 Chooser,也绝不能让应用闪退奔溃。
|
||||
Intent chooser = Intent.createChooser(targetIntent, title);
|
||||
|
||||
try {
|
||||
// 尽最后的人事,附上黑名单作为尝试屏蔽
|
||||
ComponentName[] excludes = new ComponentName[] {
|
||||
new ComponentName("com.ss.android.ugc.aweme", "com.ss.android.ugc.aweme.share.SystemShareActivity"),
|
||||
new ComponentName("com.ss.android.ugc.aweme", "com.ss.android.ugc.aweme.share.ShareToAwemeActivity"),
|
||||
new ComponentName("com.ss.android.ugc.aweme", "com.ss.android.ugc.aweme.shortvideo.ui.VideoRecordNewActivity")
|
||||
};
|
||||
chooser.putExtra(Intent.EXTRA_EXCLUDE_COMPONENTS, excludes);
|
||||
} catch (Exception e) {}
|
||||
|
||||
return chooser;
|
||||
}
|
||||
|
||||
/**
|
||||
* QQ分享回调接口
|
||||
*/
|
||||
@@ -756,3 +1051,4 @@ public class QQIntentShareUtil {
|
||||
void onCancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,13 +118,40 @@ public class WeChatIntentShareUtil {
|
||||
public void shareTextToWeChat(Activity activity, String text, int scene) {
|
||||
boolean isPackageDetected = isWeChatInstalled();
|
||||
|
||||
// 应对鸿蒙等可能存在的限制环境,仅在分享到朋友圈时先复制文本
|
||||
if (scene != SCENE_FRIENDS) {
|
||||
copyToClipboard(activity, text);
|
||||
if (scene == SCENE_MOMENTS) {
|
||||
// 提取出不包含链接的纯内容
|
||||
String textNoUrl = text.replaceAll("(http|https)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]", "").trim();
|
||||
copyToClipboard(activity, textNoUrl);
|
||||
|
||||
try {
|
||||
// 尝试拉起微信朋友圈界面
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("image/*"); // 朋友圈通常要求图片类型才能拉起对应界面
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.setComponent(new ComponentName(WECHAT_PACKAGE_NAME, WECHAT_MOMENTS_ACTIVITY));
|
||||
activity.startActivity(intent);
|
||||
activity.runOnUiThread(() -> Toast.makeText(activity, "已复制内容,请长按粘贴以发布", Toast.LENGTH_SHORT).show());
|
||||
handleShareSuccess(activity);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "拉起朋友圈界面失败,尝试打开微信主界面: " + e.getMessage());
|
||||
try {
|
||||
Intent launchIntent = activity.getPackageManager().getLaunchIntentForPackage(WECHAT_PACKAGE_NAME);
|
||||
if (launchIntent != null) {
|
||||
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.startActivity(launchIntent);
|
||||
activity.runOnUiThread(() -> Toast.makeText(activity, "已复制内容,请打开朋友圈长按粘贴", Toast.LENGTH_SHORT).show());
|
||||
handleShareSuccess(activity);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Log.e(TAG, "打开微信主界面失败: " + ex.getMessage());
|
||||
handleShareException(activity, ex);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// 创建分享Intent
|
||||
// 以下为分享给好友的正常逻辑
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text);
|
||||
@@ -133,16 +160,6 @@ public class WeChatIntentShareUtil {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
|
||||
// 根据分享场景指定目标Activity
|
||||
if (scene == SCENE_MOMENTS) {
|
||||
// 微信朋友圈分享不支持纯文本分享,提示用户
|
||||
Toast.makeText(activity, "微信朋友圈不支持纯文本分享,建议使用图文", Toast.LENGTH_SHORT).show();
|
||||
if (mCallback != null) {
|
||||
mCallback.onError(-1, "微信朋友圈不支持纯文本分享");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
boolean launched = false;
|
||||
|
||||
if (isPackageDetected) {
|
||||
@@ -384,6 +401,46 @@ public class WeChatIntentShareUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享网络图片到微信
|
||||
* 原理:先下载网络图片为Bitmap,再通过分享Bitmap的流程保存本地并拉起微信
|
||||
* @param activity 活动
|
||||
* @param imageUrl 网络图片URL
|
||||
* @param scene 分享场景:0-好友,1-朋友圈
|
||||
*/
|
||||
public void shareNetworkImage(Activity activity, String imageUrl, int scene) {
|
||||
if (TextUtils.isEmpty(imageUrl)) {
|
||||
Toast.makeText(activity, "图片链接不能为空", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
Toast.makeText(activity, "正在准备分享图片,请稍候...", Toast.LENGTH_SHORT).show();
|
||||
|
||||
// 开启子线程下载图片
|
||||
new Thread(() -> {
|
||||
try {
|
||||
java.net.URL url = new java.net.URL(imageUrl);
|
||||
java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection();
|
||||
connection.setDoInput(true);
|
||||
connection.connect();
|
||||
java.io.InputStream input = connection.getInputStream();
|
||||
Bitmap bitmap = android.graphics.BitmapFactory.decodeStream(input);
|
||||
|
||||
// 返回主线程调用现有的分享Bitmap逻辑
|
||||
activity.runOnUiThread(() -> {
|
||||
shareBitmap(activity, bitmap, scene);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "下载网络图片失败: " + e.getMessage(), e);
|
||||
activity.runOnUiThread(() -> {
|
||||
Toast.makeText(activity, "获取网络图片失败", Toast.LENGTH_SHORT).show();
|
||||
if (mCallback != null) {
|
||||
mCallback.onError(-3, "获取网络图片失败: " + e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享网页链接到微信
|
||||
* 注意:微信原生分享不支持直接分享链接,这里实际是分享文本
|
||||
@@ -412,52 +469,8 @@ public class WeChatIntentShareUtil {
|
||||
// }
|
||||
|
||||
String text = sb.toString();
|
||||
if (scene != SCENE_FRIENDS) {
|
||||
copyToClipboard(activity, text);
|
||||
}
|
||||
|
||||
// 朋友圈不支持纯文本分享,需要准备一个默认图片
|
||||
if (scene == SCENE_MOMENTS) {
|
||||
Toast.makeText(activity, "朋友圈不支持纯文本分享,已复制内容可手动发表", Toast.LENGTH_SHORT).show();
|
||||
|
||||
try {
|
||||
// 调用系统分享
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
|
||||
boolean launched = false;
|
||||
if (isPackageDetected) {
|
||||
try {
|
||||
Intent directIntent = new Intent(intent);
|
||||
ComponentName comp = new ComponentName(WECHAT_PACKAGE_NAME, WECHAT_MOMENTS_ACTIVITY);
|
||||
directIntent.setComponent(comp);
|
||||
activity.startActivity(directIntent);
|
||||
launched = true;
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
if (!launched) {
|
||||
try {
|
||||
Intent chooserIntent = Intent.createChooser(intent, "请选择微信分享");
|
||||
chooserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
chooserIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
activity.startActivity(chooserIntent);
|
||||
launched = true;
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
handleShareSuccess(activity);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "分享文本到微信失败: " + e.getMessage(), e);
|
||||
handleShareException(activity, e);
|
||||
}
|
||||
} else {
|
||||
// 分享给好友,可以直接分享文本
|
||||
shareTextToWeChat(activity, text, scene);
|
||||
}
|
||||
// 直接复用统一的文本分享逻辑(内部会自动处理朋友圈剥离链接并拉起朋友圈界面)
|
||||
shareTextToWeChat(activity, text, scene);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "分享过程中出现异常: " + e.getMessage(), e);
|
||||
handleShareException(activity, e);
|
||||
|
||||
30
keystore/daoqi_game_1.txt
Normal file
30
keystore/daoqi_game_1.txt
Normal file
@@ -0,0 +1,30 @@
|
||||
密钥库类型: PKCS12
|
||||
密钥库提供方: SunJSSE
|
||||
|
||||
您的密钥库包含 1 个条目
|
||||
|
||||
别名: gamehall
|
||||
创建日期: 2026-3-5
|
||||
条目类型: PrivateKeyEntry
|
||||
证书链长度: 1
|
||||
证书[1]:
|
||||
所有者: L=CN, O=daoqi, OU=daoqi, CN=daoqi
|
||||
发布者: L=CN, O=daoqi, OU=daoqi, CN=daoqi
|
||||
序列号: 1
|
||||
生效时间: Thu Mar 05 08:16:17 CST 2026, 失效时间: Mon Feb 27 08:16:17 CST 2051
|
||||
证书指纹:
|
||||
SHA1: 67:D1:7E:0E:E9:E7:C0:D0:93:AA:92:45:90:4C:33:16:C8:DB:7D:DB
|
||||
SHA256: 49:8F:C8:CC:AB:BB:38:A1:C5:29:FB:52:D9:00:D7:9E:B8:F9:9E:75:C3:DB:08:27:BD:09:D5:53:75:82:F0:2F
|
||||
签名算法名称: SHA256withRSA
|
||||
主体公共密钥算法: 2048 位 RSA 密钥
|
||||
版本: 1
|
||||
|
||||
|
||||
*******************************************
|
||||
*******************************************
|
||||
|
||||
|
||||
|
||||
|
||||
微信开放平台应用签名:
|
||||
d9e138b6f20acfa14ae73113c7e44727
|
||||
BIN
keystore/daoqi_game_2.keystore
Normal file
BIN
keystore/daoqi_game_2.keystore
Normal file
Binary file not shown.
30
keystore/daoqi_game_2.txt
Normal file
30
keystore/daoqi_game_2.txt
Normal file
@@ -0,0 +1,30 @@
|
||||
密钥库类型: PKCS12
|
||||
密钥库提供方: SunJSSE
|
||||
|
||||
您的密钥库包含 1 个条目
|
||||
|
||||
别名: gamehall
|
||||
创建日期: 2026-3-14
|
||||
条目类型: PrivateKeyEntry
|
||||
证书链长度: 1
|
||||
证书[1]:
|
||||
所有者: O=daoqi, OU=daoqi, CN=daoqi
|
||||
发布者: O=daoqi, OU=daoqi, CN=daoqi
|
||||
序列号: 1
|
||||
生效时间: Sat Mar 14 17:14:24 CST 2026, 失效时间: Wed Mar 08 17:14:24 CST 2051
|
||||
证书指纹:
|
||||
SHA1: 2F:76:97:3D:DC:E5:EA:56:7A:2B:53:E6:24:EF:74:CF:12:DF:A6:09
|
||||
SHA256: B8:73:5A:3E:90:57:49:95:F7:B8:BB:0F:05:E7:76:7C:27:96:F8:5E:6F:66:96:4E:F0:0F:69:B1:E9:22:28:2F
|
||||
签名算法名称: SHA256withRSA
|
||||
主体公共密钥算法: 2048 位 RSA 密钥
|
||||
版本: 1
|
||||
|
||||
|
||||
*******************************************
|
||||
*******************************************
|
||||
|
||||
|
||||
|
||||
|
||||
微信开放平台应用签名:
|
||||
6f0e6ad5c028c9824eeb55c222c0f1af
|
||||
BIN
keystore/daoqi_game_3.keystore
Normal file
BIN
keystore/daoqi_game_3.keystore
Normal file
Binary file not shown.
30
keystore/daoqi_game_3.txt
Normal file
30
keystore/daoqi_game_3.txt
Normal file
@@ -0,0 +1,30 @@
|
||||
密钥库类型: PKCS12
|
||||
密钥库提供方: SunJSSE
|
||||
|
||||
您的密钥库包含 1 个条目
|
||||
|
||||
别名: gamehall
|
||||
创建日期: 2026-3-15
|
||||
条目类型: PrivateKeyEntry
|
||||
证书链长度: 1
|
||||
证书[1]:
|
||||
所有者: O=daoqi, OU=daoqi, CN=daoqi
|
||||
发布者: O=daoqi, OU=daoqi, CN=daoqi
|
||||
序列号: 1
|
||||
生效时间: Sun Mar 15 17:42:36 CST 2026, 失效时间: Thu Mar 09 17:42:36 CST 2051
|
||||
证书指纹:
|
||||
SHA1: 44:8D:D5:4D:F3:D2:EA:F0:92:06:2D:69:9A:6C:8B:C3:EB:E5:70:CD
|
||||
SHA256: 16:2B:EE:3F:3E:8A:64:A4:20:6E:4C:96:31:0F:21:D1:57:FC:FC:7E:3B:0A:AD:A3:34:0D:6F:AC:7E:99:0A:FB
|
||||
签名算法名称: SHA256withRSA
|
||||
主体公共密钥算法: 2048 位 RSA 密钥
|
||||
版本: 1
|
||||
|
||||
|
||||
*******************************************
|
||||
*******************************************
|
||||
|
||||
|
||||
|
||||
|
||||
微信开放平台应用签名:
|
||||
03f192808871ad51dbbf7b6e94c2d885
|
||||
41
keystore/gamehall.txt
Normal file
41
keystore/gamehall.txt
Normal file
@@ -0,0 +1,41 @@
|
||||
密钥库类型: JKS
|
||||
密钥库提供方: SUN
|
||||
|
||||
您的密钥库包含 1 个条目
|
||||
|
||||
别名: gamehall
|
||||
创建日期: 2017-3-8
|
||||
条目类型: PrivateKeyEntry
|
||||
证书链长度: 1
|
||||
证书[1]:
|
||||
所有者: CN=友乐互动游戏, OU=游戏部, O=天盛网络, L=南昌, ST=江西, C=CN
|
||||
发布者: CN=友乐互动游戏, OU=游戏部, O=天盛网络, L=南昌, ST=江西, C=CN
|
||||
序列号: 72f9b86c
|
||||
生效时间: Wed Mar 08 09:55:16 CST 2017, 失效时间: Sun Mar 02 09:55:16 CST 2042
|
||||
证书指纹:
|
||||
SHA1: 08:CA:91:93:45:D3:C0:B4:76:73:E1:E6:7A:3D:74:C9:3E:B7:A7:11
|
||||
SHA256: 95:36:ED:0E:52:38:92:AF:F9:F1:07:B6:4D:7B:07:F9:93:92:1E:EB:E2:33:FE:FE:D8:21:2A:CE:C2:57:F6:72
|
||||
签名算法名称: SHA256withRSA
|
||||
主体公共密钥算法: 2048 位 RSA 密钥
|
||||
版本: 3
|
||||
|
||||
扩展:
|
||||
|
||||
#1: ObjectId: 2.5.29.14 Criticality=false
|
||||
SubjectKeyIdentifier [
|
||||
KeyIdentifier [
|
||||
0000: 58 9C EB 3D 84 A1 10 15 B4 2C 20 A6 2E 42 AC B9 X..=....., ..B..
|
||||
0010: 7A B8 66 E2 z.f.
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
|
||||
*******************************************
|
||||
*******************************************
|
||||
|
||||
|
||||
|
||||
|
||||
微信开放平台应用签名:
|
||||
52f8eed9c81dbaf314561e1809c916f5
|
||||
Reference in New Issue
Block a user