Commit 213c5941 authored by zhang_z's avatar zhang_z

Merge remote-tracking branch 'origin/master'

parents 6266e88c adc99e4a
......@@ -347,6 +347,7 @@ public class C {
private static final String ROOT_URL = PKG + "level/";
public static final String add = ROOT_URL + "add";
public static final String update = ROOT_URL + "update";
public static final String queryAll = ROOT_URL + "queryAll";
}
public final class COR {
......@@ -366,6 +367,14 @@ public class C {
public static final String getLastVer = PKG + "ver/getLastVer";
}
/**
* 会员相关
*/
public final class VIP {
private static final String ROOT_URL = PKG + "user/";
public static final String query = PKG + "query";
}
}
......
......@@ -980,6 +980,16 @@ public final class ApiFactory {
.observeOn(AndroidSchedulers.mainThread())
.retryWhen(new RetryHelper(3));
}
public static Observable<Pager<com.xingdata.zzdpos.model.Level>> getVipLevelList(int pageNumber, int pageSize) {
return Api.getInstance().service.getVipLevelList(pageNumber,pageSize)
.onErrorReturn(new ErrorFilter<>())
.map(new ResultFilter<>())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.retryWhen(new RetryHelper(3));
}
}
public static class Cor {
......
......@@ -342,6 +342,9 @@ interface ApiService {
@POST(C.URL.LEVEL.update)
Observable<HttpMessage<Level>> updateVipLevel(@Body Level l);
@POST(C.URL.LEVEL.queryAll)
Observable<HttpMessage<Pager<Level>>> getVipLevelList(@Query("pageNumber") int pageNumber, @Query ("pageSize") int pageSize);
@POST(C.URL.MSCARD.update)
Observable<HttpMessage<Mscard>> updateMscard(@Body Mscard m);
......@@ -367,4 +370,11 @@ interface ApiService {
@POST(C.URL.VER.getLastVer)
Observable<HttpMessage<Ver>> getLastVer(@Query("sn") String sn);
@POST(C.URL.VIP.query)
Observable<HttpMessage<Pager<Vip>>> getVipList(@Query("vipLevel") String keycode,
@Query("pageNumber") int pageNumber,
@Query("pageSize") int pageSize);
}
......@@ -26,15 +26,15 @@ public class VipActivity extends BaseActivity<VipPresenter, ActivityVipBinding>
@Override
public void initView() {
loadRootFragment(R.id.vip_list_frame, vipListFragment, false, false);
loadRootFragment(R.id.vip_level_frame, vipLevleFragment, false, false);
loadRootFragment(R.id.vip_title_frame, vipTitleFragment, false, false);
loadRootFragment(R.id.vip_list_frame, vipListFragment, false, false);
}
@Override
public void addVip() {
}
@Override
......@@ -43,15 +43,17 @@ public class VipActivity extends BaseActivity<VipPresenter, ActivityVipBinding>
}
@Override
public Pager<Vip> getVipLevelSus() {
return null;
public void getVipLevelSus(Pager<Level> levelPager) {
}
@Override
public Pager<Level> getVipListSus() {
return null;
public void getVipListSus(Pager<Vip> vipPager) {
}
@Override
public String getVipNumberSus() {
return null;
......
......@@ -7,26 +7,29 @@ import com.xingdata.zzdpos.model.Pager;
import com.xingdata.zzdpos.model.Vip;
interface VipContract {
public interface VipContract {
interface View extends BaseView {
void addVip();
String addVipSus();
Pager<Vip> getVipLevelSus();
Pager<Level> getVipListSus();
void getVipLevelSus(Pager<Level> levelPager);
void getVipListSus(Pager<Vip> vipPager);
String getVipNumberSus();
}
abstract class Presenter extends BasePresenter<VipContract.View> {
public abstract void getVipList(int levelId, int pageNumber);
public abstract void getVipList( int pageNumber, int vipLevel);
public abstract void getVipLevel();
public abstract void getVipLevel(int pageNum, int
pageSize);
public abstract void getVipNumber();
public abstract void addVip();
public abstract void addVip();
}
}
\ No newline at end of file
package com.xingdata.zzdpos.ui.vip;
import com.blankj.utilcode.util.ToastUtils;
import com.xingdata.zzdpos.api.ApiFactory;
import com.xingdata.zzdpos.ui.vip.fragment.VipInfoFragment;
public class VipPresenter extends VipContract.Presenter {
......@@ -10,14 +12,25 @@ public class VipPresenter extends VipContract.Presenter {
public void onAttached() {
}
@Override
public void getVipList(int levelId, int pageNumber) {
@Override
public void getVipList(int pageNumber, int vipLevel) {
ApiFactory.User.getVipList(pageNumber).subscribe(vipPager -> {
mView.getVipListSus(vipPager);
}, throwable -> {
ToastUtils.showShort(throwable.getMessage());
});
}
@Override
public void getVipLevel() {
@Override
public void getVipLevel(int pageNum, int
pageSize) {
ApiFactory.Level.getVipLevelList(pageNum, pageSize).subscribe(vipPager -> {
mView.getVipLevelSus(vipPager);
}, throwable -> {
ToastUtils.showShort(throwable.getMessage());
});
}
@Override
......
......@@ -20,7 +20,7 @@ public class VipRechargeAdapter extends BaseAdapter<VipRechangeOrder, ItemVipRec
private Context mContext;
public VipRechargeAdapter(Context mContext, @Nullable List<VipRechangeOrder> data) {
super(R.layout.item_vip_list_item, data);
super(R.layout.item_vip_recharge_item, data);
this.mContext=mContext;
}
@Override
......
package com.xingdata.zzdpos.ui.vip.dialog;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseSheetDialog;
import com.xingdata.zzdpos.databinding.DialogVipMenuBinding;
import com.xingdata.zzdpos.ui.vip.VipPresenter;
/**
* Created by JM_DEV on 2017/12/27.
*/
public class VipEditMenuDialog extends BaseSheetDialog<VipPresenter, DialogVipMenuBinding> {
@Override
public int getLayoutId() {
return R.layout.dialog_vip_menu;
}
@Override
public void initView() {
}
@Override
protected boolean isTransparentBackground() {
return true;
}
}
......@@ -8,11 +8,14 @@ import android.support.v7.widget.LinearLayoutManager;
import com.blankj.utilcode.util.ToastUtils;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseActivity;
import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.base.BaseSheetDialog;
import com.xingdata.zzdpos.databinding.FragmentVipinfoBinding;
import com.xingdata.zzdpos.model.VipRechangeOrder;
import com.xingdata.zzdpos.ui.vip.VipPresenter;
import com.xingdata.zzdpos.ui.vip.adapter.VipRechargeAdapter;
import com.xingdata.zzdpos.ui.vip.dialog.VipEditMenuDialog;
import java.util.ArrayList;
import java.util.List;
......@@ -20,9 +23,10 @@ import java.util.List;
/**
* 会员信息界面
*/
public class VipInfoFragment extends BaseFragment<VipPresenter, FragmentVipinfoBinding> {
public class VipInfoFragment extends BaseFragment<VipPresenter, FragmentVipinfoBinding> {
private VipRechargeAdapter vipRechargeAdapter;
private List<VipRechangeOrder> orders = new ArrayList<>();
@Override
public int getLayoutId() {
return R.layout.fragment_vipinfo;
......@@ -30,14 +34,34 @@ public class VipInfoFragment extends BaseFragment<VipPresenter, FragmentVipinfoB
@Override
public void initView() {
for (int i=0;i<10;i++){
orders.add(new VipRechangeOrder());
}
vipRechargeAdapter = new VipRechargeAdapter(getActivity(), orders);
mViewBinding.rechargeRecyclerView.setLayoutManager( new LinearLayoutManager(getActivity()));
mViewBinding.rechargeRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mViewBinding.rechargeRecyclerView.setAdapter(vipRechargeAdapter);
mViewBinding.rechargeRefresh.setOnRefreshListener(this::onRefresh);
vipRechargeAdapter.setEnableLoadMore(true);
vipRechargeAdapter.setOnLoadMoreListener(this::onLoadMore, mViewBinding.rechargeRecyclerView);
mViewBinding.infoTitle.popMenu.setOnClickListener(view ->{
new VipEditMenuDialog().show((BaseActivity) getActivity());
});
mViewBinding.infoTitle.ivBack.setOnClickListener(view -> {
ToastUtils.showShort("aaaaaaaaaa");
});
}
private void onLoadMore() {
vipRechargeAdapter.addData(new VipRechangeOrder());
vipRechargeAdapter.setEnableLoadMore(true);
vipRechargeAdapter.loadMoreComplete();
ToastUtils.showShort("刷新成功");
}
private void onRefresh() {
vipRechargeAdapter.addData(new ArrayList<VipRechangeOrder>());
mViewBinding.rechargeRefresh.setRefreshing(false);
ToastUtils.showShort("刷新成功");
}
......
......@@ -16,13 +16,17 @@ import android.widget.RadioGroup;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentViplevelTitleBinding;
import com.xingdata.zzdpos.model.Level;
import com.xingdata.zzdpos.model.Pager;
import com.xingdata.zzdpos.model.Vip;
import com.xingdata.zzdpos.ui.vip.VipActivity;
import com.xingdata.zzdpos.ui.vip.VipContract;
import com.xingdata.zzdpos.ui.vip.VipPresenter;
/**
* 会员等级列表
*/
public class VipLevleFragment extends BaseFragment<VipPresenter, FragmentViplevelTitleBinding> {
public class VipLevleFragment extends BaseFragment<VipPresenter, FragmentViplevelTitleBinding> implements VipContract.View {
@Override
public int getLayoutId() {
return R.layout.fragment_viplevel_title;
......@@ -30,19 +34,7 @@ public class VipLevleFragment extends BaseFragment<VipPresenter, FragmentVipleve
@Override
public void initView() {
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
layoutParams.height = 120;
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
for (int i = 0; i < 5; i++) {
mViewBinding.vipLevelRadioGroup.addView(addRadioButton(layoutParams));
}
((RadioButton) mViewBinding.vipLevelRadioGroup.getChildAt(0)).setChecked(true);
mViewBinding.vipLevelRadioGroup.setOnCheckedChangeListener((radioGroup, n) -> {
for (int i = 0; i < mViewBinding.vipLevelRadioGroup.getChildCount(); i++) {
//动态设置按钮颜色
setRadioButtonChecked(i == n - 1, ((RadioButton) radioGroup.getChildAt(i)));
}
});
mPresenter.getVipLevel(0,200);
}
/**
......@@ -58,13 +50,15 @@ public class VipLevleFragment extends BaseFragment<VipPresenter, FragmentVipleve
} else {
button.setTextSize(15);
}
mPresenter.getVipList(0,Integer.parseInt(button.getTag().toString()));
}
@SuppressLint("ResourceAsColor")
private RadioButton addRadioButton(LinearLayout.LayoutParams layoutParams) {
private RadioButton addRadioButton(LinearLayout.LayoutParams layoutParams, Level level) {
RadioButton radioButton = new RadioButton(getActivity());
radioButton.setTextSize(15);
radioButton.setText("金牌会员");
radioButton.setText(level.getVipLevelName());
radioButton.setTag(level.getVipLevel());
setRadioButtonChecked(false, radioButton);
radioButton.setGravity(Gravity.CENTER);
radioButton.setButtonDrawable(null);
......@@ -74,4 +68,42 @@ public class VipLevleFragment extends BaseFragment<VipPresenter, FragmentVipleve
radioButton.setLayoutParams(layoutParams);
return radioButton;
}
@Override
public void addVip() {
}
@Override
public String addVipSus() {
return null;
}
@Override
public void getVipLevelSus(Pager<Level> levelPager) {
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
layoutParams.height = 120;
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
for (int i = 0; i < levelPager.getPageSize(); i++) {
mViewBinding.vipLevelRadioGroup.addView(addRadioButton(layoutParams,levelPager.getList().get(i)));
}
((RadioButton) mViewBinding.vipLevelRadioGroup.getChildAt(0)).setChecked(true);
mViewBinding.vipLevelRadioGroup.setOnCheckedChangeListener((radioGroup, n) -> {
for (int i = 0; i < mViewBinding.vipLevelRadioGroup.getChildCount(); i++) {
//动态设置按钮颜色
setRadioButtonChecked(i == n - 1, ((RadioButton) radioGroup.getChildAt(i)));
}
});
}
@Override
public void getVipListSus(Pager<Vip> vipPager) {
}
@Override
public String getVipNumberSus() {
return null;
}
}
......@@ -5,14 +5,15 @@ package com.xingdata.zzdpos.ui.vip.fragment;
*/
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import com.blankj.utilcode.util.ToastUtils;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseActivity;
import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentVipListBinding;
import com.xingdata.zzdpos.databinding.FragmentViplevelTitleBinding;
import com.xingdata.zzdpos.model.Level;
import com.xingdata.zzdpos.model.Pager;
import com.xingdata.zzdpos.model.Vip;
import com.xingdata.zzdpos.ui.vip.VipContract;
import com.xingdata.zzdpos.ui.vip.VipPresenter;
import com.xingdata.zzdpos.ui.vip.adapter.VipListAdapter;
......@@ -22,9 +23,10 @@ import java.util.List;
/**
* 会员列表
*/
public class VipListFragment extends BaseFragment<VipPresenter, FragmentVipListBinding> {
public class VipListFragment extends BaseFragment<VipPresenter, FragmentVipListBinding> implements VipContract.View {
private VipListAdapter vipListAdapter;
private List<Vip> vips = new ArrayList<>();
private int inViplevel=0;
@Override
......@@ -35,21 +37,59 @@ public class VipListFragment extends BaseFragment<VipPresenter, FragmentVipListB
@Override
public void initView() {
vipListAdapter = new VipListAdapter(getActivity(), vips);
mViewBinding.vipRecyclerView.setLayoutManager( new LinearLayoutManager(getActivity()));
mViewBinding.vipRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mViewBinding.vipRecyclerView.setAdapter(vipListAdapter);
mViewBinding.vipRefresh.setOnRefreshListener(this::onRefresh);
mViewBinding.vipRecyclerView.setOnClickListener(view -> {
start(new VipInfoFragment());
vipListAdapter.setOnItemClickListener((adapter, view, position) -> {
((BaseActivity) getActivity()).start(new VipInfoFragment());
});
vipListAdapter.setOnLoadMoreListener(this::onLoadMore, mViewBinding.vipRecyclerView);
vipListAdapter.setEnableLoadMore(true);
}
private void onRefresh() {
private void onLoadMore() {
Vip vip = new Vip();
vip.setVipName("张山");
vip.setVipMobile(13311221212L);
vip.setVipDefDiscount(80);
vipListAdapter.addData(vip);
ToastUtils.showShort("刷新成功");
vipListAdapter.loadMoreComplete();
}
private void onRefresh() {
// mPresenter.getVipList(inViplevel,0);
}
@Override
public void addVip() {
}
@Override
public String addVipSus() {
return null;
}
@Override
public void getVipLevelSus(Pager<Level> levelPager) {
}
@Override
public void getVipListSus(Pager<Vip> vipPager) {
mViewBinding.vipRefresh.setRefreshing(false);
if (vipPager.isFirstPage()) {
vips.clear();
vipListAdapter.notifyDataSetChanged();
}else {
vipListAdapter.addData(vipPager.getList());
}
}
@Override
public String getVipNumberSus() {
return null;
}
}
......@@ -10,6 +10,7 @@ import android.widget.LinearLayout;
import android.widget.RadioButton;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseActivity;
import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentViplevelTitleBinding;
import com.xingdata.zzdpos.databinding.FragmentViptitleBinding;
......@@ -25,7 +26,7 @@ public class VipTitleFragment extends BaseFragment<VipPresenter, FragmentViptitl
@Override
public void initView() {
mViewBinding.addButton.setOnClickListener(view -> {
start(mPresenter.vipInfoFragment);
((BaseActivity) getActivity()).start(mPresenter.vipInfoFragment);
});
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp" />
<solid android:color="@color/white" />
</shape>
\ No newline at end of file
......@@ -4,9 +4,15 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/transparent_border"
android:background="@color/transparent"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AAAAAAAAAAAAAAAAAA" />
</LinearLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/shape_white"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
style="@style/default_bluetext_popbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dtail_hight_5"
android:background="@color/white"
android:text="编辑会员" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/line_bg" />
<TextView
style="@style/default_bluetext_popbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dtail_hight_5"
android:background="@color/white"
android:text="充值会员" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/line_bg" />
<TextView
style="@style/default_bluetext_popbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dtail_hight_5"
android:background="@color/white"
android:text="消费记录" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:layout_marginTop="30dp"
android:background="@drawable/shape_white"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
style="@style/default_bluetext_popbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dtail_hight_5"
android:background="@color/white"
android:text="取消" />
</LinearLayout>
</LinearLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout>
<data>
<variable
name="onClickListener"
type="com.xingdata.zzdpos.util.OnClickListener" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg"
android:orientation="vertical">
<include layout="@layout/title_pop" />
<include
android:id="@+id/info_title"
layout="@layout/title_pop" />
<LinearLayout
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<layout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
......@@ -8,12 +7,11 @@
android:orientation="vertical">
<RadioGroup
android:gravity="center"
android:id="@+id/vip_level_RadioGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</RadioGroup>
android:gravity="center"
android:orientation="vertical"></RadioGroup>
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -12,6 +12,7 @@
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
......
......@@ -8,8 +8,8 @@
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_margin="@dimen/all_margin"
android:background="@mipmap/pay_alipay" />
......
<?xml version="1.0" encoding="utf-8"?>
<layout>
<data>
<variable
name="onClickListener"
type="com.xingdata.zzdpos.util.OnClickListener" />
</data>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
......@@ -21,8 +12,7 @@
android:id="@+id/iv_back"
android:layout_width="?attr/actionBarSize"
android:layout_height="match_parent"
android:background="@mipmap/go_back"
android:onClick="@{onClickListener}" />
android:background="@mipmap/go_back" />
<TextView
android:id="@+id/tv_title"
......@@ -38,8 +28,7 @@
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="@mipmap/pop_menu"
android:onClick="@{onClickListener}" />
android:background="@mipmap/pop_menu" />
</RelativeLayout>
......
......@@ -43,6 +43,17 @@
<item name="android:textColor">@color/black</item>
<item name="android:textSize">@dimen/detail_textview_size</item>
</style>
<style name="default_bluetext_popbutton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">match_parent</item>
<item name="android:gravity">center_vertical</item>
<item name="android:singleLine">true</item>
<item name="android:padding">@dimen/dp_4</item>
<item name="android:textColor">@color/blue_mawu</item>
<item name="android:textSize">@dimen/big_text_size</item>
</style>
<style name="default_title">
<item name="android:gravity">center_vertical</item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment