- Update to Api 35 - Update all dependencies that were blocked because they require Api 35 - fix some deprecation warnings - implement the now required edge-to-edge mode Edge-to-edge mode means that we now draw under the status bar and the navigation bar and need to make sure we don't overlap with them. Previously the system would do that for us, and we would only provide the color we want the bars in. For the edge-to-edge mode there are two Apis that are important: - `fitsSystemWindows` - some Widgets, mostly from the Material library, automatically handle system insets if you set this attribute on them to true - `ViewCompat.setOnApplyWindowInsetsListener` - this allows you to manually handle the various insets. By returning new insets from the callback it is possible to tell the system which ones are handled and which ones should be taken care of by another view. In most places edge-to-edge was straightforward to implement, except in `ComposeActivity`, `AccountActivity` and `MainActivity` which required a more custom approach, and a hacky solution to make landscape mode work in `BaseActivity`. There is also the `ViewCompat.setWindowInsetsAnimationCallback` Api which allows animating with moving insets. I used that in `LoginActivity` and `ComposeActivity` to animate the Views together with the keyboard. On Android Versions below 15 (Api <= 34) Tusky will look almost the same as before. I think the only exception is the main bottom bar, which is now slighty larger. We customized it to be smaller than the default, but in edge-to-edge mode the height needs to be `wrap_content` or it won't handle insets correctly. Screenshots: <img src="https://github.com/user-attachments/assets/2a1bf5d9-79fb-48eb-affc-1cbb1164d5f0" width="280"/> <img src="https://github.com/user-attachments/assets/9edccdf2-c0e9-4881-a6df-bd0872934f28" width="280"/> <img src="https://github.com/user-attachments/assets/2916a271-f53e-4d38-a83a-69083eb3053f" width="280"/>
192 lines
5.6 KiB
Groovy
192 lines
5.6 KiB
Groovy
plugins {
|
|
alias(libs.plugins.android.application)
|
|
alias(libs.plugins.google.ksp)
|
|
alias(libs.plugins.hilt.android)
|
|
alias(libs.plugins.kotlin.android)
|
|
alias(libs.plugins.kotlin.parcelize)
|
|
}
|
|
|
|
apply from: 'getGitSha.gradle'
|
|
|
|
final def gitSha = ext.getGitSha()
|
|
|
|
// The app name
|
|
final def APP_NAME = "Tusky"
|
|
// The application id. Must be unique, e.g. based on your domain
|
|
final def APP_ID = "com.keylesspalace.tusky"
|
|
// url of a custom app logo. Recommended size at least 600x600. Keep empty to use the Tusky elephant friend.
|
|
final def CUSTOM_LOGO_URL = ""
|
|
// e.g. mastodon.social. Keep empty to not suggest any instance on the signup screen
|
|
final def CUSTOM_INSTANCE = ""
|
|
// link to your support account. Will be linked on the about page when not empty.
|
|
final def SUPPORT_ACCOUNT_URL = "https://mastodon.social/@Tusky"
|
|
|
|
android {
|
|
compileSdk 35
|
|
namespace "com.keylesspalace.tusky"
|
|
defaultConfig {
|
|
applicationId APP_ID
|
|
namespace "com.keylesspalace.tusky"
|
|
minSdk 24
|
|
targetSdk 35
|
|
versionCode 129
|
|
versionName "27.2"
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
vectorDrawables.useSupportLibrary = true
|
|
|
|
resValue "string", "app_name", APP_NAME
|
|
|
|
buildConfigField("String", "CUSTOM_LOGO_URL", "\"$CUSTOM_LOGO_URL\"")
|
|
buildConfigField("String", "CUSTOM_INSTANCE", "\"$CUSTOM_INSTANCE\"")
|
|
buildConfigField("String", "SUPPORT_ACCOUNT_URL", "\"$SUPPORT_ACCOUNT_URL\"")
|
|
}
|
|
buildTypes {
|
|
debug {
|
|
isDefault true
|
|
}
|
|
release {
|
|
minifyEnabled true
|
|
shrinkResources true
|
|
proguardFiles 'proguard-rules.pro'
|
|
|
|
kotlinOptions {
|
|
freeCompilerArgs = [
|
|
"-Xno-param-assertions",
|
|
"-Xno-call-assertions",
|
|
"-Xno-receiver-assertions"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
|
|
flavorDimensions += "color"
|
|
productFlavors {
|
|
blue {}
|
|
green {
|
|
resValue "string", "app_name", APP_NAME + " Test"
|
|
applicationIdSuffix ".test"
|
|
versionNameSuffix "-" + gitSha
|
|
isDefault true
|
|
}
|
|
}
|
|
|
|
lint {
|
|
lintConfig file("lint.xml")
|
|
// Regenerate by deleting the file and running `./gradlew app:lintGreenDebug`
|
|
baseline = file("lint-baseline.xml")
|
|
}
|
|
|
|
buildFeatures {
|
|
buildConfig true
|
|
resValues true
|
|
viewBinding true
|
|
}
|
|
|
|
testOptions {
|
|
unitTests {
|
|
returnDefaultValues = true
|
|
includeAndroidResources = true
|
|
}
|
|
unitTests.all {
|
|
systemProperty 'robolectric.logging.enabled', 'true'
|
|
systemProperty 'robolectric.lazyload', 'ON'
|
|
}
|
|
}
|
|
sourceSets {
|
|
// workaround to have migrations available in unit tests
|
|
// https://github.com/robolectric/robolectric/issues/3928#issuecomment-395309991
|
|
debug.assets.srcDirs += files("$projectDir/schemas".toString())
|
|
}
|
|
|
|
// Exclude unneeded files added by libraries
|
|
packagingOptions.resources.excludes += [
|
|
'LICENSE_OFL',
|
|
'LICENSE_UNICODE',
|
|
]
|
|
|
|
bundle {
|
|
language {
|
|
// bundle all languages in every apk so the dynamic language switching works
|
|
enableSplit = false
|
|
}
|
|
}
|
|
dependenciesInfo {
|
|
includeInApk false
|
|
includeInBundle false
|
|
}
|
|
applicationVariants.configureEach { variant ->
|
|
variant.outputs.configureEach {
|
|
outputFileName = "Tusky_${variant.versionName}_${variant.versionCode}_${gitSha}_" +
|
|
"${variant.flavorName}_${buildType.name}.apk"
|
|
}
|
|
}
|
|
}
|
|
|
|
ksp {
|
|
arg("room.schemaLocation", "$projectDir/schemas")
|
|
arg("room.generateKotlin", "true")
|
|
arg("room.incremental", "true")
|
|
}
|
|
|
|
configurations {
|
|
// JNI-only libraries don't play nicely with Robolectric
|
|
// see https://github.com/tuskyapp/Tusky/pull/3367
|
|
testImplementation.exclude group: "org.conscrypt", module: "conscrypt-android"
|
|
testRuntime.exclude group: "org.conscrypt", module: "conscrypt-android"
|
|
}
|
|
|
|
// library versions are in PROJECT_ROOT/gradle/libs.versions.toml
|
|
dependencies {
|
|
implementation libs.kotlinx.coroutines.android
|
|
|
|
implementation libs.bundles.androidx
|
|
implementation libs.bundles.room
|
|
ksp libs.androidx.room.compiler
|
|
|
|
implementation libs.android.material
|
|
|
|
implementation libs.bundles.moshi
|
|
ksp libs.moshi.kotlin.codegen
|
|
|
|
implementation libs.bundles.retrofit
|
|
implementation libs.networkresult.calladapter
|
|
|
|
implementation libs.bundles.okhttp
|
|
implementation libs.okio
|
|
|
|
implementation libs.conscrypt.android
|
|
|
|
implementation libs.bundles.glide
|
|
ksp libs.glide.compiler
|
|
|
|
implementation libs.hilt.android
|
|
ksp libs.hilt.compiler
|
|
implementation libs.androidx.hilt.work
|
|
ksp libs.androidx.hilt.compiler
|
|
|
|
implementation libs.sparkbutton
|
|
|
|
implementation libs.touchimageview
|
|
|
|
implementation libs.bundles.material.drawer
|
|
implementation libs.material.typeface
|
|
|
|
implementation libs.image.cropper
|
|
|
|
implementation libs.bundles.filemojicompat
|
|
|
|
implementation libs.bouncycastle
|
|
implementation libs.unified.push
|
|
|
|
implementation libs.bundles.xmldiff
|
|
|
|
testImplementation libs.androidx.test.junit
|
|
testImplementation libs.robolectric
|
|
testImplementation libs.bundles.mockito
|
|
testImplementation libs.mockwebserver
|
|
testImplementation libs.androidx.core.testing
|
|
testImplementation libs.androidx.room.testing
|
|
testImplementation libs.kotlinx.coroutines.test
|
|
testImplementation libs.androidx.work.testing
|
|
testImplementation libs.turbine
|
|
}
|