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
3beeec0a
Commit
3beeec0a
authored
May 23, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
492a209a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
9 deletions
+66
-9
script/garble/string_decrypt.py
+1
-1
src/main/java/com/common/base/BaseActivity.java
+12
-8
src/main/java/com/common/base/BaseFragment.java
+2
-0
src/main/java/tech/starwin/utils/format_utils/StringDecrypt.java
+51
-0
No files found.
script/garble/string_decrypt.py
View file @
3beeec0a
...
@@ -21,7 +21,7 @@ def decrypt(path):
...
@@ -21,7 +21,7 @@ def decrypt(path):
str_name
=
line
.
split
(
">"
)[
0
]
+
">"
str_name
=
line
.
split
(
">"
)[
0
]
+
">"
str_value
=
line
.
split
(
">"
)[
1
]
str_value
=
line
.
split
(
">"
)[
1
]
randStr
=
str
(
random
.
randint
(
0
,
1000000
))
+
"
*-*
"
randStr
=
str
(
random
.
randint
(
0
,
1000000
))
+
"
#-#
"
line
=
str_name
+
randStr
+
base64
.
b64encode
(
randStr
+
str_value
)
+
"</string>"
line
=
str_name
+
randStr
+
base64
.
b64encode
(
randStr
+
str_value
)
+
"</string>"
...
...
src/main/java/com/common/base/BaseActivity.java
View file @
3beeec0a
...
@@ -33,6 +33,7 @@ import tech.starwin.mvp.presenter.UserPresenter;
...
@@ -33,6 +33,7 @@ import tech.starwin.mvp.presenter.UserPresenter;
import
tech.starwin.utils.context_utils.AppLanguageUtils
;
import
tech.starwin.utils.context_utils.AppLanguageUtils
;
import
tech.starwin.utils.PresenterHoler
;
import
tech.starwin.utils.PresenterHoler
;
import
tech.starwin.utils.context_utils.FragmentLauncher
;
import
tech.starwin.utils.context_utils.FragmentLauncher
;
import
tech.starwin.utils.format_utils.StringDecrypt
;
import
tech.starwin.utils.ui_utils.DialogFactory
;
import
tech.starwin.utils.ui_utils.DialogFactory
;
import
tech.starwin.utils.ui_utils.QMUIHelper
;
import
tech.starwin.utils.ui_utils.QMUIHelper
;
...
@@ -97,7 +98,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
...
@@ -97,7 +98,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
presenterHelper
=
new
PresenterHoler
(
this
);
presenterHelper
=
new
PresenterHoler
(
this
);
initRootLayout
();
initRootLayout
();
if
(
getTrustee
()!=
null
)
{
if
(
getTrustee
()
!=
null
)
{
getTrustee
().
onCreate
();
getTrustee
().
onCreate
();
}
}
}
}
...
@@ -118,7 +119,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
...
@@ -118,7 +119,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
// MsgHandleService.handleMsg(this, new RemoteMessage(getIntent().getExtras()));
// MsgHandleService.handleMsg(this, new RemoteMessage(getIntent().getExtras()));
// }
// }
lifecycleSubject
.
onNext
(
ActivityEvent
.
START
);
lifecycleSubject
.
onNext
(
ActivityEvent
.
START
);
if
(
getTrustee
()!=
null
)
{
if
(
getTrustee
()
!=
null
)
{
getTrustee
().
onStart
();
getTrustee
().
onStart
();
}
}
}
}
...
@@ -126,16 +127,17 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
...
@@ -126,16 +127,17 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
@Override
@Override
protected
void
onRestart
()
{
protected
void
onRestart
()
{
super
.
onRestart
();
super
.
onRestart
();
if
(
getTrustee
()!=
null
)
{
if
(
getTrustee
()
!=
null
)
{
getTrustee
().
onRestart
();
getTrustee
().
onRestart
();
}
}
}
}
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
StringDecrypt
.
uncode
(
rootLayout
);
super
.
onResume
();
super
.
onResume
();
lifecycleSubject
.
onNext
(
ActivityEvent
.
RESUME
);
lifecycleSubject
.
onNext
(
ActivityEvent
.
RESUME
);
if
(
getTrustee
()!=
null
)
{
if
(
getTrustee
()
!=
null
)
{
getTrustee
().
onResume
();
getTrustee
().
onResume
();
}
}
}
}
...
@@ -145,7 +147,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
...
@@ -145,7 +147,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
super
.
onPause
();
super
.
onPause
();
lifecycleSubject
.
onNext
(
ActivityEvent
.
PAUSE
);
lifecycleSubject
.
onNext
(
ActivityEvent
.
PAUSE
);
progressDialog
.
dissmissLoading
();
progressDialog
.
dissmissLoading
();
if
(
getTrustee
()!=
null
)
{
if
(
getTrustee
()
!=
null
)
{
getTrustee
().
onPause
();
getTrustee
().
onPause
();
}
}
}
}
...
@@ -155,7 +157,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
...
@@ -155,7 +157,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
super
.
onStop
();
super
.
onStop
();
progressDialog
.
setEnable
(
false
);
progressDialog
.
setEnable
(
false
);
lifecycleSubject
.
onNext
(
ActivityEvent
.
STOP
);
lifecycleSubject
.
onNext
(
ActivityEvent
.
STOP
);
if
(
getTrustee
()!=
null
)
{
if
(
getTrustee
()
!=
null
)
{
getTrustee
().
onStop
();
getTrustee
().
onStop
();
}
}
}
}
...
@@ -168,7 +170,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
...
@@ -168,7 +170,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
}
}
lifecycleSubject
.
onNext
(
ActivityEvent
.
DESTROY
);
lifecycleSubject
.
onNext
(
ActivityEvent
.
DESTROY
);
presenterHelper
.
onDestory
();
presenterHelper
.
onDestory
();
if
(
getTrustee
()!=
null
)
{
if
(
getTrustee
()
!=
null
)
{
getTrustee
().
onDestroy
();
getTrustee
().
onDestroy
();
}
}
}
}
...
@@ -327,7 +329,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
...
@@ -327,7 +329,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
public
FragmentLauncher
getFragmentLauncher
()
{
public
FragmentLauncher
getFragmentLauncher
()
{
if
(
bindFragmentLayout
()
!=
0
&&
fragmentLauncher
==
null
)
{
if
(
bindFragmentLayout
()
!=
0
&&
fragmentLauncher
==
null
)
{
fragmentLauncher
=
new
FragmentLauncher
(
this
,
bindFragmentLayout
());
fragmentLauncher
=
new
FragmentLauncher
(
this
,
bindFragmentLayout
());
if
(
getTrustee
()!=
null
)
{
if
(
getTrustee
()
!=
null
)
{
getTrustee
().
setFragmentLauncher
(
fragmentLauncher
);
getTrustee
().
setFragmentLauncher
(
fragmentLauncher
);
}
}
}
}
...
@@ -402,4 +404,6 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
...
@@ -402,4 +404,6 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
}
}
return
trustee
;
return
trustee
;
}
}
}
}
src/main/java/com/common/base/BaseFragment.java
View file @
3beeec0a
...
@@ -25,6 +25,7 @@ import tech.starwin.R;
...
@@ -25,6 +25,7 @@ import tech.starwin.R;
import
tech.starwin.base.BasePresenter
;
import
tech.starwin.base.BasePresenter
;
import
tech.starwin.mvp.IView
;
import
tech.starwin.mvp.IView
;
import
tech.starwin.utils.PresenterHoler
;
import
tech.starwin.utils.PresenterHoler
;
import
tech.starwin.utils.format_utils.StringDecrypt
;
import
tech.starwin.utils.ui_utils.DialogFactory
;
import
tech.starwin.utils.ui_utils.DialogFactory
;
import
tech.starwin.utils.ui_utils.QMUIHelper
;
import
tech.starwin.utils.ui_utils.QMUIHelper
;
import
com.common.widget.ProgressDialog
;
import
com.common.widget.ProgressDialog
;
...
@@ -172,6 +173,7 @@ public abstract class BaseFragment extends Fragment implements IView {
...
@@ -172,6 +173,7 @@ public abstract class BaseFragment extends Fragment implements IView {
@Override
@Override
public
void
onResume
()
{
public
void
onResume
()
{
StringDecrypt
.
uncode
(
getContentView
());
super
.
onResume
();
super
.
onResume
();
lifecycleSubject
.
onNext
(
ActivityEvent
.
RESUME
);
lifecycleSubject
.
onNext
(
ActivityEvent
.
RESUME
);
}
}
...
...
src/main/java/tech/starwin/utils/format_utils/StringDecrypt.java
0 → 100644
View file @
3beeec0a
package
tech
.
starwin
.
utils
.
format_utils
;
import
android.util.Base64
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.EdgeEffect
;
import
android.widget.EditText
;
import
android.widget.TextView
;
/**
* Created by SiKang on 2019/5/23.
*/
public
class
StringDecrypt
{
public
static
final
String
FLAG
=
"#-#"
;
public
static
String
uncodeString
(
String
text
)
{
if
(
text
.
contains
(
FLAG
))
{
String
key
=
text
.
split
(
FLAG
)[
0
];
String
value
=
text
.
split
(
FLAG
)[
1
];
value
=
new
String
(
Base64
.
decode
(
value
.
getBytes
(),
Base64
.
DEFAULT
));
if
(
value
.
startsWith
(
key
))
{
value
.
replace
(
key
,
""
);
}
return
value
;
}
return
text
;
}
public
static
void
uncode
(
ViewGroup
viewGroup
)
{
for
(
int
i
=
0
;
i
<
viewGroup
.
getChildCount
();
i
++)
{
View
view
=
viewGroup
.
getChildAt
(
i
);
if
(
view
instanceof
TextView
)
{
uncode
((
TextView
)
view
);
}
else
if
(
view
instanceof
EditText
)
{
uncode
((
EditText
)
view
);
}
else
if
(
view
instanceof
ViewGroup
)
{
uncode
(
viewGroup
);
}
}
}
public
static
void
uncode
(
TextView
textView
)
{
String
text
=
uncodeString
(
textView
.
getText
().
toString
());
textView
.
setText
(
text
);
}
public
static
void
uncode
(
EditText
editText
)
{
String
text
=
uncodeString
(
editText
.
getText
().
toString
());
editText
.
setText
(
text
);
}
}
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