Search in sources :

Example 1 with LawDocumentGsonBean

use of com.mtm.mrecord.mvp.model.entity.LawDocumentGsonBean in project Mvp-Rxjava-Retrofit-dagger2 by pengMaster.

the class LawFileFragment method setViewData.

/**
 * 设置布局显示
 *
 * @param gsonBean
 */
private void setViewData(LawDocumentGsonBean gsonBean) {
    // 卫生监督意见书
    LawDocumentGsonBean.SuperviseViewBean superviseView = gsonBean.getSuperviseView();
    // 现场笔录
    LawDocumentGsonBean.SitenotesBean sitenotes = gsonBean.getSitenotes();
    List<LawDocumentGsonBean.AskListBean> askList = gsonBean.getAskList();
    if (null != sitenotes) {
        tvXcbl.setText("现场笔录 " + sitenotes.getNcreatetime());
        tvXcbl.setTag(new Gson().toJson(sitenotes));
    }
    if (null != superviseView) {
        tvWsjdYjs.setText("卫生监督意见书 " + superviseView.getVcreatetime());
        tvWsjdYjs.setTag(new Gson().toJson(superviseView));
    }
    if (null != askList && askList.size() > 0) {
        llXwblContent.removeAllViews();
        for (int i = 0; i < askList.size(); i++) {
            View inflate = LayoutInflater.from(getActivity()).inflate(R.layout.layout_file_item, null);
            TextView viewById = (TextView) inflate.findViewById(R.id.tv_item_name);
            viewById.setText("询问笔录 " + askList.get(i).getCreateTime());
            llXwblContent.addView(inflate);
            final LawDocumentGsonBean.AskListBean askListBean = askList.get(i);
            inflate.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    Bundle bundle = new Bundle();
                    bundle.putString("tag", new Gson().toJson(askListBean));
                    bundle.putString("type", "xwbl");
                    Intent intent = new Intent();
                    intent.setClass(getActivity(), LawDocumentDetailAct.class);
                    intent.putExtras(bundle);
                    startActivity(intent);
                }
            });
        }
    }
}
Also used : Bundle(android.os.Bundle) LawDocumentDetailAct(com.mtm.mrecord.mvp.ui.activity.record.LawDocumentDetailAct) Gson(com.google.gson.Gson) Intent(android.content.Intent) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView) LawDocumentGsonBean(com.mtm.mrecord.mvp.model.entity.LawDocumentGsonBean) TextView(android.widget.TextView)

Example 2 with LawDocumentGsonBean

use of com.mtm.mrecord.mvp.model.entity.LawDocumentGsonBean in project Mvp-Rxjava-Retrofit-dagger2 by pengMaster.

the class RecordSuperviseListPresenter method downLoadSuperviseRecordBaseInfo.

/**
 * 下载监督记录基本信息
 *
 * @param id
 */
public void downLoadSuperviseRecordBaseInfo(final String id) {
    Observable<SuperviseContentGsonBean> superviseContent = mModel.getSuperviseContentNet(id);
    Observable<superviseForm> recordBaseInfo = mModel.getRecordBaseInfo(id);
    Observable<LawDocumentGsonBean> lawFileNet = mModel.getLawFileNet(id);
    Observable.zip(recordBaseInfo, superviseContent, lawFileNet, new Function3<superviseForm, SuperviseContentGsonBean, LawDocumentGsonBean, RecordBaseGsonBean>() {

        @Override
        public RecordBaseGsonBean apply(@NonNull superviseForm superviseForm, @NonNull SuperviseContentGsonBean categoryResult, @NonNull LawDocumentGsonBean lawDocumentGsonBean) throws Exception {
            // 合并两次请求的结果
            RecordBaseGsonBean baseGsonBean = new RecordBaseGsonBean();
            baseGsonBean.setSuperviseForm(superviseForm);
            baseGsonBean.setCategoryResult(categoryResult);
            baseGsonBean.setLawDocumentGsonBean(lawDocumentGsonBean);
            baseGsonBean.setId(id);
            return baseGsonBean;
        }
    }).subscribeOn(Schedulers.io()).doOnSubscribe(new // 在执行任务前,做准备操作
    Consumer<Disposable>() {

        @Override
        public void accept(Disposable disposable) throws Exception {
            // 在执行任务之前 do some thing ...
            mRootView.showLoading();
        }
    }).observeOn(AndroidSchedulers.mainThread()).doFinally(new // 任务结束 do some thing ...
    Action() {

        @Override
        public void run() throws Exception {
            mRootView.hideLoading();
        }
    }).subscribe(new Consumer<RecordBaseGsonBean>() {

        @Override
        public void accept(@NonNull RecordBaseGsonBean recordBaseGsonBean) throws Exception {
            mRootView.hideLoading();
            mRootView.startActivity(recordBaseGsonBean);
        }
    }, new Consumer<Throwable>() {

        @Override
        public void accept(@NonNull Throwable throwable) throws Exception {
            ToastUtils.showShort(throwable.getMessage());
        }
    });
}
Also used : Disposable(io.reactivex.disposables.Disposable) Action(io.reactivex.functions.Action) Function3(io.reactivex.functions.Function3) SuperviseContentGsonBean(com.mtm.mrecord.mvp.model.entity.SuperviseContentGsonBean) com.mtm.mrecord.mvp.model.entity.superviseForm(com.mtm.mrecord.mvp.model.entity.superviseForm) Consumer(io.reactivex.functions.Consumer) NonNull(io.reactivex.annotations.NonNull) LawDocumentGsonBean(com.mtm.mrecord.mvp.model.entity.LawDocumentGsonBean) RecordBaseGsonBean(com.mtm.mrecord.mvp.model.entity.RecordBaseGsonBean)

Example 3 with LawDocumentGsonBean

use of com.mtm.mrecord.mvp.model.entity.LawDocumentGsonBean in project Mvp-Rxjava-Retrofit-dagger2 by pengMaster.

the class LawFileFragment method initData.

@Override
public void initData(Bundle savedInstanceState) {
    tvItemTitle.setText("文书列表");
    String baseGsonBean = getActivity().getIntent().getStringExtra("baseGsonBean");
    RecordBaseGsonBean recordBaseGsonBean = gson.fromJson(baseGsonBean, RecordBaseGsonBean.class);
    LawDocumentGsonBean lawDocumentGsonBean = recordBaseGsonBean.getLawDocumentGsonBean();
    setViewData(lawDocumentGsonBean);
}
Also used : LawDocumentGsonBean(com.mtm.mrecord.mvp.model.entity.LawDocumentGsonBean) RecordBaseGsonBean(com.mtm.mrecord.mvp.model.entity.RecordBaseGsonBean)

Aggregations

LawDocumentGsonBean (com.mtm.mrecord.mvp.model.entity.LawDocumentGsonBean)3 RecordBaseGsonBean (com.mtm.mrecord.mvp.model.entity.RecordBaseGsonBean)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 View (android.view.View)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 Gson (com.google.gson.Gson)1 SuperviseContentGsonBean (com.mtm.mrecord.mvp.model.entity.SuperviseContentGsonBean)1 com.mtm.mrecord.mvp.model.entity.superviseForm (com.mtm.mrecord.mvp.model.entity.superviseForm)1 LawDocumentDetailAct (com.mtm.mrecord.mvp.ui.activity.record.LawDocumentDetailAct)1 NonNull (io.reactivex.annotations.NonNull)1 Disposable (io.reactivex.disposables.Disposable)1 Action (io.reactivex.functions.Action)1 Consumer (io.reactivex.functions.Consumer)1 Function3 (io.reactivex.functions.Function3)1