From Russia v1.0版本的 MD5 值为:52aeb8738ddf971390ea1486e59c6ccd
以下内容为反编译后的 LoaderFragment.java 源代码,内容仅作参考
package com.brorders.launcher.fragment;
import android.os.Bundle;
import android.os.Environment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar;
import com.brorders.game.R;
import com.brorders.launcher.fragment.LoaderFragment;
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 LoaderFragment extends Fragment {
RoundCornerProgressBar progressbar;
TextView textloading;
TextView textmb;
TextView textprogress;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View inflate = inflater.inflate(R.layout.fragment_loader, container, false);
FileDownloader.setup(getActivity());
startDownload();
return inflate;
}
public void startDownload() {
File folder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
createDownloadTask("http://wh3606.web3.maze-host.ru//black-cache.7z", folder.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;
LoaderFragment.this.textloading.setText("Загрузка файлов игры…");
LoaderFragment.this.textprogress.setText(new Formatter().format("%.0f%s", Float.valueOf((int) progressPercent), "%").toString());
LoaderFragment.this.textmb.setText(new Formatter().format("%s из %s", Utils.bytesIntoHumanReadable(soFarBytes), Utils.bytesIntoHumanReadable(totalBytes)).toString());
LoaderFragment.this.progressbar.setProgress((int) progressPercent);
}
@Override
public void error(BaseDownloadTask task, Throwable e) {
super.error(task, e);
Toast.makeText(LoaderFragment.this.getActivity(), "Произошла ошибка начните заново установку", 0).show();
}
@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);
LoaderFragment.this.textloading.setText("Распаковка...");
LoaderFragment.this.textprogress.setText("2/2");
LoaderFragment.this.textmb.setText("");
LoaderFragment.this.UnZipCache();
}
@Override
public void warn(BaseDownloadTask task) {
super.warn(task);
}
});
}
public void UnZipCache() {
String mInputFilePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/black-cache.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) + "/black-cache.7z"));
Utils.delete(new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/black-cache.7z.temp"));
LoaderFragment.this.getActivity().runOnUiThread(new Runnable() {
@Override
public final void run() {
LoaderFragment.AnonymousClass2.this.m64lambda$run$0$combrorderslauncherfragmentLoaderFragment$2();
}
});
}
public void m64lambda$run$0$combrorderslauncherfragmentLoaderFragment$2() {
LoaderFragment.this.afterDownload();
}
}
public void afterDownload() {
Toast.makeText(getActivity(), "Игра успешно установлена!", 0).show();
}
}