Class: AMQView
- Inherits:
-
Object
- Object
- AMQView
- Defined in:
- lib/android_motion_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
- #adapter(list, &block) ⇒ Object
- #add(view_sym, style, &block) ⇒ Object
- #bottom ⇒ Object
- #button(style_method, &block) ⇒ Object
- #create_android_query_view(view, style_method, layout_params, options = {}, &block) ⇒ Object
- #data(t) ⇒ Object
- #edit_text(style_method, &block) ⇒ Object
- #frame_layout(style_method, &block) ⇒ Object
- #get ⇒ Object
- #grid_view(style_method, &block) ⇒ Object
- #height ⇒ Object
-
#id ⇒ Object
convenience methods.
- #id=(vid) ⇒ Object
- #image_button(style_method, &block) ⇒ Object
- #image_view(style_method, &block) ⇒ Object
-
#initialize(view, activity, stylesheet, style_name, layout_params, options = {}) ⇒ AMQView
constructor
A new instance of AMQView.
- #left ⇒ Object
- #linear_layout(style_method, &block) ⇒ Object
- #new_view(view, style_method, &block) ⇒ Object
- #relative_layout(style_method, &block) ⇒ Object
- #right ⇒ Object
- #tap(&block) ⇒ 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 = {}) ⇒ AMQView
Returns a new instance of AMQView.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/android_motion_query/views.rb', line 4 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.
2 3 4 |
# File 'lib/android_motion_query/views.rb', line 2 def activity @activity end |
#extra ⇒ Object
Returns the value of attribute extra.
2 3 4 |
# File 'lib/android_motion_query/views.rb', line 2 def extra @extra end |
#layout_params ⇒ Object
Returns the value of attribute layout_params.
2 3 4 |
# File 'lib/android_motion_query/views.rb', line 2 def layout_params @layout_params end |
#options ⇒ Object
Returns the value of attribute options.
2 3 4 |
# File 'lib/android_motion_query/views.rb', line 2 def @options end |
#style_name ⇒ Object
Returns the value of attribute style_name.
2 3 4 |
# File 'lib/android_motion_query/views.rb', line 2 def style_name @style_name end |
#stylesheet ⇒ Object
Returns the value of attribute stylesheet.
2 3 4 |
# File 'lib/android_motion_query/views.rb', line 2 def stylesheet @stylesheet end |
#view ⇒ Object
Returns the value of attribute view.
2 3 4 |
# File 'lib/android_motion_query/views.rb', line 2 def view @view end |
Instance Method Details
#adapter(list, &block) ⇒ Object
93 94 95 96 97 |
# File 'lib/android_motion_query/views.rb', line 93 def adapter(list, &block) # this method has to be called from a grid_view or similar views (which accept adapters) self.get.adapter = AMQAdapter.new(self.activity, list, &block) self end |
#add(view_sym, style, &block) ⇒ Object
41 42 43 |
# File 'lib/android_motion_query/views.rb', line 41 def add(view_sym, style, &block) self.send(view_sym, style, &block) end |
#bottom ⇒ Object
21 |
# File 'lib/android_motion_query/views.rb', line 21 def bottom; get.getBottom end |
#button(style_method, &block) ⇒ Object
73 74 75 76 |
# File 'lib/android_motion_query/views.rb', line 73 def (style_method, &block) view = Android::Widget::Button.new(self.activity) new_view(view, style_method, &block) end |
#create_android_query_view(view, style_method, layout_params, options = {}, &block) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/android_motion_query/views.rb', line 33 def create_android_query_view(view, style_method, layout_params, = {}, &block) aqv = AMQView.new(view, self.activity, self.stylesheet, style_method, layout_params, ) self.stylesheet.apply_style_for(aqv, style_method, layout_params) self.get.addView(aqv.get) block.call(aqv) if block_given? aqv end |
#data(t) ⇒ Object
27 |
# File 'lib/android_motion_query/views.rb', line 27 def data(t); get.text = t; self end |
#edit_text(style_method, &block) ⇒ Object
68 69 70 71 |
# File 'lib/android_motion_query/views.rb', line 68 def edit_text(style_method, &block) view = Android::Widget::EditText.new(self.activity) new_view(view, style_method, &block) end |
#frame_layout(style_method, &block) ⇒ Object
57 58 59 60 61 |
# File 'lib/android_motion_query/views.rb', line 57 def frame_layout(style_method, &block) view = Android::Widget::FrameLayout.new(self.activity) lp = Android::Widget::FrameLayout::LayoutParams create_android_query_view(view, style_method, lp, {}, &block) end |
#get ⇒ Object
18 |
# File 'lib/android_motion_query/views.rb', line 18 def get; self.view end |
#grid_view(style_method, &block) ⇒ Object
88 89 90 91 |
# File 'lib/android_motion_query/views.rb', line 88 def grid_view(style_method, &block) view = Android::Widget::GridView.new(self.activity) new_view(view, style_method, &block) end |
#height ⇒ Object
24 |
# File 'lib/android_motion_query/views.rb', line 24 def height; get.getHeight end |
#id ⇒ Object
convenience methods
16 |
# File 'lib/android_motion_query/views.rb', line 16 def id; get.id end |
#id=(vid) ⇒ Object
17 |
# File 'lib/android_motion_query/views.rb', line 17 def id=(vid); get.id = vid; self end |
#image_button(style_method, &block) ⇒ Object
83 84 85 86 |
# File 'lib/android_motion_query/views.rb', line 83 def (style_method, &block) view = Android::Widget::ImageButton.new(self.activity) new_view(view, style_method, &block) end |
#image_view(style_method, &block) ⇒ Object
78 79 80 81 |
# File 'lib/android_motion_query/views.rb', line 78 def image_view(style_method, &block) view = Android::Widget::ImageView.new(self.activity) new_view(view, style_method, &block) end |
#left ⇒ Object
19 |
# File 'lib/android_motion_query/views.rb', line 19 def left; get.getLeft end |
#linear_layout(style_method, &block) ⇒ Object
45 46 47 48 49 |
# File 'lib/android_motion_query/views.rb', line 45 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
99 100 101 |
# File 'lib/android_motion_query/views.rb', line 99 def new_view(view, style_method, &block) create_android_query_view(view, style_method, self.layout_params, {}, &block) end |
#relative_layout(style_method, &block) ⇒ Object
51 52 53 54 55 |
# File 'lib/android_motion_query/views.rb', line 51 def relative_layout(style_method, &block) view = Android::Widget::RelativeLayout.new(self.activity) lp = Android::Widget::RelativeLayout::LayoutParams create_android_query_view(view, style_method, lp, {}, &block) end |
#right ⇒ Object
20 |
# File 'lib/android_motion_query/views.rb', line 20 def right; get.getRight end |
#tap(&block) ⇒ Object
28 29 30 31 |
# File 'lib/android_motion_query/views.rb', line 28 def tap(&block) self.get.onClickListener = AMQTapListener.new(self.activity, self, &block) self end |
#text ⇒ Object
25 |
# File 'lib/android_motion_query/views.rb', line 25 def text; get.text end |
#text=(t) ⇒ Object
26 |
# File 'lib/android_motion_query/views.rb', line 26 def text=(t); get.text = t end |
#text_view(style_method, &block) ⇒ Object
63 64 65 66 |
# File 'lib/android_motion_query/views.rb', line 63 def text_view(style_method, &block) view = Android::Widget::TextView.new(self.activity) new_view(view, style_method, &block) end |
#top ⇒ Object
22 |
# File 'lib/android_motion_query/views.rb', line 22 def top; get.getTop end |
#width ⇒ Object
23 |
# File 'lib/android_motion_query/views.rb', line 23 def width; get.getWidth end |