Sha256: 574f8e60e81bd5b5ba14bc80de5c78ba58f2115476ec9f15b5d95fddcf86c612

Contents?: true

Size: 1007 Bytes

Versions: 1

Compression:

Stored size: 1007 Bytes

Contents

require 'ruboto/widget'

ruboto_import_widgets :LinearLayout, :TextView

class DialogFragmentActivity
  def onCreate(bundle)
    super
    set_title 'Dialog Fragment Test'

    self.content_view =
        linear_layout :orientation => :vertical, :gravity => :center do
          text_view :id => 42, :text => title, :text_size => 48.0,
                    :gravity => :center
        end
    ft = getFragmentManager.beginTransaction
    ft.addToBackStack(nil)
    ExampleDialogFragment.new.show(ft, 'example_dialog')
  end
end

class ExampleDialogFragment < android.app.DialogFragment
  def onCreate(bundle)
    super
    @some_var = 'Ruboto does fragments!'
  end

  def onCreateView(inflater, container, bundle)
    dialog.title = @some_var

    linear_layout :orientation => :vertical do
      linear_layout :gravity => :center, :layout => {:width= => :fill_parent} do
        text_view :text => @some_var, :id => 43, :text_size => 40.0,
                  :gravity => :center
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruboto-0.16.0 test/activity/dialog_fragment_activity.rb