You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Update progress dialog
This commit is contained in:
@@ -105,36 +105,38 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
|
||||
new DownloadReceiver() {
|
||||
@Override
|
||||
public void task(Uri uri) {
|
||||
// Process and sign the zip
|
||||
try {
|
||||
ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream inBuffer;
|
||||
|
||||
// First remove top folder (the folder with the repo name) in Github source zip
|
||||
ZipUtils.removeTopFolder(mContext.getContentResolver().openInputStream(uri), outBuffer);
|
||||
inBuffer = new ByteArrayInputStream(outBuffer.toByteArray());
|
||||
outBuffer.reset();
|
||||
|
||||
// Then sign the zip for the first time
|
||||
ZipUtils.signZip(mContext, inBuffer, outBuffer, false);
|
||||
|
||||
// Call zipadjust through JNI
|
||||
inBuffer = new ByteArrayInputStream(ZipUtils.zipAdjust(outBuffer.toByteArray(), outBuffer.size()));
|
||||
outBuffer.reset();
|
||||
|
||||
// Finally, sign the whole zip file again
|
||||
ZipUtils.signZip(mContext, inBuffer, outBuffer, true);
|
||||
|
||||
// Write it back to the downloaded zip
|
||||
OutputStream out = mContext.getContentResolver().openOutputStream(uri);
|
||||
outBuffer.writeTo(out);
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Flash the zip
|
||||
new Async.FlashZIP(mContext, uri, mFilename).exec();
|
||||
new Async.FlashZIP(mContext, uri, mFilename){
|
||||
@Override
|
||||
protected void preProcessing() throws Throwable {
|
||||
// Process and sign the zip
|
||||
publishProgress(mContext.getString(R.string.zip_install_process_zip_msg));
|
||||
try {
|
||||
ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream inBuffer;
|
||||
|
||||
// First remove top folder (the folder with the repo name) in Github source zip
|
||||
ZipUtils.removeTopFolder(mContext.getContentResolver().openInputStream(mUri), outBuffer);
|
||||
inBuffer = new ByteArrayInputStream(outBuffer.toByteArray());
|
||||
outBuffer.reset();
|
||||
|
||||
// Then sign the zip for the first time
|
||||
ZipUtils.signZip(mContext, inBuffer, outBuffer, false);
|
||||
|
||||
// Call zipadjust through JNI
|
||||
inBuffer = new ByteArrayInputStream(ZipUtils.zipAdjust(outBuffer.toByteArray(), outBuffer.size()));
|
||||
outBuffer.reset();
|
||||
|
||||
// Finally, sign the whole zip file again
|
||||
ZipUtils.signZip(mContext, inBuffer, outBuffer, true);
|
||||
|
||||
// Write it back to the downloaded zip
|
||||
OutputStream out = mContext.getContentResolver().openOutputStream(mUri);
|
||||
outBuffer.writeTo(out);
|
||||
out.close();
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
}.exec();
|
||||
}
|
||||
},
|
||||
repo.getZipUrl(),
|
||||
|
||||
Reference in New Issue
Block a user