mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-30 04:22:18 -05:00
fix progress for decrypt
This commit is contained in:
parent
1697e22d19
commit
a48de4cd84
@ -128,17 +128,18 @@ public class ServiceProgressHandler extends Handler {
|
|||||||
case UPDATE_PROGRESS:
|
case UPDATE_PROGRESS:
|
||||||
if (data.containsKey(DATA_PROGRESS) && data.containsKey(DATA_PROGRESS_MAX)) {
|
if (data.containsKey(DATA_PROGRESS) && data.containsKey(DATA_PROGRESS_MAX)) {
|
||||||
|
|
||||||
|
String msg = null;
|
||||||
|
int progress = data.getInt(DATA_PROGRESS), max =data.getInt(DATA_PROGRESS_MAX);
|
||||||
|
|
||||||
// update progress from service
|
// update progress from service
|
||||||
if (data.containsKey(DATA_MESSAGE)) {
|
if (data.containsKey(DATA_MESSAGE)) {
|
||||||
progressDialogFragment.setProgress(data.getString(DATA_MESSAGE),
|
msg = data.getString(DATA_MESSAGE);
|
||||||
data.getInt(DATA_PROGRESS), data.getInt(DATA_PROGRESS_MAX));
|
|
||||||
} else if (data.containsKey(DATA_MESSAGE_ID)) {
|
} else if (data.containsKey(DATA_MESSAGE_ID)) {
|
||||||
progressDialogFragment.setProgress(data.getInt(DATA_MESSAGE_ID),
|
msg = mActivity.getString(data.getInt(DATA_MESSAGE_ID));
|
||||||
data.getInt(DATA_PROGRESS), data.getInt(DATA_PROGRESS_MAX));
|
|
||||||
} else {
|
|
||||||
progressDialogFragment.setProgress(data.getInt(DATA_PROGRESS),
|
|
||||||
data.getInt(DATA_PROGRESS_MAX));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSetProgress(msg, progress, max);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -152,4 +153,19 @@ public class ServiceProgressHandler extends Handler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void onSetProgress(String msg, int progress, int max) {
|
||||||
|
|
||||||
|
ProgressDialogFragment progressDialogFragment =
|
||||||
|
(ProgressDialogFragment) mActivity.getSupportFragmentManager()
|
||||||
|
.findFragmentByTag("progressDialog");
|
||||||
|
|
||||||
|
if (msg != null) {
|
||||||
|
progressDialogFragment.setProgress(msg, progress, max);
|
||||||
|
} else {
|
||||||
|
progressDialogFragment.setProgress(progress, max);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -188,14 +188,9 @@ public class DecryptFilesListFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCryptoSetProgress(String msg, int progress, int max) {
|
protected boolean onCryptoSetProgress(String msg, int progress, int max) {
|
||||||
mAdapter.setProgress(mCurrentInputUri, progress, max, msg);
|
mAdapter.setProgress(mCurrentInputUri, progress, max, msg);
|
||||||
}
|
return true;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showProgressFragment(
|
|
||||||
String progressDialogMessage, int progressDialogStyle, boolean cancelable) {
|
|
||||||
// progress shown inline, so never mind
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -155,6 +155,14 @@ public abstract class CryptoOperationFragment <T extends Parcelable, S extends O
|
|||||||
onHandleResult(result);
|
onHandleResult(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSetProgress(String msg, int progress, int max) {
|
||||||
|
// allow handling of progress in fragment, or delegate upwards
|
||||||
|
if ( ! onCryptoSetProgress(msg, progress, max)) {
|
||||||
|
super.onSetProgress(msg, progress, max);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create a new Messenger for the communication back
|
// Create a new Messenger for the communication back
|
||||||
@ -213,4 +221,8 @@ public abstract class CryptoOperationFragment <T extends Parcelable, S extends O
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean onCryptoSetProgress(String msg, int progress, int max) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user