Java Code Examples for org.appcelerator.kroll.annotations.Kroll#method()
The following examples show how to use
org.appcelerator.kroll.annotations.Kroll#method() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TiGooshModule.java From ti.goosh with MIT License | 6 votes |
@Kroll.method public void registerForPushNotifications(HashMap options) { Activity activity = TiApplication.getAppRootOrCurrentActivity(); if (false == options.containsKey("callback")) { Log.e(LCAT, "You have to specify a callback attribute when calling registerForPushNotifications"); return; } messageCallback = (KrollFunction)options.get("callback"); successCallback = options.containsKey("success") ? (KrollFunction)options.get("success") : null; errorCallback = options.containsKey("error") ? (KrollFunction)options.get("error") : null; parseBootIntent(); if (checkPlayServices()) { activity.startService( new Intent(activity, RegistrationIntentService.class) ); } }
Example 2
Source File: DrawerProxy.java From Ti.DrawerLayout with MIT License | 5 votes |
@Kroll.method public void toggleRightWindow(@Kroll.argument(optional = true) Object obj) { if (TiApplication.isUIThread()) { handleToggleRightView(); return; } Message message = getMainHandler().obtainMessage(MSG_TOGGLE_RIGHT_VIEW); message.sendToTarget(); }
Example 3
Source File: CollectionViewProxy.java From TiCollectionView with MIT License | 5 votes |
@Kroll.method public void replaceSectionAt(int index, Object section) { if (TiApplication.isUIThread()) { handleReplaceSectionAt(index, section); } else { sendReplaceSectionMessage(index, section); } }
Example 4
Source File: DrawerProxy.java From Ti.DrawerLayout with MIT License | 5 votes |
@Kroll.method public void toggleLeftWindow(@Kroll.argument(optional = true) Object obj) { if (TiApplication.isUIThread()) { handleToggleLeftView(); return; } Message message = getMainHandler().obtainMessage(MSG_TOGGLE_LEFT_VIEW); message.sendToTarget(); }
Example 5
Source File: ImagepickerModule.java From titanium-imagepicker with Apache License 2.0 | 5 votes |
@Kroll.method public TiBlob getImage(String filePath) { filePath = filePath.replaceFirst("file://", ""); if (null != filePath) { return TiBlob.blobFromImage( BitmapFactory.decodeFile(filePath) ); } Log.e(Defaults.LCAT, "File path missing"); return null; }
Example 6
Source File: ActionbarextrasModule.java From actionbarextras with MIT License | 5 votes |
/** * returns the height of the Actionbar as absolute pixels * @return int actionbar height */ @Kroll.getProperty @Kroll.method public int getActionbarHeight() { TiApplication appContext = TiApplication.getInstance(); final TypedArray styledAttributes = appContext.getTheme().obtainStyledAttributes( new int[] { android.R.attr.actionBarSize } ); int mActionBarSize = (int) styledAttributes.getDimension(0, 0); styledAttributes.recycle(); return mActionBarSize; }
Example 7
Source File: ActionbarextrasModule.java From actionbarextras with MIT License | 5 votes |
/** * disables or enables the icon * @param arg */ @Kroll.method @Kroll.setProperty public void setDisableIcon(@Kroll.argument(optional = true) Boolean arg) { Boolean disabled = true; if (arg != null) { disabled = TiConvert.toBoolean(arg); } Message message = getMainHandler().obtainMessage(MSG_DISABLE_ICON, disabled); message.sendToTarget(); }
Example 8
Source File: ActionbarextrasModule.java From actionbarextras with MIT License | 4 votes |
/** * sets options for the searchview that was passed * @param arg */ @Kroll.method @Kroll.setProperty public void setSearchView(Object arg) { Message message = getMainHandler().obtainMessage(MSG_SEARCHVIEW, arg); message.sendToTarget(); }
Example 9
Source File: ExampleProxy.java From TiCollectionView with MIT License | 4 votes |
@Kroll.setProperty @Kroll.method public void setMessage(String message) { Log.d(LCAT, "Tried setting module message to: " + message); }
Example 10
Source File: NovarumbluetoothModule.java From NovarumBluetooth with MIT License | 4 votes |
@Kroll.method public boolean connect(String devicemac) { if(devicemac == null) return false; //Check if we should use the service// if(useService) { //Start Service// try { //Get Current activity// TiApplication appContext = TiApplication.getInstance(); Activity activity = appContext.getCurrentActivity(); BluetoothServiceIntent = new TiIntentWrapper(new Intent(activity,BluetoothService.class)); BluetoothServiceIntent.getIntent().putExtra("MacAddress",devicemac); appContext.startService(BluetoothServiceIntent.getIntent()); return true; } catch(Exception e) { Log.w(TAG,"error on creating bluetooth service: "+e.getMessage()); return false; } } else { bluetoothDevice = bluetoothAdapter.getRemoteDevice(devicemac); if (bluetoothDevice.getBondState() == BluetoothDevice.BOND_NONE) { if(pairDevice(bluetoothDevice)) { return socketConnect(bluetoothDevice); } else { postError("Could not pair device"); return false; } } else { return socketConnect(bluetoothDevice); } } }
Example 11
Source File: ActionbarextrasModule.java From actionbarextras with MIT License | 4 votes |
/** * sets the Actionbar hideOffset * @param arg */ @Kroll.method @Kroll.setProperty public void setHideOffset(Object arg) { Message message = getMainHandler().obtainMessage(MSG_HIDE_OFFSET, arg); message.sendToTarget(); }
Example 12
Source File: TicroutonModule.java From TiCrouton with MIT License | 4 votes |
@Kroll.method public void confirm(String text) { showText(text, STYLE_CONFIRM); }
Example 13
Source File: ActionbarextrasModule.java From actionbarextras with MIT License | 4 votes |
/** * sets the logo */ @Kroll.method @Kroll.setProperty public void setLogo(Object arg) { Message message = getMainHandler().obtainMessage(MSG_LOGO, arg); message.sendToTarget(); }
Example 14
Source File: CaffeinaGCMModule.java From gcm with MIT License | 4 votes |
@Kroll.method public int getAppBadge() { return 0; }
Example 15
Source File: ActionbarextrasModule.java From actionbarextras with MIT License | 4 votes |
/** * set up icon color * @param color */ @Kroll.method @Kroll.setProperty public void setUpColor(String color){ Message message = getMainHandler().obtainMessage(MSG_UPICON_COLOR, color); message.sendToTarget(); }
Example 16
Source File: ActionbarextrasModule.java From actionbarextras with MIT License | 4 votes |
/** * sets the logo */ @Kroll.method @Kroll.setProperty public void setMenuItemIcon(Object arg) { Message message = getMainHandler().obtainMessage(MSG_MENU_ICON, arg); message.sendToTarget(); }
Example 17
Source File: CaffeinaGCMModule.java From gcm with MIT License | 4 votes |
@Kroll.method public void setAppBadge(int count) { BadgeUtils.setBadge(TiApplication.getInstance().getApplicationContext(), count); }
Example 18
Source File: TicroutonModule.java From TiCrouton with MIT License | 4 votes |
@Kroll.method public void info(String text) { showText(text, STYLE_INFO); }
Example 19
Source File: DrawerProxy.java From Ti.DrawerLayout with MIT License | 4 votes |
@Kroll.method @Kroll.setProperty public void setLeftDrawerWidth(Object arg) { setPropertyAndFire(Drawer.PROPERTY_LEFT_VIEW_WIDTH, arg); }
Example 20
Source File: Crouton.java From TiCrouton with MIT License | 2 votes |
/** * Removes this {@link Crouton}. * * @since 1.9 */ @Kroll.method public void hide() { Manager.getInstance().removeCrouton(this); }