Example usage for android.util Log VERBOSE

List of usage examples for android.util Log VERBOSE

Introduction

In this page you can find the example usage for android.util Log VERBOSE.

Prototype

int VERBOSE

To view the source code for android.util Log VERBOSE.

Click Source Link

Document

Priority constant for the println method; use Log.v.

Usage

From source file:com.pindroid.client.NetworkUtilities.java

/**
 * Attempts to authenticate to Pinboard using a legacy Pinboard account.
 * /* w  ww .  j a v  a  2  s  .  c  om*/
 * @param username The user's username.
 * @param password The user's password.
 * @param handler The hander instance from the calling UI thread.
 * @param context The context of the calling Activity.
 * @return The boolean result indicating whether the user was
 *         successfully authenticated.
 */
public static boolean pinboardAuthenticate(String username, String password) {
    final HttpResponse resp;

    Uri.Builder builder = new Uri.Builder();
    builder.scheme(SCHEME);
    builder.authority(PINBOARD_AUTHORITY);
    builder.appendEncodedPath("v1/posts/update");
    Uri uri = builder.build();

    HttpGet request = new HttpGet(String.valueOf(uri));

    DefaultHttpClient client = (DefaultHttpClient) HttpClientFactory.getThreadSafeClient();

    CredentialsProvider provider = client.getCredentialsProvider();
    Credentials credentials = new UsernamePasswordCredentials(username, password);
    provider.setCredentials(SCOPE, credentials);

    try {
        resp = client.execute(request);
        if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log.v(TAG, "Successful authentication");
            }
            return true;
        } else {
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log.v(TAG, "Error authenticating" + resp.getStatusLine());
            }
            return false;
        }
    } catch (final IOException e) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "IOException when getting authtoken", e);
        }
        return false;
    } finally {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "getAuthtoken completing");
        }
    }
}

From source file:com.googlecode.eyesfree.brailleback.FocusFinder.java

public AccessibilityNodeInfoCompat linear(AccessibilityNodeInfoCompat source, int direction) {
    if (source == null) {
        return null;
    }// w w  w . j a  v a 2 s.  c o m
    AccessibilityNodeInfoCompat next = NodeFocusFinder.focusSearch(source, direction);

    HashSet<AccessibilityNodeInfoCompat> seenNodes = mTmpNodeHash;
    seenNodes.clear();

    while ((next != null) && !AccessibilityNodeInfoUtils.shouldFocusNode(mContext, next)) {
        if (seenNodes.contains(next)) {
            LogUtils.log(this, Log.ERROR, "Found duplicate node during traversal: %s", next);
            break;
        }

        LogUtils.log(this, Log.VERBOSE, "Search strategy rejected node: %s", next.getInfo());
        seenNodes.add(next);
        next = NodeFocusFinder.focusSearch(next, direction);
    }

    // Clear the list of seen nodes.
    AccessibilityNodeInfoUtils.recycleNodes(seenNodes);

    if (next == null) {
        LogUtils.log(this, Log.VERBOSE, "Failed to find the next node");
    }
    return next;
}

From source file:com.phonemetra.turbo.lockclock.weather.OpenWeatherMapProvider.java

@Override
public List<LocationResult> getLocations(String input) {
    String url = String.format(URL_LOCATION, Uri.encode(input), getLanguageCode());
    String response = HttpRetriever.retrieve(url);
    if (response == null) {
        return null;
    }//from  ww  w  .  j a v  a  2s  . c o  m

    if (Log.isLoggable(TAG, Log.VERBOSE)) {
        Log.v(TAG, "URL = " + url + " returning a response of " + response);
    }

    try {
        JSONArray jsonResults = new JSONObject(response).getJSONArray("list");
        ArrayList<LocationResult> results = new ArrayList<LocationResult>();
        int count = jsonResults.length();

        for (int i = 0; i < count; i++) {
            JSONObject result = jsonResults.getJSONObject(i);
            LocationResult location = new LocationResult();

            location.id = result.getString("id");
            location.city = result.getString("name");
            location.countryId = result.getJSONObject("sys").getString("country");
            results.add(location);
        }

        return results;
    } catch (JSONException e) {
        Log.w(TAG, "Received malformed location data (input=" + input + ")", e);
    }

    return null;
}

From source file:com.scvngr.levelup.core.util.LogManager.java

/**
 * Log a message./* www . java2 s  .  c  om*/
 *
 * @param msg message to log. This message is expected to be a format string if varargs are
 *            passed in.
 * @param args optional arguments to be formatted into {@code msg}.
 */
public static void v(@NonNull final String msg, @Nullable final Object... args) {
    logMessage(Log.VERBOSE, msg, args, null);
}

From source file:com.goliathonline.android.kegbot.io.RemoteUserHandler.java

/** {@inheritDoc} */
@Override//from  w w  w.j  a  v  a  2  s.  co m
public ArrayList<ContentProviderOperation> parse(JSONObject parser, ContentResolver resolver)
        throws JSONException, IOException {
    final ArrayList<ContentProviderOperation> batch = Lists.newArrayList();

    // Walk document, parsing any incoming entries
    if (!parser.has("result"))
        return batch;
    JSONObject result = parser.getJSONObject("result");
    JSONObject keg = result.getJSONObject("user");

    final String userId = sanitizeId(keg.getString("username"));
    final Uri userUri = Users.buildUserUri(userId);

    // Check for existing details, only update when changed
    final ContentValues values = queryUserDetails(userUri, resolver);
    final long localUpdated = values.getAsLong(SyncColumns.UPDATED);
    final long serverUpdated = 500; //entry.getUpdated();
    if (Log.isLoggable(TAG, Log.VERBOSE)) {
        Log.v(TAG, "found user " + userId);
        Log.v(TAG, "found localUpdated=" + localUpdated + ", server=" + serverUpdated);
    }

    // Clear any existing values for this session, treating the
    // incoming details as authoritative.
    batch.add(ContentProviderOperation.newDelete(userUri).build());

    final ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(Users.CONTENT_URI);

    builder.withValue(SyncColumns.UPDATED, serverUpdated);
    builder.withValue(Users.USER_ID, userId);

    if (keg.has("image")) {
        JSONObject image = keg.getJSONObject("image");
        if (image.has("url"))
            builder.withValue(Users.USER_IMAGE_URL, image.getString("url"));
    }

    // Normal session details ready, write to provider
    batch.add(builder.build());

    return batch;
}

From source file:com.goliathonline.android.kegbot.io.RemoteKegHandler.java

/** {@inheritDoc} */
@Override//ww w.j  a v a 2s.  co m
public ArrayList<ContentProviderOperation> parse(JSONObject parser, ContentResolver resolver)
        throws JSONException, IOException {
    final ArrayList<ContentProviderOperation> batch = Lists.newArrayList();

    // Walk document, parsing any incoming entries
    JSONObject result = parser.getJSONObject("result");
    JSONObject keg = result.getJSONObject("keg");
    JSONObject type = result.getJSONObject("type");
    JSONObject image = type.getJSONObject("image");

    final String kegId = sanitizeId(keg.getString("id"));
    final Uri kegUri = Kegs.buildKegUri(kegId);

    // Check for existing details, only update when changed
    final ContentValues values = queryKegDetails(kegUri, resolver);
    final long localUpdated = values.getAsLong(SyncColumns.UPDATED);
    final long serverUpdated = 500; //entry.getUpdated();
    if (Log.isLoggable(TAG, Log.VERBOSE)) {
        Log.v(TAG, "found keg " + kegId);
        Log.v(TAG, "found localUpdated=" + localUpdated + ", server=" + serverUpdated);
    }

    // Clear any existing values for this session, treating the
    // incoming details as authoritative.
    batch.add(ContentProviderOperation.newDelete(kegUri).build());

    final ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(Kegs.CONTENT_URI);

    builder.withValue(SyncColumns.UPDATED, serverUpdated);
    builder.withValue(Kegs.KEG_ID, kegId);

    // Inherit starred value from previous row
    if (values.containsKey(Kegs.KEG_STARRED)) {
        builder.withValue(Kegs.KEG_STARRED, values.getAsInteger(Kegs.KEG_STARRED));
    }

    if (keg.has("status"))
        builder.withValue(Kegs.STATUS, keg.getString("status"));

    if (keg.has("volume_ml_remain"))
        builder.withValue(Kegs.VOLUME_REMAIN, keg.getDouble("volume_ml_remain"));

    if (keg.has("description"))
        builder.withValue(Kegs.DESCRIPTION, keg.getString("description"));

    if (keg.has("type_id"))
        builder.withValue(Kegs.TYPE_ID, keg.getString("type_id"));

    if (keg.has("size_id"))
        builder.withValue(Kegs.SIZE_ID, keg.getInt("size_id"));

    if (keg.has("percent_full"))
        builder.withValue(Kegs.PERCENT_FULL, keg.getDouble("percent_full"));

    if (keg.has("size_name"))
        builder.withValue(Kegs.SIZE_NAME, keg.getString("size_name"));

    if (keg.has("spilled_ml"))
        builder.withValue(Kegs.VOLUME_SPILL, keg.getDouble("spilled_ml"));

    if (keg.has("size_volume_ml"))
        builder.withValue(Kegs.VOLUME_SIZE, keg.getDouble("size_volume_ml"));

    if (type.has("name"))
        builder.withValue(Kegs.KEG_NAME, type.getString("name"));

    if (type.has("abv"))
        builder.withValue(Kegs.KEG_ABV, type.getDouble("abv"));

    if (image.has("url"))
        builder.withValue(Kegs.IMAGE_URL, image.getString("url"));

    // Normal keg details ready, write to provider
    batch.add(builder.build());

    return batch;
}

From source file:com.googlecode.eyesfree.brailleback.NodeBrailler.java

/**
 * Converts the source of {@code event} and its surroundings to
 * annotated text to put on the braille display.
 * Returns the new content, or {@code null} if the event doesn't have
 * a source node./*from   w ww  . j a  va2  s.com*/
 */
public DisplayManager.Content brailleNode(AccessibilityNodeInfoCompat node) {
    DisplayManager.Content content = mSelfBrailleManager.contentForNode(node);
    if (content == null) {
        ArrayList<AccessibilityNodeInfoCompat> toFormat = new ArrayList<AccessibilityNodeInfoCompat>();
        findNodesToFormat(node, toFormat);
        LogUtils.log(this, Log.VERBOSE, "Going to format %d nodes", toFormat.size());
        SpannableStringBuilder sb = new SpannableStringBuilder();
        for (AccessibilityNodeInfoCompat n : toFormat) {
            formatSubtree(n, sb);
        }
        content = new DisplayManager.Content(sb);
        content.setFirstNode(toFormat.get(0)).setLastNode(toFormat.get(toFormat.size() - 1));
        AccessibilityNodeInfoUtils.recycleNodes(toFormat);
    }
    return content;
}

From source file:com.kth.common.utils.etc.LogUtil.java

/**
 * VERBOSE  ?.//from   w  w w  .  j a v a2s.  c o m
 * 
 * @param clazz  ??  Class.
 * @param tr Throwable.
 */
public static void v(final Class<?> clazz, final Throwable tr) {
    if (LogUtil.isVerboseEnabled()) {
        Log.println(Log.VERBOSE, TAG, LogUtil.getClassLineNumber(clazz) + " - " + Log.getStackTraceString(tr));

        //  ?? ?   ?.
        if (LogUtil.isFileLogEnabled()) {
            write(Log.VERBOSE, LogUtil.getClassLineNumber(clazz), tr);
        }
    }
}

From source file:com.googlecode.eyesfree.brailleback.DisplaySpans.java

/**
 * Utility function to log what accessibiility nodes are attached
 * to what parts of the character sequence.
 *//*from w w  w .ja  v a2  s . co m*/
public static void logNodes(CharSequence chars) {
    if (!(chars instanceof Spanned)) {
        LogUtils.log(DisplaySpans.class, Log.VERBOSE, "Not a Spanned");
        return;
    }
    Spanned spanned = (Spanned) chars;
    AccessibilityNodeInfoCompat spans[] = spanned.getSpans(0, spanned.length(),
            AccessibilityNodeInfoCompat.class);
    for (AccessibilityNodeInfoCompat node : spans) {
        LogUtils.log(DisplaySpans.class, Log.VERBOSE,
                chars.subSequence(spanned.getSpanStart(node), spanned.getSpanEnd(node)).toString());
        LogUtils.log(DisplaySpans.class, Log.VERBOSE, node.getInfo().toString());
    }
}

From source file:com.scvngr.levelup.core.util.LogManager.java

/**
 * Log a message./*from   w w  w . j  ava2 s  .  com*/
 *
 * @param msg message to log.
 * @param err an exception that occurred, whose trace will be printed with the log message.
 */
public static void v(@NonNull final String msg, @NonNull final Throwable err) {
    logMessage(Log.VERBOSE, msg, null, err);
}