mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
allow progress message to be set later
This commit is contained in:
parent
90848a2af7
commit
be53c3e564
@ -63,6 +63,11 @@ public abstract class CryptoOperationFragment<T extends Parcelable, S extends Op
|
|||||||
mOperationHelper = new CryptoOperationHelper<>(this, callback);
|
mOperationHelper = new CryptoOperationHelper<>(this, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setProgressMessageResource(int id) {
|
||||||
|
mOperationHelper.setProgressMessageResource(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
mOperationHelper.handleActivityResult(requestCode, resultCode, data);
|
mOperationHelper.handleActivityResult(requestCode, resultCode, data);
|
||||||
|
@ -67,7 +67,7 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
|||||||
// otherwise all CryptoOperationHandlers may respond to the same onActivityResult
|
// otherwise all CryptoOperationHandlers may respond to the same onActivityResult
|
||||||
private int mRequestedCode = -1;
|
private int mRequestedCode = -1;
|
||||||
|
|
||||||
private int mProgressMessageString;
|
private int mProgressMessageResource;
|
||||||
|
|
||||||
private FragmentActivity mActivity;
|
private FragmentActivity mActivity;
|
||||||
private Fragment mFragment;
|
private Fragment mFragment;
|
||||||
@ -84,7 +84,7 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
|||||||
mActivity = activity;
|
mActivity = activity;
|
||||||
mUseFragment = false;
|
mUseFragment = false;
|
||||||
mCallback = callback;
|
mCallback = callback;
|
||||||
mProgressMessageString = progressMessageString;
|
mProgressMessageResource = progressMessageString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,7 +95,7 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
|||||||
public CryptoOperationHelper(Fragment fragment, Callback<T, S> callback, int progressMessageString) {
|
public CryptoOperationHelper(Fragment fragment, Callback<T, S> callback, int progressMessageString) {
|
||||||
mFragment = fragment;
|
mFragment = fragment;
|
||||||
mUseFragment = true;
|
mUseFragment = true;
|
||||||
mProgressMessageString = progressMessageString;
|
mProgressMessageResource = progressMessageString;
|
||||||
mCallback = callback;
|
mCallback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,10 +107,14 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
|||||||
public CryptoOperationHelper(Fragment fragment, Callback<T, S> callback) {
|
public CryptoOperationHelper(Fragment fragment, Callback<T, S> callback) {
|
||||||
mFragment = fragment;
|
mFragment = fragment;
|
||||||
mUseFragment = true;
|
mUseFragment = true;
|
||||||
mProgressMessageString = R.string.progress_building_key;
|
mProgressMessageResource = R.string.progress_building_key;
|
||||||
mCallback = callback;
|
mCallback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setProgressMessageResource(int id) {
|
||||||
|
mProgressMessageResource = id;
|
||||||
|
}
|
||||||
|
|
||||||
private void initiateInputActivity(RequiredInputParcel requiredInput) {
|
private void initiateInputActivity(RequiredInputParcel requiredInput) {
|
||||||
|
|
||||||
Activity activity = mUseFragment ? mFragment.getActivity() : mActivity;
|
Activity activity = mUseFragment ? mFragment.getActivity() : mActivity;
|
||||||
@ -254,7 +258,7 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
|||||||
};
|
};
|
||||||
|
|
||||||
saveHandler.showProgressDialog(
|
saveHandler.showProgressDialog(
|
||||||
activity.getString(mProgressMessageString),
|
activity.getString(mProgressMessageResource),
|
||||||
ProgressDialog.STYLE_HORIZONTAL, false);
|
ProgressDialog.STYLE_HORIZONTAL, false);
|
||||||
|
|
||||||
// Create a new Messenger for the communication back
|
// Create a new Messenger for the communication back
|
||||||
|
Loading…
Reference in New Issue
Block a user