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
dfdff76c
Commit
dfdff76c
authored
Jun 01, 2022
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[提交人]:王雪伟
[提交简述] :小象省钱 [实现方案] :修改淘宝详情适配和首页banner图
parent
bf6f3495
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
12 deletions
+55
-12
Utils.java
cms/src/main/java/com/zxhl/cms/utils/Utils.java
+1
-0
TbGoodsDetailActivity.kt
...ava/com/zxbw/modulemain/activity/TbGoodsDetailActivity.kt
+3
-0
WrapContentHeightViewPager.java
.../com/zxbw/modulemain/view/WrapContentHeightViewPager.java
+39
-0
img_banner_mh_bg.png
moduleMain/src/main/res/drawable-xhdpi/img_banner_mh_bg.png
+0
-0
activity_layout_tb_goods_detail.xml
...n/src/main/res/layout/activity_layout_tb_goods_detail.xml
+4
-4
fragment_layout_home.xml
moduleMain/src/main/res/layout/fragment_layout_home.xml
+4
-5
item_layout_detail_banner.xml
moduleMain/src/main/res/layout/item_layout_detail_banner.xml
+4
-3
No files found.
cms/src/main/java/com/zxhl/cms/utils/Utils.java
View file @
dfdff76c
...
@@ -1271,5 +1271,6 @@ public class Utils {
...
@@ -1271,5 +1271,6 @@ public class Utils {
return
format
.
format
(
number
);
return
format
.
format
(
number
);
}
}
}
}
moduleMain/src/main/java/com/zxbw/modulemain/activity/TbGoodsDetailActivity.kt
View file @
dfdff76c
...
@@ -138,6 +138,7 @@ class TbGoodsDetailActivity : BaseActivity(), TbGoodsDetailContract.View,
...
@@ -138,6 +138,7 @@ class TbGoodsDetailActivity : BaseActivity(), TbGoodsDetailContract.View,
var
mPagerAdapter
=
DetailBannerAdapter
(
goodsDetail
?.
small_images
!!
)
var
mPagerAdapter
=
DetailBannerAdapter
(
goodsDetail
?.
small_images
!!
)
id_detail_top_banner
.
adapter
=
mPagerAdapter
id_detail_top_banner
.
adapter
=
mPagerAdapter
id_tv_vp_index
.
text
=
"${1}/${goodsDetail?.small_images?.size ?: 0 + 1}"
id_tv_vp_index
.
text
=
"${1}/${goodsDetail?.small_images?.size ?: 0 + 1}"
id_detail_top_banner
.
addOnPageChangeListener
(
object
:
ViewPager
.
OnPageChangeListener
{
id_detail_top_banner
.
addOnPageChangeListener
(
object
:
ViewPager
.
OnPageChangeListener
{
override
fun
onPageScrolled
(
override
fun
onPageScrolled
(
position
:
Int
,
position
:
Int
,
...
@@ -293,4 +294,6 @@ class TbGoodsDetailActivity : BaseActivity(), TbGoodsDetailContract.View,
...
@@ -293,4 +294,6 @@ class TbGoodsDetailActivity : BaseActivity(), TbGoodsDetailContract.View,
startActivity
(
intent
)
startActivity
(
intent
)
}
}
}
}
\ No newline at end of file
moduleMain/src/main/java/com/zxbw/modulemain/view/WrapContentHeightViewPager.java
0 → 100644
View file @
dfdff76c
package
com
.
zxbw
.
modulemain
.
view
;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.view.View
;
import
androidx.viewpager.widget.ViewPager
;
/**
* @author (wangXuewei)
* @datetime 2022-06-01 10:38 GMT+8
* @detail :
*/
public
class
WrapContentHeightViewPager
extends
ViewPager
{
public
WrapContentHeightViewPager
(
Context
context
)
{
super
(
context
);
}
public
WrapContentHeightViewPager
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
}
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
int
height
=
0
;
//下面遍历所有child的高度
for
(
int
i
=
0
;
i
<
getChildCount
();
i
++)
{
View
child
=
getChildAt
(
i
);
child
.
measure
(
widthMeasureSpec
,
MeasureSpec
.
makeMeasureSpec
(
0
,
MeasureSpec
.
UNSPECIFIED
));
int
h
=
child
.
getMeasuredHeight
();
if
(
h
>
height
)
//采用最大的view的高度。
height
=
h
;
}
heightMeasureSpec
=
MeasureSpec
.
makeMeasureSpec
(
height
,
MeasureSpec
.
EXACTLY
);
super
.
onMeasure
(
widthMeasureSpec
,
heightMeasureSpec
);
}
}
moduleMain/src/main/res/drawable-xhdpi/img_banner_mh_bg.png
View replaced file @
bf6f3495
View file @
dfdff76c
308 KB
|
W:
|
H:
296 KB
|
W:
|
H:
2-up
Swipe
Onion skin
moduleMain/src/main/res/layout/activity_layout_tb_goods_detail.xml
View file @
dfdff76c
...
@@ -99,21 +99,21 @@
...
@@ -99,21 +99,21 @@
<RelativeLayout
<RelativeLayout
android:id=
"@+id/id_rl_top_view2"
android:id=
"@+id/id_rl_top_view2"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
360dp
"
>
android:layout_height=
"
wrap_content
"
>
<
androidx.viewpager.widget.
ViewPager
<
com.zxbw.modulemain.view.WrapContentHeight
ViewPager
android:id=
"@+id/id_detail_top_banner"
android:id=
"@+id/id_detail_top_banner"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_content
"
/>
android:layout_height=
"
300dp
"
/>
<TextView
<TextView
android:id=
"@+id/id_tv_vp_index"
android:id=
"@+id/id_tv_vp_index"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"22dp"
android:layout_height=
"22dp"
android:layout_alignParentRight=
"true"
android:layout_alignParentRight=
"true"
android:layout_alignParentBottom=
"true"
android:layout_marginRight=
"16dp"
android:layout_marginRight=
"16dp"
android:layout_marginBottom=
"10dp"
android:layout_marginBottom=
"10dp"
android:layout_alignBottom=
"@id/id_detail_top_banner"
android:background=
"@drawable/shape_918782_r15"
android:background=
"@drawable/shape_918782_r15"
android:gravity=
"center"
android:gravity=
"center"
android:paddingLeft=
"15dp"
android:paddingLeft=
"15dp"
...
...
moduleMain/src/main/res/layout/fragment_layout_home.xml
View file @
dfdff76c
...
@@ -28,19 +28,18 @@
...
@@ -28,19 +28,18 @@
<RelativeLayout
<RelativeLayout
android:id=
"@+id/id_home_top_banner_view"
android:id=
"@+id/id_home_top_banner_view"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
280dp
"
android:layout_height=
"
wrap_content
"
android:paddingBottom=
"8dp"
>
android:paddingBottom=
"8dp"
>
<com.zxbw.modulemain.view.WrapContentHeightViewPager
<androidx.viewpager.widget.ViewPager
android:id=
"@+id/id_home_top_banner"
android:id=
"@+id/id_home_top_banner"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
match_parent
"
/>
android:layout_height=
"
280dp
"
/>
<com.zhpan.indicator.IndicatorView
<com.zhpan.indicator.IndicatorView
android:id=
"@+id/indicator_view"
android:id=
"@+id/indicator_view"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_align
ParentBottom=
"true
"
android:layout_align
Bottom=
"@id/id_home_top_banner
"
android:layout_centerHorizontal=
"true"
android:layout_centerHorizontal=
"true"
android:layout_marginBottom=
"50dp"
android:layout_marginBottom=
"50dp"
tl:vpi_slider_checked_color=
"@color/white"
tl:vpi_slider_checked_color=
"@color/white"
...
...
moduleMain/src/main/res/layout/item_layout_detail_banner.xml
View file @
dfdff76c
...
@@ -2,13 +2,14 @@
...
@@ -2,13 +2,14 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/id_ll_detail_item"
android:id=
"@+id/id_ll_detail_item"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
match_par
ent"
android:layout_height=
"
wrap_cont
ent"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<ImageView
<ImageView
android:id=
"@+id/id_img_detail_banner_bg"
android:id=
"@+id/id_img_detail_banner_bg"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"wrap_content"
android:scaleType=
"fitCenter"
/>
android:adjustViewBounds=
"true"
android:scaleType=
"fitXY"
/>
</LinearLayout>
</LinearLayout>
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