提交 2734777a 作者: enjoy

优化INIT

上级 2f4f8fa5
...@@ -44,7 +44,7 @@ kapt { ...@@ -44,7 +44,7 @@ kapt {
dependencies { dependencies {
implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0' implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
......
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true"> android:exported="true">
</activity>
<activity android:name="com.juling.widget_enter.StartActivity"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
......
...@@ -8,8 +8,9 @@ import com.work.provide_tool.general.RouterPath.WIDGET_MAIN ...@@ -8,8 +8,9 @@ import com.work.provide_tool.general.RouterPath.WIDGET_MAIN
class MainActivity : AppCompatActivity() { class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) // setContentView(R.layout.activity_main)
ARouter.getInstance().build(WIDGET_MAIN).navigation() // ARouter.getInstance().build(WIDGET_MAIN).navigation()
// finish()
} }
} }
\ No newline at end of file
...@@ -50,7 +50,7 @@ kapt { ...@@ -50,7 +50,7 @@ kapt {
dependencies { dependencies {
implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0' implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
...@@ -63,5 +63,7 @@ dependencies { ...@@ -63,5 +63,7 @@ dependencies {
api project(path:':widget_u_info') api project(path:':widget_u_info')
api project(path:':widget_friend') api project(path:':widget_friend')
api project(path:':widget_login') api project(path:':widget_login')
api project(path:':widget_enter')
api project(path:':widget_ipage')
} }
} }
\ No newline at end of file
...@@ -5,6 +5,7 @@ import com.work.provide_tool.app.IApp ...@@ -5,6 +5,7 @@ import com.work.provide_tool.app.IApp
class JlApp :IApp(){ class JlApp :IApp(){
override fun init(app: Application, applicationFlag: Boolean) { override fun init(app: Application, applicationFlag: Boolean) {
}
}
} }
\ No newline at end of file
...@@ -3,5 +3,7 @@ package com.work.provide_tool.general ...@@ -3,5 +3,7 @@ package com.work.provide_tool.general
object General { object General {
var widgetArray = arrayOf("com.juling.juliao.App","com.juling.pro_juliao.app" var widgetArray = arrayOf("com.juling.juliao.App","com.juling.pro_juliao.app"
,"com.juling.widget_friend.FriendApp","com.juling.widget_login.LgApp" ,"com.juling.widget_friend.FriendApp","com.juling.widget_login.LgApp"
,"com.juling.work_onepage.OneApp","com.juling.widget_u_info.UApp") ,"com.juling.work_onepage.OneApp","com.juling.widget_u_info.UApp"
,"com.juling.widget_enter.EntApp","com.juling.ipage.PagApp"
,"com.juling.provide_tt.TtApp")
} }
\ No newline at end of file
/build
\ No newline at end of file
plugins {
// id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
boolean applicationFlag = rootProject.ext.info.applicationFlag.toBoolean()
if(applicationFlag){
apply plugin: 'com.android.application'
}else {
apply plugin: 'com.android.library'
}
android {
namespace 'com.juling.provide_tt'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
targetCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'1.8'
}
dataBinding{
enabled = true
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
api project(path: ':provide_origin')
kapt rootProject.ext.android.arouter_kapt
}
\ 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
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
\ No newline at end of file
package com.juling.provide_tt
import android.app.Application
import com.work.provide_tool.app.IApp
class TtApp :IApp(){
override fun init(app: Application, applicationFlag: Boolean) {
}
}
\ No newline at end of file
...@@ -28,3 +28,6 @@ include ':pro_juliao' ...@@ -28,3 +28,6 @@ include ':pro_juliao'
include ':widget_login' include ':widget_login'
include ':widget_friend' include ':widget_friend'
include ':widget_u_info' include ':widget_u_info'
include ':widget_enter'
include ':widget_ipage'
include ':provide_tt'
/build
\ No newline at end of file
plugins {
// id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
boolean applicationFlag = rootProject.ext.info.applicationFlag.toBoolean()
if(applicationFlag){
apply plugin: 'com.android.application'
}else {
apply plugin: 'com.android.library'
}
android {
namespace 'com.juling.widget_enter'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
targetCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'1.8'
}
dataBinding{
enabled = true
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
api project(path: ':provide_origin')
kapt rootProject.ext.android.arouter_kapt
}
\ 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
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<activity android:name="com.juling.widget_enter.StartActivity" />
</application>
</manifest>
\ No newline at end of file
package com.juling.widget_enter
import android.app.Application
import com.work.provide_tool.app.IApp
class EntApp :IApp(){
override fun init(app: Application, applicationFlag: Boolean) {
}
}
\ No newline at end of file
package com.juling.widget_enter
import android.app.Activity
import android.os.Bundle
class StartActivity:Activity(){
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_enter_start)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="enter"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -50,7 +50,7 @@ kapt { ...@@ -50,7 +50,7 @@ kapt {
dependencies { dependencies {
implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0' implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
......
/build
\ No newline at end of file
plugins {
// id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
boolean applicationFlag = rootProject.ext.info.applicationFlag.toBoolean()
if(applicationFlag){
apply plugin: 'com.android.application'
}else {
apply plugin: 'com.android.library'
}
android {
namespace 'com.juling.ipage'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
targetCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'1.8'
}
dataBinding{
enabled = true
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
api project(path: ':provide_origin')
kapt rootProject.ext.android.arouter_kapt
}
\ 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
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
\ No newline at end of file
package com.juling.ipage
import android.app.Application
import com.work.provide_tool.app.IApp
class PagApp :IApp(){
override fun init(app: Application, applicationFlag: Boolean) {
}
}
\ No newline at end of file
...@@ -50,7 +50,7 @@ kapt { ...@@ -50,7 +50,7 @@ kapt {
dependencies { dependencies {
implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0' implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
......
...@@ -50,7 +50,7 @@ kapt { ...@@ -50,7 +50,7 @@ kapt {
dependencies { dependencies {
implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0' implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
......
...@@ -50,7 +50,7 @@ kapt { ...@@ -50,7 +50,7 @@ kapt {
dependencies { dependencies {
implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0' implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
......
|-provide_longnet |->provide_data |-provide_longnet |->provide_data
|-provide_longnet |->provide_data |-provide_longnet |->provide_data
引用的链路: provide_origin ->provide_general-> |-provide_net |->provide_data 引用的链路: provide_origin ->provide_general-> |-provide_net |->provide_data
|-provide_tool |-provide_tool
功能组件: 功能组件:
统一以provide为开头; 统一以provide为开头;
该App中用到的组件: 该App中用到的组件:
provide_origin:android组件(Activity等)的基类 provide_origin:android组件(Activity等)的基类
provide_general:所有功能的引用 provide_general:所有功能的引用
provide_net:网络类 provide_net、provide_longnet:网络类
provide_tool:工具类 provide_tool:工具类
provide_data:数据类 provide_data:数据类
业务组件: 业务组件:
统一以widget为开头; 统一以widget为开头;
当增加widget,要增加一个IApp的子类(init的作用例如第三方库的init),可仿照widget_onepage: 当增加widget,要增加一个IApp的子类(init的作用例如第三方库的init),可仿照widget_onepage:
1.配置build.gradle文件 1.配置build.gradle文件
2.搭一个IApp之类 2.搭一个IApp之类
com.work.provide_tool.general.General的widgetArray增该类全路径 com.work.provide_tool.general.General的widgetArray增该类全路径
在组件pro_juliao中增加依赖
该App中用到的组件: 该App中用到的组件:
widget_onepage:聊天 widget_onepage:聊天
widget_login:登录 widget_login:登录
widget_friend:联络人 widget_friend:联络人
widget_u_info:用户 widget_u_info:用户
widget_enter:启动
widget_ipage:带导航栏的首页
App组件: App组件:
统一以pro开头; 统一以pro开头;
当增加pro,要增加一个IApp的子类(init的作用例如第三方库的init),可仿照widget_onepage: 当增加pro,要增加一个IApp的子类(init的作用例如第三方库的init),可仿照widget_onepage:
1.配置build.gradle文件 2.搭一个IApp之类 1.配置build.gradle文件 2.搭一个IApp之类
com.work.provide_tool.general.General的widgetArray增该类全路径 com.work.provide_tool.general.General的widgetArray增该类全路径
该App中用到的组件: 该App中用到的组件:
pro_juliao:聊天v1.0的功能 pro_juliao:聊天v1.0的功能
\ No newline at end of file
注意的地方:
在provide.gradle中 "applicationFlag"为false,所有的组件(widget)只能作为依赖;反之可以单独跑;
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论