From 0a1b42fb304d73956daa28c49f11bdf1554d357b Mon Sep 17 00:00:00 2001 From: jaydroid1024 Date: Wed, 8 Sep 2021 15:45:47 +0800 Subject: [PATCH] openjdk11 --- app/build.gradle | 12 ++++++------ jitpack.yml | 1 + .../com/jay/vbhelper/delegate/FragmentVBDelegate.kt | 11 ----------- 3 files changed, 7 insertions(+), 17 deletions(-) create mode 100644 jitpack.yml diff --git a/app/build.gradle b/app/build.gradle index 222571f..31f7472 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -53,10 +53,10 @@ android { dependencies { - implementation 'androidx.core:core-ktx:1.3.2' - implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'com.google.android.material:material:1.3.0' - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation 'androidx.core:core-ktx:1.6.0' + implementation 'androidx.appcompat:appcompat:1.3.1' + implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.0' implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5' implementation 'androidx.navigation:navigation-ui-ktx:2.3.5' @@ -64,8 +64,8 @@ dependencies { implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.2' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' implementation(project(":vbhelper")) diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000..f78f664 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1 @@ +jdk: openjdk11 \ No newline at end of file diff --git a/vbhelper/src/main/java/com/jay/vbhelper/delegate/FragmentVBDelegate.kt b/vbhelper/src/main/java/com/jay/vbhelper/delegate/FragmentVBDelegate.kt index c1c88cf..0c9613d 100644 --- a/vbhelper/src/main/java/com/jay/vbhelper/delegate/FragmentVBDelegate.kt +++ b/vbhelper/src/main/java/com/jay/vbhelper/delegate/FragmentVBDelegate.kt @@ -93,17 +93,6 @@ inline fun fragmentVBDelegate( } @Suppress("UNCHECKED_CAST") binding = inflateMethod.invoke(null, thisRef.layoutInflater) as T - //外部传进来的布局id - if (layoutIdRes > 0) { - //反射修改 Fragment 的 mContentLayoutId 字段,将布局 id 复制给它,当 Fragment 执行 onCreateView 时就会通过父类加载完布局 - //相当于加载了两遍,绑定类加载了一遍,Fragment 类加载了一遍,这样做的的目的是不用在每个 Fragment 的 onCreateView 返回 根布局了 - val clazz: Class<*> = thisRef.javaClass.superclass - // 获得指定类的属性 - val mContentLayoutId: Field = clazz.getDeclaredField("mContentLayoutId") - mContentLayoutId.isAccessible = true - // 更改私有属性的值 - mContentLayoutId.set(thisRef, layoutIdRes) - } return binding!! } }