Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TangKuPos
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王海
TangKuPos
Commits
9a202fe6
Commit
9a202fe6
authored
Dec 22, 2017
by
zhang_z
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
dab555f3
b36a1707
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
86 additions
and
82 deletions
+86
-82
app/src/main/java/com/xingdata/zzdpos/ui/main/fragment/CasherFragment.java
.../com/xingdata/zzdpos/ui/main/fragment/CasherFragment.java
+9
-11
app/src/main/java/com/xingdata/zzdpos/ui/settle/adapter/PayAdapter.java
...ava/com/xingdata/zzdpos/ui/settle/adapter/PayAdapter.java
+36
-36
app/src/main/java/com/xingdata/zzdpos/util/MyMenuItemDecoration.java
...n/java/com/xingdata/zzdpos/util/MyMenuItemDecoration.java
+17
-14
app/src/main/res/layout/fragment_casher.xml
app/src/main/res/layout/fragment_casher.xml
+1
-1
app/src/main/res/layout/item_menu_detail.xml
app/src/main/res/layout/item_menu_detail.xml
+21
-20
app/src/main/res/values/colors.xml
app/src/main/res/values/colors.xml
+2
-0
No files found.
app/src/main/java/com/xingdata/zzdpos/ui/main/fragment/CasherFragment.java
View file @
9a202fe6
package
com
.
xingdata
.
zzdpos
.
ui
.
main
.
fragment
;
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.GridLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.xingdata.zzdpos.C
;
import
com.xingdata.zzdpos.C
;
...
@@ -17,14 +13,16 @@ import com.xingdata.zzdpos.base.BaseFragment;
...
@@ -17,14 +13,16 @@ import com.xingdata.zzdpos.base.BaseFragment;
import
com.xingdata.zzdpos.databinding.FragmentCasherBinding
;
import
com.xingdata.zzdpos.databinding.FragmentCasherBinding
;
import
com.xingdata.zzdpos.ui.main.MainPresenter
;
import
com.xingdata.zzdpos.ui.main.MainPresenter
;
import
com.xingdata.zzdpos.ui.main.adapter.MenuRecyclerAdapter
;
import
com.xingdata.zzdpos.ui.main.adapter.MenuRecyclerAdapter
;
import
com.xingdata.zzdpos.util.MyMenuItemDecoration
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
public
class
CasherFragment
extends
BaseFragment
<
MainPresenter
,
FragmentCasherBinding
>
{
public
class
CasherFragment
extends
BaseFragment
<
MainPresenter
,
FragmentCasherBinding
>
{
private
MenuRecyclerAdapter
mMenuRecyclerAdapter
;
private
MenuRecyclerAdapter
mMenuRecyclerAdapter
;
private
List
<
Integer
>
integers
;
private
List
<
Integer
>
integers
;
@Override
@Override
public
int
getLayoutId
()
{
public
int
getLayoutId
()
{
return
R
.
layout
.
fragment_casher
;
return
R
.
layout
.
fragment_casher
;
...
@@ -43,15 +41,15 @@ public class CasherFragment extends BaseFragment<MainPresenter,FragmentCasherBin
...
@@ -43,15 +41,15 @@ public class CasherFragment extends BaseFragment<MainPresenter,FragmentCasherBin
integers
.
add
(
106
);
integers
.
add
(
106
);
mMenuRecyclerAdapter
=
new
MenuRecyclerAdapter
(
getActivity
(),
integers
);
mMenuRecyclerAdapter
=
new
MenuRecyclerAdapter
(
getActivity
(),
integers
);
mMenuRecyclerAdapter
.
bindToRecyclerView
(
mViewBinding
.
fragmentCasherRecycler
);
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
()
{
mMenuRecyclerAdapter
.
setOnItemClickListener
(
new
BaseQuickAdapter
.
OnItemClickListener
()
{
@Override
@Override
public
void
onItemClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
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
:
//会员
case
C
.
MENU
.
MENU_VIP
:
//会员
break
;
break
;
case
C
.
MENU
.
MENU_RECHARGE
:
//充值
case
C
.
MENU
.
MENU_RECHARGE
:
//充值
break
;
break
;
case
C
.
MENU
.
MENU_MS
:
//营销
case
C
.
MENU
.
MENU_MS
:
//营销
...
...
app/src/main/java/com/xingdata/zzdpos/ui/settle/adapter/PayAdapter.java
View file @
9a202fe6
...
@@ -18,41 +18,41 @@ public class PayAdapter extends BaseAdapter<Pay, ItemPayBinding> {
...
@@ -18,41 +18,41 @@ public class PayAdapter extends BaseAdapter<Pay, ItemPayBinding> {
@Override
@Override
protected
void
convert
(
ItemPayBinding
mViewBinding
,
Pay
item
)
{
protected
void
convert
(
ItemPayBinding
mViewBinding
,
Pay
item
)
{
int
resLogo
,
resBackground
;
//
int resLogo, resBackground;
switch
(
item
.
getPayType
())
{
//
switch (item.getPayType()) {
case
C
.
PAY_CHANNEL
.
CASH
:
//
case C.PAY_CHANNEL.CASH:
resLogo
=
R
.
mipmap
.
pay_cash
;
//
resLogo = R.mipmap.pay_cash;
resBackground
=
R
.
color
.
red_diaochan
;
//
resBackground = R.color.red_diaochan;
break
;
//
break;
case
C
.
PAY_CHANNEL
.
WECHAT
:
//
case C.PAY_CHANNEL.WECHAT:
resLogo
=
R
.
mipmap
.
pay_wechat
;
//
resLogo = R.mipmap.pay_wechat;
resBackground
=
R
.
color
.
green_kongrun
;
//
resBackground = R.color.green_kongrun;
break
;
//
break;
case
C
.
PAY_CHANNEL
.
ALI
:
//
case C.PAY_CHANNEL.ALI:
resLogo
=
R
.
mipmap
.
pay_alipay
;
//
resLogo = R.mipmap.pay_alipay;
resBackground
=
R
.
color
.
blue_yuefei
;
//
resBackground = R.color.blue_yuefei;
break
;
//
break;
case
C
.
PAY_CHANNEL
.
BANK
:
//
case C.PAY_CHANNEL.BANK:
resLogo
=
R
.
mipmap
.
pay_card
;
//
resLogo = R.mipmap.pay_card;
resBackground
=
R
.
color
.
cyan_liubei
;
//
resBackground = R.color.cyan_liubei;
break
;
//
break;
case
C
.
PAY_CHANNEL
.
CARD
:
//
case C.PAY_CHANNEL.CARD:
resLogo
=
R
.
mipmap
.
pay_membershipcard
;
//
resLogo = R.mipmap.pay_membershipcard;
resBackground
=
R
.
color
.
yellow_huangxin
;
//
resBackground = R.color.yellow_huangxin;
break
;
//
break;
case
C
.
PAY_CHANNEL
.
TALLY
:
//
case C.PAY_CHANNEL.TALLY:
resLogo
=
R
.
mipmap
.
pay_credit
;
//
resLogo = R.mipmap.pay_credit;
resBackground
=
R
.
color
.
purple_yanqing
;
//
resBackground = R.color.purple_yanqing;
break
;
//
break;
default
:
//
default:
resLogo
=
R
.
mipmap
.
pay_cash
;
//
resLogo = R.mipmap.pay_cash;
resBackground
=
R
.
color
.
red_diaochan
;
//
resBackground = R.color.red_diaochan;
break
;
//
break;
}
//
}
mViewBinding
.
ivLogo
.
setImageResource
(
resLogo
);
//
mViewBinding.ivLogo.setImageResource(resLogo);
//
GenericDraweeHierarchy
hierarchy
=
mViewBinding
.
ivBackground
.
getHierarchy
();
//
GenericDraweeHierarchy hierarchy = mViewBinding.ivBackground.getHierarchy();
hierarchy
.
setBackgroundImage
(
mContext
.
getResources
().
getDrawable
(
resBackground
));
//
hierarchy.setBackgroundImage(mContext.getResources().getDrawable(resBackground));
mViewBinding
.
ivBackground
.
setHierarchy
(
hierarchy
);
//
mViewBinding.ivBackground.setHierarchy(hierarchy);
}
}
}
}
app/src/main/java/com/xingdata/zzdpos/util/MyItemDecoration.java
→
app/src/main/java/com/xingdata/zzdpos/util/My
Menu
ItemDecoration.java
View file @
9a202fe6
...
@@ -12,16 +12,16 @@ import android.view.View;
...
@@ -12,16 +12,16 @@ import android.view.View;
* Created by Administrator on 2017/12/21.
* Created by Administrator on 2017/12/21.
*/
*/
class
My
ItemDecoration
extends
RecyclerView
.
ItemDecoration
{
public
class
MyMenu
ItemDecoration
extends
RecyclerView
.
ItemDecoration
{
private
Drawable
mDividerDarwable
;
private
Drawable
mDividerDarwable
;
private
int
mDividerHight
=
1
;
private
int
mDividerHight
=
1
;
private
Paint
mColorPaint
;
private
Paint
mColorPaint
;
private
int
size
=
2
;
private
int
size
=
2
;
public
final
int
[]
ATRRS
=
new
int
[]{
android
.
R
.
attr
.
listDivider
};
public
final
int
[]
ATRRS
=
new
int
[]{
android
.
R
.
attr
.
listDivider
};
public
MyItemDecoration
(
Context
context
)
{
public
My
Menu
ItemDecoration
(
Context
context
)
{
final
TypedArray
ta
=
context
.
obtainStyledAttributes
(
ATRRS
);
final
TypedArray
ta
=
context
.
obtainStyledAttributes
(
ATRRS
);
this
.
mDividerDarwable
=
ta
.
getDrawable
(
0
);
this
.
mDividerDarwable
=
ta
.
getDrawable
(
0
);
ta
.
recycle
();
ta
.
recycle
();
...
@@ -31,7 +31,7 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
...
@@ -31,7 +31,7 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
int dividerHight 分割线的线宽
int dividerHight 分割线的线宽
int dividerColor 分割线的颜色
int dividerColor 分割线的颜色
*/
*/
public
MyItemDecoration
(
Context
context
,
int
dividerHight
,
int
dividerColor
)
{
public
My
Menu
ItemDecoration
(
Context
context
,
int
dividerHight
,
int
dividerColor
)
{
this
(
context
);
this
(
context
);
mDividerHight
=
dividerHight
;
mDividerHight
=
dividerHight
;
mColorPaint
=
new
Paint
();
mColorPaint
=
new
Paint
();
...
@@ -42,18 +42,19 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
...
@@ -42,18 +42,19 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
int dividerHight 分割线的线宽
int dividerHight 分割线的线宽
int dividerColor 分割线的颜色
int dividerColor 分割线的颜色
*/
*/
public
MyItemDecoration
(
Context
context
,
int
dividerHight
,
int
dividerColor
,
int
size
)
{
public
My
Menu
ItemDecoration
(
Context
context
,
int
dividerHight
,
int
dividerColor
,
int
size
)
{
this
(
context
);
this
(
context
);
mDividerHight
=
dividerHight
;
mDividerHight
=
dividerHight
;
mColorPaint
=
new
Paint
();
mColorPaint
=
new
Paint
();
mColorPaint
.
setColor
(
dividerColor
);
mColorPaint
.
setColor
(
dividerColor
);
this
.
size
=
size
;
this
.
size
=
size
;
}
}
/*
/*
int dividerHight 分割线的线宽
int dividerHight 分割线的线宽
Drawable dividerDrawable 图片分割线
Drawable dividerDrawable 图片分割线
*/
*/
public
MyItemDecoration
(
Context
context
,
int
dividerHight
,
Drawable
dividerDrawable
)
{
public
My
Menu
ItemDecoration
(
Context
context
,
int
dividerHight
,
Drawable
dividerDrawable
)
{
this
(
context
);
this
(
context
);
mDividerHight
=
dividerHight
;
mDividerHight
=
dividerHight
;
mDividerDarwable
=
dividerDrawable
;
mDividerDarwable
=
dividerDrawable
;
...
@@ -73,8 +74,8 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
...
@@ -73,8 +74,8 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
final
View
child
=
parent
.
getChildAt
(
i
);
final
View
child
=
parent
.
getChildAt
(
i
);
final
RecyclerView
.
LayoutParams
params
=
(
RecyclerView
.
LayoutParams
)
child
.
getLayoutParams
();
final
RecyclerView
.
LayoutParams
params
=
(
RecyclerView
.
LayoutParams
)
child
.
getLayoutParams
();
final
int
top
=
child
.
getTop
()
-
params
.
topMargin
+
30
;
final
int
top
=
child
.
getTop
()
-
params
.
topMargin
+
30
;
final
int
bottom
=
child
.
getBottom
()
+
params
.
bottomMargin
-
30
;
final
int
bottom
=
child
.
getBottom
()
+
params
.
bottomMargin
-
30
;
int
left
=
0
;
int
left
=
0
;
int
right
=
0
;
int
right
=
0
;
...
@@ -108,8 +109,8 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
...
@@ -108,8 +109,8 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
final
View
child
=
parent
.
getChildAt
(
i
);
final
View
child
=
parent
.
getChildAt
(
i
);
RecyclerView
.
LayoutParams
params
=
(
RecyclerView
.
LayoutParams
)
child
.
getLayoutParams
();
RecyclerView
.
LayoutParams
params
=
(
RecyclerView
.
LayoutParams
)
child
.
getLayoutParams
();
final
int
left
=
child
.
getLeft
()
-
params
.
leftMargin
-
mDividerHight
;
final
int
left
=
child
.
getLeft
()
-
params
.
leftMargin
-
mDividerHight
+
30
;
final
int
right
=
child
.
getRight
()
+
params
.
rightMargin
;
final
int
right
=
child
.
getRight
()
+
params
.
rightMargin
-
30
;
int
top
=
0
;
int
top
=
0
;
int
bottom
=
0
;
int
bottom
=
0
;
...
@@ -127,9 +128,11 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
...
@@ -127,9 +128,11 @@ class MyItemDecoration extends RecyclerView.ItemDecoration {
// top = child.getBottom() + params.bottomMargin;
// top = child.getBottom() + params.bottomMargin;
// bottom = top + mDividerHight;
// bottom = top + mDividerHight;
// } else {
// } else {
// if (i!=)
if
(
i
/
size
!=(
parent
.
getAdapter
().
getItemCount
()/
size
-
1
)){
top
=
child
.
getBottom
()
+
params
.
bottomMargin
;
top
=
child
.
getBottom
()
+
params
.
bottomMargin
;
bottom
=
top
+
mDividerHight
;
bottom
=
top
+
mDividerHight
;
}
// }
// }
//画分割线
//画分割线
mDividerDarwable
.
setBounds
(
left
,
top
,
right
,
bottom
);
mDividerDarwable
.
setBounds
(
left
,
top
,
right
,
bottom
);
...
...
app/src/main/res/layout/fragment_casher.xml
View file @
9a202fe6
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
android:layout_marginBottom=
"@dimen/all_padding"
android:layout_marginBottom=
"@dimen/all_padding"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:background=
"@color/
gray_zhouyu
"
android:background=
"@color/
white_caocao
"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
...
app/src/main/res/layout/item_menu_detail.xml
View file @
9a202fe6
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<layout>
<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
<
LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/
img
"
android:id=
"@+id/
ll
"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
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
<ImageView
android:id=
"@+id/text"
android:id=
"@+id/img"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"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>
</layout>
app/src/main/res/values/colors.xml
View file @
9a202fe6
...
@@ -145,6 +145,8 @@
...
@@ -145,6 +145,8 @@
<color
name=
"yellow_huangxin"
>
#ffc960
</color>
<color
name=
"yellow_huangxin"
>
#ffc960
</color>
<color
name=
"golden_yuji"
>
#f2e7d3
</color>
<color
name=
"purple_yanqing"
>
#6590e6
</color>
<color
name=
"purple_yanqing"
>
#6590e6
</color>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment