A lot of changes

* Custom controls:
- Rename classes
- Add Dynamic position calculator for auto scale. TODO: document position variables
* Source code
- Abstracts MainActivity.java to prepare implement custom control.
This commit is contained in:
khanhduytran0
2020-11-17 14:38:20 +07:00
parent 67a0babb7a
commit 84f97f3ccd
24 changed files with 1682 additions and 1591 deletions

View File

@@ -120,7 +120,7 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
alert.setPositiveButton(android.R.string.ok, null);
alert.setNegativeButton(android.R.string.cancel, null);
final AlertDialog dialog = alert.create();
final ControlButton properties = mHandleView.mView.getProperties();
final ControlData properties = mHandleView.mView.getProperties();
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@@ -134,7 +134,7 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
final Spinner spinnerKeycode = dialog.findViewById(R.id.controlsetting_spinner_lwjglkeycode);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(view.getContext(), android.R.layout.simple_spinner_item);
String[] oldSpecialArr = ControlButton.buildSpecialButtonArray();
String[] oldSpecialArr = ControlData.buildSpecialButtonArray();
String[] specialArr = new String[oldSpecialArr.length];
for (int i = 0; i < specialArr.length; i++) {
specialArr[i] = "SPECIAL_" + oldSpecialArr[i];
@@ -145,7 +145,7 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
adapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
spinnerKeycode.setAdapter(adapter);
if (properties.keycode < 0) {
spinnerKeycode.setSelection(properties.keycode + 2);
spinnerKeycode.setSelection(properties.keycode + 5);
} else {
spinnerKeycode.setSelection(AndroidLWJGLKeycode.getIndexByLWJGLKey(properties.keycode + 2));
}
@@ -194,7 +194,7 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
@Override
public void onClick(DialogInterface p1, int p2)
{
ControlsLayout layout = ((ControlsLayout) mHandleView.mView.getParent());
ControlLayout layout = ((ControlLayout) mHandleView.mView.getParent());
layout.removeControlButton(mHandleView.mView);
}
});

View File

@@ -59,7 +59,7 @@ public abstract class HandleView extends View implements ViewPositionListener, V
private Runnable mActionPopupShower;
// Minimum touch target size for handles
private int mMinSize;
protected ControlView mView;
protected ControlButton mView;
// MOD: Addition. Save old size of parent
private int mDownWidth, mDownHeight;
@@ -92,7 +92,7 @@ public abstract class HandleView extends View implements ViewPositionListener, V
return -1;
}
public HandleView(ControlView view) {
public HandleView(ControlButton view) {
super(view.getContext());
mView = view;

View File

@@ -27,7 +27,7 @@ import net.kdt.pojavlaunch.customcontrols.*;
public class SelectionEndHandleView extends HandleView
{
public SelectionEndHandleView(ControlView view) {
public SelectionEndHandleView(ControlButton view) {
super(view);
}