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
e844d0f6
Commit
e844d0f6
authored
Jul 04, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字符串加密
parent
0e9206d9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
5 deletions
+47
-5
build.gradle
+5
-0
script/garble/string_decrypt.py
+2
-2
script/script_help.sh
+2
-2
src/main/java/com/common/base/BaseActivity.java
+5
-1
src/main/java/com/common/base/BaseApplication.java
+33
-0
No files found.
build.gradle
View file @
e844d0f6
...
@@ -51,6 +51,11 @@ dependencies {
...
@@ -51,6 +51,11 @@ dependencies {
// multidex
// multidex
api
'com.android.support:multidex:1.0.3'
api
'com.android.support:multidex:1.0.3'
// 字符串资源替换
implementation
'com.jcminarro:Philology:1.0.1'
implementation
'io.github.inflationx:viewpump:1.0.0'
//support包
//support包
//noinspection GradleCompatible
//noinspection GradleCompatible
api
"com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
api
"com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
...
...
script/garble/string_decrypt.py
View file @
e844d0f6
...
@@ -16,8 +16,8 @@ def decrypt(path):
...
@@ -16,8 +16,8 @@ def decrypt(path):
with
open
(
path
,
"w"
)
as
f_w
:
with
open
(
path
,
"w"
)
as
f_w
:
for
line
in
lines
:
for
line
in
lines
:
if
"<string"
in
line
and
"</string>"
in
line
and
"<!"
:
not
in
line
if
"<string"
in
line
and
"</string>
\n
"
in
line
and
"<!"
:
not
in
line
line
=
line
.
replace
(
"</string>"
,
""
)
line
=
line
.
replace
(
"</string>
\n
"
,
""
)
str_name
=
line
.
split
(
">"
)[
0
]
+
">"
str_name
=
line
.
split
(
">"
)[
0
]
+
">"
str_value
=
line
.
split
(
">"
)[
1
]
str_value
=
line
.
split
(
">"
)[
1
]
...
...
script/script_help.sh
View file @
e844d0f6
...
@@ -188,8 +188,8 @@ then
...
@@ -188,8 +188,8 @@ then
elif
((
$commod
==
'23'
))
elif
((
$commod
==
'23'
))
then
then
cd
garble
cd
garble
#
chmod a+x string_decrypt.py
chmod a+x string_decrypt.py
#
python string_decrypt.py
python string_decrypt.py
elif
((
$commod
==
'24'
))
elif
((
$commod
==
'24'
))
then
then
...
...
src/main/java/com/common/base/BaseActivity.java
View file @
e844d0f6
...
@@ -15,12 +15,14 @@ import android.view.LayoutInflater;
...
@@ -15,12 +15,14 @@ import android.view.LayoutInflater;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.FrameLayout
;
import
android.widget.FrameLayout
;
import
com.jcminarro.philology.Philology
;
import
com.qmuiteam.qmui.util.QMUIStatusBarHelper
;
import
com.qmuiteam.qmui.util.QMUIStatusBarHelper
;
import
com.trello.rxlifecycle2.LifecycleTransformer
;
import
com.trello.rxlifecycle2.LifecycleTransformer
;
import
com.trello.rxlifecycle2.RxLifecycle
;
import
com.trello.rxlifecycle2.RxLifecycle
;
import
com.trello.rxlifecycle2.android.ActivityEvent
;
import
com.trello.rxlifecycle2.android.ActivityEvent
;
import
com.trello.rxlifecycle2.android.RxLifecycleAndroid
;
import
com.trello.rxlifecycle2.android.RxLifecycleAndroid
;
import
io.github.inflationx.viewpump.ViewPumpContextWrapper
;
import
io.reactivex.Observable
;
import
io.reactivex.Observable
;
import
io.reactivex.subjects.BehaviorSubject
;
import
io.reactivex.subjects.BehaviorSubject
;
import
tech.starwin.LibConfig
;
import
tech.starwin.LibConfig
;
...
@@ -85,7 +87,9 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
...
@@ -85,7 +87,9 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
@Override
@Override
protected
void
attachBaseContext
(
Context
newBase
)
{
protected
void
attachBaseContext
(
Context
newBase
)
{
super
.
attachBaseContext
(
AppLanguageUtils
.
attachBaseContext
(
newBase
,
LibConfig
.
LANGUAGE
));
// super.attachBaseContext(AppLanguageUtils.attachBaseContext(newBase, LibConfig.LANGUAGE));
Context
languageContext
=
AppLanguageUtils
.
attachBaseContext
(
newBase
,
LibConfig
.
LANGUAGE
);
super
.
attachBaseContext
(
ViewPumpContextWrapper
.
wrap
(
Philology
.
INSTANCE
.
wrap
(
languageContext
)));
}
}
@Override
@Override
...
...
src/main/java/com/common/base/BaseApplication.java
View file @
e844d0f6
...
@@ -5,6 +5,7 @@ import android.content.Context;
...
@@ -5,6 +5,7 @@ import android.content.Context;
import
android.content.res.Configuration
;
import
android.content.res.Configuration
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.multidex.MultiDexApplication
;
import
android.support.multidex.MultiDexApplication
;
import
android.util.Log
;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
...
@@ -12,10 +13,20 @@ import android.widget.FrameLayout;
...
@@ -12,10 +13,20 @@ import android.widget.FrameLayout;
import
android.widget.RelativeLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.jcminarro.philology.Philology
;
import
com.jcminarro.philology.PhilologyInterceptor
;
import
com.jcminarro.philology.PhilologyRepository
;
import
com.jcminarro.philology.PhilologyRepositoryFactory
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
import
io.github.inflationx.viewpump.ViewPump
;
import
tech.starwin.LibConfig
;
import
tech.starwin.LibConfig
;
import
tech.starwin.network.Gateway
;
import
tech.starwin.network.Gateway
;
import
tech.starwin.utils.InstallReferrerHelper
;
import
tech.starwin.utils.InstallReferrerHelper
;
import
tech.starwin.utils.context_utils.AppLanguageUtils
;
import
tech.starwin.utils.context_utils.AppLanguageUtils
;
import
tech.starwin.utils.format_utils.StringDecrypt
;
/**
/**
* Created by SiKang on 2018/11/2.
* Created by SiKang on 2018/11/2.
...
@@ -41,6 +52,11 @@ public abstract class BaseApplication extends MultiDexApplication {
...
@@ -41,6 +52,11 @@ public abstract class BaseApplication extends MultiDexApplication {
super
.
onCreate
();
super
.
onCreate
();
AppLanguageUtils
.
setLanguage
(
this
,
LibConfig
.
LANGUAGE
);
AppLanguageUtils
.
setLanguage
(
this
,
LibConfig
.
LANGUAGE
);
PhilologyRepositoryFactory
repositoryFactory
=
locale
->
new
DefaultPhilologyRepository
();
// ViewTransformerFactory viewTransformerFactory = view -> new TextViewTransformer();
Philology
.
INSTANCE
.
init
(
repositoryFactory
);
ViewPump
.
init
(
ViewPump
.
builder
().
addInterceptor
(
PhilologyInterceptor
.
INSTANCE
).
build
());
InstallReferrerHelper
.
refershInstallReferrer
(
this
);
InstallReferrerHelper
.
refershInstallReferrer
(
this
);
LibConfig
.
initLib
(
this
);
LibConfig
.
initLib
(
this
);
...
@@ -54,6 +70,23 @@ public abstract class BaseApplication extends MultiDexApplication {
...
@@ -54,6 +70,23 @@ public abstract class BaseApplication extends MultiDexApplication {
// LogUtils.d("Signal_Log", "signal: " + JNISignal.getSignal(this));
// LogUtils.d("Signal_Log", "signal: " + JNISignal.getSignal(this));
}
}
public
class
DefaultPhilologyRepository
implements
PhilologyRepository
{
@Nullable
@Override
public
CharSequence
getText
(
@NotNull
String
key
)
{
try
{
if
(
"text_loan_amount"
.
equals
(
key
)){
Log
.
d
(
"DefaultPhilology"
,
key
);
}
int
resId
=
getResources
().
getIdentifier
(
key
,
"string"
,
LibConfig
.
APPLICATION_ID
);
return
StringDecrypt
.
uncodeString
(
getResources
().
getString
(
resId
));
}
catch
(
Exception
e
)
{
return
"--"
;
}
}
}
/**
/**
* before onCreate()
* before onCreate()
*/
*/
...
...
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