Update gradle build settings

Update build settings to remove useless libraries [AppCompat], add useful libraries [LeakCanary], and also enable minifying on the release build [Which hadnt been enabled before somehow].
This commit is contained in:
OxygenCobalt 2020-09-04 12:19:36 -06:00
parent 4b3285cef0
commit e59009a0fa
2 changed files with 18 additions and 16 deletions

View file

@ -24,7 +24,7 @@ android {
buildTypes {
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
@ -45,18 +45,14 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
// --- SUPPORT ---
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
// Permissions
// General
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.activity:activity:1.2.0-alpha08'
implementation 'androidx.fragment:fragment:1.3.0-alpha08'
// Navigation
def navigation_version = "2.3.0"
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
// Layout
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
// Lifecycle
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
@ -64,6 +60,11 @@ dependencies {
// Viewpager
implementation 'androidx.viewpager2:viewpager2:1.0.0'
// Navigation
def navigation_version = "2.3.0"
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
// --- THIRD PARTY ---
// Image loading
implementation 'io.coil-kt:coil:0.12.0'
@ -73,6 +74,9 @@ dependencies {
// Lint
ktlint "com.pinterest:ktlint:0.37.2"
// Memory Leak checking
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
}
task ktlint(type: JavaExec, group: "verification") {

View file

@ -29,8 +29,6 @@ class LoadingFragment : Fragment(R.layout.fragment_loading) {
).get(LoadingViewModel::class.java)
}
private var noPerms = false
private lateinit var binding: FragmentLoadingBinding
private lateinit var permLauncher: ActivityResultLauncher<String>
@ -75,8 +73,6 @@ class LoadingFragment : Fragment(R.layout.fragment_loading) {
if (granted) {
wipeViews()
noPerms = false
loadingModel.retry()
}
}
@ -85,23 +81,25 @@ class LoadingFragment : Fragment(R.layout.fragment_loading) {
// This should be in MusicRepository, but the response comes faster than the view creation
// itself and therefore causes the error screen to not appear.
if (checkPerms()) {
noPerms = true
onNoPerms()
} else {
loadingModel.go()
}
Log.d(this::class.simpleName, "Fragment created.")
return binding.root
}
// Check for permissions. God help us all.
// Check for two things:
// - If Auxio needs to show the rationale for getting the READ_EXTERNAL_STORAGE perm
// - If Auxio straight up doesnt have the permission
private fun checkPerms(): Boolean {
return shouldShowRequestPermissionRationale(
Manifest.permission.READ_EXTERNAL_STORAGE
) || ContextCompat.checkSelfPermission(
requireContext(), Manifest.permission.READ_EXTERNAL_STORAGE
) == PackageManager.PERMISSION_DENIED || noPerms
) == PackageManager.PERMISSION_DENIED
}
private fun onMusicLoadResponse(repoResponse: MusicLoaderResponse?) {