mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-05-04 09:10:32 +00:00
v2.3
This commit is contained in:
parent
7350c7cc47
commit
a512997f38
27 changed files with 2237 additions and 1584 deletions
|
|
@ -26,6 +26,8 @@ import android.os.Environment;
|
|||
import android.widget.ImageView.ScaleType;
|
||||
|
||||
import com.vectras.vm.AppConfig;
|
||||
import com.vectras.vm.SplashActivity;
|
||||
import com.vectras.vm.VectrasApp;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.LinkedHashMap;
|
||||
|
|
@ -116,7 +118,7 @@ public class Config {
|
|||
public static String getMachineDir(){
|
||||
return getBasefileDir() + machineFolder;
|
||||
}
|
||||
public static String logFilePath = null;
|
||||
public static String logFilePath = cacheDir + "/vectras/vectras-log.txt";
|
||||
|
||||
|
||||
public static final String defaultDNSServer = "8.8.8.8";
|
||||
|
|
@ -176,7 +178,9 @@ public class Config {
|
|||
//Change to true in prod if you want to be notified by default for new versions
|
||||
public static boolean defaultCheckNewVersion = true;
|
||||
|
||||
public static final String sharedFolder = AppConfig.sharedFolder;
|
||||
// App config
|
||||
public static final String datadirpath = VectrasApp.getApp().getExternalFilesDir("data")+"/";
|
||||
public static final String sharedFolder = datadirpath + "Vectras/ProgramFiles/";
|
||||
|
||||
public static String machinename = "VECTRAS";
|
||||
public static int paused = 0;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -248,7 +248,7 @@ public class MainSettingsManager extends AppCompatActivity
|
|||
implements Preference.OnPreferenceChangeListener {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.onCreate(savedInstanceState);/*
|
||||
Preference pref = findPreference("customMemory");
|
||||
if (pref != null) {
|
||||
pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
|
|
@ -278,7 +278,7 @@ public class MainSettingsManager extends AppCompatActivity
|
|||
}
|
||||
|
||||
});
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private void onMemory() {
|
||||
|
|
@ -629,6 +629,61 @@ public class MainSettingsManager extends AppCompatActivity
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
return prefs.getBoolean("virtio", false);
|
||||
}
|
||||
|
||||
public static void setAvx(Activity activity, boolean AVX) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putBoolean("AVX", AVX);
|
||||
edit.apply();
|
||||
}
|
||||
|
||||
public static boolean getAvx(Activity activity) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
return prefs.getBoolean("AVX", false);
|
||||
}
|
||||
|
||||
public static void setTbSize(Activity activity, String TbSize) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("TbSize", TbSize);
|
||||
edit.apply();
|
||||
}
|
||||
|
||||
public static String getTbSize(Activity activity) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
return prefs.getString("TbSize", "2048");
|
||||
}
|
||||
|
||||
public static void setVmUi(Activity activity, String vmUi) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("vmUi", vmUi);
|
||||
edit.apply();
|
||||
}
|
||||
public static String getVmUi(Activity activity) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
return prefs.getString("vmUi", "VNC");
|
||||
}
|
||||
public static void setUsbTablet(Activity activity, boolean UsbTablet) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putBoolean("UsbTablet", UsbTablet);
|
||||
edit.apply();
|
||||
}
|
||||
public static boolean getUsbTablet(Activity activity) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
return prefs.getBoolean("UsbTablet", false);
|
||||
}
|
||||
public static void setCustomParams(Activity activity, String customParams) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("customParams", customParams);
|
||||
edit.apply();
|
||||
}
|
||||
public static String getCustomParams(Activity activity) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
return prefs.getString("customParams", "");
|
||||
}
|
||||
public static boolean isFirstLaunch(Activity activity) {
|
||||
PackageInfo pInfo = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,12 +6,14 @@ import android.androidVNC.VncCanvasActivity;
|
|||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.core.view.MenuItemCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
|
|
@ -51,6 +53,7 @@ import android.widget.SeekBar;
|
|||
import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.vectras.qemu.utils.FileUtils;
|
||||
import com.vectras.vm.Fragment.ControlersOptionsFragment;
|
||||
import com.vectras.vm.MainActivity;
|
||||
import com.vectras.vm.R;
|
||||
|
|
@ -124,8 +127,15 @@ public class MainVNCActivity extends VncCanvasActivity {
|
|||
ImageButton ctrlBtn = findViewById(R.id.ctrlBtn);
|
||||
ImageButton altBtn = findViewById(R.id.altBtn);
|
||||
ImageButton delBtn = findViewById(R.id.delBtn);
|
||||
ImageButton btnLogs = findViewById(R.id.btnLogs);
|
||||
Button ctrlAltDelBtn = findViewById(R.id.ctrlAltDelBtn);
|
||||
qmpBtn = findViewById(R.id.btnQmp);
|
||||
btnLogs.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
FileUtils.viewVectrasLog(activity);
|
||||
}
|
||||
});
|
||||
shutdownBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
@ -1184,20 +1194,11 @@ public class MainVNCActivity extends VncCanvasActivity {
|
|||
|
||||
}
|
||||
|
||||
|
||||
public void onBackPressed() {
|
||||
|
||||
// super.onBackPressed();
|
||||
if (!MainSettingsManager.getAlwaysShowMenuToolbar(activity)) {
|
||||
ActionBar bar = this.getSupportActionBar();
|
||||
if (bar != null) {
|
||||
if (bar.isShowing() && Config.mouseMode == Config.MouseMode.Trackpad) {
|
||||
bar.hide();
|
||||
}/* else
|
||||
bar.show();*/
|
||||
}
|
||||
} else
|
||||
super.onBackPressed();
|
||||
|
||||
super.onBackPressed();
|
||||
Machine.stopVM(activity);
|
||||
return;
|
||||
}
|
||||
|
||||
public void onHideToolbar() {
|
||||
|
|
|
|||
|
|
@ -64,22 +64,22 @@ public class StartVM {
|
|||
public String vnc_passwd = "vectras";
|
||||
|
||||
// cpu/board settings
|
||||
private String cpu;
|
||||
public String cpu;
|
||||
private String arch = "x86";
|
||||
private String machine_type;
|
||||
private int memory = 128;
|
||||
public int memory = 128;
|
||||
private int cpuNum = 1;
|
||||
public int enablekvm;
|
||||
public int enable_mttcg;
|
||||
|
||||
// disks
|
||||
public String hda_img_path;
|
||||
private String hdb_img_path;
|
||||
private String hdc_img_path;
|
||||
private String hdd_img_path;
|
||||
public String hdb_img_path;
|
||||
public String hdc_img_path;
|
||||
public String hdd_img_path;
|
||||
public String shared_folder_path;
|
||||
public int shared_folder_readonly = 1;
|
||||
private String hd_cache = "default";
|
||||
public String hd_cache = "default";
|
||||
|
||||
//removable devices
|
||||
public String cd_iso_path;
|
||||
|
|
@ -88,26 +88,30 @@ public class StartVM {
|
|||
public String sd_img_path;
|
||||
|
||||
//boot options
|
||||
private String bootdevice = null;
|
||||
public String bootdevice = null;
|
||||
private String kernel;
|
||||
private String initrd;
|
||||
|
||||
//graphics
|
||||
private String vga_type = "std";
|
||||
public String vga_type = "std";
|
||||
|
||||
//audio
|
||||
public String sound_card;
|
||||
|
||||
// net
|
||||
private String net_cfg = "None";
|
||||
private String nic_card = null;
|
||||
public String net_cfg = "None";
|
||||
public String nic_card = null;
|
||||
private String hostfwd = null;
|
||||
private String guestfwd = null;
|
||||
|
||||
//advanced
|
||||
private int disableacpi = 0;
|
||||
private int disablehpet = 0;
|
||||
private int disabletsc = 0;
|
||||
public int disableacpi = 0;
|
||||
public int disablehpet = 0;
|
||||
public int disabletsc = 0;
|
||||
|
||||
public boolean enablleAvx = false;
|
||||
public String tbSize = "2048";
|
||||
|
||||
public String extra_params;
|
||||
|
||||
/**
|
||||
|
|
@ -120,7 +124,11 @@ public class StartVM {
|
|||
save_dir = Config.getMachineDir() + name;
|
||||
save_state_name = save_dir + "/" + Config.state_filename;
|
||||
hda_img_path = Config.hda_path;
|
||||
|
||||
extra_params = Config.extra_params;
|
||||
extra_params += " ";
|
||||
extra_params += MainSettingsManager.getCustomParams(MainActivity.activity);
|
||||
|
||||
shared_folder_path = Config.sharedFolder;
|
||||
//extra_params = Config.extra_params;
|
||||
this.context = context;
|
||||
|
|
@ -133,6 +141,14 @@ public class StartVM {
|
|||
this.enable_mttcg = 0;
|
||||
this.vnc_allow_external = 0;
|
||||
|
||||
this.enablleAvx = MainSettingsManager.getAvx(MainActivity.activity);
|
||||
|
||||
this.tbSize = MainSettingsManager.getTbSize(MainActivity.activity);
|
||||
|
||||
if (MainSettingsManager.getUsbTablet(MainActivity.activity))
|
||||
this.mouse = "usb-tablet";
|
||||
else
|
||||
this.mouse = "ps2";
|
||||
}
|
||||
|
||||
public static void onVMResolutionChanged(int width, int height) {
|
||||
|
|
@ -283,7 +299,8 @@ public class StartVM {
|
|||
}
|
||||
|
||||
if (mouse != null && !mouse.equals("ps2")) {
|
||||
paramsList.add("-usb");
|
||||
paramsList.add("-machine");
|
||||
paramsList.add("usb=on");
|
||||
paramsList.add("-device");
|
||||
paramsList.add(mouse);
|
||||
}
|
||||
|
|
@ -309,7 +326,7 @@ public class StartVM {
|
|||
|
||||
private void addAudioOptions(ArrayList<String> paramsList) {
|
||||
|
||||
if (sound_card != null && !sound_card.equals("None")) {
|
||||
if (sound_card != null && !sound_card.equals("None") && enablevnc != 1) {
|
||||
paramsList.add("-soundhw");
|
||||
paramsList.add(sound_card);
|
||||
}
|
||||
|
|
@ -384,7 +401,7 @@ public class StartVM {
|
|||
if (this.cpuNum > 1 &&
|
||||
(enablekvm == 1 || enable_mttcg == 1 || !Config.enableSMPOnlyOnKVM)) {
|
||||
paramsList.add("-smp");
|
||||
paramsList.add("sockets="+"1"+",cores="+this.cpuNum+",threads="+this.cpuNum+"");
|
||||
paramsList.add("sockets=" + "1" + ",cores=" + this.cpuNum + ",threads=" + this.cpuNum + "");
|
||||
}
|
||||
|
||||
if (machine_type != null && !machine_type.equals("Default")) {
|
||||
|
|
@ -411,7 +428,11 @@ public class StartVM {
|
|||
|
||||
if (this.cpu != null && !cpu.equals("Default")) {
|
||||
paramsList.add("-cpu");
|
||||
paramsList.add(cpu + ",+avx");
|
||||
String cpuParams = null;
|
||||
cpuParams += cpu;
|
||||
if (enablleAvx)
|
||||
cpuParams += ",+avx";
|
||||
paramsList.add(cpuParams);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -429,7 +450,7 @@ public class StartVM {
|
|||
tcgParams += ",thread=multi";
|
||||
else
|
||||
tcgParams += ",thread=single";
|
||||
tcgParams += ",tb-size=2048";
|
||||
tcgParams += ",tb-size=" + tbSize;
|
||||
paramsList.add(tcgParams);
|
||||
//#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
package com.vectras.qemu.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.vectras.qemu.Config;
|
||||
import com.vectras.vm.MainActivity;
|
||||
import com.vectras.vm.R;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.vectras.vm.Fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
|
@ -21,6 +22,7 @@ import android.widget.Switch;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
|
@ -28,6 +30,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import com.vectras.vm.R;
|
||||
import com.vectras.vm.RomsManagerActivity;
|
||||
import com.vectras.vm.MainActivity;
|
||||
import com.vectras.vm.VectrasApp;
|
||||
import com.vectras.vm.adapter.LogsAdapter;
|
||||
import com.vectras.vm.logger.VectrasStatus;
|
||||
import com.vectras.vm.utils.UIUtils;
|
||||
|
|
@ -46,20 +49,21 @@ import java.util.TimerTask;
|
|||
public class LoggerFragment extends Fragment {
|
||||
|
||||
View view;
|
||||
MainActivity activity = MainActivity.activity;
|
||||
private final String CREDENTIAL_SHARED_PREF = "settings_prefs";
|
||||
private LogsAdapter mLogAdapter;
|
||||
private RecyclerView logList;
|
||||
private Timer _timer = new Timer();
|
||||
private TimerTask t;
|
||||
Activity activity;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
view = inflater.inflate(R.layout.fragment_logs, container, false);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(MainActivity.activity);
|
||||
mLogAdapter = new LogsAdapter(layoutManager, MainActivity.activity);
|
||||
activity = getActivity();
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(VectrasApp.getApp());
|
||||
mLogAdapter = new LogsAdapter(layoutManager, VectrasApp.getApp());
|
||||
logList = (RecyclerView) view.findViewById(R.id.recyclerLog);
|
||||
logList.setAdapter(mLogAdapter);
|
||||
logList.setLayoutManager(layoutManager);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import android.androidVNC.RfbProto;
|
|||
import android.androidVNC.VncCanvas;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Dialog;
|
||||
|
|
@ -49,6 +50,7 @@ import androidx.drawerlayout.widget.DrawerLayout;
|
|||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.vectordrawable.graphics.drawable.ArgbEvaluator;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
|
|
@ -71,6 +73,7 @@ import com.vectras.qemu.utils.Machine;
|
|||
import com.vectras.qemu.utils.QmpClient;
|
||||
import com.vectras.vm.Fragment.HomeFragment;
|
||||
import com.vectras.vm.Fragment.LoggerFragment;
|
||||
import com.vectras.vm.MainRoms.AdapterMainRoms;
|
||||
import com.vectras.vm.logger.VectrasStatus;
|
||||
import com.vectras.vm.utils.AppUpdater;
|
||||
import com.vectras.qemu.utils.FileInstaller;
|
||||
|
|
@ -146,7 +149,6 @@ public class MainActivity extends AppCompatActivity {
|
|||
setupStrictMode();
|
||||
execTimer();
|
||||
checkAndLoadLibs();
|
||||
Config.logFilePath = Config.cacheDir + "/vectras/vectras-log.txt";
|
||||
activity = this;
|
||||
this.setContentView(R.layout.main);
|
||||
this.setupWidgets();
|
||||
|
|
@ -446,7 +448,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
if (MainSettingsManager.getPromptUpdateVersion(activity))
|
||||
updateApp(true);
|
||||
updateApp(false);
|
||||
/*FirebaseUser user = mAuth.getCurrentUser();
|
||||
TextView usernameTxt = findViewById(R.id.usernameTxt);
|
||||
TextView emailTxt = findViewById(R.id.emailTxt);
|
||||
|
|
@ -476,6 +478,12 @@ public class MainActivity extends AppCompatActivity {
|
|||
AlertDialog alertDialog;
|
||||
alertDialog = new AlertDialog.Builder(activity, R.style.MainDialogTheme).create();
|
||||
alertDialog.setTitle("JOIN US ON TELEGRAM");
|
||||
TextView title = alertDialog.findViewById(R.id.title_text);
|
||||
ObjectAnimator rgbAnim=ObjectAnimator.ofObject(title,"textColor",new ArgbEvaluator(), Color.RED,Color.GREEN,Color.BLUE);
|
||||
rgbAnim.setDuration(1000);
|
||||
rgbAnim.setRepeatMode(ValueAnimator.REVERSE);
|
||||
rgbAnim.setRepeatCount(ValueAnimator.INFINITE);
|
||||
rgbAnim.start();
|
||||
alertDialog.setMessage("Join us on Telegram where we publish all the news and updates and receive your opinions and bugs");
|
||||
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "JOIN", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
|
@ -533,6 +541,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
|
@ -541,6 +550,8 @@ public class MainActivity extends AppCompatActivity {
|
|||
} else {
|
||||
Config.hd_if_type = "ide";
|
||||
}
|
||||
setupFolders();
|
||||
Config.ui = MainSettingsManager.getVmUi(activity);
|
||||
InterstitialAd.load(this, "ca-app-pub-3568137780412047/7745973511", adRequest,
|
||||
new InterstitialAdLoadCallback() {
|
||||
@Override
|
||||
|
|
@ -756,21 +767,18 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
public static void setupFolders() {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
Config.cacheDir = activity.getCacheDir().getAbsolutePath();
|
||||
Config.storagedir = Environment.getDataDirectory().toString();
|
||||
|
||||
Config.cacheDir = activity.getCacheDir().getAbsolutePath();
|
||||
Config.storagedir = Environment.getExternalStorageDirectory().toString();
|
||||
// Create Temp folder
|
||||
File folder = new File(Config.getTmpFolder());
|
||||
if (!folder.exists())
|
||||
folder. mkdirs();
|
||||
|
||||
// Create Temp folder
|
||||
File folder = new File(Config.getTmpFolder());
|
||||
if (!folder.exists())
|
||||
folder.mkdirs();
|
||||
} catch (Exception ignored) {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
}
|
||||
|
||||
//XXX: sometimes this needs to be called from the main thread otherwise
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.vectras.vm.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue