Skip to content

Commit

Permalink
Updated icon & added two switches.
Browse files Browse the repository at this point in the history
  • Loading branch information
nov30th authored and Vincent Qiu committed Aug 21, 2017
1 parent d716b75 commit c2c682c
Show file tree
Hide file tree
Showing 15 changed files with 195 additions and 100 deletions.
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ android {

defaultConfig {
applicationId "im.hoho.alipayInstallB"
minSdkVersion 22
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
versionCode 3
versionName "1.0.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -27,10 +27,10 @@ repositories {
dependencies {
provided 'de.robv.android.xposed:api:82'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
// exclude group: 'com.android.support', module: 'support-annotations'
// })
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
// compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
33 changes: 30 additions & 3 deletions app/src/main/java/im/hoho/alipayInstallB/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Switch;

public class MainActivity extends AppCompatActivity {

private EditText editText;
private EditText editText2;
private Switch switchYuEBao;
private Switch switchBackground;


private SharedPreferences sp;
Expand Down Expand Up @@ -40,15 +45,37 @@ protected void onCreate(Bundle savedInstanceState) {
editor.apply();


// R.layout.activity_main = sp.edit();
// editor.putString("test_put", "test_put");

editText = (EditText) findViewById(R.id.editText);
editText.setText(sp.getString("yuebaoIncreaseAmount", "20000000"));

editText2 = (EditText) findViewById(R.id.editText2);
editText2.setText(sp.getString("yuebaoTotalProfit", "172823.23"));

switchBackground = (Switch) findViewById(R.id.switchBackground);
if (sp.getString("enableBackground", "true").equals("true"))
switchBackground.setChecked(true);
switchYuEBao = (Switch) findViewById(R.id.switchYuEBao);
if (sp.getString("enableYuEBao", "true").equals("true"))
switchYuEBao.setChecked(true);

switchYuEBao.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
editor.putString("enableYuEBao", Boolean.toString(isChecked).toLowerCase());
editor.apply();
}
});

switchBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
editor.putString("enableBackground", Boolean.toString(isChecked).toLowerCase());
editor.apply();
}
});



editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
Expand Down
149 changes: 83 additions & 66 deletions app/src/main/java/im/hoho/alipayInstallB/PluginMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) thr
//
if (lpparam.packageName.contains("com.eg.android.AlipayGphone")) {
XposedBridge.log("Loaded App: " + lpparam.packageName);
XposedBridge.log("Powered by HOHO`` 20170309");
XposedBridge.log("Powered by HOHO`` 20170821");

// //StackTraceElement[] getStackTrace
//// throw Exception
Expand Down Expand Up @@ -145,6 +145,16 @@ public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) thr
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {
XposedBridge.log("Now, let's install B...");
XSharedPreferences pre = new XSharedPreferences("im.hoho.alipayInstallB", "prefs");
pre.makeWorldReadable();
String enabledBackground = pre.getString("enableBackground", "true");
XposedBridge.log("enableBackground value: " + enabledBackground);

if (!enabledBackground.equals("true")) {
XposedBridge.log("Install B is failed! Not enabled.");
return;
}

Map<String, String> result = (Map<String, String>) param.getResult();
if (result.containsKey("memberGrade")) {
XposedBridge.log("Original member grade: " + result.get("memberGrade"));
Expand All @@ -170,65 +180,65 @@ protected void afterHookedMethod(MethodHookParam param)
}
});

//download url
XposedHelpers.findAndHookMethod(
"com.alipay.mobile.framework.service.ext.openplatform.domain.AppEntity",
lpparam.classLoader,
"setDownloadUrl",
String.class,
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {
XposedBridge.log("setDownloadUrl: " + param.args[0]);
}
});
// //download url
// XposedHelpers.findAndHookMethod(
// "com.alipay.mobile.framework.service.ext.openplatform.domain.AppEntity",
// lpparam.classLoader,
// "setDownloadUrl",
// String.class,
// new XC_MethodHook() {
// @Override
// protected void afterHookedMethod(MethodHookParam param)
// throws Throwable {
// XposedBridge.log("setDownloadUrl: " + param.args[0]);
// }
// });

//setPageUrl
XposedHelpers.findAndHookMethod(
"com.alipay.mobile.framework.service.ext.openplatform.domain.AppEntity",
lpparam.classLoader,
"setPageUrl",
String.class,
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {
XposedBridge.log("setPageUrl: " + param.args[0]);
}
});
// //setPageUrl
// XposedHelpers.findAndHookMethod(
// "com.alipay.mobile.framework.service.ext.openplatform.domain.AppEntity",
// lpparam.classLoader,
// "setPageUrl",
// String.class,
// new XC_MethodHook() {
// @Override
// protected void afterHookedMethod(MethodHookParam param)
// throws Throwable {
// XposedBridge.log("setPageUrl: " + param.args[0]);
// }
// });

//feeAmount
XposedHelpers.findAndHookMethod(
"com.alipay.wealth.common.ui.PopupFloatView",
lpparam.classLoader,
"setFeeAmount",
String.class,
String.class,
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {
XposedBridge.log("setFeeAmount 1st: " + param.args[0]);
XposedBridge.log("setFeeAmount 2st: " + param.args[1]);
}
});
// //feeAmount
// XposedHelpers.findAndHookMethod(
// "com.alipay.wealth.common.ui.PopupFloatView",
// lpparam.classLoader,
// "setFeeAmount",
// String.class,
// String.class,
// new XC_MethodHook() {
// @Override
// protected void afterHookedMethod(MethodHookParam param)
// throws Throwable {
// XposedBridge.log("setFeeAmount 1st: " + param.args[0]);
// XposedBridge.log("setFeeAmount 2st: " + param.args[1]);
// }
// });

//feeAmount2
XposedHelpers.findAndHookMethod(
"com.alipay.wealth.common.ui.PopupFloatView",
lpparam.classLoader,
"setFeeAmountValue",
String.class,
boolean.class,
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {
XposedBridge.log("setFeeAmountValue 1st: " + param.args[0]);
XposedBridge.log("setFeeAmountValue 2st: " + param.args[1].toString());
}
});
// //feeAmount2
// XposedHelpers.findAndHookMethod(
// "com.alipay.wealth.common.ui.PopupFloatView",
// lpparam.classLoader,
// "setFeeAmountValue",
// String.class,
// boolean.class,
// new XC_MethodHook() {
// @Override
// protected void afterHookedMethod(MethodHookParam param)
// throws Throwable {
// XposedBridge.log("setFeeAmountValue 1st: " + param.args[0]);
// XposedBridge.log("setFeeAmountValue 2st: " + param.args[1].toString());
// }
// });


//Yu'ebao
Expand All @@ -245,6 +255,17 @@ protected void afterHookedMethod(MethodHookParam param)
protected void beforeHookedMethod(MethodHookParam param)
throws Throwable {
XposedBridge.log("Let's do it...Changing me to GaoShuaiFu!");
XSharedPreferences pre = new XSharedPreferences("im.hoho.alipayInstallB", "prefs");
pre.makeWorldReadable();
String enableYuEBao = pre.getString("enableYuEBao", "true");
XposedBridge.log("enableYuEBao value: " + enableYuEBao);
if (!enableYuEBao.equals("true")) {
XposedBridge.log("Not enabled, keep original...");
return;
}

String increaseString = pre.getString("yuebaoIncreaseAmount", "512345");
String totalProfitSetString = pre.getString("yuebaoTotalProfit", "512345");

boolean canSetPreProfit = false;
Field previousProfitField = FundHomeInfoV99ResultPB.getDeclaredField("previousProfit");
Expand All @@ -265,10 +286,6 @@ protected void beforeHookedMethod(MethodHookParam param)
}

BigDecimal totalAmountProcessing = new BigDecimal(totalAmount);
XSharedPreferences pre = new XSharedPreferences("im.hoho.alipayInstallB", "prefs");
pre.makeWorldReadable();
String increaseString = pre.getString("yuebaoIncreaseAmount","512345");
String totalProfitSetString = pre.getString("yuebaoTotalProfit","512345");

if (!increaseString.equals("1130")) {
BigDecimal increaseTotal = new BigDecimal(increaseString);
Expand All @@ -284,23 +301,23 @@ protected void beforeHookedMethod(MethodHookParam param)
totalAmountProcessing = totalAmountProcessing.add(increaseTotal).setScale(2, RoundingMode.HALF_EVEN);
previousProfitProcessing = totalAmountProcessing.divide(profitRatio, 2, RoundingMode.HALF_EVEN);

XposedBridge.log("totalProfit before: " +(String)totalProfitField.get(param.args[0]));
XposedBridge.log("totalProfit before: " + (String) totalProfitField.get(param.args[0]));
XposedBridge.log("previousProfit before: " + previousProfit);
XposedBridge.log("totalAmount before: " + totalAmount);
XposedBridge.log("totalProfit settings value: " + totalProfitSetString);

totalProfitField.set(param.args[0],totalProfitDec.toString());
totalProfitField.set(param.args[0], totalProfitDec.toString());
if (canSetPreProfit)
previousProfitField.set(param.args[0], previousProfitProcessing.toPlainString());
totalAmountField.set(param.args[0], totalAmountProcessing.toPlainString());

XposedBridge.log("previousProfit after: " + (String) previousProfitField.get(param.args[0]));
XposedBridge.log("totalAmount after: " + (String) totalAmountField.get(param.args[0]));
XposedBridge.log("totalProfit after: " + (String) totalProfitField.get(param.args[0]));
}else{
} else {
previousProfitField.set(param.args[0], "神!");
totalAmountField.set(param.args[0],"高端大气上档次");
weekRateField.set(param.args[0],"狂拽酷炫吊炸天");
totalAmountField.set(param.args[0], "高端大气上档次");
weekRateField.set(param.args[0], "狂拽酷炫吊炸天");
}
}
});
Expand Down
36 changes: 36 additions & 0 deletions app/src/main/java/im/hoho/alipayInstallB/PreferencesUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package im.hoho.alipayInstallB;

import de.robv.android.xposed.XSharedPreferences;

public class PreferencesUtils {

private static XSharedPreferences instance = null;

private static XSharedPreferences getInstance() {
if (instance == null) {
instance = new XSharedPreferences(PreferencesUtils.class.getPackage().getName());
instance.makeWorldReadable();
} else {
instance.reload();
}
return instance;
}

public static boolean open() {
return getInstance().getBoolean("open", false);
}


public static boolean delay() {
return getInstance().getBoolean("delay", false);
}

public static int delayTime() {
return getInstance().getInt("delay_time", 0);
}

public static boolean quickOpen() {
return getInstance().getBoolean("quick_open", false);
}

}
Loading

0 comments on commit c2c682c

Please sign in to comment.