List of usage examples for android.util Log WARN
int WARN
To view the source code for android.util Log WARN.
Click Source Link
From source file:com.ofalvai.bpinfo.api.bkkfutar.FutarApiClient.java
@NonNull private RouteType parseRouteType(@NonNull String type) { try {/*from w ww . j av a2s. co m*/ return RouteType.valueOf(type); } catch (IllegalArgumentException ex) { Crashlytics.log(Log.WARN, TAG, "Route parse: failed to parse route type to enum: " + type); } return RouteType._OTHER_; }
From source file:com.radicaldynamic.groupinform.activities.LauncherActivity.java
@Override protected void onDestroy() { super.onDestroy(); final String tt = t + "onDestroy(): "; // Unbind from our services if (Collect.getInstance().getCouchService() instanceof ServiceConnection) { try {//from ww w .ja va 2 s . c om if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, tt + "unbinding from CouchService"); unbindService(Collect.getInstance().getCouchService()); } catch (IllegalArgumentException e) { if (Collect.Log.WARN) Log.w(Collect.LOGTAG, tt + "CouchService not registered: " + e.toString()); } } if (Collect.getInstance().getDbService() instanceof DatabaseService) { try { if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, tt + "unbinding from DatabaseService"); unbindService(mDatabaseConnection); } catch (IllegalArgumentException e) { if (Collect.Log.WARN) Log.w(Collect.LOGTAG, tt + "DatabaseService not registered: " + e.toString()); } } if (Collect.getInstance().getIoService() instanceof InformOnlineService) { try { if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, tt + "unbinding from InformOnlineService"); unbindService(mOnlineConnection); } catch (IllegalArgumentException e) { if (Collect.Log.WARN) Log.w(Collect.LOGTAG, tt + "InformOnlineService not registered: " + e.toString()); } } // User has reset GC Mobile (see http://stackoverflow.com/questions/2042222/close-application) if (mExitApplication) { exitApplication(); } }
From source file:com.googlecode.eyesfree.brailleback.SearchNavigationMode.java
/** * Formats some braille content from an {@link AccessibilityEvent}. *//*from w ww . j a va2 s . co m*/ private DisplayManager.Content formatEventToBraille(AccessibilityEvent event) { AccessibilityNodeInfoCompat eventNode = getNodeFromEvent(event); if (eventNode != null) { DisplayManager.Content content = formatNodeToBraille(eventNode); if (content != null) { return content.setPanStrategy(DisplayManager.Content.PAN_CURSOR); } } // This should never happen, print out an error if it does. LogUtils.log(this, Log.WARN, "No node on event!"); return null; }
From source file:org.thoughtland.xlocation.UpdateService.java
private static void notifyProgress(Context context, int id, String format, int percentage) { String message = String.format(format, String.format("%d %%", percentage)); Util.log(null, Log.WARN, message); NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); NotificationCompat.Builder builder = new NotificationCompat.Builder(context); builder.setSmallIcon(R.drawable.ic_launcher); builder.setContentTitle(context.getString(R.string.app_name)); builder.setContentText(message);/*from ww w . ja v a 2s.c om*/ builder.setWhen(System.currentTimeMillis()); builder.setAutoCancel(percentage == 100); builder.setOngoing(percentage < 100); Notification notification = builder.build(); notificationManager.notify(id, notification); }
From source file:com.radicaldynamic.groupinform.activities.AccountFolderList.java
public static ArrayList<AccountFolder> loadFolderList() { if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, t + "loading folder cache"); ArrayList<AccountFolder> folders = new ArrayList<AccountFolder>(); if (!new File(Collect.getInstance().getCacheDir(), FileUtilsExtended.FOLDER_CACHE_FILE).exists()) { if (Collect.Log.WARN) Log.w(Collect.LOGTAG, t + "folder cache file cannot be read: aborting loadFolderList()"); return folders; }//from w w w.ja v a 2 s .c o m try { FileInputStream fis = new FileInputStream( new File(Collect.getInstance().getCacheDir(), FileUtilsExtended.FOLDER_CACHE_FILE)); InputStreamReader reader = new InputStreamReader(fis); BufferedReader buffer = new BufferedReader(reader, 8192); StringBuilder sb = new StringBuilder(); String cur; while ((cur = buffer.readLine()) != null) { sb.append(cur + "\n"); } buffer.close(); reader.close(); fis.close(); try { JSONArray jsonFolders = (JSONArray) new JSONTokener(sb.toString()).nextValue(); for (int i = 0; i < jsonFolders.length(); i++) { JSONObject jsonFolder = jsonFolders.getJSONObject(i); AccountFolder folder = new AccountFolder(jsonFolder.getString("id"), jsonFolder.getString("rev"), jsonFolder.getString("owner"), jsonFolder.getString("name"), jsonFolder.getString("description"), jsonFolder.getString("visibility"), jsonFolder.getBoolean("replication")); folders.add(folder); // Also update the account folder hash since this will be needed by BrowserActivity, among other things Collect.getInstance().getInformOnlineState().getAccountFolders().put(folder.getId(), folder); } } catch (JSONException e) { // Parse error (malformed result) if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, t + "failed to parse JSON " + sb.toString()); e.printStackTrace(); } } catch (Exception e) { if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, t + "unable to read folder cache: " + e.toString()); e.printStackTrace(); } return folders; }
From source file:com.radicaldynamic.groupinform.services.DatabaseService.java
synchronized private void connectToLocalServer() throws DbUnavailableException { final String tt = t + "connectToLocalServer(): "; if (mLocalHost == null || mLocalPort == 0) { if (Collect.Log.WARN) Log.w(Collect.LOGTAG, tt + "local host information not available; aborting connection"); mConnectedToLocal = false;//from ww w . j a v a 2 s .co m return; } if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, tt + "establishing connection to " + mLocalHost + ":" + mLocalPort); try { /* * Socket timeout of 5 minutes is important, otherwise long-running replications * will fail. It is possible that we will need to extend this in the future if * it turns out to be insufficient. */ mLocalHttpClient = new StdHttpClient.Builder().host(mLocalHost).port(mLocalPort) .socketTimeout(TIME_FIVE_MINUTES * 1000).build(); mLocalDbInstance = new StdCouchDbInstance(mLocalHttpClient); mLocalDbInstance.getAllDatabases(); if (mConnectedToLocal == false) mConnectedToLocal = true; if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, tt + "connection to " + mLocalHost + " successful"); } catch (Exception e) { if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, tt + e.toString()); e.printStackTrace(); mConnectedToLocal = false; throw new DbUnavailableException(); } }
From source file:com.radicaldynamic.groupinform.services.InformOnlineService.java
private void restoreSession() { // Restore any serialized session information File sessionCache = new File(getCacheDir(), FileUtilsExtended.SESSION_CACHE_FILE); if (sessionCache.exists()) { if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, t + "restoring cached session"); try {//from ww w . ja v a 2 s. co m InformOnlineSession session = new InformOnlineSession(); FileInputStream fis = new FileInputStream(sessionCache); ObjectInputStream ois = new ObjectInputStream(fis); session = (InformOnlineSession) ois.readObject(); ois.close(); fis.close(); Collect.getInstance().getInformOnlineState().setSession(new BasicCookieStore()); Iterator<InformOnlineSession> cookies = session.getCookies().iterator(); if (cookies.hasNext()) { InformOnlineSession ios = cookies.next(); BasicClientCookie bcc = new BasicClientCookie(ios.getName(), ios.getValue()); bcc.setDomain(ios.getDomain()); bcc.setExpiryDate(ios.getExpiryDate()); bcc.setPath(ios.getPath()); bcc.setVersion(ios.getVersion()); Collect.getInstance().getInformOnlineState().getSession().addCookie(bcc); } } catch (Exception e) { if (Collect.Log.WARN) Log.w(Collect.LOGTAG, t + "problem restoring cached session " + e.toString()); e.printStackTrace(); // Don't leave a broken file hanging new File(getCacheDir(), FileUtilsExtended.SESSION_CACHE_FILE).delete(); // Clear the session Collect.getInstance().getInformOnlineState().setSession(null); } } else { if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, t + "no session to restore"); } }
From source file:com.android.screenspeak.formatter.EventSpeechRule.java
/** * Parses a property according to its expected type. Parsing failures are * logged and null is returned.//from w w w . j a va 2 s .c o m * * @param name The property name. * @param value The property value. * @return The parsed value or null if parse error occurs. */ private static Comparable<?> parsePropertyValue(String name, String value) { if (PROPERTY_EVENT_TYPE.equals(name)) { return sEventTypeNameToValueMap.get(value); } final int propertyType = getPropertyType(name); switch (propertyType) { case PROPERTY_TYPE_BOOLEAN: return Boolean.valueOf(value); case PROPERTY_TYPE_FLOAT: try { return Float.valueOf(value); } catch (NumberFormatException nfe) { LogUtils.log(EventSpeechRule.class, Log.WARN, "Property '%s' not float.", name); return null; } case PROPERTY_TYPE_INTEGER: try { return Integer.valueOf(value); } catch (NumberFormatException nfe) { LogUtils.log(EventSpeechRule.class, Log.WARN, "Property '%s' not int.", name); return null; } case PROPERTY_TYPE_STRING: return value; default: throw new IllegalArgumentException("Unknown property: " + name); } }
From source file:com.googlecode.eyesfree.brailleback.BrailleIME.java
private boolean handleBrailleKeyInternal(int dots) { // TODO: Support more than computer braille. This means that // there's not a 1:1 correspondence between a cell and a character, // so requires more book-keeping. BrailleTranslator translator = getCurrentBrailleTranslator(); InputConnection ic = getCurrentInputConnection(); if (translator == null || ic == null) { LogUtils.log(this, Log.WARN, "missing translator %s or IC %s", translator, ic); return false; }//from w w w .j a v a2 s. c o m CharSequence text = translator.backTranslate(new byte[] { (byte) dots }); if (!TextUtils.isEmpty(text)) { return ic.commitText(text, 1); } return true; }
From source file:biz.bokhorst.xprivacy.ActivityMain.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent dataIntent) { super.onActivityResult(requestCode, resultCode, dataIntent); if (requestCode == ACTIVITY_LICENSE) { // License check if (dataIntent != null) { int code = dataIntent.getIntExtra("Code", -1); int reason = dataIntent.getIntExtra("Reason", -1); String sReason;/* www .j a v a 2 s. com*/ if (reason == LICENSED) sReason = "LICENSED"; else if (reason == NOT_LICENSED) sReason = "NOT_LICENSED"; else if (reason == RETRY) sReason = "RETRY"; else if (reason == ERROR_CONTACTING_SERVER) sReason = "ERROR_CONTACTING_SERVER"; else if (reason == ERROR_INVALID_PACKAGE_NAME) sReason = "ERROR_INVALID_PACKAGE_NAME"; else if (reason == ERROR_NON_MATCHING_UID) sReason = "ERROR_NON_MATCHING_UID"; else sReason = Integer.toString(reason); Util.log(null, Log.WARN, "Licensing: code=" + code + " reason=" + sReason); if (code > 0) { Util.setPro(true); invalidateOptionsMenu(); Toast.makeText(this, getString(R.string.menu_pro), Toast.LENGTH_LONG).show(); } else if (reason == RETRY) { Util.setPro(false); mProHandler.postDelayed(new Runnable() { @Override public void run() { checkLicense(); } }, 30 * 1000); } } } }