Skip to content

Commit

Permalink
Peach fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielBRDeveloper committed Jan 3, 2024
1 parent 7c1623c commit 1efb149
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.preference.Preference;
Expand Down Expand Up @@ -39,6 +40,8 @@ public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable S
profile.setName(name);
ControllerProfileManager.add(profile);
refreshScreenProfileList();
} else {
Toast.makeText(requireContext(), R.string.invalid_name, Toast.LENGTH_SHORT).show();
}
}).setTitle(R.string.create_profile).show();
});
Expand Down Expand Up @@ -66,15 +69,7 @@ public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable S
}

public String formatName(String name) {
name = String.valueOf(name);
while (name.startsWith(" ")) {
name = name.substring(1);
}
while (name.endsWith(" ")) {
name = name.substring(0, name.length() - 1);
}
name = name.replaceAll("\\s\\s", " ");
return name;
return name.trim().replaceAll("\\s\\s", " ");
}

private void refresh() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.panda3ds.pandroid.data;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.panda3ds.pandroid.lang.Task;
import com.panda3ds.pandroid.utils.FileUtils;

public class GsonConfigParser {
private final Gson gson = new Gson();
private final Gson gson = new GsonBuilder().setPrettyPrinting().create();
private final String name;

public GsonConfigParser(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ protected void dispatchDraw(Canvas canvas) {
}

public void drawSelected(Canvas canvas, Paint paint) {
int[] mePosition = new int[2];
int[] viewPosition = new int[2];
int[] absolutePosition = new int[2];
int[] selectedViewPosition = new int[2];

selectedView.getLocationOnScreen(viewPosition);
getLocationOnScreen(mePosition);
selectedView.getLocationOnScreen(selectedViewPosition);
getLocationOnScreen(absolutePosition);

int width = selectedView.getLayoutParams().width;
int height = selectedView.getLayoutParams().height;

int x = viewPosition[0] - mePosition[0];
int y = viewPosition[1] - mePosition[1];
int x = selectedViewPosition[0] - absolutePosition[0];
int y = selectedViewPosition[1] - absolutePosition[1];

canvas.drawRect(x, y, x + width, y + height, paint);
}
Expand Down
1 change: 1 addition & 0 deletions src/pandroid/app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@
<string name="name">Nome</string>
<string name="pref_screen_controllers_title">Disposições de controle</string>
<string name="pref_default_controller_title">Disposição de controle padrão</string>
<string name="invalid_name">Nome Invalido</string>
</resources>
1 change: 1 addition & 0 deletions src/pandroid/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@
<string name="name">Name</string>
<string name="pref_screen_controllers_title">Screen gamepad layouts</string>
<string name="pref_default_controller_title">Default screen gamepad layout</string>
<string name="invalid_name">Invalid name</string>
</resources>

0 comments on commit 1efb149

Please sign in to comment.