mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-05-19 08:10:36 +00:00
4.0.6
- Fixed the crash issue when dragging and dropping files. - Added the Use default BIOS/UEFI option in the virtual machine editing and creation settings. - Added a restriction when selecting the output save directory as the virtual machine's own directory. - Fixed the issue of the virtual machine control panel dialog freezing. - Fixed the issue of creating unused virtual machine directories. - Added automatic cleanup of empty directories and files in the virtual machine directory. - Removed the Hard drive interface, Boot from, Custom params, and Use default BIOS/UEFI options in the general Qemu settings.
This commit is contained in:
parent
46d70be632
commit
ca9cb3b25d
20 changed files with 223 additions and 113 deletions
|
|
@ -12,8 +12,8 @@ android {
|
|||
applicationId "com.vectras.vm"
|
||||
minSdk minApi
|
||||
targetSdk targetApi
|
||||
versionCode 109
|
||||
versionName "4.0.5"
|
||||
versionCode 110
|
||||
versionName "4.0.6"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import android.app.Activity;
|
|||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
|
@ -142,8 +143,9 @@ public class ExportRomActivity extends AppCompatActivity {
|
|||
|
||||
vmConfigMap.put("bootFrom", current.bootFrom);
|
||||
vmConfigMap.put("isShowBootMenu", current.isShowBootMenu);
|
||||
vmConfigMap.put("isUseUefi", current.isUseUefi);
|
||||
vmConfigMap.put("isUseLocalTime", current.isUseLocalTime);
|
||||
vmConfigMap.put("isUseUefi", current.isUseUefi);
|
||||
vmConfigMap.put("isUseDefaultBios", current.isUseDefaultBios);
|
||||
vmConfigMap.put("qemu", VmFileManager.pathToTextMark(current.vmID, current.itemExtra));
|
||||
vmConfigMap.put("arch", current.itemArch);
|
||||
|
||||
|
|
@ -231,6 +233,21 @@ public class ExportRomActivity extends AppCompatActivity {
|
|||
}
|
||||
}*/
|
||||
|
||||
String outputPath = FileUtils.getPath(this, uri);
|
||||
|
||||
if (outputPath != null) {
|
||||
if (outputPath.startsWith(VmFileManager.quickGetPath(current.vmID))) {
|
||||
if (!new File(outputPath).isDirectory()) FileUtils.delete(outputPath);
|
||||
runOnUiThread(() -> {
|
||||
DialogUtils.oopsDialog(this, getString(R.string.cannot_save_here_please_choose_another_location));
|
||||
DialogUtils.safeDismiss(this, progressDialog);
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
outputPath = "";
|
||||
}
|
||||
|
||||
final boolean[] result = {ZipUtils.compress(
|
||||
this,
|
||||
finalFilePaths,
|
||||
|
|
@ -238,32 +255,30 @@ public class ExportRomActivity extends AppCompatActivity {
|
|||
progressText,
|
||||
progressBar
|
||||
)};
|
||||
String finalOutputPath = outputPath;
|
||||
runOnUiThread(() -> {
|
||||
isExporting = false;
|
||||
DialogUtils.safeDismiss(this, progressDialog);
|
||||
|
||||
String finalOutputPath = "";
|
||||
try {
|
||||
//FileUtils.delete(new File(outputPath));
|
||||
VmFileManager.removeTemp(this, current.vmID);
|
||||
finalOutputPath = FileUtils.getPath(this, uri);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "startCreate: ", e);
|
||||
}
|
||||
|
||||
String finalOutputPath1 = finalOutputPath != null ? finalOutputPath : "";
|
||||
String title;
|
||||
String content;
|
||||
if (result[0]) {
|
||||
title = getString(R.string.done);
|
||||
content = finalOutputPath1.isEmpty() ? getString(R.string.rom_successfully_exported) : getString(R.string.saved_in) + ": " + finalOutputPath1 + ".";
|
||||
content = finalOutputPath.isEmpty() ? getString(R.string.rom_successfully_exported) : getString(R.string.saved_in) + ": " + finalOutputPath + ".";
|
||||
} else {
|
||||
title = getString(R.string.oops);
|
||||
content = getString(R.string.something_went_wrong) + ":\n\n" + ZipUtils.lastErrorContent;
|
||||
}
|
||||
|
||||
File file = new File(finalOutputPath1);
|
||||
boolean isShowInFolder = !finalOutputPath1.isEmpty() && result[0] && file.getParent() != null && FileUtils.isFileExists(file.getParent());
|
||||
File file = new File(finalOutputPath);
|
||||
boolean isShowInFolder = !finalOutputPath.isEmpty() && result[0] && file.getParent() != null && FileUtils.isFileExists(file.getParent());
|
||||
|
||||
DialogUtils.twoDialog(this,
|
||||
title,
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ public class SplashActivity extends AppCompatActivity {
|
|||
|
||||
private void cleanUp() {
|
||||
FileUtils.delete(AppConfig.vmFolder + "QuickRun");
|
||||
VmFileManager.removeTemp(this, "");
|
||||
VmFileManager.quickCleanUp(this);
|
||||
}
|
||||
|
||||
private void finishSplash() {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ public class StartVM {
|
|||
snapshotParams = getQmpParams() + " " + snapshotParams;
|
||||
snapshotParams = getQemuSystem(activity) + " " + snapshotParams;
|
||||
snapshotParams += " " + getDisplayParams(activity);
|
||||
if (!snapshotParams.contains("-incoming defer")) snapshotParams += " -incoming defer";
|
||||
if (!snapshotParams.contains("-incoming defer"))
|
||||
snapshotParams += " -incoming defer";
|
||||
Log.d("StartVM.env", snapshotParams);
|
||||
return snapshotParams;
|
||||
}
|
||||
|
|
@ -82,7 +83,7 @@ public class StartVM {
|
|||
params.add(getQmpParams());
|
||||
|
||||
String ifType;
|
||||
ifType= MainSettingsManager.getIfType(activity);
|
||||
ifType = MainSettingsManager.getIfType(activity);
|
||||
|
||||
String cdrom = "";
|
||||
String hdd0;
|
||||
|
|
@ -208,7 +209,7 @@ public class StartVM {
|
|||
|
||||
//params.add(soundDevice);
|
||||
|
||||
if (MainSettingsManager.useDefaultBios(activity)) {
|
||||
if (vmConfigs.isUseDefaultBios) {
|
||||
if (MainSettingsManager.getArch(activity).equals("PPC")) {
|
||||
bios = "-L ";
|
||||
bios += "pc-bios";
|
||||
|
|
@ -217,7 +218,7 @@ public class StartVM {
|
|||
bios += "file=" + AppConfig.basefiledir + "QEMU_EFI.img,format=raw,readonly=on,if=pflash";
|
||||
bios += " -drive ";
|
||||
bios += "file=" + AppConfig.basefiledir + "QEMU_VARS.img,format=raw,if=pflash";
|
||||
} else if (MainSettingsManager.getArch(activity).equals("X86_64") && (vmConfigs.isUseUefi)) {
|
||||
} else if (vmConfigs.isUseUefi) {
|
||||
bios = "-drive ";
|
||||
bios += "file=" + AppConfig.basefiledir + "RELEASEX64_OVMF.fd,format=raw,readonly=on,if=pflash";
|
||||
bios += " -drive ";
|
||||
|
|
@ -310,6 +311,7 @@ public class StartVM {
|
|||
public static String getQmpParams() {
|
||||
return "-qmp unix:" + Config.getLocalQMPSocketPath() + ",server,nowait";
|
||||
}
|
||||
|
||||
public static String removeQmpParams(String params) {
|
||||
return params.replaceAll("(?<=\\s|^)-qmp\\s+(\"[^\"]+\"|\\S+)", "");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -454,7 +454,10 @@ public class VMManager {
|
|||
result.append(random.nextInt(2) > 0 ? TextUtils.randomALetter() : String.valueOf(random.nextInt(10)));
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
long millis = System.currentTimeMillis();
|
||||
long days = millis / 1000 / 60 / 60 / 24;
|
||||
|
||||
return result.toString() + days;
|
||||
}
|
||||
|
||||
// TODO: This can be removed because QMP currently uses sockets instead of open ports.
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.vectras.qemu.MainSettingsManager;
|
|||
import com.vectras.vm.R;
|
||||
import com.vectras.vm.databinding.ActivitySetArchBinding;
|
||||
import com.vectras.vm.main.MainActivity;
|
||||
import com.vectras.vm.utils.DialogUtils;
|
||||
import com.vectras.vm.utils.FileUtils;
|
||||
import com.vectras.vm.utils.IntentUtils;
|
||||
import com.vectras.vm.utils.UIUtils;
|
||||
|
|
@ -77,18 +78,28 @@ public class SetArchActivity extends AppCompatActivity implements View.OnClickLi
|
|||
Uri uri = clipData.getItemAt(0).getUri();
|
||||
String filePath = FileUtils.getFilePathFromUri(getApplicationContext(), uri);
|
||||
|
||||
File file = new File(filePath);
|
||||
new Thread (() -> {
|
||||
if (filePath == null) FileUtils.getPath(this, uri);
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(getApplicationContext(), VMCreatorActivity.class);
|
||||
intent.putExtra("addromnow", "");
|
||||
intent.putExtra("romextra", "");
|
||||
intent.putExtra("romname", "");
|
||||
intent.putExtra("romicon", "");
|
||||
intent.putExtra("rompath", filePath);
|
||||
intent.putExtra("romfilename", file.getName());
|
||||
startActivity(intent);
|
||||
finish();
|
||||
File file = filePath != null ? new File(filePath) : null;
|
||||
|
||||
runOnUiThread(() -> {
|
||||
if (file != null) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(getApplicationContext(), VMCreatorActivity.class);
|
||||
intent.putExtra("addromnow", "");
|
||||
intent.putExtra("romextra", "");
|
||||
intent.putExtra("romname", "");
|
||||
intent.putExtra("romicon", "");
|
||||
intent.putExtra("rompath", filePath);
|
||||
intent.putExtra("romfilename", file.getName());
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else {
|
||||
DialogUtils.oopsDialog(this, getString(R.string.invalid_file_path_content));
|
||||
}
|
||||
});
|
||||
}).start();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,8 +77,9 @@ public class VMCreatorActivity extends AppCompatActivity {
|
|||
private String thumbnailPath = "";
|
||||
private String vmID = VMManager.idGenerator();
|
||||
private boolean isShowBootMenu = false;
|
||||
private boolean isUseUefi = false;
|
||||
private boolean isUseLocalTime = true;
|
||||
private boolean isUseUefi = false;
|
||||
private boolean isUseDefaultBios = true;
|
||||
private int bootFrom = 0;
|
||||
|
||||
@Override
|
||||
|
|
@ -278,9 +279,14 @@ public class VMCreatorActivity extends AppCompatActivity {
|
|||
|
||||
binding.cbvShowbootmenu.setOnCheckedChangeListener((v, isChecked) -> isShowBootMenu = isChecked);
|
||||
|
||||
binding.cbvUselocaltime.setOnCheckedChangeListener((v, isChecked) -> isUseLocalTime = isChecked);
|
||||
|
||||
binding.cbvUseuefi.setOnCheckedChangeListener((v, isChecked) -> isUseUefi = isChecked);
|
||||
|
||||
binding.cbvUselocaltime.setOnCheckedChangeListener((v, isChecked) -> isUseLocalTime = isChecked);
|
||||
binding.cbvUseDefaultBios.setOnCheckedChangeListener((v, isChecked) -> {
|
||||
isUseDefaultBios = isChecked;
|
||||
binding.cbvUseuefi.setEnabled(isChecked);
|
||||
});
|
||||
|
||||
if (!MainSettingsManager.getArch(this).equals("X86_64"))
|
||||
binding.cbvUseuefi.setVisibility(View.GONE);
|
||||
|
|
@ -574,6 +580,11 @@ public class VMCreatorActivity extends AppCompatActivity {
|
|||
private void loadConfig(DataMainRoms vmConfig) {
|
||||
if (vmConfig != null) current = vmConfig;
|
||||
if (binding != null && current != null) {
|
||||
if (!current.vmID.isEmpty()) {
|
||||
vmID = current.vmID;
|
||||
checkVMID();
|
||||
}
|
||||
|
||||
if (current.itemArch != null) {
|
||||
VMManager.setArch(current.itemArch, this);
|
||||
binding.collapsingToolbarLayout.setSubtitle(MainSettingsManager.getArch(this));
|
||||
|
|
@ -624,6 +635,11 @@ public class VMCreatorActivity extends AppCompatActivity {
|
|||
binding.cbvUseuefi.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
isUseDefaultBios = current.isUseDefaultBios;
|
||||
binding.cbvUseDefaultBios.setChecked(isUseDefaultBios);
|
||||
|
||||
binding.cbvUseuefi.setEnabled(isUseDefaultBios);
|
||||
|
||||
isUseLocalTime = current.isUseLocalTime;
|
||||
binding.cbvUselocaltime.setChecked(isUseLocalTime);
|
||||
}
|
||||
|
|
@ -657,13 +673,14 @@ public class VMCreatorActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private void checkVMID() {
|
||||
if (FileUtils.isFileExists(AppConfig.maindirpath + "/roms/" + vmID) || vmID.isEmpty()) {
|
||||
if (vmID.isEmpty() || (!modify && VmFileManager.isInUse(vmID))) {
|
||||
vmID = VMManager.idGenerator();
|
||||
Log.d(TAG, "Changed to ID:" + vmID);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean createVMFolder(boolean isShowDialog) {
|
||||
File romDir = new File(VmFileManager.getPath(vmID));
|
||||
File romDir = new File(VmFileManager.quickGetPath(vmID));
|
||||
if (!romDir.exists()) {
|
||||
if (!romDir.mkdirs()) {
|
||||
if (isShowDialog) DialogUtils.oneDialog(this,
|
||||
|
|
@ -758,6 +775,7 @@ public class VMCreatorActivity extends AppCompatActivity {
|
|||
vmConfigMap.put("bootFrom", bootFrom);
|
||||
vmConfigMap.put("isShowBootMenu", isShowBootMenu);
|
||||
vmConfigMap.put("isUseUefi", isUseUefi);
|
||||
vmConfigMap.put("isUseDefaultBios", isUseDefaultBios);
|
||||
vmConfigMap.put("isUseLocalTime", isUseLocalTime);
|
||||
vmConfigMap.put("vmID", vmID);
|
||||
vmConfigMap.put("qmpPort", 8080);
|
||||
|
|
@ -971,7 +989,7 @@ public class VMCreatorActivity extends AppCompatActivity {
|
|||
|
||||
showProgressDialog(getString(R.string.importing) + "\n" + getString(R.string.please_stay_here));
|
||||
|
||||
Log.i(TAG, "importRom: Extracting with " + (isUseUri ? "uri" : "path") + " from " + filePath + " to " + VmFileManager.getPath(vmID));
|
||||
Log.i(TAG, "importRom: Extracting with " + (isUseUri ? "uri" : "path") + " from " + filePath + " to " + VmFileManager.quickGetPath(vmID));
|
||||
|
||||
new Thread(() -> {
|
||||
boolean result = isUseUri ? ZipUtils.extract(
|
||||
|
|
|
|||
|
|
@ -51,7 +51,9 @@ public class DataMainRoms {
|
|||
|
||||
public boolean isShowBootMenu = false;
|
||||
|
||||
public boolean isUseLocalTime = true;
|
||||
|
||||
public boolean isUseUefi = false;
|
||||
|
||||
public boolean isUseLocalTime = true;
|
||||
public boolean isUseDefaultBios = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
|
||||
import com.google.android.material.transition.MaterialFadeThrough;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.vectras.vm.AppConfig;
|
||||
import com.vectras.vm.R;
|
||||
import com.vectras.vm.VMManager;
|
||||
|
|
@ -30,6 +32,7 @@ import org.json.JSONException;
|
|||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
|
@ -111,83 +114,33 @@ public class VmsFragment extends Fragment implements CallbackInterface.HomeCallT
|
|||
try {
|
||||
if (!isAdded()) return;
|
||||
|
||||
jArray = new JSONArray(FileUtils.readFromFile(requireActivity(), new File(AppConfig.maindirpath
|
||||
+ "roms-data.json")));
|
||||
Gson gson = new Gson();
|
||||
Type listType = new TypeToken<List<DataMainRoms>>(){}.getType();
|
||||
|
||||
// Extract data from json and store into ArrayList as class objects
|
||||
for (int i = 0; i < jArray.length(); i++) {
|
||||
JSONObject json_data = jArray.getJSONObject(i);
|
||||
DataMainRoms romsMainData = new DataMainRoms();
|
||||
romsMainData.itemName = json_data.getString("imgName");
|
||||
romsMainData.itemIcon = json_data.getString("imgIcon");
|
||||
try {
|
||||
romsMainData.itemArch = json_data.getString("imgArch");
|
||||
} catch (JSONException ignored) {
|
||||
romsMainData.itemArch = "unknown";
|
||||
}
|
||||
romsMainData.itemPath = json_data.getString("imgPath");
|
||||
try {
|
||||
romsMainData.imgCdrom = json_data.getString("imgCdrom");
|
||||
} catch (JSONException ignored) {
|
||||
romsMainData.imgCdrom = "";
|
||||
}
|
||||
try {
|
||||
romsMainData.vmID = json_data.getString("vmID");
|
||||
} catch (JSONException ignored) {
|
||||
romsMainData.vmID = "";
|
||||
}
|
||||
try {
|
||||
romsMainData.qmpPort = json_data.getInt("qmpPort");
|
||||
} catch (JSONException ignored) {
|
||||
romsMainData.qmpPort = 0;
|
||||
}
|
||||
try {
|
||||
romsMainData.itemDrv1 = json_data.getString("imgDrv1");
|
||||
} catch (JSONException ignored) {
|
||||
romsMainData.itemDrv1 = "";
|
||||
}
|
||||
try {
|
||||
romsMainData.bootFrom = json_data.getInt("bootFrom");
|
||||
} catch (JSONException ignored) {
|
||||
romsMainData.bootFrom = 0;
|
||||
}
|
||||
try {
|
||||
romsMainData.isShowBootMenu = json_data.getBoolean("isShowBootMenu");
|
||||
} catch (JSONException ignored) {
|
||||
romsMainData.isShowBootMenu = false;
|
||||
}
|
||||
try {
|
||||
romsMainData.isUseUefi = json_data.getBoolean("isUseUefi");
|
||||
} catch (JSONException ignored) {
|
||||
romsMainData.isUseUefi = false;
|
||||
}
|
||||
try {
|
||||
romsMainData.isUseLocalTime = json_data.getBoolean("isUseLocalTime");
|
||||
} catch (JSONException ignored) {
|
||||
romsMainData.isUseLocalTime = true;
|
||||
}
|
||||
String json = FileUtils.readFromFile(requireActivity(),
|
||||
new File(AppConfig.romsdatajson));
|
||||
|
||||
tempdata = gson.fromJson(json, listType);
|
||||
|
||||
romsMainData.itemExtra = json_data.getString("imgExtra");
|
||||
tempdata.add(romsMainData);
|
||||
}
|
||||
if (!isAdded()) return;
|
||||
requireActivity().runOnUiThread(() -> binding.lnError.setVisibility(View.GONE));
|
||||
} catch (JSONException e) {
|
||||
} catch (Exception e) {
|
||||
if (!isAdded()) return;
|
||||
requireActivity().runOnUiThread(() -> binding.lnError.setVisibility(View.VISIBLE));
|
||||
Log.e(TAG, "loadDataVbi: ", e);
|
||||
}
|
||||
|
||||
if (!isAdded()) return;
|
||||
List<DataMainRoms> finalTempdata = tempdata;
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
binding.lnLoad.setVisibility(View.GONE);
|
||||
if (tempdata.isEmpty()) {
|
||||
if (finalTempdata.isEmpty()) {
|
||||
binding.rvRomlist.setVisibility(View.GONE);
|
||||
binding.lnNothinghere.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.rvRomlist.setVisibility(View.VISIBLE);
|
||||
binding.lnNothinghere.setVisibility(View.GONE);
|
||||
vmsHomeAdapter.updateData(tempdata);
|
||||
vmsHomeAdapter.updateData(finalTempdata);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@ import com.vectras.vm.utils.StreamAudio;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class VmControllerDialog extends DialogFragment {
|
||||
|
||||
|
|
@ -54,10 +59,34 @@ public class VmControllerDialog extends DialogFragment {
|
|||
AlertDialog dialog = new AlertDialog.Builder(requireActivity()).create();
|
||||
dialog.setView(binding.getRoot());
|
||||
|
||||
new Thread(() -> {
|
||||
infoBlock = QmpSender.getAllDevice();
|
||||
AtomicBoolean isGotInfo = new AtomicBoolean(false);
|
||||
|
||||
ProgressDialog progressDialog = new ProgressDialog(requireActivity());
|
||||
progressDialog.setText(getString(R.string.just_a_sec));
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
if (isGotInfo.get()) {
|
||||
progressDialog.reset();
|
||||
} else {
|
||||
progressDialog.show();
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
Future<String> getInfoBlock = executor.submit(QmpSender::getAllDevice);
|
||||
infoBlock = getInfoBlock.get(3, TimeUnit.SECONDS);
|
||||
} catch (Exception e) {
|
||||
infoBlock = "";
|
||||
}
|
||||
|
||||
long audioFileSize = FileUtils.getFileSize(VmFileManager.findAudioRaw(requireContext(), Config.vmID));
|
||||
|
||||
isGotInfo.set(true);
|
||||
new Handler(Looper.getMainLooper()).post(() -> {
|
||||
progressDialog.reset();
|
||||
|
||||
if (position > -1) {
|
||||
binding.lnConnect.setOnClickListener(v -> {
|
||||
if (isAdded()) DisplaySystem.launch(requireActivity());
|
||||
|
|
@ -112,13 +141,14 @@ public class VmControllerDialog extends DialogFragment {
|
|||
});
|
||||
|
||||
if (isAdded() && (!(requireActivity() instanceof MainVNCActivity))) {
|
||||
if (streamAudio == null) streamAudio = new StreamAudio(requireActivity().getApplicationContext());
|
||||
if (streamAudio == null)
|
||||
streamAudio = new StreamAudio(requireActivity().getApplicationContext());
|
||||
if (!streamAudio.isPlaying()) VmAudioManager.set(Config.vmID);
|
||||
}
|
||||
|
||||
if (streamAudio == null ||
|
||||
!isAdded() ||
|
||||
FileUtils.getFileSize(VmFileManager.findAudioRaw(requireContext(), Config.vmID)) == 0 ||
|
||||
audioFileSize == 0 ||
|
||||
(isAdded() && (!(requireActivity() instanceof MainVNCActivity)) && !VmAudioManager.currentVmId.equals(Config.vmID))
|
||||
) {
|
||||
binding.lnMute.setVisibility(View.GONE);
|
||||
|
|
@ -297,7 +327,8 @@ public class VmControllerDialog extends DialogFragment {
|
|||
}
|
||||
|
||||
binding.ivScreenOneToOne.setOnClickListener(v -> {
|
||||
if (MainSettingsManager.getVNCScaleMode(requireActivity()) == VNCConfig.oneToOne) return;
|
||||
if (MainSettingsManager.getVNCScaleMode(requireActivity()) == VNCConfig.oneToOne)
|
||||
return;
|
||||
|
||||
MainSettingsManager.setVNCScaleMode(requireActivity(), VNCConfig.oneToOne);
|
||||
requireActivity().recreate();
|
||||
|
|
@ -305,7 +336,8 @@ public class VmControllerDialog extends DialogFragment {
|
|||
});
|
||||
|
||||
binding.ivScreenFit.setOnClickListener(v -> {
|
||||
if (MainSettingsManager.getVNCScaleMode(requireActivity()) == VNCConfig.fitToScreen) return;
|
||||
if (MainSettingsManager.getVNCScaleMode(requireActivity()) == VNCConfig.fitToScreen)
|
||||
return;
|
||||
|
||||
MainSettingsManager.setVNCScaleMode(requireActivity(), VNCConfig.fitToScreen);
|
||||
requireActivity().recreate();
|
||||
|
|
@ -313,7 +345,8 @@ public class VmControllerDialog extends DialogFragment {
|
|||
});
|
||||
|
||||
binding.ivScreenScale.setOnClickListener(v -> {
|
||||
if (MainSettingsManager.getVNCScaleMode(requireActivity()) == VNCConfig.scaleToFitScreen) return;
|
||||
if (MainSettingsManager.getVNCScaleMode(requireActivity()) == VNCConfig.scaleToFitScreen)
|
||||
return;
|
||||
|
||||
MainSettingsManager.setVNCScaleMode(requireActivity(), VNCConfig.scaleToFitScreen);
|
||||
requireActivity().recreate();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.vectras.vm.AppConfig;
|
|||
import com.vectras.vm.utils.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class VmFileManager {
|
||||
private static final String TAG = "VmFileManager";
|
||||
|
|
@ -43,6 +44,21 @@ public class VmFileManager {
|
|||
return FileUtils.rename(getPath(HIDE_VM_SUFFIX + vmId), vmId);
|
||||
}
|
||||
|
||||
public static void quickCleanUp(Context context) {
|
||||
ArrayList<String> fileList = new ArrayList<>();
|
||||
FileUtils.getAListOfAllFilesAndFoldersInADirectory(AppConfig.vmFolder, fileList);
|
||||
for (int position = 0; position < fileList.size(); position++) {
|
||||
if (FileUtils.isEmpty(fileList.get(position))) FileUtils.delete(fileList.get(position));
|
||||
}
|
||||
|
||||
removeTemp(context, "");
|
||||
}
|
||||
|
||||
public static boolean isInUse(String vmId) {
|
||||
if (!FileUtils.isFileExists(quickGetPath(vmId))) return true;
|
||||
return !FileUtils.isEmpty(quickGetPath(vmId));
|
||||
}
|
||||
|
||||
public static String getPath(String vmId, String childFilePath) {
|
||||
return new File(getPath(vmId), childFilePath).getAbsolutePath();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -722,6 +722,17 @@ public class FileUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean isEmpty(String path) {
|
||||
File file = new File(path);
|
||||
|
||||
if (file.isDirectory()) {
|
||||
File[] files = file.listFiles();
|
||||
return files != null && files.length == 0;
|
||||
}
|
||||
|
||||
return file.length() == 0;
|
||||
}
|
||||
|
||||
public static int getFileSize(String _path) {
|
||||
try {
|
||||
File file = new File(_path);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class CheckBoxView extends LinearLayout {
|
|||
|
||||
public void setEnabled(boolean isEnabled) {
|
||||
findViewById(R.id.root).setEnabled(isEnabled);
|
||||
findViewById(R.id.root).setAlpha(0.5f);
|
||||
findViewById(R.id.root).setAlpha(isEnabled ? 1f : 0.5f);
|
||||
checkBox.setEnabled(isEnabled);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -279,6 +279,13 @@
|
|||
android:layout_height="wrap_content"
|
||||
app:setText="@string/show_boot_menu"/>
|
||||
|
||||
<com.vectras.vm.view.CheckBoxView
|
||||
android:id="@+id/cbv_uselocaltime"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:setText="@string/use_local_time"
|
||||
app:setChecked="true"/>
|
||||
|
||||
<com.vectras.vm.view.CheckBoxView
|
||||
android:id="@+id/cbv_useuefi"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -286,11 +293,11 @@
|
|||
app:setText="@string/use_uefi_for_x64_only"/>
|
||||
|
||||
<com.vectras.vm.view.CheckBoxView
|
||||
android:id="@+id/cbv_uselocaltime"
|
||||
android:id="@+id/cbv_use_default_bios"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:setText="@string/use_local_time"
|
||||
app:setChecked="true"/>
|
||||
app:setText="@string/use_default_bios_uefi"
|
||||
app:setChecked="true" />
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
|
|
|||
|
|
@ -555,6 +555,7 @@
|
|||
<string name="manage">Quản lý</string>
|
||||
<string name="connect">Kết nối</string>
|
||||
<string name="shutting_down">Đang tắt…</string>
|
||||
<string name="cannot_save_here_please_choose_another_location">Không thể lưu ở đây, hãy chọn một nơi khác.</string>
|
||||
|
||||
<!--======================TERMUX STRINGS====================-->
|
||||
<string name="application_name" translatable="false">Vterm</string>
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
<declare-styleable name="CheckBoxView">
|
||||
<attr name="setText" format="string"/>
|
||||
<attr name="setChecked" format="boolean"/>
|
||||
<attr name="setEnable" format="boolean"/>
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
|
|
@ -566,6 +566,7 @@
|
|||
<string name="manage">Manage</string>
|
||||
<string name="connect">Connect</string>
|
||||
<string name="shutting_down">Shutting down…</string>
|
||||
<string name="cannot_save_here_please_choose_another_location">Cannot save here, please choose another location.</string>
|
||||
|
||||
|
||||
<!--======================TERMUX STRINGS====================-->
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
app:isPreferenceVisible="false"
|
||||
app:icon="@drawable/round_volume_up_24"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<ListPreference
|
||||
<!--<ListPreference
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:defaultValue=""
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
android:key="ifType"
|
||||
app:useSimpleSummaryProvider="true"
|
||||
app:icon="@drawable/round_dns_24" />
|
||||
<!--<ListPreference
|
||||
<ListPreference
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:key="boot"
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
android:key="sharedFolder"
|
||||
android:summary="/Documents/VectrasVM/SharedFolder/"
|
||||
app:icon="@drawable/round_folder_24" />
|
||||
<EditTextPreference
|
||||
<!--<EditTextPreference
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:defaultValue=""
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
android:singleLine="true"
|
||||
android:title="@string/custom_params"
|
||||
app:useSimpleSummaryProvider="true"
|
||||
app:icon="@drawable/round_terminal_24" />
|
||||
app:icon="@drawable/round_terminal_24" />-->
|
||||
<SwitchPreferenceCompat
|
||||
android:id="@+id/autocreatedisk"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -95,14 +95,14 @@
|
|||
android:summary="@string/with_size_is_128GB"
|
||||
android:title="@string/auto_create_new_hard_drive_when_creating_new_vm"
|
||||
app:icon="@drawable/round_add_24" />
|
||||
<SwitchPreferenceCompat
|
||||
<!--<SwitchPreferenceCompat
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:defaultValue="true"
|
||||
android:key="useDefaultBios"
|
||||
android:title="@string/use_default_bios_uefi"
|
||||
app:icon="@drawable/hard_disk_24px" />
|
||||
<!--<SwitchPreferenceCompat
|
||||
<SwitchPreferenceCompat
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:defaultValue="false"
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@
|
|||
"url": "https://github.com/xoureldeen/Vectras-VM-Android/releases",
|
||||
"Message": "<h2>4.0.0</h2>\nBugs fixed.",
|
||||
"cancellable": true,
|
||||
"versionCodeBeta":"109",
|
||||
"versionNameBeta":"4.0.5",
|
||||
"versionNameBetas":"4.0.0,4.0.1,4.0.2,4.0.3,4.0.4,4.0.5",
|
||||
"versionCodeBeta":"110",
|
||||
"versionNameBeta":"4.0.6",
|
||||
"versionNameBetas":"4.0.0,4.0.1,4.0.2,4.0.3,4.0.4,4.0.5,4.0.6",
|
||||
"sizeBeta": "45 MB",
|
||||
"urlBeta": "https://github.com/AnBui2004/Vectras-VM-Emu-Android/releases",
|
||||
"MessageBeta": "<h2>4.0.5</h2>Bugs fixed.",
|
||||
"MessageBeta": "<h2>4.0.6</h2>Bugs fixed.",
|
||||
"cancellableBeta": true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -900,6 +900,24 @@
|
|||
"vecid": "templeoscvbi",
|
||||
"id": ""
|
||||
},
|
||||
{
|
||||
"rom_name": "Tiny Core Linux",
|
||||
"rom_icon": "https://miro.medium.com/v2/1*6Xeb45jiU6kKqoH7LeUGsg.png",
|
||||
"rom_url": "https://anbui.ovh/get/vec/community/linux/tinycorelinux.html",
|
||||
"rom_path": "Tiny Core Linux.cvbi",
|
||||
"rom_avail": true,
|
||||
"rom_size": "Light",
|
||||
"rom_arch": "X86_64",
|
||||
"rom_kernel": "linux",
|
||||
"rom_extra": "",
|
||||
"final_rom_file_name": "",
|
||||
"desc": "From @olikvos on Telegram and fixed by Nguyen Bao An Bui.\n\nTiny Core Linux (TCL) is a minimal Linux kernel based operating system focusing on providing a base system using BusyBox and FLTK. It was developed by Robert Shingledecker, who was previously the lead developer of Damn Small Linux. The distribution is notable for its small size (11 to 16 MB) and minimalism; additional functions are provided by extensions. Tiny Core Linux is free and open-source software licensed under the GNU General Public License version 2.",
|
||||
"file_size": "700 MB",
|
||||
"creator": "olikvos",
|
||||
"verified": true,
|
||||
"vecid": "tinycorelinuxcvbi",
|
||||
"id": ""
|
||||
},
|
||||
{
|
||||
"rom_name": "Tiny XP",
|
||||
"rom_icon": "https://vuetiwuvbyxywfukompp.supabase.co/storage/v1/object/public/getmyos/v1/files/2018/10/12/windows_2001_logo_1_abcd7f82240a9d6d4ef94d5c6223130b.png",
|
||||
|
|
@ -1044,6 +1062,24 @@
|
|||
"vecid": "windows10micro10cvbi",
|
||||
"id": ""
|
||||
},
|
||||
{
|
||||
"rom_name": "Windows 10 (Tiny10)",
|
||||
"rom_icon": "https://vuetiwuvbyxywfukompp.supabase.co/storage/v1/object/public/getmyos/v1/files/2018/09/17/windows-logo_1_926ed76111646acbbe332bc5af0cf2ce.png",
|
||||
"rom_url": "https://anbui.ovh/get/vec/community/win/nt10/tiny10.html",
|
||||
"rom_path": "Tiny10.cvbi",
|
||||
"rom_avail": true,
|
||||
"rom_size": "Lighter",
|
||||
"rom_arch": "X86_64",
|
||||
"rom_kernel": "windows",
|
||||
"rom_extra": "",
|
||||
"final_rom_file_name": "",
|
||||
"desc": "From @tokaevUser on Telegram.\n\nWindows 10 is a major release of Microsoft's Windows NT operating system. The successor to Windows 8.1, it was released to manufacturing on July 15, 2015, and later to retail on July 29, 2015.",
|
||||
"file_size": "7 GB",
|
||||
"creator": "tokaevUser",
|
||||
"verified": true,
|
||||
"vecid": "tiny10cvbi",
|
||||
"id": ""
|
||||
},
|
||||
{
|
||||
"rom_name": "Windows 10 1511",
|
||||
"rom_icon": "https://vuetiwuvbyxywfukompp.supabase.co/storage/v1/object/public/getmyos/v1/files/2018/09/17/windows-logo_1_926ed76111646acbbe332bc5af0cf2ce.png",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue