Commit 3beeec0a by sikang

test

parent 492a209a
......@@ -21,7 +21,7 @@ def decrypt(path):
str_name = line.split(">")[0] + ">"
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>"
......
......@@ -33,6 +33,7 @@ import tech.starwin.mvp.presenter.UserPresenter;
import tech.starwin.utils.context_utils.AppLanguageUtils;
import tech.starwin.utils.PresenterHoler;
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.QMUIHelper;
......@@ -97,7 +98,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
presenterHelper = new PresenterHoler(this);
initRootLayout();
if(getTrustee()!=null){
if (getTrustee() != null) {
getTrustee().onCreate();
}
}
......@@ -118,7 +119,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
// MsgHandleService.handleMsg(this, new RemoteMessage(getIntent().getExtras()));
// }
lifecycleSubject.onNext(ActivityEvent.START);
if(getTrustee()!=null){
if (getTrustee() != null) {
getTrustee().onStart();
}
}
......@@ -126,16 +127,17 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
@Override
protected void onRestart() {
super.onRestart();
if(getTrustee()!=null){
if (getTrustee() != null) {
getTrustee().onRestart();
}
}
@Override
protected void onResume() {
StringDecrypt.uncode(rootLayout);
super.onResume();
lifecycleSubject.onNext(ActivityEvent.RESUME);
if(getTrustee()!=null){
if (getTrustee() != null) {
getTrustee().onResume();
}
}
......@@ -145,7 +147,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
super.onPause();
lifecycleSubject.onNext(ActivityEvent.PAUSE);
progressDialog.dissmissLoading();
if(getTrustee()!=null){
if (getTrustee() != null) {
getTrustee().onPause();
}
}
......@@ -155,7 +157,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
super.onStop();
progressDialog.setEnable(false);
lifecycleSubject.onNext(ActivityEvent.STOP);
if(getTrustee()!=null){
if (getTrustee() != null) {
getTrustee().onStop();
}
}
......@@ -168,7 +170,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
}
lifecycleSubject.onNext(ActivityEvent.DESTROY);
presenterHelper.onDestory();
if(getTrustee()!=null){
if (getTrustee() != null) {
getTrustee().onDestroy();
}
}
......@@ -327,7 +329,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
public FragmentLauncher getFragmentLauncher() {
if (bindFragmentLayout() != 0 && fragmentLauncher == null) {
fragmentLauncher = new FragmentLauncher(this, bindFragmentLayout());
if(getTrustee()!=null){
if (getTrustee() != null) {
getTrustee().setFragmentLauncher(fragmentLauncher);
}
}
......@@ -402,4 +404,6 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
}
return trustee;
}
}
......@@ -25,6 +25,7 @@ import tech.starwin.R;
import tech.starwin.base.BasePresenter;
import tech.starwin.mvp.IView;
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.QMUIHelper;
import com.common.widget.ProgressDialog;
......@@ -172,6 +173,7 @@ public abstract class BaseFragment extends Fragment implements IView {
@Override
public void onResume() {
StringDecrypt.uncode(getContentView());
super.onResume();
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