V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
androidwing
V2EX  ›  Android

小弟开发了一款 Android Studio 插件,用来生成 MVP 的接口和实现类,求关注

  •  
  •   androidwing · Aug 25, 2016 · 13926 views
    This topic created in 3537 days ago, the information mentioned may be changed or developed.

    大家都知道在 Android 中 MVP 模式需要写很多繁琐的实现类,为了提高效率,便开发了一款直接生成接口与实现类的插件~~~ 插件可以直接在插件仓库搜索 MVPHelper 或者去 github 上下载 https://github.com/githubwing/MVPHelper 这里也弱弱的求个 star

    插件目前有 2 种模式,一种是常规型分包。

    image

    另一种是 Contract 型,这里对 Contract 型进行个简短的说明。。

    对于 MVP 模式,定义一个 Contract 类来放置 Model View Presenter 的接口,将大大减少类文件。将普通的接口替代如下:

    public interface GoodsInfoContract {
    
      public interface View{
    
      }
      public interface Presenter{
    
      }
      public interface Model{
    
      }
    
    }
    

    image

    8 replies    2016-09-03 09:25:55 +08:00
    kitalphaj
        1
    kitalphaj  
       Aug 26, 2016
    支持一下
    QuDump
        2
    QuDump  
       Aug 26, 2016
    已添加
    banxi1988
        3
    banxi1988  
       Aug 26, 2016
    已 Star
    不过看到 MVP 这么麻烦, 估计难以普及.
    androidwing
        4
    androidwing  
    OP
       Aug 26, 2016
    多谢
    androidwing
        5
    androidwing  
    OP
       Aug 26, 2016
    @banxi1988 已经越来越多的项目在使用了 再过半年 估计就成主流开发模式
    jhdxr
        6
    jhdxr  
       Aug 26, 2016
    @androidwing 然后再过半年就到 MVVM 了噗哈哈哈哈。。。每个客户端都是这么走过来的。。。
    androidwing
        7
    androidwing  
    OP
       Aug 26, 2016
    @jhdxr 确实,我们已经在用 databinding 了
    TaoQAQ
        8
    TaoQAQ  
       Sep 3, 2016
    我的 contract 接口没有带 Model ,不知道符合规范不。
    public interface ListContract {

    interface Presenter{
    void getList(String page);
    void search(String q);
    }

    interface View{
    void onSuccess(List<Bitmap> datas);
    void onFailure();
    }


    }
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2137 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 00:33 · PVG 08:33 · LAX 17:33 · JFK 20:33
    ♥ Do have faith in what you're doing.