Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use mvp of mosby #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 0 additions & 226 deletions .idea/findbugs-idea.xml

This file was deleted.

3 changes: 2 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ dependencies {
//okhttp
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'

compile 'com.hannesdorfmann.mosby:mvp:2.0.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,21 @@
* Created by JDD on 2016/4/8.
*/
public class AutoLoadRecylerView extends RecyclerView {
private loadMoreListener loadMoreListener;
private LoadMoreListener loadMoreListener;
private AutoLoadScroller autoLoadScroller;
private boolean isLoading = false;

public interface loadMoreListener {
void onLoadMore();
}

public AutoLoadRecylerView(Context context) {
this(context, null);
}


public AutoLoadRecylerView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
autoLoadScroller = new AutoLoadScroller();
addOnScrollListener(autoLoadScroller);
}


public void setLoadMoreListener(AutoLoadRecylerView.loadMoreListener loadMoreListener) {
public void setLoadMoreListener(LoadMoreListener loadMoreListener) {
this.loadMoreListener = loadMoreListener;
}

Expand All @@ -46,6 +40,10 @@ public void removeAutoScroller() {
removeOnScrollListener(autoLoadScroller);
}

public interface LoadMoreListener {
void onLoadMore();
}

private class AutoLoadScroller extends OnScrollListener {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
Expand Down
44 changes: 0 additions & 44 deletions app/src/main/java/rx/dong/com/rxjoke/presenter/BasePresenter.java

This file was deleted.

20 changes: 5 additions & 15 deletions app/src/main/java/rx/dong/com/rxjoke/presenter/JokePresenter.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package rx.dong.com.rxjoke.presenter;

import com.hannesdorfmann.mosby.mvp.MvpBasePresenter;
import com.orhanobut.logger.Logger;

import java.util.List;
Expand All @@ -17,17 +18,7 @@
/**
* Created by JDD on 2016/4/21 0021.
*/
public class JokePresenter extends BasePresenter<JokeView> {

@Override
public void attachView(JokeView mvpView) {
super.attachView(mvpView);
}

@Override
public void detachView() {
super.detachView();
}
public class JokePresenter extends MvpBasePresenter<JokeView> {

public void loadList(final int page) {
RxService.createApi(JokeApi.class)
Expand All @@ -49,18 +40,17 @@ public void onCompleted() {
@Override
public void onError(Throwable e) {
Logger.e(e.getMessage());
getMvpView().showError(null, null);
getView().showError(null, null);
}

@Override
public void onNext(List<ContentlistEntity> contentlistEntities) {
if (page == 1) {
getMvpView().refresh(contentlistEntities);
getView().refresh(contentlistEntities);
} else {
getMvpView().loadMore(contentlistEntities);
getView().loadMore(contentlistEntities);
}
}
});

}
}
15 changes: 0 additions & 15 deletions app/src/main/java/rx/dong/com/rxjoke/presenter/Presenter.java

This file was deleted.

Loading