motion_kondi 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Kondi
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'kondi'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install kondi
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/lib/kondi.rb ADDED
@@ -0,0 +1 @@
1
+ require "kondi/version"
@@ -0,0 +1,15 @@
1
+ module Kondi
2
+ class Application
3
+ def self.root_view(view = nil)
4
+ @root_view = view if view
5
+ @root_view
6
+ end
7
+
8
+ def application(application, didFinishLaunchingWithOptions:launchOptions)
9
+ @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.applicationFrame)
10
+ @window.rootViewController = self.class.root_view.new
11
+ @window.makeKeyAndVisible
12
+ true
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,39 @@
1
+ module Kondi
2
+ module Callbacks
3
+ def self.included(receiver)
4
+ receiver.extend(ClassMethods)
5
+ end
6
+
7
+ def run_before_callbacks(action, *args)
8
+ run_callbacks(:before, action)
9
+ end
10
+
11
+ def run_after_callbacks(action, *args)
12
+ run_callbacks(:after, action)
13
+ end
14
+
15
+ def run_callbacks(before_or_after, action, *args)
16
+ self.class._callbacks_for(before_or_after, action).each do |method_name|
17
+ send(method_name, *args)
18
+ end
19
+ end
20
+
21
+ module ClassMethods
22
+ def _callbacks
23
+ @_callbacks ||= {}
24
+ end
25
+
26
+ def _callbacks_for(before_or_after, action)
27
+ _callbacks["#{before_or_after}_#{action}".to_sym] ||= []
28
+ end
29
+
30
+ def before(action, callback)
31
+ _callbacks_for(:before, action) << callback
32
+ end
33
+
34
+ def after(action, callback)
35
+ _callbacks_for(:after, action) << callback
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,29 @@
1
+ require 'kondi/callbacks'
2
+
3
+ module Kondi
4
+ class TableViewCell < UITableViewCell
5
+ include Callbacks
6
+
7
+ ACCESSORY = {
8
+ :none => UITableViewCellAccessoryNone,
9
+ :checkmark => UITableViewCellAccessoryCheckmark
10
+ }
11
+
12
+ def label
13
+ textLabel
14
+ end
15
+
16
+ def accessory=(accessory_name)
17
+ self.accessoryType = ACCESSORY[accessory_name] || UITableViewCellAccessoryNone
18
+ end
19
+
20
+ def self.new(table_view_controller)
21
+ table_view_controller.recycle_cell(self) || alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier:identifier)
22
+ end
23
+
24
+ def self.identifier
25
+ name
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,30 @@
1
+ module Kondi
2
+ class TableViewController < UITableViewController
3
+ def tableView(tableView, numberOfRowsInSection:section)
4
+ size
5
+ end
6
+
7
+ def tableView(tableView, cellForRowAtIndexPath:indexPath)
8
+ cell_for(indexPath)
9
+ end
10
+
11
+ def tableView(tableView, didSelectRowAtIndexPath:indexPath)
12
+ cell_at(indexPath).run_after_callbacks :selected
13
+ end
14
+
15
+ def recycle_cell(id_or_class)
16
+ id = id_or_class.respond_to?(:identifier) ? id_or_class.identifier : id_or_class
17
+ tableView.dequeueReusableCellWithIdentifier(id)
18
+ end
19
+
20
+ def cell_at(index_path)
21
+ tableView.cellForRowAtIndexPath(index_path)
22
+ end
23
+
24
+ def self.new
25
+ instance = alloc.initWithStyle(UITableViewStylePlain)
26
+ instance.wantsFullScreenLayout = true
27
+ instance
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,3 @@
1
+ module Kondi
2
+ VERSION = "0.1.1"
3
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion_kondi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mick Staugaard
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-22 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: An application framework for RubyMotion
15
+ email:
16
+ - mick@staugaard.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/kondi/application.rb
22
+ - lib/kondi/callbacks.rb
23
+ - lib/kondi/table_view_cell.rb
24
+ - lib/kondi/table_view_controller.rb
25
+ - lib/kondi/version.rb
26
+ - lib/kondi.rb
27
+ - README.md
28
+ homepage: ''
29
+ licenses: []
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubyforge_project:
48
+ rubygems_version: 1.8.24
49
+ signing_key:
50
+ specification_version: 3
51
+ summary: makes you feel right at home
52
+ test_files: []