Commit b3c43071cc32b9a4cdf8de7cb3004458262d73ab
1 parent
8c991655
Exists in
yxb_dev
and in
2 other branches
no message
Showing
4 changed files
with
125 additions
and
10 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/contract/report/ReportContract.java
0 → 100644
| @@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
| 1 | +package com.shunzhi.parent.contract.report; | ||
| 2 | + | ||
| 3 | +import com.share.mvpsdk.base.BasePresenter; | ||
| 4 | +import com.share.mvpsdk.base.IBaseModel; | ||
| 5 | +import com.share.mvpsdk.base.IBaseView; | ||
| 6 | +import com.shunzhi.parent.bean.ReportBean; | ||
| 7 | + | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +import io.reactivex.Observable; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * Created by Administrator on 2018/3/15 0015. | ||
| 14 | + */ | ||
| 15 | + | ||
| 16 | +public interface ReportContract { | ||
| 17 | + abstract class ReportPresenter extends BasePresenter<IReportModel,IReportView> { | ||
| 18 | + public abstract void reportResult(); | ||
| 19 | + | ||
| 20 | + } | ||
| 21 | + interface IReportModel extends IBaseModel{ | ||
| 22 | + Observable<ReportBean> getReportResult(); | ||
| 23 | + } | ||
| 24 | + interface IReportView extends IBaseView{ | ||
| 25 | + void UpdateList(List<ReportBean>list); | ||
| 26 | + } | ||
| 27 | +} |
app/src/main/java/com/shunzhi/parent/model/report/ReportModel.java
0 → 100644
| @@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
| 1 | +package com.shunzhi.parent.model.report; | ||
| 2 | + | ||
| 3 | +import com.shunzhi.parent.bean.ReportBean; | ||
| 4 | +import com.shunzhi.parent.contract.report.ReportContract; | ||
| 5 | + | ||
| 6 | +import io.reactivex.Observable; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Created by Administrator on 2018/3/15 0015. | ||
| 10 | + */ | ||
| 11 | + | ||
| 12 | +public class ReportModel implements ReportContract.IReportModel { | ||
| 13 | + | ||
| 14 | + public static ReportModel newInstance() { | ||
| 15 | + return new ReportModel(); | ||
| 16 | + } | ||
| 17 | + @Override | ||
| 18 | + public Observable<ReportBean> getReportResult() { | ||
| 19 | + return null; | ||
| 20 | + } | ||
| 21 | +} |
app/src/main/java/com/shunzhi/parent/presenter/report/ReportPresenter.java
0 → 100644
| @@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
| 1 | +package com.shunzhi.parent.presenter.report; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.shunzhi.parent.bean.ReportBean; | ||
| 5 | +import com.shunzhi.parent.contract.report.ReportContract; | ||
| 6 | +import com.shunzhi.parent.model.report.ReportModel; | ||
| 7 | + | ||
| 8 | +import java.util.ArrayList; | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * Created by Administrator on 2018/3/15 0015. | ||
| 13 | + */ | ||
| 14 | + | ||
| 15 | +public class ReportPresenter extends ReportContract.ReportPresenter{ | ||
| 16 | + @Override | ||
| 17 | + public ReportContract.IReportModel getModel() { | ||
| 18 | + return ReportModel.newInstance(); | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + @Override | ||
| 22 | + public void onStart() { | ||
| 23 | + | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public void reportResult() { | ||
| 28 | + List<ReportBean> list=new ArrayList<>(); | ||
| 29 | + ReportBean reportBean=new ReportBean(); | ||
| 30 | + list.add(reportBean); | ||
| 31 | + list.add(reportBean); | ||
| 32 | + mIView.UpdateList(list); | ||
| 33 | + | ||
| 34 | + } | ||
| 35 | +} |
app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java
| 1 | package com.shunzhi.parent.ui.fragment; | 1 | package com.shunzhi.parent.ui.fragment; |
| 2 | 2 | ||
| 3 | -import android.content.Context; | ||
| 4 | -import android.net.Uri; | 3 | + |
| 5 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 6 | -import android.support.v4.app.Fragment; | ||
| 7 | -import android.view.LayoutInflater; | 5 | +import android.support.annotation.NonNull; |
| 6 | +import android.support.annotation.Nullable; | ||
| 7 | +import android.support.v7.widget.LinearLayoutManager; | ||
| 8 | +import android.support.v7.widget.RecyclerView; | ||
| 8 | import android.view.View; | 9 | import android.view.View; |
| 9 | -import android.view.ViewGroup; | ||
| 10 | 10 | ||
| 11 | +import com.share.mvpsdk.base.BasePresenter; | ||
| 12 | +import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | ||
| 11 | import com.shunzhi.parent.R; | 13 | import com.shunzhi.parent.R; |
| 14 | +import com.shunzhi.parent.adapter.ReportAdapter; | ||
| 15 | +import com.shunzhi.parent.bean.ReportBean; | ||
| 16 | +import com.shunzhi.parent.contract.report.ReportContract; | ||
| 17 | +import com.shunzhi.parent.presenter.report.ReportPresenter; | ||
| 18 | + | ||
| 19 | +import java.util.List; | ||
| 20 | + | ||
| 21 | +public class ReportFragment extends BaseMVPCompatFragment <ReportContract.ReportPresenter,ReportContract.IReportModel> | ||
| 22 | +implements ReportContract.IReportView{ | ||
| 23 | + RecyclerView recyclerView; | ||
| 24 | + ReportAdapter reportAdapter; | ||
| 25 | + | ||
| 26 | + @NonNull | ||
| 27 | + @Override | ||
| 28 | + public BasePresenter initPresenter() { | ||
| 29 | + return new ReportPresenter(); | ||
| 30 | + } | ||
| 12 | 31 | ||
| 13 | -public class ReportFragment extends Fragment { | 32 | + @Override |
| 33 | + public int getLayoutId() { | ||
| 34 | + return R.layout.fragment_report; | ||
| 35 | + } | ||
| 14 | 36 | ||
| 15 | @Override | 37 | @Override |
| 16 | - public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
| 17 | - Bundle savedInstanceState) { | ||
| 18 | - // Inflate the layout for this fragment | ||
| 19 | - return inflater.inflate(R.layout.fragment_report, container, false); | 38 | + public void initUI(View view, @Nullable Bundle savedInstanceState) { |
| 39 | + recyclerView = view.findViewById(R.id.recycle_report); | ||
| 40 | + recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); | ||
| 41 | + initReportList(); | ||
| 42 | + | ||
| 20 | } | 43 | } |
| 21 | 44 | ||
| 45 | + private void initReportList() { | ||
| 46 | + mPresenter.reportResult(); | ||
| 47 | + } | ||
| 22 | 48 | ||
| 49 | + @Override | ||
| 50 | + public void UpdateList(List<ReportBean> list) { | ||
| 51 | + reportAdapter=new ReportAdapter(getActivity()); | ||
| 52 | + reportAdapter.addAll(list); | ||
| 53 | + recyclerView.setAdapter(reportAdapter); | ||
| 54 | + } | ||
| 23 | } | 55 | } |