Sha256: cdb775a835ffbf0af6d29393ba1f7ac21786feffa699169769a66c9bd220db88

Contents?: true

Size: 1.08 KB

Versions: 27

Compression:

Stored size: 1.08 KB

Contents

require 'ruboto/widget'

java_import android.location.Location

ruboto_import_widgets :LinearLayout, :TextView

class LocationActivity
  def onCreate(bundle)
    super
    set_title File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
    self.content_view =
        linear_layout :orientation => LinearLayout::VERTICAL, :gravity => android.view.Gravity::CENTER do
          @distance_text = text_view :id => 42,
                    :text_size => 48.0, :gravity => android.view.Gravity::CENTER
          @start_bearing_text = text_view :id => 43,
                    :text_size => 48.0, :gravity => android.view.Gravity::CENTER
          @end_bearing_text = text_view :id => 44,
                    :text_size => 48.0, :gravity => android.view.Gravity::CENTER
        end
  end

  def onResume
    super
    result = Array.new(3, 0.0).to_java(:float)
    Location.distanceBetween(59.0, 11.0, 59.1, 11.1, result)
    @distance_text.text = result[0].to_s
    @start_bearing_text.text = result[1].to_s
    @end_bearing_text.text = result[2].to_s
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
ruboto-0.13.0.rc.0 test/activity/location_activity.rb
ruboto-0.12.0.rc.0 test/activity/location_activity.rb
ruboto-0.11.0 test/activity/location_activity.rb
ruboto-0.11.0.rc.1 test/activity/location_activity.rb
ruboto-0.11.0.rc.0 test/activity/location_activity.rb
ruboto-0.10.2 test/activity/location_activity.rb
ruboto-0.10.2.rc.0 test/activity/location_activity.rb