List of usage examples for android.util Log ERROR
int ERROR
To view the source code for android.util Log ERROR.
Click Source Link
From source file:com.android.screenspeak.formatter.EventSpeechRule.java
/** * Creates a new instance given a <code>className</code>. * * @param className the class name./*from ww w .j a v a 2 s . c o m*/ * @return New instance if succeeded, null otherwise. */ @SuppressWarnings("unchecked") private <T> T createNewInstance(String className) { try { final Class<T> clazz = (Class<T>) mContext.getClassLoader().loadClass(className); return clazz.newInstance(); } catch (Exception e) { e.printStackTrace(); LogUtils.log(EventSpeechRule.class, Log.ERROR, "Rule: #%d. Could not load class: '%s'.", mRuleIndex, className); } return null; }
From source file:com.radicaldynamic.groupinform.services.DatabaseService.java
private void removePlaceholders(HashMap<String, JSONObject> placeholders) { final String tt = t + "removePlaceholders(): "; for (Map.Entry<String, JSONObject> entry : placeholders.entrySet()) { if (entry.getValue().optString("createdBy", null) == null || entry.getValue().optString("dateCreated", null) == null) { // Remove old style (unowned) placeholders immediately try { getDb().delete(entry.getKey(), entry.getValue().optString("_rev")); if (Collect.Log.VERBOSE) Log.v(Collect.LOGTAG, tt + "removed old-style placeholder " + entry.getKey()); } catch (Exception e) { if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, tt + "unable to remove old-style placeholder"); e.printStackTrace();//w w w .j av a 2s. com } } else if (entry.getValue().optString("createdBy") .equals(Collect.getInstance().getInformOnlineState().getDeviceId())) { // Remove placeholders owned by me immediately try { getDb().delete(entry.getKey(), entry.getValue().optString("_rev")); if (Collect.Log.VERBOSE) Log.v(Collect.LOGTAG, tt + "removed my placeholder " + entry.getKey()); } catch (Exception e) { if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, tt + "unable to remove my placeholder"); e.printStackTrace(); } } else { // Remove placeholders owned by other people if they are stale (older than a day) SimpleDateFormat sdf = new SimpleDateFormat(Generic.DATETIME); Calendar calendar = Calendar.getInstance(); try { calendar.setTime(sdf.parse(entry.getValue().optString("dateCreated"))); if (calendar.getTimeInMillis() - Calendar.getInstance().getTimeInMillis() > TIME_24_HOURS) { try { getDb().delete(entry.getKey(), entry.getValue().optString("_rev")); if (Collect.Log.VERBOSE) Log.v(Collect.LOGTAG, tt + "removed stale placeholder " + entry.getKey()); } catch (Exception e) { if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, tt + "unable to remove stale placeholder"); e.printStackTrace(); } } } catch (ParseException e1) { if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, tt + "unable to parse dateCreated: " + e1.toString()); e1.printStackTrace(); } } } }
From source file:com.google.android.marvin.mytalkback.formatter.EventSpeechRule.java
/** * Creates a new instance given a <code>className</code> and the <code>expectedClass</code> that * instance must belong to.//from w w w .j a v a 2s . c om * * @param className the class name. * @return New instance if succeeded, null otherwise. */ @SuppressWarnings("unchecked") private <T> T createNewInstance(String className, Class<T> expectedClass) { try { final Class<T> clazz = (Class<T>) mContext.getClassLoader().loadClass(className); return clazz.newInstance(); } catch (Exception e) { e.printStackTrace(); LogUtils.log(EventSpeechRule.class, Log.ERROR, "Rule: #%d. Could not load class: '%s'.", mRuleIndex, className); } return null; }
From source file:com.irccloud.android.activity.UploadsActivity.java
public void onIRCEvent(int what, Object o) { IRCCloudJSONObject obj;// w ww .j a v a 2 s. c o m final File f; switch (what) { case NetworkConnection.EVENT_SUCCESS: obj = (IRCCloudJSONObject) o; f = delete_reqids.get(obj.getInt("_reqid")); if (f != null) { Log.d("IRCCloud", "File deleted successfully"); delete_reqids.remove(obj.getInt("_reqid")); runOnUiThread(new Runnable() { @Override public void run() { adapter.removeFile(f); View.OnClickListener undo = new View.OnClickListener() { @Override public void onClick(View view) { NetworkConnection.getInstance().restoreFile(f.id); adapter.restoreFile(f); } }; if (f.name != null && f.name.length() > 0) Snackbar.make(findViewById(android.R.id.list), f.name + " was deleted.", Snackbar.LENGTH_LONG).setAction("UNDO", undo).show(); else Snackbar.make(findViewById(android.R.id.list), "File was deleted.", Snackbar.LENGTH_LONG).setAction("UNDO", undo).show(); } }); } break; case NetworkConnection.EVENT_FAILURE_MSG: obj = (IRCCloudJSONObject) o; f = delete_reqids.get(obj.getInt("_reqid")); if (f != null) { delete_reqids.remove(obj.getInt("_reqid")); Crashlytics.log(Log.ERROR, "IRCCloud", "Delete failed: " + obj.toString()); runOnUiThread(new Runnable() { @Override public void run() { AlertDialog.Builder builder = new AlertDialog.Builder(UploadsActivity.this); builder.setTitle("Error"); if (f.name != null && f.name.length() > 0) builder.setMessage("Unable to delete '" + f.name + "'. Please try again shortly."); else builder.setMessage("Unable to delete file. Please try again shortly."); builder.setPositiveButton("Close", null); builder.show(); f.deleting = false; adapter.notifyDataSetChanged(); } }); } break; default: break; } }
From source file:com.android.screenspeak.formatter.EventSpeechRule.java
/** * Returns a resource identifier from the given <code>context</code> for the text * content of a <code>node</code>. * <p>/*from ww w . ja va 2 s.com*/ * Note: The resource identifier format is: @<package * name>:<type>/<resource name> * </p> * * @param context The parent context. * @param resName A valid resource name. * @return A resource identifier, or {@code -1} if the resource name is * invalid. */ private static int getResourceIdentifierContent(Context context, String resName) { if (resName == null) { return -1; } final Matcher matcher = mResourceIdentifier.matcher(resName); if (!matcher.matches()) { return -1; } final Resources res = context.getResources(); final String defaultPackage = (matcher.groupCount() < 2) ? context.getPackageName() : null; final int resId = res.getIdentifier(resName.substring(1), null, defaultPackage); if (resId == 0) { LogUtils.log(EventSpeechRule.class, Log.ERROR, "Failed to load resource: %s", resName); } return resId; }
From source file:com.android.screenspeak.contextmenu.RadialMenuView.java
private boolean getClosestTouchedWedge(float dX, float dY, float touchDistSq, TouchedMenuItem result) { if (touchDistSq <= mInnerRadiusSq) { // The user is touching the center dot. return false; }//w w w . j av a2s . c om final RadialMenu menu = (mSubMenu != null) ? mSubMenu : mRootMenu; int menuSize = menu.size(); if (menuSize == 0) return false; final float offset = (mSubMenu != null) ? mSubMenuOffset : mRootMenuOffset; // Which wedge is the user touching? final double angle = Math.atan2(dX, dY); final double wedgeArc = (360.0 / menuSize); final double offsetArc = (wedgeArc / 2.0) - offset; double touchArc = (((180.0 - Math.toDegrees(angle)) + offsetArc) % 360); if (touchArc < 0) { touchArc += 360; } final int wedgeNum = (int) (touchArc / wedgeArc); if ((wedgeNum < 0) || (wedgeNum >= menuSize)) { LogUtils.log(this, Log.ERROR, "Invalid wedge index: %d", wedgeNum); return false; } result.item = menu.getItem(wedgeNum); result.isDirectTouch = (touchDistSq < mExtremeRadiusSq); return true; }
From source file:com.googlecode.eyesfree.widget.RadialMenuView.java
private boolean getClosestTouchedWedge(float dX, float dY, float touchDistSq, TouchedMenuItem result) { if (touchDistSq <= mInnerRadiusSq) { // The user is touching the center dot. return false; }/*from ww w . j a v a 2 s .co m*/ final RadialMenu menu = (mSubMenu != null) ? mSubMenu : mRootMenu; final float offset = (mSubMenu != null) ? mSubMenuOffset : mRootMenuOffset; // Which wedge is the user touching? final double angle = Math.atan2(dX, dY); final double wedgeArc = (360.0 / menu.size()); final double offsetArc = (wedgeArc / 2.0) - offset; double touchArc = (((180.0 - Math.toDegrees(angle)) + offsetArc) % 360); if (touchArc < 0) { touchArc += 360; } final int wedgeNum = (int) (touchArc / wedgeArc); if ((wedgeNum < 0) || (wedgeNum > menu.size())) { LogUtils.log(this, Log.ERROR, "Invalid wedge index: %d", wedgeNum); return false; } result.item = menu.getItem(wedgeNum); result.isDirectTouch = (touchDistSq < mExtremeRadiusSq); return true; }
From source file:com.android.screenspeak.controller.CursorControllerApp.java
private boolean navigateWrapAround(AccessibilityNodeInfoCompat root, int direction, TraversalStrategy traversalStrategy) { if (root == null) { return false; }/* w w w .j a va2 s . co m*/ AccessibilityNodeInfoCompat tempNode = null; AccessibilityNodeInfoCompat wrapNode = null; try { switch (direction) { case OrderedTraversalStrategy.SEARCH_FOCUS_FORWARD: tempNode = traversalStrategy.focusFirst(root); wrapNode = navigateSelfOrFrom(tempNode, direction, traversalStrategy); break; case OrderedTraversalStrategy.SEARCH_FOCUS_BACKWARD: tempNode = traversalStrategy.focusLast(root); wrapNode = navigateSelfOrFrom(tempNode, direction, traversalStrategy); break; } if (wrapNode == null) { if (LogUtils.LOG_LEVEL <= Log.ERROR) { Log.e(LOGTAG, "Failed to wrap navigation"); } return false; } return setCursor(wrapNode); } finally { AccessibilityNodeInfoUtils.recycleNodes(tempNode, wrapNode); } }
From source file:com.example.emachine.FXcalcActivity.java
private void EspressoMachine_CrashlyticsFAB() { if (getPrefBugIssue(getBaseContext())) Crashlytics.log(Log.ERROR, TAG, "onResume ..."); FloatingActionButton btn_BugFAB = new FloatingActionButton.Builder(this) .withDrawable(getResources().getDrawable(R.drawable.bug)).withButtonColor(Color.RED) .withGravity(Gravity.BOTTOM | Gravity.RIGHT).withMargins(0, 0, 16, 16).create(); btn_BugFAB.setOnClickListener(new View.OnClickListener() { @Override//from w ww . j a v a 2s. c o m public void onClick(View v) { EspressoMachine_MakeItCrashException(); } }); if (getPrefBugIssue(getBaseContext())) { btn_BugFAB.setVisibility(View.VISIBLE); } else { btn_BugFAB.setVisibility(View.INVISIBLE); } }
From source file:com.example.emachine.FXcalcActivity.java
private void ProgrammaticFAB() { if (getPrefBugIssue(getBaseContext())) Crashlytics.log(Log.ERROR, TAG, "ProgrammaticFAB ..."); FloatingActionButton btn_pFAB = new FloatingActionButton.Builder(this) .withDrawable(getResources().getDrawable(R.drawable.idea)).withButtonColor(Color.BLUE) .withGravity(Gravity.BOTTOM | Gravity.LEFT).withMargins(0, 0, 16, 16).create(); btn_pFAB.setOnClickListener(new View.OnClickListener() { @Override//from ww w . j a v a 2 s . c o m public void onClick(View v) { Snackbar.make(v, "Programmatic FAB selected.", Snackbar.LENGTH_LONG).setAction("Action", null) .show(); } }); }