Commit 3beeec0a by sikang

test

parent 492a209a
...@@ -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>"
......
...@@ -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;
} }
} }
...@@ -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);
} }
......
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);
}
}
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