Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
a0290fda
提交
a0290fda
authored
10月 10, 2018
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
kotlin-> 1.2.71
上级
eecbb233
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
30 行增加
和
30 行删除
+30
-30
build.gradle
android/build.gradle
+5
-5
FluwxShareHandler.kt
...main/kotlin/com/jarvan/fluwx/handler/FluwxShareHandler.kt
+17
-19
build.gradle
example/android/app/build.gradle
+5
-5
build.gradle
example/android/build.gradle
+1
-1
gradle.properties
example/android/gradle.properties
+2
-0
没有找到文件。
android/build.gradle
浏览文件 @
a0290fda
...
@@ -2,14 +2,14 @@ group 'com.jarvan.fluwx'
...
@@ -2,14 +2,14 @@ group 'com.jarvan.fluwx'
version
'1.0-SNAPSHOT'
version
'1.0-SNAPSHOT'
buildscript
{
buildscript
{
ext
.
kotlin_version
=
'1.2.
60
'
ext
.
kotlin_version
=
'1.2.
71
'
repositories
{
repositories
{
google
()
google
()
jcenter
()
jcenter
()
}
}
dependencies
{
dependencies
{
classpath
'com.android.tools.build:gradle:3.
1.4
'
classpath
'com.android.tools.build:gradle:3.
2.0
'
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
}
}
...
@@ -32,7 +32,7 @@ android {
...
@@ -32,7 +32,7 @@ android {
}
}
defaultConfig
{
defaultConfig
{
minSdkVersion
16
minSdkVersion
16
testInstrumentationRunner
"android
.support
.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"android
x
.test.runner.AndroidJUnitRunner"
}
}
lintOptions
{
lintOptions
{
disable
'InvalidPackage'
disable
'InvalidPackage'
...
@@ -42,9 +42,9 @@ android {
...
@@ -42,9 +42,9 @@ android {
dependencies
{
dependencies
{
implementation
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api
'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.1.4'
api
'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.1.4'
implementation
'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.
24.0
'
implementation
'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.
30.2
'
// implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-common:0.24.0'
// implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-common:0.24.0'
implementation
'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.
24.0
'
implementation
'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.
30.2
'
implementation
'top.zibin:Luban:1.1.8'
implementation
'top.zibin:Luban:1.1.8'
implementation
'com.squareup.okhttp3:okhttp:3.11.0'
implementation
'com.squareup.okhttp3:okhttp:3.11.0'
}
}
android/src/main/kotlin/com/jarvan/fluwx/handler/FluwxShareHandler.kt
浏览文件 @
a0290fda
...
@@ -24,10 +24,8 @@ import com.tencent.mm.opensdk.modelmsg.*
...
@@ -24,10 +24,8 @@ import com.tencent.mm.opensdk.modelmsg.*
import
io.flutter.plugin.common.MethodCall
import
io.flutter.plugin.common.MethodCall
import
io.flutter.plugin.common.MethodChannel
import
io.flutter.plugin.common.MethodChannel
import
io.flutter.plugin.common.PluginRegistry
import
io.flutter.plugin.common.PluginRegistry
import
kotlinx.coroutines.experimental.
CommonPool
import
kotlinx.coroutines.experimental.
*
import
kotlinx.coroutines.experimental.android.UI
import
kotlinx.coroutines.experimental.android.UI
import
kotlinx.coroutines.experimental.async
import
kotlinx.coroutines.experimental.launch
/***
/***
...
@@ -115,7 +113,7 @@ internal object FluwxShareHandler {
...
@@ -115,7 +113,7 @@ internal object FluwxShareHandler {
msg
.
description
=
call
.
argument
(
"description"
)
// 小程序消息desc
msg
.
description
=
call
.
argument
(
"description"
)
// 小程序消息desc
val
thumbnail
:
String
?
=
call
.
argument
(
WechatPluginKeys
.
THUMBNAIL
)
val
thumbnail
:
String
?
=
call
.
argument
(
WechatPluginKeys
.
THUMBNAIL
)
launch
((
UI
))
{
GlobalScope
.
launch
((
Dispatchers
.
Main
),
CoroutineStart
.
DEFAULT
,
{
if
(
thumbnail
.
isNullOrBlank
())
{
if
(
thumbnail
.
isNullOrBlank
())
{
msg
.
thumbData
=
null
msg
.
thumbData
=
null
}
else
{
}
else
{
...
@@ -132,38 +130,38 @@ internal object FluwxShareHandler {
...
@@ -132,38 +130,38 @@ internal object FluwxShareHandler {
)
)
)
)
}
}
)
}
}
private
suspend
fun
getThumbnailByteArrayMiniProgram
(
registrar
:
PluginRegistry
.
Registrar
?,
thumbnail
:
String
):
ByteArray
{
private
suspend
fun
getThumbnailByteArrayMiniProgram
(
registrar
:
PluginRegistry
.
Registrar
?,
thumbnail
:
String
):
ByteArray
{
return
async
(
CommonPool
)
{
return
GlobalScope
.
async
(
Dispatchers
.
Default
,
CoroutineStart
.
DEFAULT
,
{
val
result
=
WeChatThumbnailUtil
.
thumbnailForMiniProgram
(
thumbnail
,
registrar
)
val
result
=
WeChatThumbnailUtil
.
thumbnailForMiniProgram
(
thumbnail
,
registrar
)
result
?:
byteArrayOf
()
result
?:
byteArrayOf
()
}.
await
()
}
)
.
await
()
}
}
private
suspend
fun
getImageByteArrayCommon
(
registrar
:
PluginRegistry
.
Registrar
?,
imagePath
:
String
):
ByteArray
{
private
suspend
fun
getImageByteArrayCommon
(
registrar
:
PluginRegistry
.
Registrar
?,
imagePath
:
String
):
ByteArray
{
return
async
(
CommonPool
)
{
return
GlobalScope
.
async
(
Dispatchers
.
Default
,
CoroutineStart
.
DEFAULT
,
{
val
result
=
ShareImageUtil
.
getImageData
(
registrar
,
imagePath
)
val
result
=
ShareImageUtil
.
getImageData
(
registrar
,
imagePath
)
result
?:
byteArrayOf
()
result
?:
byteArrayOf
()
}.
await
()
}
)
.
await
()
}
}
private
suspend
fun
getThumbnailByteArrayCommon
(
registrar
:
PluginRegistry
.
Registrar
?,
thumbnail
:
String
):
ByteArray
{
private
suspend
fun
getThumbnailByteArrayCommon
(
registrar
:
PluginRegistry
.
Registrar
?,
thumbnail
:
String
):
ByteArray
{
return
async
(
CommonPool
)
{
return
GlobalScope
.
async
(
Dispatchers
.
Default
,
CoroutineStart
.
DEFAULT
,
{
val
result
=
WeChatThumbnailUtil
.
thumbnailForCommon
(
thumbnail
,
registrar
)
val
result
=
WeChatThumbnailUtil
.
thumbnailForCommon
(
thumbnail
,
registrar
)
result
?:
byteArrayOf
()
result
?:
byteArrayOf
()
}.
await
()
}
)
.
await
()
}
}
private
fun
shareImage
(
call
:
MethodCall
,
result
:
MethodChannel
.
Result
)
{
private
fun
shareImage
(
call
:
MethodCall
,
result
:
MethodChannel
.
Result
)
{
val
imagePath
=
call
.
argument
<
String
>(
WechatPluginKeys
.
IMAGE
)
val
imagePath
=
call
.
argument
<
String
>(
WechatPluginKeys
.
IMAGE
)
launch
(
UI
)
{
GlobalScope
.
launch
(
Dispatchers
.
Main
,
CoroutineStart
.
DEFAULT
,
{
val
byteArray
:
ByteArray
?
=
if
(
imagePath
.
isNullOrBlank
()){
val
byteArray
:
ByteArray
?
=
if
(
imagePath
.
isNullOrBlank
()){
byteArrayOf
()
byteArrayOf
()
}
else
{
}
else
{
...
@@ -191,7 +189,7 @@ internal object FluwxShareHandler {
...
@@ -191,7 +189,7 @@ internal object FluwxShareHandler {
// val thumbnailData = Util.bmpToByteArray(bitmap,true)
// val thumbnailData = Util.bmpToByteArray(bitmap,true)
handleShareImage
(
imgObj
,
call
,
thumbnailData
,
result
)
handleShareImage
(
imgObj
,
call
,
thumbnailData
,
result
)
}
}
)
}
}
...
@@ -237,7 +235,7 @@ internal object FluwxShareHandler {
...
@@ -237,7 +235,7 @@ internal object FluwxShareHandler {
msg
.
description
=
call
.
argument
(
"description"
)
msg
.
description
=
call
.
argument
(
"description"
)
val
thumbnail
:
String
?
=
call
.
argument
(
"thumbnail"
)
val
thumbnail
:
String
?
=
call
.
argument
(
"thumbnail"
)
launch
(
UI
)
{
GlobalScope
.
launch
(
Dispatchers
.
Main
,
CoroutineStart
.
DEFAULT
,
{
if
(
thumbnail
!=
null
&&
thumbnail
.
isNotBlank
())
{
if
(
thumbnail
!=
null
&&
thumbnail
.
isNotBlank
())
{
msg
.
thumbData
=
getThumbnailByteArrayCommon
(
registrar
,
thumbnail
)
msg
.
thumbData
=
getThumbnailByteArrayCommon
(
registrar
,
thumbnail
)
}
}
...
@@ -252,7 +250,7 @@ internal object FluwxShareHandler {
...
@@ -252,7 +250,7 @@ internal object FluwxShareHandler {
WechatPluginKeys
.
RESULT
to
done
WechatPluginKeys
.
RESULT
to
done
)
)
)
)
}
}
)
}
}
...
@@ -272,7 +270,7 @@ internal object FluwxShareHandler {
...
@@ -272,7 +270,7 @@ internal object FluwxShareHandler {
msg
.
description
=
call
.
argument
(
WechatPluginKeys
.
DESCRIPTION
)
msg
.
description
=
call
.
argument
(
WechatPluginKeys
.
DESCRIPTION
)
val
thumbnail
:
String
?
=
call
.
argument
(
WechatPluginKeys
.
THUMBNAIL
)
val
thumbnail
:
String
?
=
call
.
argument
(
WechatPluginKeys
.
THUMBNAIL
)
launch
(
UI
)
{
GlobalScope
.
launch
(
Dispatchers
.
Main
,
CoroutineStart
.
DEFAULT
,
{
if
(
thumbnail
!=
null
&&
thumbnail
.
isNotBlank
())
{
if
(
thumbnail
!=
null
&&
thumbnail
.
isNotBlank
())
{
msg
.
thumbData
=
getThumbnailByteArrayCommon
(
registrar
,
thumbnail
)
msg
.
thumbData
=
getThumbnailByteArrayCommon
(
registrar
,
thumbnail
)
}
}
...
@@ -286,7 +284,7 @@ internal object FluwxShareHandler {
...
@@ -286,7 +284,7 @@ internal object FluwxShareHandler {
WechatPluginKeys
.
RESULT
to
done
WechatPluginKeys
.
RESULT
to
done
)
)
)
)
}
}
)
}
}
...
@@ -301,7 +299,7 @@ internal object FluwxShareHandler {
...
@@ -301,7 +299,7 @@ internal object FluwxShareHandler {
msg
.
title
=
call
.
argument
(
WechatPluginKeys
.
TITLE
)
msg
.
title
=
call
.
argument
(
WechatPluginKeys
.
TITLE
)
msg
.
description
=
call
.
argument
(
WechatPluginKeys
.
DESCRIPTION
)
msg
.
description
=
call
.
argument
(
WechatPluginKeys
.
DESCRIPTION
)
val
thumbnail
:
String
?
=
call
.
argument
(
WechatPluginKeys
.
THUMBNAIL
)
val
thumbnail
:
String
?
=
call
.
argument
(
WechatPluginKeys
.
THUMBNAIL
)
launch
(
UI
)
{
GlobalScope
.
launch
(
Dispatchers
.
Main
,
CoroutineStart
.
DEFAULT
,
{
if
(
thumbnail
!=
null
&&
thumbnail
.
isNotBlank
())
{
if
(
thumbnail
!=
null
&&
thumbnail
.
isNotBlank
())
{
msg
.
thumbData
=
getThumbnailByteArrayCommon
(
registrar
,
thumbnail
)
msg
.
thumbData
=
getThumbnailByteArrayCommon
(
registrar
,
thumbnail
)
}
}
...
@@ -315,7 +313,7 @@ internal object FluwxShareHandler {
...
@@ -315,7 +313,7 @@ internal object FluwxShareHandler {
WechatPluginKeys
.
RESULT
to
done
WechatPluginKeys
.
RESULT
to
done
)
)
)
)
}
}
)
}
}
// private fun createWxImageObject(imagePath:String):WXImageObject?{
// private fun createWxImageObject(imagePath:String):WXImageObject?{
...
...
example/android/app/build.gradle
浏览文件 @
a0290fda
...
@@ -16,7 +16,7 @@ apply plugin: 'kotlin-android'
...
@@ -16,7 +16,7 @@ apply plugin: 'kotlin-android'
apply
from:
"$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply
from:
"$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android
{
android
{
compileSdkVersion
2
7
compileSdkVersion
2
8
sourceSets
{
sourceSets
{
main
.
java
.
srcDirs
+=
'src/main/kotlin'
main
.
java
.
srcDirs
+=
'src/main/kotlin'
...
@@ -29,10 +29,10 @@ android {
...
@@ -29,10 +29,10 @@ android {
defaultConfig
{
defaultConfig
{
applicationId
"net.sourceforge.simcpux"
applicationId
"net.sourceforge.simcpux"
minSdkVersion
16
minSdkVersion
16
targetSdkVersion
2
7
targetSdkVersion
2
8
versionCode
1
versionCode
1
versionName
"1.0"
versionName
"1.0"
testInstrumentationRunner
"android
.support
.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"android
x
.test.runner.AndroidJUnitRunner"
}
}
buildTypes
{
buildTypes
{
...
@@ -61,7 +61,7 @@ flutter {
...
@@ -61,7 +61,7 @@ flutter {
dependencies
{
dependencies
{
implementation
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation
'junit:junit:4.12'
testImplementation
'junit:junit:4.12'
androidTestImplementation
'
com.android.support.test:runner:1.0.
1'
androidTestImplementation
'
androidx.test:runner:1.1.0-beta0
1'
androidTestImplementation
'
com.android.support.test.espresso:espresso-core:3.0.
1'
androidTestImplementation
'
androidx.test.espresso:espresso-core:3.1.0-beta0
1'
}
}
example/android/build.gradle
浏览文件 @
a0290fda
buildscript
{
buildscript
{
ext
.
kotlin_version
=
'1.2.
60
'
ext
.
kotlin_version
=
'1.2.
71
'
repositories
{
repositories
{
google
()
google
()
jcenter
()
jcenter
()
...
...
example/android/gradle.properties
浏览文件 @
a0290fda
android.enableJetifier
=
true
android.useAndroidX
=
true
org.gradle.jvmargs
=
-Xmx1536M
org.gradle.jvmargs
=
-Xmx1536M
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论