Commit 9a202fe6 authored by zhang_z's avatar zhang_z

Merge remote-tracking branch 'origin/master'

parents dab555f3 b36a1707
package com.xingdata.zzdpos.ui.main.fragment;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.xingdata.zzdpos.C;
......@@ -17,14 +13,16 @@ import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentCasherBinding;
import com.xingdata.zzdpos.ui.main.MainPresenter;
import com.xingdata.zzdpos.ui.main.adapter.MenuRecyclerAdapter;
import com.xingdata.zzdpos.util.MyMenuItemDecoration;
import java.util.ArrayList;
import java.util.List;
public class CasherFragment extends BaseFragment<MainPresenter,FragmentCasherBinding> {
public class CasherFragment extends BaseFragment<MainPresenter, FragmentCasherBinding> {
private MenuRecyclerAdapter mMenuRecyclerAdapter;
private List<Integer> integers;
@Override
public int getLayoutId() {
return R.layout.fragment_casher;
......@@ -43,15 +41,15 @@ public class CasherFragment extends BaseFragment<MainPresenter,FragmentCasherBin
integers.add(106);
mMenuRecyclerAdapter = new MenuRecyclerAdapter(getActivity(), integers);
mMenuRecyclerAdapter.bindToRecyclerView(mViewBinding.fragmentCasherRecycler);
// mViewBinding.fragmentCasherRecycler.addItemDecoration(new MyItemDecoration(getActivity(), 2, R.color.black_zhangfei));
mViewBinding.fragmentCasherRecycler.addItemDecoration(new MyMenuItemDecoration(getActivity(),5,getResources().getColor(R.color.gray_kongming)));
mMenuRecyclerAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
switch ((int)adapter.getData().get(position)) {
switch ((int) adapter.getData().get(position)) {
case C.MENU.MENU_VIP://会员
break;
case C.MENU.MENU_RECHARGE://充值
case C.MENU.MENU_RECHARGE://充值
break;
case C.MENU.MENU_MS://营销
......
......@@ -18,41 +18,41 @@ public class PayAdapter extends BaseAdapter<Pay, ItemPayBinding> {
@Override
protected void convert(ItemPayBinding mViewBinding, Pay item) {
int resLogo, resBackground;
switch (item.getPayType()) {
case C.PAY_CHANNEL.CASH:
resLogo = R.mipmap.pay_cash;
resBackground = R.color.red_diaochan;
break;
case C.PAY_CHANNEL.WECHAT:
resLogo = R.mipmap.pay_wechat;
resBackground = R.color.green_kongrun;
break;
case C.PAY_CHANNEL.ALI:
resLogo = R.mipmap.pay_alipay;
resBackground = R.color.blue_yuefei;
break;
case C.PAY_CHANNEL.BANK:
resLogo = R.mipmap.pay_card;
resBackground = R.color.cyan_liubei;
break;
case C.PAY_CHANNEL.CARD:
resLogo = R.mipmap.pay_membershipcard;
resBackground = R.color.yellow_huangxin;
break;
case C.PAY_CHANNEL.TALLY:
resLogo = R.mipmap.pay_credit;
resBackground = R.color.purple_yanqing;
break;
default:
resLogo = R.mipmap.pay_cash;
resBackground = R.color.red_diaochan;
break;
}
mViewBinding.ivLogo.setImageResource(resLogo);
GenericDraweeHierarchy hierarchy = mViewBinding.ivBackground.getHierarchy();
hierarchy.setBackgroundImage(mContext.getResources().getDrawable(resBackground));
mViewBinding.ivBackground.setHierarchy(hierarchy);
// int resLogo, resBackground;
// switch (item.getPayType()) {
// case C.PAY_CHANNEL.CASH:
// resLogo = R.mipmap.pay_cash;
// resBackground = R.color.red_diaochan;
// break;
// case C.PAY_CHANNEL.WECHAT:
// resLogo = R.mipmap.pay_wechat;
// resBackground = R.color.green_kongrun;
// break;
// case C.PAY_CHANNEL.ALI:
// resLogo = R.mipmap.pay_alipay;
// resBackground = R.color.blue_yuefei;
// break;
// case C.PAY_CHANNEL.BANK:
// resLogo = R.mipmap.pay_card;
// resBackground = R.color.cyan_liubei;
// break;
// case C.PAY_CHANNEL.CARD:
// resLogo = R.mipmap.pay_membershipcard;
// resBackground = R.color.yellow_huangxin;
// break;
// case C.PAY_CHANNEL.TALLY:
// resLogo = R.mipmap.pay_credit;
// resBackground = R.color.purple_yanqing;
// break;
// default:
// resLogo = R.mipmap.pay_cash;
// resBackground = R.color.red_diaochan;
// break;
// }
// mViewBinding.ivLogo.setImageResource(resLogo);
//
// GenericDraweeHierarchy hierarchy = mViewBinding.ivBackground.getHierarchy();
// hierarchy.setBackgroundImage(mContext.getResources().getDrawable(resBackground));
// mViewBinding.ivBackground.setHierarchy(hierarchy);
}
}
......@@ -12,16 +12,16 @@ import android.view.View;
* Created by Administrator on 2017/12/21.
*/
class MyItemDecoration extends RecyclerView.ItemDecoration {
public class MyMenuItemDecoration extends RecyclerView.ItemDecoration {
private Drawable mDividerDarwable;
private int mDividerHight = 1;
private Paint mColorPaint;
private int size=2;
private int size = 2;
public final int[] ATRRS = new int[]{android.R.attr.listDivider};
public MyItemDecoration(Context context) {
public MyMenuItemDecoration(Context context) {
final TypedArray ta = context.obtainStyledAttributes(ATRRS);
this.mDividerDarwable = ta.getDrawable(0);
ta.recycle();
......@@ -31,7 +31,7 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
int dividerHight 分割线的线宽
int dividerColor 分割线的颜色
*/
public MyItemDecoration(Context context, int dividerHight, int dividerColor) {
public MyMenuItemDecoration(Context context, int dividerHight, int dividerColor) {
this(context);
mDividerHight = dividerHight;
mColorPaint = new Paint();
......@@ -42,18 +42,19 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
int dividerHight 分割线的线宽
int dividerColor 分割线的颜色
*/
public MyItemDecoration(Context context, int dividerHight, int dividerColor, int size) {
public MyMenuItemDecoration(Context context, int dividerHight, int dividerColor, int size) {
this(context);
mDividerHight = dividerHight;
mColorPaint = new Paint();
mColorPaint.setColor(dividerColor);
this.size=size;
this.size = size;
}
/*
int dividerHight 分割线的线宽
Drawable dividerDrawable 图片分割线
*/
public MyItemDecoration(Context context, int dividerHight, Drawable dividerDrawable) {
public MyMenuItemDecoration(Context context, int dividerHight, Drawable dividerDrawable) {
this(context);
mDividerHight = dividerHight;
mDividerDarwable = dividerDrawable;
......@@ -73,8 +74,8 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
final View child = parent.getChildAt(i);
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
final int top = child.getTop() - params.topMargin+30;
final int bottom = child.getBottom() + params.bottomMargin-30;
final int top = child.getTop() - params.topMargin + 30;
final int bottom = child.getBottom() + params.bottomMargin - 30;
int left = 0;
int right = 0;
......@@ -108,8 +109,8 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
final View child = parent.getChildAt(i);
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
final int left = child.getLeft() - params.leftMargin - mDividerHight;
final int right = child.getRight() + params.rightMargin;
final int left = child.getLeft() - params.leftMargin - mDividerHight+30;
final int right = child.getRight() + params.rightMargin-30;
int top = 0;
int bottom = 0;
......@@ -127,9 +128,11 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
// top = child.getBottom() + params.bottomMargin;
// bottom = top + mDividerHight;
// } else {
// if (i!=)
top = child.getBottom() + params.bottomMargin;
bottom = top + mDividerHight;
if (i/size!=(parent.getAdapter().getItemCount()/size-1)){
top = child.getBottom() + params.bottomMargin;
bottom = top + mDividerHight;
}
// }
//画分割线
mDividerDarwable.setBounds(left, top, right, bottom);
......
......@@ -55,7 +55,7 @@
android:layout_marginBottom="@dimen/all_padding"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/gray_zhouyu"
android:background="@color/white_caocao"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
......
<?xml version="1.0" encoding="utf-8"?>
<layout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="25dp"
android:paddingBottom="25dp"
android:gravity="center"
android:elevation="0.5dp"
android:background="@color/white_caocao"
android:layout_margin="0.8dp"
android:orientation="vertical">
<ImageView
android:id="@+id/img"
android:layout_width="wrap_content"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"/>
android:layout_margin="0.8dp"
android:background="@color/white_caocao"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="25dp"
android:paddingTop="25dp">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp" />
</LinearLayout>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black_baozheng" />
</LinearLayout>
</layout>
......@@ -145,6 +145,8 @@
<color name="yellow_huangxin">#ffc960</color>
<color name="golden_yuji">#f2e7d3</color>
<color name="purple_yanqing">#6590e6</color>
......
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