From Russia v1.0版本的 MD5 值为:52aeb8738ddf971390ea1486e59c6ccd
以下内容为反编译后的 LoaderActivity.java 源代码,内容仅作参考
package com.brorders.launcher.activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar;
import com.brorders.game.R;
import com.brorders.launcher.activity.LoaderActivity;
import com.brorders.launcher.other.Utils;
import com.hzy.libp7zip.P7ZipApi;
import com.liulishuo.filedownloader.BaseDownloadTask;
import com.liulishuo.filedownloader.FileDownloadSampleListener;
import com.liulishuo.filedownloader.FileDownloader;
import java.io.File;
import java.util.Formatter;
public class LoaderActivity extends AppCompatActivity {
File folder;
RoundCornerProgressBar progressbar;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_loader);
FileDownloader.setup(this);
getWindow().addFlags(128);
startDownload();
}
public void startDownload() {
File externalStoragePublicDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
this.folder = externalStoragePublicDirectory;
createDownloadTask("http://wh3606.web3.maze-host.ru/brnewzakazi/datacache.7z", externalStoragePublicDirectory.getPath()).start();
}
private BaseDownloadTask createDownloadTask(String url, String path) {
return FileDownloader.getImpl().create(url).setPath(path, true).setCallbackProgressTimes(100).setMinIntervalUpdateSpeed(100).setListener(new FileDownloadSampleListener() {
@Override
public void pending(BaseDownloadTask task, int soFarBytes, int totalBytes) {
super.pending(task, soFarBytes, totalBytes);
}
@Override
public void progress(BaseDownloadTask task, int soFarBytes, int totalBytes) {
super.progress(task, soFarBytes, totalBytes);
long progressPercent = (soFarBytes * 100) / totalBytes;
RoundCornerProgressBar progressbar = (RoundCornerProgressBar) LoaderActivity.this.findViewById(R.id.progress_bar);
TextView textprogress = (TextView) LoaderActivity.this.findViewById(R.id.loading_percent);
TextView textloading = (TextView) LoaderActivity.this.findViewById(R.id.loading_text);
textloading.setText("Идёт загрузка игры...");
textprogress.setText(new Formatter().format("%s из %s", Utils.bytesIntoHumanReadable(soFarBytes), Utils.bytesIntoHumanReadable(totalBytes)).toString());
progressbar.setProgress((int) progressPercent);
}
@Override
public void error(BaseDownloadTask task, Throwable e) {
super.error(task, e);
Toast.makeText(LoaderActivity.this.getApplicationContext(), "Произошла ошибка начните заново установку", 0).show();
LoaderActivity.this.startActivity(new Intent(LoaderActivity.this, (Class<?>) MainActivity.class));
}
@Override
public void connected(BaseDownloadTask task, String et, boolean isContinue, int soFarBytes, int totalBytes) {
super.connected(task, et, isContinue, soFarBytes, totalBytes);
}
@Override
public void paused(BaseDownloadTask task, int soFarBytes, int totalBytes) {
super.paused(task, soFarBytes, totalBytes);
}
@Override
public void completed(BaseDownloadTask task) {
super.completed(task);
TextView textprogress = (TextView) LoaderActivity.this.findViewById(R.id.loading_percent);
TextView textloading = (TextView) LoaderActivity.this.findViewById(R.id.loading_text);
textloading.setText("Идёт распаковка файлов игры...");
textprogress.setText("1/2");
LoaderActivity.this.UnZipCache();
}
@Override
public void warn(BaseDownloadTask task) {
super.warn(task);
}
});
}
public void UnZipCache() {
String mInputFilePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/datacache.7z";
String mOutputPath = Environment.getExternalStorageDirectory().toString();
new AnonymousClass2(mInputFilePath, mOutputPath).start();
}
public class AnonymousClass2 extends Thread {
final String val$mInputFilePath;
final String val$mOutputPath;
AnonymousClass2(String str, String str2) {
this.val$mInputFilePath = str;
this.val$mOutputPath = str2;
}
@Override
public void run() {
P7ZipApi.executeCommand(String.format("7z x '%s' '-o%s' -aoa", this.val$mInputFilePath, this.val$mOutputPath));
Utils.delete(new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/datacache.7z"));
Utils.delete(new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/datacache.7z.temp"));
LoaderActivity.this.runOnUiThread(new Runnable() {
@Override
public final void run() {
LoaderActivity.AnonymousClass2.this.m61lambda$run$0$combrorderslauncheractivityLoaderActivity$2();
}
});
}
public void m61lambda$run$0$combrorderslauncheractivityLoaderActivity$2() {
LoaderActivity.this.afterDownload();
}
}
public void afterDownload() {
Toast.makeText(this, "Игра успешно установлена!", 0).show();
startActivity(new Intent(this, (Class<?>) MainActivity.class));
}
}