Java Code Examples for org.appcelerator.kroll.common.Log#e()
The following examples show how to use
org.appcelerator.kroll.common.Log#e() .
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: CollectionViewProxy.java From TiCollectionView with MIT License | 6 votes |
@Kroll.setProperty @Kroll.method public void setSections(Object sections) { if (!(sections instanceof Object[])) { Log.e(TAG, "Invalid argument type to setSection(), needs to be an array", Log.DEBUG_MODE); return; } //Update java and javascript property setProperty(TiC.PROPERTY_SECTIONS, sections); Object[] sectionsArray = (Object[]) sections; TiUIView listView = peekView(); //Preload sections if listView is not opened. if (listView == null) { preload = true; clearPreloadSections(); addPreloadSections(sectionsArray, -1, true); } else { if (TiApplication.isUIThread()) { ((CollectionView)listView).processSectionsAndNotify(sectionsArray); } else { TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_SECTIONS), sectionsArray); } } }
Example 2
Source File: CollectionViewTemplate.java From TiCollectionView with MIT License | 6 votes |
private void processChildProperties(Object childProperties, DataItem parent) { if (childProperties instanceof Object[]) { Object[] propertiesArray = (Object[])childProperties; for (int i = 0; i < propertiesArray.length; i++) { HashMap<String, Object> properties = (HashMap<String, Object>) propertiesArray[i]; //bind proxies and default properties DataItem item = bindProxiesAndProperties(new KrollDict(properties), false, parent); //Recursively calls for all childTemplates if (properties.containsKey(TiC.PROPERTY_CHILD_TEMPLATES)) { if(item == null) { Log.e(TAG, "Unable to generate valid data from child view", Log.DEBUG_MODE); } processChildProperties(properties.get(TiC.PROPERTY_CHILD_TEMPLATES), item); } } } }
Example 3
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 6 votes |
private void handleAppendItems(Object data) { if (data instanceof Object[]) { Object[] views = (Object[]) data; if (itemProperties == null) { itemProperties = new ArrayList<Object>(Arrays.asList(views)); } else { for (Object view: views) { itemProperties.add(view); } } //only process items when listview's properties is processed. if (getListView() == null) { preload = true; return; } //we must update the itemCount before notify data change. If we don't, it will crash int count = itemCount; itemCount += views.length; processData(views, count); } else { Log.e(TAG, "Invalid argument type to setData", Log.DEBUG_MODE); } }
Example 4
Source File: GCMIntentService.java From gcmpush with Apache License 2.0 | 6 votes |
private int getResource(String type, String name) { int icon = 0; if (name != null) { /* Remove extension from icon */ int index = name.lastIndexOf("."); if (index > 0) { name = name.substring(0, index); } try { icon = TiRHelper.getApplicationResource(type + "." + name); } catch (TiRHelper.ResourceNotFoundException ex) { Log.e(LCAT, type + "." + name + " not found; make sure it's in platform/android/res/" + type); } } return icon; }
Example 5
Source File: ActionbarextrasModule.java From actionbarextras with MIT License | 6 votes |
/** * Sets Up icon color * @param obj */ private void handleSetUpColor(String color){ ActionBar actionBar = getActionBar(); try { TiApplication appContext = TiApplication.getInstance(); AppCompatActivity _activity = (AppCompatActivity) appContext.getCurrentActivity(); final int res_id = TiRHelper.getResource("drawable.abc_ic_ab_back_material", true); final Drawable upArrow = ContextCompat.getDrawable(_activity, res_id); upArrow.setColorFilter(TiConvert.toColor(color), PorterDuff.Mode.SRC_ATOP); actionBar.setHomeAsUpIndicator(upArrow); }catch(Exception e){ Log.e(TAG, e.toString()); } }
Example 6
Source File: CollectionView.java From TiCollectionView with MIT License | 6 votes |
private int findItemPosition(int sectionIndex, int sectionItemIndex) { int position = 0; for (int i = 0; i < sections.size(); i++) { CollectionSectionProxy section = sections.get(i); if (i == sectionIndex) { if (sectionItemIndex >= section.getContentCount()) { Log.e(TAG, "Invalid item index"); return -1; } position += sectionItemIndex; break; } else { position += section.getItemCount(); } } return position; }
Example 7
Source File: GCMModule.java From gcmpush with Apache License 2.0 | 5 votes |
@Kroll.method public void unregister() { Log.d(LCAT, "unregister called (" + (instance != null) + ")"); try { GCMRegistrar.unregister(TiApplication.getInstance()); } catch (Exception ex) { Log.e(LCAT, "Cannot unregister from push: " + ex.getMessage()); } }
Example 8
Source File: DefaultCollectionViewTemplate.java From TiCollectionView with MIT License | 5 votes |
public void updateOrMergeWithDefaultProperties(KrollDict data, boolean update) { if (!data.containsKey(TiC.PROPERTY_PROPERTIES)) { Log.e(TAG, "Please use 'properties' binding for builtInTemplate"); if (!update) { //apply default behavior data.clear(); } return; } parseDefaultData(data); super.updateOrMergeWithDefaultProperties(data, update); }
Example 9
Source File: GCMModule.java From gcmpush with Apache License 2.0 | 5 votes |
public void sendTopicMessage(HashMap<String, Object> messageData) { if (topicCallback != null) { HashMap<String, Object> data = new HashMap<String, Object>(); data.put("data", messageData); data.put("inBackground", !isInForeground()); topicCallback.call(getKrollObject(), data); } else { Log.e(LCAT, "No callback specified for topic subscribe"); } }
Example 10
Source File: GCMModule.java From gcmpush with Apache License 2.0 | 5 votes |
public void sendMessage(HashMap<String, Object> messageData) { if (messageCallback != null) { HashMap<String, Object> data = new HashMap<String, Object>(); data.put("data", messageData); data.put("inBackground", !isInForeground()); messageCallback.call(getKrollObject(), data); } else { Log.e(LCAT, "No callback specified for push notification"); } }
Example 11
Source File: GCMModule.java From gcmpush with Apache License 2.0 | 5 votes |
/** * Cancel a notification by the id given in the payload. * @param notificationId */ @Kroll.method public void cancelNotificationById(int notificationId) { try { NotificationManager notificationManager = (NotificationManager) TiApplication.getInstance().getApplicationContext().getSystemService(TiApplication.NOTIFICATION_SERVICE); notificationManager.cancel(notificationId); Log.i(LCAT, "Notification " + notificationId + " cleared successfully"); } catch (Exception ex) { Log.e(LCAT, "Cannot cancel notification:" + notificationId + " Error: " + ex.getMessage()); } }
Example 12
Source File: GCMIntentService.java From gcmpush with Apache License 2.0 | 5 votes |
@Override public boolean onRecoverableError(Context context, String errorId) { Log.e(LCAT, "RecoverableError: " + errorId); if (GCMModule.getInstance() != null) { GCMModule.getInstance().sendError(errorId); } return true; }
Example 13
Source File: GCMIntentService.java From gcmpush with Apache License 2.0 | 5 votes |
@Override public void onError(Context context, String errorId) { Log.e(LCAT, "Error: " + errorId); if (GCMModule.getInstance() != null) { GCMModule.getInstance().sendError(errorId); } }
Example 14
Source File: ViewProxy.java From TiTouchImageView with MIT License | 5 votes |
private Bitmap loadImageFromApplication(String imageName) { Bitmap result = null; try { // Load the image from the application assets String url = getPathToApplicationAsset(imageName); TiBaseFile file = TiFileFactory.createTitaniumFile(new String[] { url }, false); result = TiUIHelper.createBitmap(file.getInputStream()); } catch (IOException e) { Log.e(LCAT, " TiTouchImageView only supports local image files"); } return result; }
Example 15
Source File: GCMIntentService.java From gcm with MIT License | 5 votes |
@Override public void onError(Context context, String errorId) { Log.e(LCAT, "Error: " + errorId); if (CaffeinaGCMModule.getInstance() != null) { CaffeinaGCMModule.getInstance().sendError(errorId); } }
Example 16
Source File: GCMIntentService.java From gcm with MIT License | 5 votes |
private int getResource(String type, String name) { int icon = 0; if (name != null) { int index = name.lastIndexOf("."); if (index > 0) name = name.substring(0, index); try { icon = TiRHelper.getApplicationResource(type + "." + name); } catch (TiRHelper.ResourceNotFoundException ex) { Log.e(LCAT, type + "." + name + " not found; make sure it's in platform/android/res/" + type); } } return icon; }
Example 17
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 18
Source File: CollectionViewProxy.java From TiCollectionView with MIT License | 5 votes |
private void handleDeleteSectionAt(int index) { TiUIView listView = peekView(); if (listView != null) { ((CollectionView) listView).deleteSectionAt(index); } else { if (index < 0 || index >= preloadSections.size()) { Log.e(TAG, "Invalid index to delete section"); return; } preload = true; preloadSections.remove(index); } }
Example 19
Source File: CollectionView.java From TiCollectionView with MIT License | 4 votes |
public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy) { if (key.equals(TiC.PROPERTY_HEADER_TITLE)) { setHeaderTitle(TiConvert.toString(newValue)); } else if (key.equals(TiC.PROPERTY_FOOTER_TITLE)) { setFooterTitle(TiConvert.toString(newValue)); } else if (key.equals(TiC.PROPERTY_SECTIONS) && newValue instanceof Object[] ) { processSectionsAndNotify((Object[])newValue); } else if (key.equals(TiC.PROPERTY_SEARCH_TEXT)) { this.searchText = TiConvert.toString(newValue); if (this.searchText != null) { reFilter(this.searchText); } } else if (key.equals(TiC.PROPERTY_CASE_INSENSITIVE_SEARCH)) { this.caseInsensitive = TiConvert.toBoolean(newValue, true); if (this.searchText != null) { reFilter(this.searchText); } } else if (key.equals(TiC.PROPERTY_SEARCH_VIEW)) { TiViewProxy searchView = (TiViewProxy) newValue; if (isSearchViewValid(searchView)) { TiUIView search = searchView.getOrCreateView(); setSearchListener(searchView, search); if (searchLayout != null) { searchLayout.removeAllViews(); addSearchLayout(searchLayout, searchView, search); } else { layoutSearchView(searchView); } } else { Log.e(TAG, "Searchview type is invalid"); } } else if (key.equals(TiC.PROPERTY_SHOW_VERTICAL_SCROLL_INDICATOR) && newValue != null) { listView.setVerticalScrollBarEnabled(TiConvert.toBoolean(newValue)); } else if (key.equals(TiC.PROPERTY_DEFAULT_ITEM_TEMPLATE) && newValue != null) { defaultTemplateBinding = TiConvert.toString(newValue); refreshItems(); } else if (key.equals(TiC.PROPERTY_SEPARATOR_COLOR)) { String color = TiConvert.toString(newValue); setSeparatorColor(color); } else { super.propertyChanged(key, oldValue, newValue, proxy); } }
Example 20
Source File: ImagepickerModule.java From titanium-imagepicker with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") @Kroll.method public void createCustomGallery(KrollDict options) { if ( (options != null) && options.containsKeyAndNotNull(Defaults.Params.IMAGES) ) { Object[] imageArray = (Object []) options.get(Defaults.Params.IMAGES); int size = imageArray.length; if (size != 0) { ArrayList<ImageViewerInfo> imagesInfo = new ArrayList<ImageViewerInfo>(); for (int i=0; i<size; i++) { Object o = imageArray[i]; KrollDict info = new KrollDict((HashMap<String, Object>) o); if ( (info != null) && info.containsKeyAndNotNull(Defaults.Params.IMAGE_PATH) ) { String path = info.getString(Defaults.Params.IMAGE_PATH); String title = info.containsKeyAndNotNull(Defaults.Params.IMAGE_TITLE) ? info.getString(Defaults.Params.IMAGE_TITLE) : ""; String titleColor = info.containsKeyAndNotNull(Defaults.Params.IMAGE_TITLE_COLOR) ? info.getString(Defaults.Params.IMAGE_TITLE_COLOR) : Defaults.IMAGE_TITLE_COLOR; String titleBgColor = info.containsKeyAndNotNull(Defaults.Params.IMAGE_TITLE_BACKGROUND_COLOR) ? info.getString(Defaults.Params.IMAGE_TITLE_BACKGROUND_COLOR) : Defaults.IMAGE_TITLE_BACKGROUND_COLOR; imagesInfo.add(new ImageViewerInfo(path, title, titleColor, titleBgColor)); } } if (imagesInfo.size() > 0) { Activity activity = TiApplication.getAppCurrentActivity(); Intent intent = new Intent(activity, ImageViewerActivity.class); intent = prepareExtrasForIntent(intent, options, false); intent.putParcelableArrayListExtra(Defaults.Params.IMAGES, imagesInfo); activity.startActivity(intent); } } else { Log.e(Defaults.LCAT, "No images passed."); } } else { Log.e(Defaults.LCAT, "No options passed."); } }