KeyListFragment: make import callback inline
This commit is contained in:
@@ -77,8 +77,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
||||||
implements SearchView.OnQueryTextListener,
|
implements SearchView.OnQueryTextListener,
|
||||||
LoaderManager.LoaderCallbacks<Cursor>, FabContainer,
|
LoaderManager.LoaderCallbacks<Cursor>, FabContainer {
|
||||||
CryptoOperationHelper.Callback<ImportKeyringParcel, ImportKeyResult> {
|
|
||||||
|
|
||||||
static final int REQUEST_ACTION = 1;
|
static final int REQUEST_ACTION = 1;
|
||||||
private static final int REQUEST_DELETE = 2;
|
private static final int REQUEST_DELETE = 2;
|
||||||
@@ -515,7 +514,35 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
|||||||
// search config
|
// search config
|
||||||
mKeyserver = Preferences.getPreferences(getActivity()).getPreferredKeyserver();
|
mKeyserver = Preferences.getPreferences(getActivity()).getPreferredKeyserver();
|
||||||
|
|
||||||
mImportOpHelper = new CryptoOperationHelper<>(1, this, this, R.string.progress_updating);
|
CryptoOperationHelper.Callback<ImportKeyringParcel, ImportKeyResult> callback
|
||||||
|
= new CryptoOperationHelper.Callback<ImportKeyringParcel, ImportKeyResult>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ImportKeyringParcel createOperationInput() {
|
||||||
|
return new ImportKeyringParcel(mKeyList, mKeyserver);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCryptoOperationSuccess(ImportKeyResult result) {
|
||||||
|
result.createNotify(getActivity()).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCryptoOperationCancelled() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCryptoOperationError(ImportKeyResult result) {
|
||||||
|
result.createNotify(getActivity()).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCryptoSetProgress(String msg, int progress, int max) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mImportOpHelper = new CryptoOperationHelper<>(1, this, callback, R.string.progress_updating);
|
||||||
mImportOpHelper.setProgressCancellable(true);
|
mImportOpHelper.setProgressCancellable(true);
|
||||||
mImportOpHelper.cryptoOperation();
|
mImportOpHelper.cryptoOperation();
|
||||||
}
|
}
|
||||||
@@ -536,7 +563,6 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCryptoOperationCancelled() {
|
public void onCryptoOperationCancelled() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -570,7 +596,6 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCryptoOperationCancelled() {
|
public void onCryptoOperationCancelled() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -651,29 +676,4 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
|||||||
anim.start();
|
anim.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
// CryptoOperationHelper.Callback methods
|
|
||||||
@Override
|
|
||||||
public ImportKeyringParcel createOperationInput() {
|
|
||||||
return new ImportKeyringParcel(mKeyList, mKeyserver);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCryptoOperationSuccess(ImportKeyResult result) {
|
|
||||||
result.createNotify(getActivity()).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCryptoOperationCancelled() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCryptoOperationError(ImportKeyResult result) {
|
|
||||||
result.createNotify(getActivity()).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCryptoSetProgress(String msg, int progress, int max) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user