Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
lib_base
Commits
e53edaca
Commit
e53edaca
authored
Jul 04, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
6b14a257
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
11 deletions
+30
-11
src/main/java/tech/starwin/utils/format_utils/StringDecrypt.java
+30
-11
No files found.
src/main/java/tech/starwin/utils/format_utils/StringDecrypt.java
View file @
e53edaca
package
tech
.
starwin
.
utils
.
format_utils
;
package
tech
.
starwin
.
utils
.
format_utils
;
import
android.app.Activity
;
import
android.util.Base64
;
import
android.util.Base64
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.EdgeEffect
;
import
android.widget.EdgeEffect
;
...
@@ -16,31 +18,48 @@ public class StringDecrypt {
...
@@ -16,31 +18,48 @@ public class StringDecrypt {
public
static
final
String
FLAG
=
"#-#"
;
public
static
final
String
FLAG
=
"#-#"
;
public
static
String
uncodeString
(
String
text
)
{
public
static
String
uncodeString
(
String
text
)
{
try
{
if
(
text
.
contains
(
FLAG
))
{
if
(
text
.
contains
(
FLAG
))
{
String
key
=
text
.
split
(
FLAG
)[
0
];
String
key
=
text
.
split
(
FLAG
)[
0
];
String
value
=
text
.
split
(
FLAG
)[
1
];
String
value
=
text
.
split
(
FLAG
)[
1
];
value
=
new
String
(
Base64
.
decode
(
value
.
getBytes
(),
Base64
.
DEFAULT
));
value
=
new
String
(
Base64
.
decode
(
value
.
getBytes
(),
Base64
.
DEFAULT
));
if
(
value
.
startsWith
(
key
))
{
if
(
value
.
startsWith
(
key
))
{
value
.
replace
(
key
,
""
);
value
=
value
.
replace
(
key
+
"#-#"
,
""
);
}
}
return
value
;
return
value
;
}
}
}
catch
(
Exception
e
)
{
Log
.
d
(
"StringDecrypt"
,
text
);
}
return
text
;
return
text
;
}
}
public
static
void
uncode
(
ViewGroup
viewGroup
)
{
Stack
stack
=
new
Stack
();
public
static
void
encode
(
Activity
activity
)
{
for
(
int
i
=
0
;
i
<
viewGroup
.
getChildCount
();
i
++)
{
View
rootView
=
((
ViewGroup
)
activity
.
findViewById
(
android
.
R
.
id
.
content
)).
getChildAt
(
0
);
encode
((
ViewGroup
)
rootView
);
}
public
static
void
encode
(
ViewGroup
viewGroup
)
{
try
{
int
count
=
viewGroup
.
getChildCount
();
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
View
view
=
viewGroup
.
getChildAt
(
i
);
View
view
=
viewGroup
.
getChildAt
(
i
);
if
(
view
instanceof
TextView
)
{
if
(
view
instanceof
ViewGroup
)
{
uncode
((
TextView
)
view
);
encode
((
ViewGroup
)
view
);
}
else
if
(
view
instanceof
EditText
)
{
}
else
if
(
view
instanceof
TextView
)
{
uncode
((
EditText
)
view
);
TextView
textView
=
(
TextView
)
view
;
}
else
if
(
view
instanceof
ViewGroup
)
{
String
text
=
StringDecrypt
.
uncodeString
(
textView
.
getText
().
toString
());
stack
.
push
(
viewGroup
);
textView
.
setText
(
text
);
if
(
textView
.
getHint
()
!=
null
)
{
String
hint
=
StringDecrypt
.
uncodeString
(
textView
.
getHint
().
toString
());
textView
.
setHint
(
hint
);
}
}
}
}
}
}
catch
(
Exception
e
)
{
Log
.
e
(
"StringDecrypt"
,
"can not update View!"
);
}
}
}
public
static
void
uncode
(
TextView
textView
)
{
public
static
void
uncode
(
TextView
textView
)
{
...
...
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