提交 b5cc59c1 authored 作者: lgd's avatar lgd

1.运费单详情

上级 882b7822
......@@ -2497,6 +2497,14 @@
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.bat.work.FareSearchActivity"
android:configChanges="keyboardHidden|orientation"
android:label="生成运费单"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.mes.work.QualityWorkActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
......
......@@ -151,7 +151,7 @@ public class FareListActivity extends WorkToolBarActivity {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.search:
// startActivity(ProductOrderSearchActivity.class, "identity", getIntent().getStringExtra("identity"));
startActivity(FareSearchActivity.class);
break;
case R.id.add:
startActivity(FareAddActivity.class);
......
package com.wd.workoffice.ui.activity.bat.work;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.WorkBaseActivity;
import com.wd.workoffice.bean.FareBean;
import com.wd.workoffice.bean.InStockBean;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;
import com.wd.workoffice.ui.adapter.FareAdapter;
import com.wd.workoffice.ui.adapter.WorkInStockAdapter;
import com.wd.workoffice.util.WorkUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import flexible.xd.android_base.network.rtfhttp.Transformer;
import io.reactivex.disposables.Disposable;
/**
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class FareSearchActivity extends WorkBaseActivity {
@BindView(R.id.et_key)
EditText etKey;
@BindView(R.id.tv_search)
TextView tvSearch;
@BindView(R.id.tb_title)
Toolbar tbTitle;
@BindView(R.id.rv_data)
RecyclerView rvData;
@BindView(R.id.srl_refresh)
SmartRefreshLayout srlRefresh;
private int page = 1;
private Map<String, Object> param;
private List<FareBean.RecordsBean> dataList;
private FareAdapter dataAdapter;
@Override
protected void initView() {
ButterKnife.bind(this);
rvData.setLayoutManager(new LinearLayoutManager(this,RecyclerView.VERTICAL,false));
setSupportActionBar(tbTitle);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void initData() {
dataList = new ArrayList<>();
dataAdapter = new FareAdapter(R.layout.item_fare, dataList);
dataAdapter.bindToRecyclerView(rvData);
dataAdapter.setEmptyView(R.layout.view_empty_content,rvData);
param = WorkUtils.pageKey();
param.put("current", page);
// getData();
}
private void getData() {
RtfUtils.getRtf().fareList(param).compose(Transformer.schedule()).subscribe(new WorkObserver<BaseBean>() {
@Override
public void doOnSubscribe(Disposable d) {
}
@Override
public void onFail(String errorMsg) {
hideLoading();
toast(errorMsg);
}
@Override
public void onSuccess(BaseBean data) {
hideLoading();
if (data.getCode() != 0) {
toast(data.getMessage());
return;
}
List<FareBean.RecordsBean> getList = JSON.parseObject(data.getData().toString(), FareBean.class).getRecords();
if (page == 1) {
srlRefresh.finishRefresh();
dataList.clear();
dataList.addAll(getList);
dataAdapter.notifyDataSetChanged();
dataAdapter.loadMoreComplete();
} else {
dataAdapter.loadMoreComplete();
dataList.addAll(getList);
dataAdapter.notifyDataSetChanged();
}
if (getList.size() == 0) {
dataAdapter.loadMoreEnd();
} else {
page++;
}
}
});
}
@Override
protected void initEvent() {
srlRefresh.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
page = 1;
param.put("current", page);
getData();
}
});
dataAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
param.put("current", page);
getData();
}
}, rvData);
}
@Override
protected int layoutId() {
return R.layout.activity_fare_search;
}
@OnClick(R.id.tv_search)
public void onViewClicked() {
page = 1;
param.put("current", page);
param.put("searchValue", etKey.getText().toString());
getData();
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/tb_title"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Light"
app:contentInsetEnd="0mm"
app:contentInsetEndWithActions="0mm"
app:contentInsetLeft="0mm"
app:contentInsetRight="0mm"
app:contentInsetStart="0mm"
app:contentInsetStartWithNavigation="0mm">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:paddingVertical="5mm">
<EditText
android:id="@+id/et_key"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginVertical="3mm"
android:layout_weight="1"
android:background="@drawable/shape_client_search"
android:hint="搜索库存类别"
android:paddingHorizontal="3mm"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_search"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:paddingHorizontal="8mm"
android:text="搜索" />
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
<View style="@style/dividerX" />
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/srl_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_data"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
\ No newline at end of file
......@@ -4,6 +4,7 @@
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:layout_marginTop="10mm"
android:paddingHorizontal="20mm"
android:paddingVertical="10mm">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论