mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-05-02 16:20:30 +00:00
2.9.0 Update
This commit is contained in:
parent
28de7905dc
commit
3658d98e4b
13 changed files with 87 additions and 353 deletions
|
|
@ -10,6 +10,8 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
|
|
@ -33,6 +35,7 @@ import com.vectras.vm.VectrasApp;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
public class MainSettingsManager extends AppCompatActivity
|
||||
|
|
@ -133,7 +136,23 @@ public class MainSettingsManager extends AppCompatActivity
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public static void updateLanguage(Context context, String selectedLanguage) {
|
||||
if (!"".equals(selectedLanguage)) {
|
||||
Locale locale = new Locale(selectedLanguage);
|
||||
Locale.setDefault(locale);
|
||||
Configuration config = new Configuration();
|
||||
config.locale = locale;
|
||||
context.getResources().updateConfiguration(config, null);
|
||||
|
||||
// Persist user's language preference
|
||||
SharedPreferences sharedPreferences =
|
||||
PreferenceManager.getDefaultSharedPreferences(context);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString("language", selectedLanguage);
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -196,6 +215,7 @@ public class MainSettingsManager extends AppCompatActivity
|
|||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||
VectrasApp.getApp().setTheme(R.style.AppTheme);
|
||||
}
|
||||
|
||||
activity.finish();
|
||||
startActivity(new Intent(activity, SplashActivity.class));
|
||||
}
|
||||
|
|
@ -825,16 +845,19 @@ public class MainSettingsManager extends AppCompatActivity
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
return prefs.getString("vmUi", "VNC");
|
||||
}
|
||||
|
||||
public static void setResolution(Activity activity, String RESOLUTION) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("RESOLUTION", RESOLUTION);
|
||||
edit.apply();
|
||||
}
|
||||
|
||||
public static String getResolution(Activity activity) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
return prefs.getString("RESOLUTION", "800x600x32");
|
||||
}
|
||||
|
||||
public static void setSoundCard(Activity activity, String soundCard) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
|
|
|
|||
|
|
@ -303,9 +303,9 @@ public class MainVNCActivity extends VncCanvasActivity {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
new AlertDialog.Builder(activity, R.style.MainDialogTheme)
|
||||
.setTitle("Shutdown")
|
||||
.setMessage("Are you sure you want to shutdown vm?")
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener()
|
||||
.setTitle(getString(R.string.shutdown))
|
||||
.setMessage(getString(R.string.are_you_sure_you_want_to_shutdown_vm))
|
||||
.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
|
@ -321,7 +321,7 @@ public class MainVNCActivity extends VncCanvasActivity {
|
|||
}
|
||||
|
||||
})
|
||||
.setNegativeButton("No", null)
|
||||
.setNegativeButton(getString(R.string.no), null)
|
||||
.show();
|
||||
}
|
||||
});
|
||||
|
|
@ -864,11 +864,8 @@ public class MainVNCActivity extends VncCanvasActivity {
|
|||
}
|
||||
|
||||
public boolean checkVMResolutionFits() {
|
||||
if (vncCanvas.rfb.framebufferWidth < vncCanvas.getWidth()
|
||||
&& vncCanvas.rfb.framebufferHeight < vncCanvas.getHeight())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return vncCanvas.rfb.framebufferWidth < vncCanvas.getWidth()
|
||||
&& vncCanvas.rfb.framebufferHeight < vncCanvas.getHeight();
|
||||
}
|
||||
|
||||
private void onDisplayMode() {
|
||||
|
|
|
|||
|
|
@ -164,22 +164,19 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
processBuilder.environment().put("TMPDIR", tmpDir.getAbsolutePath());
|
||||
processBuilder.environment().put("SHELL", "/bin/sh");
|
||||
|
||||
// Example PRoot command; replace 'libproot.so' and other paths as needed
|
||||
String[] prootCommand = {
|
||||
nativeLibDir + "/libproot.so", // PRoot binary path
|
||||
"--kill-on-exit",
|
||||
"--link2symlink",
|
||||
"-0",
|
||||
"-r", filesDir + "/distro", // Path to the rootfs
|
||||
"-b", "/dev",
|
||||
"-b", "/proc",
|
||||
"-b", "/sys",
|
||||
"-b", "/sdcard",
|
||||
"-b", "/storage",
|
||||
"-b", "/data",
|
||||
"-w", "/root",
|
||||
"--rootfs=" + filesDir + "/distro", // Path to the rootfs
|
||||
"--bind=/dev",
|
||||
"--bind=/proc",
|
||||
"--bind=/sys",
|
||||
"--bind=/sdcard",
|
||||
"--bind=/storage",
|
||||
"--bind=/data",
|
||||
"--cwd=/root",
|
||||
"/bin/sh",
|
||||
"--login"// The shell to execute inside PRoot
|
||||
"--login" // The shell to execute inside PRoot
|
||||
};
|
||||
|
||||
processBuilder.command(prootCommand);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
package com.vectras.vterm;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue