All Projects → riggaroo → Android Studio Group Templates Mvp

riggaroo / Android Studio Group Templates Mvp

Example of template for Android Studio, to create a set of files for MVP functionality.

Projects that are alternatives of or similar to Android Studio Group Templates Mvp

Screenshots
Firefox Screenshots: the best way to take screenshots on the web.
Stars: ✭ 609 (+882.26%)
Mutual labels:  freemarker
Vs Freemarker
FreeMarker language colorization extension for Visual Studio Code
Stars: ✭ 17 (-72.58%)
Mutual labels:  freemarker
V5cmsjava
Spring+SpringMVC+Spring Data JPA+FreeMarker+Bootstarp(master分支),mybatis分支ORM使用的是MyBatis。
Stars: ✭ 29 (-53.23%)
Mutual labels:  freemarker
Freemarker
Apache Freemarker
Stars: ✭ 643 (+937.1%)
Mutual labels:  freemarker
Springboot Learning
🚕 spring boot学习案例,方便spring boot 初学者快速掌握相关知识
Stars: ✭ 724 (+1067.74%)
Mutual labels:  freemarker
Alfresco Datalist Constraints
Use datalists to maintain Alfresco model constraints
Stars: ✭ 7 (-88.71%)
Mutual labels:  freemarker
Fluent Rs
Rust implementation of Project Fluent
Stars: ✭ 503 (+711.29%)
Mutual labels:  freemarker
Freemarker Java 8
Library adding java.time support to FreeMarker
Stars: ✭ 37 (-40.32%)
Mutual labels:  freemarker
Springbootcodegenerator
又名大狼狗代码生成器,基于SpringBoot2+Freemarker的JAVA代码生成器,以释放双手为目的,支持mysql/oracle/pgsql三大数据库, 用DDL-SQL语句生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL等相关代码.
Stars: ✭ 810 (+1206.45%)
Mutual labels:  freemarker
Android Studio Templates
Android Studio Templates
Stars: ✭ 10 (-83.87%)
Mutual labels:  freemarker
Coolmeeting
更多 Java 教程----->
Stars: ✭ 689 (+1011.29%)
Mutual labels:  freemarker
Fs Blog
个人博客,Spring Boot 开山之作,采用 Spring Boot + MyBatis,前端 Bootstrap + LayUI,支持程序员非常青睐的轻量化的 Markdown 编辑器 Editor.md,支持标签分类检索
Stars: ✭ 700 (+1029.03%)
Mutual labels:  freemarker
Springbootunity
rabbitmq、redis、scheduled、socket、mongodb、Swagger2、spring data jpa、Thymeleaf、freemarker etc. (muti module spring boot project) (with spring boot framework,different bussiness scence with different technology。)
Stars: ✭ 845 (+1262.9%)
Mutual labels:  freemarker
Android Studio Mvp Template
Android MVP template for Android Studio
Stars: ✭ 636 (+925.81%)
Mutual labels:  freemarker
Blogmanageplatform
一个springboot项目的脚手架,追求简洁高速可扩展。
Stars: ✭ 34 (-45.16%)
Mutual labels:  freemarker
Android Studio Material Template
A template for Android Studio to create applications with material design and Navigation Drawer.
Stars: ✭ 596 (+861.29%)
Mutual labels:  freemarker
Loginandroidstudiotemplate
This template generates code snippets for Login with Presenter, View, Model and Activity classes. Following are the different styles of login fields that are generated from this template.
Stars: ✭ 18 (-70.97%)
Mutual labels:  freemarker
Skeleton
🔨 Nepxion Skeleton is a generic codes and files generator based on freemaker for any text formats, and provides skeleton of Spring Cloud with docker deployment 基于Docker & Spring Cloud的代码和文件的脚手架生成平台
Stars: ✭ 61 (-1.61%)
Mutual labels:  freemarker
Android Studio Templates
A set of templates for your Android Studio
Stars: ✭ 35 (-43.55%)
Mutual labels:  freemarker
Arc42 Gradle
Gradle project template for architecture documentation based on the arc42 template (s. http://www.arc42.de/)
Stars: ✭ 8 (-87.1%)
Mutual labels:  freemarker

android-studio-group-templates-mvp

Example of template for Android Studio, to create a set of files for MVP functionality.

Please read the blog post first as this is just an example implementation of the concepts described in the blog post: https://riggaroo.co.za/custom-file-template-group-android-studiointellij/

Important Note: This is just an example usage of file templates, I am not advocating this is the perfect solution for using MVP in Android. This sample is merely to show how you can create a set of files based on a template of files.

In order to use this in your project.

  • Create the following files in your project:

MvpView.java

public interface MvpView {
}

MvpPresenter.java

public interface MvpPresenter<V extends MvpView> {

    void attachView(V mvpView);

    void detachView();
}

BasePresenter.java

  /**
   * Base class that implements the Presenter interface and provides a base implementation for
   * attachView() and detachView(). It also handles keeping a reference to the mvpView that
   * can be accessed from the children classes by calling getView().
   */
  public class BasePresenter<T extends MvpView> implements MvpPresenter<T> {
  
      private T view;
  
      private CompositeSubscription compositeSubscription = new CompositeSubscription();
  
      @Override
      public void attachView(T mvpView) {
          view = mvpView;
      }
  
      @Override
      public void detachView() {
          view = null;
          compositeSubscription.clear();
      }
  
      public T getView() {
          return view;
      }
  
      public void checkViewAttached() {
          if (!isViewAttached()) {
              throw new MvpViewNotAttachedException();
          }
      }
  
      public boolean isViewAttached() {
          return view != null;
      }
  
      public void addSubscription(Subscription subscription) {
          this.compositeSubscription.add(subscription);
      }
  
      public static class MvpViewNotAttachedException extends RuntimeException {
          public MvpViewNotAttachedException() {
              super("Please call Presenter.attachView(MvpView) before" + " requesting data to the Presenter");
          }
      }
  }
  • You will need to change the package name of the import statement in the template files, as when you generate this template it will generate different import statements. You need to change it in the following places:

    • root/src/app_package/Contract.java.ftl,
    • root/src/app_package/MvpView.java.ftl
    • root/src/pp_package/Presenter.java.ftl

    Change the import statements in each of those files, to correspond with your package name.

  • Then place the folder from this projected into the following location in your Android Studio Installation:

/Applications/Android Studio.app/Contents/plugins/android/lib/templates/other/
  • Restart Android Studio, and then when you right click on a folder to create a new file, you will be able to see the new option to create a MVP Function.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].