modify ImportKeysActivity to match new pattern

This commit is contained in:
Adithya Abraham Philip 2015-06-11 05:42:10 +05:30
parent 17aca1c99c
commit 3a35df0db7

View File

@ -353,30 +353,16 @@ public class ImportKeysActivity extends BaseNfcActivity {
if (loaderState instanceof ImportKeysListFragment.CloudLoaderState) { if (loaderState instanceof ImportKeysListFragment.CloudLoaderState) {
// do the tor check // do the tor check
// this handle will set tor to be ignored whenever a message is received // this handle will set tor to be ignored whenever a message is received
Handler ignoreTorHandler = new Handler() { Runnable ignoreTor = new Runnable() {
@Override @Override
public void handleMessage(Message msg) { public void run() {
// disables Tor until Activity is recreated // disables Tor until Activity is recreated
mProxyPrefs = new Preferences.ProxyPrefs(false, false, null, -1, null); mProxyPrefs = new Preferences.ProxyPrefs(false, false, null, -1, null);
mListFragment.loadNew(loaderState, mProxyPrefs.parcelableProxy); mListFragment.loadNew(loaderState, mProxyPrefs.parcelableProxy);
} }
}; };
if (OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, mProxyPrefs, this)) {
if(mProxyPrefs.torEnabled && !OrbotHelper.isOrbotInstalled(this)) { mListFragment.loadNew(loaderState, mProxyPrefs.parcelableProxy);
OrbotHelper.getInstallDialogFragmentWithThirdButton(
new Messenger(ignoreTorHandler),
R.string.orbot_install_dialog_ignore_tor
).show(getSupportFragmentManager(), "orbotInstallDialog");
return;
}
if(mProxyPrefs.torEnabled && !OrbotHelper.isOrbotRunning()) {
OrbotHelper.getOrbotStartDialogFragment(new Messenger(ignoreTorHandler),
R.string.orbot_install_dialog_ignore_tor)
.show(getSupportFragmentManager(), "orbotStartDialog");
return;
} }
} }