Skip to content

Commit

Permalink
opt getV()
Browse files Browse the repository at this point in the history
  • Loading branch information
limedroid committed May 28, 2018
1 parent cb6c750 commit 0dedcb9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions mvp/src/main/java/cn/droidlover/xdroidmvp/mvp/IPresent.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ public interface IPresent<V> {
void attachV(V view);

void detachV();

boolean hasV();
}
4 changes: 3 additions & 1 deletion mvp/src/main/java/cn/droidlover/xdroidmvp/mvp/XActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ protected VDelegate getvDelegate() {
protected P getP() {
if (p == null) {
p = newP();
if (p != null) {
}
if (p != null) {
if (!p.hasV()) {
p.attachV(this);
}
}
Expand Down
4 changes: 3 additions & 1 deletion mvp/src/main/java/cn/droidlover/xdroidmvp/mvp/XFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ protected VDelegate getvDelegate() {
protected P getP() {
if (p == null) {
p = newP();
if (p != null) {
}
if (p != null) {
if (!p.hasV()) {
p.attachV(this);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public VDelegate getvDelegate() {
protected P getP() {
if (p == null) {
p = newP();
if (p != null) {
}
if (p != null) {
if (!p.hasV()) {
p.attachV(this);
}
}
Expand Down
6 changes: 6 additions & 0 deletions mvp/src/main/java/cn/droidlover/xdroidmvp/mvp/XPresent.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@ protected V getV() {
}
return v.get();
}


@Override
public boolean hasV() {
return v != null && v.get() != null;
}
}

0 comments on commit 0dedcb9

Please sign in to comment.