-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Assuming:
- domain name =
com.mitch
- app name =
Todo
-
// BEFORE rootProject.name = "template" // AFTER rootProject.name = "todo"
-
package name from
com.mitch.template
tocom.mitch.todo
see how -
// BEFORE val packageName = "com.mitch.template" enum class TemplateBuildType enum class TemplateFlavorDimension enum class TemplateFlavor(val dimension: TemplateFlavorDimension... // AFTER val packageName = "com.mitch.todo" enum class TodoBuildType enum class TodoFlavorDimension enum class TodoFlavor(val dimension: TodoFlavorDimension...
-
rename TemplateApplication.kt to
TodoApplication.kt
and its class:// BEFORE class TemplateApplication : Application() // AFTER class TodoApplication : Application()
-
<!-- BEFORE --> android:name=".TemplateApplication" <!-- AFTER --> android:name=".TodoApplication"
-
rename TemplateAppState.kt and its function and class:
// BEFORE fun rememberTemplateAppState() // AFTER fun rememberTodoAppState() // BEFORE class TemplateAppState() // AFTER class TodoAppState()
-
rename TemplateTheme.kt to
TodoTheme.kt
and its function and design system helper:// BEFORE typealias TemplateDesignSystem = MaterialTheme fun TemplateTheme() // AFTER typealias TodoDesignSystem = MaterialTheme fun TodoTheme()
Warning
use TodoDesignSystem
everywhere instead of MaterialTheme and apply the next steps to enforce this pattern.
-
rename TemplateIcons.kt to
TodoIcons.kt
and its object:// BEFORE object TemplateIcons // AFTER object TodoIcons
-
rename TemplateDestination.kt to
TodoDestination.kt
and its sealed interface:// BEFORE sealed interface TemplateDestination // AFTER sealed interface TodoDestination
-
rename TemplateNavHost.kt to
TodoNavHost.kt
and its @Composable:// BEFORE @Composable fun TemplateNavHost // AFTER @Composable fun TodoNavHost
-
// BEFORE option java_package = "com.mitch.template.data.userprefs"; ... TemplateThemePreferenceProto theme = 1; enum TemplateThemePreferenceProto ... // AFTER option java_package = "com.mitch.todo.data.userprefs"; ... TodoThemePreferenceProto theme = 1; enum TodoThemePreferenceProto ...
-
rename TemplateLanguagePreference.kt to
TodoLanguagePreference.kt
and its enum class:// BEFORE enum class TemplateLanguagePreference // AFTER enum class TodoLanguagePreference
-
rename TemplateThemePreference.kt to
TodoThemePreference.kt
and its enum class:// BEFORE enum class TemplateThemePreference // AFTER enum class TodoThemePreference
-
rename TemplateUserPreferences.kt to
TemplateUserPreferences.kt
and its data class:// BEFORE data class TemplateUserPreferences // AFTER data class TemplateUserPreferences
-
in strings.xml:
<!-- BEFORE --> <string name="app_name">Template</string> <!-- AFTER --> <string name="app_name">Todo</string>
⚠️ do this for every strings.xml file (i.e. for each app-supported language and build type) -
app supported languages in:
⚠️ you must also create theres/values-*language tag*
folder containing thestrings.xml
file for each language💯 here is a list of all the supported language tags
-
in themes.xml rename:
-
NightAdjusted.Theme.Template
➡️NightAdjusted.Theme.Todo
-
Theme.Template
➡️Theme.Todo
-
Theme.Template.Splash
➡️Theme.Todo.Splash
-
-
rename TemplateDatabase.kt to
TodoDatabase.kt
and its abstract class:// BEFORE abstract class TemplateDatabase : RoomDatabase() { } // AFTER abstract class TodoDatabase : RoomDatabase() { }
-
in DefaultDependenciesProvider.kt:
// BEFORE override val database: TemplateDatabase by lazy { Room.databaseBuilder( context, TemplateDatabase::class.java, "template.db" ).build() } // AFTER override val database: TodoDatabase by lazy { Room.databaseBuilder( context, TodoDatabase::class.java, "todo.db" ).build() }
-
update all references of "template/Template" inside ui/designsystem/components/snackbars to "todo/Todo"
-
to change formatting rules, edit detekt.yml
-
to change versions, dependencies and plugins, edit this file
-
in build.gradle.kts, change the
Lint-Registry-v2
attribute:// BEFORE attributes["Lint-Registry-v2"] = "com.mitch.template.lint.TemplateIssueRegistry" // AFTER attributes["Lint-Registry-v2"] = "com.mitch.todo.lint.TodoIssueRegistry"
-
rename TemplateIssueRegistry to
TodoIssueRegistry.kt
and update vendor info. -
in com.android.tools.lint.client.api.IssueRegistry update issue registry package.
// BEFORE com.mitch.template.lint.TemplateIssueRegistry // AFTER com.mitch.todo.lint.TodoIssueRegistry
-
in DesignSystemDetector update replaces:
// BEFORE Reportable( wrongName = "MaterialTheme", correctName = "TemplateTheme", fix = Fix(fileExceptions = listOf(FileName.of("TemplateTheme"))) { it.replace() .text("MaterialTheme") .with("com.mitch.template.ui.designsystem.TemplateTheme") .shortenNames() .build() } ) Reportable( wrongName = "Icons", correctName = "TemplateIcons", fix = Fix(fileExceptions = listOf(FileName.of("TemplateIcons"))) { it.replace() .text("Icons") .with("com.mitch.template.ui.designsystem.TemplateIcons") .shortenNames() .build() } ) Reportable( wrongName = "MaterialTheme", correctName = "TemplateDesignSystem", fix = Fix(fileExceptions = listOf(FileName.of("TemplateTheme"))) { it.replace() .text("MaterialTheme") .with("com.mitch.template.ui.designsystem.TemplateDesignSystem") .shortenNames() .build() } ) // AFTER Reportable( wrongName = "MaterialTheme", correctName = "TodoTheme", fix = Fix(fileExceptions = listOf(FileName.of("TodoTheme"))) { it.replace() .text("MaterialTheme") .with("com.mitch.todo.ui.designsystem.TodoTheme") .shortenNames() .build() } ) Reportable( wrongName = "Icons", correctName = "TodoIcons", fix = Fix(fileExceptions = listOf(FileName.of("TodoIcons"))) { it.replace() .text("Icons") .with("com.mitch.todo.ui.designsystem.TodoIcons") .shortenNames() .build() } ) Reportable( wrongName = "MaterialTheme", correctName = "TodoDesignSystem", fix = Fix(fileExceptions = listOf(FileName.of("TodoTheme"))) { it.replace() .text("MaterialTheme") .with("com.mitch.todo.ui.designsystem.TodoDesignSystem") .shortenNames() .build() } )
- delete the old
build
folders inside all modules -
Make Project
to generate all the files needed to run the app - run the app and you should see the Splashscreen followed by the HomeScreen