Class: AndroidMotionQuery::View
- Inherits:
-
Object
- Object
- AndroidMotionQuery::View
- Defined in:
- lib/android_query/views.rb
Instance Attribute Summary collapse
-
#activity ⇒ Object
Returns the value of attribute activity.
-
#extra ⇒ Object
Returns the value of attribute extra.
-
#layout_params ⇒ Object
Returns the value of attribute layout_params.
-
#options ⇒ Object
Returns the value of attribute options.
-
#style_name ⇒ Object
Returns the value of attribute style_name.
-
#stylesheet ⇒ Object
Returns the value of attribute stylesheet.
-
#view ⇒ Object
Returns the value of attribute view.
Instance Method Summary collapse
- #bottom ⇒ Object
- #button(style_method, &block) ⇒ Object
- #create_android_query_view(view, style_method, layout_params, options = {}, &block) ⇒ Object
- #edit_text(style_method, &block) ⇒ Object
-
#get ⇒ Object
convenience methods.
- #height ⇒ Object
- #image_button(style_method, &block) ⇒ Object
- #image_view(style_method, &block) ⇒ Object
-
#initialize(view, activity, stylesheet, style_name, layout_params, options = {}) ⇒ View
constructor
A new instance of View.
- #left ⇒ Object
- #linear_layout(style_method, &block) ⇒ Object
- #new_view(view, style_method, &block) ⇒ Object
- #right ⇒ Object
- #text ⇒ Object
- #text=(t) ⇒ Object
- #text_view(style_method, &block) ⇒ Object
- #top ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(view, activity, stylesheet, style_name, layout_params, options = {}) ⇒ View
Returns a new instance of View.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/android_query/views.rb', line 5 def initialize(view, activity, stylesheet, style_name, layout_params, = {}) self.view = view self.activity = activity self.stylesheet = stylesheet self.style_name = style_name self.layout_params = layout_params self. = { parent: nil, }.merge() end |
Instance Attribute Details
#activity ⇒ Object
Returns the value of attribute activity.
3 4 5 |
# File 'lib/android_query/views.rb', line 3 def activity @activity end |
#extra ⇒ Object
Returns the value of attribute extra.
3 4 5 |
# File 'lib/android_query/views.rb', line 3 def extra @extra end |
#layout_params ⇒ Object
Returns the value of attribute layout_params.
3 4 5 |
# File 'lib/android_query/views.rb', line 3 def layout_params @layout_params end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/android_query/views.rb', line 3 def @options end |
#style_name ⇒ Object
Returns the value of attribute style_name.
3 4 5 |
# File 'lib/android_query/views.rb', line 3 def style_name @style_name end |
#stylesheet ⇒ Object
Returns the value of attribute stylesheet.
3 4 5 |
# File 'lib/android_query/views.rb', line 3 def stylesheet @stylesheet end |
#view ⇒ Object
Returns the value of attribute view.
3 4 5 |
# File 'lib/android_query/views.rb', line 3 def view @view end |
Instance Method Details
#bottom ⇒ Object
20 |
# File 'lib/android_query/views.rb', line 20 def bottom; get.getBottom end |
#button(style_method, &block) ⇒ Object
52 53 54 55 |
# File 'lib/android_query/views.rb', line 52 def (style_method, &block) view = Android::Widget::Button.new(self.activity) create_android_query_view(view, style_method, self.layout_params, {}, &block) end |
#create_android_query_view(view, style_method, layout_params, options = {}, &block) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/android_query/views.rb', line 27 def create_android_query_view(view, style_method, layout_params, = {}, &block) aqv = View.new(view, self.activity, self.stylesheet, style_method, layout_params, ) self.stylesheet.apply_style_for(aqv, style_method, layout_params) puts "Adding #{aqv.get} to #{self.get}" self.get.addView(aqv.get) block.call(aqv) if block_given? aqv end |
#edit_text(style_method, &block) ⇒ Object
47 48 49 50 |
# File 'lib/android_query/views.rb', line 47 def edit_text(style_method, &block) view = Android::Widget::EditText.new(self.activity) create_android_query_view(view, style_method, self.layout_params, {}, &block) end |
#get ⇒ Object
convenience methods
17 |
# File 'lib/android_query/views.rb', line 17 def get; self.view end |
#height ⇒ Object
23 |
# File 'lib/android_query/views.rb', line 23 def height; get.getHeight end |
#image_button(style_method, &block) ⇒ Object
62 63 64 65 |
# File 'lib/android_query/views.rb', line 62 def (style_method, &block) view = Android::Widget::ImageButton.new(self.activity) create_android_query_view(view, style_method, self.layout_params, {}, &block) end |
#image_view(style_method, &block) ⇒ Object
57 58 59 60 |
# File 'lib/android_query/views.rb', line 57 def image_view(style_method, &block) view = Android::Widget::ImageView.new(self.activity) create_android_query_view(view, style_method, self.layout_params, {}, &block) end |
#left ⇒ Object
18 |
# File 'lib/android_query/views.rb', line 18 def left; get.getLeft end |
#linear_layout(style_method, &block) ⇒ Object
36 37 38 39 40 |
# File 'lib/android_query/views.rb', line 36 def linear_layout(style_method, &block) view = Android::Widget::LinearLayout.new(self.activity) lp = Android::Widget::LinearLayout::LayoutParams create_android_query_view(view, style_method, lp, {}, &block) end |
#new_view(view, style_method, &block) ⇒ Object
67 68 69 |
# File 'lib/android_query/views.rb', line 67 def new_view(view, style_method, &block) create_android_query_view(view, style_method, self.layout_params, {}, &block) end |
#right ⇒ Object
19 |
# File 'lib/android_query/views.rb', line 19 def right; get.getRight end |
#text ⇒ Object
24 |
# File 'lib/android_query/views.rb', line 24 def text; get.text end |
#text=(t) ⇒ Object
25 |
# File 'lib/android_query/views.rb', line 25 def text=(t); get.text = t end |
#text_view(style_method, &block) ⇒ Object
42 43 44 45 |
# File 'lib/android_query/views.rb', line 42 def text_view(style_method, &block) view = Android::Widget::TextView.new(self.activity) create_android_query_view(view, style_method, self.layout_params, {}, &block) end |
#top ⇒ Object
21 |
# File 'lib/android_query/views.rb', line 21 def top; get.getTop end |
#width ⇒ Object
22 |
# File 'lib/android_query/views.rb', line 22 def width; get.getWidth end |