final String remountCommand="mount -o remount,rw /system";
final String copyToSystemCommand="cp "+info.sourceDir+" /system/app/FonBot.apk";
final String chmodSystemCommand="chmod 644 /system/app/FonBot.apk";
+ final String rmSystemCommand="rm /system/app/FonBot.apk";
final String copyToUserCommand="cp "+info.sourceDir+" /data/app/FonBot.apk";
final String chmodUserCommand="chmod 644 /data/app/FonBot.apk";
- final String rmCommand="rm "+info.sourceDir;
+ final String rmUserCommand="rm "+info.sourceDir;
if(isChecked){
Runtime.getRuntime().exec(new String[]{
"su", "-c",
- remountCommand+';'+copyToSystemCommand+';'+chmodSystemCommand+';'+rmCommand
+ remountCommand+';'+copyToSystemCommand+';'+chmodSystemCommand+';'+rmUserCommand
}).waitFor();
Toast.makeText(FonBotPreferenceActivity.this,
} else {
Runtime.getRuntime().exec(new String[]{
"su", "-c",
- remountCommand+';'+copyToUserCommand+';'+chmodUserCommand+';'+rmCommand
+ remountCommand+';'+copyToUserCommand+';'+chmodUserCommand+';'+rmSystemCommand
}).waitFor();
-
Toast.makeText(FonBotPreferenceActivity.this,
"Reboot to make FonBot a non-system application", Toast.LENGTH_LONG).show();
}
}
});
+ final EditTextPreference protocolPreference=(EditTextPreference) findPreference("protocol");
+ protocolPreference.setSummary(protocolPreference.getText());
+ protocolPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(final @Nullable Preference preference, final @Nullable Object newValue) {
+ if(newValue==null)
+ return false;
+
+ protocolPreference.setSummary(newValue.toString());
+ return true;
+ }
+ });
+
final EditTextPreference hostnamePreference=(EditTextPreference) findPreference("hostname");
hostnamePreference.setSummary(hostnamePreference.getText());
hostnamePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {