mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-16 08:05:34 -04:00
Adding custom controls cause broken?
This commit is contained in:
parent
0f76135da8
commit
4d008013ad
@ -140,10 +140,10 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
|
|||||||
adapter.addAll(AndroidLWJGLKeycode.generateKeyName());
|
adapter.addAll(AndroidLWJGLKeycode.generateKeyName());
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
|
adapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
|
||||||
spinnerKeycode.setAdapter(adapter);
|
spinnerKeycode.setAdapter(adapter);
|
||||||
if (properties.lwjglKeycode < 0) {
|
if (properties.keycode < 0) {
|
||||||
spinnerKeycode.setSelection(properties.lwjglKeycode + 2);
|
spinnerKeycode.setSelection(properties.keycode + 2);
|
||||||
} else {
|
} else {
|
||||||
spinnerKeycode.setSelection(AndroidLWJGLKeycode.getIndexByLWJGLKey(properties.lwjglKeycode + 2));
|
spinnerKeycode.setSelection(AndroidLWJGLKeycode.getIndexByLWJGLKey(properties.keycode + 2));
|
||||||
}
|
}
|
||||||
spinnerKeycode.setOnItemSelectedListener(new Spinner.OnItemSelectedListener(){
|
spinnerKeycode.setOnItemSelectedListener(new Spinner.OnItemSelectedListener(){
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
|
|||||||
if (editName.getText().toString().isEmpty()) {
|
if (editName.getText().toString().isEmpty()) {
|
||||||
editName.setError(view.getResources().getString(R.string.global_error_field_empty));
|
editName.setError(view.getResources().getString(R.string.global_error_field_empty));
|
||||||
} else {
|
} else {
|
||||||
properties.lwjglKeycode = AndroidLWJGLKeycode.getKeyIndex(spinnerKeycode.getSelectedItemPosition()) - 2;
|
properties.keycode = AndroidLWJGLKeycode.getKeyIndex(spinnerKeycode.getSelectedItemPosition()) - 2;
|
||||||
properties.name = editName.getText().toString();
|
properties.name = editName.getText().toString();
|
||||||
properties.hidden = checkHidden.isChecked();
|
properties.hidden = checkHidden.isChecked();
|
||||||
|
|
||||||
|
@ -18,20 +18,23 @@ public class CustomControlsActivity extends AppCompatActivity
|
|||||||
{
|
{
|
||||||
private DrawerLayout drawerLayout;
|
private DrawerLayout drawerLayout;
|
||||||
private NavigationView navDrawer;
|
private NavigationView navDrawer;
|
||||||
|
|
||||||
private ControlsLayout ctrlLayout;
|
private ControlsLayout ctrlLayout;
|
||||||
|
|
||||||
private String selectedName = "";
|
|
||||||
|
|
||||||
private CustomControls mCtrl;
|
private CustomControls mCtrl;
|
||||||
|
|
||||||
|
private SharedPreferences mPref;
|
||||||
|
|
||||||
|
public boolean isModified = false;
|
||||||
|
|
||||||
private Gson gson;
|
private Gson gson;
|
||||||
|
private String selectedName = "new_control";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.control_mapping);
|
setContentView(R.layout.control_mapping);
|
||||||
|
|
||||||
|
mPref = getSharedPreferences(getPackageName() + "_preferences", Context.MODE_PRIVATE);
|
||||||
|
|
||||||
gson = new GsonBuilder().setPrettyPrinting().create();
|
gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
@ -49,6 +52,12 @@ public class CustomControlsActivity extends AppCompatActivity
|
|||||||
case R.id.menu_ctrl_add:
|
case R.id.menu_ctrl_add:
|
||||||
ctrlLayout.addControlButton(new ControlButton("New", Keyboard.CHAR_NONE, 100, 100));
|
ctrlLayout.addControlButton(new ControlButton("New", Keyboard.CHAR_NONE, 100, 100));
|
||||||
break;
|
break;
|
||||||
|
case R.id.menu_ctrl_selectdefault:
|
||||||
|
dialogSelectDefaultCtrl();
|
||||||
|
break;
|
||||||
|
case R.id.menu_ctrl_save:
|
||||||
|
save(false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
//Toast.makeText(MainActivity.this, menuItem.getTitle() + ":" + menuItem.getItemId(), Toast.LENGTH_SHORT).show();
|
//Toast.makeText(MainActivity.this, menuItem.getTitle() + ":" + menuItem.getItemId(), Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
@ -58,15 +67,68 @@ public class CustomControlsActivity extends AppCompatActivity
|
|||||||
});
|
});
|
||||||
|
|
||||||
mCtrl = new CustomControls();
|
mCtrl = new CustomControls();
|
||||||
|
String defaultControl = mPref.getString("defaultCtrl", "");
|
||||||
|
if (defaultControl.isEmpty() || defaultControl.endsWith("/default.json")) {
|
||||||
generateDefaultControlMap();
|
generateDefaultControlMap();
|
||||||
|
try {
|
||||||
|
doSaveCtrl("default");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
loadControl(defaultControl);
|
||||||
|
}
|
||||||
|
|
||||||
ctrlLayout = (ControlsLayout) findViewById(R.id.customctrl_controllayout);
|
ctrlLayout = (ControlsLayout) findViewById(R.id.customctrl_controllayout);
|
||||||
|
ctrlLayout.setActivity(this);
|
||||||
ctrlLayout.loadLayout(mCtrl);
|
ctrlLayout.loadLayout(mCtrl);
|
||||||
ctrlLayout.setModifiable(true);
|
ctrlLayout.setModifiable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
|
if (!isModified) {
|
||||||
|
super.onBackPressed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
save(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setDefaultControlJson(String path) {
|
||||||
|
mPref.edit().putString("defaultCtrl", path).commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dialogSelectDefaultCtrl() {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle(R.string.customctrl_selectdefault);
|
||||||
|
builder.setPositiveButton(android.R.string.cancel, null);
|
||||||
|
|
||||||
|
final AlertDialog dialog = builder.create();
|
||||||
|
FileListView flv = new FileListView(this);
|
||||||
|
flv.listFileAt(Tools.CTRLMAP_PATH);
|
||||||
|
flv.setFileSelectedListener(new FileSelectedListener(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFileSelected(File file, String path, String name) {
|
||||||
|
if (name.endsWith(".json")) {
|
||||||
|
setDefaultControlJson(path);
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.setView(flv);
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String doSaveCtrl(String name) throws Exception {
|
||||||
|
String jsonPath = Tools.CTRLMAP_PATH + "/" + name + ".json";
|
||||||
|
ctrlLayout.saveLayout(jsonPath);
|
||||||
|
|
||||||
|
return jsonPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void save(final boolean exit) {
|
||||||
final EditText edit = new EditText(this);
|
final EditText edit = new EditText(this);
|
||||||
edit.setSingleLine();
|
edit.setSingleLine();
|
||||||
edit.setText(selectedName);
|
edit.setText(selectedName);
|
||||||
@ -76,14 +138,14 @@ public class CustomControlsActivity extends AppCompatActivity
|
|||||||
builder.setView(edit);
|
builder.setView(edit);
|
||||||
builder.setPositiveButton(android.R.string.ok, null);
|
builder.setPositiveButton(android.R.string.ok, null);
|
||||||
builder.setNegativeButton(android.R.string.cancel, null);
|
builder.setNegativeButton(android.R.string.cancel, null);
|
||||||
|
if (exit) {
|
||||||
builder.setNeutralButton("Exit without save", new AlertDialog.OnClickListener(){
|
builder.setNeutralButton("Exit without save", new AlertDialog.OnClickListener(){
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface p1, int p2)
|
public void onClick(DialogInterface p1, int p2) {
|
||||||
{
|
|
||||||
CustomControlsActivity.super.onBackPressed();
|
CustomControlsActivity.super.onBackPressed();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
final AlertDialog dialog = builder.create();
|
final AlertDialog dialog = builder.create();
|
||||||
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||||
|
|
||||||
@ -99,11 +161,16 @@ public class CustomControlsActivity extends AppCompatActivity
|
|||||||
edit.setError(getResources().getString(R.string.global_error_field_empty));
|
edit.setError(getResources().getString(R.string.global_error_field_empty));
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
Tools.write(Tools.CTRLMAP_PATH + "/" + edit.getText().toString() + ".json", gson.toJson(mCtrl));
|
String jsonPath = doSaveCtrl(edit.getText().toString());
|
||||||
|
|
||||||
|
Toast.makeText(CustomControlsActivity.this, getString(R.string.global_save) + ": " + jsonPath, Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
if (exit) {
|
||||||
CustomControlsActivity.super.onBackPressed();
|
CustomControlsActivity.super.onBackPressed();
|
||||||
|
}
|
||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
Tools.showError(CustomControlsActivity.this, th);
|
Tools.showError(CustomControlsActivity.this, th, exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,7 +183,7 @@ public class CustomControlsActivity extends AppCompatActivity
|
|||||||
|
|
||||||
private void actionLoad() {
|
private void actionLoad() {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle("Select control json file");
|
builder.setTitle(R.string.customctrl_title_selectctrl);
|
||||||
builder.setPositiveButton(android.R.string.cancel, null);
|
builder.setPositiveButton(android.R.string.cancel, null);
|
||||||
|
|
||||||
final AlertDialog dialog = builder.create();
|
final AlertDialog dialog = builder.create();
|
||||||
@ -127,13 +194,8 @@ public class CustomControlsActivity extends AppCompatActivity
|
|||||||
@Override
|
@Override
|
||||||
public void onFileSelected(File file, String path, String name) {
|
public void onFileSelected(File file, String path, String name) {
|
||||||
if (name.endsWith(".json")) {
|
if (name.endsWith(".json")) {
|
||||||
try {
|
loadControl(path);
|
||||||
mCtrl = gson.fromJson(Tools.read(path), CustomControls.class);
|
|
||||||
ctrlLayout.loadLayout(mCtrl);
|
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
} catch (Exception e) {
|
|
||||||
Tools.showError(CustomControlsActivity.this, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -141,18 +203,27 @@ public class CustomControlsActivity extends AppCompatActivity
|
|||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private float dpToPx(float dp) {
|
private void loadControl(String path) {
|
||||||
return Tools.dpToPx(this, dp);
|
try {
|
||||||
|
mCtrl = gson.fromJson(Tools.read(path), CustomControls.class);
|
||||||
|
ctrlLayout.loadLayout(mCtrl);
|
||||||
|
|
||||||
|
selectedName = new File(path).getName();
|
||||||
|
// Remove `.json`
|
||||||
|
selectedName = selectedName.substring(0, selectedName.length() - 5);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Tools.showError(CustomControlsActivity.this, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateDefaultControlMap() {
|
private void generateDefaultControlMap() {
|
||||||
List<ControlButton> btn = mCtrl.button;
|
List<ControlButton> btn = mCtrl.button;
|
||||||
btn.add(ControlButton.getSpecialButtons()[0]); // Keyboard
|
btn.add(ControlButton.getSpecialButtons()[0].clone()); // Keyboard
|
||||||
btn.add(ControlButton.getSpecialButtons()[1]); // GUI
|
btn.add(ControlButton.getSpecialButtons()[1].clone()); // GUI
|
||||||
// btn.add(ControlButton.getSpecialButtons()[2]); // Toggle mouse
|
// btn.add(ControlButton.getSpecialButtons()[2]); // Toggle mouse
|
||||||
btn.add(new ControlButton(this, R.string.control_debug, Keyboard.KEY_F3, ControlButton.pixelOf2dp, ControlButton.pixelOf2dp, false));
|
btn.add(new ControlButton(this, R.string.control_debug, Keyboard.KEY_F3, ControlButton.pixelOf2dp, ControlButton.pixelOf2dp, false));
|
||||||
btn.add(new ControlButton(this, R.string.control_chat, Keyboard.KEY_T, ControlButton.pixelOf2dp * 2 + ControlButton.pixelOf80dp, ControlButton.pixelOf2dp, false));
|
btn.add(new ControlButton(this, R.string.control_chat, Keyboard.KEY_T, ControlButton.pixelOf2dp * 2 + ControlButton.pixelOf80dp, ControlButton.pixelOf2dp, false));
|
||||||
btn.add(new ControlButton(this, R.string.control_listplayers, Keyboard.KEY_TAB, ControlButton.pixelOf2dp * 3 + ControlButton.pixelOf80dp * 2, ControlButton.pixelOf2dp, false));
|
btn.add(new ControlButton(this, R.string.control_listplayers, Keyboard.KEY_TAB, ControlButton.pixelOf2dp * 4 + ControlButton.pixelOf80dp * 3, ControlButton.pixelOf2dp, false));
|
||||||
btn.add(new ControlButton(this, R.string.control_thirdperson, Keyboard.KEY_F5, ControlButton.pixelOf2dp, ControlButton.pixelOf2dp, false));
|
btn.add(new ControlButton(this, R.string.control_thirdperson, Keyboard.KEY_F5, ControlButton.pixelOf2dp, ControlButton.pixelOf30dp + ControlButton.pixelOf2dp, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -978,6 +978,7 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||||||
dialog = new ProgressDialog(MCLauncherActivity.this);
|
dialog = new ProgressDialog(MCLauncherActivity.this);
|
||||||
dialog.setTitle("Installing OptiFine");
|
dialog.setTitle("Installing OptiFine");
|
||||||
dialog.setMessage("Preparing");
|
dialog.setMessage("Preparing");
|
||||||
|
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
|
||||||
dialog.setMax(5);
|
dialog.setMax(5);
|
||||||
dialog.setCancelable(false);
|
dialog.setCancelable(false);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
@ -79,15 +79,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
private DisplayMetrics displayMetrics;
|
private DisplayMetrics displayMetrics;
|
||||||
public boolean hiddenTextIgnoreUpdate = true;
|
public boolean hiddenTextIgnoreUpdate = true;
|
||||||
public String hiddenTextContents = initText;
|
public String hiddenTextContents = initText;
|
||||||
private Button upButton,
|
private ControlsLayout controlLayout;
|
||||||
downButton, leftButton,
|
|
||||||
rightButton, jumpButton,
|
|
||||||
primaryButton, secondaryButton,
|
|
||||||
debugButton, shiftButton,
|
|
||||||
keyboardButton, inventoryButton,
|
|
||||||
talkButton, thirdPersonButton,
|
|
||||||
zoomButton, listPlayersButton,
|
|
||||||
toggleControlButton;
|
|
||||||
private LinearLayout touchPad;
|
private LinearLayout touchPad;
|
||||||
private ImageView mousePointer;
|
private ImageView mousePointer;
|
||||||
//private EditText hiddenEditor;
|
//private EditText hiddenEditor;
|
||||||
@ -114,7 +106,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
|
|
||||||
private View.OnTouchListener glTouchListener;
|
private View.OnTouchListener glTouchListener;
|
||||||
|
|
||||||
private Button[] controlButtons;
|
// private Button[] controlButtons;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
private LinearLayout contentCanvas;
|
private LinearLayout contentCanvas;
|
||||||
@ -199,6 +191,12 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
|
|
||||||
gestureDetector = new GestureDetector(this, new SingleTapConfirm());
|
gestureDetector = new GestureDetector(this, new SingleTapConfirm());
|
||||||
|
|
||||||
|
glSurfaceView = (MinecraftGLView) findViewById(R.id.main_game_render_view);
|
||||||
|
|
||||||
|
controlLayout = findViewById(R.id.main_controllayout);
|
||||||
|
controlLayout.loadLayout(getSharedPreferences(getPackageName() + "_preferences", MODE_PRIVATE).getString("defaultCtrl", Tools.CTRLMAP_PATH + "/default.json"));
|
||||||
|
controlLayout.setModifiable(false);
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
drawerLayout = (DrawerLayout) findViewById(R.id.main_drawer_options);
|
drawerLayout = (DrawerLayout) findViewById(R.id.main_drawer_options);
|
||||||
|
|
||||||
@ -223,22 +221,8 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.upButton = findButton(R.id.control_up);
|
|
||||||
this.downButton = findButton(R.id.control_down);
|
/*
|
||||||
this.leftButton = findButton(R.id.control_left);
|
|
||||||
this.rightButton = findButton(R.id.control_right);
|
|
||||||
this.jumpButton = findButton(R.id.control_jump);
|
|
||||||
this.primaryButton = findButton(R.id.control_primary);
|
|
||||||
this.secondaryButton = findButton(R.id.control_secondary);
|
|
||||||
this.debugButton = findButton(R.id.control_debug);
|
|
||||||
this.shiftButton = findButton(R.id.control_shift);
|
|
||||||
this.keyboardButton = findButton(R.id.control_keyboard);
|
|
||||||
this.inventoryButton = findButton(R.id.control_inventory);
|
|
||||||
this.talkButton = findButton(R.id.control_talk);
|
|
||||||
this.thirdPersonButton = findButton(R.id.control_thirdperson);
|
|
||||||
this.zoomButton = findButton(R.id.control_zoom);
|
|
||||||
this.listPlayersButton = findButton(R.id.control_listplayers);
|
|
||||||
this.toggleControlButton = findButton(R.id.control_togglecontrol);
|
|
||||||
this.controlButtons = new Button[]{
|
this.controlButtons = new Button[]{
|
||||||
upButton, downButton, leftButton, rightButton,
|
upButton, downButton, leftButton, rightButton,
|
||||||
jumpButton, primaryButton, secondaryButton,
|
jumpButton, primaryButton, secondaryButton,
|
||||||
@ -246,6 +230,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
inventoryButton, talkButton, thirdPersonButton,
|
inventoryButton, talkButton, thirdPersonButton,
|
||||||
listPlayersButton
|
listPlayersButton
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
// this.overlayView = (ViewGroup) findViewById(R.id.main_control_overlay);
|
// this.overlayView = (ViewGroup) findViewById(R.id.main_control_overlay);
|
||||||
|
|
||||||
//this.hiddenEditor = findViewById(R.id.hiddenTextbox);
|
//this.hiddenEditor = findViewById(R.id.hiddenTextbox);
|
||||||
@ -276,11 +261,6 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
|
|
||||||
this.debugText = (TextView) findViewById(R.id.content_text_debug);
|
this.debugText = (TextView) findViewById(R.id.content_text_debug);
|
||||||
|
|
||||||
this.toggleControlButton.setOnClickListener(this);
|
|
||||||
this.zoomButton.setVisibility(mVersionInfo.optifineLib == null ? View.GONE : View.VISIBLE);
|
|
||||||
|
|
||||||
this.glSurfaceView = (MinecraftGLView) findViewById(R.id.main_game_render_view);
|
|
||||||
|
|
||||||
ControlButton[] specialButtons = ControlButton.getSpecialButtons();
|
ControlButton[] specialButtons = ControlButton.getSpecialButtons();
|
||||||
specialButtons[0].specialButtonListener = new View.OnClickListener(){
|
specialButtons[0].specialButtonListener = new View.OnClickListener(){
|
||||||
|
|
||||||
@ -295,12 +275,12 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View view)
|
public void onClick(View view)
|
||||||
{
|
{
|
||||||
MainActivity.this.onClick(toggleControlButton);
|
// MainActivity.this.onClick(toggleControlButton);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// toggleGui(null);
|
// toggleGui(null);
|
||||||
onClick(toggleControlButton);
|
// onClick(toggleControlButton);
|
||||||
this.drawerLayout.closeDrawers();
|
this.drawerLayout.closeDrawers();
|
||||||
|
|
||||||
AndroidLWJGLKeycode.isBackspaceAfterChar = mVersionInfo.minimumLauncherVersion >= 18;
|
AndroidLWJGLKeycode.isBackspaceAfterChar = mVersionInfo.minimumLauncherVersion >= 18;
|
||||||
@ -748,16 +728,9 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
switch (view.getId()) {
|
|
||||||
case R.id.control_togglecontrol: {
|
|
||||||
/*
|
/*
|
||||||
switch(overlayView.getVisibility()){
|
switch (view.getId()) {
|
||||||
case View.VISIBLE: overlayView.setVisibility(View.GONE);
|
case R.id.control_togglectrl: {
|
||||||
break;
|
|
||||||
case View.GONE: overlayView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (Button button : controlButtons) {
|
for (Button button : controlButtons) {
|
||||||
button.setVisibility(button.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
|
button.setVisibility(button.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
@ -765,6 +738,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
zoomButton.setVisibility((zoomButton.getVisibility() == View.GONE && mVersionInfo.optifineLib != null) ? View.VISIBLE : View.GONE);
|
zoomButton.setVisibility((zoomButton.getVisibility() == View.GONE && mVersionInfo.optifineLib != null) ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onTouch(View v, MotionEvent e) {
|
public boolean onTouch(View v, MotionEvent e) {
|
||||||
@ -782,7 +756,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.control_up: sendKeyPress(Keyboard.KEY_W, isDown); break;
|
case R.id.control_up: sendKeyPress(Keyboard.KEY_W, isDown); break;
|
||||||
case R.id.control_left: sendKeyPress(Keyboard.KEY_A, isDown); break;
|
case R.id.control_left: sendKeyPress(Keyboard.KEY_A, isDown); break;
|
||||||
@ -795,8 +769,8 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
sendMouseButton(1, isDown);
|
sendMouseButton(1, isDown);
|
||||||
} else {
|
} else {
|
||||||
if (!isDown) {
|
if (!isDown) {
|
||||||
AndroidDisplay.putMouseEventWithCoords(/* right mouse */ (byte) 1, (byte) 0, AndroidDisplay.mouseX, AndroidDisplay.mouseY, 0, System.nanoTime());
|
AndroidDisplay.putMouseEventWithCoords((byte) 1, (byte) 0, AndroidDisplay.mouseX, AndroidDisplay.mouseY, 0, System.nanoTime());
|
||||||
AndroidDisplay.putMouseEventWithCoords(/* right mouse */ (byte) 1, (byte) 1, AndroidDisplay.mouseX, AndroidDisplay.mouseY, 0, System.nanoTime());
|
AndroidDisplay.putMouseEventWithCoords((byte) 1, (byte) 1, AndroidDisplay.mouseX, AndroidDisplay.mouseY, 0, System.nanoTime());
|
||||||
}
|
}
|
||||||
setRightOverride(isDown);
|
setRightOverride(isDown);
|
||||||
} break;
|
} break;
|
||||||
@ -809,7 +783,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
case R.id.control_zoom: sendKeyPress(Keyboard.KEY_C, isDown); break;
|
case R.id.control_zoom: sendKeyPress(Keyboard.KEY_C, isDown); break;
|
||||||
case R.id.control_listplayers: sendKeyPress(Keyboard.KEY_TAB, isDown); break;
|
case R.id.control_listplayers: sendKeyPress(Keyboard.KEY_TAB, isDown); break;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1222,20 +1196,20 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
// this.secondaryButton.setBackgroundDrawable(this.rightOverride ? this.secondaryButtonColorBackground : this.secondaryButtonDefaultBackground);
|
// this.secondaryButton.setBackgroundDrawable(this.rightOverride ? this.secondaryButtonColorBackground : this.secondaryButtonDefaultBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendKeyPress(int keyCode, boolean status) {
|
public static void sendKeyPress(int keyCode, boolean status) {
|
||||||
sendKeyPress(keyCode, '\u0000', status);
|
sendKeyPress(keyCode, '\u0000', status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendKeyPress(int keyCode, char keyChar, boolean status) {
|
public static void sendKeyPress(int keyCode, char keyChar, boolean status) {
|
||||||
AndroidDisplay.setKey(keyCode, keyChar, status);
|
AndroidDisplay.setKey(keyCode, keyChar, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendKeyPress(char keyChar) {
|
public static void sendKeyPress(char keyChar) {
|
||||||
sendKeyPress(0, keyChar, true);
|
sendKeyPress(0, keyChar, true);
|
||||||
sendKeyPress(0, keyChar, false);
|
sendKeyPress(0, keyChar, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendKeyPress(int keyCode) {
|
public static void sendKeyPress(int keyCode) {
|
||||||
sendKeyPress(keyCode, true);
|
sendKeyPress(keyCode, true);
|
||||||
sendKeyPress(keyCode, false);
|
sendKeyPress(keyCode, false);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
package net.kdt.pojavlaunch.value.customcontrols;
|
package net.kdt.pojavlaunch.value.customcontrols;
|
||||||
|
|
||||||
import net.kdt.pojavlaunch.*;
|
import net.kdt.pojavlaunch.*;
|
||||||
import android.view.*;
|
import android.view.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -6,7 +7,7 @@ import android.content.*;
|
|||||||
import org.lwjgl.input.*;
|
import org.lwjgl.input.*;
|
||||||
import org.lwjgl.opengl.*;
|
import org.lwjgl.opengl.*;
|
||||||
|
|
||||||
public class ControlButton
|
public class ControlButton implements Cloneable
|
||||||
{
|
{
|
||||||
public static int pixelOf2dp;
|
public static int pixelOf2dp;
|
||||||
public static int pixelOf30dp;
|
public static int pixelOf30dp;
|
||||||
@ -23,7 +24,7 @@ public class ControlButton
|
|||||||
if (SPECIAL_BUTTONS == null) {
|
if (SPECIAL_BUTTONS == null) {
|
||||||
SPECIAL_BUTTONS = new ControlButton[]{
|
SPECIAL_BUTTONS = new ControlButton[]{
|
||||||
new ControlButton("Keyboard", -1, pixelOf2dp * 3 + pixelOf80dp * 2, pixelOf2dp, pixelOf80dp, pixelOf30dp),
|
new ControlButton("Keyboard", -1, pixelOf2dp * 3 + pixelOf80dp * 2, pixelOf2dp, pixelOf80dp, pixelOf30dp),
|
||||||
new ControlButton("GUI", -2, pixelOf2dp, AndroidDisplay.windowHeight - pixelOf2dp - pixelOf50dp)
|
new ControlButton("GUI", -2, pixelOf2dp, AndroidDisplay.windowHeight - pixelOf2dp - pixelOf50dp * 2)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +48,8 @@ public class ControlButton
|
|||||||
public float y;
|
public float y;
|
||||||
public int width = pixelOf50dp;
|
public int width = pixelOf50dp;
|
||||||
public int height = pixelOf50dp;
|
public int height = pixelOf50dp;
|
||||||
public int lwjglKeycode;
|
public int keycode;
|
||||||
|
public int keyindex;
|
||||||
public boolean hidden;
|
public boolean hidden;
|
||||||
public boolean holdCtrl;
|
public boolean holdCtrl;
|
||||||
public boolean holdAlt;
|
public boolean holdAlt;
|
||||||
@ -59,25 +61,25 @@ public class ControlButton
|
|||||||
this("", Keyboard.CHAR_NONE, 0, 0);
|
this("", Keyboard.CHAR_NONE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlButton(String name, int lwjglKeycode) {
|
public ControlButton(String name, int keycode) {
|
||||||
this(name, lwjglKeycode, 0, 0);
|
this(name, keycode, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlButton(String name, int lwjglKeycode, float x, float y) {
|
public ControlButton(String name, int keycode, float x, float y) {
|
||||||
this(name, lwjglKeycode, x, y, pixelOf50dp, pixelOf50dp);
|
this(name, keycode, x, y, pixelOf50dp, pixelOf50dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlButton(android.content.Context ctx, int resId, int lwjglKeycode, float x, float y, boolean isSquare) {
|
public ControlButton(android.content.Context ctx, int resId, int keycode, float x, float y, boolean isSquare) {
|
||||||
this(ctx.getResources().getString(resId), lwjglKeycode, x, y, isSquare ? pixelOf50dp : pixelOf80dp, isSquare ? pixelOf50dp : pixelOf30dp);
|
this(ctx.getResources().getString(resId), keycode, x, y, isSquare ? pixelOf50dp : pixelOf80dp, isSquare ? pixelOf50dp : pixelOf30dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlButton(String name, int lwjglKeycode, float x, float y, boolean isSquare) {
|
public ControlButton(String name, int keycode, float x, float y, boolean isSquare) {
|
||||||
this(name, lwjglKeycode, x, y, isSquare ? pixelOf50dp : pixelOf80dp, isSquare ? pixelOf50dp : pixelOf30dp);
|
this(name, keycode, x, y, isSquare ? pixelOf50dp : pixelOf80dp, isSquare ? pixelOf50dp : pixelOf30dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlButton(String name, int lwjglKeycode, float x, float y, int width, int height) {
|
public ControlButton(String name, int keycode, float x, float y, int width, int height) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.lwjglKeycode = lwjglKeycode;
|
this.keycode = keycode;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
@ -85,6 +87,10 @@ public class ControlButton
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void execute(MainActivity act, boolean isDown) {
|
public void execute(MainActivity act, boolean isDown) {
|
||||||
act.sendKeyPress(lwjglKeycode, isDown);
|
act.sendKeyPress(keycode, isDown);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlButton clone() {
|
||||||
|
return new ControlButton(name, keycode, x, y, width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,6 +105,7 @@ public class ControlView extends Button implements OnLongClickListener, OnTouchL
|
|||||||
public boolean onTouch(View view, MotionEvent event) {
|
public boolean onTouch(View view, MotionEvent event) {
|
||||||
if (!mCanModify) {
|
if (!mCanModify) {
|
||||||
mCanTriggerLongClick = false;
|
mCanTriggerLongClick = false;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ public class ControlsLayout extends FrameLayout
|
|||||||
{
|
{
|
||||||
private boolean mCanModify;
|
private boolean mCanModify;
|
||||||
private CustomControls mLayout;
|
private CustomControls mLayout;
|
||||||
|
private CustomControlsActivity mActivity;
|
||||||
public ControlsLayout(Context ctx) {
|
public ControlsLayout(Context ctx) {
|
||||||
super(ctx);
|
super(ctx);
|
||||||
}
|
}
|
||||||
@ -28,12 +29,22 @@ public class ControlsLayout extends FrameLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void loadLayout(String jsonPath) {
|
||||||
|
try {
|
||||||
|
loadLayout(new Gson().fromJson(Tools.read(jsonPath), CustomControls.class));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void loadLayout(CustomControls controlLayout) {
|
public void loadLayout(CustomControls controlLayout) {
|
||||||
mLayout = controlLayout;
|
mLayout = controlLayout;
|
||||||
removeAllViews();
|
removeAllViews();
|
||||||
for (ControlButton button : controlLayout.button) {
|
for (ControlButton button : controlLayout.button) {
|
||||||
addControlView(button);
|
addControlView(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setModified(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addControlButton(ControlButton controlButton) {
|
public void addControlButton(ControlButton controlButton) {
|
||||||
@ -45,16 +56,25 @@ public class ControlsLayout extends FrameLayout
|
|||||||
final ControlView view = new ControlView(getContext(), controlButton);
|
final ControlView view = new ControlView(getContext(), controlButton);
|
||||||
view.setModifiable(mCanModify);
|
view.setModifiable(mCanModify);
|
||||||
addView(view);
|
addView(view);
|
||||||
|
|
||||||
|
setModified(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeControlButton(ControlView controlButton) {
|
public void removeControlButton(ControlView controlButton) {
|
||||||
mLayout.button.remove(controlButton.getProperties());
|
mLayout.button.remove(controlButton.getProperties());
|
||||||
controlButton.setVisibility(View.GONE);
|
controlButton.setVisibility(View.GONE);
|
||||||
removeView(controlButton);
|
removeView(controlButton);
|
||||||
|
|
||||||
|
setModified(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveLayout(String path) throws Exception {
|
public void saveLayout(String path) throws Exception {
|
||||||
Tools.write(path, new Gson().toJson(mLayout));
|
Tools.write(path, new Gson().toJson(mLayout));
|
||||||
|
setModified(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivity(CustomControlsActivity activity) {
|
||||||
|
mActivity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModifiable(boolean z) {
|
public void setModifiable(boolean z) {
|
||||||
@ -62,8 +82,14 @@ public class ControlsLayout extends FrameLayout
|
|||||||
for (int i = 0; i < getChildCount(); i++) {
|
for (int i = 0; i < getChildCount(); i++) {
|
||||||
View v = getChildAt(i);
|
View v = getChildAt(i);
|
||||||
if (v instanceof ControlView) {
|
if (v instanceof ControlView) {
|
||||||
((ControlView) v).setModifiable(z);
|
ControlView cv = ((ControlView) v);
|
||||||
|
cv.setModifiable(z);
|
||||||
|
cv.setVisibility(cv.getProperties().hidden ? View.INVISIBLE : View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setModified(boolean z) {
|
||||||
|
if (mActivity != null) mActivity.isModified = z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,18 @@
|
|||||||
android:id="@+id/main_log_behind_GL"
|
android:id="@+id/main_log_behind_GL"
|
||||||
android:maxLines="100"/>
|
android:maxLines="100"/>
|
||||||
|
|
||||||
|
<net.kdt.pojavlaunch.value.customcontrols.ControlsLayout
|
||||||
|
android:id="@+id/main_controllayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<net.kdt.pojavlaunch.MinecraftGLView
|
<net.kdt.pojavlaunch.MinecraftGLView
|
||||||
android:id="@+id/main_game_render_view"
|
android:id="@+id/main_game_render_view"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"/>
|
android:layout_height="fill_parent"/>
|
||||||
|
|
||||||
|
</net.kdt.pojavlaunch.value.customcontrols.ControlsLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -42,205 +49,6 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/control_debug"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="30.0dip"
|
|
||||||
android:layout_marginLeft="2.0dip"
|
|
||||||
android:layout_marginTop="2.0dip"
|
|
||||||
android:text="@string/control_debug"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_marginRight="2dp"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/control_talk"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="30.0dip"
|
|
||||||
android:layout_marginTop="2.0dip"
|
|
||||||
android:layout_marginRight="2.0dip"
|
|
||||||
android:text="@string/control_chat"
|
|
||||||
android:layout_toRightOf="@id/control_debug"
|
|
||||||
android:layout_alignParentTop="true"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/control_keyboard"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="30.0dip"
|
|
||||||
android:layout_marginTop="2.0dip"
|
|
||||||
android:layout_marginRight="2.0dip"
|
|
||||||
android:text="@string/control_keyboard"
|
|
||||||
android:layout_toRightOf="@id/control_talk"
|
|
||||||
android:layout_alignParentTop="true"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/control_thirdperson"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="30.0dip"
|
|
||||||
android:layout_marginLeft="2.0dip"
|
|
||||||
android:layout_marginTop="2.0dip"
|
|
||||||
android:layout_marginRight="2.0dip"
|
|
||||||
android:text="@string/control_thirdperson"
|
|
||||||
android:layout_below="@id/control_debug"
|
|
||||||
android:layout_alignParentLeft="true"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="30.0dip"
|
|
||||||
android:layout_marginTop="2.0dip"
|
|
||||||
android:layout_marginRight="2.0dip"
|
|
||||||
android:text="@string/control_zoom"
|
|
||||||
android:layout_below="@id/control_talk"
|
|
||||||
android:layout_toRightOf="@id/control_thirdperson"
|
|
||||||
android:id="@+id/control_zoom"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="30.0dip"
|
|
||||||
android:layout_marginTop="2.0dip"
|
|
||||||
android:layout_marginRight="2.0dip"
|
|
||||||
android:text="@string/control_listplayers"
|
|
||||||
android:layout_toRightOf="@id/control_keyboard"
|
|
||||||
android:id="@+id/control_listplayers"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:textSize="32.0sp"
|
|
||||||
android:id="@+id/control_down"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="50.0dip"
|
|
||||||
android:layout_height="50.0dip"
|
|
||||||
android:layout_marginLeft="68.0dip"
|
|
||||||
android:layout_marginBottom="14.0dip"
|
|
||||||
android:text="@string/control_down"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentBottom="true"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:textSize="32.0sp"
|
|
||||||
android:id="@+id/control_up"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="50.0dip"
|
|
||||||
android:layout_height="50.0dip"
|
|
||||||
android:layout_marginLeft="68.0dip"
|
|
||||||
android:layout_marginBottom="122.0dip"
|
|
||||||
android:text="@string/control_up"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentBottom="true"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:textSize="32.0sp"
|
|
||||||
android:id="@+id/control_left"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="50.0dip"
|
|
||||||
android:layout_height="50.0dip"
|
|
||||||
android:layout_marginLeft="14.0dip"
|
|
||||||
android:layout_marginBottom="68.0dip"
|
|
||||||
android:text="@string/control_left"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentBottom="true"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:textSize="32.0sp"
|
|
||||||
android:id="@+id/control_right"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="50.0dip"
|
|
||||||
android:layout_height="50.0dip"
|
|
||||||
android:layout_marginLeft="122.0dip"
|
|
||||||
android:layout_marginBottom="68.0dip"
|
|
||||||
android:text="@string/control_right"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentBottom="true"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/control_jump"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="50.0dip"
|
|
||||||
android:layout_height="50.0dip"
|
|
||||||
android:layout_marginRight="68.0dip"
|
|
||||||
android:layout_marginBottom="68.0dip"
|
|
||||||
android:text="@string/control_jump"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_alignParentRight="true"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:textSize="16.0sp"
|
|
||||||
android:id="@+id/control_primary"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="50.0dip"
|
|
||||||
android:layout_height="50.0dip"
|
|
||||||
android:layout_marginLeft="14.0dip"
|
|
||||||
android:layout_marginBottom="122.0dip"
|
|
||||||
android:text="@string/control_primary"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentBottom="true"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:textSize="16.0sp"
|
|
||||||
android:id="@+id/control_secondary"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="50.0dip"
|
|
||||||
android:layout_height="50.0dip"
|
|
||||||
android:layout_marginLeft="122.0dip"
|
|
||||||
android:layout_marginBottom="122.0dip"
|
|
||||||
android:text="@string/control_secondary"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentBottom="true"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:textSize="20.0sp"
|
|
||||||
android:id="@+id/control_shift"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="50.0dip"
|
|
||||||
android:layout_height="50.0dip"
|
|
||||||
android:layout_marginLeft="68.0dip"
|
|
||||||
android:layout_marginBottom="68.0dip"
|
|
||||||
android:text="@string/control_shift"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentBottom="true"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:textSize="16.0sp"
|
|
||||||
android:id="@+id/control_inventory"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="50.0dip"
|
|
||||||
android:layout_height="50.0dip"
|
|
||||||
android:layout_marginLeft="122.0dip"
|
|
||||||
android:layout_marginBottom="14.0dip"
|
|
||||||
android:text="@string/control_inventory"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentBottom="true"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:text="@string/control_mouseoff"
|
|
||||||
android:layout_below="@id/control_debug"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_marginRight="2dp"
|
|
||||||
android:layout_marginTop="2dp"
|
|
||||||
android:onClick="toggleMouse"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:id="@+id/control_mouse_toggle"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:background="@drawable/control_button"
|
|
||||||
android:layout_width="50dp"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
android:text="@string/control_toggle"
|
|
||||||
android:layout_marginBottom="14dp"
|
|
||||||
android:layout_marginLeft="14dp"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:id="@+id/control_togglecontrol"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_ctrl_add"
|
||||||
|
android:title="@string/customctrl_addbutton"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_ctrl_load"
|
android:id="@+id/menu_ctrl_load"
|
||||||
android:title="@string/global_load"/>
|
android:title="@string/global_load"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_ctrl_add"
|
android:id="@+id/menu_ctrl_save"
|
||||||
android:title="@string/global_add"/>
|
android:title="@string/global_save"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_ctrl_selectdefault"
|
||||||
|
android:title="@string/customctrl_selectdefault"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -179,9 +179,12 @@
|
|||||||
<string name="control_more3"></string>
|
<string name="control_more3"></string>
|
||||||
<string name="control_more4"></string>
|
<string name="control_more4"></string>
|
||||||
|
|
||||||
<string name="customctrl_keyname">LWJGL Keycode</string>
|
<string name="customctrl_keyname">Keycode</string>
|
||||||
<string name="customctrl_specialkey">Special Key</string>
|
<string name="customctrl_specialkey">Special Key</string>
|
||||||
<string name="customctrl_hidden">Hidden</string>
|
<string name="customctrl_hidden">Hidden</string>
|
||||||
|
<string name="customctrl_addbutton">Add button</string>
|
||||||
|
<string name="customctrl_title_selectctrl">Select default Control json</string>
|
||||||
|
<string name="customctrl_selectdefault">Select default Control json</string>
|
||||||
|
|
||||||
<!-- Update part (unused now) -->
|
<!-- Update part (unused now) -->
|
||||||
<string name="update_console">Update console</string>
|
<string name="update_console">Update console</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user