mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-04-29 23:09:48 +00:00
initial commit
This commit is contained in:
parent
6dc29411a6
commit
16394be6ec
18 changed files with 494 additions and 402 deletions
|
|
@ -3,7 +3,7 @@ package com.vectras.vm;
|
|||
import static android.content.Intent.ACTION_OPEN_DOCUMENT;
|
||||
import static android.content.Intent.ACTION_VIEW;
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import com.termux.app.TermuxService;
|
||||
import com.termux.app.TermuxService;
|
||||
import static com.vectras.vm.utils.UIUtils.UIAlert;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
|
|
@ -101,10 +101,10 @@ import java.util.Objects;
|
|||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import com.vectras.vm.core.ShellExecutor;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import com.vectras.vm.core.ShellExecutor;
|
||||
|
||||
import com.vectras.vm.x11.X11Activity;
|
||||
|
||||
|
||||
|
|
@ -202,6 +202,16 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
});*/
|
||||
|
||||
Button gotoromstore = findViewById(R.id.gotoromstorebutton);
|
||||
gotoromstore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(getApplicationContext(), RomsManagerActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
FloatingActionButton fabAdd = findViewById(R.id.fabAdd_AppBarBottomActivity);
|
||||
fabAdd.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
@ -550,6 +560,23 @@ public class MainActivity extends AppCompatActivity {
|
|||
Intent intent = new Intent();
|
||||
intent.setClass(getApplicationContext(), RomsManagerActivity.class);
|
||||
startActivity(intent);
|
||||
} else if (id == R.id.cleanup) {
|
||||
alertDialog = new AlertDialog.Builder(activity, R.style.MainDialogTheme).create();
|
||||
alertDialog.setTitle(getResources().getString(R.string.clean_up));
|
||||
alertDialog.setMessage(getResources().getString(R.string.clean_up_content));
|
||||
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.clean_up), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
VectrasApp.startCleanUp();
|
||||
errorjsondialog();
|
||||
Toast.makeText(getApplicationContext(), activity.getResources().getString(R.string.done), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
alertDialog.dismiss();
|
||||
}
|
||||
});
|
||||
alertDialog.show();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -802,6 +829,25 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
public static void startCleanUp() {
|
||||
String _romsdata = VectrasApp.readFile(AppConfig.maindirpath + "roms-data.json").replace("\\/", "/");
|
||||
int _startRepeat = 0;
|
||||
ArrayList<String> _filelist = new ArrayList<>();
|
||||
listDir(AppConfig.maindirpath + "roms/", _filelist);
|
||||
if (!_filelist.isEmpty()) {
|
||||
for (int _repeat = 0; _repeat < (int)(_filelist.size()); _repeat++) {
|
||||
if (_startRepeat < _filelist.size()) {
|
||||
if (!isFileExists(_filelist.get((int)(_startRepeat)) + "/vmID.txt")) {
|
||||
if (!_romsdata.contains(_filelist.get((int)(_startRepeat)))) {
|
||||
deleteDirectory(_filelist.get((int)(_startRepeat)));
|
||||
}
|
||||
}
|
||||
}
|
||||
_startRepeat++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue