diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 89d3213d7..c4259fc6b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -57,6 +57,7 @@ android { kotlinOptions { jvmTarget = "11" + freeCompilerArgs = listOf("-Xjvm-default=enable") } } @@ -109,19 +110,19 @@ dependencies { implementation("androidx.room:room-ktx:${vRoom}") kapt("androidx.room:room-compiler:${vRoom}") - val vNav = "2.4.0-rc01" + val vNav = "2.5.0-alpha01" implementation("androidx.navigation:navigation-fragment-ktx:${vNav}") implementation("androidx.navigation:navigation-ui-ktx:${vNav}") implementation("androidx.biometric:biometric:1.1.0") - implementation("androidx.constraintlayout:constraintlayout:2.1.2") + implementation("androidx.constraintlayout:constraintlayout:2.1.3") implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") implementation("androidx.appcompat:appcompat:1.4.1") - implementation("androidx.preference:preference:1.1.1") + implementation("androidx.preference:preference:1.2.0") implementation("androidx.recyclerview:recyclerview:1.2.1") - implementation("androidx.fragment:fragment-ktx:1.4.0") + implementation("androidx.fragment:fragment-ktx:1.4.1") implementation("androidx.transition:transition:1.4.1") implementation("androidx.core:core-ktx:1.7.0") implementation("androidx.core:core-splashscreen:1.0.0-beta01") - implementation("com.google.android.material:material:1.4.0") + implementation("com.google.android.material:material:1.5.0") } diff --git a/app/src/main/java/com/topjohnwu/magisk/di/ServiceLocator.kt b/app/src/main/java/com/topjohnwu/magisk/di/ServiceLocator.kt index 87bd3e8f1..1398e6b6c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/di/ServiceLocator.kt +++ b/app/src/main/java/com/topjohnwu/magisk/di/ServiceLocator.kt @@ -54,14 +54,14 @@ object ServiceLocator { object VMFactory : ViewModelProvider.Factory { @Suppress("UNCHECKED_CAST") - override fun create(clz: Class): T { - return when (clz) { + override fun create(modelClass: Class): T { + return when (modelClass) { HomeViewModel::class.java -> HomeViewModel(networkService) LogViewModel::class.java -> LogViewModel(logRepo) SuperuserViewModel::class.java -> SuperuserViewModel(policyDB) InstallViewModel::class.java -> InstallViewModel(networkService) SuRequestViewModel::class.java -> SuRequestViewModel(policyDB, timeoutPrefs) - else -> clz.newInstance() + else -> modelClass.newInstance() } as T } } @@ -69,7 +69,7 @@ object ServiceLocator { inline fun ViewModelStoreOwner.viewModel() = lazy(LazyThreadSafetyMode.NONE) { - ViewModelProvider(this, ServiceLocator.VMFactory).get(VM::class.java) + ViewModelProvider(this, ServiceLocator.VMFactory)[VM::class.java] } private fun createSuLogDatabase(context: Context) = diff --git a/app/src/main/java/com/topjohnwu/magisk/view/MagiskDialog.kt b/app/src/main/java/com/topjohnwu/magisk/view/MagiskDialog.kt index e92eac551..8f97ab8d7 100644 --- a/app/src/main/java/com/topjohnwu/magisk/view/MagiskDialog.kt +++ b/app/src/main/java/com/topjohnwu/magisk/view/MagiskDialog.kt @@ -121,15 +121,15 @@ class MagiskDialog( super.onCreate(savedInstanceState) super.setContentView(binding.root) - val default = MaterialColors.getColor(context, R.attr.colorSurface, javaClass.canonicalName) + val default = MaterialColors.getColor(context, com.google.android.material.R.attr.colorSurface, javaClass.canonicalName) val surfaceColor = MaterialColors.getColor(context, R.attr.colorSurfaceSurfaceVariant, default) - val materialShapeDrawable = MaterialShapeDrawable(context, null, R.attr.alertDialogStyle, R.style.MaterialAlertDialog_MaterialComponents) + val materialShapeDrawable = MaterialShapeDrawable(context, null, androidx.appcompat.R.attr.alertDialogStyle, com.google.android.material.R.style.MaterialAlertDialog_MaterialComponents) materialShapeDrawable.initializeElevationOverlay(context) materialShapeDrawable.fillColor = ColorStateList.valueOf(surfaceColor) materialShapeDrawable.elevation = context.resources.getDimension(R.dimen.margin_generic) materialShapeDrawable.setCornerSize(context.resources.getDimension(R.dimen.l_50)) - val inset = context.resources.getDimensionPixelSize(R.dimen.appcompat_dialog_background_inset) + val inset = context.resources.getDimensionPixelSize(com.google.android.material.R.dimen.appcompat_dialog_background_inset) window?.apply { setBackgroundDrawable(InsetDrawable(materialShapeDrawable, inset, inset, inset, inset)) setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) diff --git a/app/src/main/java/com/topjohnwu/magisk/widget/ConcealableBottomNavigationView.java b/app/src/main/java/com/topjohnwu/magisk/widget/ConcealableBottomNavigationView.java index 016276941..4690c46fc 100644 --- a/app/src/main/java/com/topjohnwu/magisk/widget/ConcealableBottomNavigationView.java +++ b/app/src/main/java/com/topjohnwu/magisk/widget/ConcealableBottomNavigationView.java @@ -29,11 +29,11 @@ public class ConcealableBottomNavigationView extends BottomNavigationView { } public ConcealableBottomNavigationView(@NonNull Context context, @Nullable AttributeSet attrs) { - this(context, attrs, R.attr.bottomNavigationStyle); + this(context, attrs, com.google.android.material.R.attr.bottomNavigationStyle); } public ConcealableBottomNavigationView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - this(context, attrs, defStyleAttr, R.style.Widget_Design_BottomNavigationView); + this(context, attrs, defStyleAttr, com.google.android.material.R.style.Widget_Design_BottomNavigationView); } public ConcealableBottomNavigationView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 37991b40b..7242f64f0 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { `kotlin-dsl` } @@ -15,10 +17,16 @@ gradlePlugin { } } +tasks.withType { + kotlinOptions { + jvmTarget = "11" + } +} + dependencies { implementation(kotlin("gradle-plugin", "1.6.10")) - implementation("com.android.tools.build:gradle:7.0.4") - implementation("androidx.navigation:navigation-safe-args-gradle-plugin:2.4.0-rc01") + implementation("com.android.tools.build:gradle:7.1.0") + implementation("androidx.navigation:navigation-safe-args-gradle-plugin:2.5.0-alpha01") implementation("io.michaelrocks:paranoid-gradle-plugin:0.3.7") implementation("org.eclipse.jgit:org.eclipse.jgit:5.12.0.202106070339-r") } diff --git a/buildSrc/src/main/java/Setup.kt b/buildSrc/src/main/java/Setup.kt index 5da9cef1f..d7911e75a 100644 --- a/buildSrc/src/main/java/Setup.kt +++ b/buildSrc/src/main/java/Setup.kt @@ -29,7 +29,7 @@ fun Project.setupCommon() { androidBase { compileSdkVersion(31) buildToolsVersion = "31.0.0" - ndkPath = "${System.getenv("ANDROID_SDK_ROOT")}/ndk/magisk" + ndkPath = "$sdkDirectory/ndk/magisk" defaultConfig { minSdk = 21 diff --git a/gradle.properties b/gradle.properties index e79d61d39..b1620fe1e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,6 +24,7 @@ org.gradle.caching=true android.useAndroidX=true android.databinding.incremental=true android.injected.testOnly=false +android.nonTransitiveRClass=true # Magisk magisk.stubVersion=23