Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
machine
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hooloo
android
machine
Commits
de720882
Commit
de720882
authored
Jun 23, 2022
by
wjg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化字体
parent
163e8e9e
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
168 additions
and
30 deletions
+168
-30
app/src/main/assets/fonts/futura_regular.ttf
+0
-0
app/src/main/assets/fonts/pingfang_jianti_regular.ttf
+0
-0
app/src/main/assets/fonts/vnarial.ttf
+0
-0
app/src/main/java/com/ihaoin/hooloo/device/HLApplication.java
+13
-1
app/src/main/java/com/ihaoin/hooloo/device/adapter/GoodsAdapter.java
+20
-5
app/src/main/java/com/ihaoin/hooloo/device/adapter/RecommendAdapter.java
+3
-5
app/src/main/java/com/ihaoin/hooloo/device/adapter/TrolleyAdapter.java
+15
-0
app/src/main/java/com/ihaoin/hooloo/device/network/HttpUtil.java
+2
-1
app/src/main/java/com/ihaoin/hooloo/device/util/JsonUtils.java
+11
-0
app/src/main/java/com/ihaoin/hooloo/device/util/Utils.java
+11
-0
app/src/main/java/com/ihaoin/hooloo/device/view/ConfirmOrderDialog.java
+1
-1
app/src/main/java/com/ihaoin/hooloo/device/view/GoodsDetailDialog.java
+55
-5
app/src/main/java/com/ihaoin/hooloo/device/view/LauncherActivity.java
+3
-2
app/src/main/java/com/ihaoin/hooloo/device/view/TrolleyView.java
+18
-1
app/src/main/res/layout/activity_launcher.xml
+2
-1
app/src/main/res/values-w1080dp/dimens.xml
+5
-4
app/src/main/res/values/dimens.xml
+3
-2
app/src/main/res/values/strings.xml
+1
-0
app/src/main/res/values/styles.xml
+1
-0
todo.md
+4
-2
No files found.
app/src/main/assets/fonts/futura_regular.ttf
0 → 100644
View file @
de720882
File added
app/src/main/assets/fonts/pingfang_jianti_regular.ttf
0 → 100644
View file @
de720882
File added
app/src/main/assets/fonts/vnarial.ttf
0 → 100644
View file @
de720882
File added
app/src/main/java/com/ihaoin/hooloo/device/HLApplication.java
View file @
de720882
package
com
.
ihaoin
.
hooloo
.
device
;
import
android.app.Application
;
import
android.graphics.Typeface
;
import
android.util.Log
;
import
com.ihaoin.hooloo.device.config.AppConfig
;
...
...
@@ -11,6 +12,7 @@ import com.ihaoin.hooloo.device.util.SharedPreferencesUtils;
import
com.ihaoin.hooloo.device.util.StringUtils
;
import
com.umeng.commonsdk.UMConfigure
;
import
java.lang.reflect.Field
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -21,6 +23,7 @@ public class HLApplication extends Application {
public
static
HLApplication
SELF
=
null
;
private
static
MainData
mainData
=
new
MainData
();
private
static
List
<
TrolleyGoods
>
TROLLEY_GOODS
=
new
ArrayList
<>();
public
static
MainData
getMainData
()
{
return
mainData
;
}
...
...
@@ -40,6 +43,15 @@ public class HLApplication extends Application {
UMConfigure
.
preInit
(
this
,
AppConfig
.
UMENG_APPKEY
,
AppConfig
.
UMENG_CHANNEL
);
UMConfigure
.
init
(
this
,
AppConfig
.
UMENG_APPKEY
,
AppConfig
.
UMENG_CHANNEL
,
0
,
null
);
try
{
Typeface
typefaceMonospace
=
Typeface
.
createFromAsset
(
getAssets
(),
"fonts/pingfang_jianti_regular.ttf"
);
Field
monospace
=
Typeface
.
class
.
getDeclaredField
(
"MONOSPACE"
);
monospace
.
setAccessible
(
true
);
monospace
.
set
(
null
,
typefaceMonospace
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
AppConfig
.
MACHINE_CODE
=
SharedPreferencesUtils
.
getMachineCode
(
this
);
JPushInterface
.
setDebugMode
(
true
);
...
...
@@ -57,7 +69,7 @@ public class HLApplication extends Application {
super
.
onTerminate
();
}
public
static
Integer
getCountOfOrder
()
{
public
static
Integer
getCountOfOrder
()
{
if
(
HLApplication
.
getMainData
()
==
null
||
HLApplication
.
getMainData
().
getCountOfOrder
()
==
null
)
{
return
9
;
}
...
...
app/src/main/java/com/ihaoin/hooloo/device/adapter/GoodsAdapter.java
View file @
de720882
...
...
@@ -2,6 +2,7 @@ package com.ihaoin.hooloo.device.adapter;
import
android.content.Context
;
import
android.graphics.Paint
;
import
android.graphics.Typeface
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -9,8 +10,6 @@ import android.widget.ImageView;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.bumptech.glide.load.resource.bitmap.RoundedCorners
;
import
com.bumptech.glide.request.RequestOptions
;
import
com.chad.library.adapter.base.BaseSectionQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.ihaoin.hooloo.device.R
;
...
...
@@ -54,6 +53,10 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
LinearLayout
layoutTag
=
helper
.
getView
(
R
.
id
.
layout_tags
);
layoutTag
.
removeAllViews
();
// TODO delete
goods
.
setTags
(
Arrays
.
asList
(
"一二"
,
"一二三四"
,
"一二三四五六七"
));
if
(
CollectionUtils
.
isEmpty
(
goods
.
getTags
()))
{
helper
.
setVisible
(
R
.
id
.
layout_tags
,
false
);
View
tagView
=
LayoutInflater
.
from
(
mContext
).
inflate
(
R
.
layout
.
item_tag
,
null
);
...
...
@@ -68,12 +71,13 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
}
ImageView
imgThumbnail
=
helper
.
getView
(
R
.
id
.
img_thumbnail
);
RoundedCorners
roundedCorners
=
new
RoundedCorners
(
5
);
RequestOptions
options
=
RequestOptions
.
bitmapTransform
(
roundedCorners
);
//
RoundedCorners roundedCorners = new RoundedCorners(5);
//
RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
if
(
goods
.
getPics
()
==
null
)
{
imgThumbnail
.
setImageDrawable
(
null
);
}
else
{
Utils
.
getGlide
(
mContext
).
load
(
Utils
.
getThumbnailUrl
(
goods
.
getPics
().
getThumbnail
())).
apply
(
options
).
into
(
imgThumbnail
);
// Utils.getGlide(mContext).load(Utils.getThumbnailUrl(goods.getPics().getThumbnail())).apply(options).into(imgThumbnail);
Utils
.
getGlide
(
mContext
).
load
(
Utils
.
getThumbnailUrl
(
goods
.
getPics
().
getThumbnail
())).
into
(
imgThumbnail
);
}
Sku
sku
=
Utils
.
getDefaultSku
(
goods
.
getSkus
());
...
...
@@ -127,6 +131,8 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
helper
.
setGone
(
R
.
id
.
img_recommend
,
false
);
}
TextView
icoDiscount
=
helper
.
getView
(
R
.
id
.
ico_discount
);
TextView
txtDiscount
=
helper
.
getView
(
R
.
id
.
txt_discount
);
TextView
icoPrice
=
helper
.
getView
(
R
.
id
.
ico_price
);
TextView
txtPrice
=
helper
.
getView
(
R
.
id
.
txt_price
);
icoPrice
.
setPaintFlags
(
icoPrice
.
getPaintFlags
()
|
Paint
.
STRIKE_THRU_TEXT_FLAG
);
...
...
@@ -143,6 +149,15 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
}
else
{
layoutItem
.
setPadding
(
0
,
verPadding
,
0
,
verPadding
);
}
Typeface
tfAmount
=
Utils
.
getAmountFont
(
mContext
);
icoDiscount
.
setTypeface
(
tfAmount
);
txtDiscount
.
setTypeface
(
tfAmount
);
icoPrice
.
setTypeface
(
tfAmount
);
txtPrice
.
setTypeface
(
tfAmount
);
icoDiscount
.
getPaint
().
setFakeBoldText
(
true
);
txtDiscount
.
getPaint
().
setFakeBoldText
(
true
);
}
private
boolean
trolleyState
=
false
;
...
...
app/src/main/java/com/ihaoin/hooloo/device/adapter/RecommendAdapter.java
View file @
de720882
...
...
@@ -4,8 +4,6 @@ import android.content.Context;
import
android.view.View
;
import
android.widget.ImageView
;
import
com.bumptech.glide.load.resource.bitmap.RoundedCorners
;
import
com.bumptech.glide.request.RequestOptions
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.ihaoin.hooloo.device.R
;
...
...
@@ -31,9 +29,9 @@ public class RecommendAdapter extends BaseQuickAdapter<ScrollBean, BaseViewHolde
helper
.
setText
(
R
.
id
.
txt_intro
,
recommend
.
getDesc
());
ImageView
imgRecommend
=
helper
.
getView
(
R
.
id
.
img_recommend
);
RoundedCorners
roundedCorners
=
new
RoundedCorners
(
5
);
RequestOptions
options
=
RequestOptions
.
bitmapTransform
(
roundedCorners
);
Utils
.
getGlide
(
mContext
).
load
(
recommend
.
getPic
()).
apply
(
options
).
into
(
imgRecommend
);
//
RoundedCorners roundedCorners = new RoundedCorners(5);
//
RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
Utils
.
getGlide
(
mContext
).
load
(
recommend
.
getPic
()).
into
(
imgRecommend
);
View
layoutItem
=
helper
.
getView
(
R
.
id
.
layout_item
);
layoutItem
.
setOnClickListener
(
v
->
{
...
...
app/src/main/java/com/ihaoin/hooloo/device/adapter/TrolleyAdapter.java
View file @
de720882
...
...
@@ -2,6 +2,7 @@ package com.ihaoin.hooloo.device.adapter;
import
android.content.Context
;
import
android.graphics.Paint
;
import
android.graphics.Typeface
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -45,6 +46,7 @@ public class TrolleyAdapter extends BaseAdapter {
TextView
txtOptions
=
convertView
.
findViewById
(
R
.
id
.
txt_options
);
TextView
icoPrice
=
convertView
.
findViewById
(
R
.
id
.
ico_price
);
TextView
txtPrice
=
convertView
.
findViewById
(
R
.
id
.
txt_price
);
TextView
icoDiscount
=
convertView
.
findViewById
(
R
.
id
.
ico_discount
);
TextView
txtDiscount
=
convertView
.
findViewById
(
R
.
id
.
txt_discount
);
View
butnSubtract
=
convertView
.
findViewById
(
R
.
id
.
butn_subtract
);
TextView
txtCount
=
convertView
.
findViewById
(
R
.
id
.
txt_count
);
...
...
@@ -93,6 +95,19 @@ public class TrolleyAdapter extends BaseAdapter {
ViewGroup
layoutItem
=
convertView
.
findViewById
(
R
.
id
.
layout_item
);
Utils
.
setTouchDelegate
(
layoutItem
,
Arrays
.
asList
(
butnAdd
,
butnSubtract
));
Typeface
tfAmount
=
Utils
.
getAmountFont
(
mContext
);
icoDiscount
.
setTypeface
(
tfAmount
);
txtDiscount
.
setTypeface
(
tfAmount
);
icoPrice
.
setTypeface
(
tfAmount
);
txtPrice
.
setTypeface
(
tfAmount
);
icoDiscount
.
getPaint
().
setFakeBoldText
(
true
);
txtDiscount
.
getPaint
().
setFakeBoldText
(
true
);
Typeface
tfHalf
=
Utils
.
getHalfFont
(
mContext
);
txtCount
.
setTypeface
(
tfHalf
);
txtCount
.
getPaint
().
setFakeBoldText
(
true
);
return
convertView
;
}
...
...
app/src/main/java/com/ihaoin/hooloo/device/network/HttpUtil.java
View file @
de720882
...
...
@@ -130,7 +130,8 @@ public class HttpUtil {
public
static
String
getMacAddress
()
{
try
{
if
(
AppConfig
.
DEBUG
)
{
if
(
AppConfig
.
DEBUG
)
{
// TODO delete
return
"SN0091290001"
;
}
List
<
NetworkInterface
>
all
=
Collections
.
list
(
NetworkInterface
.
getNetworkInterfaces
());
...
...
app/src/main/java/com/ihaoin/hooloo/device/util/JsonUtils.java
View file @
de720882
...
...
@@ -11,4 +11,15 @@ public class JsonUtils {
objectMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
return
objectMapper
;
}
public
static
<
T
>
T
readValue
(
Object
obj
,
Class
<
T
>
cls
)
{
try
{
if
(
obj
==
null
)
{
return
null
;
}
return
JsonUtils
.
getMapper
().
readValue
(
obj
.
toString
(),
cls
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
}
app/src/main/java/com/ihaoin/hooloo/device/util/Utils.java
View file @
de720882
...
...
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import
android.content.Context
;
import
android.content.Intent
;
import
android.graphics.Rect
;
import
android.graphics.Typeface
;
import
android.util.DisplayMetrics
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
...
...
@@ -201,4 +202,14 @@ public class Utils {
}
return
url
+
"?x-oss-process=image/resize,m_fill,h_100,w_100"
;
}
public
static
Typeface
getAmountFont
(
Context
context
)
{
return
Typeface
.
createFromAsset
(
context
.
getAssets
(),
"fonts/futura_regular.ttf"
);
}
public
static
Typeface
getHalfFont
(
Context
context
)
{
return
Typeface
.
createFromAsset
(
context
.
getAssets
(),
"fonts/vnarial.ttf"
);
}
}
app/src/main/java/com/ihaoin/hooloo/device/view/ConfirmOrderDialog.java
View file @
de720882
...
...
@@ -273,7 +273,7 @@ public class ConfirmOrderDialog extends Dialog {
}
String
id
=
obj
.
toString
();
id
=
AppConfig
.
MACHINE_CODE
;
//
id = AppConfig.MACHINE_CODE;
Bitmap
bitmap
=
genQRCode
(
id
);
imgQRCode
.
setImageBitmap
(
bitmap
);
startExpireThread
();
...
...
app/src/main/java/com/ihaoin/hooloo/device/view/GoodsDetailDialog.java
View file @
de720882
...
...
@@ -4,6 +4,7 @@ import android.app.Dialog;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.graphics.Paint
;
import
android.graphics.Typeface
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Message
;
...
...
@@ -19,6 +20,7 @@ import android.widget.TextView;
import
androidx.annotation.NonNull
;
import
androidx.viewpager.widget.ViewPager
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.ihaoin.hooloo.device.HLApplication
;
import
com.ihaoin.hooloo.device.R
;
import
com.ihaoin.hooloo.device.component.AutoWrapLayout
;
...
...
@@ -32,6 +34,7 @@ import com.ihaoin.hooloo.device.data.vo.Sku;
import
com.ihaoin.hooloo.device.data.vo.SkuRule
;
import
com.ihaoin.hooloo.device.network.HttpUtil
;
import
com.ihaoin.hooloo.device.util.CollectionUtils
;
import
com.ihaoin.hooloo.device.util.JsonUtils
;
import
com.ihaoin.hooloo.device.util.StringUtils
;
import
com.ihaoin.hooloo.device.util.Utils
;
...
...
@@ -54,8 +57,9 @@ public class GoodsDetailDialog extends Dialog {
private
TextView
txtName
;
private
LinearLayout
layoutSpecs
;
private
LinearLayout
layoutImages
;
private
TextView
icoPrice
;
private
TextView
txtPrice
;
private
TextView
ico
Pirce
;
private
TextView
ico
Discount
;
private
TextView
txtDiscount
;
private
Button
butnSubtract
;
private
TextView
txtCount
;
...
...
@@ -88,8 +92,9 @@ public class GoodsDetailDialog extends Dialog {
txtName
=
findViewById
(
R
.
id
.
txt_name
);
layoutSpecs
=
findViewById
(
R
.
id
.
layout_specs
);
layoutImages
=
findViewById
(
R
.
id
.
layout_images
);
icoP
ir
ce
=
findViewById
(
R
.
id
.
ico_price
);
icoP
ri
ce
=
findViewById
(
R
.
id
.
ico_price
);
txtPrice
=
findViewById
(
R
.
id
.
txt_price
);
icoDiscount
=
findViewById
(
R
.
id
.
ico_discount
);
txtDiscount
=
findViewById
(
R
.
id
.
txt_discount
);
butnSubtract
=
findViewById
(
R
.
id
.
butn_subtract
);
txtCount
=
findViewById
(
R
.
id
.
txt_count
);
...
...
@@ -97,6 +102,19 @@ public class GoodsDetailDialog extends Dialog {
butnBuy
=
findViewById
(
R
.
id
.
butn_buy
);
butnTrolley
=
findViewById
(
R
.
id
.
butn_trolley
);
Typeface
tfAmount
=
Utils
.
getAmountFont
(
getContext
());
icoDiscount
.
setTypeface
(
tfAmount
);
txtDiscount
.
setTypeface
(
tfAmount
);
icoPrice
.
setTypeface
(
tfAmount
);
txtPrice
.
setTypeface
(
tfAmount
);
icoDiscount
.
getPaint
().
setFakeBoldText
(
true
);
txtDiscount
.
getPaint
().
setFakeBoldText
(
true
);
Typeface
tfHalf
=
Utils
.
getHalfFont
(
getContext
());
txtCount
.
setTypeface
(
tfHalf
);
txtCount
.
getPaint
().
setFakeBoldText
(
true
);
butnClose
.
setOnClickListener
(
x
->
dismiss
());
introViews
=
new
ArrayList
<>();
...
...
@@ -158,7 +176,7 @@ public class GoodsDetailDialog extends Dialog {
butnSubtract
.
setOnClickListener
(
v
->
subtractCount
());
butnAdd
.
setOnClickListener
(
v
->
addCount
());
icoP
irce
.
setPaintFlags
(
icoPir
ce
.
getPaintFlags
()
|
Paint
.
STRIKE_THRU_TEXT_FLAG
);
icoP
rice
.
setPaintFlags
(
icoPri
ce
.
getPaintFlags
()
|
Paint
.
STRIKE_THRU_TEXT_FLAG
);
txtPrice
.
setPaintFlags
(
txtPrice
.
getPaintFlags
()
|
Paint
.
STRIKE_THRU_TEXT_FLAG
);
butnBuy
.
setOnClickListener
(
v
->
prepareBuyNow
());
...
...
@@ -270,18 +288,49 @@ public class GoodsDetailDialog extends Dialog {
@Override
public
void
handleMessage
(
@NonNull
Message
msg
)
{
super
.
handleMessage
(
msg
);
if
(
msg
.
what
!=
1
)
{
Object
obj
=
msg
.
obj
;
if
(
msg
.
what
!=
1
||
obj
==
null
)
{
Utils
.
showToast
(
getContext
(),
R
.
string
.
error_check_sku_wrong
);
return
;
}
JsonNode
rsp
=
JsonUtils
.
readValue
(
obj
,
JsonNode
.
class
);
Goods
rspGoods
=
JsonUtils
.
readValue
(
rsp
.
get
(
"goods"
).
toString
(),
Goods
.
class
);
if
(
rspGoods
==
null
)
{
Utils
.
showToast
(
getContext
(),
R
.
string
.
error_check_sku
);
showSelloutViews
();
return
;
}
// for (int i = 0; i < rspGoods.getSkus().size(); i++) {
// Sku s = rspGoods.getSkus().get(i);
// if (s.getSkuId().equals(2111) || s.getSkuId().equals(2112)) {
// continue;
// }
// s.setState(2);
// }
// if (true) {
if
(!
SkuState
.
SELLIN
.
getCode
().
equals
(
rsp
.
get
(
"state"
).
asInt
()))
{
Utils
.
showToast
(
getContext
(),
R
.
string
.
error_check_sku
);
setGoods
(
rspGoods
);
return
;
}
if
(
this
.
type
==
1
)
{
buyNow
(
goods
,
sku
,
count
);
}
else
{
addTrolley
(
goods
,
sku
,
count
);
}
setGoods
(
rspGoods
);
}
}
private
void
setGoods
(
Goods
rspGoods
)
{
this
.
mGoods
=
rspGoods
;
processSpecRules
();
buildSpecs
();
}
public
void
prepareBuyNow
()
{
if
(
mSku
==
null
)
{
Utils
.
showToast
(
getContext
(),
R
.
string
.
not_found_goods
);
...
...
@@ -296,7 +345,7 @@ public class GoodsDetailDialog extends Dialog {
Utils
.
showToast
(
getContext
(),
R
.
string
.
not_found_goods
);
return
;
}
if
(
mCount
+
HLApplication
.
getGoodsCount
()
>
=
HLApplication
.
getCountOfOrder
())
{
if
(
mCount
+
HLApplication
.
getGoodsCount
()
>
HLApplication
.
getCountOfOrder
())
{
Utils
.
showToast
(
this
.
getContext
(),
getContext
().
getString
(
R
.
string
.
count_limit
,
HLApplication
.
getCountOfOrder
().
toString
()));
return
;
}
...
...
@@ -332,6 +381,7 @@ public class GoodsDetailDialog extends Dialog {
}
private
void
buildSpecs
()
{
layoutSpecs
.
removeAllViews
();
if
(
CollectionUtils
.
isEmpty
(
mGoods
.
getSpecs
()))
{
return
;
}
...
...
app/src/main/java/com/ihaoin/hooloo/device/view/LauncherActivity.java
View file @
de720882
...
...
@@ -227,14 +227,15 @@ public class LauncherActivity extends Activity {
int
nextPosition
=
firstPosition
+
1
;
// 当前显示的下一个索引
if
(
nextPosition
<
scrollGoods
.
size
())
{
// 已经是最后一个item
if
(
scrollGoods
.
get
(
nextPosition
).
isHeader
)
{
// 下一个是否是标题
int
paddingTop
=
Utils
.
getDimens
(
mContext
,
R
.
dimen
.
goods_padding_top
);
View
nextView
=
goodsLayoutManager
.
findViewByPosition
(
nextPosition
);
// 下一个view
int
[]
location
=
new
int
[
2
];
nextView
.
getLocationInWindow
(
location
);
int
topMargin
=
location
[
1
];
int
topMargin
=
location
[
1
]
-
paddingTop
;
int
height
=
nextView
.
getHeight
();
// Log.d(AppConfig.TAG, String.format("c:%s, n:%s, 0:%s, 1:%s", firstPosition, nextPosition, rect[0], rect[1]));
if
(
topMargin
<
height
)
{
lp
.
setMargins
(
0
,
-(
height
-
topMargin
),
0
,
0
);
lp
.
setMargins
(
0
,
-(
height
-
topMargin
),
0
,
0
);
}
}
}
...
...
app/src/main/java/com/ihaoin/hooloo/device/view/TrolleyView.java
View file @
de720882
package
com
.
ihaoin
.
hooloo
.
device
.
view
;
import
android.content.Context
;
import
android.graphics.Typeface
;
import
android.os.Message
;
import
android.util.AttributeSet
;
import
android.view.LayoutInflater
;
...
...
@@ -14,15 +15,18 @@ import android.widget.TextView;
import
androidx.annotation.NonNull
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.ihaoin.hooloo.device.HLApplication
;
import
com.ihaoin.hooloo.device.R
;
import
com.ihaoin.hooloo.device.adapter.TrolleyAdapter
;
import
com.ihaoin.hooloo.device.component.NetworkHandler
;
import
com.ihaoin.hooloo.device.config.Base
;
import
com.ihaoin.hooloo.device.data.TrolleyGoods
;
import
com.ihaoin.hooloo.device.data.enums.SkuState
;
import
com.ihaoin.hooloo.device.data.vo.Goods
;
import
com.ihaoin.hooloo.device.data.vo.Sku
;
import
com.ihaoin.hooloo.device.network.HttpUtil
;
import
com.ihaoin.hooloo.device.util.JsonUtils
;
import
com.ihaoin.hooloo.device.util.RandomUtils
;
import
com.ihaoin.hooloo.device.util.Utils
;
...
...
@@ -66,6 +70,12 @@ public class TrolleyView extends RelativeLayout {
viewBackground
.
setOnClickListener
(
v
->
closeTrolley
());
butnPay
.
setOnClickListener
(
v
->
showPayDialog
());
Typeface
tfHalf
=
Utils
.
getHalfFont
(
getContext
());
txtCount
.
setTypeface
(
tfHalf
);
txtTotal
.
setTypeface
(
tfHalf
);
txtCount
.
getPaint
().
setFakeBoldText
(
true
);
txtTotal
.
getPaint
().
setFakeBoldText
(
true
);
}
public
void
prepareAddGoods
(
Goods
goods
,
Sku
sku
,
Integer
count
)
{
...
...
@@ -88,7 +98,14 @@ public class TrolleyView extends RelativeLayout {
@Override
public
void
handleMessage
(
@NonNull
Message
msg
)
{
super
.
handleMessage
(
msg
);
if
(
msg
.
what
!=
1
)
{
Object
obj
=
msg
.
obj
;
if
(
msg
.
what
!=
1
||
obj
==
null
)
{
Utils
.
showToast
(
getContext
(),
R
.
string
.
error_check_sku_wrong
);
return
;
}
JsonNode
rsp
=
JsonUtils
.
readValue
(
obj
,
JsonNode
.
class
);
if
(!
SkuState
.
SELLIN
.
getCode
().
equals
(
rsp
.
get
(
"state"
).
asInt
()))
{
Utils
.
showToast
(
getContext
(),
R
.
string
.
error_check_sku
);
return
;
}
...
...
app/src/main/res/layout/activity_launcher.xml
View file @
de720882
...
...
@@ -24,7 +24,8 @@
<FrameLayout
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"0.30833"
>
android:layout_weight=
"0.30833"
android:paddingTop=
"@dimen/goods_padding_top"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rec_right"
android:layout_width=
"match_parent"
...
...
app/src/main/res/values-w1080dp/dimens.xml
View file @
de720882
...
...
@@ -15,6 +15,7 @@
<dimen
name=
"recommend_desc_margin_top"
>
18px
</dimen>
<dimen
name=
"recommend_desc_margin_left"
>
68px
</dimen>
<dimen
name=
"goods_padding_top"
>
30px
</dimen>
<dimen
name=
"goods_padding_ver"
>
30px
</dimen>
<dimen
name=
"goods_padding_right"
>
38px
</dimen>
<dimen
name=
"goods_last_padding_bottom"
>
300px
</dimen>
...
...
@@ -23,9 +24,9 @@
<dimen
name=
"goods_recommend_margin"
>
30px
</dimen>
<dimen
name=
"goods_category_margin_top"
>
13px
</dimen>
<dimen
name=
"goods_tag_margin_top"
>
13px
</dimen>
<dimen
name=
"goods_tag_padding_ver"
>
3
px
</dimen>
<dimen
name=
"goods_tag_padding_hor"
>
9
px
</dimen>
<dimen
name=
"goods_tag_margin_right"
>
1
6
px
</dimen>
<dimen
name=
"goods_tag_padding_ver"
>
0
px
</dimen>
<dimen
name=
"goods_tag_padding_hor"
>
5
px
</dimen>
<dimen
name=
"goods_tag_margin_right"
>
1
5
px
</dimen>
<dimen
name=
"goods_desc_margin_top"
>
26px
</dimen>
<dimen
name=
"goods_butns_margin_top"
>
25px
</dimen>
<dimen
name=
"goods_price_margin"
>
5px
</dimen>
...
...
@@ -54,7 +55,7 @@
<dimen
name=
"goods_detail_rule_width"
>
148px
</dimen>
<dimen
name=
"goods_detail_rule_margin_top"
>
16px
</dimen>
<dimen
name=
"goods_detail_rule_margin_right"
>
28px
</dimen>
<dimen
name=
"goods_detail_rule_padding_hor"
>
6
0px
</dimen>
<dimen
name=
"goods_detail_rule_padding_hor"
>
3
0px
</dimen>
<dimen
name=
"goods_detail_rule_padding_ver"
>
10px
</dimen>
<dimen
name=
"goods_detail_layout_rule_margin_top"
>
17px
</dimen>
<dimen
name=
"goods_detail_rec_padding_hor"
>
12px
</dimen>
...
...
app/src/main/res/values/dimens.xml
View file @
de720882
...
...
@@ -15,6 +15,7 @@
<dimen
name=
"recommend_desc_margin_top"
>
30px
</dimen>
<dimen
name=
"recommend_desc_margin_left"
>
68px
</dimen>
<dimen
name=
"goods_padding_top"
>
60px
</dimen>
<dimen
name=
"goods_padding_ver"
>
30px
</dimen>
<dimen
name=
"goods_padding_right"
>
38px
</dimen>
<dimen
name=
"goods_last_padding_bottom"
>
400px
</dimen>
...
...
@@ -23,8 +24,8 @@
<dimen
name=
"goods_recommend_margin"
>
5dp
</dimen>
<dimen
name=
"goods_category_margin_top"
>
10dp
</dimen>
<dimen
name=
"goods_tag_margin_top"
>
3dp
</dimen>
<dimen
name=
"goods_tag_padding_ver"
>
3
px
</dimen>
<dimen
name=
"goods_tag_padding_hor"
>
9
px
</dimen>
<dimen
name=
"goods_tag_padding_ver"
>
2
px
</dimen>
<dimen
name=
"goods_tag_padding_hor"
>
10
px
</dimen>
<dimen
name=
"goods_tag_margin_right"
>
16px
</dimen>
<dimen
name=
"goods_desc_margin_top"
>
26px
</dimen>
<dimen
name=
"goods_butns_margin_top"
>
25px
</dimen>
...
...
app/src/main/res/values/strings.xml
View file @
de720882
...
...
@@ -12,5 +12,6 @@
<string
name=
"error_price"
>
商品金额错误
</string>
<string
name=
"error_sku_state"
>
本商品已售罄或已经下架
</string>
<string
name=
"error_load_main_data"
>
获取数据失败
</string>
<string
name=
"error_check_sku_wrong"
>
商品状态错误
</string>
<string
name=
"error_check_sku"
>
商品已售罄
</string>
</resources>
app/src/main/res/values/styles.xml
View file @
de720882
<resources>
<style
name=
"AppTheme"
parent=
"Theme.AppCompat.Light.DarkActionBar"
>
<item
name=
"android:typeface"
>
monospace
</item>
</style>
<style
name=
"button_style"
parent=
"Widget.AppCompat.Button.Borderless"
>
</style>
...
...
todo.md
View file @
de720882
## 未解决事项 TODO
*****
\ No newline at end of file
*****
1、设置字体 购物袋总数量,购物袋item数量,商品详情数量
2、设置字体 购物袋总金额
\ 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