Skip to content

Commit

Permalink
feat(location): add onPresenterCircle method
Browse files Browse the repository at this point in the history
  • Loading branch information
xujiaji committed Oct 12, 2018
1 parent 4a947d8 commit 9de45fb
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 10 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![banner](display/banner.png)
[![GitHub release](https://img.shields.io/badge/size-12%20kb-green.svg)](https://github.com/xujiaji/XMVP/releases) [![GitHub release](https://img.shields.io/badge/bintray-1.2.2-brightgreen.svg)](https://bintray.com/xujiaji/maven/xmvp/1.2.2)
[![GitHub release](https://img.shields.io/badge/size-12%20kb-green.svg)](https://github.com/xujiaji/XMVP/releases) [![GitHub release](https://img.shields.io/badge/bintray-1.2.3-brightgreen.svg)](https://bintray.com/xujiaji/maven/xmvp/1.2.3)

# XMVP
This is a mvp framework to help you easily achieve mvp structure.
Expand All @@ -8,6 +8,8 @@ This is a mvp framework to help you easily achieve mvp structure.

## Update
```
> v1.2.3 add onPresenterCircle method
> v1.2.2 Fragment lazy load data, and add cycle function in View. Fix some bug.
> v1.1.5 Can not create Presenter after fixing obfuscation
Expand All @@ -34,7 +36,7 @@ This is a mvp framework to help you easily achieve mvp structure.
### First, Add xmvp dependency
```
dependencies {
compile 'com.github.xujiaji:xmvp:1.2.2'
compile 'com.github.xujiaji:xmvp:1.2.3'
}
```
or
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ext {
siteUrl = 'https://github.com/xujiaji/XMVP'
gitUrl = 'https://github.com/xujiaji/XMVP.git'

libraryVersion = '1.2.2'
libraryVersion = '1.2.3'

developerId = 'xujiaji'
developerName = 'xujiaji'
Expand Down
10 changes: 8 additions & 2 deletions xmvp/src/main/java/io/xujiaji/xmvp/view/base/XBaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@
* 项目中Activity的基类 <br />
* base Activity class
*/
public abstract class XBaseActivity<T extends XBasePresenter> extends AppCompatActivity implements XActivityCycle {
public abstract class XBaseActivity<T extends XBasePresenter> extends AppCompatActivity implements XActivityCycle<T> {
protected T presenter;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
onBeforeCreateCircle();
try{
presenter = GenericHelper.newPresenter(this);
if (presenter != null) {
Expand All @@ -44,7 +45,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
e.printStackTrace();
}

onBeforeCreateCircle();
onPresenterCircle(presenter);
super.onCreate(savedInstanceState);

beforeSetContentView();
Expand Down Expand Up @@ -97,6 +98,11 @@ public void onBeforeCreateCircle() {

}

@Override
public void onPresenterCircle(T presenter) {

}

/**
* 处理上个页面传递过来的值 <br />
* Handle passed the previous page intent when first enter the page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* 项目中Fragment的基类 <br /> base Fragment class <br />
* 部分代码参照(reference):https://github.com/xmagicj/LazyFragment/blob/master/app/src/main/java/com/xmagicj/android/lazyfragment/BaseFragment.java
*/
public abstract class XBaseFragment<T extends XBasePresenter> extends Fragment implements XFragViewCycle {
public abstract class XBaseFragment<T extends XBasePresenter> extends Fragment implements XFragViewCycle<T> {

protected T presenter;

Expand Down Expand Up @@ -84,6 +84,7 @@ public void onAttach(Context context) {
e.printStackTrace();
}

onPresenterCircle(presenter);
}

@Override
Expand Down Expand Up @@ -167,6 +168,11 @@ public void onInvisible() {
@Override
public void onBeforeCreateCircle() { }

@Override
public void onPresenterCircle(T presenter) {

}

@Override
public void onBundleHandle(@NonNull Bundle savedInstanceState) { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* 项目中Fragment的基类 <br /> base Fragment class <br />
* 部分代码参照(reference):https://github.com/xmagicj/LazyFragment/blob/master/app/src/main/java/com/xmagicj/android/lazyfragment/BaseFragment.java
*/
public abstract class XBaseFragment<T extends XBasePresenter> extends Fragment implements XFragViewCycle {
public abstract class XBaseFragment<T extends XBasePresenter> extends Fragment implements XFragViewCycle<T> {

protected T presenter;

Expand Down Expand Up @@ -70,6 +70,7 @@ public void onAttach(Context context) {
e.printStackTrace();
}

onPresenterCircle(presenter);
}

@Override
Expand Down Expand Up @@ -153,6 +154,11 @@ public void onInvisible() {
@Override
public void onBeforeCreateCircle() { }

@Override
public void onPresenterCircle(T presenter) {

}

@Override
public void onBundleHandle(@NonNull Bundle savedInstanceState) { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
import android.content.Intent;
import android.support.annotation.NonNull;

import io.xujiaji.xmvp.presenters.XBasePresenter;

/**
* author: xujiaji
* created on: 2018/9/11 15:05
* description: 定义Activity View相关周期 <br /> Define Activity View related Cycle
*/
public interface XActivityCycle extends XViewCycle {
public interface XActivityCycle<T extends XBasePresenter> extends XViewCycle<T> {
/**
* 处理上个页面传递过来的数据 <br /> Handle the data passed from the previous page
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
import android.os.Bundle;
import android.support.annotation.NonNull;

import io.xujiaji.xmvp.presenters.XBasePresenter;

/**
* author: xujiaji
* created on: 2018/9/4 10:57
* description: 定义Fragment View相关周期 <br /> Define Fragment View related Cycle
*/
public interface XFragViewCycle extends XViewCycle {
public interface XFragViewCycle<T extends XBasePresenter> extends XViewCycle<T> {

/**
* 处理{@link Fragment#getArguments()} 的值,如果有才会调用 <br /> Handle the value of {@link Fragment#getArguments()} , if it is there, it will be called
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,22 @@
import android.os.Bundle;
import android.support.annotation.NonNull;

import io.xujiaji.xmvp.presenters.XBasePresenter;

/**
* author: xujiaji
* created on: 2018/9/4 10:57
* description: 定义View相关周期 <br /> Define View related Cycle
*/
public interface XViewCycle {
public interface XViewCycle<T extends XBasePresenter> {

/**
* 在 super {@link android.app.Activity#onCreate(Bundle)}之前被调用 <br /> will be called before super class {@link android.app.Activity#onCreate(Bundle)} called
*/
void onBeforeCreateCircle();

void onPresenterCircle(T presenter);

/**
* 在 super {@link android.app.Activity#onCreate(Bundle)}之前被调用,并且有Bundle <br /> will be called before super class {@link android.app.Activity#onCreate(Bundle)} called
* @param savedInstanceState 该参数不可能为null <br /> this parameter cannot be null
Expand Down

0 comments on commit 9de45fb

Please sign in to comment.