ruboto-core 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,313 @@
1
+ #######################################################
2
+ #
3
+ # ruboto.rb (by Scott Moyer)
4
+ #
5
+ # Wrapper for using RubotoActivity in Ruboto IRB
6
+ #
7
+ #######################################################
8
+
9
+ $RUBOTO_VERSION = 4
10
+
11
+ def confirm_ruboto_version(required_version, exact=true)
12
+ raise "requires $RUBOTO_VERSION=#{required_version} or greater, current version #{$RUBOTO_VERSION}" if $RUBOTO_VERSION < required_version and not exact
13
+ raise "requires $RUBOTO_VERSION=#{required_version}, current version #{$RUBOTO_VERSION}" if $RUBOTO_VERSION != required_version and exact
14
+ end
15
+
16
+ require 'java'
17
+
18
+
19
+
20
+ %w(Activity BroadcastReceiver Service).map do |klass|
21
+ java_import "org.ruboto.Ruboto#{klass}"
22
+ end
23
+
24
+ RUBOTO_CLASSES = [RubotoActivity, RubotoBroadcastReceiver, RubotoService]
25
+ $init_methods = Hash.new 'create'
26
+ $init_methods[RubotoBroadcastReceiver] = 'receive'
27
+
28
+ java_import "org.ruboto.RubotoView"
29
+
30
+ java_import "android.app.Activity"
31
+ java_import "android.content.Intent"
32
+ java_import "android.os.Bundle"
33
+
34
+ java_import "android.view.View"
35
+ java_import "android.view.ViewGroup"
36
+
37
+ java_import "android.widget.Toast"
38
+
39
+ java_import "android.widget.ArrayAdapter"
40
+ java_import "java.util.Arrays"
41
+ java_import "java.util.ArrayList"
42
+ java_import "android.R"
43
+
44
+ java_import "android.util.Log"
45
+
46
+ module Ruboto
47
+ java_import "THE_PACKAGE.R"
48
+ begin
49
+ Id = JavaUtilities.get_proxy_class("THE_PACKAGE.R$id")
50
+ rescue NameError
51
+ Log.d "RUBOTO", "no R$id"
52
+ end
53
+
54
+ end
55
+ AndroidIds = JavaUtilities.get_proxy_class("android.R$id")
56
+
57
+ #############################################################################
58
+ #
59
+ # Activity
60
+ #
61
+
62
+ class Activity
63
+ attr_accessor :init_block
64
+
65
+ def start_ruboto_dialog(remote_variable, &block)
66
+ start_ruboto_activity(remote_variable, true, &block)
67
+ end
68
+
69
+ def start_ruboto_activity(remote_variable, dialog=false, &block)
70
+ @@init_block = block
71
+
72
+ if @initialized or not self.is_a?(RubotoActivity)
73
+ b = Bundle.new
74
+ b.putString("Remote Variable", remote_variable)
75
+ b.putBoolean("Define Remote Variable", true)
76
+ b.putString("Initialize Script", "#{remote_variable}.initialize_activity")
77
+
78
+ i = Intent.new
79
+ i.setClassName "THE_PACKAGE",
80
+ "THE_PACKAGE.ACTIVITY_NAME"
81
+ i.putExtra("RubotoActivity Config", b)
82
+
83
+ self.startActivity i
84
+ else
85
+ instance_eval "#{remote_variable}=self"
86
+ setRemoteVariable remote_variable
87
+ initialize_activity
88
+ on_create nil
89
+ end
90
+
91
+ self
92
+ end
93
+
94
+ #plugin
95
+ def toast(text, duration=5000)
96
+ Toast.makeText(self, text, duration).show
97
+ end
98
+
99
+ #plugin
100
+ def toast_result(result, success, failure, duration=5000)
101
+ toast(result ? success : failure, duration)
102
+ end
103
+ end
104
+
105
+ #############################################################################
106
+ #
107
+ # RubotoActivity
108
+ #
109
+
110
+ class RubotoActivity
111
+ #
112
+ # Initialize
113
+ #
114
+
115
+ def initialize_activity()
116
+ instance_eval &@@init_block
117
+ @initialized = true
118
+ self
119
+ end
120
+
121
+ #
122
+ # Option Menus
123
+ #
124
+
125
+ def add_menu title, icon=nil, &block
126
+ mi = @menu.add(title)
127
+ mi.setIcon(icon) if icon
128
+ mi.class.class_eval {attr_accessor :on_click}
129
+ mi.on_click = block
130
+ end
131
+
132
+ def handle_create_options_menu &block
133
+ requestCallback RubotoActivity::CB_CREATE_OPTIONS_MENU
134
+ @create_options_menu_block = block
135
+ end
136
+
137
+ def on_create_options_menu(*args)
138
+ @menu, @context_menu = args[0], nil
139
+ instance_eval {@create_options_menu_block.call(*args)} if @create_options_menu_block
140
+ end
141
+
142
+ def on_menu_item_selected(num,menu_item)
143
+ (instance_eval &(menu_item.on_click); return true) if @menu
144
+ false
145
+ end
146
+
147
+ #
148
+ # Context Menus
149
+ #
150
+
151
+ def add_context_menu title, &block
152
+ mi = @context_menu.add(title)
153
+ mi.class.class_eval {attr_accessor :on_click}
154
+ mi.on_click = block
155
+ end
156
+
157
+ def handle_create_context_menu &block
158
+ requestCallback RubotoActivity::CB_CREATE_CONTEXT_MENU
159
+ @create_context_menu_block = block
160
+ end
161
+
162
+ def on_create_context_menu(*args)
163
+ @menu, @context_menu = nil, args[0]
164
+ instance_eval {@create_context_menu_block.call(*args)} if @create_context_menu_block
165
+ end
166
+
167
+ def on_context_item_selected(menu_item)
168
+ (instance_eval {menu_item.on_click.call(menu_item.getMenuInfo.position)}; return true) if menu_item.on_click
169
+ false
170
+ end
171
+ end
172
+
173
+ RUBOTO_CLASSES.each do |klass|
174
+ klass.class_eval do
175
+ def when_launched(&block)
176
+ instance_exec *args, &block
177
+ on_create nil
178
+ end
179
+
180
+ def handle_create &block
181
+ @create_block = block
182
+ end
183
+
184
+ def on_create(bundle)
185
+ setContentView(instance_eval &@content_view_block) if @content_view_block
186
+ instance_eval {@create_block.call} if @create_block
187
+ end
188
+
189
+ # plugin or something
190
+ def setup_content &block
191
+ @view_parent = nil
192
+ @content_view_block = block
193
+ end
194
+
195
+ #
196
+ # Setup Callbacks
197
+ #
198
+
199
+ def method_missing(name, *args, &block)
200
+ # make #handle_name_of_callback request that callback
201
+ if name.to_s =~ /^handle_(.*)/ and (const = RubotoActivity.const_get("CB_#{$1.upcase}"))
202
+ requestCallback const
203
+ @eigenclass ||= class << self; self; end
204
+ @eigenclass.send(:define_method, "on_#{$1}", &block)
205
+ else
206
+ super
207
+ end
208
+ end
209
+
210
+ def respond_to?(name)
211
+ return true if name.to_s =~ /^handle_(.*)/ and RubotoActivity.const_get("CB_#{$1.upcase}")
212
+ super
213
+ end
214
+
215
+ eval %Q{
216
+ def handle_#{$init_methods[klass]}(&block)
217
+ when_launched &block
218
+ end
219
+ }
220
+ end
221
+ end
222
+
223
+
224
+ #############################################################################
225
+ #
226
+ # RubotoActivity View Generation
227
+ #
228
+
229
+ def ruboto_import_widgets(*widgets)
230
+ widgets.each{|i| ruboto_import_widget i}
231
+ end
232
+
233
+ def ruboto_import_widget(class_name)
234
+ view_class = java_import "android.widget.#{class_name}"
235
+ return unless view_class
236
+
237
+ RubotoActivity.class_eval "
238
+ def #{(class_name.to_s.gsub(/([A-Z])/) {'_' + $1.downcase})[1..-1]}(params={})
239
+ rv = #{class_name}.new self
240
+ @view_parent.addView(rv) if @view_parent
241
+ rv.configure self, params
242
+ if block_given?
243
+ old_view_parent, @view_parent = @view_parent, rv
244
+ yield
245
+ @view_parent = old_view_parent
246
+ end
247
+ rv
248
+ end
249
+ "
250
+ end
251
+
252
+ # Need to load these two to extend classes
253
+ ruboto_import_widgets :ListView, :Button
254
+
255
+ #############################################################################
256
+ #
257
+ # Extend Common View Classes
258
+ #
259
+
260
+ class View
261
+ @@convert_params = {
262
+ :wrap_content => ViewGroup::LayoutParams::WRAP_CONTENT,
263
+ :fill_parent => ViewGroup::LayoutParams::FILL_PARENT,
264
+ }
265
+
266
+ def configure(context, params = {})
267
+ if width = params.delete(:width)
268
+ getLayoutParams.width = @@convert_params[width] or width
269
+ end
270
+
271
+ if height = params.delete(:height)
272
+ getLayoutParams.height = @@convert_params[height] or height
273
+ end
274
+
275
+ params.each do |k, v|
276
+ if v.is_a?(Array)
277
+ self.send("set#{k.to_s.gsub(/(^|_)([a-z])/) {$2.upcase}}", *v)
278
+ else
279
+ self.send("set#{k.to_s.gsub(/(^|_)([a-z])/) {$2.upcase}}", v)
280
+ end
281
+ end
282
+ end
283
+ end
284
+
285
+ class ListView
286
+ attr_reader :adapter, :adapter_list
287
+
288
+ def configure(context, params = {})
289
+ if params.has_key? :list
290
+ @adapter_list = ArrayList.new
291
+ @adapter_list.addAll(params[:list])
292
+ @adapter = ArrayAdapter.new(context, R::layout::simple_list_item_1, @adapter_list)
293
+ setAdapter @adapter
294
+ params.delete :list
295
+ end
296
+ setOnItemClickListener(context)
297
+ super(context, params)
298
+ end
299
+
300
+ def reload_list(list)
301
+ @adapter_list.clear();
302
+ @adapter_list.addAll(list)
303
+ @adapter.notifyDataSetChanged
304
+ invalidate
305
+ end
306
+ end
307
+
308
+ class Button
309
+ def configure(context, params = {})
310
+ setOnClickListener(context)
311
+ super(context, params)
312
+ end
313
+ end
@@ -0,0 +1,21 @@
1
+ require 'ruboto.rb'
2
+
3
+ ruboto_import_widgets :TextView, :LinearLayout, :Button
4
+
5
+ $activity.handle_create do |bundle|
6
+ setTitle 'This is the Title'
7
+
8
+ setup_content do
9
+ linear_layout :orientation => LinearLayout::VERTICAL do
10
+ @text_view = text_view :text => "What hath Matz wrought?"
11
+ button :text => "M-x butterfly", :width => :wrap_content
12
+ end
13
+ end
14
+
15
+ handle_click do |view|
16
+ if view.getText == 'M-x butterfly'
17
+ @text_view.setText "What hath Matz wrought!"
18
+ toast 'Flipped a bit via butterfly'
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ require 'ruboto.rb'
2
+
3
+ # despite the name, the when_launched block will get called whenever
4
+ # the BroadcastReceiver receives an intent (whenever onReceive is called)
5
+ $broadcast_receiver.handle_receive do |context, intent|
6
+ Log.v "MYAPP", intent.getExtras.to_s
7
+ end
@@ -0,0 +1,13 @@
1
+ require 'ruboto.rb'
2
+ $service.handle_create do
3
+ # define what your service does. Directly put any code that you want
4
+ # executed when onCreate gets called. Define the rest of the
5
+ # behavior with handle_ blocks. See the README for more info.
6
+
7
+ # Services are complicated and don't really make sense unless you
8
+ # show the interaction between the Service and other parts of your
9
+ # app
10
+ # For now, just take a look at the explanation and example in
11
+ # online:
12
+ # http://developer.android.com/reference/android/app/Service.html
13
+ end
@@ -0,0 +1,10 @@
1
+ package THE_PACKAGE;
2
+
3
+ public class InheritingActivity extends org.ruboto.RubotoActivity {
4
+ public void onCreate(android.os.Bundle arg0) {
5
+
6
+ setScriptName("start.rb");
7
+ super.onCreate(arg0);
8
+ }
9
+
10
+ }
@@ -0,0 +1,10 @@
1
+ package THE_PACKAGE;
2
+
3
+ public class InheritingBroadcastReceiver extends org.ruboto.RubotoBroadcastReceiver {
4
+ public void onReceive(android.content.Context arg0, android.content.Intent arg1) {
5
+
6
+ setScriptName("start.rb");
7
+ super.onReceive(arg0,arg1);
8
+ }
9
+
10
+ }
@@ -0,0 +1,10 @@
1
+ package THE_PACKAGE;
2
+
3
+ public class InheritingService extends org.ruboto.RubotoService {
4
+ public void onCreate() {
5
+
6
+ setScriptName("start.rb");
7
+ super.onCreate();
8
+ }
9
+
10
+ }
@@ -0,0 +1,1406 @@
1
+ /**********************************************************************************************
2
+ *
3
+ * RubotoActivity.java is generated from RubotoClass.java.erb. Any changes needed in should be
4
+ * made within the erb template or they will be lost.
5
+ *
6
+ */
7
+
8
+ package org.ruboto;
9
+
10
+ import java.io.IOException;
11
+ import android.app.Activity;
12
+ import android.app.ProgressDialog;
13
+ import android.os.Handler;
14
+ import android.os.Bundle;
15
+
16
+ import org.jruby.Ruby;
17
+ import org.jruby.javasupport.util.RuntimeHelpers;
18
+ import org.jruby.runtime.builtin.IRubyObject;
19
+ import org.jruby.javasupport.JavaUtil;
20
+ import org.jruby.exceptions.RaiseException;
21
+
22
+ public abstract class RubotoActivity extends Activity
23
+ implements
24
+ android.content.DialogInterface.OnCancelListener,
25
+ android.widget.TabHost.TabContentFactory,
26
+ android.content.DialogInterface.OnShowListener,
27
+ android.widget.TimePicker.OnTimeChangedListener,
28
+ android.widget.AdapterView.OnItemLongClickListener,
29
+ android.view.View.OnClickListener,
30
+ android.content.DialogInterface.OnDismissListener,
31
+ android.content.DialogInterface.OnClickListener,
32
+ android.content.DialogInterface.OnKeyListener,
33
+ android.view.View.OnTouchListener,
34
+ android.app.DatePickerDialog.OnDateSetListener,
35
+ android.widget.AdapterView.OnItemClickListener,
36
+ android.hardware.SensorEventListener,
37
+ android.view.View.OnLongClickListener,
38
+ android.widget.TextView.OnEditorActionListener,
39
+ android.content.DialogInterface.OnMultiChoiceClickListener,
40
+ android.widget.DatePicker.OnDateChangedListener,
41
+ android.view.ViewGroup.OnHierarchyChangeListener,
42
+ android.widget.AdapterView.OnItemSelectedListener,
43
+ android.view.View.OnFocusChangeListener,
44
+ java.lang.Runnable,
45
+ android.view.View.OnKeyListener,
46
+ android.app.TimePickerDialog.OnTimeSetListener,
47
+ android.widget.TabHost.OnTabChangeListener
48
+ {
49
+ public static final int CB_CANCEL = 0;
50
+ public static final int CB_CREATE_TAB_CONTENT = 1;
51
+ public static final int CB_SHOW = 2;
52
+ public static final int CB_TIME_CHANGED = 3;
53
+ public static final int CB_ITEM_LONG_CLICK = 4;
54
+ public static final int CB_CLICK = 5;
55
+ public static final int CB_SIZE_CHANGED = 6;
56
+ public static final int CB_DRAW = 7;
57
+ public static final int CB_DISMISS = 8;
58
+ public static final int CB_DIALOG_CLICK = 9;
59
+ public static final int CB_DIALOG_KEY = 10;
60
+ public static final int CB_TOUCH = 11;
61
+ public static final int CB_DATE_SET = 12;
62
+ public static final int CB_ITEM_CLICK = 13;
63
+ public static final int CB_SENSOR_CHANGED = 14;
64
+ public static final int CB_ACCURACY_CHANGED = 15;
65
+ public static final int CB_LONG_CLICK = 16;
66
+ public static final int CB_EDITOR_ACTION = 17;
67
+ public static final int CB_DIALOG_MULTI_CHOICE_CLICK = 18;
68
+ public static final int CB_DATE_CHANGED = 19;
69
+ public static final int CB_CHILD_VIEW_REMOVED = 20;
70
+ public static final int CB_CHILD_VIEW_ADDED = 21;
71
+ public static final int CB_NOTHING_SELECTED = 22;
72
+ public static final int CB_ITEM_SELECTED = 23;
73
+ public static final int CB_FOCUS_CHANGE = 24;
74
+ public static final int CB_RUN = 25;
75
+ public static final int CB_KEY = 26;
76
+ public static final int CB_SAVE_INSTANCE_STATE = 27;
77
+ public static final int CB_LOW_MEMORY = 28;
78
+ public static final int CB_USER_INTERACTION = 29;
79
+ public static final int CB_STOP = 30;
80
+ public static final int CB_POST_RESUME = 31;
81
+ public static final int CB_CREATE_PANEL_MENU = 32;
82
+ public static final int CB_WINDOW_FOCUS_CHANGED = 33;
83
+ public static final int CB_USER_LEAVE_HINT = 34;
84
+ public static final int CB_DETACHED_FROM_WINDOW = 35;
85
+ public static final int CB_CREATE_VIEW = 36;
86
+ public static final int CB_PREPARE_OPTIONS_MENU = 37;
87
+ public static final int CB_PAUSE = 38;
88
+ public static final int CB_OPTIONS_MENU_CLOSED = 39;
89
+ public static final int CB_CREATE_OPTIONS_MENU = 40;
90
+ public static final int CB_CREATE_DESCRIPTION = 41;
91
+ public static final int CB_RETAIN_NON_CONFIGURATION_INSTANCE = 42;
92
+ public static final int CB_RESTORE_INSTANCE_STATE = 43;
93
+ public static final int CB_OPTIONS_ITEM_SELECTED = 44;
94
+ public static final int CB_ACTIVITY_RESULT = 45;
95
+ public static final int CB_START = 46;
96
+ public static final int CB_RESUME = 47;
97
+ public static final int CB_DESTROY = 48;
98
+ public static final int CB_CREATE_PANEL_VIEW = 49;
99
+ public static final int CB_CREATE_DIALOG = 50;
100
+ public static final int CB_KEY_DOWN = 51;
101
+ public static final int CB_CONTENT_CHANGED = 52;
102
+ public static final int CB_WINDOW_ATTRIBUTES_CHANGED = 53;
103
+ public static final int CB_TITLE_CHANGED = 54;
104
+ public static final int CB_SEARCH_REQUESTED = 55;
105
+ public static final int CB_RESTART = 56;
106
+ public static final int CB_PREPARE_DIALOG = 57;
107
+ public static final int CB_POST_CREATE = 58;
108
+ public static final int CB_KEY_MULTIPLE = 59;
109
+ public static final int CB_KEY_LONG_PRESS = 60;
110
+ public static final int CB_CONTEXT_MENU_CLOSED = 61;
111
+ public static final int CB_CONFIGURATION_CHANGED = 62;
112
+ public static final int CB_CHILD_TITLE_CHANGED = 63;
113
+ public static final int CB_ATTACHED_TO_WINDOW = 64;
114
+ public static final int CB_TRACKBALL_EVENT = 65;
115
+ public static final int CB_TOUCH_EVENT = 66;
116
+ public static final int CB_PREPARE_PANEL = 67;
117
+ public static final int CB_CREATE_THUMBNAIL = 68;
118
+ public static final int CB_CREATE_CONTEXT_MENU = 69;
119
+ public static final int CB_BACK_PRESSED = 70;
120
+ public static final int CB_APPLY_THEME_RESOURCE = 71;
121
+ public static final int CB_NEW_INTENT = 72;
122
+ public static final int CB_MENU_OPENED = 73;
123
+ public static final int CB_KEY_UP = 74;
124
+ public static final int CB_PANEL_CLOSED = 75;
125
+ public static final int CB_TIME_SET = 76;
126
+ public static final int CB_TAB_CHANGED = 77;
127
+ public static final int CB_LAST = 78;
128
+
129
+ private boolean[] callbackOptions = new boolean [CB_LAST];
130
+
131
+ private String remoteVariable = "";
132
+
133
+ private final Handler loadingHandler = new Handler();
134
+ private IRubyObject __this__;
135
+ private Ruby __ruby__;
136
+ private String scriptName;
137
+ public Object[] args;
138
+
139
+ public RubotoActivity setRemoteVariable(String var) {
140
+ remoteVariable = ((var == null) ? "" : (var + "."));
141
+ return this;
142
+ }
143
+
144
+ /**********************************************************************************
145
+ *
146
+ * Callback management
147
+ */
148
+
149
+ public void requestCallback(int id) {
150
+ callbackOptions[id] = true;
151
+ }
152
+
153
+ public void removeCallback(int id) {
154
+ callbackOptions[id] = false;
155
+ }
156
+
157
+ /*
158
+ * Activity Lifecycle: onCreate
159
+ */
160
+
161
+ @Override
162
+ public void onCreate(android.os.Bundle arg0) {
163
+
164
+ args = new Object[1];
165
+ args[0] = arg0;
166
+ super.onCreate(arg0);
167
+
168
+ Script.copyScriptsIfNeeded(getFilesDir().getAbsolutePath() + "/scripts", getAssets());
169
+
170
+ if (Script.getRuby() == null){
171
+ Script.setUpJRuby(null);
172
+ }
173
+ Script.defineGlobalVariable("$activity", this);
174
+
175
+
176
+ __ruby__ = Script.getRuby();
177
+ __this__ = JavaUtil.convertJavaToRuby(__ruby__, RubotoActivity.this);
178
+
179
+ Bundle configBundle = getIntent().getBundleExtra("RubotoActivity Config");
180
+
181
+ Script.defineGlobalVariable("$bundle", arg0);
182
+
183
+ if (configBundle != null) {
184
+ setRemoteVariable(configBundle.getString("Remote Variable"));
185
+ if (configBundle.getBoolean("Define Remote Variable")) {
186
+ Script.defineGlobalVariable(configBundle.getString("Remote Variable"), this);
187
+ setRemoteVariable(configBundle.getString("Remote Variable"));
188
+ }
189
+ if (configBundle.getString("Initialize Script") != null) {
190
+ Script.execute(configBundle.getString("Initialize Script"));
191
+ }
192
+ Script.execute(remoteVariable + "on_create($bundle)");
193
+ } else {
194
+ Script.defineGlobalVariable("$activity", this);
195
+
196
+ try {
197
+ new Script(scriptName).execute();
198
+ }
199
+ catch(IOException e){
200
+ ProgressDialog.show(this, "Script failed", "Something bad happened", true, false);
201
+ }
202
+ }
203
+ }
204
+
205
+ public void setScriptName(String name){
206
+ scriptName = name;
207
+ }
208
+
209
+
210
+
211
+ /*********************************************************************************
212
+ *
213
+ * Ruby Generated Callback Methods
214
+ */
215
+
216
+ /*
217
+ * android.content.DialogInterface$OnCancelListener
218
+ */
219
+
220
+ public void onCancel(android.content.DialogInterface arg0) {
221
+ if (callbackOptions[CB_CANCEL]) {
222
+
223
+ try {
224
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_cancel", JavaUtil.convertJavaToRuby(__ruby__, arg0));
225
+ } catch (RaiseException re) {
226
+ re.printStackTrace(__ruby__.getErrorStream());
227
+
228
+ }
229
+ }
230
+ }
231
+
232
+ /*
233
+ * android.widget.TabHost$TabContentFactory
234
+ */
235
+
236
+ public android.view.View createTabContent(java.lang.String arg0) {
237
+ if (callbackOptions[CB_CREATE_TAB_CONTENT]) {
238
+
239
+ try {
240
+ return (android.view.View)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "create_tab_content", JavaUtil.convertJavaToRuby(__ruby__, arg0)).toJava(android.view.View.class);
241
+ } catch (RaiseException re) {
242
+ re.printStackTrace(__ruby__.getErrorStream());
243
+ return null;
244
+ }
245
+ } else {
246
+ return null;
247
+ }
248
+ }
249
+
250
+ /*
251
+ * android.content.DialogInterface$OnShowListener
252
+ */
253
+
254
+ public void onShow(android.content.DialogInterface arg0) {
255
+ if (callbackOptions[CB_SHOW]) {
256
+
257
+ try {
258
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_show", JavaUtil.convertJavaToRuby(__ruby__, arg0));
259
+ } catch (RaiseException re) {
260
+ re.printStackTrace(__ruby__.getErrorStream());
261
+
262
+ }
263
+ }
264
+ }
265
+
266
+ /*
267
+ * android.widget.TimePicker$OnTimeChangedListener
268
+ */
269
+
270
+ public void onTimeChanged(android.widget.TimePicker arg0, int arg1, int arg2) {
271
+ if (callbackOptions[CB_TIME_CHANGED]) {
272
+
273
+ try {
274
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_time_changed", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2));
275
+ } catch (RaiseException re) {
276
+ re.printStackTrace(__ruby__.getErrorStream());
277
+
278
+ }
279
+ }
280
+ }
281
+
282
+ /*
283
+ * android.widget.AdapterView$OnItemLongClickListener
284
+ */
285
+
286
+ public boolean onItemLongClick(android.widget.AdapterView arg0, android.view.View arg1, int arg2, long arg3) {
287
+ if (callbackOptions[CB_ITEM_LONG_CLICK]) {
288
+
289
+ try {
290
+ IRubyObject[] args = {JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2), JavaUtil.convertJavaToRuby(__ruby__, arg3)};
291
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_item_long_click", args).toJava(boolean.class);
292
+ } catch (RaiseException re) {
293
+ re.printStackTrace(__ruby__.getErrorStream());
294
+ return false;
295
+ }
296
+ } else {
297
+ return false;
298
+ }
299
+ }
300
+
301
+ /*
302
+ * android.view.View$OnClickListener
303
+ */
304
+
305
+ public void onClick(android.view.View arg0) {
306
+ if (callbackOptions[CB_CLICK]) {
307
+
308
+ try {
309
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_click", JavaUtil.convertJavaToRuby(__ruby__, arg0));
310
+ } catch (RaiseException re) {
311
+ re.printStackTrace(__ruby__.getErrorStream());
312
+
313
+ }
314
+ }
315
+ }
316
+
317
+ /*
318
+ * none
319
+ */
320
+
321
+ public void onSizeChanged(android.view.View arg0, int arg1, int arg2, int arg3, int arg4) {
322
+ if (callbackOptions[CB_SIZE_CHANGED]) {
323
+
324
+ try {
325
+ IRubyObject[] args = {JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2), JavaUtil.convertJavaToRuby(__ruby__, arg3), JavaUtil.convertJavaToRuby(__ruby__, arg4)};
326
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_size_changed", args);
327
+ } catch (RaiseException re) {
328
+ re.printStackTrace(__ruby__.getErrorStream());
329
+
330
+ }
331
+ }
332
+ }
333
+
334
+ public void onDraw(android.view.View arg0, android.graphics.Canvas arg1) {
335
+ if (callbackOptions[CB_DRAW]) {
336
+
337
+ try {
338
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_draw", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1));
339
+ } catch (RaiseException re) {
340
+ re.printStackTrace(__ruby__.getErrorStream());
341
+
342
+ }
343
+ }
344
+ }
345
+
346
+ /*
347
+ * android.content.DialogInterface$OnDismissListener
348
+ */
349
+
350
+ public void onDismiss(android.content.DialogInterface arg0) {
351
+ if (callbackOptions[CB_DISMISS]) {
352
+
353
+ try {
354
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_dismiss", JavaUtil.convertJavaToRuby(__ruby__, arg0));
355
+ } catch (RaiseException re) {
356
+ re.printStackTrace(__ruby__.getErrorStream());
357
+
358
+ }
359
+ }
360
+ }
361
+
362
+ /*
363
+ * android.content.DialogInterface$OnClickListener
364
+ */
365
+
366
+ public void onClick(android.content.DialogInterface arg0, int arg1) {
367
+ if (callbackOptions[CB_DIALOG_CLICK]) {
368
+
369
+ try {
370
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_dialog_click", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1));
371
+ } catch (RaiseException re) {
372
+ re.printStackTrace(__ruby__.getErrorStream());
373
+
374
+ }
375
+ }
376
+ }
377
+
378
+ /*
379
+ * android.content.DialogInterface$OnKeyListener
380
+ */
381
+
382
+ public boolean onKey(android.content.DialogInterface arg0, int arg1, android.view.KeyEvent arg2) {
383
+ if (callbackOptions[CB_DIALOG_KEY]) {
384
+
385
+ try {
386
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_dialog_key", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2)).toJava(boolean.class);
387
+ } catch (RaiseException re) {
388
+ re.printStackTrace(__ruby__.getErrorStream());
389
+ return false;
390
+ }
391
+ } else {
392
+ return false;
393
+ }
394
+ }
395
+
396
+ /*
397
+ * android.view.View$OnTouchListener
398
+ */
399
+
400
+ public boolean onTouch(android.view.View arg0, android.view.MotionEvent arg1) {
401
+ if (callbackOptions[CB_TOUCH]) {
402
+
403
+ try {
404
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_touch", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1)).toJava(boolean.class);
405
+ } catch (RaiseException re) {
406
+ re.printStackTrace(__ruby__.getErrorStream());
407
+ return false;
408
+ }
409
+ } else {
410
+ return false;
411
+ }
412
+ }
413
+
414
+ /*
415
+ * android.app.DatePickerDialog$OnDateSetListener
416
+ */
417
+
418
+ public void onDateSet(android.widget.DatePicker arg0, int arg1, int arg2, int arg3) {
419
+ if (callbackOptions[CB_DATE_SET]) {
420
+
421
+ try {
422
+ IRubyObject[] args = {JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2), JavaUtil.convertJavaToRuby(__ruby__, arg3)};
423
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_date_set", args);
424
+ } catch (RaiseException re) {
425
+ re.printStackTrace(__ruby__.getErrorStream());
426
+
427
+ }
428
+ }
429
+ }
430
+
431
+ /*
432
+ * android.widget.AdapterView$OnItemClickListener
433
+ */
434
+
435
+ public void onItemClick(android.widget.AdapterView arg0, android.view.View arg1, int arg2, long arg3) {
436
+ if (callbackOptions[CB_ITEM_CLICK]) {
437
+
438
+ try {
439
+ IRubyObject[] args = {JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2), JavaUtil.convertJavaToRuby(__ruby__, arg3)};
440
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_item_click", args);
441
+ } catch (RaiseException re) {
442
+ re.printStackTrace(__ruby__.getErrorStream());
443
+
444
+ }
445
+ }
446
+ }
447
+
448
+ /*
449
+ * android.hardware.SensorEventListener
450
+ */
451
+
452
+ public void onSensorChanged(android.hardware.SensorEvent arg0) {
453
+ if (callbackOptions[CB_SENSOR_CHANGED]) {
454
+
455
+ try {
456
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_sensor_changed", JavaUtil.convertJavaToRuby(__ruby__, arg0));
457
+ } catch (RaiseException re) {
458
+ re.printStackTrace(__ruby__.getErrorStream());
459
+
460
+ }
461
+ }
462
+ }
463
+
464
+ public void onAccuracyChanged(android.hardware.Sensor arg0, int arg1) {
465
+ if (callbackOptions[CB_ACCURACY_CHANGED]) {
466
+
467
+ try {
468
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_accuracy_changed", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1));
469
+ } catch (RaiseException re) {
470
+ re.printStackTrace(__ruby__.getErrorStream());
471
+
472
+ }
473
+ }
474
+ }
475
+
476
+ /*
477
+ * android.view.View$OnLongClickListener
478
+ */
479
+
480
+ public boolean onLongClick(android.view.View arg0) {
481
+ if (callbackOptions[CB_LONG_CLICK]) {
482
+
483
+ try {
484
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_long_click", JavaUtil.convertJavaToRuby(__ruby__, arg0)).toJava(boolean.class);
485
+ } catch (RaiseException re) {
486
+ re.printStackTrace(__ruby__.getErrorStream());
487
+ return false;
488
+ }
489
+ } else {
490
+ return false;
491
+ }
492
+ }
493
+
494
+ /*
495
+ * android.widget.TextView$OnEditorActionListener
496
+ */
497
+
498
+ public boolean onEditorAction(android.widget.TextView arg0, int arg1, android.view.KeyEvent arg2) {
499
+ if (callbackOptions[CB_EDITOR_ACTION]) {
500
+
501
+ try {
502
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_editor_action", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2)).toJava(boolean.class);
503
+ } catch (RaiseException re) {
504
+ re.printStackTrace(__ruby__.getErrorStream());
505
+ return false;
506
+ }
507
+ } else {
508
+ return false;
509
+ }
510
+ }
511
+
512
+ /*
513
+ * android.view.View$OnCreateContextMenuListener
514
+ */
515
+
516
+ /*
517
+ * android.content.DialogInterface$OnMultiChoiceClickListener
518
+ */
519
+
520
+ public void onClick(android.content.DialogInterface arg0, int arg1, boolean arg2) {
521
+ if (callbackOptions[CB_DIALOG_MULTI_CHOICE_CLICK]) {
522
+
523
+ try {
524
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_dialog_multi_choice_click", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2));
525
+ } catch (RaiseException re) {
526
+ re.printStackTrace(__ruby__.getErrorStream());
527
+
528
+ }
529
+ }
530
+ }
531
+
532
+ /*
533
+ * android.widget.DatePicker$OnDateChangedListener
534
+ */
535
+
536
+ public void onDateChanged(android.widget.DatePicker arg0, int arg1, int arg2, int arg3) {
537
+ if (callbackOptions[CB_DATE_CHANGED]) {
538
+
539
+ try {
540
+ IRubyObject[] args = {JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2), JavaUtil.convertJavaToRuby(__ruby__, arg3)};
541
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_date_changed", args);
542
+ } catch (RaiseException re) {
543
+ re.printStackTrace(__ruby__.getErrorStream());
544
+
545
+ }
546
+ }
547
+ }
548
+
549
+ /*
550
+ * android.view.ViewGroup$OnHierarchyChangeListener
551
+ */
552
+
553
+ public void onChildViewRemoved(android.view.View arg0, android.view.View arg1) {
554
+ if (callbackOptions[CB_CHILD_VIEW_REMOVED]) {
555
+
556
+ try {
557
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_child_view_removed", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1));
558
+ } catch (RaiseException re) {
559
+ re.printStackTrace(__ruby__.getErrorStream());
560
+
561
+ }
562
+ }
563
+ }
564
+
565
+ public void onChildViewAdded(android.view.View arg0, android.view.View arg1) {
566
+ if (callbackOptions[CB_CHILD_VIEW_ADDED]) {
567
+
568
+ try {
569
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_child_view_added", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1));
570
+ } catch (RaiseException re) {
571
+ re.printStackTrace(__ruby__.getErrorStream());
572
+
573
+ }
574
+ }
575
+ }
576
+
577
+ /*
578
+ * android.widget.AdapterView$OnItemSelectedListener
579
+ */
580
+
581
+ public void onNothingSelected(android.widget.AdapterView arg0) {
582
+ if (callbackOptions[CB_NOTHING_SELECTED]) {
583
+
584
+ try {
585
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_nothing_selected", JavaUtil.convertJavaToRuby(__ruby__, arg0));
586
+ } catch (RaiseException re) {
587
+ re.printStackTrace(__ruby__.getErrorStream());
588
+
589
+ }
590
+ }
591
+ }
592
+
593
+ public void onItemSelected(android.widget.AdapterView arg0, android.view.View arg1, int arg2, long arg3) {
594
+ if (callbackOptions[CB_ITEM_SELECTED]) {
595
+
596
+ try {
597
+ IRubyObject[] args = {JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2), JavaUtil.convertJavaToRuby(__ruby__, arg3)};
598
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_item_selected", args);
599
+ } catch (RaiseException re) {
600
+ re.printStackTrace(__ruby__.getErrorStream());
601
+
602
+ }
603
+ }
604
+ }
605
+
606
+ /*
607
+ * android.view.View$OnFocusChangeListener
608
+ */
609
+
610
+ public void onFocusChange(android.view.View arg0, boolean arg1) {
611
+ if (callbackOptions[CB_FOCUS_CHANGE]) {
612
+
613
+ try {
614
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_focus_change", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1));
615
+ } catch (RaiseException re) {
616
+ re.printStackTrace(__ruby__.getErrorStream());
617
+
618
+ }
619
+ }
620
+ }
621
+
622
+ /*
623
+ * java.lang.Runnable
624
+ */
625
+
626
+ public void run() {
627
+ if (callbackOptions[CB_RUN]) {
628
+
629
+ try {
630
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "run");
631
+ } catch (RaiseException re) {
632
+ re.printStackTrace(__ruby__.getErrorStream());
633
+
634
+ }
635
+ }
636
+ }
637
+
638
+ /*
639
+ * android.view.View$OnKeyListener
640
+ */
641
+
642
+ public boolean onKey(android.view.View arg0, int arg1, android.view.KeyEvent arg2) {
643
+ if (callbackOptions[CB_KEY]) {
644
+
645
+ try {
646
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_key", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2)).toJava(boolean.class);
647
+ } catch (RaiseException re) {
648
+ re.printStackTrace(__ruby__.getErrorStream());
649
+ return false;
650
+ }
651
+ } else {
652
+ return false;
653
+ }
654
+ }
655
+
656
+ /*
657
+ * android.app.Activity
658
+ */
659
+
660
+ public void onSaveInstanceState(android.os.Bundle arg0) {
661
+ if (callbackOptions[CB_SAVE_INSTANCE_STATE]) {
662
+ super.onSaveInstanceState(arg0);
663
+ try {
664
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_save_instance_state", JavaUtil.convertJavaToRuby(__ruby__, arg0));
665
+ } catch (RaiseException re) {
666
+ re.printStackTrace(__ruby__.getErrorStream());
667
+
668
+ }
669
+ } else {
670
+ super.onSaveInstanceState(arg0);
671
+ }
672
+ }
673
+
674
+ public void onLowMemory() {
675
+ if (callbackOptions[CB_LOW_MEMORY]) {
676
+ super.onLowMemory();
677
+ try {
678
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_low_memory");
679
+ } catch (RaiseException re) {
680
+ re.printStackTrace(__ruby__.getErrorStream());
681
+
682
+ }
683
+ } else {
684
+ super.onLowMemory();
685
+ }
686
+ }
687
+
688
+ public void onUserInteraction() {
689
+ if (callbackOptions[CB_USER_INTERACTION]) {
690
+ super.onUserInteraction();
691
+ try {
692
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_user_interaction");
693
+ } catch (RaiseException re) {
694
+ re.printStackTrace(__ruby__.getErrorStream());
695
+
696
+ }
697
+ } else {
698
+ super.onUserInteraction();
699
+ }
700
+ }
701
+
702
+ public void onStop() {
703
+ if (callbackOptions[CB_STOP]) {
704
+ super.onStop();
705
+ try {
706
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_stop");
707
+ } catch (RaiseException re) {
708
+ re.printStackTrace(__ruby__.getErrorStream());
709
+
710
+ }
711
+ } else {
712
+ super.onStop();
713
+ }
714
+ }
715
+
716
+ public void onPostResume() {
717
+ if (callbackOptions[CB_POST_RESUME]) {
718
+ super.onPostResume();
719
+ try {
720
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_post_resume");
721
+ } catch (RaiseException re) {
722
+ re.printStackTrace(__ruby__.getErrorStream());
723
+
724
+ }
725
+ } else {
726
+ super.onPostResume();
727
+ }
728
+ }
729
+
730
+ public boolean onCreatePanelMenu(int arg0, android.view.Menu arg1) {
731
+ if (callbackOptions[CB_CREATE_PANEL_MENU]) {
732
+ super.onCreatePanelMenu(arg0, arg1);
733
+ try {
734
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_create_panel_menu", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1)).toJava(boolean.class);
735
+ } catch (RaiseException re) {
736
+ re.printStackTrace(__ruby__.getErrorStream());
737
+ return false;
738
+ }
739
+ } else {
740
+ return super.onCreatePanelMenu(arg0, arg1);
741
+ }
742
+ }
743
+
744
+ public void onWindowFocusChanged(boolean arg0) {
745
+ if (callbackOptions[CB_WINDOW_FOCUS_CHANGED]) {
746
+ super.onWindowFocusChanged(arg0);
747
+ try {
748
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_window_focus_changed", JavaUtil.convertJavaToRuby(__ruby__, arg0));
749
+ } catch (RaiseException re) {
750
+ re.printStackTrace(__ruby__.getErrorStream());
751
+
752
+ }
753
+ } else {
754
+ super.onWindowFocusChanged(arg0);
755
+ }
756
+ }
757
+
758
+ public void onUserLeaveHint() {
759
+ if (callbackOptions[CB_USER_LEAVE_HINT]) {
760
+ super.onUserLeaveHint();
761
+ try {
762
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_user_leave_hint");
763
+ } catch (RaiseException re) {
764
+ re.printStackTrace(__ruby__.getErrorStream());
765
+
766
+ }
767
+ } else {
768
+ super.onUserLeaveHint();
769
+ }
770
+ }
771
+
772
+ public void onDetachedFromWindow() {
773
+ if (callbackOptions[CB_DETACHED_FROM_WINDOW]) {
774
+ super.onDetachedFromWindow();
775
+ try {
776
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_detached_from_window");
777
+ } catch (RaiseException re) {
778
+ re.printStackTrace(__ruby__.getErrorStream());
779
+
780
+ }
781
+ } else {
782
+ super.onDetachedFromWindow();
783
+ }
784
+ }
785
+
786
+ public android.view.View onCreateView(java.lang.String arg0, android.content.Context arg1, android.util.AttributeSet arg2) {
787
+ if (callbackOptions[CB_CREATE_VIEW]) {
788
+ super.onCreateView(arg0, arg1, arg2);
789
+ try {
790
+ return (android.view.View)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_create_view", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2)).toJava(android.view.View.class);
791
+ } catch (RaiseException re) {
792
+ re.printStackTrace(__ruby__.getErrorStream());
793
+ return null;
794
+ }
795
+ } else {
796
+ return super.onCreateView(arg0, arg1, arg2);
797
+ }
798
+ }
799
+
800
+ public boolean onPrepareOptionsMenu(android.view.Menu arg0) {
801
+ if (callbackOptions[CB_PREPARE_OPTIONS_MENU]) {
802
+ super.onPrepareOptionsMenu(arg0);
803
+ try {
804
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_prepare_options_menu", JavaUtil.convertJavaToRuby(__ruby__, arg0)).toJava(boolean.class);
805
+ } catch (RaiseException re) {
806
+ re.printStackTrace(__ruby__.getErrorStream());
807
+ return false;
808
+ }
809
+ } else {
810
+ return super.onPrepareOptionsMenu(arg0);
811
+ }
812
+ }
813
+
814
+ public void onPause() {
815
+ if (callbackOptions[CB_PAUSE]) {
816
+ super.onPause();
817
+ try {
818
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_pause");
819
+ } catch (RaiseException re) {
820
+ re.printStackTrace(__ruby__.getErrorStream());
821
+
822
+ }
823
+ } else {
824
+ super.onPause();
825
+ }
826
+ }
827
+
828
+ public void onOptionsMenuClosed(android.view.Menu arg0) {
829
+ if (callbackOptions[CB_OPTIONS_MENU_CLOSED]) {
830
+ super.onOptionsMenuClosed(arg0);
831
+ try {
832
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_options_menu_closed", JavaUtil.convertJavaToRuby(__ruby__, arg0));
833
+ } catch (RaiseException re) {
834
+ re.printStackTrace(__ruby__.getErrorStream());
835
+
836
+ }
837
+ } else {
838
+ super.onOptionsMenuClosed(arg0);
839
+ }
840
+ }
841
+
842
+ public boolean onMenuItemSelected(int arg0, android.view.MenuItem arg1) {
843
+ if (callbackOptions[CB_CREATE_OPTIONS_MENU]) {
844
+ super.onMenuItemSelected(arg0, arg1);
845
+ try {
846
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_menu_item_selected", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1)).toJava(boolean.class);
847
+ } catch (RaiseException re) {
848
+ re.printStackTrace(__ruby__.getErrorStream());
849
+ return false;
850
+ }
851
+ } else {
852
+ return super.onMenuItemSelected(arg0, arg1);
853
+ }
854
+ }
855
+
856
+ public java.lang.CharSequence onCreateDescription() {
857
+ if (callbackOptions[CB_CREATE_DESCRIPTION]) {
858
+ super.onCreateDescription();
859
+ try {
860
+ return (java.lang.CharSequence)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_create_description").toJava(java.lang.CharSequence.class);
861
+ } catch (RaiseException re) {
862
+ re.printStackTrace(__ruby__.getErrorStream());
863
+ return null;
864
+ }
865
+ } else {
866
+ return super.onCreateDescription();
867
+ }
868
+ }
869
+
870
+ public java.lang.Object onRetainNonConfigurationInstance() {
871
+ if (callbackOptions[CB_RETAIN_NON_CONFIGURATION_INSTANCE]) {
872
+ super.onRetainNonConfigurationInstance();
873
+ try {
874
+ return (java.lang.Object)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_retain_non_configuration_instance").toJava(java.lang.Object.class);
875
+ } catch (RaiseException re) {
876
+ re.printStackTrace(__ruby__.getErrorStream());
877
+ return null;
878
+ }
879
+ } else {
880
+ return super.onRetainNonConfigurationInstance();
881
+ }
882
+ }
883
+
884
+ public void onRestoreInstanceState(android.os.Bundle arg0) {
885
+ if (callbackOptions[CB_RESTORE_INSTANCE_STATE]) {
886
+ super.onRestoreInstanceState(arg0);
887
+ try {
888
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_restore_instance_state", JavaUtil.convertJavaToRuby(__ruby__, arg0));
889
+ } catch (RaiseException re) {
890
+ re.printStackTrace(__ruby__.getErrorStream());
891
+
892
+ }
893
+ } else {
894
+ super.onRestoreInstanceState(arg0);
895
+ }
896
+ }
897
+
898
+ public boolean onOptionsItemSelected(android.view.MenuItem arg0) {
899
+ if (callbackOptions[CB_OPTIONS_ITEM_SELECTED]) {
900
+ super.onOptionsItemSelected(arg0);
901
+ try {
902
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_options_item_selected", JavaUtil.convertJavaToRuby(__ruby__, arg0)).toJava(boolean.class);
903
+ } catch (RaiseException re) {
904
+ re.printStackTrace(__ruby__.getErrorStream());
905
+ return false;
906
+ }
907
+ } else {
908
+ return super.onOptionsItemSelected(arg0);
909
+ }
910
+ }
911
+
912
+ public void onActivityResult(int arg0, int arg1, android.content.Intent arg2) {
913
+ if (callbackOptions[CB_ACTIVITY_RESULT]) {
914
+ super.onActivityResult(arg0, arg1, arg2);
915
+ try {
916
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_activity_result", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2));
917
+ } catch (RaiseException re) {
918
+ re.printStackTrace(__ruby__.getErrorStream());
919
+
920
+ }
921
+ } else {
922
+ super.onActivityResult(arg0, arg1, arg2);
923
+ }
924
+ }
925
+
926
+ public void onStart() {
927
+ if (callbackOptions[CB_START]) {
928
+ super.onStart();
929
+ try {
930
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_start");
931
+ } catch (RaiseException re) {
932
+ re.printStackTrace(__ruby__.getErrorStream());
933
+
934
+ }
935
+ } else {
936
+ super.onStart();
937
+ }
938
+ }
939
+
940
+ public void onResume() {
941
+ if (callbackOptions[CB_RESUME]) {
942
+ super.onResume();
943
+ try {
944
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_resume");
945
+ } catch (RaiseException re) {
946
+ re.printStackTrace(__ruby__.getErrorStream());
947
+
948
+ }
949
+ } else {
950
+ super.onResume();
951
+ }
952
+ }
953
+
954
+ public void onDestroy() {
955
+ if (callbackOptions[CB_DESTROY]) {
956
+ super.onDestroy();
957
+ try {
958
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_destroy");
959
+ } catch (RaiseException re) {
960
+ re.printStackTrace(__ruby__.getErrorStream());
961
+
962
+ }
963
+ } else {
964
+ super.onDestroy();
965
+ }
966
+ }
967
+
968
+ public android.view.View onCreatePanelView(int arg0) {
969
+ if (callbackOptions[CB_CREATE_PANEL_VIEW]) {
970
+ super.onCreatePanelView(arg0);
971
+ try {
972
+ return (android.view.View)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_create_panel_view", JavaUtil.convertJavaToRuby(__ruby__, arg0)).toJava(android.view.View.class);
973
+ } catch (RaiseException re) {
974
+ re.printStackTrace(__ruby__.getErrorStream());
975
+ return null;
976
+ }
977
+ } else {
978
+ return super.onCreatePanelView(arg0);
979
+ }
980
+ }
981
+
982
+ public android.app.Dialog onCreateDialog(int arg0, android.os.Bundle arg1) {
983
+ if (callbackOptions[CB_CREATE_DIALOG]) {
984
+ super.onCreateDialog(arg0, arg1);
985
+ try {
986
+ return (android.app.Dialog)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_create_dialog", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1)).toJava(android.app.Dialog.class);
987
+ } catch (RaiseException re) {
988
+ re.printStackTrace(__ruby__.getErrorStream());
989
+ return null;
990
+ }
991
+ } else {
992
+ return super.onCreateDialog(arg0, arg1);
993
+ }
994
+ }
995
+
996
+ public boolean onKeyDown(int arg0, android.view.KeyEvent arg1) {
997
+ if (callbackOptions[CB_KEY_DOWN]) {
998
+ super.onKeyDown(arg0, arg1);
999
+ try {
1000
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_key_down", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1)).toJava(boolean.class);
1001
+ } catch (RaiseException re) {
1002
+ re.printStackTrace(__ruby__.getErrorStream());
1003
+ return false;
1004
+ }
1005
+ } else {
1006
+ return super.onKeyDown(arg0, arg1);
1007
+ }
1008
+ }
1009
+
1010
+ public boolean onCreateOptionsMenu(android.view.Menu arg0) {
1011
+ if (callbackOptions[CB_CREATE_OPTIONS_MENU]) {
1012
+ super.onCreateOptionsMenu(arg0);
1013
+ try {
1014
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_create_options_menu", JavaUtil.convertJavaToRuby(__ruby__, arg0)).toJava(boolean.class);
1015
+ } catch (RaiseException re) {
1016
+ re.printStackTrace(__ruby__.getErrorStream());
1017
+ return false;
1018
+ }
1019
+ } else {
1020
+ return super.onCreateOptionsMenu(arg0);
1021
+ }
1022
+ }
1023
+
1024
+ public void onContentChanged() {
1025
+ if (callbackOptions[CB_CONTENT_CHANGED]) {
1026
+ super.onContentChanged();
1027
+ try {
1028
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_content_changed");
1029
+ } catch (RaiseException re) {
1030
+ re.printStackTrace(__ruby__.getErrorStream());
1031
+
1032
+ }
1033
+ } else {
1034
+ super.onContentChanged();
1035
+ }
1036
+ }
1037
+
1038
+ public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams arg0) {
1039
+ if (callbackOptions[CB_WINDOW_ATTRIBUTES_CHANGED]) {
1040
+ super.onWindowAttributesChanged(arg0);
1041
+ try {
1042
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_window_attributes_changed", JavaUtil.convertJavaToRuby(__ruby__, arg0));
1043
+ } catch (RaiseException re) {
1044
+ re.printStackTrace(__ruby__.getErrorStream());
1045
+
1046
+ }
1047
+ } else {
1048
+ super.onWindowAttributesChanged(arg0);
1049
+ }
1050
+ }
1051
+
1052
+ public void onTitleChanged(java.lang.CharSequence arg0, int arg1) {
1053
+ if (callbackOptions[CB_TITLE_CHANGED]) {
1054
+ super.onTitleChanged(arg0, arg1);
1055
+ try {
1056
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_title_changed", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1));
1057
+ } catch (RaiseException re) {
1058
+ re.printStackTrace(__ruby__.getErrorStream());
1059
+
1060
+ }
1061
+ } else {
1062
+ super.onTitleChanged(arg0, arg1);
1063
+ }
1064
+ }
1065
+
1066
+ public boolean onSearchRequested() {
1067
+ if (callbackOptions[CB_SEARCH_REQUESTED]) {
1068
+ super.onSearchRequested();
1069
+ try {
1070
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_search_requested").toJava(boolean.class);
1071
+ } catch (RaiseException re) {
1072
+ re.printStackTrace(__ruby__.getErrorStream());
1073
+ return false;
1074
+ }
1075
+ } else {
1076
+ return super.onSearchRequested();
1077
+ }
1078
+ }
1079
+
1080
+ public void onRestart() {
1081
+ if (callbackOptions[CB_RESTART]) {
1082
+ super.onRestart();
1083
+ try {
1084
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_restart");
1085
+ } catch (RaiseException re) {
1086
+ re.printStackTrace(__ruby__.getErrorStream());
1087
+
1088
+ }
1089
+ } else {
1090
+ super.onRestart();
1091
+ }
1092
+ }
1093
+
1094
+ public void onPrepareDialog(int arg0, android.app.Dialog arg1, android.os.Bundle arg2) {
1095
+ if (callbackOptions[CB_PREPARE_DIALOG]) {
1096
+ super.onPrepareDialog(arg0, arg1, arg2);
1097
+ try {
1098
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_prepare_dialog", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2));
1099
+ } catch (RaiseException re) {
1100
+ re.printStackTrace(__ruby__.getErrorStream());
1101
+
1102
+ }
1103
+ } else {
1104
+ super.onPrepareDialog(arg0, arg1, arg2);
1105
+ }
1106
+ }
1107
+
1108
+ public void onPostCreate(android.os.Bundle arg0) {
1109
+ if (callbackOptions[CB_POST_CREATE]) {
1110
+ super.onPostCreate(arg0);
1111
+ try {
1112
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_post_create", JavaUtil.convertJavaToRuby(__ruby__, arg0));
1113
+ } catch (RaiseException re) {
1114
+ re.printStackTrace(__ruby__.getErrorStream());
1115
+
1116
+ }
1117
+ } else {
1118
+ super.onPostCreate(arg0);
1119
+ }
1120
+ }
1121
+
1122
+ public boolean onKeyMultiple(int arg0, int arg1, android.view.KeyEvent arg2) {
1123
+ if (callbackOptions[CB_KEY_MULTIPLE]) {
1124
+ super.onKeyMultiple(arg0, arg1, arg2);
1125
+ try {
1126
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_key_multiple", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2)).toJava(boolean.class);
1127
+ } catch (RaiseException re) {
1128
+ re.printStackTrace(__ruby__.getErrorStream());
1129
+ return false;
1130
+ }
1131
+ } else {
1132
+ return super.onKeyMultiple(arg0, arg1, arg2);
1133
+ }
1134
+ }
1135
+
1136
+ public boolean onKeyLongPress(int arg0, android.view.KeyEvent arg1) {
1137
+ if (callbackOptions[CB_KEY_LONG_PRESS]) {
1138
+ super.onKeyLongPress(arg0, arg1);
1139
+ try {
1140
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_key_long_press", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1)).toJava(boolean.class);
1141
+ } catch (RaiseException re) {
1142
+ re.printStackTrace(__ruby__.getErrorStream());
1143
+ return false;
1144
+ }
1145
+ } else {
1146
+ return super.onKeyLongPress(arg0, arg1);
1147
+ }
1148
+ }
1149
+
1150
+ public void onContextMenuClosed(android.view.Menu arg0) {
1151
+ if (callbackOptions[CB_CONTEXT_MENU_CLOSED]) {
1152
+ super.onContextMenuClosed(arg0);
1153
+ try {
1154
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_context_menu_closed", JavaUtil.convertJavaToRuby(__ruby__, arg0));
1155
+ } catch (RaiseException re) {
1156
+ re.printStackTrace(__ruby__.getErrorStream());
1157
+
1158
+ }
1159
+ } else {
1160
+ super.onContextMenuClosed(arg0);
1161
+ }
1162
+ }
1163
+
1164
+ public void onConfigurationChanged(android.content.res.Configuration arg0) {
1165
+ if (callbackOptions[CB_CONFIGURATION_CHANGED]) {
1166
+ super.onConfigurationChanged(arg0);
1167
+ try {
1168
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_configuration_changed", JavaUtil.convertJavaToRuby(__ruby__, arg0));
1169
+ } catch (RaiseException re) {
1170
+ re.printStackTrace(__ruby__.getErrorStream());
1171
+
1172
+ }
1173
+ } else {
1174
+ super.onConfigurationChanged(arg0);
1175
+ }
1176
+ }
1177
+
1178
+ public void onChildTitleChanged(android.app.Activity arg0, java.lang.CharSequence arg1) {
1179
+ if (callbackOptions[CB_CHILD_TITLE_CHANGED]) {
1180
+ super.onChildTitleChanged(arg0, arg1);
1181
+ try {
1182
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_child_title_changed", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1));
1183
+ } catch (RaiseException re) {
1184
+ re.printStackTrace(__ruby__.getErrorStream());
1185
+
1186
+ }
1187
+ } else {
1188
+ super.onChildTitleChanged(arg0, arg1);
1189
+ }
1190
+ }
1191
+
1192
+ public void onAttachedToWindow() {
1193
+ if (callbackOptions[CB_ATTACHED_TO_WINDOW]) {
1194
+ super.onAttachedToWindow();
1195
+ try {
1196
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_attached_to_window");
1197
+ } catch (RaiseException re) {
1198
+ re.printStackTrace(__ruby__.getErrorStream());
1199
+
1200
+ }
1201
+ } else {
1202
+ super.onAttachedToWindow();
1203
+ }
1204
+ }
1205
+
1206
+ public boolean onTrackballEvent(android.view.MotionEvent arg0) {
1207
+ if (callbackOptions[CB_TRACKBALL_EVENT]) {
1208
+ super.onTrackballEvent(arg0);
1209
+ try {
1210
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_trackball_event", JavaUtil.convertJavaToRuby(__ruby__, arg0)).toJava(boolean.class);
1211
+ } catch (RaiseException re) {
1212
+ re.printStackTrace(__ruby__.getErrorStream());
1213
+ return false;
1214
+ }
1215
+ } else {
1216
+ return super.onTrackballEvent(arg0);
1217
+ }
1218
+ }
1219
+
1220
+ public boolean onTouchEvent(android.view.MotionEvent arg0) {
1221
+ if (callbackOptions[CB_TOUCH_EVENT]) {
1222
+ super.onTouchEvent(arg0);
1223
+ try {
1224
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_touch_event", JavaUtil.convertJavaToRuby(__ruby__, arg0)).toJava(boolean.class);
1225
+ } catch (RaiseException re) {
1226
+ re.printStackTrace(__ruby__.getErrorStream());
1227
+ return false;
1228
+ }
1229
+ } else {
1230
+ return super.onTouchEvent(arg0);
1231
+ }
1232
+ }
1233
+
1234
+ public boolean onPreparePanel(int arg0, android.view.View arg1, android.view.Menu arg2) {
1235
+ if (callbackOptions[CB_PREPARE_PANEL]) {
1236
+ super.onPreparePanel(arg0, arg1, arg2);
1237
+ try {
1238
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_prepare_panel", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2)).toJava(boolean.class);
1239
+ } catch (RaiseException re) {
1240
+ re.printStackTrace(__ruby__.getErrorStream());
1241
+ return false;
1242
+ }
1243
+ } else {
1244
+ return super.onPreparePanel(arg0, arg1, arg2);
1245
+ }
1246
+ }
1247
+
1248
+ public boolean onCreateThumbnail(android.graphics.Bitmap arg0, android.graphics.Canvas arg1) {
1249
+ if (callbackOptions[CB_CREATE_THUMBNAIL]) {
1250
+ super.onCreateThumbnail(arg0, arg1);
1251
+ try {
1252
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_create_thumbnail", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1)).toJava(boolean.class);
1253
+ } catch (RaiseException re) {
1254
+ re.printStackTrace(__ruby__.getErrorStream());
1255
+ return false;
1256
+ }
1257
+ } else {
1258
+ return super.onCreateThumbnail(arg0, arg1);
1259
+ }
1260
+ }
1261
+
1262
+ public void onCreateContextMenu(android.view.ContextMenu arg0, android.view.View arg1, android.view.ContextMenu.ContextMenuInfo arg2) {
1263
+ if (callbackOptions[CB_CREATE_CONTEXT_MENU]) {
1264
+ super.onCreateContextMenu(arg0, arg1, arg2);
1265
+ try {
1266
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_create_context_menu", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2));
1267
+ } catch (RaiseException re) {
1268
+ re.printStackTrace(__ruby__.getErrorStream());
1269
+
1270
+ }
1271
+ } else {
1272
+ super.onCreateContextMenu(arg0, arg1, arg2);
1273
+ }
1274
+ }
1275
+
1276
+ public void onBackPressed() {
1277
+ if (callbackOptions[CB_BACK_PRESSED]) {
1278
+ super.onBackPressed();
1279
+ try {
1280
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_back_pressed");
1281
+ } catch (RaiseException re) {
1282
+ re.printStackTrace(__ruby__.getErrorStream());
1283
+
1284
+ }
1285
+ } else {
1286
+ super.onBackPressed();
1287
+ }
1288
+ }
1289
+
1290
+ public void onApplyThemeResource(android.content.res.Resources.Theme arg0, int arg1, boolean arg2) {
1291
+ if (callbackOptions[CB_APPLY_THEME_RESOURCE]) {
1292
+ super.onApplyThemeResource(arg0, arg1, arg2);
1293
+ try {
1294
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_apply_theme_resource", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2));
1295
+ } catch (RaiseException re) {
1296
+ re.printStackTrace(__ruby__.getErrorStream());
1297
+
1298
+ }
1299
+ } else {
1300
+ super.onApplyThemeResource(arg0, arg1, arg2);
1301
+ }
1302
+ }
1303
+
1304
+ public void onNewIntent(android.content.Intent arg0) {
1305
+ if (callbackOptions[CB_NEW_INTENT]) {
1306
+ super.onNewIntent(arg0);
1307
+ try {
1308
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_new_intent", JavaUtil.convertJavaToRuby(__ruby__, arg0));
1309
+ } catch (RaiseException re) {
1310
+ re.printStackTrace(__ruby__.getErrorStream());
1311
+
1312
+ }
1313
+ } else {
1314
+ super.onNewIntent(arg0);
1315
+ }
1316
+ }
1317
+
1318
+ public boolean onMenuOpened(int arg0, android.view.Menu arg1) {
1319
+ if (callbackOptions[CB_MENU_OPENED]) {
1320
+ super.onMenuOpened(arg0, arg1);
1321
+ try {
1322
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_menu_opened", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1)).toJava(boolean.class);
1323
+ } catch (RaiseException re) {
1324
+ re.printStackTrace(__ruby__.getErrorStream());
1325
+ return false;
1326
+ }
1327
+ } else {
1328
+ return super.onMenuOpened(arg0, arg1);
1329
+ }
1330
+ }
1331
+
1332
+ public boolean onKeyUp(int arg0, android.view.KeyEvent arg1) {
1333
+ if (callbackOptions[CB_KEY_UP]) {
1334
+ super.onKeyUp(arg0, arg1);
1335
+ try {
1336
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_key_up", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1)).toJava(boolean.class);
1337
+ } catch (RaiseException re) {
1338
+ re.printStackTrace(__ruby__.getErrorStream());
1339
+ return false;
1340
+ }
1341
+ } else {
1342
+ return super.onKeyUp(arg0, arg1);
1343
+ }
1344
+ }
1345
+
1346
+ public void onPanelClosed(int arg0, android.view.Menu arg1) {
1347
+ if (callbackOptions[CB_PANEL_CLOSED]) {
1348
+ super.onPanelClosed(arg0, arg1);
1349
+ try {
1350
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_panel_closed", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1));
1351
+ } catch (RaiseException re) {
1352
+ re.printStackTrace(__ruby__.getErrorStream());
1353
+
1354
+ }
1355
+ } else {
1356
+ super.onPanelClosed(arg0, arg1);
1357
+ }
1358
+ }
1359
+
1360
+ public boolean onContextItemSelected(android.view.MenuItem arg0) {
1361
+ if (callbackOptions[CB_CREATE_CONTEXT_MENU]) {
1362
+ super.onContextItemSelected(arg0);
1363
+ try {
1364
+ return (Boolean)RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_context_item_selected", JavaUtil.convertJavaToRuby(__ruby__, arg0)).toJava(boolean.class);
1365
+ } catch (RaiseException re) {
1366
+ re.printStackTrace(__ruby__.getErrorStream());
1367
+ return false;
1368
+ }
1369
+ } else {
1370
+ return super.onContextItemSelected(arg0);
1371
+ }
1372
+ }
1373
+
1374
+ /*
1375
+ * android.app.TimePickerDialog$OnTimeSetListener
1376
+ */
1377
+
1378
+ public void onTimeSet(android.widget.TimePicker arg0, int arg1, int arg2) {
1379
+ if (callbackOptions[CB_TIME_SET]) {
1380
+
1381
+ try {
1382
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_time_set", JavaUtil.convertJavaToRuby(__ruby__, arg0), JavaUtil.convertJavaToRuby(__ruby__, arg1), JavaUtil.convertJavaToRuby(__ruby__, arg2));
1383
+ } catch (RaiseException re) {
1384
+ re.printStackTrace(__ruby__.getErrorStream());
1385
+
1386
+ }
1387
+ }
1388
+ }
1389
+
1390
+ /*
1391
+ * android.widget.TabHost$OnTabChangeListener
1392
+ */
1393
+
1394
+ public void onTabChanged(java.lang.String arg0) {
1395
+ if (callbackOptions[CB_TAB_CHANGED]) {
1396
+
1397
+ try {
1398
+ RuntimeHelpers.invoke(__ruby__.getCurrentContext(), __this__, "on_tab_changed", JavaUtil.convertJavaToRuby(__ruby__, arg0));
1399
+ } catch (RaiseException re) {
1400
+ re.printStackTrace(__ruby__.getErrorStream());
1401
+
1402
+ }
1403
+ }
1404
+ }
1405
+
1406
+ }