forked from getActivity/AndroidProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
新增MVP相关类,新增BaseDialog类,新增 Activity 栈管理类、更新基类的几个方法
- Loading branch information
Showing
71 changed files
with
1,563 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.hjq.demo.mvp; | ||
|
||
/** | ||
* author : HJQ | ||
* github : https://github.com/getActivity/AndroidProject | ||
* time : 2018/11/17 | ||
* desc : MVP 通用性接口 | ||
*/ | ||
public interface IMvpView { | ||
|
||
/** | ||
* 用于页面请求数据时显示加载状态 | ||
*/ | ||
void showLoading(); | ||
|
||
/** | ||
* 用于请求的数据为空的状态 | ||
*/ | ||
void showEmpty(); | ||
|
||
/** | ||
* 用于请求数据出错 | ||
*/ | ||
void showError(); | ||
|
||
/** | ||
* 用于请求数据完成 | ||
*/ | ||
void loadingComplete(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.hjq.demo.mvp; | ||
|
||
import com.hjq.demo.common.CommonActivity; | ||
|
||
/** | ||
* author : HJQ | ||
* github : https://github.com/getActivity/AndroidProject | ||
* time : 2018/11/17 | ||
* desc : MVP Activity 基类 | ||
*/ | ||
public abstract class MvpActivity<P extends MvpPresenter> extends CommonActivity { | ||
|
||
private P mPresenter; | ||
|
||
@Override | ||
public void init() { | ||
mPresenter = initPresenter(); | ||
mPresenter.attach(this); | ||
mPresenter.start(); | ||
super.init(); | ||
} | ||
|
||
@Override | ||
protected void onDestroy() { | ||
mPresenter.detach(); | ||
super.onDestroy(); | ||
} | ||
|
||
public P getPresenter() { | ||
return mPresenter; | ||
} | ||
|
||
protected abstract P initPresenter(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.hjq.demo.mvp; | ||
|
||
import com.hjq.demo.common.CommonLazyFragment; | ||
|
||
/** | ||
* author : HJQ | ||
* github : https://github.com/getActivity/AndroidProject | ||
* time : 2018/11/17 | ||
* desc : MVP 懒加载 Fragment 基类 | ||
*/ | ||
public abstract class MvpLazyFragment<P extends MvpPresenter> extends CommonLazyFragment { | ||
|
||
private P mPresenter; | ||
|
||
@Override | ||
protected void init() { | ||
mPresenter = initPresenter(); | ||
mPresenter.attach(this); | ||
mPresenter.start(); | ||
super.init(); | ||
} | ||
|
||
@Override | ||
public void onDestroy() { | ||
mPresenter.detach(); | ||
super.onDestroy(); | ||
} | ||
|
||
public P getPresenter() { | ||
return mPresenter; | ||
} | ||
|
||
protected abstract P initPresenter(); | ||
} |
Oops, something went wrong.