mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-09-10 17:47:05 +00:00
Update MainActivity.kt
This commit is contained in:
parent
f26cde17b7
commit
d933c8b19d
|
@ -61,6 +61,17 @@ import java.time.LocalDateTime
|
|||
import java.time.format.DateTimeFormatter
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetManager;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
|
||||
class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||
private lateinit var binding: ActivityMainBinding
|
||||
|
@ -84,6 +95,60 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
|||
|
||||
ThemeHelper.setTheme(this)
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
copyProdKeysToAppDirectory();
|
||||
}
|
||||
|
||||
private void copyProdKeysToAppDirectory() {
|
||||
AssetManager assetManager = getAssets();
|
||||
String fileName = "prod.keys";
|
||||
String destinationPath = getFilesDir().getPath() + "/keys/";
|
||||
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream = null;
|
||||
|
||||
try {
|
||||
inputStream = assetManager.open(fileName);
|
||||
File destinationDir = new File(destinationPath);
|
||||
|
||||
if (!destinationDir.exists()) {
|
||||
destinationDir.mkdirs();
|
||||
}
|
||||
|
||||
File destFile = new File(destinationDir, fileName);
|
||||
outputStream = new FileOutputStream(destFile);
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
|
||||
while ((length = inputStream.read(buffer)) > 0) {
|
||||
outputStream.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
outputStream.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
if (outputStream != null) {
|
||||
outputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||
|
|
Loading…
Reference in a new issue