Skip to content

Commit

Permalink
Merge pull request #11 from Mraulio/improv
Browse files Browse the repository at this point in the history
Added translations
  • Loading branch information
Mraulio authored Aug 18, 2023
2 parents 61e2523 + c50d98c commit b6f5055
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,6 @@ public void onClick(DialogInterface dialog, int which) {
LocalDateTime now = LocalDateTime.now();

File gifFile = new File(Utils.IMAGES_FOLDER, "GIF_" + dtf.format(now) + ".gif");
File mp4File = new File(Utils.IMAGES_FOLDER, "GIF_" + dtf.format(now) + ".mp4");

try (FileOutputStream out = new FileOutputStream(gifFile)) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public void onClick(View v) {
}
} else if (cbAddFrame.isChecked()) {
if (finalListBitmaps.get(0).getHeight() != 144 && finalListBitmaps.get(0).getHeight() != 224) {
Utils.toast(getContext(), "Can't add this image as a frame");//Add string
Utils.toast(getContext(), getString(R.string.cant_add_frame));//Add string
btnAddImages.setEnabled(true);
} else frameNameDialog();
}
Expand All @@ -337,27 +337,27 @@ private void frameNameDialog() {
EditText etFrameName = view.findViewById(R.id.etFrameName);
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setView(view);
AlertDialog alertdialog = builder.create();
AlertDialog alertdialog = builder.create();

etFrameName.setImeOptions(EditorInfo.IME_ACTION_DONE);//When pressing enter
builder.setTitle("Set new Frame name");//Add string
// builder.setTitle("Set new Frame name");//Add string
Button btnSaveFrame = view.findViewById(R.id.btnSaveFrame);
btnSaveFrame.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GbcFrame gbcFrame = new GbcFrame();
gbcFrame.setFrameBitmap(filledFrame);
if (filledFrame.getHeight()==224){
if (filledFrame.getHeight() == 224) {
gbcFrame.setWildFrame(true);
}
List<GbcFrame> newFrameImages = new ArrayList<>();
//Add here the dialog for the frame name
String frameName = etFrameName.getText().toString();
if (frameName.equals("")) {
Utils.toast(getContext(), "Name must not be empty");//Add string
Utils.toast(getContext(), getString(R.string.no_empty_frame_name));
etFrameName.setBackgroundColor(Color.parseColor("#FF0000"));
} else if (frameName.contains(" ")) {
Utils.toast(getContext(), "Text must no contain empty spaces.");//Add string
Utils.toast(getContext(), getString(R.string.no_spaces_frame_name));//Add string
etFrameName.setBackgroundColor(Color.parseColor("#FF0000"));
} else {
gbcFrame.setFrameName(frameName);
Expand All @@ -367,7 +367,7 @@ public void onClick(View v) {
if (frame.getFrameName().toLowerCase(Locale.ROOT).equals(gbcFrame.getFrameName())) {
alreadyAdded = true;
etFrameName.setBackgroundColor(Color.parseColor("#FF0000"));
Utils.toast(getContext(), "This frame name already exists.");//Add string
Utils.toast(getContext(), getString(R.string.frame_name_exists));//Add string
break;
}
}
Expand Down Expand Up @@ -857,7 +857,7 @@ public void onActivityResult(ActivityResult result) {

} else {
tvFileName.setText(getString(R.string.file_name) + fileName);
tvFileName.setText("Not a valid image file");
tvFileName.setText(getString(R.string.no_valid_image_file));
btnExtractFile.setVisibility(View.GONE);
btnAddImages.setVisibility(View.GONE);
layoutCb.setVisibility(View.GONE);
Expand Down Expand Up @@ -898,7 +898,6 @@ public boolean extractSavImages() {
listImportedImageBytes = extractor.extractBytes(fileBytes);
//Check for Magic or FF bytes
if (!magicIsReal(fileBytes)) {
System.out.println("NO VALID FILE///////////////////////");
return false;
}
int nameIndex = 1;
Expand All @@ -917,7 +916,7 @@ public boolean extractSavImages() {
String hashHex = Utils.bytesToHex(hash);
gbcImage.setHashCode(hashHex);
ImageCodec imageCodec = new ImageCodec(128, 112, gbcImage.isLockFrame());
Bitmap image = imageCodec.decodeWithPalette(Utils.hashPalettes.get(gbcImage.getPaletteId()).getPaletteColorsInt(), imageBytes, false,false);
Bitmap image = imageCodec.decodeWithPalette(Utils.hashPalettes.get(gbcImage.getPaletteId()).getPaletteColorsInt(), imageBytes, false, false);
if (image.getHeight() == 112 && image.getWidth() == 128) {
//I need to use copy because if not it's inmutable bitmap
Bitmap framed = Utils.framesList.get(3).getFrameBitmap().copy(Bitmap.Config.ARGB_8888, true);
Expand Down Expand Up @@ -961,7 +960,7 @@ public static void extractHexImages(String fileContent) throws NoSuchAlgorithmEx
gbcImage.setName(fileName + " " + formattedIndex);
int height = (data.length() + 1) / 120;//To get the real height of the image
ImageCodec imageCodec = new ImageCodec(160, height, false);
Bitmap image = imageCodec.decodeWithPalette(Utils.hashPalettes.get(gbcImage.getPaletteId()).getPaletteColorsInt(), gbcImage.getImageBytes(), false,false);
Bitmap image = imageCodec.decodeWithPalette(Utils.hashPalettes.get(gbcImage.getPaletteId()).getPaletteColorsInt(), gbcImage.getImageBytes(), false, false);
importedImagesBitmaps.add(image);
importedImagesList.add(gbcImage);
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_import.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
android:layout_height="wrap_content"
android:id="@+id/cbAddFrame"
android:visibility="gone"
android:text="Add as frame"
android:text="@string/add_as_frame"
/>
<GridView
android:id="@+id/gridViewImport"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
android:autoSizeMinTextSize="10sp"
android:autoSizeTextType="uniform"
android:maxLines="1"
android:text="Show Rotation button" />
android:text="@string/rotation_button" />

<TextView
android:layout_width="match_parent"
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout/frame_name_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
android:id="@+id/etFrameName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Set frame name"
android:hint="@string/frame_name"
android:singleLine="true" />

<ImageView
Expand All @@ -31,6 +31,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Save frame" />
android:text="@string/btn_add_frames"
/>
</LinearLayout>
</ScrollView>
11 changes: 11 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,15 @@

<string name="analyzing">Analyse läuft, bitte warten...</string>
<string name="done_analyzing">Fertig mit der Analyse!</string>

<string name="check_magic">Überprüfen Sie beim Import/Extrahieren, ob eine gültige .sav-Datei vorhanden ist</string>
<string name="delete_photo_folder_dialog">Photo-ROM-Ordner löschen?</string>
<string name="add_as_frame">Als Frame hinzufügen</string>
<string name="rotation_button">Schaltfläche Rotation anzeigen.</string>
<string name="frame_name">Legen Sie den Frame-Namen fest</string>
<string name="cant_add_frame">Dieses Bild kann nicht als Frame hinzugefügt werden</string>
<string name="no_empty_frame_name">Der Name darf nicht leer sein</string>
<string name="no_spaces_frame_name">Der Name darf keine Leerzeichen enthalten</string>
<string name="frame_name_exists">Dieser Framename existiert bereits</string>
<string name="no_valid_image_file">Keine gültige Bilddatei</string>
</resources>
10 changes: 9 additions & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,13 @@
<string name="done_analyzing">¡Análisis terminado!</string>

<string name="check_magic">Comprobar .sav válido al importar/extraer</string>

<string name="delete_photo_folder_dialog">¿Borrar directorio de rom Photo?</string>
<string name="add_as_frame">Añadir como marco</string>
<string name="rotation_button">Mostrar botón Rotar</string>
<string name="frame_name">Establecer nombre del marco</string>
<string name="cant_add_frame">No se puede añadir esta imagen como marco</string>
<string name="no_empty_frame_name">El nombre no debe estar vacío</string>
<string name="no_spaces_frame_name">El nombre no debe contener espacios</string>
<string name="frame_name_exists">Este nombre de marco ya existe</string>
<string name="no_valid_image_file">No es un archivo de imagen válido</string>
</resources>
11 changes: 11 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,15 @@

<string name="analyzing">Analyse en cours, veuillez patienter...</string>
<string name="done_analyzing">Analyse terminée!</string>

<string name="check_magic">Vérifier la validité du fichier .sav lors de l\'importation/extraction</string>
<string name="delete_photo_folder_dialog">Supprimer le dossier rom Photo?</string>
<string name="add_as_frame">Ajouter comme bordure</string>
<string name="rotation_button">Bouton Afficher la rotation</string>
<string name="frame_name">Définir le nom du bordure</string>
<string name="cant_add_frame">Impossible d\'ajouter cette image en tant que bordure</string>
<string name="no_empty_frame_name">Le nom ne doit pas être vide</string>
<string name="no_spaces_frame_name">Le nom ne doit pas contenir d\'espaces vides</string>
<string name="frame_name_exists">Ce nom de bordure existe déjà</string>
<string name="no_valid_image_file">Pas un fichier image valide</string>
</resources>
11 changes: 11 additions & 0 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,15 @@

<string name="analyzing">Analisando, aguarde...</string>
<string name="done_analyzing">Análise concluída!</string>

<string name="check_magic">Verifique se há .sav válido ao importar/extrair</string>
<string name="delete_photo_folder_dialog">Deletar a pasta Photo rom?</string>
<string name="add_as_frame">Adicionar como moldura</string>
<string name="rotation_button">Mostrar botão de rotação</string>
<string name="frame_name">Definir nome do moldura</string>
<string name="cant_add_frame">Não é possível adicionar esta imagem como moldura</string>
<string name="no_empty_frame_name">O nome não deve estar vazio</string>
<string name="no_spaces_frame_name">O nome não deve conter espaços vazios</string>
<string name="frame_name_exists">Este nome de moldura já existe</string>
<string name="no_valid_image_file">Não é um arquivo de imagem válido</string>
</resources>
10 changes: 8 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@

<string name="check_magic">Check for valid .sav when importing/extracting</string>
<string name="delete_photo_folder_dialog">Delete Photo rom folder?</string>


<string name="add_as_frame">Add as frame</string>
<string name="rotation_button">Show Rotation button</string>
<string name="frame_name">Set frame name</string>
<string name="cant_add_frame">Can\'t add this image as a frame</string>
<string name="no_empty_frame_name">Name must not be empty</string>
<string name="no_spaces_frame_name">Name must not contain empty spaces</string>
<string name="frame_name_exists">This frame name already exists</string>
<string name="no_valid_image_file">Not a valid image file</string>

</resources>

0 comments on commit b6f5055

Please sign in to comment.