diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-09-14 00:08:12 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-09-14 00:08:12 +0200 |
commit | 6156600e42407a6a810f3f8b294197de47095f74 (patch) | |
tree | be7a25bf7f655aa456117ae9c1d7d49e9fb51817 /OpenKeychain/src/main/java/org | |
parent | d5c9021b892185ce9e23a11515bffa1662fed6dd (diff) | |
parent | 0625a16cb5aaef9c31fdbdf7c91210f7bac34558 (diff) | |
download | open-keychain-6156600e42407a6a810f3f8b294197de47095f74.tar.gz open-keychain-6156600e42407a6a810f3f8b294197de47095f74.tar.bz2 open-keychain-6156600e42407a6a810f3f8b294197de47095f74.zip |
Merge pull request #850 from da-kid/master
Fixed pull2refresh bugs
Diffstat (limited to 'OpenKeychain/src/main/java/org')
3 files changed, 34 insertions, 30 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 966c43597..f8ef9b0f6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -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()); - } - - // 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(); + 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(); + } + + // save key bytes in entry object for doing the + // actual import afterwards + keyRings.add(new ParcelableKeyRing(downloadedKeyBytes, entry.getFingerprintHex())); + } catch (Exception e) { + sendErrorToHandler(e); } - - // save key bytes in entry object for doing the - // actual import afterwards - keyRings.add(new ParcelableKeyRing(downloadedKeyBytes, entry.getFingerprintHex())); } 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 { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java index db5c48da7..84f12522d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ListAwareSwipeRefreshLayout.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ListAwareSwipeRefreshLayout.java index 17954f827..7490d69ee 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ListAwareSwipeRefreshLayout.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ListAwareSwipeRefreshLayout.java @@ -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 + ) + ) ); } }
\ No newline at end of file |