mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
commit
6156600e42
@ -641,36 +641,39 @@ public class KeychainIntentService extends IntentService implements Progressable
|
||||
sendErrorToHandler(e);
|
||||
}
|
||||
} else if (ACTION_DOWNLOAD_AND_IMPORT_KEYS.equals(action) || ACTION_IMPORT_KEYBASE_KEYS.equals(action)) {
|
||||
try {
|
||||
ArrayList<ImportKeysListEntry> entries = data.getParcelableArrayList(DOWNLOAD_KEY_LIST);
|
||||
ArrayList<ImportKeysListEntry> entries = data.getParcelableArrayList(DOWNLOAD_KEY_LIST);
|
||||
|
||||
// this downloads the keys and places them into the ImportKeysListEntry entries
|
||||
String keyServer = data.getString(DOWNLOAD_KEY_SERVER);
|
||||
|
||||
ArrayList<ParcelableKeyRing> keyRings = new ArrayList<ParcelableKeyRing>(entries.size());
|
||||
for (ImportKeysListEntry entry : entries) {
|
||||
Keyserver server;
|
||||
if (entry.getOrigin() == null) {
|
||||
server = new HkpKeyserver(keyServer);
|
||||
} else if (KeybaseKeyserver.ORIGIN.equals(entry.getOrigin())) {
|
||||
server = new KeybaseKeyserver();
|
||||
} else {
|
||||
server = new HkpKeyserver(entry.getOrigin());
|
||||
}
|
||||
try {
|
||||
Keyserver server;
|
||||
if (entry.getOrigin() == null) {
|
||||
server = new HkpKeyserver(keyServer);
|
||||
} else if (KeybaseKeyserver.ORIGIN.equals(entry.getOrigin())) {
|
||||
server = new KeybaseKeyserver();
|
||||
} else {
|
||||
server = new HkpKeyserver(entry.getOrigin());
|
||||
}
|
||||
|
||||
// if available use complete fingerprint for get request
|
||||
byte[] downloadedKeyBytes;
|
||||
if (KeybaseKeyserver.ORIGIN.equals(entry.getOrigin())) {
|
||||
downloadedKeyBytes = server.get(entry.getExtraData()).getBytes();
|
||||
} else if (entry.getFingerprintHex() != null) {
|
||||
downloadedKeyBytes = server.get("0x" + entry.getFingerprintHex()).getBytes();
|
||||
} else {
|
||||
downloadedKeyBytes = server.get(entry.getKeyIdHex()).getBytes();
|
||||
}
|
||||
// if available use complete fingerprint for get request
|
||||
byte[] downloadedKeyBytes;
|
||||
if (KeybaseKeyserver.ORIGIN.equals(entry.getOrigin())) {
|
||||
downloadedKeyBytes = server.get(entry.getExtraData()).getBytes();
|
||||
} else if (entry.getFingerprintHex() != null) {
|
||||
downloadedKeyBytes = server.get("0x" + entry.getFingerprintHex()).getBytes();
|
||||
} else {
|
||||
downloadedKeyBytes = server.get(entry.getKeyIdHex()).getBytes();
|
||||
}
|
||||
|
||||
// save key bytes in entry object for doing the
|
||||
// actual import afterwards
|
||||
keyRings.add(new ParcelableKeyRing(downloadedKeyBytes, entry.getFingerprintHex()));
|
||||
// save key bytes in entry object for doing the
|
||||
// actual import afterwards
|
||||
keyRings.add(new ParcelableKeyRing(downloadedKeyBytes, entry.getFingerprintHex()));
|
||||
} catch (Exception e) {
|
||||
sendErrorToHandler(e);
|
||||
}
|
||||
}
|
||||
|
||||
Intent importIntent = new Intent(this, KeychainIntentService.class);
|
||||
@ -686,9 +689,6 @@ public class KeychainIntentService extends IntentService implements Progressable
|
||||
onHandleIntent(importIntent);
|
||||
|
||||
// result is handled in ACTION_IMPORT_KEYRING
|
||||
} catch (Exception e) {
|
||||
sendErrorToHandler(e);
|
||||
}
|
||||
} else if (ACTION_CERTIFY_KEYRING.equals(action)) {
|
||||
try {
|
||||
|
||||
|
@ -82,7 +82,7 @@ import se.emilsjolander.stickylistheaders.StickyListHeadersListView;
|
||||
*/
|
||||
public class KeyListFragment extends LoaderFragment
|
||||
implements SearchView.OnQueryTextListener, AdapterView.OnItemClickListener,
|
||||
LoaderManager.LoaderCallbacks<Cursor>, NoScrollableSwipeRefreshLayout.OnRefreshListener {
|
||||
LoaderManager.LoaderCallbacks<Cursor>, ListAwareSwipeRefreshLayout.OnRefreshListener {
|
||||
|
||||
private KeyListAdapter mAdapter;
|
||||
private StickyListHeadersListView mStickyList;
|
||||
|
@ -70,9 +70,13 @@ public class ListAwareSwipeRefreshLayout extends NoScrollableSwipeRefreshLayout
|
||||
|
||||
return (mIsLocked || (
|
||||
mStickyListHeadersListView.getWrappedList().getChildCount() > 0
|
||||
&& (mStickyListHeadersListView.getTop() > 0
|
||||
|| mStickyListHeadersListView.getFirstVisiblePosition() > 0
|
||||
))
|
||||
&&
|
||||
(
|
||||
mStickyListHeadersListView.getWrappedList().getChildAt(0).getTop() < 0
|
||||
||
|
||||
mStickyListHeadersListView.getFirstVisiblePosition() > 0
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user