diff --git a/app/src/main/java/org/etlegacy/app/ETLMain.java b/app/src/main/java/org/etlegacy/app/ETLMain.java index 91a378a..7d95f59 100644 --- a/app/src/main/java/org/etlegacy/app/ETLMain.java +++ b/app/src/main/java/org/etlegacy/app/ETLMain.java @@ -4,6 +4,7 @@ import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; +import android.view.WindowManager; import com.google.common.io.Files; import com.loopj.android.http.AsyncHttpClient; @@ -20,7 +21,9 @@ public class ETLMain extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - File etl_pak = new File(getExternalFilesDir(null), "pak2.pk3"); + getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + + File etl_pak = new File(getExternalFilesDir(null), "/etlegacy/etmain/pak0.pk3"); final Intent intent = new Intent(ETLMain.this, ETLActivity.class); if (etl_pak.exists()) { @@ -28,8 +31,8 @@ public class ETLMain extends Activity { finish(); } else { - AsyncHttpClient client = new AsyncHttpClient(); - client.get("http://mirror.etlegacy.com/etmain/pak2.pk3", new FileAsyncHttpResponseHandler(this) { + final AsyncHttpClient client = new AsyncHttpClient(); + client.get("http://mirror.etlegacy.com/etmain/pak0.pk3", new FileAsyncHttpResponseHandler(this) { @Override public void onSuccess(int statusCode, Header[] headers, File file) { @@ -40,9 +43,10 @@ public class ETLMain extends Activity { super.onFinish(); if (file.getAbsoluteFile().exists()) { try { - Files.move(file.getAbsoluteFile(), new File(getExternalFilesDir(null), "pak2.pk3")); - finish(); + Files.move(file.getAbsoluteFile(), new File(getExternalFilesDir(null), "/etlegacy/etmain/pak0.pk3")); + client.cancelAllRequests(true); startActivity(intent); + finish(); } catch (IOException e) { e.printStackTrace(); }