-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
can
committed
Jun 12, 2018
1 parent
40f1912
commit e2395bb
Showing
28 changed files
with
883 additions
and
44 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
384 changes: 384 additions & 0 deletions
384
app/src/main/java/com/can/canutils/bean/HomeArticleListBean.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
41 changes: 41 additions & 0 deletions
41
app/src/main/java/com/can/canutils/ui/SimulationDataActivity.java
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,41 @@ | ||
package com.can.canutils.ui; | ||
|
||
import android.util.Log; | ||
import android.view.View; | ||
|
||
import com.can.canutils.R; | ||
import com.can.mvp.base.BaseRefreshActivity; | ||
import com.can.mvp.bean.requestBean.BaseRequestBean; | ||
|
||
/** | ||
* Created by can on 2018/6/11. | ||
* 模拟请求数据 | ||
*/ | ||
|
||
public class SimulationDataActivity extends BaseRefreshActivity { | ||
|
||
|
||
@Override | ||
public int getLayoutId() { | ||
return R.layout.activity_simulation; | ||
} | ||
|
||
@Override | ||
public void initView(View view) { | ||
super.initView(view); | ||
} | ||
|
||
@Override | ||
public BaseRequestBean getRequestParameters() { | ||
BaseRequestBean bean = new BaseRequestBean(); | ||
bean.setRequest_url("http://www.wanandroid.com/"); | ||
bean.setObservable(manager.getHomeArticleList(0)); | ||
return bean; | ||
} | ||
|
||
@Override | ||
public void ReturnNetworkData(Object result) { | ||
Log.d("111",result.toString()+""); | ||
|
||
} | ||
} |
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,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:fitsSystemWindows="true" | ||
android:clipToPadding="false"> | ||
|
||
<com.can.mvp.views.baseviews.IRecycleView | ||
android:id="@+id/irl" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"/> | ||
|
||
</LinearLayout> |
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
85 changes: 85 additions & 0 deletions
85
library/src/main/java/com/can/mvp/base/BaseRefreshActivity.java
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,85 @@ | ||
package com.can.mvp.base; | ||
|
||
import android.support.v7.widget.RecyclerView; | ||
import android.view.View; | ||
|
||
import com.can.mvp.R; | ||
import com.can.mvp.bean.requestBean.BaseRequestBean; | ||
import com.can.mvp.mvps.models.BaseModel; | ||
import com.can.mvp.mvps.presenters.BasePresenter; | ||
import com.can.mvp.mvps.views.BaseView; | ||
import com.can.mvp.views.baseviews.IRecycleView; | ||
|
||
|
||
/** | ||
* Created by can on 2018/6/11. | ||
* base下拉刷新Activity | ||
*/ | ||
|
||
public class BaseRefreshActivity extends BaseActivity implements BaseView, IRecycleView.OnIRecycleListener { | ||
|
||
public IRecycleView irl; | ||
public BasePresenter basePresenter; | ||
|
||
@Override | ||
public int getLayoutId() { | ||
return R.layout.activity_base_refresh; | ||
} | ||
|
||
@Override | ||
public void initView(View view) { | ||
super.initView(view); | ||
irl = (IRecycleView) findViewById(R.id.irl); | ||
|
||
irl.setOnIRecycleListener(this); | ||
} | ||
|
||
@Override | ||
public void initData() { | ||
super.initData(); | ||
basePresenter = new BasePresenter(this,new BaseModel(mCompositeSubscription)); | ||
basePresenter.getData(getRequestParameters(),getRequestParameters()==null?null:getRequestParameters().getObservable()); | ||
} | ||
|
||
@Override | ||
public void onError(String error) { | ||
//ReturnNetworkData(error); | ||
//ToastUtils.getInstance(this).showText(error); | ||
} | ||
|
||
@Override | ||
public void onSuccess(Object success) { | ||
ReturnNetworkData(success); | ||
} | ||
|
||
@Override | ||
public void onComplete() { | ||
irl.refreshComlete(); | ||
} | ||
|
||
|
||
@Override | ||
public void onRefresh() { | ||
basePresenter.getData(getRequestParameters(),getRequestParameters()==null?null:getRequestParameters().getObservable()); | ||
} | ||
|
||
@Override | ||
public void onLoadMore() { | ||
|
||
} | ||
|
||
@Override | ||
public BaseRequestBean getRequestParameters() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void ReturnNetworkData(Object result) { | ||
|
||
} | ||
|
||
@Override | ||
public RecyclerView.Adapter getAdapter() { | ||
return null; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
library/src/main/java/com/can/mvp/base/BaseRefreshAdapter.java
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,27 @@ | ||
package com.can.mvp.base; | ||
|
||
import android.support.v7.widget.RecyclerView; | ||
import android.view.ViewGroup; | ||
|
||
/** | ||
* Created by can on 2018/6/12. | ||
* 通用适配器 | ||
*/ | ||
|
||
public class BaseRefreshAdapter extends RecyclerView.Adapter { | ||
|
||
@Override | ||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { | ||
|
||
} | ||
|
||
@Override | ||
public int getItemCount() { | ||
return 0; | ||
} | ||
} |
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
Oops, something went wrong.