2026-06-20 21:45:01 +02:00
|
|
|
package de.winniepat.parrotmod.ui;
|
|
|
|
|
|
2026-06-20 22:58:27 +02:00
|
|
|
import de.winniepat.parrotmod.config.ConfigManager;
|
2026-06-20 21:45:01 +02:00
|
|
|
import icyllis.modernui.util.DataSet;
|
2026-06-20 23:09:00 +02:00
|
|
|
import icyllis.modernui.view.LayoutInflater;
|
|
|
|
|
import icyllis.modernui.view.View;
|
|
|
|
|
import icyllis.modernui.view.ViewGroup;
|
|
|
|
|
import icyllis.modernui.widget.Button;
|
|
|
|
|
import icyllis.modernui.widget.LinearLayout;
|
2026-06-20 22:10:10 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2026-06-20 21:45:01 +02:00
|
|
|
|
2026-06-20 23:09:00 +02:00
|
|
|
public class GeneralTabFragment extends BaseTabFragment {
|
2026-06-20 21:45:01 +02:00
|
|
|
|
|
|
|
|
@Override
|
2026-06-20 22:10:10 +02:00
|
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, DataSet savedInstanceData) {
|
2026-06-20 21:45:01 +02:00
|
|
|
LinearLayout layout = new LinearLayout(getContext());
|
|
|
|
|
layout.setOrientation(LinearLayout.VERTICAL);
|
2026-06-20 23:09:00 +02:00
|
|
|
layout.setPadding(dp(20), dp(20), dp(20), dp(20));
|
2026-06-20 21:45:01 +02:00
|
|
|
|
2026-06-20 22:10:10 +02:00
|
|
|
layout.addView(makeLabel("Minecraft Version: " + Minecraft.getInstance().getLaunchedVersion()));
|
2026-06-20 21:45:01 +02:00
|
|
|
|
2026-06-20 22:58:27 +02:00
|
|
|
Button reloadBtn = new Button(getContext());
|
|
|
|
|
reloadBtn.setText("Reload Config");
|
|
|
|
|
reloadBtn.setOnClickListener(v -> ConfigManager.load());
|
|
|
|
|
var p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
2026-06-20 23:09:00 +02:00
|
|
|
p.topMargin = dp(24);
|
2026-06-20 22:58:27 +02:00
|
|
|
layout.addView(reloadBtn, p);
|
|
|
|
|
|
|
|
|
|
Button saveBtn = new Button(getContext());
|
|
|
|
|
saveBtn.setText("Save Config");
|
|
|
|
|
saveBtn.setOnClickListener(v -> ConfigManager.save());
|
2026-06-20 23:09:00 +02:00
|
|
|
var p2 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
|
|
|
p2.topMargin = dp(12);
|
|
|
|
|
layout.addView(saveBtn, p2);
|
2026-06-20 22:58:27 +02:00
|
|
|
|
2026-06-20 21:45:01 +02:00
|
|
|
return layout;
|
|
|
|
|
}
|
|
|
|
|
}
|