Skip to content

Commit

Permalink
openjdk11
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydroid1024 committed Sep 8, 2021
1 parent 0c035b6 commit 0a1b42f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ 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'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
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"))

Expand Down
1 change: 1 addition & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jdk: openjdk11
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,6 @@ inline fun <reified T : ViewBinding> 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!!
}
}
Expand Down

0 comments on commit 0a1b42f

Please sign in to comment.