Commit c9670b70 authored by zhang_z's avatar zhang_z

Merge remote-tracking branch 'origin/master'

parents 9acd0561 245b2aae
......@@ -8,18 +8,38 @@ import com.xingdata.zzdpos.model.Pager;
import com.xingdata.zzdpos.model.Vip;
import com.xingdata.zzdpos.ui.vip.fragment.VipInfoFragment;
import com.xingdata.zzdpos.ui.vip.fragment.VipLevleFragment;
import com.xingdata.zzdpos.ui.vip.fragment.VipListFragment;
import com.xingdata.zzdpos.ui.vip.fragment.VipTitleFragment;
import com.xingdata.zzdpos.util.OnClickListener;
public class VipActivity extends BaseActivity<VipPresenter, ActivityVipBinding> implements VipContract.View {
private VipInfoFragment vipInfoFragment = new VipInfoFragment();
private VipListFragment vipListFragment = new VipListFragment();
private VipLevleFragment vipLevleFragment = new VipLevleFragment();
private VipTitleFragment vipTitleFragment = new VipTitleFragment();
@Override
public int getLayoutId() {
return R.layout.activity_vip;
}
@Override
public void initView() {
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
public String addVipSus() {
return null;
}
@Override
......
......@@ -10,15 +10,23 @@ import com.xingdata.zzdpos.model.Vip;
interface VipContract {
interface View extends BaseView {
void addVip();
String addVipSus();
Pager<Vip> getVipLevelSus();
Pager<Level> getVipListSus();
String getVipNumberSus();
}
abstract class Presenter extends BasePresenter<VipContract.View> {
public abstract void getVipList(int levelId, int pageNumber);
public abstract void getVipLevel();
public abstract void getVipNumber();
public abstract void addVip();
}
}
\ No newline at end of file
package com.xingdata.zzdpos.ui.vip;
import com.xingdata.zzdpos.ui.vip.fragment.VipInfoFragment;
public class VipPresenter extends VipContract.Presenter {
public VipInfoFragment vipInfoFragment = new VipInfoFragment();
@Override
public void onAttached() {
}
......@@ -20,4 +24,9 @@ public class VipPresenter extends VipContract.Presenter {
public void getVipNumber() {
}
@Override
public void addVip() {
mView.addVip();
}
}
package com.xingdata.zzdpos.ui.vip.adapter;
import android.content.Context;
import android.support.annotation.Nullable;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseAdapter;
import com.xingdata.zzdpos.databinding.ItemVipListItemBinding;
import com.xingdata.zzdpos.model.Vip;
import java.util.List;
/**
* Created by JM_DEV on 2017/12/25.
*/
public class VipListAdapter extends BaseAdapter<Vip, ItemVipListItemBinding> {
private Context mContext;
public VipListAdapter(Context mContext, @Nullable List<Vip> data) {
super(R.layout.item_vip_list_item, data);
this.mContext=mContext;
}
@Override
protected void convert(ItemVipListItemBinding mViewBinding, Vip item) {
mViewBinding.vipName.setText(item.getVipName());
mViewBinding.vipMobile.setText(String.valueOf(item.getVipMobile()));
mViewBinding.vipDiscount.setText(String.valueOf(item.getVipDefDiscount()));
}
}
......@@ -6,23 +6,26 @@ package com.xingdata.zzdpos.ui.vip.fragment;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentViplevelTitleBinding;
import com.xingdata.zzdpos.databinding.FragmentVipinfoBinding;
import com.xingdata.zzdpos.ui.vip.VipPresenter;
/**
* 会员信息界面
*/
public class VipInfoFragment extends BaseFragment<VipPresenter, FragmentViplevelTitleBinding> {
public class VipInfoFragment extends BaseFragment<VipPresenter, FragmentVipinfoBinding> {
@Override
public int getLayoutId() {
return R.layout.fragment_viplevel_title;
return R.layout.fragment_vipinfo;
}
@Override
public void initView() {
// RadioButton radioButton = new RadioButton(getActivity());
// radioButton.setText("AAAAAAAAAAAAAAA");
// mViewBinding.vipLevelRadioGroup.addView(radioButton);
}
@Override
public boolean onBackPressedSupport() {
pop();
return true;
}
}
......@@ -36,7 +36,7 @@ public class VipLevleFragment extends BaseFragment<VipPresenter, FragmentVipleve
for (int i = 0; i < 5; i++) {
mViewBinding.vipLevelRadioGroup.addView(addRadioButton(layoutParams));
}
setRadioButtonChecked(true, ((RadioButton) mViewBinding.vipLevelRadioGroup.getChildAt(0)));
((RadioButton) mViewBinding.vipLevelRadioGroup.getChildAt(0)).setChecked(true);
mViewBinding.vipLevelRadioGroup.setOnCheckedChangeListener((radioGroup, n) -> {
for (int i = 0; i < mViewBinding.vipLevelRadioGroup.getChildCount(); i++) {
//动态设置按钮颜色
......
......@@ -4,25 +4,49 @@ package com.xingdata.zzdpos.ui.vip.fragment;
* Created by JM_DEV on 2017/12/21.
*/
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.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentVipListBinding;
import com.xingdata.zzdpos.databinding.FragmentViplevelTitleBinding;
import com.xingdata.zzdpos.model.Vip;
import com.xingdata.zzdpos.ui.vip.VipPresenter;
import com.xingdata.zzdpos.ui.vip.adapter.VipListAdapter;
import java.util.ArrayList;
import java.util.List;
/**
* 会员列表
*/
public class VipListFragment extends BaseFragment<VipPresenter, FragmentViplevelTitleBinding> {
public class VipListFragment extends BaseFragment<VipPresenter, FragmentVipListBinding> {
private VipListAdapter vipListAdapter;
private List<Vip> vips = new ArrayList<>();
@Override
public int getLayoutId() {
return R.layout.fragment_viplevel_title;
return R.layout.fragment_vip_list;
}
@Override
public void initView() {
// RadioButton radioButton = new RadioButton(getActivity());
// radioButton.setText("AAAAAAAAAAAAAAA");
// mViewBinding.vipLevelRadioGroup.addView(radioButton);
vipListAdapter = new VipListAdapter(getActivity(), vips);
mViewBinding.vipRecyclerView.setLayoutManager( new LinearLayoutManager(getActivity()));
mViewBinding.vipRecyclerView.setAdapter(vipListAdapter);
mViewBinding.vipRefresh.setOnRefreshListener(this::onRefresh);
}
private void onRefresh() {
Vip vip = new Vip();
vip.setVipName("张山");
vip.setVipMobile(13311221212L);
vip.setVipDefDiscount(80);
vipListAdapter.addData(vip);
ToastUtils.showShort("刷新成功");
mViewBinding.vipRefresh.setRefreshing(false);
}
}
......@@ -20,9 +20,6 @@ public class VipRecordFragment extends BaseFragment<VipPresenter, FragmentViplev
@Override
public void initView() {
// RadioButton radioButton = new RadioButton(getActivity());
// radioButton.setText("AAAAAAAAAAAAAAA");
// mViewBinding.vipLevelRadioGroup.addView(radioButton);
}
}
package com.xingdata.zzdpos.ui.vip.fragment;
/**
* Created by JM_DEV on 2017/12/21.
*/
import android.annotation.SuppressLint;
import android.view.Gravity;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentViplevelTitleBinding;
import com.xingdata.zzdpos.databinding.FragmentViptitleBinding;
import com.xingdata.zzdpos.ui.vip.VipPresenter;
public class VipTitleFragment extends BaseFragment<VipPresenter, FragmentViptitleBinding> {
@Override
public int getLayoutId() {
return R.layout.fragment_viptitle;
}
@Override
public void initView() {
mViewBinding.addButton.setOnClickListener(view -> {
start(mPresenter.vipInfoFragment);
});
}
}
<?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"
android:background="@color/bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<include
layout="@layout/title_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageView
android:layout_width="50dp"
android:layout_height="match_parent"
android:background="@mipmap/swipe_card_bg" />
<ImageView
android:layout_width="50dp"
android:layout_height="match_parent"
android:background="@mipmap/scan_bg" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/line1" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="@dimen/view_line_L5"
android:background="@color/line1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/default_blacktext_smallstyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="本店会员" />
<TextView
style="@style/default_blacktext_smallstyle"
<FrameLayout
android:id="@+id/vip_title_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="今日新增" />
</LinearLayout>
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/default_blacktext_bigstyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="150"
android:textSize="22sp"
android:textStyle="bold" />
<TextView
style="@style/default_blacktext_bigstyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="10"
android:textSize="22sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="@dimen/view_line_L5"
android:background="@color/line1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/all_margin_left"
......@@ -103,13 +18,13 @@
<FrameLayout
android:id="@+id/vip_level_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="3"></FrameLayout>
<FrameLayout
android:id="@+id/vip_frame"
android:id="@+id/vip_list_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"></FrameLayout>
</LinearLayout>
</LinearLayout>
......
<?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"
android:orientation="vertical">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/vip_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/vipRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
</layout>
\ No newline at end of file
<?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"
android:background="@color/white"
android:orientation="vertical">
<include layout="@layout/title"/>
</LinearLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout>
<data>
<variable
name="onClickListener"
type="android.view.View.OnClickListener" />
<variable
name="onCheckedChangeListener"
type="android.widget.RadioGroup.OnCheckedChangeListener" />
</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"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<include
layout="@layout/title_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageView
android:layout_width="50dp"
android:layout_height="match_parent"
android:background="@mipmap/swipe_card_bg" />
<ImageView
android:id="@+id/onScan"
android:layout_width="50dp"
android:layout_height="match_parent"
android:background="@mipmap/scan_bg"
android:onClick="@{onClickListener}" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="@dimen/view_line_L5"
android:background="@color/line1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:background="@color/white"
android:orientation="horizontal">
<TextView
style="@style/default_blacktext_smallstyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="本店会员" />
<TextView
style="@style/default_blacktext_smallstyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="今日新增" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="horizontal">
<TextView
style="@style/default_blacktext_bigstyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="150"
android:textSize="22sp"
android:textStyle="bold" />
<TextView
style="@style/default_blacktext_bigstyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="10"
android:textSize="22sp"
android:textStyle="bold" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@color/white"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/addVip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:onClick="@{onClickListener}"
android:orientation="horizontal">
<ImageButton
android:id="@+id/addButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:background="@mipmap/add_bg" />
<TextView
style="@style/default_blacktext_bigstyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="添加会员"
android:textColor="@color/deep_red"
android:textSize="22sp" />
</LinearLayout>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="@dimen/view_line_L5"
android:background="@color/line1" />
</LinearLayout>
</layout>
\ No newline at end of file
<?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="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:text="张小萌"
android:id="@+id/vip_name"
style="@style/default_blacktext_bigstyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:text="13311556556"
android:id="@+id/vip_mobile"
style="@style/default_blacktext_smallstyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:text="85折"
android:id="@+id/vipDiscount"
style="@style/default_blacktext_smallstyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</layout>
\ No newline at end of file
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