Skip to content

Commit

Permalink
Remove templates plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
matejsemancik committed Mar 3, 2022
1 parent ef24905 commit 1888141
Show file tree
Hide file tree
Showing 32 changed files with 0 additions and 671 deletions.
71 changes: 0 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ of projects and it's production ready.
2. [Use Cases](#use-cases)
3. [Propagating data model changes into UI](#propagating-data-model-changes-into-ui)
4. [Stores (Repositories)](#stores-repositories)
5. [Templates](#templates)

## Getting started - Minimal project file hierarchy
Minimal working project must contain files as presented in `example-minimal`
Expand Down Expand Up @@ -589,76 +588,6 @@ doAfterActivityInjection<SampleActivity> { activity ->
```
See [these tests]([https://github.com/futuredapp/arkitekt](https://github.com/futuredapp/arkitekt/tree/4.x/example/src/sharedTest/java/app/futured/sample/ui)) in `example` module for more detailed samples of espresso test that can be executed as local unit tests or connected android tests.

## Templates

Arkitekt framework requires several files to be created with each new Activity or Fragment. To make the process of screen creation smooth, our framework is shipped with a template module. It contains templates for creating "Arkitekt Activity" and "Arkitekt Fragment" via Android Studio GUI.

To import templates into Android Studio follow these steps:

**On Mac/Linux**

1. Add plugin into your project Gradle file
```
plugins {
id "app.futured.arkitekt.templates" version "LatestVersion"
}
```
2. Sync Gradle dependencies
3. Run from your Android Studio terminal
```
./gradlew copyTemplates
```
4. Restart Android Studio

> Note: You can also run this task from Gradle sidebar in Android Studio. You can find it under **Tasks -> arkitekt -> copyTemplates**
**On Windows**

1. Copy folders */ArkitektActivity* and */ArkitektFragment* from *arkitekt\templates\src\main\resources\templates* in to *C:\Program Files\Android\Android Studio\plugins\android\lib\templates\other*

2. Restart/Start Android Studio


**Prerequisites to use templates**
1. `ConstraintLayout` dependency - Layout generated by template has `ConstraintLayout` as a root.
2. BaseClasses - `BaseBindingActivity` and `BaseBindingFragment` in package `your.app.pkg.ui.base`.

```kotlin
import androidx.databinding.ViewDataBinding
import app.futured.arkitekt.core.BaseViewModel
import app.futured.arkitekt.core.ViewState
import app.futured.arkitekt.dagger.activity.BaseDaggerBindingActivity
import your.app.pkg.BR

abstract class BaseBindingActivity<VM : BaseViewModel<VS>, VS : ViewState, B : ViewDataBinding> :
BaseDaggerBindingActivity<VM, VS, B>() {

override val brViewVariableId = BR.view
override val brViewModelVariableId = BR.viewModel
override val brViewStateVariableId = BR.viewState
}
```


```kotlin
import androidx.databinding.ViewDataBinding
import app.futured.arkitekt.core.BaseViewModel
import app.futured.arkitekt.core.ViewState
import app.futured.arkitekt.dagger.fragment.BaseDaggerBindingFragment
import your.app.pkg.BR

abstract class BaseBindingFragment<VM : BaseViewModel<VS>, VS : ViewState, B : ViewDataBinding> :
BaseDaggerBindingFragment<VM, VS, B>() {

override val brViewVariableId = BR.view
override val brViewModelVariableId = BR.viewModel
override val brViewStateVariableId = BR.viewState
}
```

When the templates are in place you can use them directly from GUI
![AS Example](extras/arkitekt_template_example.png)

# License
Arkitekt is available under the MIT license. See the [LICENSE file](LICENCE) for more information.

Expand Down
5 changes: 0 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ buildscript {
repositories {
google()
jcenter()
flatDir {
dirs("templates/build/libs")
}
}
dependencies {
classpath(Deps.gradlePlugin)
Expand All @@ -24,8 +21,6 @@ plugins {
idea
id(Deps.Plugins.detekt) version Versions.detekt
id(Deps.Plugins.ktlint) version Versions.ktlint
// uncomment this line for local testing purposes during template module development
// id(ProjectSettings.Templates.id) version ProjectSettings.version
}

tasks {
Expand Down
7 changes: 0 additions & 7 deletions buildSrc/src/main/kotlin/ProjectSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ object ProjectSettings {
*/
val version = System.getenv("VERSION_NAME") ?: "0.0.1-SNAPSHOT"

object Templates {
const val module = "templates"
const val id = "$group.$module"
const val name = "copyTemplates"
const val implementationClass = "app.futured.arkitekt.templates.Templates"
}

object Core {
const val artifact = "core"
const val libraryDescription = "Core module of Arkitekt framework"
Expand Down
1 change: 0 additions & 1 deletion extras/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# MVVM Android extras content

- **architecture-diagram.png** - A diagram simply describes the main parts of the architecture. The source file in the draw.io format can be changed in [Google Drive](https://drive.google.com/drive/u/1/folders/1SkculA_-hh0Is6bfxd8HrgF6Iv6hXQ3s) (if you've got permission).
- **arkitekt_template_example.png** - Screenshot showing where to find action to use our template files.
Binary file removed extras/arkitekt_template_example.png
Binary file not shown.
18 changes: 0 additions & 18 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,8 @@ include(
":rx-usecases",
":cr-usecases",
":bindingadapters",
":templates",
":arkitekt-lint",
":core-test",
":rx-usecases-test",
":cr-usecases-test"
)

pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
flatDir {
dirs("templates/build/libs")
}
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == "app.futured.arkitekt.templates") {
useModule("app.futured.arkitekt:templates:${requested.version}")
}
}
}
}
1 change: 0 additions & 1 deletion templates/.gitignore

This file was deleted.

41 changes: 0 additions & 41 deletions templates/build.gradle.kts

This file was deleted.

166 changes: 0 additions & 166 deletions templates/src/main/java/app/futured/arkitekt/templates/Templates.java

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1888141

Please sign in to comment.