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
5f3bb6bb
Commit
5f3bb6bb
authored
Jan 29, 2018
by
zhang_z
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改好多东西;
parent
5c60f6c7
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
405 additions
and
98 deletions
+405
-98
app/src/main/java/com/xingdata/zzdpos/api/ApiFactory.java
app/src/main/java/com/xingdata/zzdpos/api/ApiFactory.java
+1
-2
app/src/main/java/com/xingdata/zzdpos/ui/manage/sssku/SsskuActivity.java
...va/com/xingdata/zzdpos/ui/manage/sssku/SsskuActivity.java
+1
-0
app/src/main/java/com/xingdata/zzdpos/ui/manage/sssku/SsskuPresenter.java
...a/com/xingdata/zzdpos/ui/manage/sssku/SsskuPresenter.java
+2
-0
app/src/main/java/com/xingdata/zzdpos/ui/marketing/ms/view/GroupCateView.java
...m/xingdata/zzdpos/ui/marketing/ms/view/GroupCateView.java
+1
-1
app/src/main/java/com/xingdata/zzdpos/ui/marketing/ms/view/GroupSkuView.java
...om/xingdata/zzdpos/ui/marketing/ms/view/GroupSkuView.java
+1
-0
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettleActivity.java
...in/java/com/xingdata/zzdpos/ui/settle/SettleActivity.java
+6
-19
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettlePresenter.java
...n/java/com/xingdata/zzdpos/ui/settle/SettlePresenter.java
+3
-3
app/src/main/java/com/xingdata/zzdpos/ui/settle/fragment/VipFragment.java
...a/com/xingdata/zzdpos/ui/settle/fragment/VipFragment.java
+2
-2
app/src/main/java/com/xingdata/zzdpos/ui/store/StoreActivity.java
...main/java/com/xingdata/zzdpos/ui/store/StoreActivity.java
+10
-16
app/src/main/java/com/xingdata/zzdpos/ui/store/StoreContract.java
...main/java/com/xingdata/zzdpos/ui/store/StoreContract.java
+8
-0
app/src/main/java/com/xingdata/zzdpos/ui/store/StorePresenter.java
...ain/java/com/xingdata/zzdpos/ui/store/StorePresenter.java
+1
-0
app/src/main/java/com/xingdata/zzdpos/ui/store/fragment/StoreFragment.java
.../com/xingdata/zzdpos/ui/store/fragment/StoreFragment.java
+0
-1
app/src/main/java/com/xingdata/zzdpos/util/SystemUtil.java
app/src/main/java/com/xingdata/zzdpos/util/SystemUtil.java
+4
-4
app/src/main/java/com/xingdata/zzdpos/view/SearchBar.java
app/src/main/java/com/xingdata/zzdpos/view/SearchBar.java
+121
-0
app/src/main/res/layout/activity_settle.xml
app/src/main/res/layout/activity_settle.xml
+10
-15
app/src/main/res/layout/activity_store.xml
app/src/main/res/layout/activity_store.xml
+22
-27
app/src/main/res/layout/fragment_settle.xml
app/src/main/res/layout/fragment_settle.xml
+1
-1
app/src/main/res/layout/item_sssku_sku.xml
app/src/main/res/layout/item_sssku_sku.xml
+5
-2
app/src/main/res/layout/view_empty.xml
app/src/main/res/layout/view_empty.xml
+1
-3
app/src/main/res/layout/view_group_cate.xml
app/src/main/res/layout/view_group_cate.xml
+0
-1
app/src/main/res/layout/view_search_bar.xml
app/src/main/res/layout/view_search_bar.xml
+61
-0
app/src/main/res/mipmap-xhdpi/ic_clear.png
app/src/main/res/mipmap-xhdpi/ic_clear.png
+0
-0
app/src/main/res/mipmap-xxhdpi/ic_clear.png
app/src/main/res/mipmap-xxhdpi/ic_clear.png
+0
-0
app/src/main/res/mipmap-xxxhdpi/ic_clear.png
app/src/main/res/mipmap-xxxhdpi/ic_clear.png
+0
-0
app/src/main/res/values/attrs.xml
app/src/main/res/values/attrs.xml
+138
-1
app/src/main/res/values/strings.xml
app/src/main/res/values/strings.xml
+6
-0
No files found.
app/src/main/java/com/xingdata/zzdpos/api/ApiFactory.java
View file @
5f3bb6bb
...
...
@@ -11,7 +11,6 @@ import com.xingdata.zzdpos.model.Category;
import
com.xingdata.zzdpos.model.Gbound
;
import
com.xingdata.zzdpos.model.Mscard
;
import
com.xingdata.zzdpos.model.Pager
;
import
com.xingdata.zzdpos.model.Smt
;
import
com.xingdata.zzdpos.model.Trule
;
import
com.xingdata.zzdpos.model.Ubound
;
import
com.xingdata.zzdpos.model.UsskuParam
;
...
...
@@ -1083,7 +1082,7 @@ public final class ApiFactory {
public
static
class
Recard
{
public
static
Observable
<
Boolean
>
checkPwd
(
Long
vipId
,
String
cardNo
,
String
pwd
)
{
return
Api
.
getInstance
().
service
.
checkPwd
(
vipId
,
cardNo
,
pwd
)
return
Api
.
getInstance
().
service
.
checkPwd
(
vipId
,
cardNo
,
EncryptUtils
.
encryptMD5ToString
(
pwd
)
)
.
onErrorReturn
(
new
ErrorFilter
<>())
.
map
(
new
ResultFilter
<>())
.
subscribeOn
(
Schedulers
.
io
())
...
...
app/src/main/java/com/xingdata/zzdpos/ui/manage/sssku/SsskuActivity.java
View file @
5f3bb6bb
...
...
@@ -162,6 +162,7 @@ public class SsskuActivity extends BaseActivity<SsskuPresenter, ActivitySsskuBin
mScanFragment
.
setOnBackPressedListener
(
this
::
backToAddFragment
);
break
;
}
KeyboardUtils
.
hideSoftInput
(
mViewBinding
.
etSearch
);
this
.
start
(
mScanFragment
);
}
...
...
app/src/main/java/com/xingdata/zzdpos/ui/manage/sssku/SsskuPresenter.java
View file @
5f3bb6bb
...
...
@@ -95,10 +95,12 @@ public class SsskuPresenter extends SsskuContract.Presenter {
if
(
ssskuPager
.
getList
().
size
()
>
1
)
{
mView
.
loadCheckSkus
(
ssskuPager
.
getList
());
}
else
if
(
ssskuPager
.
getList
().
size
()
==
1
)
{
mView
.
backToManagerFragment
();
mView
.
showEditorFragment
(
ssskuPager
.
getList
().
get
(
0
),
C
.
SKU_EDITOR_MODE
.
ADD
);
}
else
{
Sssku
sssku
=
new
Sssku
();
sssku
.
setSpuBarcode
(
ConvertUtil
.
stringToLong
(
barcode
));
mView
.
backToManagerFragment
();
mView
.
showEditorFragment
(
sssku
,
C
.
SKU_EDITOR_MODE
.
UNKNOWN
);
}
})
...
...
app/src/main/java/com/xingdata/zzdpos/ui/marketing/ms/view/GroupCateView.java
View file @
5f3bb6bb
...
...
@@ -83,8 +83,8 @@ public class GroupCateView extends BaseGroupView<ViewGroupCateBinding> {
if
(
mMs
!=
null
&&
mMs
.
getSpuCateId
()
!=
null
)
{
cateId
=
mMs
.
getSpuCateId
();
}
mViewBinding
.
nsType3
.
setVisibility
(
View
.
GONE
);
loadCla
();
mViewBinding
.
nsType1
.
setOnItemSelectedListener
(
mOnItemSelectedListener
);
mViewBinding
.
nsType2
.
setOnItemSelectedListener
(
mOnItemSelectedListener
);
mViewBinding
.
nsType3
.
setOnItemSelectedListener
(
mOnItemSelectedListener
);
...
...
app/src/main/java/com/xingdata/zzdpos/ui/marketing/ms/view/GroupSkuView.java
View file @
5f3bb6bb
...
...
@@ -55,6 +55,7 @@ public class GroupSkuView<Sku extends BaseSku> extends BaseGroupView<ViewGroupSk
if
(
sku
!=
null
)
{
mViewBinding
.
setName
(
sku
.
getSpuName
());
mViewBinding
.
setPrice
(
ConvertUtil
.
fenToYuan
(
sku
.
getSkuRetailPrice1
(),
true
));
mViewBinding
.
tvProductPic
.
setImageURI
(
sku
.
getSpuImg
());
mViewBinding
.
llProduct
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
mViewBinding
.
llProduct
.
setVisibility
(
View
.
GONE
);
...
...
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettleActivity.java
View file @
5f3bb6bb
package
com
.
xingdata
.
zzdpos
.
ui
.
settle
;
import
android.view.MotionEvent
;
import
android.view.inputmethod.EditorInfo
;
import
com.blankj.utilcode.util.ActivityUtils
;
import
com.blankj.utilcode.util.KeyboardUtils
;
import
com.blankj.utilcode.util.ToastUtils
;
import
com.xingdata.zzdpos.C
;
import
com.xingdata.zzdpos.R
;
...
...
@@ -57,16 +55,9 @@ public class SettleActivity extends BaseActivity<SettlePresenter, ActivitySettle
this
.
loadRootFragment
(
R
.
id
.
f_settle
,
mSettleFragment
);
mViewBinding
.
setTitleMode
(
C
.
TITLE_MODE
.
TEXT
);
mViewBinding
.
btnBack
.
setOnClickListener
(
view
->
getTopFragment
().
onBackPressedSupport
());
mViewBinding
.
etSearch
.
setOnEditorActionListener
((
textView
,
i
,
keyEvent
)
->
{
if
(
i
==
EditorInfo
.
IME_ACTION_SEARCH
)
{
KeyboardUtils
.
hideSoftInput
(
textView
);
switch
(
mViewBinding
.
getTitleMode
())
{
case
C
.
TITLE_MODE
.
VIP
:
mPresenter
.
searchVip
(
textView
.
getText
().
toString
());
break
;
}
}
return
false
;
mViewBinding
.
vSearch
.
setOnSearchListener
(
keyword
->
{
mPresenter
.
searchVip
(
keyword
);
});
}
...
...
@@ -87,6 +78,8 @@ public class SettleActivity extends BaseActivity<SettlePresenter, ActivitySettle
@Override
public
void
showVipFragment
()
{
this
.
showTitleBarByTitleMode
(
C
.
TITLE_MODE
.
VIP
);
mViewBinding
.
vSearch
.
clear
();
mViewBinding
.
vSearch
.
showSoftInput
();
this
.
start
(
mVipFragment
);
}
...
...
@@ -205,9 +198,9 @@ public class SettleActivity extends BaseActivity<SettlePresenter, ActivitySettle
@Override
public
void
backToSettleFragment
()
{
this
.
popTo
(
mSettleFragment
.
getClass
(),
false
);
this
.
showTitleBarByTitleMode
(
C
.
TITLE_MODE
.
TEXT
);
mViewBinding
.
tvTitle
.
setText
(
R
.
string
.
settle_title
);
this
.
pop
();
}
@Override
...
...
@@ -229,12 +222,6 @@ public class SettleActivity extends BaseActivity<SettlePresenter, ActivitySettle
public
void
showTitleBarByTitleMode
(
int
titleMode
)
{
if
(
mViewBinding
.
getTitleMode
()
==
titleMode
)
return
;
mViewBinding
.
setTitleMode
(
titleMode
);
switch
(
titleMode
)
{
case
C
.
TITLE_MODE
.
VIP
:
mViewBinding
.
etSearch
.
setHint
(
R
.
string
.
settle_vip_search_hint
);
mViewBinding
.
etSearch
.
setText
(
""
);
break
;
}
}
@Override
...
...
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettlePresenter.java
View file @
5f3bb6bb
...
...
@@ -276,13 +276,13 @@ public class SettlePresenter extends SettleContract.Presenter {
@Override
public
void
payInCard
(
Long
cardNo
,
String
password
)
{
ApiFactory
.
Recard
.
checkPwd
(
mVip
.
getVipId
(),
String
.
valueOf
(
cardNo
)
,
password
).
subscribe
(
ApiFactory
.
Recard
.
checkPwd
(
mVip
.
getVipId
(),
null
,
password
).
subscribe
(
b
->
{
mView
.
dismissPasswordDialog
();
mView
.
showLoadingDialog
();
subscribePay
(
commitOrder
().
flatMap
(
orderNo
->
ApiFactory
.
Saleorder
.
addOrderPayMis
(
mSaleorder
.
pay
(
orderNo
,
C
.
PAY_CHANNEL
.
CARD
,
String
.
valueOf
(
cardNo
))).
doFinally
(()
->
mView
.
dismissLoadingDialog
())));
},
throwable
->
mView
.
showMsg
(
"密码错误"
)
throwable
->
mView
.
showMsg
(
throwable
.
getMessage
()
)
);
}
...
...
@@ -294,7 +294,7 @@ public class SettlePresenter extends SettleContract.Presenter {
mView
.
showLoadingDialog
();
subscribePay
(
commitOrder
().
flatMap
(
orderNo
->
ApiFactory
.
Saleorder
.
addOrderPayMis
(
mSaleorder
.
pay
(
orderNo
,
C
.
PAY_CHANNEL
.
TALLY
)).
doFinally
(()
->
mView
.
dismissLoadingDialog
())));
},
throwable
->
mView
.
showMsg
(
"密码错误"
)
throwable
->
mView
.
showMsg
(
throwable
.
getMessage
()
)
);
}
...
...
app/src/main/java/com/xingdata/zzdpos/ui/settle/fragment/VipFragment.java
View file @
5f3bb6bb
...
...
@@ -39,7 +39,7 @@ public class VipFragment extends BaseFragment<SettlePresenter, FragmentSettleVip
mVipAdapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
mPresenter
.
selectVip
(
mVipAdapter
.
getData
().
get
(
position
));
this
.
pop
();
((
SettleActivity
)
getActivity
()).
backToSettleFragment
();
});
}
...
...
@@ -52,7 +52,7 @@ public class VipFragment extends BaseFragment<SettlePresenter, FragmentSettleVip
((
TextView
)
mVipAdapter
.
getEmptyView
().
findViewById
(
R
.
id
.
tv_empty
)).
setText
(
R
.
string
.
settle_vip_search_none
);
if
(
vips
.
size
()
==
1
)
{
mPresenter
.
selectVip
(
vips
.
get
(
0
));
this
.
pop
();
((
SettleActivity
)
getActivity
()).
backToSettleFragment
();
}
else
{
mViewBinding
.
setEmpty
(
vips
.
size
()
==
0
);
mVipAdapter
.
setNewData
(
vips
);
...
...
app/src/main/java/com/xingdata/zzdpos/ui/store/StoreActivity.java
View file @
5f3bb6bb
...
...
@@ -7,13 +7,11 @@ import android.content.Intent;
import
android.os.Bundle
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.inputmethod.EditorInfo
;
import
com.blankj.utilcode.constant.PermissionConstants
;
import
com.blankj.utilcode.util.ActivityUtils
;
import
com.blankj.utilcode.util.KeyboardUtils
;
import
com.blankj.utilcode.util.PermissionUtils
;
import
com.blankj.utilcode.util.
String
Utils
;
import
com.blankj.utilcode.util.
Toast
Utils
;
import
com.xingdata.zzdpos.C
;
import
com.xingdata.zzdpos.R
;
import
com.xingdata.zzdpos.base.BaseActivity
;
...
...
@@ -59,13 +57,7 @@ public class StoreActivity extends BaseActivity<StorePresenter, ActivityStoreBin
mViewBinding
.
tvSettle
.
setOnClickListener
(
view
->
mPresenter
.
clickSettle
());
mViewBinding
.
btnBack
.
setOnClickListener
(
view
->
onBackPressedSupport
());
mViewBinding
.
etSearch
.
setOnEditorActionListener
((
textView
,
i
,
keyEvent
)
->
{
if
(
i
==
EditorInfo
.
IME_ACTION_SEARCH
&&
!
StringUtils
.
isEmpty
(
textView
.
getText
()))
{
KeyboardUtils
.
hideSoftInput
(
textView
);
mPresenter
.
searchSku
(
textView
.
getText
().
toString
());
}
return
false
;
});
mViewBinding
.
vSearch
.
setOnSearchListener
(
keyword
->
mPresenter
.
searchSku
(
keyword
));
mViewBinding
.
btnScan
.
setOnClickListener
(
view
->
PermissionUtils
.
permission
(
PermissionConstants
.
CAMERA
)
...
...
@@ -84,6 +76,11 @@ public class StoreActivity extends BaseActivity<StorePresenter, ActivityStoreBin
mScanFragment
.
setOnScanCompletedListener
(
barcode
->
mPresenter
.
scanComplete
(
barcode
));
}
@Override
public
void
showMsg
(
String
msg
)
{
ToastUtils
.
showShort
(
msg
);
}
@Override
public
<
Sku
extends
BaseSku
>
void
loadSkus
(
List
<
Sku
>
skus
,
boolean
isRefresh
)
{
mStoreFragment
.
loadSkus
(
skus
,
isRefresh
);
...
...
@@ -161,10 +158,8 @@ public class StoreActivity extends BaseActivity<StorePresenter, ActivityStoreBin
public
void
showSearchFragment
()
{
if
(!
mSearchFragment
.
isAdded
())
{
mViewBinding
.
setTitleMode
(
C
.
TITLE_MODE
.
SKU
);
mViewBinding
.
etSearch
.
setVisibility
(
View
.
VISIBLE
);
mViewBinding
.
etSearch
.
setText
(
""
);
mViewBinding
.
etSearch
.
requestFocus
();
KeyboardUtils
.
showSoftInput
(
mViewBinding
.
etSearch
);
mViewBinding
.
vSearch
.
clear
();
mViewBinding
.
vSearch
.
showSoftInput
();
this
.
start
(
mSearchFragment
.
setKeyword
(
""
));
}
}
...
...
@@ -173,8 +168,7 @@ public class StoreActivity extends BaseActivity<StorePresenter, ActivityStoreBin
public
void
showSearchFragment
(
String
keyword
)
{
if
(!
mSearchFragment
.
isAdded
())
{
mViewBinding
.
setTitleMode
(
C
.
TITLE_MODE
.
SKU
);
mViewBinding
.
etSearch
.
setText
(
keyword
);
mViewBinding
.
etSearch
.
requestFocus
();
mViewBinding
.
vSearch
.
setText
(
keyword
);
this
.
start
(
mSearchFragment
.
setKeyword
(
keyword
));
}
}
...
...
app/src/main/java/com/xingdata/zzdpos/ui/store/StoreContract.java
View file @
5f3bb6bb
...
...
@@ -13,6 +13,14 @@ import java.util.List;
interface
StoreContract
{
interface
View
extends
BaseView
{
/**
* 显示提示
*
* @param msg 提示内容
*/
void
showMsg
(
String
msg
);
/**
* 加载商品
*
...
...
app/src/main/java/com/xingdata/zzdpos/ui/store/StorePresenter.java
View file @
5f3bb6bb
...
...
@@ -360,6 +360,7 @@ public class StorePresenter extends StoreContract.Presenter {
}
else
if
(
ssskus
.
size
()
==
0
&&
usskus
.
size
()
==
1
)
{
this
.
clickAddSku
(
usskus
.
get
(
0
),
1
);
}
else
{
mView
.
showMsg
(
"没有找到此商品~"
);
mView
.
resetScanner
();
}
mView
.
dismissLoadingDialog
();
...
...
app/src/main/java/com/xingdata/zzdpos/ui/store/fragment/StoreFragment.java
View file @
5f3bb6bb
...
...
@@ -63,7 +63,6 @@ public class StoreFragment extends BaseFragment<StorePresenter, FragmentStoreBin
mSkuAdapter
.
setOnCountChangeListener
((
view
,
sku
,
value
)
->
{
if
(
value
>
0
)
this
.
clickAdd
(
view
,
sku
,
value
);
else
mPresenter
.
clickRemoveSku
(
sku
,
value
);
});
// set grp listener
...
...
app/src/main/java/com/xingdata/zzdpos/util/SystemUtil.java
View file @
5f3bb6bb
...
...
@@ -28,8 +28,8 @@ public final class SystemUtil {
* @return 设备型号
*/
public
static
String
getDeviceModel
()
{
return
DeviceUtils
.
getModel
();
// return "AECRC10
";
//
return DeviceUtils.getModel();
return
"MI5
"
;
}
...
...
@@ -57,8 +57,8 @@ public final class SystemUtil {
e
.
printStackTrace
();
}
}
return
deviceSN
;
//
return "5484965656";
//
return deviceSN;
return
"5484965656"
;
}
/**
...
...
app/src/main/java/com/xingdata/zzdpos/view/SearchBar.java
0 → 100644
View file @
5f3bb6bb
package
com
.
xingdata
.
zzdpos
.
view
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.content.res.TypedArray
;
import
android.databinding.DataBindingUtil
;
import
android.support.constraint.ConstraintLayout
;
import
android.text.Editable
;
import
android.text.TextWatcher
;
import
android.util.AttributeSet
;
import
android.view.LayoutInflater
;
import
android.view.inputmethod.EditorInfo
;
import
com.blankj.utilcode.util.KeyboardUtils
;
import
com.blankj.utilcode.util.StringUtils
;
import
com.blankj.utilcode.util.ToastUtils
;
import
com.xingdata.zzdpos.R
;
import
com.xingdata.zzdpos.databinding.ViewSearchBarBinding
;
@SuppressLint
(
"AppCompatCustomView"
)
public
class
SearchBar
extends
ConstraintLayout
{
private
ViewSearchBarBinding
mViewBinding
;
public
interface
OnSearchListener
{
void
onSearch
(
String
keyword
);
}
private
OnSearchListener
mOnSearchListener
;
public
void
setOnSearchListener
(
OnSearchListener
onSearchListener
)
{
this
.
mOnSearchListener
=
onSearchListener
;
}
/**
* 设置搜索框内的字符串
*
* @param str 字符串
*/
public
void
setText
(
String
str
)
{
mViewBinding
.
etSearch
.
setText
(
str
);
}
/**
* 设置搜索框里的提示信息
*
* @param hint 提示信息
*/
public
void
setHint
(
String
hint
)
{
mViewBinding
.
etSearch
.
setHint
(
hint
);
}
/**
* 清空搜索框
*/
public
void
clear
()
{
setText
(
""
);
}
/**
* 显示软键盘
*/
public
void
showSoftInput
()
{
KeyboardUtils
.
showSoftInput
(
mViewBinding
.
etSearch
);
}
public
SearchBar
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
mViewBinding
=
DataBindingUtil
.
inflate
(
LayoutInflater
.
from
(
context
),
R
.
layout
.
view_search_bar
,
this
,
true
);
mViewBinding
.
etSearch
.
setOnEditorActionListener
((
textView
,
i
,
keyEvent
)
->
{
if
(
i
==
EditorInfo
.
IME_ACTION_SEARCH
&&
!
StringUtils
.
isEmpty
(
textView
.
getText
()))
{
String
str
=
mViewBinding
.
etSearch
.
getText
().
toString
();
if
(
StringUtils
.
isEmpty
(
str
))
{
ToastUtils
.
showShort
(
"请输入搜索内容"
);
return
false
;
}
KeyboardUtils
.
hideSoftInput
(
mViewBinding
.
etSearch
);
mOnSearchListener
.
onSearch
(
str
);
}
return
false
;
});
mViewBinding
.
tvSearch
.
setOnClickListener
(
view
->
{
String
str
=
mViewBinding
.
etSearch
.
getText
().
toString
();
if
(
StringUtils
.
isEmpty
(
str
))
{
ToastUtils
.
showShort
(
"请输入搜索内容"
);
return
;
}
KeyboardUtils
.
hideSoftInput
(
mViewBinding
.
etSearch
);
mOnSearchListener
.
onSearch
(
str
);
});
mViewBinding
.
btnClear
.
setOnClickListener
(
view
->
{
mViewBinding
.
etSearch
.
setText
(
""
);
KeyboardUtils
.
showSoftInput
(
mViewBinding
.
etSearch
);
});
mViewBinding
.
etSearch
.
addTextChangedListener
(
new
TextWatcher
()
{
@Override
public
void
beforeTextChanged
(
CharSequence
charSequence
,
int
i
,
int
i1
,
int
i2
)
{
}
@Override
public
void
onTextChanged
(
CharSequence
charSequence
,
int
i
,
int
i1
,
int
i2
)
{
}
@Override
public
void
afterTextChanged
(
Editable
editable
)
{
mViewBinding
.
setKeywordLength
(
editable
.
length
());
}
});
//拿到布局文件中的每一个自定义属性的值
TypedArray
typedArray
=
context
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
SearchBar
);
if
(
typedArray
!=
null
)
{
mViewBinding
.
etSearch
.
setHint
(
typedArray
.
getString
(
R
.
styleable
.
SearchBar_hint
));
mViewBinding
.
etSearch
.
setInputType
(
typedArray
.
getInt
(
R
.
styleable
.
SearchBar_inputType
,
0x00000001
));
typedArray
.
recycle
();
}
}
}
app/src/main/res/layout/activity_settle.xml
View file @
5f3bb6bb
...
...
@@ -5,6 +5,8 @@
<data>
<import
type=
"android.view.View"
/>
<variable
name=
"titleMode"
type=
"int"
/>
...
...
@@ -31,24 +33,17 @@
android:src=
"@mipmap/back_black"
app:layout_constraintLeft_toLeftOf=
"parent"
/>
<LinearLayout
<com.xingdata.zzdpos.view.SearchBar
android:id=
"@+id/v_search"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_marginEnd=
"@dimen/all_margin"
android:visibility=
"@{titleMode>1?0:8}"
app:layout_constraintBottom_toTopOf=
"parent"
android:layout_height=
"0dp"
android:visibility=
"@{titleMode>1?View.VISIBLE:View.INVISIBLE}"
app:hint=
"@string/settle_vip_search_hint"
app:inputType=
"number"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toRightOf=
"@id/btn_back"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"parent"
>
<EditText
android:id=
"@+id/et_search"
style=
"@style/searchBarEditor"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:inputType=
"number"
android:labelFor=
"@+id/et_search"
/>
</LinearLayout>
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_title"
...
...
app/src/main/res/layout/activity_store.xml
View file @
5f3bb6bb
...
...
@@ -54,36 +54,16 @@
android:src=
"@mipmap/back_black"
app:layout_constraintLeft_toLeftOf=
"parent"
/>
<LinearLayout
<com.xingdata.zzdpos.view.SearchBar
android:id=
"@+id/v_search"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_marginEnd=
"@dimen/all_margin"
app:layout_constraintBottom_toTopOf=
"parent"
android:layout_height=
"0dp"
android:visibility=
"@{titleMode>1?View.VISIBLE:View.INVISIBLE}"
app:hint=
"@string/store_search_hint"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toRightOf=
"@id/btn_back"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"parent"
>
<EditText
android:id=
"@+id/et_search"
style=
"@style/searchBarEditor"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:hint=
"@string/store_search_hint"
android:inputType=
"text"
android:labelFor=
"@+id/et_search"
android:visibility=
"@{titleMode>1?View.VISIBLE:View.INVISIBLE}"
/>
<ImageButton
android:id=
"@+id/btn_scan"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/all_spacing"
android:background=
"@color/transparent"
android:contentDescription=
"@string/store_scan"
android:foreground=
"?android:attr/actionBarItemBackground"
android:src=
"@mipmap/but_sweep_yard"
android:visibility=
"@{titleMode>1?View.GONE:View.VISIBLE}"
/>
</LinearLayout>
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_title"
...
...
@@ -97,6 +77,21 @@
app:layout_constraintLeft_toRightOf=
"parent"
app:layout_constraintRight_toLeftOf=
"parent"
/>
<ImageButton
android:id=
"@+id/btn_scan"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/all_margin"
android:layout_marginStart=
"@dimen/all_spacing"
android:background=
"@color/transparent"
android:contentDescription=
"@string/store_scan"
android:foreground=
"?android:attr/actionBarItemBackground"
android:src=
"@mipmap/but_sweep_yard"
android:visibility=
"@{titleMode>1?View.GONE:View.VISIBLE}"
app:layout_constraintBottom_toTopOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"parent"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/all_line_width"
...
...
app/src/main/res/layout/fragment_settle.xml
View file @
5f3bb6bb
...
...
@@ -150,7 +150,7 @@
android:text=
"@{@string/settle_vip_dis_rate_hint + disRate + @string/settle_vip_dis_rate}"
android:textColor=
"@color/black_baozheng"
android:textSize=
"@dimen/all_caption_size"
android:visibility=
"@{defualtVip?View.INVISIBLE:View.VISIBLE}"
android:visibility=
"@{defualtVip
||disRate==null
?View.INVISIBLE:View.VISIBLE}"
app:layout_constraintBottom_toTopOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@id/iv_arrow"
app:layout_constraintTop_toBottomOf=
"parent"
/>
...
...
app/src/main/res/layout/item_sssku_sku.xml
View file @
5f3bb6bb
...
...
@@ -47,11 +47,14 @@
<TextView
android:id=
"@+id/tv_size"
android:layout_width=
"wrap_content"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
@dimen/all_margin_big
"
android:layout_marginTop=
"@dimen/all_margin"
android:background=
"@drawable/shape_black_b2"
android:padding=
"@dimen/all_spacing"
android:gravity=
"center"
android:paddingEnd=
"@dimen/all_spacing"
android:paddingStart=
"@dimen/all_spacing"
android:text=
"@{@string/sku_size+spuUnitName}"
android:textColor=
"@color/black_baozheng"
android:textSize=
"@dimen/all_caption_size"
app:layout_constraintBottom_toBottomOf=
"@id/ll_price"
app:layout_constraintLeft_toLeftOf=
"@id/tv_name"
/>
...
...
app/src/main/res/layout/view_empty.xml
View file @
5f3bb6bb
...
...
@@ -4,9 +4,7 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:orientation=
"vertical"
>
android:gravity=
"center"
>
<TextView
android:id=
"@+id/tv_empty"
...
...
app/src/main/res/layout/view_group_cate.xml
View file @
5f3bb6bb
...
...
@@ -49,7 +49,6 @@
android:id=
"@+id/ns_type_3"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"@id/ns_type_1"
app:layout_constraintRight_toRightOf=
"parent"
...
...
app/src/main/res/layout/view_search_bar.xml
0 → 100644
View file @
5f3bb6bb
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
>
<data>
<import
type=
"android.view.View"
/>
<variable
name=
"keywordLength"
type=
"int"
/>
</data>
<android.support.constraint.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<EditText
android:id=
"@+id/et_search"
style=
"@style/searchBarEditor"
android:layout_width=
"0dp"
android:labelFor=
"@+id/et_search"
android:paddingEnd=
"@dimen/all_margin_big"
android:paddingStart=
"@dimen/all_spacing"
app:layout_constraintBottom_toTopOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@id/tv_search"
app:layout_constraintTop_toBottomOf=
"parent"
/>
<ImageButton
android:id=
"@+id/btn_clear"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"?attr/actionBarItemBackground"
android:contentDescription=
"@string/search_clear"
android:padding=
"@dimen/all_spacing"
android:src=
"@mipmap/ic_clear"
android:visibility=
"@{keywordLength>0?View.VISIBLE:View.GONE}"
app:layout_constraintBottom_toTopOf=
"parent"
app:layout_constraintRight_toRightOf=
"@id/et_search"
app:layout_constraintTop_toBottomOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_search"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:background=
"?attr/actionBarItemBackground"
android:gravity=
"center"
android:paddingEnd=
"@dimen/all_margin"
android:paddingStart=
"@dimen/all_margin"
android:text=
"@string/search_action"
android:textColor=
"@color/black_baozheng"
android:textSize=
"@dimen/all_body_size"
app:layout_constraintLeft_toRightOf=
"@id/et_search"
app:layout_constraintRight_toRightOf=
"parent"
/>
</android.support.constraint.ConstraintLayout>
</layout>
\ No newline at end of file
app/src/main/res/mipmap-xhdpi/ic_clear.png
0 → 100644
View file @
5f3bb6bb
1.68 KB
app/src/main/res/mipmap-xxhdpi/ic_clear.png
0 → 100644
View file @
5f3bb6bb
2.17 KB
app/src/main/res/mipmap-xxxhdpi/ic_clear.png
0 → 100644
View file @
5f3bb6bb
2.6 KB
app/src/main/res/values/attrs.xml
View file @
5f3bb6bb
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable
name=
"NineGridImageView"
>
<attr
format=
"dimension"
name=
"imgGap"
/>
<attr
name=
"imgGap"
format=
"dimension"
/>
</declare-styleable>
<declare-styleable
name=
"SearchBar"
>
<attr
name=
"inputType"
>
<!-- There is no content type. The text is not editable. -->
<flag
name=
"none"
value=
"0x00000000"
/>
<!-- Just plain old text. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_NORMAL}. -->
<flag
name=
"text"
value=
"0x00000001"
/>
<!-- Can be combined with <var>text</var> and its variations to
request capitalization of all characters. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_CAP_CHARACTERS}. -->
<flag
name=
"textCapCharacters"
value=
"0x00001001"
/>
<!-- Can be combined with <var>text</var> and its variations to
request capitalization of the first character of every word. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_CAP_WORDS}. -->
<flag
name=
"textCapWords"
value=
"0x00002001"
/>
<!-- Can be combined with <var>text</var> and its variations to
request capitalization of the first character of every sentence. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_CAP_SENTENCES}. -->
<flag
name=
"textCapSentences"
value=
"0x00004001"
/>
<!-- Can be combined with <var>text</var> and its variations to
request auto-correction of text being input. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_AUTO_CORRECT}. -->
<flag
name=
"textAutoCorrect"
value=
"0x00008001"
/>
<!-- Can be combined with <var>text</var> and its variations to
specify that this field will be doing its own auto-completion and
talking with the input method appropriately. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_AUTO_COMPLETE}. -->
<flag
name=
"textAutoComplete"
value=
"0x00010001"
/>
<!-- Can be combined with <var>text</var> and its variations to
allow multiple lines of text in the field. If this flag is not set,
the text field will be constrained to a single line. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_MULTI_LINE}. -->
<flag
name=
"textMultiLine"
value=
"0x00020001"
/>
<!-- Can be combined with <var>text</var> and its variations to
indicate that though the regular text view should not be multiple
lines, the IME should provide multiple lines if it can. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_IME_MULTI_LINE}. -->
<flag
name=
"textImeMultiLine"
value=
"0x00040001"
/>
<!-- Can be combined with <var>text</var> and its variations to
indicate that the IME should not show any
dictionary-based word suggestions. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_NO_SUGGESTIONS}. -->
<flag
name=
"textNoSuggestions"
value=
"0x00080001"
/>
<!-- Text that will be used as a URI. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_URI}. -->
<flag
name=
"textUri"
value=
"0x00000011"
/>
<!-- Text that will be used as an e-mail address. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_EMAIL_ADDRESS}. -->
<flag
name=
"textEmailAddress"
value=
"0x00000021"
/>
<!-- Text that is being supplied as the subject of an e-mail. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_EMAIL_SUBJECT}. -->
<flag
name=
"textEmailSubject"
value=
"0x00000031"
/>
<!-- Text that is the content of a short message. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_SHORT_MESSAGE}. -->
<flag
name=
"textShortMessage"
value=
"0x00000041"
/>
<!-- Text that is the content of a long message. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_LONG_MESSAGE}. -->
<flag
name=
"textLongMessage"
value=
"0x00000051"
/>
<!-- Text that is the name of a person. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_PERSON_NAME}. -->
<flag
name=
"textPersonName"
value=
"0x00000061"
/>
<!-- Text that is being supplied as a postal mailing address. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_POSTAL_ADDRESS}. -->
<flag
name=
"textPostalAddress"
value=
"0x00000071"
/>
<!-- Text that is a password. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_PASSWORD}. -->
<flag
name=
"textPassword"
value=
"0x00000081"
/>
<!-- Text that is a password that should be visible. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_VISIBLE_PASSWORD}. -->
<flag
name=
"textVisiblePassword"
value=
"0x00000091"
/>
<!-- Text that is being supplied as text in a web form. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_WEB_EDIT_TEXT}. -->
<flag
name=
"textWebEditText"
value=
"0x000000a1"
/>
<!-- Text that is filtering some other data. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_FILTER}. -->
<flag
name=
"textFilter"
value=
"0x000000b1"
/>
<!-- Text that is for phonetic pronunciation, such as a phonetic name
field in a contact entry. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_PHONETIC}. -->
<flag
name=
"textPhonetic"
value=
"0x000000c1"
/>
<!-- Text that will be used as an e-mail address on a web form. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS}. -->
<flag
name=
"textWebEmailAddress"
value=
"0x000000d1"
/>
<!-- Text that will be used as a password on a web form. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_WEB_PASSWORD}. -->
<flag
name=
"textWebPassword"
value=
"0x000000e1"
/>
<!-- A numeric only field. Corresponds to
{@link android.text.InputType#TYPE_CLASS_NUMBER} |
{@link android.text.InputType#TYPE_NUMBER_VARIATION_NORMAL}. -->
<flag
name=
"number"
value=
"0x00000002"
/>
<!-- Can be combined with <var>number</var> and its other options to
allow a signed number. Corresponds to
{@link android.text.InputType#TYPE_CLASS_NUMBER} |
{@link android.text.InputType#TYPE_NUMBER_FLAG_SIGNED}. -->
<flag
name=
"numberSigned"
value=
"0x00001002"
/>
<!-- Can be combined with <var>number</var> and its other options to
allow a decimal (fractional) number. Corresponds to
{@link android.text.InputType#TYPE_CLASS_NUMBER} |
{@link android.text.InputType#TYPE_NUMBER_FLAG_DECIMAL}. -->
<flag
name=
"numberDecimal"
value=
"0x00002002"
/>
<!-- A numeric password field. Corresponds to
{@link android.text.InputType#TYPE_CLASS_NUMBER} |
{@link android.text.InputType#TYPE_NUMBER_VARIATION_PASSWORD}. -->
<flag
name=
"numberPassword"
value=
"0x00000012"
/>
<!-- For entering a phone number. Corresponds to
{@link android.text.InputType#TYPE_CLASS_PHONE}. -->
<flag
name=
"phone"
value=
"0x00000003"
/>
<!-- For entering a date and time. Corresponds to
{@link android.text.InputType#TYPE_CLASS_DATETIME} |
{@link android.text.InputType#TYPE_DATETIME_VARIATION_NORMAL}. -->
<flag
name=
"datetime"
value=
"0x00000004"
/>
<!-- For entering a date. Corresponds to
{@link android.text.InputType#TYPE_CLASS_DATETIME} |
{@link android.text.InputType#TYPE_DATETIME_VARIATION_DATE}. -->
<flag
name=
"date"
value=
"0x00000014"
/>
<!-- For entering a time. Corresponds to
{@link android.text.InputType#TYPE_CLASS_DATETIME} |
{@link android.text.InputType#TYPE_DATETIME_VARIATION_TIME}. -->
<flag
name=
"time"
value=
"0x00000024"
/>
</attr>
<attr
name=
"hint"
format=
"reference|string"
/>
</declare-styleable>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
5f3bb6bb
...
...
@@ -736,4 +736,10 @@
<string
name=
"sku_empty_hint"
>
没有找到对应商品~
</string>
<string
name=
"search_action"
>
搜索
</string>
<string
name=
"search_clear"
>
清空
</string>
</resources>
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