Commit 4e762f14 by konghaorui

补充文章模块

parent 77a715f7
......@@ -8,10 +8,11 @@ ext {
"m-confide" : "0.0.48.23",
"m-consultant" : "0.0.59.10",
"m-fm" : "0.0.29.9",
"m-user" : "0.0.60.4",
"m-user" : "0.0.60.7",
"m-home" : "0.0.22.3",
"m-im" : "0.0.18.3",
"m-dynamic" : "0.0.7.7",
"m-article" : "0.0.0.5",
"m-muse" : "0.0.28.12",
"m-tests" : "0.0.24.4",
......
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'resTools' // 资源重命名插件
// 配置资源重命名插件
resConfig {
new_prefix = 'article_' // 资源前缀
old_prefix = '' // 老前缀,可为''空字符串
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", "article")
}
}
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: "article"]
}
}
flavorDimensions "versionCode"//Flavor 维度信息
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//前缀的名字
// resourcePrefix "article_"
//Flavor 信息
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
res.srcDirs = [
'src/main/res'
]
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.aar','*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
kapt 'com.alibaba:arouter-compiler:1.2.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api rootProject.ext.dependencies["ydl-user-router"]
if (rootProject.ext.dev_mode){
//开发时使用
api project(':ydl-webview')
api project(':ydl-platform')
implementation project(':ydl-flutter-base')
}else {
//发布时使用
api rootProject.ext.dependencies["ydl-webview"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
implementation rootProject.ext.dependencies["ydl-flutter-base"]
}
}
isApplicaiton = false
modular {
//模块包名
packageName "com.yidianling.article"
// 模块发布需要的参数
publish {
modules {
xlzx {
groupId = "com.ydl"
artifactId = "m-article-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
ydl{
groupId = "com.ydl"
artifactId = "m-article-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
}
api {
//壹点灵/心理咨询 业务模块 API层 jar包的发布信息
groupId = "com.ydl"
artifactId = "m-article-api"
//开发时注释掉版本号,发布api时打开
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1'
implementation 'de.greenrobot:eventbus:2.4.0'
}
}
}
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yidianling.article">
<application>
<activity android:name=".flutter.ArticleActivity"
android:screenOrientation="portrait"/>
</application>
</manifest>
\ No newline at end of file
package com.yidianling.article.flutter
import com.alibaba.android.arouter.facade.annotation.Route
import com.channel.ydl_flutter_base.base.BaseFlutterActivity
import org.json.JSONObject
/**
* Created by harvie on 2019/9/6.
*/
@Route(path = "/article/list")
class ArticleActivity : BaseFlutterActivity() {
override fun initialRoute(): String {
return "article/home"
}
override fun initChannelPlugin(jsonObject: JSONObject) {
ArticlePlugin.rigister(this)
}
}
package com.yidianling.article.flutter
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydlcommon.utils.AppUtils
import com.ydl.ydlcommon.view.dialog.YDLShareDialog
import com.yidianling.common.tools.ToastUtil
import io.flutter.app.FlutterActivity
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
/**
* Created by harvie on 2019/9/6.
*/
class ArticlePlugin : MethodChannel.MethodCallHandler {
companion object {
const val CHANNEL: String = "lib/m_module/article"
const val ACTION_TO_H5 = "action_to_h5" //跳转原生H5
const val ACTION_GET_COMMON_PARAMS = "action_get_common_params" //获取http公用参数
fun rigister(activity: FlutterActivity) {
MethodChannel(activity.flutterView, CHANNEL).setMethodCallHandler(ArticlePlugin(activity))
}
}
private var mActivity: FlutterActivity? = null
private constructor(activity: FlutterActivity) {
mActivity = activity
}
override fun onMethodCall(methodCall: MethodCall, result: MethodChannel.Result) {
methodCall.let {
when (methodCall.method) {
// flutter获取原生的功能
ACTION_TO_H5 -> {
var url: String? = methodCall.argument<String>("url")
YDLRouterManager.router("ydl-user://h5/h5?params={'url':'${url}'}")
// NewH5Activity.start(mActivity, H5Params(url?:"",null))
}
ACTION_GET_COMMON_PARAMS -> {
val map = AppUtils.getHttpCommonParams()
result?.success(map)
}
else -> {
}
}
}
}
/**
* 分享,跟FM一致
*/
private fun share(methodCall: MethodCall?) {
var shareUrl = methodCall?.argument<String>("shareUrl") ?: ""
var title = methodCall?.argument<String>("title") ?: ""
var path = methodCall?.argument<String>("path") ?: ""
var appId = methodCall?.argument<String>("appId") ?: ""
if (shareUrl.isEmpty()) {
ToastUtil.toastShort("分享数据获取失败")
} else {
val dialog = YDLShareDialog.style7(mActivity!!, title, shareUrl, null, "https://img.yidianling.com/file/2019/06/10/fm0vovijx0p2br9s.png", path, appId)
dialog.setCallBack(object : YDLShareDialog.ICallBack {
override fun callBack(type: Int) {
}
})
dialog.show(mActivity!!.fragmentManager, "lose")
}
}
}
\ No newline at end of file
......@@ -3,6 +3,6 @@ include ':app',
':ydl-platform', ':ydl-webview', ':ydl-pay', ':m-home',
':m-home', ':m-confide', ':m-audioim', ":m-user",
':m-consultant', ':m-muse', ':m-fm', ':m-tests', ":m-course",
":m-im",":m-dynamic"
":m-im",":m-dynamic",":m-article"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment