Android Studio外掛程式之MVPHelper,一鍵產生MVP代碼

來源:互聯網
上載者:User

標籤:技術   list   ica   tps   修改   ant   搜尋   intel   log   

MVP盛行,聽到的最多的抱怨就是咋要寫這麼多介面,那麼本文作者提供了一個外掛程式,自動產生這些介面的聲明。感興趣的還可以學習該外掛程式的寫法,按照自己平時的需求修改,提供開發效率。

 

 

MVPHelper

 

一款Intellj IDEA 和Android Studio的外掛程式,可以為MVP產生介面以及實作類別,解放雙手。

Github 地址 :

  • https://github.com/githubwing/MVPHelper

 

注意

對於MVP模式,定義一個Contract類來放置Model View Presenter 的介面,將大大減少類檔案。

 

將普通的介面替代如下:

 

 1 public interface GoodsInfoContract { 2  3     public interface View{ 4      5     } 6     public interface Presenter{ 7      8     } 9     public interface Model{10     11     }12 13 }

 

當你在Contract類中使用外掛程式,效果如下:


如何使用

 

在外掛程式倉庫搜尋MVPHelper

手動安裝的辦法;

 

下載MVPHelper.jar

(https://github.com/githubwing/MVPHelper/raw/master/MVPHelper.jar)

 

然後安裝外掛程式:

 

在Contract類或者Presenter類內部,點擊Generate菜單,選擇MVPHelper即可產生對應檔案

 

Android Studio外掛程式之MVPHelper,一鍵產生MVP代碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.