Skip to content

Commit

Permalink
Merge pull request #115 from DroidKaigi/change-app-name
Browse files Browse the repository at this point in the history
Change app name
  • Loading branch information
takahirom authored Sep 3, 2022
2 parents 91715b4 + 4f62a70 commit 6e17b80
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
27 changes: 27 additions & 0 deletions app-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import com.android.build.api.variant.ResValue

plugins {
id("droidkaigi.primitive.androidapplication")
id("droidkaigi.primitive.android.kotlin")
Expand Down Expand Up @@ -37,6 +39,31 @@ android {
}
}

androidComponents {
onVariants { variant ->
val appName = if (variant.name == "prodRelease") {
"DroidKaigi 2022"
} else {
val baseName = "Kaigi22"
val networkFlavor = variant
.productFlavors
.first { it.first == "network" }
val network = networkFlavor.second
val buildType = if (variant.buildType == "debug") {
"-d"
} else {
"-r"
}
"$baseName$network$buildType"
}

variant.resValues.put(
variant.makeResValueKey("string", "app_name"),
ResValue(appName)
)
}
}

dependencies {
implementation(projects.featureSessions)
implementation(projects.featureContributors)
Expand Down
1 change: 0 additions & 1 deletion app-android/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<resources>
<string name="app_name">android-project-template-2022</string>
</resources>

0 comments on commit 6e17b80

Please sign in to comment.