Sha256: 7e7bbacf4b07d4254e8445705833d06da6798ec9539b83028a3bcba91f519a6c

Contents?: true

Size: 737 Bytes

Versions: 5

Compression:

Stored size: 737 Bytes

Contents

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

  attr_reader :label, :spinner

  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

5 entries across 5 versions & 2 rubygems

Version Path
under-os-ui-1.4.0 lib/under_os/ui/locker.rb
under-os-1.3.0 lib/under_os/ui/locker.rb
under-os-1.2.1 lib/under_os/ui/locker.rb
under-os-1.2.0 lib/under_os/ui/locker.rb
under-os-1.1.0 lib/under_os/ui/locker.rb