mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-05-06 02:07:05 +00:00
initial commit
This commit is contained in:
parent
c3ea07c071
commit
46bb998b2f
19 changed files with 172 additions and 66 deletions
|
|
@ -30,9 +30,12 @@ import androidx.preference.PreferenceFragmentCompat;
|
|||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.SwitchPreferenceCompat;
|
||||
|
||||
import com.vectras.vm.AboutActivity;
|
||||
import com.vectras.vm.MainActivity;
|
||||
import com.vectras.vm.R;
|
||||
import com.vectras.vm.RomsManagerActivity;
|
||||
import com.vectras.vm.SplashActivity;
|
||||
import com.vectras.vm.StoreActivity;
|
||||
import com.vectras.vm.VectrasApp;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -132,7 +135,6 @@ public class MainSettingsManager extends AppCompatActivity
|
|||
|
||||
}
|
||||
|
||||
|
||||
public static class AppPreferencesFragment extends PreferenceFragmentCompat
|
||||
implements Preference.OnPreferenceChangeListener {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -236,6 +236,8 @@ public class MainVNCActivity extends VncCanvasActivity {
|
|||
});
|
||||
JoystickView joystick = (JoystickView) findViewById(R.id.joyStick);
|
||||
joystick.setVisibility(View.GONE);
|
||||
ImageButton btnFit = findViewById(R.id.btnFit);
|
||||
btnFit.setVisibility(View.GONE);
|
||||
tabBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ public class CustomRomActivity extends AppCompatActivity {
|
|||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
setTitle("Rom Options");
|
||||
setTitle(getString(R.string.rom_options));
|
||||
//AdView mAdView = findViewById(R.id.adView);
|
||||
//AdRequest adRequest = new AdRequest.Builder().build();
|
||||
//mAdView.loadAd(adRequest);
|
||||
|
|
|
|||
|
|
@ -597,18 +597,18 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
if (Config.debug)
|
||||
UIUtils.UIAlert(activity, "DEBUG TESTING BUILD 5", "welcome to debug build of vectras vm :)<br>" +
|
||||
"this version unstable and has alot of bugs<br>" +
|
||||
"don't forget to tell us on github issues or telegram bot<br>" +
|
||||
"<a href=\"https://t.me/vectras_protect_bot\">telegram report bot</a><br>" +
|
||||
"<a href=\"https://github.com/epicstudios856/Vectras-VM-Android/issues\">github issues page</a><br>");
|
||||
UIUtils.UIAlert(activity, getString(R.string.debug_testing_build_5), getString(R.string.welcome_to_debug_build_of_vectras_vm_br) +
|
||||
getString(R.string.this_version_unstable_and_has_alot_of_bugs_br) +
|
||||
getString(R.string.don_t_forget_to_tell_us_on_github_issues_or_telegram_bot_br) +
|
||||
getString(R.string.a_href_https_t_me_vectras_protect_bot_telegram_report_bot_a_br) +
|
||||
getString(R.string.a_href_https_github_com_epicstudios856_vectras_vm_android_issues_github_issues_page_a_br));
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
if (!prefs.getBoolean("tgDialog", false)) {
|
||||
AlertDialog alertDialog;
|
||||
alertDialog = new AlertDialog.Builder(activity, R.style.MainDialogTheme).create();
|
||||
alertDialog.setTitle("JOIN US ON TELEGRAM");
|
||||
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() {
|
||||
alertDialog.setTitle(getString(R.string.join_us_on_telegram));
|
||||
alertDialog.setMessage(getString(R.string.join_us_on_telegram_where_we_publish_all_the_news_and_updates_and_receive_your_opinions_and_bugs));
|
||||
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.join), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String tg = "https://t.me/vectras_os";
|
||||
Intent f = new Intent(Intent.ACTION_VIEW);
|
||||
|
|
@ -617,12 +617,12 @@ public class MainActivity extends AppCompatActivity {
|
|||
return;
|
||||
}
|
||||
});
|
||||
alertDialog.setButton(DialogInterface.BUTTON_NEUTRAL, "CANCEL", new DialogInterface.OnClickListener() {
|
||||
alertDialog.setButton(DialogInterface.BUTTON_NEUTRAL, getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "DONT SHOW AGAIN", new DialogInterface.OnClickListener() {
|
||||
alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.dont_show_again), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import static android.content.Intent.ACTION_VIEW;
|
|||
import com.termux.app.TermuxService;
|
||||
import static com.vectras.vm.utils.UIUtils.UIAlert;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
|
|
@ -316,6 +317,7 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
String tarPath;
|
||||
|
||||
// Function to append text and automatically scroll to bottom
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void appendTextAndScroll(String textToAdd) {
|
||||
ScrollView scrollView = findViewById(R.id.scrollView);
|
||||
|
||||
|
|
@ -331,29 +333,29 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
|
||||
if (textToAdd.contains("Starting setup...")) {
|
||||
title.setText("Getting ready for you...");
|
||||
textviewsettingup.setText("Getting ready for you...\nPlease don't disconnect the network.");
|
||||
textviewsettingup.setText(R.string.getting_ready_for_you_please_don_t_disconnect_the_network);
|
||||
} else if (textToAdd.contains("Installing packages...")) {
|
||||
title.setText("It won't take long...");
|
||||
textviewsettingup.setText("Completed 10%\nIt won't take long...");
|
||||
title.setText(R.string.it_won_t_take_long);
|
||||
textviewsettingup.setText(R.string.completed_10_it_won_t_take_long);
|
||||
} else if (textToAdd.contains("(50/")) {
|
||||
textviewsettingup.setText("Completed 20%\nIt won't take long...");
|
||||
textviewsettingup.setText(R.string.completed_20_it_won_t_take_long);
|
||||
} else if (textToAdd.contains("100/")) {
|
||||
textviewsettingup.setText("Completed 30%\nIt won't take long...");
|
||||
textviewsettingup.setText(R.string.completed_30_it_won_t_take_long);
|
||||
} else if (textToAdd.contains("150/")) {
|
||||
textviewsettingup.setText("Completed 40%\nIt won't take long...");
|
||||
textviewsettingup.setText(R.string.completed_40_it_won_t_take_long);
|
||||
} else if (textToAdd.contains("200/")) {
|
||||
textviewsettingup.setText("Completed 50%\nIt won't take long...");
|
||||
textviewsettingup.setText(R.string.completed_50_it_won_t_take_long);
|
||||
} else if (textToAdd.contains("Downloading Qemu...")) {
|
||||
title.setText("Don't disconnect...");
|
||||
textviewsettingup.setText("Completed 75%\nDon't disconnect...");
|
||||
title.setText(R.string.don_t_disconnect);
|
||||
textviewsettingup.setText(R.string.completed_75_don_t_disconnect);
|
||||
} else if (textToAdd.contains("Installing Qemu...")) {
|
||||
title.setText("Keep it up...");
|
||||
textviewsettingup.setText("Completed 80%\nKeep it up...");
|
||||
title.setText(R.string.keep_it_up);
|
||||
textviewsettingup.setText(R.string.completed_80_keep_it_up);
|
||||
} else if (textToAdd.contains("qemu-system")) {
|
||||
textviewsettingup.setText("Completed 95%\nKeep it up...");
|
||||
textviewsettingup.setText(R.string.completed_95_keep_it_up);
|
||||
} else if (textToAdd.contains("Just a sec...")) {
|
||||
title.setText("Almost there.");
|
||||
textviewsettingup.setText("Almost there.");
|
||||
title.setText(R.string.almost_there);
|
||||
textviewsettingup.setText(getString(R.string.almost_there));
|
||||
}
|
||||
|
||||
// Scroll to the bottom
|
||||
|
|
@ -678,10 +680,10 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
}
|
||||
|
||||
alertDialog = new AlertDialog.Builder(activity, R.style.MainDialogTheme).create();
|
||||
alertDialog.setTitle("BOOTSTRAP REQUIRED!");
|
||||
alertDialog.setMessage("You can choose between auto download and setup or manual setup by choosing bootstrap file.");
|
||||
alertDialog.setTitle(getString(R.string.bootstrap_required));
|
||||
alertDialog.setMessage(getString(R.string.you_can_choose_between_auto_download_and_setup_or_manual_setup_by_choosing_bootstrap_file));
|
||||
alertDialog.setCancelable(false);
|
||||
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "AUTO SETUP", new DialogInterface.OnClickListener() {
|
||||
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.auto_setup), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//startDownload();
|
||||
if (AppConfig.getSetupFiles().contains("arm64-v8a") || AppConfig.getSetupFiles().contains("x86_64")) {
|
||||
|
|
@ -692,7 +694,7 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
return;
|
||||
}
|
||||
});
|
||||
alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "MANUAL SETUP", new DialogInterface.OnClickListener() {
|
||||
alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.manual_setup), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent(ACTION_OPEN_DOCUMENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import androidx.appcompat.app.AppCompatDelegate;
|
|||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.vectras.qemu.MainSettingsManager;
|
||||
import com.vectras.vm.utils.FileUtils;
|
||||
|
|
@ -85,15 +86,17 @@ public class SplashActivity extends AppCompatActivity implements Runnable {
|
|||
|
||||
setupFiles();
|
||||
|
||||
updateLocale(MainSettingsManager.getLang(activity));
|
||||
updateLocale();
|
||||
}
|
||||
|
||||
private void updateLocale(String languageCode) {
|
||||
private void updateLocale() {
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
String languageCode = sharedPreferences.getString("language", "en");
|
||||
|
||||
Locale locale = new Locale(languageCode);
|
||||
Locale.setDefault(locale);
|
||||
Configuration config = new Configuration();
|
||||
config.setLocale(locale);
|
||||
|
||||
getResources().updateConfiguration(config, getResources().getDisplayMetrics());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ public class StartVM {
|
|||
params.add("gtk");
|
||||
}
|
||||
|
||||
params.add("-full-screen");
|
||||
//params.add("-full-screen");
|
||||
|
||||
params.add("-qmp");
|
||||
params.add("tcp:localhost:4444,server,nowait");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.vectras.vm;
|
||||
|
||||
import static androidx.core.app.ActivityCompat.shouldShowRequestPermissionRationale;
|
||||
import static androidx.core.content.ContextCompat.getString;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
|
|
@ -443,16 +444,16 @@ public class VectrasApp extends Application {
|
|||
} else {
|
||||
if (request) {
|
||||
AlertDialog alertDialog = new AlertDialog.Builder(activity, R.style.MainDialogTheme).create();
|
||||
alertDialog.setTitle("Allow permissions");
|
||||
alertDialog.setMessage("You need to grant permission to access the storage before use.");
|
||||
alertDialog.setTitle(activity.getString(R.string.allow_permissions));
|
||||
alertDialog.setMessage(activity.getString(R.string.you_need_to_grant_permission_to_access_the_storage_before_use));
|
||||
alertDialog.setCancelable(false);
|
||||
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "Allow", new DialogInterface.OnClickListener() {
|
||||
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, getContext().getString(R.string.allow), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (activity.shouldShowRequestPermissionRationale(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
intent.setData(Uri.parse("package:" + activity.getPackageName()));
|
||||
activity.startActivity(intent);
|
||||
Toast.makeText(activity, "Find and allow access to storage in Settings.", Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(activity, R.string.find_and_allow_access_to_storage_in_settings, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,6 +368,7 @@ public class X11Activity extends AppCompatActivity implements View.OnApplyWindow
|
|||
|
||||
ImageButton shutdownBtn = findViewById(R.id.shutdownBtn);
|
||||
ImageButton settingBtn = findViewById(R.id.btnSettings);
|
||||
ImageButton btnFit = findViewById(R.id.btnFit);
|
||||
ImageButton keyboardBtn = findViewById(R.id.kbdBtn);
|
||||
ImageButton controllersBtn = findViewById(R.id.btnMode);
|
||||
ImageButton upBtn = findViewById(R.id.upBtn);
|
||||
|
|
@ -393,7 +394,27 @@ public class X11Activity extends AppCompatActivity implements View.OnApplyWindow
|
|||
ImageButton leftGameBtn = findViewById(R.id.leftGameBtn);
|
||||
ImageButton rightGameBtn = findViewById(R.id.rightGameBtn);
|
||||
ImageButton enterGameBtn = findViewById(R.id.enterGameBtn);
|
||||
|
||||
qmpBtn = findViewById(R.id.btnQmp);
|
||||
|
||||
final boolean[] isFullScreen = {false};
|
||||
btnFit.setOnClickListener(view -> {
|
||||
sendKey(KEYCODE_CTRL_LEFT, false);
|
||||
sendKey(KEYCODE_ALT_LEFT, false);
|
||||
sendKey(KEYCODE_F, false);
|
||||
sendKey(KEYCODE_CTRL_LEFT, true);
|
||||
sendKey(KEYCODE_ALT_LEFT, true);
|
||||
sendKey(KEYCODE_F, true);
|
||||
|
||||
if (isFullScreen[0]) {
|
||||
btnFit.setImageDrawable(getResources().getDrawable(R.drawable.close_fullscreen_24px));
|
||||
isFullScreen[0] = false;
|
||||
} else {
|
||||
btnFit.setImageDrawable(getResources().getDrawable(R.drawable.open_in_full_24px));
|
||||
isFullScreen[0] = true;
|
||||
}
|
||||
});
|
||||
|
||||
upGameBtn.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
|
|
@ -586,16 +607,15 @@ public class X11Activity extends AppCompatActivity implements View.OnApplyWindow
|
|||
newFragment.show(ft, "Controllers");
|
||||
}
|
||||
});
|
||||
settingBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final Dialog alertDialog = new Dialog(activity, R.style.MainDialogTheme);
|
||||
alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
alertDialog.setContentView(R.layout.dialog_setting);
|
||||
alertDialog.show();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.btnSettings)
|
||||
.setOnClickListener(
|
||||
(l) ->
|
||||
startActivity(
|
||||
new Intent(this, LoriePreferences.class) {
|
||||
{
|
||||
setAction(Intent.ACTION_MAIN);
|
||||
}
|
||||
}));
|
||||
upBtn.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue