mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-16 08:05:34 -04:00
Bring auto re-locate to non-dynamic buttons.
Later will rename "dynamic" to use "custom dynamic"
This commit is contained in:
parent
487151c7fb
commit
7a5c6f592d
@ -118,11 +118,17 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
|
|||||||
|
|
||||||
final CheckBox checkHidden = dialog.findViewById(R.id.controlsetting_checkbox_hidden);
|
final CheckBox checkHidden = dialog.findViewById(R.id.controlsetting_checkbox_hidden);
|
||||||
checkHidden.setChecked(properties.hidden);
|
checkHidden.setChecked(properties.hidden);
|
||||||
|
|
||||||
final CheckBox checkDynamicPos = dialog.findViewById(R.id.controlsetting_checkbox_dynamicpos);
|
|
||||||
checkDynamicPos.setChecked(properties.isDynamicBtn);
|
|
||||||
|
|
||||||
final LinearLayout layoutDynamicBtn = dialog.findViewById(R.id.controlsetting_dynamicbtnlayout);
|
final LinearLayout layoutDynamicBtn = dialog.findViewById(R.id.controlsetting_dynamicbtnlayout);
|
||||||
|
final CheckBox checkDynamicPos = dialog.findViewById(R.id.controlsetting_checkbox_dynamicpos);
|
||||||
|
checkDynamicPos.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton btn, boolean checked) {
|
||||||
|
layoutDynamicBtn.setVisibility(checked ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
checkDynamicPos.setChecked(properties.isDynamicBtn);
|
||||||
|
|
||||||
final EditText editDynamicX = dialog.findViewById(R.id.controlsetting_edit_dynamicpos_x);
|
final EditText editDynamicX = dialog.findViewById(R.id.controlsetting_edit_dynamicpos_x);
|
||||||
final EditText editDynamicY = dialog.findViewById(R.id.controlsetting_edit_dynamicpos_y);
|
final EditText editDynamicY = dialog.findViewById(R.id.controlsetting_edit_dynamicpos_y);
|
||||||
@ -133,14 +139,6 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
|
|||||||
editDynamicY.setHint(Float.toString(properties.y));
|
editDynamicY.setHint(Float.toString(properties.y));
|
||||||
editDynamicY.setText(properties.dynamicY);
|
editDynamicY.setText(properties.dynamicY);
|
||||||
|
|
||||||
checkDynamicPos.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton btn, boolean checked) {
|
|
||||||
layoutDynamicBtn.setVisibility(checked ? View.VISIBLE : View.GONE);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final CheckBox checkHoldAlt = dialog.findViewById(R.id.controlsetting_checkbox_keycombine_alt);
|
final CheckBox checkHoldAlt = dialog.findViewById(R.id.controlsetting_checkbox_keycombine_alt);
|
||||||
checkHoldAlt.setChecked(properties.holdAlt);
|
checkHoldAlt.setChecked(properties.holdAlt);
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import android.widget.*;
|
|||||||
import net.kdt.pojavlaunch.*;
|
import net.kdt.pojavlaunch.*;
|
||||||
import com.kdt.handleview.*;
|
import com.kdt.handleview.*;
|
||||||
import android.view.ViewGroup.*;
|
import android.view.ViewGroup.*;
|
||||||
|
import org.lwjgl.glfw.*;
|
||||||
|
|
||||||
public class ControlButton extends Button implements OnLongClickListener, OnTouchListener
|
public class ControlButton extends Button implements OnLongClickListener, OnTouchListener
|
||||||
{
|
{
|
||||||
@ -100,6 +101,7 @@ public class ControlButton extends Button implements OnLongClickListener, OnTouc
|
|||||||
|
|
||||||
if (!mProperties.isDynamicBtn) {
|
if (!mProperties.isDynamicBtn) {
|
||||||
mProperties.x = x;
|
mProperties.x = x;
|
||||||
|
mProperties.dynamicX = Float.toString(x / CallbackBridge.windowWidth) + " * ${screen_width}";
|
||||||
setModified(true);
|
setModified(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,6 +112,7 @@ public class ControlButton extends Button implements OnLongClickListener, OnTouc
|
|||||||
|
|
||||||
if (!mProperties.isDynamicBtn) {
|
if (!mProperties.isDynamicBtn) {
|
||||||
mProperties.y = y;
|
mProperties.y = y;
|
||||||
|
mProperties.dynamicY = Float.toString(y / CallbackBridge.windowHeight) + " * ${screen_height}";
|
||||||
setModified(true);
|
setModified(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,13 +100,7 @@ public class ControlData implements Cloneable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ControlData(String name, int keycode, float x, float y, float width, float height) {
|
public ControlData(String name, int keycode, float x, float y, float width, float height) {
|
||||||
this.name = name;
|
this(name, keycode, null, null, width, height);
|
||||||
this.keycode = keycode;
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.width = width;
|
|
||||||
this.height = height;
|
|
||||||
this.isDynamicBtn = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlData(String name, int keycode, String dynamicX, String dynamicY) {
|
public ControlData(String name, int keycode, String dynamicX, String dynamicY) {
|
||||||
@ -168,8 +162,10 @@ public class ControlData implements Cloneable
|
|||||||
specialButtonListener = data.specialButtonListener;
|
specialButtonListener = data.specialButtonListener;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} if (!isDynamicBtn) {
|
} if (dynamicX == null) {
|
||||||
return;
|
dynamicX = Float.toString(x);
|
||||||
|
} if (dynamicY == null) {
|
||||||
|
dynamicY = Float.toString(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
x = insertDynamicPos(dynamicX);
|
x = insertDynamicPos(dynamicX);
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
package net.kdt.pojavlaunch.customcontrols;
|
package net.kdt.pojavlaunch.customcontrols;
|
||||||
import android.widget.*;
|
|
||||||
import android.content.*;
|
import android.content.*;
|
||||||
import android.util.*;
|
import android.util.*;
|
||||||
import android.view.*;
|
import android.view.*;
|
||||||
|
import android.widget.*;
|
||||||
import com.google.gson.*;
|
import com.google.gson.*;
|
||||||
import net.kdt.pojavlaunch.*;
|
|
||||||
import android.support.v7.app.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import net.kdt.pojavlaunch.*;
|
||||||
import net.kdt.pojavlaunch.prefs.*;
|
import net.kdt.pojavlaunch.prefs.*;
|
||||||
|
import org.lwjgl.glfw.*;
|
||||||
|
|
||||||
public class ControlLayout extends FrameLayout
|
public class ControlLayout extends FrameLayout
|
||||||
{
|
{
|
||||||
@ -49,6 +48,8 @@ public class ControlLayout extends FrameLayout
|
|||||||
button.isHideable = button.keycode != ControlData.SPECIALBTN_TOGGLECTRL && button.keycode != ControlData.SPECIALBTN_VIRTUALMOUSE;
|
button.isHideable = button.keycode != ControlData.SPECIALBTN_TOGGLECTRL && button.keycode != ControlData.SPECIALBTN_VIRTUALMOUSE;
|
||||||
button.width = button.width / controlLayout.scaledAt * LauncherPreferences.PREF_BUTTONSIZE;
|
button.width = button.width / controlLayout.scaledAt * LauncherPreferences.PREF_BUTTONSIZE;
|
||||||
button.height = button.height / controlLayout.scaledAt * LauncherPreferences.PREF_BUTTONSIZE;
|
button.height = button.height / controlLayout.scaledAt * LauncherPreferences.PREF_BUTTONSIZE;
|
||||||
|
button.dynamicX = Float.toString(button.x / CallbackBridge.windowWidth) + " * ${screen_width}";
|
||||||
|
button.dynamicY = Float.toString(button.y / CallbackBridge.windowHeight) + " * ${screen_height}";
|
||||||
addControlView(button);
|
addControlView(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user