mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-14 04:45:04 -05:00
Use size of input uris for progress bar in encrypt/decrypt
This commit is contained in:
parent
de6950377c
commit
2712c18a7a
@ -193,7 +193,11 @@ public class FileHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static long getFileSize(Context context, Uri uri) {
|
public static long getFileSize(Context context, Uri uri) {
|
||||||
long size = -1;
|
return getFileSize(context, uri, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getFileSize(Context context, Uri uri, long def) {
|
||||||
|
long size = def;
|
||||||
try {
|
try {
|
||||||
Cursor cursor = context.getContentResolver().query(uri, new String[]{OpenableColumns.SIZE}, null, null, null);
|
Cursor cursor = context.getContentResolver().query(uri, new String[]{OpenableColumns.SIZE}, null, null, null);
|
||||||
|
|
||||||
|
@ -719,13 +719,13 @@ public class KeychainIntentService extends IntentService
|
|||||||
Uri providerUri = data.getParcelable(ENCRYPT_INPUT_URI);
|
Uri providerUri = data.getParcelable(ENCRYPT_INPUT_URI);
|
||||||
|
|
||||||
// InputStream
|
// InputStream
|
||||||
return new InputData(getContentResolver().openInputStream(providerUri), 0);
|
return new InputData(getContentResolver().openInputStream(providerUri), FileHelper.getFileSize(this, providerUri, 0));
|
||||||
|
|
||||||
case IO_URIS:
|
case IO_URIS:
|
||||||
providerUri = data.<Uri>getParcelableArrayList(ENCRYPT_INPUT_URIS).get(data.getInt(SELECTED_URI));
|
providerUri = data.<Uri>getParcelableArrayList(ENCRYPT_INPUT_URIS).get(data.getInt(SELECTED_URI));
|
||||||
|
|
||||||
// InputStream
|
// InputStream
|
||||||
return new InputData(getContentResolver().openInputStream(providerUri), 0);
|
return new InputData(getContentResolver().openInputStream(providerUri), FileHelper.getFileSize(this, providerUri, 0));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new PgpGeneralException("No target choosen!");
|
throw new PgpGeneralException("No target choosen!");
|
||||||
|
Loading…
Reference in New Issue
Block a user