Search in sources :

Example 1 with MobileUnitBean

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

the class RecordUnitListActivity method initData.

@Override
public void initData(Bundle savedInstanceState) {
    // 下载单位列表
    userId = GlobalConstantUtils.getUser().getId();
    mPresenter.initUnitList(userId, currentPage + "", "", "", "", "", true);
    // 初始化下拉刷新控件
    swipeContainer.setColorSchemeResources(R.color.color_bule2, R.color.color_bule, R.color.color_bule2, R.color.color_bule3);
    // 下拉刷新
    swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            currentPage = 1;
            mPresenter.initUnitList(userId, currentPage + "", "", "", "", "", true);
        }
    });
    lvContent.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            MobileUnitBean unitBean = (MobileUnitBean) lvContent.getItemAtPosition(i);
            Bundle bundle = new Bundle();
            bundle.putString("unitBean", gson.toJson(unitBean));
            Intent intent = new Intent();
            intent.setClass(getApplicationContext(), RecordSuperviseListActivity.class);
            intent.putExtras(bundle);
            startActivity(intent);
        }
    });
}
Also used : Bundle(android.os.Bundle) Intent(android.content.Intent) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) BindView(butterknife.BindView) View(android.view.View) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ListView(android.widget.ListView) MobileUnitBean(com.mtm.mrecord.mvp.model.entity.MobileUnitBean) AdapterView(android.widget.AdapterView)

Example 2 with MobileUnitBean

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

the class RecordSuperviseListActivity method initData.

@Override
public void initData(Bundle savedInstanceState) {
    btnQuery.setVisibility(View.GONE);
    // 下载单位列表
    String unitBean = getIntent().getStringExtra("unitBean");
    if (null == unitBean) {
        return;
    }
    MobileUnitBean mobileUnitBean = gson.fromJson(unitBean, MobileUnitBean.class);
    compId = mobileUnitBean.getId();
    mPresenter.downLoadSuperviseRecord(compId);
    // ListItem点击事件
    lvContent.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        private String id;

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            RecordListBean.SuperviseListBean superviseListBean = (RecordListBean.SuperviseListBean) lvContent.getItemAtPosition(i);
            id = superviseListBean.getId();
            mPresenter.downLoadSuperviseRecordBaseInfo(id);
        }
    });
}
Also used : RecordListBean(com.mtm.mrecord.mvp.model.entity.RecordListBean) MobileUnitBean(com.mtm.mrecord.mvp.model.entity.MobileUnitBean) AdapterView(android.widget.AdapterView) BindView(butterknife.BindView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Example 3 with MobileUnitBean

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

the class RecordUnitListActivity method addNewData.

@Override
public void addNewData(RecordUnitListBean unitListBean) {
    hibernatePage = unitListBean.getHibernatePage();
    List<MobileUnitBean> superviseList = unitListBean.getSuperviseList();
    mAdapter = new Adapter(lvContent, superviseList, "unitList");
    lvContent.setAdapter(mAdapter);
    // 下拉刷新转圈消失
    swipeContainer.setRefreshing(false);
    // 当前页和总页数
    currentPage++;
    totalPages = hibernatePage.getTotalPages();
    // 初始化 mPaginate
    mPaginate = Paginate.with(lvContent, this).setLoadingTriggerThreshold(2).addLoadingListItem(true).build();
}
Also used : MobileUnitBean(com.mtm.mrecord.mvp.model.entity.MobileUnitBean) Adapter(com.mtm.mrecord.mvp.ui.adapter.Adapter)

Aggregations

MobileUnitBean (com.mtm.mrecord.mvp.model.entity.MobileUnitBean)3 View (android.view.View)2 AdapterView (android.widget.AdapterView)2 ListView (android.widget.ListView)2 BindView (butterknife.BindView)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 AbsListView (android.widget.AbsListView)1 TextView (android.widget.TextView)1 RecordListBean (com.mtm.mrecord.mvp.model.entity.RecordListBean)1 Adapter (com.mtm.mrecord.mvp.ui.adapter.Adapter)1