added proxy support to OperationHelper
This commit is contained in:
@@ -54,6 +54,7 @@ import org.sufficientlysecure.keychain.ui.base.CachingCryptoOperationFragment;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||
import org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -312,8 +313,8 @@ public class CertifyKeyFragment
|
||||
actionsParcel.mCertifyActions.addAll(certifyActions);
|
||||
|
||||
if (mUploadKeyCheckbox.isChecked()) {
|
||||
actionsParcel.keyServerUri = Preferences.getPreferences(getActivity()).getPreferredKeyserver();
|
||||
actionsParcel.parcelableProxy = mProxyPrefs.parcelableProxy;
|
||||
actionsParcel.keyServerUri = Preferences.getPreferences(getActivity())
|
||||
.getPreferredKeyserver();
|
||||
}
|
||||
|
||||
// cached for next cryptoOperation loop
|
||||
|
||||
@@ -131,7 +131,7 @@ public class CreateYubiKeyImportFragment
|
||||
}
|
||||
};
|
||||
|
||||
if (OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
|
||||
if (OrbotHelper.putOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
|
||||
getActivity())) {
|
||||
importKey(proxyPrefs.parcelableProxy);
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public class CreateYubiKeyImportFragment
|
||||
}
|
||||
};
|
||||
|
||||
if (OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
|
||||
if (OrbotHelper.putOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
|
||||
getActivity())) {
|
||||
refreshSearch(proxyPrefs.parcelableProxy);
|
||||
}
|
||||
@@ -245,7 +245,7 @@ public class CreateYubiKeyImportFragment
|
||||
}
|
||||
};
|
||||
|
||||
if (OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
|
||||
if (OrbotHelper.putOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
|
||||
getActivity())) {
|
||||
refreshSearch(proxyPrefs.parcelableProxy);
|
||||
}
|
||||
|
||||
@@ -19,15 +19,11 @@ package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
@@ -52,7 +48,6 @@ import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.ui.base.CachingCryptoOperationFragment;
|
||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State;
|
||||
@@ -438,7 +433,7 @@ public abstract class DecryptFragment extends Fragment implements LoaderManager.
|
||||
}
|
||||
};
|
||||
|
||||
if (OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
|
||||
if (OrbotHelper.putOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
|
||||
getActivity())) {
|
||||
lookupUnknownKey(signatureKeyId, proxyPrefs.parcelableProxy);
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ public class ImportKeysActivity extends BaseNfcActivity
|
||||
mListFragment.loadNew(loaderState, mProxyPrefs.parcelableProxy);
|
||||
}
|
||||
};
|
||||
if (OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, mProxyPrefs, this)) {
|
||||
if (OrbotHelper.putOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, mProxyPrefs, this)) {
|
||||
mListFragment.loadNew(loaderState, mProxyPrefs.parcelableProxy);
|
||||
}
|
||||
} else if (loaderState instanceof ImportKeysListFragment.BytesLoaderState) { // must always be true
|
||||
@@ -450,8 +450,6 @@ public class ImportKeysActivity extends BaseNfcActivity
|
||||
ImportKeysListFragment.CloudLoaderState sls =
|
||||
(ImportKeysListFragment.CloudLoaderState) ls;
|
||||
|
||||
data.putParcelable(KeychainService.EXTRA_PARCELABLE_PROXY, mProxyPrefs.parcelableProxy);
|
||||
|
||||
// get selected key entries
|
||||
ArrayList<ParcelableKeyRing> keys = new ArrayList<>();
|
||||
{
|
||||
|
||||
@@ -195,23 +195,23 @@ public class ImportKeysProxyActivity extends FragmentActivity
|
||||
}
|
||||
}
|
||||
|
||||
public void importKeys(byte[] keyringData, ParcelableProxy parcelableProxy) {
|
||||
public void importKeys(byte[] keyringData) {
|
||||
ParcelableKeyRing keyEntry = new ParcelableKeyRing(keyringData);
|
||||
ArrayList<ParcelableKeyRing> selectedEntries = new ArrayList<>();
|
||||
selectedEntries.add(keyEntry);
|
||||
|
||||
startImportService(selectedEntries, parcelableProxy);
|
||||
startImportService(selectedEntries);
|
||||
}
|
||||
|
||||
public void importKeys(String fingerprint, ParcelableProxy parcelableProxy) {
|
||||
public void importKeys(String fingerprint) {
|
||||
ParcelableKeyRing keyEntry = new ParcelableKeyRing(fingerprint, null, null);
|
||||
ArrayList<ParcelableKeyRing> selectedEntries = new ArrayList<>();
|
||||
selectedEntries.add(keyEntry);
|
||||
|
||||
startImportService(selectedEntries, parcelableProxy);
|
||||
startImportService(selectedEntries);
|
||||
}
|
||||
|
||||
private void startImportService(ArrayList<ParcelableKeyRing> keyRings, ParcelableProxy parcelableProxy) {
|
||||
private void startImportService(ArrayList<ParcelableKeyRing> keyRings) {
|
||||
|
||||
// search config
|
||||
{
|
||||
@@ -275,18 +275,8 @@ public class ImportKeysProxyActivity extends FragmentActivity
|
||||
NdefMessage msg = (NdefMessage) rawMsgs[0];
|
||||
// record 0 contains the MIME type, record 1 is the AAR, if present
|
||||
final byte[] receivedKeyringBytes = msg.getRecords()[0].getPayload();
|
||||
final Preferences.ProxyPrefs proxyPrefs = Preferences.getPreferences(this)
|
||||
.getProxyPrefs();
|
||||
Runnable ignoreTor = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
importKeys(receivedKeyringBytes, new ParcelableProxy(null, -1, null));
|
||||
}
|
||||
};
|
||||
|
||||
if (OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs, this)) {
|
||||
importKeys(receivedKeyringBytes, proxyPrefs.parcelableProxy);
|
||||
}
|
||||
importKeys(receivedKeyringBytes);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -557,7 +557,7 @@ public class KeyListFragment extends LoaderFragment
|
||||
startActivityForResult(intent, REQUEST_ACTION);
|
||||
}
|
||||
|
||||
private void updateAllKeys(ParcelableProxy parcelableProxy) {
|
||||
private void updateAllKeys() {
|
||||
Activity activity = getActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
* Copyright (C) 2015 Adithya Abraham Philip <adithyaphilip@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.util.ParcelableProxy;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
import org.sufficientlysecure.keychain.util.orbot.OrbotHelper;
|
||||
|
||||
/**
|
||||
* Simply encapsulates a dialog. If orbot is not installed, it shows an install dialog, else a dialog to enable orbot.
|
||||
*/
|
||||
public class OrbotRequiredDialogActivity extends FragmentActivity {
|
||||
|
||||
// to provide any previous crypto input into which proxy preference is merged
|
||||
public static final String EXTRA_CRYPTO_INPUT = "extra_crypto_input";
|
||||
|
||||
public static final String RESULT_CRYPTO_INPUT = "result_crypto_input";
|
||||
|
||||
private CryptoInputParcel mCryptoInputParcel;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mCryptoInputParcel = getIntent().getParcelableExtra(EXTRA_CRYPTO_INPUT);
|
||||
if (mCryptoInputParcel == null) {
|
||||
mCryptoInputParcel = new CryptoInputParcel();
|
||||
}
|
||||
showDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an install or start orbot dialog depending on orbot's presence and state
|
||||
*/
|
||||
public void showDialog() {
|
||||
DialogFragmentWorkaround.INTERFACE.runnableRunDelayed(new Runnable() {
|
||||
public void run() {
|
||||
Runnable ignoreTor = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Intent intent = new Intent();
|
||||
mCryptoInputParcel.addParcelableProxy(ParcelableProxy.getForNoProxy());
|
||||
intent.putExtra(RESULT_CRYPTO_INPUT, mCryptoInputParcel);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
};
|
||||
if (OrbotHelper.putOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor,
|
||||
Preferences.getPreferences(OrbotRequiredDialogActivity.this)
|
||||
.getProxyPrefs(),
|
||||
OrbotRequiredDialogActivity.this)) {
|
||||
// no action required after all
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(RESULT_CRYPTO_INPUT, mCryptoInputParcel);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,11 @@
|
||||
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.EditTextPreference;
|
||||
|
||||
@@ -37,7 +37,6 @@ import org.sufficientlysecure.keychain.service.ExportKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.ParcelableProxy;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
import org.sufficientlysecure.keychain.util.orbot.OrbotHelper;
|
||||
|
||||
@@ -78,19 +77,7 @@ public class UploadKeyActivity extends BaseActivity
|
||||
mUploadButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final Preferences.ProxyPrefs proxyPrefs = Preferences.getPreferences(UploadKeyActivity.this)
|
||||
.getProxyPrefs();
|
||||
Runnable ignoreTor = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
uploadKey(proxyPrefs.parcelableProxy);
|
||||
}
|
||||
};
|
||||
|
||||
if (OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
|
||||
UploadKeyActivity.this)) {
|
||||
uploadKey(proxyPrefs.parcelableProxy);
|
||||
}
|
||||
uploadKey();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -146,8 +133,7 @@ public class UploadKeyActivity extends BaseActivity
|
||||
|
||||
@Override
|
||||
public void onCryptoOperationSuccess(ExportResult result) {
|
||||
Toast.makeText(UploadKeyActivity.this, R.string.msg_crt_upload_success,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
result.createNotify(this).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,7 +143,7 @@ public class UploadKeyActivity extends BaseActivity
|
||||
|
||||
@Override
|
||||
public void onCryptoOperationError(ExportResult result) {
|
||||
// TODO: Implement proper log for key upload then show error
|
||||
result.createNotify(this).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -211,7 +211,7 @@ public class ViewKeyTrustFragment extends LoaderFragment implements
|
||||
}
|
||||
};
|
||||
|
||||
if (OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
|
||||
if (OrbotHelper.putOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
|
||||
getActivity())) {
|
||||
mStartSearch.setEnabled(false);
|
||||
new DescribeKey(proxyPrefs.parcelableProxy).execute(fingerprint);
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
||||
import org.sufficientlysecure.keychain.ui.NfcOperationActivity;
|
||||
import org.sufficientlysecure.keychain.ui.OrbotRequiredDialogActivity;
|
||||
import org.sufficientlysecure.keychain.ui.PassphraseDialogActivity;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
@@ -62,6 +63,7 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
||||
|
||||
public static final int REQUEST_CODE_PASSPHRASE = 0x00008001;
|
||||
public static final int REQUEST_CODE_NFC = 0x00008002;
|
||||
public static final int REQUEST_CODE_ENABLE_ORBOT = 0x00008004;
|
||||
|
||||
// keeps track of request code used to start an activity from this CryptoOperationHelper.
|
||||
// this is necessary when multiple CryptoOperationHelpers are used in the same fragment/activity
|
||||
@@ -116,11 +118,13 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
||||
mProgressMessageResource = id;
|
||||
}
|
||||
|
||||
private void initiateInputActivity(RequiredInputParcel requiredInput) {
|
||||
private void initiateInputActivity(RequiredInputParcel requiredInput,
|
||||
CryptoInputParcel cryptoInputParcel) {
|
||||
|
||||
Activity activity = mUseFragment ? mFragment.getActivity() : mActivity;
|
||||
|
||||
switch (requiredInput.mType) {
|
||||
// don't forget to set mRequestedCode!
|
||||
case NFC_MOVE_KEY_TO_CARD:
|
||||
case NFC_DECRYPT:
|
||||
case NFC_SIGN: {
|
||||
@@ -130,7 +134,7 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
||||
if (mUseFragment) {
|
||||
mFragment.startActivityForResult(intent, mRequestedCode);
|
||||
} else {
|
||||
mActivity.startActivityForResult(intent, mRequestedCode);
|
||||
activity.startActivityForResult(intent, mRequestedCode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -143,18 +147,32 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
||||
if (mUseFragment) {
|
||||
mFragment.startActivityForResult(intent, mRequestedCode);
|
||||
} else {
|
||||
mActivity.startActivityForResult(intent, mRequestedCode);
|
||||
activity.startActivityForResult(intent, mRequestedCode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException("Unhandled pending result!");
|
||||
case ENABLE_ORBOT: {
|
||||
Intent intent = new Intent(activity, OrbotRequiredDialogActivity.class);
|
||||
intent.putExtra(OrbotRequiredDialogActivity.EXTRA_CRYPTO_INPUT, cryptoInputParcel);
|
||||
mRequestedCode = REQUEST_CODE_ENABLE_ORBOT;
|
||||
if (mUseFragment) {
|
||||
mFragment.startActivityForResult(intent, mRequestedCode);
|
||||
} else {
|
||||
activity.startActivityForResult(intent, mRequestedCode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
default: {
|
||||
throw new RuntimeException("Unhandled pending result!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts the result of an activity started by this helper. Returns true if requestCode is recognized,
|
||||
* false otherwise.
|
||||
* Attempts the result of an activity started by this helper. Returns true if requestCode is
|
||||
* recognized, false otherwise.
|
||||
*
|
||||
* @param requestCode
|
||||
* @param resultCode
|
||||
@@ -196,6 +214,18 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
||||
break;
|
||||
}
|
||||
|
||||
case REQUEST_CODE_ENABLE_ORBOT: {
|
||||
Log.e("PHILIP", "request rec");
|
||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||
CryptoInputParcel cryptoInput =
|
||||
data.getParcelableExtra(
|
||||
OrbotRequiredDialogActivity.RESULT_CRYPTO_INPUT);
|
||||
Log.e("PHILIP", "initiating next op");
|
||||
cryptoOperation(cryptoInput);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
default: {
|
||||
return false;
|
||||
}
|
||||
@@ -225,7 +255,7 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
||||
|
||||
}
|
||||
|
||||
public void cryptoOperation(CryptoInputParcel cryptoInput, boolean showProgress) {
|
||||
public void cryptoOperation(final CryptoInputParcel cryptoInput, boolean showProgress) {
|
||||
|
||||
FragmentActivity activity = mUseFragment ? mFragment.getActivity() : mActivity;
|
||||
|
||||
@@ -257,7 +287,7 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
||||
final OperationResult result =
|
||||
returnData.getParcelable(OperationResult.EXTRA_RESULT);
|
||||
|
||||
onHandleResult(result);
|
||||
onHandleResult(result, cryptoInput);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +329,7 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
||||
}
|
||||
}
|
||||
|
||||
public void onHandleResult(OperationResult result) {
|
||||
public void onHandleResult(OperationResult result, CryptoInputParcel oldCryptoInput) {
|
||||
Log.d(Constants.TAG, "Handling result in OperationHelper success: " + result.success());
|
||||
|
||||
if (result instanceof InputPendingResult) {
|
||||
@@ -307,7 +337,7 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
||||
if (pendingResult.isPending()) {
|
||||
|
||||
RequiredInputParcel requiredInput = pendingResult.getRequiredInputParcel();
|
||||
initiateInputActivity(requiredInput);
|
||||
initiateInputActivity(requiredInput, oldCryptoInput);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,19 +54,11 @@ import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.keyimport.HkpKeyserver;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
import org.sufficientlysecure.keychain.util.TlsHelper;
|
||||
import org.sufficientlysecure.keychain.util.orbot.OrbotHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.Proxy;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import java.io.IOException;
|
||||
|
||||
public class AddEditKeyserverDialogFragment extends DialogFragment implements OnEditorActionListener {
|
||||
private static final String ARG_MESSENGER = "arg_messenger";
|
||||
@@ -220,7 +212,7 @@ public class AddEditKeyserverDialogFragment extends DialogFragment implements On
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// behaviour same for edit and add
|
||||
String keyserverUrl = mKeyserverEditText.getText().toString();
|
||||
final String keyserverUrl = mKeyserverEditText.getText().toString();
|
||||
if (mVerifyKeyserverCheckBox.isChecked()) {
|
||||
final Preferences.ProxyPrefs proxyPrefs = Preferences.getPreferences(getActivity())
|
||||
.getProxyPrefs();
|
||||
@@ -231,7 +223,7 @@ public class AddEditKeyserverDialogFragment extends DialogFragment implements On
|
||||
}
|
||||
};
|
||||
|
||||
if (OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
|
||||
if (OrbotHelper.putOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
|
||||
getActivity())) {
|
||||
verifyConnection(keyserverUrl, proxyPrefs.parcelableProxy.getProxy());
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
package org.sufficientlysecure.keychain.ui.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
@@ -25,6 +25,7 @@ import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.os.RemoteException;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.view.ContextThemeWrapper;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
@@ -62,8 +63,15 @@ public class OrbotStartDialogFragment extends DialogFragment {
|
||||
int title = getArguments().getInt(ARG_TITLE);
|
||||
final int message = getArguments().getInt(ARG_MESSAGE);
|
||||
int middleButton = getArguments().getInt(ARG_MIDDLE_BUTTON);
|
||||
final Activity activity = getActivity();
|
||||
|
||||
CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(getActivity());
|
||||
// if the dialog is displayed from the application class, design is missing.
|
||||
// hack to get holo design (which is not automatically applied due to activity's
|
||||
// Theme.NoDisplay)
|
||||
ContextThemeWrapper theme = new ContextThemeWrapper(activity,
|
||||
R.style.Theme_AppCompat_Light_Dialog);
|
||||
|
||||
CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(theme);
|
||||
builder.setTitle(title).setMessage(message);
|
||||
|
||||
builder.setNegativeButton(R.string.orbot_start_dialog_cancel, new DialogInterface.OnClickListener() {
|
||||
@@ -97,4 +105,4 @@ public class OrbotStartDialogFragment extends DialogFragment {
|
||||
|
||||
return builder.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user