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
9742797d
Commit
9742797d
authored
Oct 12, 2022
by
maxiaoliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改弹窗文案
parent
bab043c5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
7 deletions
+109
-7
HtmlTagHandler.java
cms/src/main/java/com/zxhl/cms/utils/HtmlTagHandler.java
+98
-0
DialogUtils.kt
...ain/src/main/java/com/zxbw/modulemain/view/DialogUtils.kt
+7
-4
dialog_layout_recharge_tips.xml
...eMain/src/main/res/layout/dialog_layout_recharge_tips.xml
+4
-3
No files found.
cms/src/main/java/com/zxhl/cms/utils/HtmlTagHandler.java
0 → 100644
View file @
9742797d
package
com
.
zxhl
.
cms
.
utils
;
import
android.graphics.Color
;
import
android.text.Editable
;
import
android.text.Html
;
import
android.text.Spanned
;
import
android.text.TextUtils
;
import
android.text.style.AbsoluteSizeSpan
;
import
android.text.style.ForegroundColorSpan
;
import
org.xml.sax.XMLReader
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
public
class
HtmlTagHandler
implements
Html
.
TagHandler
{
// 自定义标签名称
private
String
tagName
;
// 标签开始索引
private
int
startIndex
=
0
;
// 标签结束索引
private
int
endIndex
=
0
;
// 存放标签所有属性键值对
final
HashMap
<
String
,
String
>
attributes
=
new
HashMap
<>();
public
HtmlTagHandler
(
String
tagName
)
{
this
.
tagName
=
tagName
;
}
@Override
public
void
handleTag
(
boolean
opening
,
String
tag
,
Editable
output
,
XMLReader
xmlReader
)
{
// 判断是否是当前需要的tag
if
(
tag
.
equalsIgnoreCase
(
tagName
))
{
// 解析所有属性值
parseAttributes
(
xmlReader
);
if
(
opening
)
{
startHandleTag
(
tag
,
output
,
xmlReader
);
}
else
{
endEndHandleTag
(
tag
,
output
,
xmlReader
);
}
}
}
public
void
startHandleTag
(
String
tag
,
Editable
output
,
XMLReader
xmlReader
)
{
startIndex
=
output
.
length
();
}
public
void
endEndHandleTag
(
String
tag
,
Editable
output
,
XMLReader
xmlReader
)
{
endIndex
=
output
.
length
();
// 获取对应的属性值
String
color
=
attributes
.
get
(
"color"
);
String
size
=
attributes
.
get
(
"size"
);
size
=
size
.
split
(
"px"
)[
0
];
// 设置颜色
if
(!
TextUtils
.
isEmpty
(
color
))
{
output
.
setSpan
(
new
ForegroundColorSpan
(
Color
.
parseColor
(
color
)),
startIndex
,
endIndex
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
}
// 设置字体大小
if
(!
TextUtils
.
isEmpty
(
size
))
{
output
.
setSpan
(
new
AbsoluteSizeSpan
(
Integer
.
parseInt
(
size
)),
startIndex
,
endIndex
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
}
}
/**
* 解析所有属性值
*
* @param xmlReader
*/
private
void
parseAttributes
(
final
XMLReader
xmlReader
)
{
try
{
Field
elementField
=
xmlReader
.
getClass
().
getDeclaredField
(
"theNewElement"
);
elementField
.
setAccessible
(
true
);
Object
element
=
elementField
.
get
(
xmlReader
);
Field
attsField
=
element
.
getClass
().
getDeclaredField
(
"theAtts"
);
attsField
.
setAccessible
(
true
);
Object
atts
=
attsField
.
get
(
element
);
Field
dataField
=
atts
.
getClass
().
getDeclaredField
(
"data"
);
dataField
.
setAccessible
(
true
);
String
[]
data
=
(
String
[])
dataField
.
get
(
atts
);
Field
lengthField
=
atts
.
getClass
().
getDeclaredField
(
"length"
);
lengthField
.
setAccessible
(
true
);
int
len
=
(
Integer
)
lengthField
.
get
(
atts
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
attributes
.
put
(
data
[
i
*
5
+
1
],
data
[
i
*
5
+
4
]);
}
}
catch
(
Exception
e
)
{
}
}
}
\ No newline at end of file
moduleMain/src/main/java/com/zxbw/modulemain/view/DialogUtils.kt
View file @
9742797d
...
@@ -8,6 +8,7 @@ import android.app.Activity
...
@@ -8,6 +8,7 @@ import android.app.Activity
import
android.app.Dialog
import
android.app.Dialog
import
android.content.Context
import
android.content.Context
import
android.graphics.Color
import
android.graphics.Color
import
android.text.Html
import
android.view.Gravity
import
android.view.Gravity
import
android.view.View
import
android.view.View
import
android.view.animation.AccelerateInterpolator
import
android.view.animation.AccelerateInterpolator
...
@@ -25,10 +26,7 @@ import com.zxbw.modulemain.box.adapter.SelectBoxAdapter
...
@@ -25,10 +26,7 @@ import com.zxbw.modulemain.box.adapter.SelectBoxAdapter
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.net.SettingPreference
import
com.zxhl.cms.net.SettingPreference
import
com.zxhl.cms.net.model.qy.CouponsEntity
import
com.zxhl.cms.net.model.qy.CouponsEntity
import
com.zxhl.cms.utils.AdCallback
import
com.zxhl.cms.utils.*
import
com.zxhl.cms.utils.EventUtils
import
com.zxhl.cms.utils.PhoneUtils
import
com.zxhl.cms.utils.Utils
object
DialogUtils
{
object
DialogUtils
{
...
@@ -401,7 +399,12 @@ object DialogUtils {
...
@@ -401,7 +399,12 @@ object DialogUtils {
0
,
0
,
Gravity
.
CENTER
Gravity
.
CENTER
)
)
val
text
=
"<b><myfont size=80>携号转网</myfont></b>"
+
"号码请勿提交充值,提交"
+
"<b><myfont size=80>不能售后</myfont></b>"
+
"<br>"
+
"话费充值成功售后期"
+
"<b><myfont size=80>7天</myfont></b>"
+
",请及时查看账单,超时"
+
"<b><myfont size=80>不能售后</myfont></b></br>"
mDialogView
.
findViewById
<
TextView
>(
R
.
id
.
id_tv_phone
).
text
=
"本次充值号码为:${phone}"
mDialogView
.
findViewById
<
TextView
>(
R
.
id
.
id_tv_phone
).
text
=
"本次充值号码为:${phone}"
mDialogView
.
findViewById
<
TextView
>(
R
.
id
.
id_tv_dialog_content_trip
).
text
=
Html
.
fromHtml
(
text
,
null
,
HtmlTagHandler
(
"myfont"
))
// mDialogView.findViewById<TextView>(R.id.id_tv_dialog_content_trip).text = Html.fromHtml("<b><font size='40px'>携号转网</font></b>" + "<font size='20px'>号码请勿提交充值,提交不能售后</font>" + "<br>" + "话费充值成功售后期" + "<b><font size=24>7天</font></b>" + ",请及时查看账单,超时不能售后" + "</br>")
mDialogView
.
findViewById
<
TextView
>(
R
.
id
.
id_btn_ok
).
setOnClickListener
{
mDialogView
.
findViewById
<
TextView
>(
R
.
id
.
id_btn_ok
).
setOnClickListener
{
mDialog
.
dismiss
()
mDialog
.
dismiss
()
makeSureListener
.
onClick
(
it
)
makeSureListener
.
onClick
(
it
)
...
...
moduleMain/src/main/res/layout/dialog_layout_recharge_tips.xml
View file @
9742797d
...
@@ -23,14 +23,15 @@
...
@@ -23,14 +23,15 @@
android:textSize=
"18sp"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
<TextView
<TextView
android:id=
"@+id/id_tv_dialog_content_trip"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:layout_marginTop=
"10dp"
android:textSize=
"16sp"
android:textColor=
"@color/color_ff282a"
android:textColor=
"@color/color_ff282a"
android:textSize=
"18sp"
android:visibility=
"visible"
/>
android:textStyle=
"bold"
android:text=
"携号转网号码、虚拟号段号码以及副号、空号、合账号、集团号、公司号无法充值,请勿提交,提交不能售后"
/>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
...
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