Redesign "select signing key" api dialog
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package org.sufficientlysecure.keychain.livedata;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
|
||||
import org.sufficientlysecure.keychain.livedata.KeyInfoInteractor.KeyInfo;
|
||||
import org.sufficientlysecure.keychain.livedata.KeyInfoInteractor.KeySelector;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.loader.AsyncTaskLiveData;
|
||||
|
||||
|
||||
public class KeyInfoLiveData extends AsyncTaskLiveData<List<KeyInfo>> {
|
||||
private final KeyInfoInteractor keyInfoInteractor;
|
||||
|
||||
private KeySelector keySelector;
|
||||
|
||||
public KeyInfoLiveData(Context context, ContentResolver contentResolver) {
|
||||
super(context, null);
|
||||
|
||||
this.keyInfoInteractor = new KeyInfoInteractor(contentResolver);
|
||||
}
|
||||
|
||||
public void setKeySelector(KeySelector keySelector) {
|
||||
this.keySelector = keySelector;
|
||||
|
||||
updateDataInBackground();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<KeyInfo> asyncLoadData() {
|
||||
if (keySelector == null) {
|
||||
return null;
|
||||
}
|
||||
return keyInfoInteractor.loadKeyInfo(keySelector);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.sufficientlysecure.keychain.livedata;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpKeyOperation;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.loader.AsyncTaskLiveData;
|
||||
import org.sufficientlysecure.keychain.util.ProgressScaler;
|
||||
|
||||
|
||||
public class PgpKeyGenerationLiveData extends AsyncTaskLiveData<PgpEditKeyResult> {
|
||||
private SaveKeyringParcel saveKeyringParcel;
|
||||
|
||||
public PgpKeyGenerationLiveData(Context context) {
|
||||
super(context, null);
|
||||
}
|
||||
|
||||
public void setSaveKeyringParcel(SaveKeyringParcel saveKeyringParcel) {
|
||||
if (this.saveKeyringParcel == saveKeyringParcel) {
|
||||
return;
|
||||
}
|
||||
this.saveKeyringParcel = saveKeyringParcel;
|
||||
|
||||
updateDataInBackground();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PgpEditKeyResult asyncLoadData() {
|
||||
if (saveKeyringParcel == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PgpKeyOperation keyOperations = new PgpKeyOperation(new ProgressScaler());
|
||||
return keyOperations.createSecretKeyRing(saveKeyringParcel);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user