mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-04-29 23:09:48 +00:00
v2.9.5.1-3dfx
- Now you can search in Rom store. - View information about roms in Rom Store more intuitively. - Support opening cvbi files in more file browsers.
This commit is contained in:
parent
db32a07e5b
commit
cb827624b0
9 changed files with 54 additions and 60 deletions
|
|
@ -959,6 +959,7 @@ public class CustomRomActivity extends AppCompatActivity {
|
|||
} else {
|
||||
DialogUtils.oneDialog(CustomRomActivity.this, getResources().getString(R.string.oops), getResources().getString(R.string.error_CR_CVBI1), getResources().getString(R.string.ok), true, R.drawable.error_96px, true, null, null);
|
||||
}
|
||||
Log.e("Error", "CR_CVBI1: " + _filepath);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import android.Manifest;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.widget.Button;
|
||||
|
|
@ -97,6 +98,7 @@ public class ReceiveRomFileActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
private String getFilePath(Uri _uri) {
|
||||
String result = "";
|
||||
if (_uri.toString().contains("/file%253A%252F%252F%252F")) {
|
||||
//Decrypt 2 times by FileProvider
|
||||
try {
|
||||
|
|
@ -104,16 +106,22 @@ public class ReceiveRomFileActivity extends AppCompatActivity {
|
|||
String decoded2 = URLDecoder.decode(decoded1, "UTF-8");
|
||||
//No need to check and works perfectly with return decoded2.replace("file://", "");
|
||||
if (decoded2.startsWith("/file://")) {
|
||||
return decoded2.replace("/file://", "");
|
||||
result = decoded2.replace("/file://", "");
|
||||
} else {
|
||||
return decoded2.replace("file://", "");
|
||||
result = decoded2.replace("file://", "");
|
||||
}
|
||||
} catch (UnsupportedEncodingException _e) {
|
||||
_e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
return _uri.getPath();
|
||||
result = _uri.getPath();
|
||||
}
|
||||
return null;
|
||||
|
||||
assert result != null;
|
||||
if (result.startsWith("/external_files")) {
|
||||
result = result.replace("/external_files", Environment.getExternalStorageDirectory().getAbsolutePath());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,26 +8,18 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.vectras.qemu.MainSettingsManager;
|
||||
import com.vectras.vm.databinding.ActivityRomInfoBinding;
|
||||
import com.vectras.vm.utils.DialogUtils;
|
||||
import com.vectras.vm.utils.FileUtils;
|
||||
import com.vectras.vm.utils.UIUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
|
@ -43,37 +35,20 @@ public class RomInfo extends AppCompatActivity {
|
|||
EdgeToEdge.enable(this);
|
||||
binding = ActivityRomInfoBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
// UIUtils.setOnApplyWindowInsetsListener(findViewById(R.id.main));
|
||||
|
||||
ImageView ivIcon;
|
||||
TextView textName;
|
||||
TextView textSize;
|
||||
Button btn_download;
|
||||
Button btn_pick;
|
||||
TextView descTxt;
|
||||
Toolbar toolbar;
|
||||
|
||||
ivIcon = findViewById(R.id.ivIcon);
|
||||
textName = findViewById(R.id.textName);
|
||||
textSize = findViewById(R.id.textSize);
|
||||
btn_download = findViewById(R.id.btn_download);
|
||||
btn_pick = findViewById(R.id.btn_pick);
|
||||
descTxt = findViewById(R.id.descTxt);
|
||||
toolbar = findViewById(R.id.toolbar);
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
toolbar.setNavigationOnClickListener(v -> {
|
||||
setSupportActionBar(binding.toolbar);
|
||||
binding.toolbar.setNavigationOnClickListener(v -> {
|
||||
onBackPressed();
|
||||
});
|
||||
|
||||
btn_download.setOnClickListener(v -> {
|
||||
binding.btnDownload.setOnClickListener(v -> {
|
||||
Intent openurl = new Intent();
|
||||
openurl.setAction(Intent.ACTION_VIEW);
|
||||
openurl.setData(Uri.parse(getIntent().getStringExtra("getrom")));
|
||||
startActivity(openurl);
|
||||
});
|
||||
|
||||
btn_pick.setOnClickListener(new View.OnClickListener() {
|
||||
binding.btnPick.setOnClickListener(new View.OnClickListener() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
@ -86,20 +61,19 @@ public class RomInfo extends AppCompatActivity {
|
|||
});
|
||||
|
||||
if (getIntent().hasExtra("title")) {
|
||||
textName.setText(getIntent().getStringExtra("title"));
|
||||
binding.textName.setText(getIntent().getStringExtra("title"));
|
||||
}
|
||||
if (getIntent().hasExtra("shortdesc")) {
|
||||
textSize.setText(getIntent().getStringExtra("shortdesc"));
|
||||
binding.textSize.setText(getIntent().getStringExtra("shortdesc"));
|
||||
}
|
||||
if (getIntent().hasExtra("desc")) {
|
||||
descTxt.setText(getIntent().getStringExtra("desc"));
|
||||
binding.descTxt.setText(getIntent().getStringExtra("desc"));
|
||||
}
|
||||
|
||||
if (getIntent().hasExtra("icon")) {
|
||||
Glide.with(this).load(getIntent().getStringExtra("icon")).placeholder(R.drawable.ic_computer_180dp_with_padding).error(R.drawable.ic_computer_180dp_with_padding).into(ivIcon);
|
||||
Glide.with(this).load(getIntent().getStringExtra("icon")).placeholder(R.drawable.ic_computer_180dp_with_padding).error(R.drawable.ic_computer_180dp_with_padding).into(binding.ivIcon);
|
||||
}
|
||||
|
||||
// btn_pick.setText(getString(R.string.select) + " " + getIntent().getStringExtra("filename"));
|
||||
initialize();
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +122,14 @@ public class RomInfo extends AppCompatActivity {
|
|||
}
|
||||
startActivity(intent);
|
||||
} else {
|
||||
UIUtils.oneDialog(getString(R.string.problem_has_been_detected), getString(R.string.please_select) + " " + getIntent().getStringExtra("filename"), true, false, this);
|
||||
DialogUtils.oneDialog(RomInfo.this,
|
||||
getString(R.string.problem_has_been_detected),
|
||||
getString(R.string.please_select) + " " + getIntent().getStringExtra("filename"),
|
||||
getString(R.string.ok),
|
||||
true, R.drawable.warning_48px,
|
||||
true,
|
||||
null,
|
||||
null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -204,8 +185,8 @@ public class RomInfo extends AppCompatActivity {
|
|||
|
||||
binding.lnCreator.setOnClickListener((v -> DialogUtils.oneDialog(
|
||||
RomInfo.this,
|
||||
getString(R.string.creator),
|
||||
getIntent().getStringExtra("creator"),
|
||||
getString(R.string.who_created_this_rom),
|
||||
getIntent().getStringExtra("creator") + ".",
|
||||
getString(R.string.ok),
|
||||
true,
|
||||
R.drawable.account_circle_24px,
|
||||
|
|
@ -216,7 +197,7 @@ public class RomInfo extends AppCompatActivity {
|
|||
binding.lnArch.setOnClickListener((v -> DialogUtils.oneDialog(
|
||||
RomInfo.this,
|
||||
getString(R.string.architecture),
|
||||
getArchName(Objects.requireNonNull(getIntent().getStringExtra("arch"))),
|
||||
getArchName(Objects.requireNonNull(getIntent().getStringExtra("arch"))) + ".",
|
||||
getString(R.string.ok),
|
||||
true,
|
||||
R.drawable.devices_other_24px,
|
||||
|
|
@ -227,7 +208,7 @@ public class RomInfo extends AppCompatActivity {
|
|||
binding.lnSize.setOnClickListener((v -> DialogUtils.oneDialog(
|
||||
RomInfo.this,
|
||||
getString(R.string.sizetext),
|
||||
getIntent().getStringExtra("size"),
|
||||
getIntent().getStringExtra("size") + ".",
|
||||
getString(R.string.ok),
|
||||
true,
|
||||
R.drawable.hard_drive_24px,
|
||||
|
|
@ -238,7 +219,7 @@ public class RomInfo extends AppCompatActivity {
|
|||
binding.lnFilename.setOnClickListener((v -> DialogUtils.oneDialog(
|
||||
RomInfo.this,
|
||||
getString(R.string.file_name),
|
||||
getIntent().getStringExtra("filename"),
|
||||
getIntent().getStringExtra("filename") + ".",
|
||||
getString(R.string.ok),
|
||||
true,
|
||||
R.drawable.file_copy_24px,
|
||||
|
|
@ -247,6 +228,7 @@ public class RomInfo extends AppCompatActivity {
|
|||
null)));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private String getArchName(String arch) {
|
||||
return switch (arch) {
|
||||
case "X86_64" -> getString(R.string.x86_64);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue