Sha256: ac827c378ae211ca2ab6afa077614e619cfdc5791db176e99c5d436621906d45

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

module UI
  module Text
    def text_alignment
      case (proxy.gravity & Android::View::Gravity::HORIZONTAL_GRAVITY_MASK)
        when Android::View::Gravity::LEFT
          :left
        when Android::View::Gravity::RIGHT
          :right
        else
          :center
      end
    end

    def text_alignment=(sym)
      val = Android::View::Gravity::CENTER_VERTICAL
      val |= case sym
        when :left
          Android::View::Gravity::LEFT
        when :center
          Android::View::Gravity::CENTER_HORIZONTAL
        when :right
          Android::View::Gravity::RIGHT
        else
          raise "Incorrect value, should be :left, :center or :right"
      end
      proxy.gravity = val
    end

    def color
      UI::Color(proxy.textColor)
    end

    def color=(color)
      proxy.textColor = UI::Color(color).proxy
    end

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

    def text
      proxy.text.toString
    end

    def font
      UI::Font._wrap(proxy.typeface, proxy.textSize)
    end

    def font=(font)
      font = UI::Font(font)
      proxy.setTypeface(font.proxy)
      proxy.setTextSize(font.size)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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