Sha256: 6a44f91fdb0cc1246522de954fe2f5e83b56e2844e584e1fd86366e0a3c4b6af

Contents?: true

Size: 845 Bytes

Versions: 9

Compression:

Stored size: 845 Bytes

Contents

class FlowUITextInputTextChangedListener
  def initialize(view)
    @view = view
  end

  def afterTextChanged(s)
    # Do nothing.
  end

  def beforeTextChanged(s, start, count, after)
    # Do nothing.
  end

  def onTextChanged(s, start, before, count)
    @view.trigger(:change, @view.text)
  end
end

module UI
  class TextInput < UI::Control
    include UI::Text
    include Eventable

    def placeholder=(text)
      proxy.hint = text
    end

    def placeholder
      proxy.hint
    end

    def proxy
      @proxy ||= begin
        edit_text = Android::Widget::EditText.new(UI.context)
        edit_text.setPadding(0, 0, 0, 0)
        edit_text.backgroundColor = Android::Graphics::Color::TRANSPARENT
        edit_text.addTextChangedListener FlowUITextInputTextChangedListener.new(self)
        edit_text
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
motion-flow-0.1.8 flow/ui/android/text_input.rb
motion-flow-0.1.7 flow/ui/android/text_input.rb
motion-flow-0.1.6 flow/ui/android/text_input.rb
motion-flow-0.1.5 flow/ui/android/text_input.rb
motion-flow-0.1.4 flow/ui/android/text_input.rb
motion-flow-0.1.3 flow/ui/android/text_input.rb
motion-flow-0.1.2 flow/ui/android/text_input.rb
motion-flow-0.1.1 flow/ui/android/text_input.rb
motion-flow-0.1 flow/ui/android/text_input.rb