Skip to content

Commit

Permalink
2.9.0 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
xoureldeen committed May 11, 2024
1 parent 28de790 commit 3658d98
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 353 deletions.
2 changes: 1 addition & 1 deletion .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ android {
abi {
enable true
reset()
include 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
include 'armeabi-v7a', 'arm64-v8a'
universalApk true
}
}
Expand All @@ -60,21 +60,21 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation "androidx.annotation:annotation:1.3.0"
implementation "androidx.core:core:1.6.0"
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
implementation "androidx.preference:preference:1.1.1"
implementation 'com.google.android.material:material:1.12.0'
implementation "androidx.annotation:annotation:1.7.1"
implementation "androidx.core:core:1.13.1"
implementation "androidx.drawerlayout:drawerlayout:1.2.0"
implementation "androidx.preference:preference:1.2.1"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "androidx.viewpager:viewpager:1.0.0"
implementation platform('com.google.firebase:firebase-bom:32.3.1')
implementation platform('com.google.firebase:firebase-bom:33.0.0')
implementation 'com.google.firebase:firebase-analytics'
implementation("com.google.firebase:firebase-auth")
implementation("com.google.firebase:firebase-database")
implementation 'com.google.firebase:firebase-storage'
implementation("com.google.android.gms:play-services-auth:20.7.0")
implementation("com.google.android.gms:play-services-auth:21.1.1")
implementation("com.google.firebase:firebase-crashlytics")
implementation 'com.google.android.gms:play-services-ads:22.6.0'
implementation 'com.google.android.gms:play-services-ads:23.1.0'
implementation 'com.github.bumptech.glide:glide:4.16.0'
implementation 'com.google.guava:guava:33.1.0-jre'

Expand Down
23 changes: 23 additions & 0 deletions app/src/main/java/com/vectras/qemu/MainSettingsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
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;
Expand All @@ -33,6 +35,7 @@

import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Objects;

public class MainSettingsManager extends AppCompatActivity
Expand Down Expand Up @@ -133,7 +136,23 @@ public static class AppPreferencesFragment extends PreferenceFragmentCompat
@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
Expand Down Expand Up @@ -196,6 +215,7 @@ private void onNightMode() {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
VectrasApp.getApp().setTheme(R.style.AppTheme);
}

activity.finish();
startActivity(new Intent(activity, SplashActivity.class));
}
Expand Down Expand Up @@ -825,16 +845,19 @@ public static String getVmUi(Activity activity) {
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();
Expand Down
15 changes: 6 additions & 9 deletions app/src/main/java/com/vectras/qemu/MainVNCActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ public void onClick(View v) {
@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) {
Expand All @@ -321,7 +321,7 @@ public void onClick(DialogInterface dialog, int which) {
}

})
.setNegativeButton("No", null)
.setNegativeButton(getString(R.string.no), null)
.show();
}
});
Expand Down Expand Up @@ -864,11 +864,8 @@ public void onClick(DialogInterface dialog, int i) {
}

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() {
Expand Down
21 changes: 9 additions & 12 deletions app/src/main/java/com/vectras/vm/SetupQemuActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,19 @@ public void executeShellCommand(String userCommand) {
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);
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/vectras/vterm/Terminal.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/round_language_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM18.92,8h-2.95c-0.32,-1.25 -0.78,-2.45 -1.38,-3.56 1.84,0.63 3.37,1.91 4.33,3.56zM12,4.04c0.83,1.2 1.48,2.53 1.91,3.96h-3.82c0.43,-1.43 1.08,-2.76 1.91,-3.96zM4.26,14C4.1,13.36 4,12.69 4,12s0.1,-1.36 0.26,-2h3.38c-0.08,0.66 -0.14,1.32 -0.14,2s0.06,1.34 0.14,2L4.26,14zM5.08,16h2.95c0.32,1.25 0.78,2.45 1.38,3.56 -1.84,-0.63 -3.37,-1.9 -4.33,-3.56zM8.03,8L5.08,8c0.96,-1.66 2.49,-2.93 4.33,-3.56C8.81,5.55 8.35,6.75 8.03,8zM12,19.96c-0.83,-1.2 -1.48,-2.53 -1.91,-3.96h3.82c-0.43,1.43 -1.08,2.76 -1.91,3.96zM14.34,14L9.66,14c-0.09,-0.66 -0.16,-1.32 -0.16,-2s0.07,-1.35 0.16,-2h4.68c0.09,0.65 0.16,1.32 0.16,2s-0.07,1.34 -0.16,2zM14.59,19.56c0.6,-1.11 1.06,-2.31 1.38,-3.56h2.95c-0.96,1.65 -2.49,2.93 -4.33,3.56zM16.36,14c0.08,-0.66 0.14,-1.32 0.14,-2s-0.06,-1.34 -0.14,-2h3.38c0.16,0.64 0.26,1.31 0.26,2s-0.1,1.36 -0.26,2h-3.38z"/>
</vector>
Loading

0 comments on commit 3658d98

Please sign in to comment.