version:4.5
fix: update:支付回调,咨询页面修改,通过分类获取资讯,我的订单详情
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
package com.uiuios.aios.activity;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiuios.aios.R;
|
||||
import com.uiuios.aios.adapter.OrderAdapter;
|
||||
import com.uiuios.aios.base.BaseDataBindingActivity;
|
||||
import com.uiuios.aios.bean.BaseResponse;
|
||||
import com.uiuios.aios.bean.OrderIndexBean;
|
||||
import com.uiuios.aios.bean.OrderIndexData;
|
||||
import com.uiuios.aios.databinding.ActivityOrderListBinding;
|
||||
import com.uiuios.aios.network.NetInterfaceManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class OrderListActivity extends BaseDataBindingActivity {
|
||||
private static final String TAG = OrderListActivity.class.getSimpleName();
|
||||
|
||||
private ActivityOrderListBinding mBinding;
|
||||
private OrderAdapter mOrderAdapter;
|
||||
|
||||
/**
|
||||
* 初始化视图
|
||||
*/
|
||||
@Override
|
||||
public void initView() {
|
||||
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_order_list);
|
||||
|
||||
mOrderAdapter = new OrderAdapter();
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mBinding.rvOrder.setLayoutManager(linearLayoutManager);
|
||||
mBinding.rvOrder.setAdapter(mOrderAdapter);
|
||||
|
||||
mBinding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
mBinding.rvOrder.scrollToPosition(0);
|
||||
String title = tab.getText().toString();
|
||||
Log.e(TAG, "onTabSelected: " + title);
|
||||
switch (title) {
|
||||
default:
|
||||
case "全部":
|
||||
getAllOrderList();
|
||||
break;
|
||||
case "待付款":
|
||||
getOrderIndexList(0);
|
||||
break;
|
||||
case "待发货":
|
||||
getOrderIndexList(1);
|
||||
break;
|
||||
case "待收货":
|
||||
getOrderIndexList(2);
|
||||
break;
|
||||
case "已签收":
|
||||
getOrderIndexList(3);
|
||||
break;
|
||||
case "已评价":
|
||||
getOrderIndexList(4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
Log.e(TAG, "onTabUnselected: " + tab.getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
Log.e(TAG, "onTabReselected: " + tab.getText());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
@Override
|
||||
public void initData() {
|
||||
getAllOrderList();
|
||||
}
|
||||
|
||||
private void getAllOrderList() {
|
||||
NetInterfaceManager.getInstance().getAllOrderObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycleSubject, ActivityEvent.DESTROY))
|
||||
.subscribe(getOrderListObserver());
|
||||
}
|
||||
|
||||
private void getOrderIndexList(int status) {
|
||||
NetInterfaceManager.getInstance().getOrderIndexObservable(status)
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycleSubject, ActivityEvent.DESTROY))
|
||||
.subscribe(getOrderListObserver());
|
||||
}
|
||||
|
||||
private Observer<BaseResponse<OrderIndexData>> getOrderListObserver() {
|
||||
return new Observer<BaseResponse<OrderIndexData>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAllOrderListObserver", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<OrderIndexData> baseResponse) {
|
||||
Log.e("getAllOrderListObserver", "onNext: " + baseResponse);
|
||||
if (baseResponse.code == 200) {
|
||||
OrderIndexData orderIndexData = baseResponse.data;
|
||||
List<OrderIndexBean> orderIndexBeanList = orderIndexData.getData();
|
||||
mOrderAdapter.setOrderIndexBeans(orderIndexBeanList);
|
||||
}else {
|
||||
mOrderAdapter.setOrderIndexBeans(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAllOrderListObserver", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAllOrderListObserver", "onComplete: ");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,12 @@ public class PayActivity extends BaseDataBindingActivity {
|
||||
getWechatPayQrcode(mOrderBean);
|
||||
}
|
||||
});
|
||||
mBinding.ivExit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,6 +112,7 @@ public class PayActivity extends BaseDataBindingActivity {
|
||||
mCountdownSubscribe.dispose();
|
||||
}
|
||||
mCountdownSubscribe = Observable.interval(1, TimeUnit.SECONDS)
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycleSubject, ActivityEvent.DESTROY))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<Long>() {
|
||||
@@ -135,10 +142,10 @@ public class PayActivity extends BaseDataBindingActivity {
|
||||
mCheckOrderSubscribe.dispose();
|
||||
}
|
||||
mCheckOrderSubscribe = Observable.interval(5, TimeUnit.SECONDS)
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycleSubject, ActivityEvent.DESTROY))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<Long>() {
|
||||
|
||||
@Override
|
||||
public void accept(Long aLong) throws Exception {
|
||||
NetInterfaceManager.getInstance()
|
||||
@@ -180,6 +187,4 @@ public class PayActivity extends BaseDataBindingActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user