Commit e844d0f6 by sikang

字符串加密

parent 0e9206d9
...@@ -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"
......
...@@ -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]
......
...@@ -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
......
...@@ -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
......
...@@ -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()
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment