-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemplates
More file actions
38 lines (32 loc) · 1.18 KB
/
Templates
File metadata and controls
38 lines (32 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Standard-GUI
var GUI;
var activity = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
function newLevel(){
activity.runOnUiThread(new java.lang.Runnable({ run: function(){
try{
var layout = new android.widget.LinearLayout(activity);
layout.setOrientation(1);
GUI = new android.widget.PopupWindow();
var button = new android.widget.Button(activity);
button.setText("Button");
button.setOnClickListener(new android.view.View.OnClickListener({
onClick: function(viewarg){
//Your Code
}
}));
layout.addView(button);
GUI.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT));
GUI.showAtLocation(activity.getWindow().getDecorView(), android.view.Gravity.RIGHT | android.view.Gravity.TOP, 0, 0);
}catch(err){
print("An error occured: " + err);
}
}}));
}
function leaveGame(){
activity.runOnUiThread(new java.lang.Runnable({ run: function(){
if(GUI != null){
GUI.dismiss();
GUI = null;
}
}}));
}