Class: PotionDialog
- Defined in:
- lib/project/potion_dialog/potion_dialog.rb
Instance Method Summary collapse
- #build_dialog(options) ⇒ Object
-
#initialize(options) ⇒ PotionDialog
constructor
A new instance of PotionDialog.
Constructor Details
#initialize(options) ⇒ PotionDialog
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/project/potion_dialog/potion_dialog.rb', line 3 def initialize() @width = [:width] || [:w] @height = [:height] || [:h] # err if missing required options raise "[BluePotion ERROR] PotionDialog#initialize Requires an xml_layout" unless [:xml_layout] raise "[BluePotion ERROR] PotionDialog#initialize Cannot have width without height" if @width && !@height raise "[BluePotion ERROR] PotionDialog#initialize Cannot have height without width" if @height && !@width # Merging defaults opts = { title: false, show: true }.merge() built_dialog = build_dialog(opts) built_dialog.show if opts[:show] built_dialog end |
Instance Method Details
#build_dialog(options) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/project/potion_dialog/potion_dialog.rb', line 26 def build_dialog() # create dialog dialog = Potion::Dialog.new(find.activity) # manage title if [:title] dialog.title = [:title] else dialog.requestWindowFeature(Potion::Window::FEATURE_NO_TITLE) end # set alert content dialog.setContentView([:xml_layout]) # set width and height of Dialog Window if @width && @height dialog.window.setLayout(@width, @height) end dialog end |