Created
February 18, 2015 23:43
-
-
Save TigerWolf/2ff0586e99fa8a79c738 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AlertHelper | |
def initialize(activity, listener = nil) | |
@activity = activity | |
@listener = listener | |
@listener = self if listener.nil? | |
@ok = false | |
end | |
def dialog(title, message) | |
r_string_yes = 17039379 | |
r_string_no = 17039369 | |
ab = Android::App::AlertDialog::Builder.new(@activity) | |
.setTitle(title) | |
.setMessage(message) | |
.setPositiveButton(r_string_yes, @listener) | |
.setCancelable(false) | |
if @ok == true | |
ab.setNegativeButton(r_string_no, @listener) | |
else | |
end | |
ab.show | |
end | |
def ok=(bool) | |
@ok = bool | |
end | |
def onClick(dialog, which) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you have any more cool helpers for Android? I'd love to see some code make its way into SugarCube's Android support! 😃