Sha256: 47b6bb32e7b561a35632e3f9d298391ee2a93bbe91516eeeab09f9a8ebeb1f3f

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 Bytes

Contents

class UnderOs::UI::Locker < UnderOs::UI::View
  wraps UIView, tag: :locker

  attr_reader :label, :sinner

  def initialize(options={})
    super options

    @dialog  = UnderOs::UI::View.new(class: 'locker-dialog')
    @spinner = UnderOs::UI::Spinner.new
    @label   = UnderOs::UI::Label.new(text: options[:text] || '')

    append @dialog.append(@spinner, @label)

    addClass 'with-label' if options[:text]
  end

  def show
    insertTo(UnderOs::App.history.current_page.view) if ! parent
    repaint
  end

  def hide
    remove
  end

  def text
    @label.text
  end

  def text=(text)
    @label.text = text
  end

  def show_for(&block)
    show
    1.ms.later do
      block.call
      1.ms.later { hide }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
under-os-1.0.0 lib/under_os/ui/locker.rb