xyz.candycoded.alertconfirmdialog 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Plugins/Android/AndroidPlugin.java +31 -22
- package/Plugins/Android/com.candycoded.alertconfirmdialog-release.aar +0 -0
- package/package.json +1 -1
- package/Plugins/Android/androidplugin-release.aar +0 -0
- /package/Plugins/Android/{androidplugin-release.aar.meta → com.candycoded.alertconfirmdialog-release.aar.meta} +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
package com.candycoded.alertconfirmdialog;
|
|
4
4
|
|
|
5
|
+
import android.app.Activity;
|
|
5
6
|
import android.content.Context;
|
|
6
7
|
import android.app.AlertDialog;
|
|
7
8
|
import android.os.Bundle;
|
|
@@ -10,52 +11,60 @@ import com.unity3d.player.UnityPlayer;
|
|
|
10
11
|
|
|
11
12
|
public class AndroidPlugin {
|
|
12
13
|
|
|
13
|
-
private
|
|
14
|
+
private Activity activity;
|
|
14
15
|
|
|
15
16
|
public AndroidPlugin(Context context) {
|
|
16
|
-
this.
|
|
17
|
+
this.activity = (Activity) context;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
public void Alert(String title, String message, String okButtonLabel) {
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
activity.runOnUiThread(() -> {
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
alertDialog.setMessage(message);
|
|
25
|
-
alertDialog.setPositiveButton(okButtonLabel, (dialog, which) -> {
|
|
24
|
+
AlertDialog.Builder alertDialog = new AlertDialog.Builder(activity);
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
alertDialog.setTitle(title);
|
|
27
|
+
alertDialog.setMessage(message);
|
|
28
|
+
alertDialog.setPositiveButton(okButtonLabel, (dialog, which) -> {
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
dialog.dismiss();
|
|
31
|
+
|
|
32
|
+
UnityPlayer.UnitySendMessage("AlertConfirmDialog", "Callback", "OK");
|
|
33
|
+
|
|
34
|
+
});
|
|
35
|
+
alertDialog.create();
|
|
36
|
+
alertDialog.show();
|
|
30
37
|
|
|
31
38
|
});
|
|
32
|
-
alertDialog.create();
|
|
33
|
-
alertDialog.show();
|
|
34
39
|
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
public void Confirm(String title, String message, String okButtonLabel, String cancelButtonLabel) {
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
activity.runOnUiThread(() -> {
|
|
40
45
|
|
|
41
|
-
|
|
42
|
-
alertDialog.setMessage(message);
|
|
43
|
-
alertDialog.setPositiveButton(okButtonLabel, (dialog, which) -> {
|
|
46
|
+
AlertDialog.Builder alertDialog = new AlertDialog.Builder(activity);
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
alertDialog.setTitle(title);
|
|
49
|
+
alertDialog.setMessage(message);
|
|
50
|
+
alertDialog.setPositiveButton(okButtonLabel, (dialog, which) -> {
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
dialog.dismiss();
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
UnityPlayer.UnitySendMessage("AlertConfirmDialog", "Callback", "OK");
|
|
55
|
+
|
|
56
|
+
});
|
|
57
|
+
alertDialog.setNegativeButton(cancelButtonLabel, (dialog, which) -> {
|
|
58
|
+
|
|
59
|
+
dialog.dismiss();
|
|
51
60
|
|
|
52
|
-
|
|
61
|
+
UnityPlayer.UnitySendMessage("AlertConfirmDialog", "Callback", "CANCEL");
|
|
53
62
|
|
|
54
|
-
|
|
63
|
+
});
|
|
64
|
+
alertDialog.create();
|
|
65
|
+
alertDialog.show();
|
|
55
66
|
|
|
56
67
|
});
|
|
57
|
-
alertDialog.create();
|
|
58
|
-
alertDialog.show();
|
|
59
68
|
|
|
60
69
|
}
|
|
61
70
|
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|
|
File without changes
|