Merge branch 'master' of github.com:open-keychain/open-keychain

Conflicts:
	OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java
This commit is contained in:
Dominik Schürmann
2014-10-03 02:20:38 +02:00
17 changed files with 175 additions and 127 deletions

View File

@@ -166,6 +166,9 @@ public class CreateKeyInputFragment extends Fragment {
}
private void hideKeyboard() {
if (getActivity() == null) {
return;
}
InputMethodManager inputManager = (InputMethodManager) getActivity()
.getSystemService(Context.INPUT_METHOD_SERVICE);

View File

@@ -76,9 +76,15 @@ public class DecryptActivity extends DrawerActivity {
if (Build.VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
// get text from clipboard
final CharSequence clipboardText = ClipboardReflection.getClipboardText(DecryptActivity.this);
final CharSequence clipboardText =
ClipboardReflection.getClipboardText(DecryptActivity.this);
AsyncTask<String, Void, Boolean> tadaTask = new AsyncTask<String, Void, Boolean>() {
// if it's null, nothing to do here /o/
if (clipboardText == null) {
return;
}
new AsyncTask<String, Void, Boolean>() {
@Override
protected Boolean doInBackground(String... clipboardText) {
@@ -103,11 +109,7 @@ public class DecryptActivity extends DrawerActivity {
SubtleAttentionSeeker.tada(findViewById(R.id.clipboard_icon), 1.5f).start();
}
}
};
if (clipboardText != null) {
tadaTask.execute(clipboardText.toString());
}
}.execute(clipboardText.toString());
}
}

View File

@@ -159,6 +159,9 @@ public class ImportKeysCloudFragment extends Fragment {
}
private void hideKeyboard() {
if (getActivity() == null) {
return;
}
InputMethodManager inputManager = (InputMethodManager) getActivity()
.getSystemService(Context.INPUT_METHOD_SERVICE);

View File

@@ -157,8 +157,8 @@ public class PassphraseDialogActivity extends FragmentActivity {
/* Get key type for message */
// find a master key id for our key
long masterKeyId = new ProviderHelper(getActivity()).getMasterKeyId(mSubKeyId);
CachedPublicKeyRing keyRing = new ProviderHelper(getActivity()).getCachedPublicKeyRing(masterKeyId);
long masterKeyId = new ProviderHelper(activity).getMasterKeyId(mSubKeyId);
CachedPublicKeyRing keyRing = new ProviderHelper(activity).getCachedPublicKeyRing(masterKeyId);
// get the type of key (from the database)
CanonicalizedSecretKey.SecretKeyType keyType = keyRing.getSecretKeyType(mSubKeyId);
switch (keyType) {
@@ -324,6 +324,11 @@ public class PassphraseDialogActivity extends FragmentActivity {
}
private void finishCaching(String passphrase) {
// any indication this isn't needed anymore, don't do it.
if (mIsCancelled || getActivity() == null) {
return;
}
if (mServiceIntent != null) {
// TODO: Not routing passphrase through OpenPGP API currently
// due to security concerns...
@@ -352,6 +357,10 @@ public class PassphraseDialogActivity extends FragmentActivity {
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
if (getActivity() == null) {
return;
}
hideKeyboard();
getActivity().setResult(RESULT_CANCELED);

View File

@@ -206,6 +206,9 @@ public class AddUserIdDialogFragment extends DialogFragment implements OnEditorA
}
private void hideKeyboard() {
if (getActivity() == null) {
return;
}
InputMethodManager inputManager = (InputMethodManager) getActivity()
.getSystemService(Context.INPUT_METHOD_SERVICE);

View File

@@ -209,6 +209,10 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
mPassphraseEditText.post(new Runnable() {
@Override
public void run() {
// The activity might already be gone! Nvm in that case.
if (getActivity() == null) {
return;
}
InputMethodManager imm = (InputMethodManager) getActivity()
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(mPassphraseEditText, InputMethodManager.SHOW_IMPLICIT);
@@ -342,13 +346,18 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
}
private void hideKeyboard() {
// The activity which called the dialog might no longer exist. Nvm in that case...
if (getActivity() == null) {
return;
}
InputMethodManager inputManager = (InputMethodManager) getActivity()
.getSystemService(Context.INPUT_METHOD_SERVICE);
//check if no view has focus:
View v = getActivity().getCurrentFocus();
if (v == null)
if (v == null) {
return;
}
inputManager.hideSoftInputFromWindow(v.getWindowToken(), 0);
}

View File

@@ -200,6 +200,9 @@ public class SetPassphraseDialogFragment extends DialogFragment implements OnEdi
}
private void hideKeyboard() {
if (getActivity() == null) {
return;
}
InputMethodManager inputManager = (InputMethodManager) getActivity()
.getSystemService(Context.INPUT_METHOD_SERVICE);