Class: RMQTextViewStyler

Inherits:
RMQViewStyler show all
Defined in:
lib/project/ruby_motion_query/stylers/rmq_text_view_styler.rb

Direct Known Subclasses

RMQButtonStyler

Instance Attribute Summary

Attributes inherited from RMQViewStyler

#bg_color, #context, #corner_radius, #view

Instance Method Summary collapse

Methods inherited from RMQViewStyler

#background_color=, #background_resource=, #convert_color, #convert_gravity, #create_drawable, #density, #dp2px, #initialize, #layout_align_parent_left=, #layout_align_parent_right=, #layout_center_in_parent=, #layout_center_vertical=, #layout_gravity=, #layout_height=, #layout_params, #layout_weight=, #layout_width=, #margin=, #margin_bottom=, #margin_left=, #margin_right=, #margin_top=, #padding=, #padding_bottom=, #padding_left=, #padding_right=, #padding_top=

Constructor Details

This class inherits a constructor from RMQViewStyler

Instance Method Details

#color=(text_color) ⇒ Object



27
28
29
# File 'lib/project/ruby_motion_query/stylers/rmq_text_view_styler.rb', line 27

def color=(text_color)
  @view.textColor = convert_color(text_color)
end

#finalizeObject



44
45
46
47
48
49
# File 'lib/project/ruby_motion_query/stylers/rmq_text_view_styler.rb', line 44

def finalize
  super
  @text_style ||= Android::Graphics::Typeface::NORMAL
  typeface = Android::Graphics::Typeface.create(@font_family, @text_style) if @font_family
  @view.setTypeface(typeface, @text_style) # ok for typeface to be nil
end

#font=(rmq_font) ⇒ Object



35
36
37
38
# File 'lib/project/ruby_motion_query/stylers/rmq_text_view_styler.rb', line 35

def font=(rmq_font)
  @view.setTypeface(rmq_font.to_typeface, rmq_font.sdk_text_style)
  @view.textSize = rmq_font.size
end

#font_family=(font_family) ⇒ Object



6
7
8
# File 'lib/project/ruby_motion_query/stylers/rmq_text_view_styler.rb', line 6

def font_family=(font_family)
  @font_family = font_family
end

#gravity=(gravity) ⇒ Object



40
41
42
# File 'lib/project/ruby_motion_query/stylers/rmq_text_view_styler.rb', line 40

def gravity=(gravity)
  @view.gravity = convert_gravity(gravity)
end

#text=(text) ⇒ Object



31
32
33
# File 'lib/project/ruby_motion_query/stylers/rmq_text_view_styler.rb', line 31

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

#text_color=(text_color) ⇒ Object



24
25
26
# File 'lib/project/ruby_motion_query/stylers/rmq_text_view_styler.rb', line 24

def text_color=(text_color)
  @view.textColor = convert_color(text_color)
end

#text_size=(text_size) ⇒ Object



2
3
4
# File 'lib/project/ruby_motion_query/stylers/rmq_text_view_styler.rb', line 2

def text_size=(text_size)
  @view.textSize = text_size
end

#text_style=(text_style) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/project/ruby_motion_query/stylers/rmq_text_view_styler.rb', line 10

def text_style=(text_style)
  @text_style =
    case text_style.to_s.downcase
    when "bold"
      Android::Graphics::Typeface::BOLD
    when "italic"
      Android::Graphics::Typeface::ITALIC
    when "bold italic"
      Android::Graphics::Typeface::BOLD_ITALIC
    when "normal"
      Android::Graphics::Typeface::NORMAL
    end
end