diff --git a/moxy-templates/MoxyActivity/globals.xml.ftl b/moxy-templates/Java/MoxyActivity/globals.xml.ftl similarity index 100% rename from moxy-templates/MoxyActivity/globals.xml.ftl rename to moxy-templates/Java/MoxyActivity/globals.xml.ftl diff --git a/moxy-templates/MoxyActivity/recipe.xml.ftl b/moxy-templates/Java/MoxyActivity/recipe.xml.ftl similarity index 100% rename from moxy-templates/MoxyActivity/recipe.xml.ftl rename to moxy-templates/Java/MoxyActivity/recipe.xml.ftl diff --git a/moxy-templates/MoxyActivity/root/AndroidManifest.xml.ftl b/moxy-templates/Java/MoxyActivity/root/AndroidManifest.xml.ftl similarity index 100% rename from moxy-templates/MoxyActivity/root/AndroidManifest.xml.ftl rename to moxy-templates/Java/MoxyActivity/root/AndroidManifest.xml.ftl diff --git a/moxy-templates/MoxyActivity/root/res/layout/activity_blank.xml.ftl b/moxy-templates/Java/MoxyActivity/root/res/layout/activity_blank.xml.ftl similarity index 100% rename from moxy-templates/MoxyActivity/root/res/layout/activity_blank.xml.ftl rename to moxy-templates/Java/MoxyActivity/root/res/layout/activity_blank.xml.ftl diff --git a/moxy-templates/MoxyActivity/root/src/app_package/presentation/presenter/BlankPresenter.java.ftl b/moxy-templates/Java/MoxyActivity/root/src/app_package/presentation/presenter/BlankPresenter.java.ftl similarity index 100% rename from moxy-templates/MoxyActivity/root/src/app_package/presentation/presenter/BlankPresenter.java.ftl rename to moxy-templates/Java/MoxyActivity/root/src/app_package/presentation/presenter/BlankPresenter.java.ftl diff --git a/moxy-templates/MoxyActivity/root/src/app_package/presentation/view/BlankView.java.ftl b/moxy-templates/Java/MoxyActivity/root/src/app_package/presentation/view/BlankView.java.ftl similarity index 100% rename from moxy-templates/MoxyActivity/root/src/app_package/presentation/view/BlankView.java.ftl rename to moxy-templates/Java/MoxyActivity/root/src/app_package/presentation/view/BlankView.java.ftl diff --git a/moxy-templates/MoxyActivity/root/src/app_package/ui/activity/BlankActivity.java.ftl b/moxy-templates/Java/MoxyActivity/root/src/app_package/ui/activity/BlankActivity.java.ftl similarity index 100% rename from moxy-templates/MoxyActivity/root/src/app_package/ui/activity/BlankActivity.java.ftl rename to moxy-templates/Java/MoxyActivity/root/src/app_package/ui/activity/BlankActivity.java.ftl diff --git a/moxy-templates/MoxyActivity/template.xml b/moxy-templates/Java/MoxyActivity/template.xml similarity index 100% rename from moxy-templates/MoxyActivity/template.xml rename to moxy-templates/Java/MoxyActivity/template.xml diff --git a/moxy-templates/MoxyActivity/template_moxy_activity.png b/moxy-templates/Java/MoxyActivity/template_moxy_activity.png similarity index 100% rename from moxy-templates/MoxyActivity/template_moxy_activity.png rename to moxy-templates/Java/MoxyActivity/template_moxy_activity.png diff --git a/moxy-templates/MoxyFragment/globals.xml.ftl b/moxy-templates/Java/MoxyFragment/globals.xml.ftl similarity index 100% rename from moxy-templates/MoxyFragment/globals.xml.ftl rename to moxy-templates/Java/MoxyFragment/globals.xml.ftl diff --git a/moxy-templates/MoxyFragment/recipe.xml.ftl b/moxy-templates/Java/MoxyFragment/recipe.xml.ftl similarity index 100% rename from moxy-templates/MoxyFragment/recipe.xml.ftl rename to moxy-templates/Java/MoxyFragment/recipe.xml.ftl diff --git a/moxy-templates/MoxyFragment/root/res/layout/fragment_blank.xml.ftl b/moxy-templates/Java/MoxyFragment/root/res/layout/fragment_blank.xml.ftl similarity index 100% rename from moxy-templates/MoxyFragment/root/res/layout/fragment_blank.xml.ftl rename to moxy-templates/Java/MoxyFragment/root/res/layout/fragment_blank.xml.ftl diff --git a/moxy-templates/MoxyFragment/root/src/app_package/presentation/presenter/BlankPresenter.java.ftl b/moxy-templates/Java/MoxyFragment/root/src/app_package/presentation/presenter/BlankPresenter.java.ftl similarity index 100% rename from moxy-templates/MoxyFragment/root/src/app_package/presentation/presenter/BlankPresenter.java.ftl rename to moxy-templates/Java/MoxyFragment/root/src/app_package/presentation/presenter/BlankPresenter.java.ftl diff --git a/moxy-templates/MoxyFragment/root/src/app_package/presentation/view/BlankView.java.ftl b/moxy-templates/Java/MoxyFragment/root/src/app_package/presentation/view/BlankView.java.ftl similarity index 100% rename from moxy-templates/MoxyFragment/root/src/app_package/presentation/view/BlankView.java.ftl rename to moxy-templates/Java/MoxyFragment/root/src/app_package/presentation/view/BlankView.java.ftl diff --git a/moxy-templates/MoxyFragment/root/src/app_package/ui/fragment/BlankFragment.java.ftl b/moxy-templates/Java/MoxyFragment/root/src/app_package/ui/fragment/BlankFragment.java.ftl similarity index 100% rename from moxy-templates/MoxyFragment/root/src/app_package/ui/fragment/BlankFragment.java.ftl rename to moxy-templates/Java/MoxyFragment/root/src/app_package/ui/fragment/BlankFragment.java.ftl diff --git a/moxy-templates/MoxyFragment/template.xml b/moxy-templates/Java/MoxyFragment/template.xml similarity index 100% rename from moxy-templates/MoxyFragment/template.xml rename to moxy-templates/Java/MoxyFragment/template.xml diff --git a/moxy-templates/MoxyFragment/template_moxy_fragment.png b/moxy-templates/Java/MoxyFragment/template_moxy_fragment.png similarity index 100% rename from moxy-templates/MoxyFragment/template_moxy_fragment.png rename to moxy-templates/Java/MoxyFragment/template_moxy_fragment.png diff --git a/moxy-templates/Kotlin/MoxyActivity/globals.xml.ftl b/moxy-templates/Kotlin/MoxyActivity/globals.xml.ftl new file mode 100644 index 00000000..4cac0e5d --- /dev/null +++ b/moxy-templates/Kotlin/MoxyActivity/globals.xml.ftl @@ -0,0 +1,6 @@ + + + <#include "../common/common_globals.xml.ftl" /> + + + diff --git a/moxy-templates/Kotlin/MoxyActivity/recipe.xml.ftl b/moxy-templates/Kotlin/MoxyActivity/recipe.xml.ftl new file mode 100644 index 00000000..c769d234 --- /dev/null +++ b/moxy-templates/Kotlin/MoxyActivity/recipe.xml.ftl @@ -0,0 +1,34 @@ + + + + <#if includeLayout> + + + + + + + + + + + <#if includeView> + + + + + + <#if includePresenter> + + + + + + + + diff --git a/moxy-templates/Kotlin/MoxyActivity/root/AndroidManifest.xml.ftl b/moxy-templates/Kotlin/MoxyActivity/root/AndroidManifest.xml.ftl new file mode 100644 index 00000000..a80f84e4 --- /dev/null +++ b/moxy-templates/Kotlin/MoxyActivity/root/AndroidManifest.xml.ftl @@ -0,0 +1,6 @@ + + + + + + diff --git a/moxy-templates/Kotlin/MoxyActivity/root/res/layout/activity_blank.xml.ftl b/moxy-templates/Kotlin/MoxyActivity/root/res/layout/activity_blank.xml.ftl new file mode 100644 index 00000000..59b57d12 --- /dev/null +++ b/moxy-templates/Kotlin/MoxyActivity/root/res/layout/activity_blank.xml.ftl @@ -0,0 +1,9 @@ + + + + + diff --git a/moxy-templates/Kotlin/MoxyActivity/root/src/app_package/presentation/presenter/BlankPresenter.kt.ftl b/moxy-templates/Kotlin/MoxyActivity/root/src/app_package/presentation/presenter/BlankPresenter.kt.ftl new file mode 100644 index 00000000..ddc221b8 --- /dev/null +++ b/moxy-templates/Kotlin/MoxyActivity/root/src/app_package/presentation/presenter/BlankPresenter.kt.ftl @@ -0,0 +1,10 @@ +package ${packageName}.presentation.presenter${dotSubpackage} + +import com.arellomobile.mvp.InjectViewState +import com.arellomobile.mvp.MvpPresenter +import ${packageName}.presentation.view${dotSubpackage}.${viewName} + +@InjectViewState +class ${presenterName} : MvpPresenter<${viewName}>() { + +} diff --git a/moxy-templates/Kotlin/MoxyActivity/root/src/app_package/presentation/view/BlankView.kt.ftl b/moxy-templates/Kotlin/MoxyActivity/root/src/app_package/presentation/view/BlankView.kt.ftl new file mode 100644 index 00000000..bd24a774 --- /dev/null +++ b/moxy-templates/Kotlin/MoxyActivity/root/src/app_package/presentation/view/BlankView.kt.ftl @@ -0,0 +1,7 @@ +package ${packageName}.presentation.view${dotSubpackage} + +import com.arellomobile.mvp.MvpView + +interface ${viewName} : MvpView { + +} diff --git a/moxy-templates/Kotlin/MoxyActivity/root/src/app_package/ui/activity/BlankActivity.kt.ftl b/moxy-templates/Kotlin/MoxyActivity/root/src/app_package/ui/activity/BlankActivity.kt.ftl new file mode 100644 index 00000000..b00970ea --- /dev/null +++ b/moxy-templates/Kotlin/MoxyActivity/root/src/app_package/ui/activity/BlankActivity.kt.ftl @@ -0,0 +1,34 @@ +package ${packageName}.ui.activity${dotSubpackage} + +import android.content.Context +import android.content.Intent +import android.os.Bundle +<#if !extendsBaseActivity> +import com.arellomobile.mvp.MvpActivity + +import com.arellomobile.mvp.presenter.InjectPresenter +import ${packageName}.R +import ${packageName}.presentation.view${dotSubpackage}.${viewName} +import ${packageName}.presentation.presenter${dotSubpackage}.${presenterName} +<#if extendsBaseActivity> +import ${packageName}.ui.activity.BaseActivity + + +class ${className} : <#if extendsBaseActivity>BaseActivity()<#else>MvpActivity(), ${viewName} { + companion object { + const val TAG = "${className}" + <#if includeFactory> + fun getIntent(context: Context): Intent = Intent(context, ${className}::class.java) + + } + + @InjectPresenter + lateinit var m${presenterName}: ${presenterName} + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + <#if includeLayout> + setContentView(R.layout.${activityName}) + + } +} diff --git a/moxy-templates/Kotlin/MoxyActivity/template.xml b/moxy-templates/Kotlin/MoxyActivity/template.xml new file mode 100644 index 00000000..9fe8cf87 --- /dev/null +++ b/moxy-templates/Kotlin/MoxyActivity/template.xml @@ -0,0 +1,109 @@ + + diff --git a/moxy-templates/Kotlin/MoxyActivity/template_moxy_activity.png b/moxy-templates/Kotlin/MoxyActivity/template_moxy_activity.png new file mode 100644 index 00000000..3553819b Binary files /dev/null and b/moxy-templates/Kotlin/MoxyActivity/template_moxy_activity.png differ diff --git a/moxy-templates/Kotlin/MoxyFragment/globals.xml.ftl b/moxy-templates/Kotlin/MoxyFragment/globals.xml.ftl new file mode 100644 index 00000000..4cac0e5d --- /dev/null +++ b/moxy-templates/Kotlin/MoxyFragment/globals.xml.ftl @@ -0,0 +1,6 @@ + + + <#include "../common/common_globals.xml.ftl" /> + + + diff --git a/moxy-templates/Kotlin/MoxyFragment/recipe.xml.ftl b/moxy-templates/Kotlin/MoxyFragment/recipe.xml.ftl new file mode 100644 index 00000000..24934a95 --- /dev/null +++ b/moxy-templates/Kotlin/MoxyFragment/recipe.xml.ftl @@ -0,0 +1,30 @@ + + + + <#if includeLayout> + + + + + + + + + + <#if includeView> + + + + + + <#if includePresenter> + + + + + + diff --git a/moxy-templates/Kotlin/MoxyFragment/root/res/layout/fragment_blank.xml.ftl b/moxy-templates/Kotlin/MoxyFragment/root/res/layout/fragment_blank.xml.ftl new file mode 100644 index 00000000..e942383a --- /dev/null +++ b/moxy-templates/Kotlin/MoxyFragment/root/res/layout/fragment_blank.xml.ftl @@ -0,0 +1,7 @@ + + + diff --git a/moxy-templates/Kotlin/MoxyFragment/root/src/app_package/presentation/presenter/BlankPresenter.kt.ftl b/moxy-templates/Kotlin/MoxyFragment/root/src/app_package/presentation/presenter/BlankPresenter.kt.ftl new file mode 100644 index 00000000..ddc221b8 --- /dev/null +++ b/moxy-templates/Kotlin/MoxyFragment/root/src/app_package/presentation/presenter/BlankPresenter.kt.ftl @@ -0,0 +1,10 @@ +package ${packageName}.presentation.presenter${dotSubpackage} + +import com.arellomobile.mvp.InjectViewState +import com.arellomobile.mvp.MvpPresenter +import ${packageName}.presentation.view${dotSubpackage}.${viewName} + +@InjectViewState +class ${presenterName} : MvpPresenter<${viewName}>() { + +} diff --git a/moxy-templates/Kotlin/MoxyFragment/root/src/app_package/presentation/view/BlankView.kt.ftl b/moxy-templates/Kotlin/MoxyFragment/root/src/app_package/presentation/view/BlankView.kt.ftl new file mode 100644 index 00000000..bd24a774 --- /dev/null +++ b/moxy-templates/Kotlin/MoxyFragment/root/src/app_package/presentation/view/BlankView.kt.ftl @@ -0,0 +1,7 @@ +package ${packageName}.presentation.view${dotSubpackage} + +import com.arellomobile.mvp.MvpView + +interface ${viewName} : MvpView { + +} diff --git a/moxy-templates/Kotlin/MoxyFragment/root/src/app_package/ui/fragment/BlankFragment.kt.ftl b/moxy-templates/Kotlin/MoxyFragment/root/src/app_package/ui/fragment/BlankFragment.kt.ftl new file mode 100644 index 00000000..29a7c218 --- /dev/null +++ b/moxy-templates/Kotlin/MoxyFragment/root/src/app_package/ui/fragment/BlankFragment.kt.ftl @@ -0,0 +1,42 @@ +package ${packageName}.ui.fragment${dotSubpackage} + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import ${packageName}.R +import ${packageName}.presentation.view${dotSubpackage}.${viewName} +import ${packageName}.presentation.presenter${dotSubpackage}.${presenterName} + +import com.arellomobile.mvp.MvpFragment +import com.arellomobile.mvp.presenter.InjectPresenter + +class ${className} : MvpFragment(), ${viewName} { + companion object { + const val TAG = "${className}" +<#if includeFactory> + + fun newInstance(): ${className} { + val fragment: ${className} = ${className}() + val args: Bundle = Bundle() + fragment.arguments = args + return fragment + } + + } + + @InjectPresenter + lateinit var m${presenterName}: ${presenterName} + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle?): View? { +<#if includeLayout> + return inflater.inflate(R.layout.${fragmentName}, container, false) + + } + + override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + } +} diff --git a/moxy-templates/Kotlin/MoxyFragment/template.xml b/moxy-templates/Kotlin/MoxyFragment/template.xml new file mode 100644 index 00000000..c9027a88 --- /dev/null +++ b/moxy-templates/Kotlin/MoxyFragment/template.xml @@ -0,0 +1,100 @@ + + diff --git a/moxy-templates/Kotlin/MoxyFragment/template_moxy_fragment.png b/moxy-templates/Kotlin/MoxyFragment/template_moxy_fragment.png new file mode 100644 index 00000000..3553819b Binary files /dev/null and b/moxy-templates/Kotlin/MoxyFragment/template_moxy_fragment.png differ diff --git a/moxy-templates/README.md b/moxy-templates/README.md index ee836bb0..dacbd91a 100644 --- a/moxy-templates/README.md +++ b/moxy-templates/README.md @@ -29,11 +29,10 @@ Our goal is generate this class set using Android Studio Templates

Template settings

Adding Moxy templates to Android Studio: - +* Download templates for **Java** from [Github](https://github.com/Arello-Mobile/Moxy/tree/master/moxy-templates/Java) or directly [using link](https://drive.google.com/file/d/0B0bXlVHPiZVXY2FVQkNLc1lMbW8/view?usp=sharing) +* Or download templates for **Kotlin** from [Github](https://github.com/Arello-Mobile/Moxy/tree/master/moxy-templates/Kotlin) +* Copy files to ANDROID_STUDIO_DIR/plugins/android/lib/templates/activities +* Restart Android Studio Managing hot keys for templates quick access: