class PMListScreen

http://hipbyte.myjetbrains.com/youtrack/issue/RM-773 - can't put this in a module yet :(

module ProMotion

Attributes

view[RW]

Public Instance Methods

adapter() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 48
def adapter
  @adapter ||= begin
    td = table_data
    if td.is_a?(Array)
      cells = td.first[:cells]
      PMBaseAdapter.new(data: cells)
    elsif td.is_a?(Hash)
      mp "Please supply a cursor in #{self.inspect}#table_data." unless td[:cursor]
      PMCursorAdapter.new(td)
    end
  end
end
add_adapter() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 44
def add_adapter
  self.view.setAdapter(adapter)
end
add_empty_view() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 35
def add_empty_view
  # append(Potion::TextView, :empty).style do |st|
  #   st.layout_width = :match_parent
  #   st.layout_height = :match_parent
  #   st.background = "#FFFFFF"
  #   st.text = "No data"
  # end
end
add_table_view() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 26
def add_table_view
  # create(Potion::ListView, :list).style do |st|
  #   st.layout_width = :match_parent
  #   st.layout_height = :match_parent
  #   st.layout_weight = 1
  #   st.view.drawSelectorOnTop = false
  # end
end
load_view() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 14
def load_view
  v = Potion::View.new(app.context) # TODO, fix this horrible hack
  lv = rmq(v).create(Potion::ListView).tag(:list)
  self.view = lv.get
end
onActivityCreated(saved_instance_state) click to toggle source

def load_view

Potion::FrameLayout.new(self.activity)

end

Calls superclass method
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 108
def onActivityCreated(saved_instance_state)
  mp "PMScreen onActivityCreated" if RMQ.debugging?

  super

  @view.rmq_data.is_screen_root_view = true

  self.rmq.build(@view)

  screen_setup

  if self.class.rmq_style_sheet_class
    self.rmq.stylesheet = self.class.rmq_style_sheet_class
    @view.rmq.apply_style(:root_view) #if @view.rmq.stylesheet.respond_to?(:root_view)
  end

  build_and_tag_xml_views

  set_title
  on_load
  on_activity_created
end
onAttach(activity) click to toggle source

Boilerplate from PMScreen ###

Calls superclass method
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 74
def onAttach(activity)
  super
  activity.on_fragment_attached(self) if activity.respond_to?(:on_fragment_attached)
  on_attach(activity)
end
onCreate(bundle) click to toggle source
Calls superclass method
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 81
def onCreate(bundle); super; on_create(bundle); end
onCreateView(inflater, parent, saved_instance_state) click to toggle source
Calls superclass method
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 84
def onCreateView(inflater, parent, saved_instance_state)
  super

  if @xml_resource = self.class.xml_resource
    @view = inflater.inflate(r(:layout, @xml_resource), parent, false)
  else
    v = load_view
    mp v
    @view ||= v
    @view.id = Potion::ViewIdGenerator.generate
  end

  set_up_action_bar(self.class.action_bar_options)

  on_create_view(inflater, parent, saved_instance_state)

  @view
end
onDestroy() click to toggle source
Calls superclass method PMScreenModule#onDestroy
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 151
def onDestroy; super; on_destroy; end
onDestroyView() click to toggle source
Calls superclass method
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 148
def onDestroyView; super; on_destroy_view; end
onDetach() click to toggle source
Calls superclass method
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 154
def onDetach
  super
  on_detach
  self.activity.on_fragment_detached(self) if self.activity.respond_to?(:on_fragment_detached)
end
onPause() click to toggle source
Calls superclass method
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 142
def onPause; super; on_pause; end
onResume() click to toggle source
Calls superclass method
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 137
def onResume; super; on_resume; end
onStart() click to toggle source
Calls superclass method
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 133
def onStart; super; on_start; end
onStop() click to toggle source
Calls superclass method
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 145
def onStop; super; on_stop; end
on_activity_created() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 131
def on_activity_created; end
on_appear()
Alias for: on_start
on_attach(activity) click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 79
def on_attach(activity); end
on_create(bundle) click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 82
def on_create(bundle); end
on_create_menu(menu) click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 140
def on_create_menu(menu); end
on_create_view(inflater, parent, saved_instance_state) click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 102
def on_create_view(inflater, parent, saved_instance_state); end
on_destroy() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 152
def on_destroy; end
on_destroy_view() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 149
def on_destroy_view; end
on_detach() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 159
def on_detach; end
on_load() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 130
def on_load; end
on_pause() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 143
def on_pause; end
on_resume() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 138
def on_resume; end
on_start() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 134
def on_start; end
Also aliased as: on_appear
on_stop() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 146
def on_stop; end
screen_setup() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 20
def screen_setup
  add_table_view
  add_empty_view
  add_adapter
end
table_data() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 9
def table_data
  mp "Implement a table_data method in #{self.inspect}."
  []
end
update_table_data() click to toggle source
# File lib/project/pro_motion/fragments/pm_list_screen.rb, line 61
def update_table_data
  # base adapters must reacquire their data from the PMListScreen "delegate"
  if adapter.instance_of?(PMCursorAdapter)
    # TODO:  Reload for PMCursorAdapter
  elsif adapter.is_a?(PMBaseAdapter)
    td = table_data
    adapter.data = td && td.first && td.first[:cells]
  end
  adapter.notifyDataSetChanged
end