Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
X
xxsq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
xxsq
Commits
9be26765
Commit
9be26765
authored
May 31, 2022
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[提交人]:王雪伟
[提交简述] :小象省钱 [实现方案] :调整UI
parent
cd1d8c8b
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
502 additions
and
57 deletions
+502
-57
H5Activity.kt
cms/src/main/java/com/zxhl/cms/common/H5Activity.kt
+16
-2
WebActivity.kt
cms/src/main/java/com/zxhl/cms/common/WebActivity.kt
+3
-1
PayDialog.kt
cms/src/main/java/com/zxhl/cms/pay/PayDialog.kt
+29
-6
activity_h5.xml
cms/src/main/res/layout/activity_h5.xml
+1
-1
activity_web.xml
cms/src/main/res/layout/activity_web.xml
+2
-2
RightsDetailActivity.kt
...java/com/zxbw/modulemain/activity/RightsDetailActivity.kt
+6
-1
HomeBannerAdapter.kt
...ain/java/com/zxbw/modulemain/adapter/HomeBannerAdapter.kt
+1
-1
HomeQyBannerAdapter.kt
...n/java/com/zxbw/modulemain/adapter/HomeQyBannerAdapter.kt
+0
-1
HomeRecommendAdapter.kt
.../java/com/zxbw/modulemain/adapter/HomeRecommendAdapter.kt
+34
-11
NewBoxGoodsDetailActivity.kt
...zxbw/modulemain/box/activity/NewBoxGoodsDetailActivity.kt
+5
-5
RightsPayPresenter.kt
.../java/com/zxbw/modulemain/presenter/RightsPayPresenter.kt
+0
-1
UIndicator.java
...in/src/main/java/com/zxbw/modulemain/view/UIndicator.java
+321
-0
activity_layout_new_box_goods_detail.xml
.../main/res/layout/activity_layout_new_box_goods_detail.xml
+0
-2
activity_layout_rights_detail.xml
...ain/src/main/res/layout/activity_layout_rights_detail.xml
+8
-8
dialog_layout_box_result.xml
moduleMain/src/main/res/layout/dialog_layout_box_result.xml
+2
-2
fragment_layout_home.xml
moduleMain/src/main/res/layout/fragment_layout_home.xml
+2
-2
item_layout_detail_banner.xml
moduleMain/src/main/res/layout/item_layout_detail_banner.xml
+2
-2
item_layout_home_qy_view.xml
moduleMain/src/main/res/layout/item_layout_home_qy_view.xml
+24
-9
attrs_universal_indicator.xml
moduleMain/src/main/res/values/attrs_universal_indicator.xml
+46
-0
No files found.
cms/src/main/java/com/zxhl/cms/common/H5Activity.kt
View file @
9be26765
...
...
@@ -10,6 +10,7 @@ import android.view.View
import
android.webkit.*
import
androidx.appcompat.app.AppCompatActivity
import
com.zxhl.cms.R
import
com.zxhl.cms.utils.EventUtils
import
kotlinx.android.synthetic.main.activity_h5.*
...
...
@@ -106,8 +107,8 @@ class H5Activity : AppCompatActivity() {
}
//处理http和https开头的url
wv
.
loadUrl
(
url
)
return
tru
e
//
wv.loadUrl(url)
return
fals
e
}
override
fun
onReceivedSslError
(
...
...
@@ -117,6 +118,19 @@ class H5Activity : AppCompatActivity() {
)
{
handler
.
proceed
()
}
override
fun
onReceivedError
(
view
:
WebView
?,
request
:
WebResourceRequest
?,
error
:
WebResourceError
?
)
{
super
.
onReceivedError
(
view
,
request
,
error
)
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
android
.
os
.
Build
.
VERSION_CODES
.
M
)
{
Log
.
d
(
"wxw"
,
"1error${error?.errorCode}"
)
Log
.
d
(
"wxw"
,
"2error${error?.description}"
)
}
else
{
}
}
})
}
var
firstLoad
:
Boolean
=
false
...
...
cms/src/main/java/com/zxhl/cms/common/WebActivity.kt
View file @
9be26765
...
...
@@ -121,6 +121,7 @@ class WebActivity : BaseActivity() {
id_activity_web_view
?.
webViewClient
=
object
:
WebViewClient
()
{
override
fun
shouldOverrideUrlLoading
(
wv
:
WebView
,
url
:
String
?):
Boolean
{
Log
.
e
(
"MXL"
,
"AURL"
+
url
)
if
(
url
==
null
)
return
false
try
{
if
(
url
.
startsWith
(
"weixin://"
)
//微信
...
...
@@ -129,9 +130,10 @@ class WebActivity : BaseActivity() {
||
url
.
startsWith
(
"tel://"
)
//电话
||
url
.
startsWith
(
"dianping://"
)
//大众点评
||
url
.
startsWith
(
"tbopen://"
)
//淘宝
||
url
.
startsWith
(
"openapp.jdmobile://"
)
//
淘宝
||
url
.
startsWith
(
"openapp.jdmobile://"
)
//
京东
||
url
.
startsWith
(
"tmast://"
)
//淘宝
||
url
.
startsWith
(
"pinduoduo://"
)
//拼多多
||
url
.
startsWith
(
"imeituan://"
)
//美团
//其他自定义的scheme
)
{
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
url
))
...
...
cms/src/main/java/com/zxhl/cms/pay/PayDialog.kt
View file @
9be26765
...
...
@@ -316,6 +316,7 @@ object PayDialog : PayContract.View {
)
{
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
url
))
mActivity
?.
startActivity
(
intent
)
EventUtils
.
onEvent
(
"h5_open_zfb_suc"
)
return
true
}
}
catch
(
e
:
Exception
)
{
//防止crash (如果手机上没有安装处理某个scheme开头的url的APP, 会导致crash)
...
...
@@ -342,9 +343,8 @@ object PayDialog : PayContract.View {
handler
:
SslErrorHandler
?,
error
:
SslError
?
)
{
super
.
onReceivedSslError
(
view
,
handler
,
error
)
EventUtils
.
onEvent
(
"h5_pay_error0"
,
error
.
toString
())
showResultLoading
(
false
)
// 接受所有网站的证书,忽略SSL错误,执行访问网页
handler
?.
proceed
();
}
override
fun
onReceivedError
(
...
...
@@ -353,7 +353,16 @@ object PayDialog : PayContract.View {
error
:
WebResourceError
?
)
{
super
.
onReceivedError
(
view
,
request
,
error
)
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
android
.
os
.
Build
.
VERSION_CODES
.
M
)
{
// Log.d("wxw", "1error${error?.errorCode}")
// Log.d("wxw", "2error${error?.description}")
EventUtils
.
onEvent
(
"h5_pay_error1"
,
"code: ${error?.errorCode} desc: ${error?.description}"
)
}
else
{
EventUtils
.
onEvent
(
"h5_pay_error1"
,
error
.
toString
())
}
showResultLoading
(
false
)
}
...
...
@@ -362,10 +371,24 @@ object PayDialog : PayContract.View {
request
:
WebResourceRequest
?,
errorResponse
:
WebResourceResponse
?
)
{
super
.
onReceivedHttpError
(
view
,
request
,
errorResponse
)
EventUtils
.
onEvent
(
"h5_pay_error2"
,
errorResponse
?.
statusCode
.
toString
())
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
android
.
os
.
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
if
(
request
?.
url
?.
path
?.
endsWith
(
"/favicon.ico"
)
==
true
)
{
}
else
{
// Log.d("wxw", "1errorResponse?.statusCode${request?.url}")
// Log.d("wxw", "2errorResponse?.statusCode${errorResponse?.statusCode}")
EventUtils
.
onEvent
(
"h5_pay_error2"
,
errorResponse
?.
statusCode
.
toString
()
+
" url:${request?.url}"
)
showResultLoading
(
false
)
}
}
else
{
EventUtils
.
onEvent
(
"h5_pay_error2"
,
errorResponse
.
toString
())
showResultLoading
(
false
)
}
super
.
onReceivedHttpError
(
view
,
request
,
errorResponse
)
}
}
id_pay_web_view
?.
loadUrl
(
NetConfig
.
H5
.
WEB_URL_H5_PAY
)
...
...
cms/src/main/res/layout/activity_h5.xml
View file @
9be26765
...
...
@@ -26,7 +26,7 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:text=
""
android:textColor=
"@color/
white
"
android:textColor=
"@color/
color_333333
"
android:textSize=
"17sp"
/>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
...
...
cms/src/main/res/layout/activity_web.xml
View file @
9be26765
...
...
@@ -17,7 +17,7 @@
android:id=
"@+id/id_activity_web_toolbar"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:navigationIcon=
"@drawable/i
ncon_back
"
app:navigationIcon=
"@drawable/i
con_fanhui
"
app:theme=
"@style/myToolbarNavigationButtonStyle"
>
<TextView
...
...
@@ -26,7 +26,7 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:text=
""
android:textColor=
"@color/
white
"
android:textColor=
"@color/
color_333333
"
android:textSize=
"17sp"
/>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
...
...
moduleMain/src/main/java/com/zxbw/modulemain/activity/RightsDetailActivity.kt
View file @
9be26765
...
...
@@ -145,6 +145,7 @@ class RightsDetailActivity : BaseActivity(), RightsDetailContract.View, RightsPa
showToast
(
"请选择要购买的权益"
)
return
}
isClickPayBtn
=
true
mLoading
?.
setLoading
(
"请稍后..."
)
mLoading
?.
show
()
mPayPresenter
?.
requestRightsAliPay
(
mRightsData
?.
id
?:
""
,
pay_type
.
toString
(),
phoneNumber
)
...
...
@@ -243,12 +244,15 @@ class RightsDetailActivity : BaseActivity(), RightsDetailContract.View, RightsPa
}
override
fun
verifyOrderSuc
(
order
:
String
)
{
isClickPayBtn
=
false
SettingPreference
.
setOutTradeNo
(
""
)
showResultLoading
(
true
)
showToast
(
"成功!"
)
Log
.
d
(
"wxw"
,
"成功"
)
}
override
fun
verifyOrderFail
(
errorMsg
:
String
)
{
isClickPayBtn
=
false
showResultLoading
(
false
)
}
...
...
@@ -265,10 +269,11 @@ class RightsDetailActivity : BaseActivity(), RightsDetailContract.View, RightsPa
isPause
=
true
}
private
var
isPause
=
false
private
var
isClickPayBtn
=
false
override
fun
onResume
()
{
super
.
onResume
()
Log
.
d
(
"wxw"
,
"OnResume"
)
if
(
isPause
)
{
if
(
isPause
&&
isClickPayBtn
)
{
Log
.
d
(
"wxw"
,
"1OnResume"
+
pay_type
)
if
(
pay_type
==
PayActivity
.
MIN_PAY_PROGRAM
||
pay_type
==
PayActivity
.
H5_PAY
)
{
//如果是敏支付或者H5支付
...
...
moduleMain/src/main/java/com/zxbw/modulemain/adapter/HomeBannerAdapter.kt
View file @
9be26765
...
...
@@ -48,7 +48,7 @@ class HomeBannerAdapter : PagerAdapter {
if
(
data
.
bannerType
.
equals
(
"blindBox"
))
{
JumpUtils
.
goodsDetailJump
(
data
.
boxId
)
}
else
if
(
data
.
bannerType
.
equals
(
"H5"
))
{
JumpUtils
.
webJump
(
""
,
data
.
url
)
JumpUtils
.
webJump
(
"
免费领红包
"
,
data
.
url
)
}
else
{
JumpUtils
.
FlashSaleJump
()
}
...
...
moduleMain/src/main/java/com/zxbw/modulemain/adapter/HomeQyBannerAdapter.kt
View file @
9be26765
...
...
@@ -53,7 +53,6 @@ class HomeQyBannerAdapter : PagerAdapter {
}
else
{
JumpUtils
.
RightsDetailJump
(
data
.
brand
,
data
.
icon
)
}
})
val
manager
=
GridLayoutManager
(
mActivity
,
5
)
manager
.
isSmoothScrollbarEnabled
=
true
;
...
...
moduleMain/src/main/java/com/zxbw/modulemain/adapter/HomeRecommendAdapter.kt
View file @
9be26765
...
...
@@ -11,9 +11,12 @@ import android.widget.TextView
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
androidx.viewpager.widget.ViewPager
import
com.bytedance.pangle.transform.ZeusTransformUtils
import
com.zhpan.indicator.IndicatorView
import
com.zhpan.indicator.base.IIndicator
import
com.zxbw.modulemain.R
import
com.zxbw.modulemain.box.adapter.ItemBoxGoodsAdapter
import
com.zxbw.modulemain.view.UIndicator
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.common.base.BaseRecyclerAdapter
import
com.zxhl.cms.net.model.qy.JgqQyEntity
...
...
@@ -149,11 +152,28 @@ class HomeRecommendAdapter : BaseRecyclerAdapter<TbGoodsItemEntity, RecyclerView
Log
.
d
(
"wxw"
,
"resultSize${result.size}"
)
var
mQyBannerAdapter
=
HomeQyBannerAdapter
(
result
,
mContext
)
holder
.
qy_vp
?.
adapter
=
mQyBannerAdapter
;
holder
.
qy_vp
?.
postDelayed
(
Runnable
{
holder
.
qy_vp
?.
requestLayout
()
},
100
)
holder
.
id_qy_indicator_view
?.
setSliderGap
(
40f
)
holder
.
id_qy_indicator_view
?.
setupWithViewPager
(
holder
.
qy_vp
!!
)
mQyBannerAdapter
.
notifyDataSetChanged
()
// holder.qy_vp?.postDelayed(Runnable {
// holder.qy_vp?.requestLayout()
// }, 100)
// holder.qy_vp?.requestLayout()
holder
.
id_qy_indicator_view
?.
setIndicatorCount
(
result
.
size
)
holder
.
qy_vp
?.
addOnPageChangeListener
(
object
:
ViewPager
.
OnPageChangeListener
{
override
fun
onPageScrolled
(
position
:
Int
,
positionOffset
:
Float
,
positionOffsetPixels
:
Int
)
{
}
override
fun
onPageSelected
(
position
:
Int
)
{
holder
.
id_qy_indicator_view
?.
setSelectPos
(
position
)
}
override
fun
onPageScrollStateChanged
(
state
:
Int
)
{
}
})
}
else
{
holder
.
qy_item_view
?.
visibility
=
View
.
GONE
}
...
...
@@ -162,16 +182,18 @@ class HomeRecommendAdapter : BaseRecyclerAdapter<TbGoodsItemEntity, RecyclerView
}
else
if
(
holder
is
BoxViewHolder
)
{
val
bean
=
mList
[
position
-
viewNum
]
holder
.
box_main_img
?.
setLoadImageUrl
(
bean
.
mainImage
,
0
,
5
)
holder
.
box_name
?.
text
=
bean
.
boxName
holder
.
box_price
?.
text
=
bean
.
onePriceStr
holder
.
box_name
?.
text
=
bean
.
boxName
holder
.
box_price
?.
text
=
bean
.
onePriceStr
holder
.
box_old_price
?.
text
=
"¥ ${bean.originalPrice}"
holder
.
box_old_price
?.
paint
?.
flags
=
Paint
.
STRIKE_THRU_TEXT_FLAG
var
a_price
=
bean
.
originalPrice
?.
toDoubleOrNull
()
?:
0
as
Double
var
b_price
=
bean
.
onePriceStr
?.
toDoubleOrNull
()
?:
0
as
Double
holder
.
box_discount_desc
?.
text
=
"已减${Utils.getNoMoreThanTwoDigits(Utils.sub(a_price,b_price))}元"
holder
.
box_discount_desc
?.
text
=
"已减${Utils.getNoMoreThanTwoDigits(Utils.sub(a_price, b_price))}元"
var
mAdapter
:
ItemBoxGoodsAdapter
?
=
ItemBoxGoodsAdapter
(
mContext
)
holder
.
box_goods_list
?.
layoutManager
=
LinearLayoutManager
(
mContext
,
RecyclerView
.
HORIZONTAL
,
false
)
holder
.
box_goods_list
?.
layoutManager
=
LinearLayoutManager
(
mContext
,
RecyclerView
.
HORIZONTAL
,
false
)
holder
.
box_goods_list
?.
adapter
=
mAdapter
mAdapter
?.
clear
()
mAdapter
?.
appendToList
(
bean
.
goodsList
)
...
...
@@ -236,14 +258,14 @@ class HomeRecommendAdapter : BaseRecyclerAdapter<TbGoodsItemEntity, RecyclerView
class
QyViewHolder
:
RecyclerView
.
ViewHolder
{
var
qy_item_view
:
RelativeLayout
?
var
qy_vp
:
ViewPager
?
var
id_qy_indicator_view
:
IndicatorView
?
var
id_qy_indicator_view
:
UIndicator
?
constructor
(
itemView
:
View
)
:
super
(
itemView
)
{
qy_item_view
=
itemView
.
findViewById
<
RelativeLayout
>(
R
.
id
.
id_rl_home_qy_item_view
)
qy_vp
=
itemView
.
findViewById
<
ViewPager
>(
R
.
id
.
id_vp_home_jgq_qy_list
)
id_qy_indicator_view
=
itemView
.
findViewById
<
IndicatorView
>(
R
.
id
.
id_qy_indicator_view
)
id_qy_indicator_view
=
itemView
.
findViewById
<
UIndicator
>(
R
.
id
.
id_qy_indicator_view
)
}
}
...
...
@@ -279,4 +301,5 @@ class HomeRecommendAdapter : BaseRecyclerAdapter<TbGoodsItemEntity, RecyclerView
box_goods_list
=
itemView
.
findViewById
<
RecyclerView
>(
R
.
id
.
id_rcl_box_goods_list
)
}
}
}
\ No newline at end of file
moduleMain/src/main/java/com/zxbw/modulemain/box/activity/NewBoxGoodsDetailActivity.kt
View file @
9be26765
...
...
@@ -297,16 +297,16 @@ class NewBoxGoodsDetailActivity : BaseActivity(), GoodsDetailContract.View,
if
(
reslut
.
activitiesType
==
2
)
{
id_ll_five_lottery
?.
visibility
=
View
.
GONE
id_btn_one_lottery
?.
text
=
"买一送一"
id_tv_oneprice
?.
text
=
"${reslut.activitiesPrice}"
id_tv_oneprice
?.
text
=
"
¥
${reslut.activitiesPrice}"
}
else
{
id_ll_five_lottery
?.
visibility
=
View
.
VISIBLE
id_btn_one_lottery
?.
text
=
"一发入魂"
id_tv_oneprice
?.
text
=
"${reslut.onePriceStr}"
id_tv_oneprice
?.
text
=
"
¥
${reslut.onePriceStr}"
}
if
(
TextUtils
.
isEmpty
(
newUserPrice
))
{
id_tv_five_price2
.
text
=
"${reslut.onePrice?.times(5)}"
id_tv_five_price2
.
text
=
"
¥
${reslut.onePrice?.times(5)}"
}
else
{
id_tv_five_price2
.
text
=
"${newUserPrice?.toDoubleOrNull()?.times(5)}"
id_tv_five_price2
.
text
=
"
¥
${newUserPrice?.toDoubleOrNull()?.times(5)}"
}
if
(
boxid
.
equals
(
"-1"
)
||
boxid
.
equals
(
"-12"
)
||
boxid
.
equals
(
"-11"
))
{
newUserPrice
=
"0"
...
...
@@ -327,7 +327,7 @@ class NewBoxGoodsDetailActivity : BaseActivity(), GoodsDetailContract.View,
}
id_tv_five_price2
.
getPaint
().
setFlags
(
Paint
.
STRIKE_THRU_TEXT_FLAG
)
//中划线
id_tv_five_price
?.
text
=
"${reslut.fivePrice}"
id_tv_five_price
?.
text
=
"
¥
${reslut.fivePrice}"
mList
=
reslut
.
goodsList
fiveSellCoin
=
reslut
?.
fivePrice
?:
0.0
...
...
moduleMain/src/main/java/com/zxbw/modulemain/presenter/RightsPayPresenter.kt
View file @
9be26765
...
...
@@ -25,7 +25,6 @@ import com.zxhl.cms.utils.WeChatPay
import
org.json.JSONObject
/**
* Created by gaoleichao on 2021/8/31
*/
class
RightsPayPresenter
:
RightsPayContract
.
Presenter
{
...
...
moduleMain/src/main/java/com/zxbw/modulemain/view/UIndicator.java
0 → 100644
View file @
9be26765
package
com
.
zxbw
.
modulemain
.
view
;
import
android.content.Context
;
import
android.content.res.ColorStateList
;
import
android.content.res.TypedArray
;
import
android.graphics.Canvas
;
import
android.graphics.Color
;
import
android.graphics.Paint
;
import
android.graphics.RectF
;
import
android.util.AttributeSet
;
import
android.view.View
;
import
androidx.annotation.Nullable
;
import
androidx.viewpager.widget.ViewPager
;
import
com.zxbw.modulemain.R
;
/**
* @author (wangXuewei)
* @datetime 2022-04-16 18:06 GMT+8
* @detail :
*/
public
class
UIndicator
extends
View
{
private
static
final
String
TAG
=
"UIndicator"
;
//指示器样式一 选中未选中都是圆点
public
static
final
int
STYLE_CIRCLR_CIRCLE
=
0
;
//指示器样式二 选中未选中都是方形
public
static
final
int
STYLE_RECT_RECT
=
1
;
//指示器样式三 选中方形,未选中圆点
public
static
final
int
STYLE_CIRCLR_RECT
=
2
;
//横向排列
public
static
final
int
HORIZONTAL
=
0
;
//纵向排列
public
static
final
int
VERTICAL
=
1
;
private
Context
mContext
;
//指示器之间的间距
private
int
spacing
;
//指示器排列方向
private
int
orientation
=
HORIZONTAL
;
//选中与为选中的颜色
private
ColorStateList
selectedColor
,
normalColor
;
//指示器样式,默认都是圆点
private
int
mStyle
=
STYLE_CIRCLR_CIRCLE
;
//样式一 圆点半径大小
private
int
circleCircleRadius
=
0
;
//样式二 方形大小及圆角
private
int
rectRectItemWidth
=
0
,
rectRectItemHeight
=
0
,
rectRectCorner
=
0
;
//样式三 选中的方形大小及圆角
private
int
circleRectItemWidth
=
0
,
circleRectItemHeight
=
0
,
circleRectCorner
=
0
;
//样式三 未选中的圆点半径
private
int
circleRectRadius
=
0
;
//画笔
private
Paint
normalPaint
,
selectedPaint
;
//指示器item的区域
private
RectF
mRectF
;
//指示器大小
private
int
width
,
height
;
//指示器item个数
private
int
itemCount
=
0
;
//当前选中的位置
private
int
selection
=
0
;
private
ViewPager
viewPager
;
public
UIndicator
(
Context
context
)
{
this
(
context
,
null
);
}
public
UIndicator
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
this
(
context
,
attrs
,
0
);
}
public
UIndicator
(
Context
context
,
@Nullable
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
mContext
=
context
;
init
(
attrs
);
intPaint
();
checkItemCount
();
}
/**
* 加载自定义属性
*/
private
void
init
(
AttributeSet
attrs
)
{
// 加载自定义属性集合
TypedArray
ta
=
mContext
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
Indicator
);
// 第二个参数是默认设置颜色
selectedColor
=
ta
.
getColorStateList
(
R
.
styleable
.
Indicator_selected_color
);
normalColor
=
ta
.
getColorStateList
(
R
.
styleable
.
Indicator_normal_color
);
spacing
=
ta
.
getDimensionPixelSize
(
R
.
styleable
.
Indicator_spacing
,
dip2px
(
6
));
orientation
=
ta
.
getInt
(
R
.
styleable
.
Indicator_orientation
,
HORIZONTAL
);
mStyle
=
ta
.
getInt
(
R
.
styleable
.
Indicator_style
,
STYLE_CIRCLR_CIRCLE
);
circleCircleRadius
=
ta
.
getDimensionPixelSize
(
R
.
styleable
.
Indicator_circle_circle_radius
,
dip2px
(
3
));
rectRectCorner
=
ta
.
getDimensionPixelSize
(
R
.
styleable
.
Indicator_rect_rect_corner
,
0
);
rectRectItemHeight
=
ta
.
getDimensionPixelSize
(
R
.
styleable
.
Indicator_rect_rect_itemHeight
,
dip2px
(
3
));
rectRectItemWidth
=
ta
.
getDimensionPixelSize
(
R
.
styleable
.
Indicator_rect_rect_itemWidth
,
dip2px
(
15
));
circleRectCorner
=
ta
.
getDimensionPixelSize
(
R
.
styleable
.
Indicator_circle_rect_corner
,
0
);
circleRectRadius
=
ta
.
getDimensionPixelSize
(
R
.
styleable
.
Indicator_circle_rect_radius
,
dip2px
(
3
));
circleRectItemHeight
=
ta
.
getDimensionPixelSize
(
R
.
styleable
.
Indicator_circle_rect_itemHeight
,
dip2px
(
3
));
circleRectItemWidth
=
ta
.
getDimensionPixelSize
(
R
.
styleable
.
Indicator_circle_rect_itemWidth
,
dip2px
(
15
));
// 解析后释放资源
ta
.
recycle
();
}
private
void
intPaint
()
{
normalPaint
=
new
Paint
();
normalPaint
.
setStyle
(
Paint
.
Style
.
FILL
);
normalPaint
.
setAntiAlias
(
true
);
normalPaint
.
setColor
(
normalColor
==
null
?
Color
.
GRAY
:
normalColor
.
getDefaultColor
());
selectedPaint
=
new
Paint
();
selectedPaint
.
setStyle
(
Paint
.
Style
.
FILL
);
selectedPaint
.
setAntiAlias
(
true
);
selectedPaint
.
setColor
(
selectedColor
==
null
?
Color
.
RED
:
selectedColor
.
getDefaultColor
());
mRectF
=
new
RectF
();
}
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
super
.
onMeasure
(
widthMeasureSpec
,
heightMeasureSpec
);
int
heightSize
=
MeasureSpec
.
getSize
(
heightMeasureSpec
);
int
widthSize
=
MeasureSpec
.
getSize
(
widthMeasureSpec
);
switch
(
mStyle
)
{
case
STYLE_CIRCLR_CIRCLE:
if
(
orientation
==
HORIZONTAL
)
{
width
=
2
*
circleCircleRadius
*
itemCount
+
(
itemCount
-
1
)
*
spacing
;
height
=
Math
.
max
(
heightSize
,
2
*
circleCircleRadius
);
}
else
{
height
=
2
*
circleCircleRadius
*
itemCount
+
(
itemCount
-
1
)
*
spacing
;
width
=
Math
.
max
(
widthSize
,
2
*
circleCircleRadius
);
}
break
;
case
STYLE_RECT_RECT:
if
(
orientation
==
HORIZONTAL
)
{
width
=
rectRectItemWidth
*
itemCount
+
(
itemCount
-
1
)
*
spacing
;
height
=
Math
.
max
(
heightSize
,
rectRectItemHeight
);
}
else
{
height
=
rectRectItemHeight
*
itemCount
+
(
itemCount
-
1
)
*
spacing
;
width
=
Math
.
max
(
widthSize
,
rectRectItemWidth
);
}
break
;
case
STYLE_CIRCLR_RECT:
if
(
orientation
==
HORIZONTAL
)
{
int
normalItemWidth
=
circleRectRadius
*
2
;
width
=
(
itemCount
-
1
)
*
normalItemWidth
+
circleRectItemWidth
+
(
itemCount
-
1
)
*
spacing
;
int
tempHeight
=
Math
.
max
(
circleRectItemHeight
,
circleRectRadius
*
2
);
height
=
Math
.
max
(
heightSize
,
tempHeight
);
}
else
{
int
normalItemHeight
=
circleRectRadius
*
2
;
height
=
(
itemCount
-
1
)
*
normalItemHeight
+
circleRectItemHeight
+
(
itemCount
-
1
)
*
spacing
;
int
tempWidth
=
Math
.
max
(
circleRectItemWidth
,
circleRectRadius
*
2
);
width
=
Math
.
max
(
widthSize
,
tempWidth
);
}
break
;
}
setMeasuredDimension
(
width
,
height
);
}
@Override
protected
void
onDraw
(
Canvas
canvas
)
{
super
.
onDraw
(
canvas
);
if
(
orientation
==
HORIZONTAL
)
{
switch
(
mStyle
)
{
case
STYLE_CIRCLR_CIRCLE:
float
cy
=
height
/
2
;
for
(
int
i
=
0
;
i
<
itemCount
;
i
++)
{
int
cx
=
(
i
+
1
)
*
circleCircleRadius
+
i
*
spacing
;
//全部绘制圆点,画笔的区别
canvas
.
drawCircle
(
cx
,
cy
,
circleCircleRadius
,
i
==
selection
?
selectedPaint
:
normalPaint
);
}
break
;
case
STYLE_RECT_RECT:
for
(
int
i
=
0
;
i
<
itemCount
;
i
++)
{
int
left
=
i
*
rectRectItemWidth
+
i
*
spacing
;
mRectF
.
set
(
left
,
0
,
left
+
rectRectItemWidth
,
rectRectItemHeight
);
//全部绘制圆角矩形,画笔的区别
canvas
.
drawRoundRect
(
mRectF
,
rectRectCorner
,
rectRectCorner
,
i
==
selection
?
selectedPaint
:
normalPaint
);
}
break
;
case
STYLE_CIRCLR_RECT:
for
(
int
i
=
0
;
i
<
itemCount
;
i
++)
{
int
left
=
selection
*
(
circleRectRadius
*
2
+
spacing
);
int
top
;
if
(
selection
==
i
)
{
//选中的绘制圆角矩形
top
=
(
height
-
circleRectItemHeight
)
/
2
;
mRectF
.
set
(
left
,
top
,
left
+
circleRectItemWidth
,
circleRectItemHeight
+
top
);
canvas
.
drawRoundRect
(
mRectF
,
circleRectCorner
,
circleRectCorner
,
selectedPaint
);
}
else
{
//未选中的绘制圆点,距离需要判断position在选中的左边或者右边,从而确定cx
top
=
(
height
-
circleRectRadius
*
2
)
/
2
;
int
cx
=
0
;
float
cy1
=
circleRectRadius
+
top
;
if
(
selection
<
i
)
{
cx
=
(
i
-
1
)
*
circleRectRadius
*
2
+
i
*
spacing
+
circleRectItemWidth
+
circleRectRadius
;
}
else
{
cx
=
i
*
(
circleRectRadius
*
2
)
+
i
*
spacing
+
circleRectRadius
;
}
canvas
.
drawCircle
(
cx
,
cy1
,
circleRectRadius
,
normalPaint
);
}
}
break
;
}
}
else
{
switch
(
mStyle
)
{
case
STYLE_CIRCLR_CIRCLE:
float
cx
=
width
/
2
;
for
(
int
i
=
0
;
i
<
itemCount
;
i
++)
{
int
cy
=
i
*
(
circleCircleRadius
*
2
+
spacing
)
+
circleCircleRadius
;
//全部绘制圆点,画笔的区别
canvas
.
drawCircle
(
cx
,
cy
,
circleCircleRadius
,
i
==
selection
?
selectedPaint
:
normalPaint
);
}
break
;
case
STYLE_RECT_RECT:
for
(
int
i
=
0
;
i
<
itemCount
;
i
++)
{
int
top
=
i
*
rectRectItemHeight
+
i
*
spacing
;
int
left
=
(
width
-
rectRectItemWidth
)
/
2
;
mRectF
.
set
(
left
,
top
,
left
+
rectRectItemWidth
,
top
+
rectRectItemHeight
);
//全部绘制圆角矩形,画笔的区别
canvas
.
drawRoundRect
(
mRectF
,
rectRectCorner
,
rectRectCorner
,
i
==
selection
?
selectedPaint
:
normalPaint
);
}
break
;
case
STYLE_CIRCLR_RECT:
for
(
int
i
=
0
;
i
<
itemCount
;
i
++)
{
if
(
selection
==
i
)
{
int
left
=
(
width
-
circleRectItemWidth
)
/
2
;
//选中的绘制圆角矩形
int
top
=
selection
*
(
circleRectRadius
*
2
+
spacing
);
mRectF
.
set
(
left
,
top
,
left
+
circleRectItemWidth
,
top
+
circleRectItemHeight
);
canvas
.
drawRoundRect
(
mRectF
,
circleRectCorner
,
circleRectCorner
,
selectedPaint
);
}
else
{
//未选中的绘制圆点,距离需要判断position在选中的左边或者右边,从而确定cx
int
cx1
=
(
width
-
2
*
circleRectRadius
)
/
2
+
circleRectRadius
;
float
cy1
=
0
;
if
(
selection
<
i
)
{
cy1
=
(
i
-
1
)
*
circleRectRadius
*
2
+
i
*
spacing
+
circleRectItemHeight
+
circleRectRadius
;
}
else
{
cy1
=
i
*
(
circleRectRadius
*
2
)
+
i
*
spacing
+
circleRectRadius
;
}
canvas
.
drawCircle
(
cx1
,
cy1
,
circleRectRadius
,
normalPaint
);
}
}
break
;
}
}
}
/**
* 关联ViewPager
*
* @param viewPager
*/
public
void
attachToViewPager
(
ViewPager
viewPager
)
{
}
/**
* 设置指示器数量
*/
public
void
setIndicatorCount
(
int
count
)
{
itemCount
=
count
;
selection
=
0
;
checkItemCount
();
}
/**
* 设置选中的指示器
*/
public
void
setSelectPos
(
int
pos
)
{
selection
=
pos
;
postInvalidate
();
}
/**
* 设置选中的值,当ViewPager只有一个item不显示指示器
*/
private
void
checkItemCount
()
{
if
(
selection
>=
itemCount
)
{
selection
=
itemCount
-
1
;
}
setVisibility
((
itemCount
<=
1
)
?
GONE
:
VISIBLE
);
}
/**
* dp to px
*/
public
int
dip2px
(
float
dpValue
)
{
final
float
scale
=
getContext
().
getResources
().
getDisplayMetrics
().
density
;
return
(
int
)
(
dpValue
*
scale
+
0.5f
);
}
}
moduleMain/src/main/res/layout/activity_layout_new_box_goods_detail.xml
View file @
9be26765
...
...
@@ -100,7 +100,6 @@
android:id=
"@+id/id_tv_five_price"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:drawableLeft=
"@drawable/icon_jinbi"
android:drawablePadding=
"5dp"
android:textColor=
"@color/white"
android:textSize=
"12sp"
/>
...
...
@@ -145,7 +144,6 @@
android:id=
"@+id/id_tv_oneprice"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:drawableLeft=
"@drawable/icon_jinbi"
android:drawablePadding=
"5dp"
android:textColor=
"@color/white"
android:textSize=
"12sp"
/>
...
...
moduleMain/src/main/res/layout/activity_layout_rights_detail.xml
View file @
9be26765
...
...
@@ -14,7 +14,7 @@
android:id=
"@+id/id_rights_detail_title_sys_bar_view"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:layout_marginBottom=
"
1
5dp"
/>
android:layout_marginBottom=
"5dp"
/>
<ImageView
android:id=
"@+id/id_img_back"
...
...
@@ -142,21 +142,20 @@
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:layout_marginLeft=
"23dp"
android:layout_marginBottom=
"5dp"
android:layout_marginRight=
"23dp"
android:layout_marginBottom=
"10dp"
android:background=
"#F0F0F0"
/>
</LinearLayout>
<View
android:layout_width=
"match_parent"
android:layout_height=
"10dp"
android:layout_marginTop=
"10dp"
android:background=
"#F3F4F5"
/>
<!--套餐-->
<LinearLayout
android:layout_width=
"match_parent"
android:background=
"@color/white"
android:layout_height=
"wrap_content"
android:background=
"@color/white"
android:orientation=
"vertical"
>
<LinearLayout
...
...
@@ -190,14 +189,14 @@
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"12dp"
android:layout_marginTop=
"8dp"
android:layout_marginRight=
"12dp"
/>
android:layout_marginRight=
"12dp"
android:layout_marginBottom=
"10dp"
/>
</LinearLayout>
<View
android:layout_width=
"match_parent"
android:layout_height=
"10dp"
android:layout_marginTop=
"12dp"
android:background=
"#F3F4F5"
/>
<!--权益说明-->
...
...
@@ -306,9 +305,10 @@
android:textStyle=
"bold"
/>
</LinearLayout>
<WebView
android:id=
"@+id/id_rights_pay_web_view"
android:visibility=
"gone"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
android:visibility=
"gone"
/>
</RelativeLayout>
moduleMain/src/main/res/layout/dialog_layout_box_result.xml
View file @
9be26765
...
...
@@ -40,8 +40,8 @@
android:layout_height=
"wrap_content"
android:textColor=
"@color/white"
android:textSize=
"13sp"
android:text
Style=
"bold
"
android:
visibility=
"gone
"
/>
android:text
=
"提货流程:我的-我的仓库-选择商品进行提货
"
android:
textStyle=
"bold
"
/>
<TextView
android:id=
"@+id/id_five_lottery_goods_price2"
...
...
moduleMain/src/main/res/layout/fragment_layout_home.xml
View file @
9be26765
...
...
@@ -25,7 +25,7 @@
android:id=
"@+id/id_home_top_banner_view"
android:layout_width=
"match_parent"
android:layout_height=
"280dp"
android:paddingBottom=
"
20
dp"
>
android:paddingBottom=
"
16
dp"
>
<androidx.viewpager.widget.ViewPager
android:id=
"@+id/id_home_top_banner"
...
...
@@ -101,7 +101,7 @@
<com.zxbw.modulemain.view.SlidingTabLayout2
android:id=
"@+id/id_fragment_home_tab"
android:layout_width=
"match_parent"
android:layout_height=
"3
0
dp"
android:layout_height=
"3
8
dp"
android:layout_below=
"@+id/id_rl_search_view"
android:layout_marginTop=
"17dp"
android:paddingLeft=
"5dp"
...
...
moduleMain/src/main/res/layout/item_layout_detail_banner.xml
View file @
9be26765
...
...
@@ -2,13 +2,13 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/id_ll_detail_item"
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_cont
ent"
android:layout_height=
"
match_par
ent"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/id_img_detail_banner_bg"
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_cont
ent"
android:layout_height=
"
match_par
ent"
android:scaleType=
"fitCenter"
/>
</LinearLayout>
moduleMain/src/main/res/layout/item_layout_home_qy_view.xml
View file @
9be26765
...
...
@@ -14,16 +14,31 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<com.z
hpan.indicator.IndicatorView
<com.z
xbw.modulemain.view.UIndicator
android:id=
"@+id/id_qy_indicator_view"
android:layout_width=
"
wrap_cont
ent"
android:layout_height=
"
wrap_content
"
android:layout_below=
"@
+
id/id_vp_home_jgq_qy_list"
android:layout_width=
"
match_par
ent"
android:layout_height=
"
18dp
"
android:layout_below=
"@id/id_vp_home_jgq_qy_list"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"6dp"
android:layout_marginBottom=
"15dp"
app:vpi_slider_checked_color=
"#F1352C"
app:vpi_slider_normal_color=
"#E8DFDF"
app:vpi_slider_radius=
"3dp"
/>
app:circle_rect_radius=
"2dp"
app:circle_rect_itemWidth=
"15dp"
app:circle_rect_itemHeight=
"4dp"
app:circle_rect_corner=
"2dp"
app:normal_color=
"#E8DFDF"
app:orientation=
"horizontal"
app:selected_color=
"#F1352C"
app:spacing=
"4dp"
app:style=
"circle_rect"
/>
<!-- <com.zhpan.indicator.IndicatorView-->
<!-- android:id="@+id/id_qy_indicator_view"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_below="@+id/id_vp_home_jgq_qy_list"-->
<!-- android:layout_centerHorizontal="true"-->
<!-- android:layout_marginTop="6dp"-->
<!-- android:layout_marginBottom="15dp"-->
<!-- app:vpi_slider_checked_color="#F1352C"-->
<!-- app:vpi_slider_normal_color="#E8DFDF"-->
<!-- app:vpi_slider_radius="3dp" />-->
</RelativeLayout>
\ No newline at end of file
moduleMain/src/main/res/values/attrs_universal_indicator.xml
0 → 100644
View file @
9be26765
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable
name=
"Indicator"
>
<!--未选中的指示器颜色-->
<attr
name=
"normal_color"
format=
"reference|color"
/>
<!--选中的指示器颜色-->
<attr
name=
"selected_color"
format=
"reference|color"
/>
<!--指示器每个item之间的间距-->
<attr
name=
"spacing"
format=
"dimension"
/>
<!--指示器排列方向-->
<attr
name=
"orientation"
format=
"enum"
>
<enum
name=
"horizontal"
value=
"0"
/>
<enum
name=
"vertical"
value=
"1"
/>
</attr>
<!--指示器类型 命名规则:未选中样式_选中样式-->
<attr
name=
"style"
format=
"enum"
>
<!--都是圆点-->
<enum
name=
"circle_circle"
value=
"0"
/>
<!--都是方形-->
<enum
name=
"rect_rect"
value=
"1"
/>
<!--未选中是圆点,选中是方形-->
<enum
name=
"circle_rect"
value=
"2"
/>
</attr>
<!--都是圆点指示器半径大小-->
<attr
name=
"circle_circle_radius"
format=
"dimension"
/>
<!--都是方形指示器长度-->
<attr
name=
"rect_rect_itemWidth"
format=
"dimension"
/>
<!--都是方形指示器高度-->
<attr
name=
"rect_rect_itemHeight"
format=
"dimension"
/>
<!--都是方形指示器圆角-->
<attr
name=
"rect_rect_corner"
format=
"dimension"
/>
<!--circle_rect 模式圆点半径-->
<attr
name=
"circle_rect_radius"
format=
"dimension"
/>
<!--circle_rect 模式方形宽度-->
<attr
name=
"circle_rect_itemWidth"
format=
"dimension"
/>
<!--circle_rect 模式方形高度-->
<attr
name=
"circle_rect_itemHeight"
format=
"dimension"
/>
<!--circle_rect 模式方形圆角-->
<attr
name=
"circle_rect_corner"
format=
"dimension"
/>
</declare-styleable>
</resources>
\ No newline at end of file
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