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.magicmod.mmweather.engine.YahooWeatherProvider.java

private LocationResult parsePlace(JSONObject place) throws JSONException {
    LocationResult result = new LocationResult();
    JSONObject country = place.getJSONObject("country");

    result.id = place.getString("woeid");
    result.country = country.getString("content");
    result.countryId = country.getString("code");
    if (!place.isNull("postal")) {
        result.postal = place.getJSONObject("postal").getString("content");
    }/*from ww w.j  a  v  a2  s. co  m*/

    for (String name : LOCALITY_NAMES) {
        if (!place.isNull(name)) {
            result.city = place.getJSONObject(name).getString("content");
            break;
        }
    }

    if (Log.isLoggable(TAG, Log.VERBOSE)) {
        Log.v(TAG, "JSON data " + place.toString() + " -> id=" + result.id + ", city=" + result.city
                + ", country=" + result.countryId);
    }

    if (result.id == null || result.city == null || result.countryId == null) {
        return null;
    }

    return result;
}

From source file:com.android.talkback.controller.FullScreenReadControllerApp.java

private void setReadingState(int newState) {
    LogUtils.log(TAG, Log.VERBOSE, "Continuous reading switching to mode: %s", newState);

    mCurrentState = newState;//w w w. ja  v a  2 s  .  c  om

    TalkBackService service = TalkBackService.getInstance();
    if (service != null) {
        service.getSpeechController().setShouldInjectAutoReadingCallbacks(isActive(), mNodeSpokenRunnable);
    }
}

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

@Override
public void onStartInputView(EditorInfo info, boolean restarting) {
    super.onStartInputView(info, restarting);
    LogUtils.log(this, Log.VERBOSE, "onStartInputView");

    Host host = getHost();/*from w  w  w.ja  v  a 2s .c om*/
    if (host != null) {
        host.onStartInputView(info, restarting);
    }
}

From source file:com.digipom.manteresting.android.service.cache.CacheService.java

@Override
public IBinder onBind(Intent intent) {
    if (LoggerConfig.canLog(Log.VERBOSE)) {
        Log.v(TAG, "onBind(" + intent + ")");
    }//from  w  w  w . j  av  a 2 s .  com

    return localBinder;
}

From source file:com.ty.highway.frameworklibrary.support.percent.PercentLayoutHelper.java

/**
 * Constructs a PercentLayoutInfo from attributes associated with a View.
 * Call this method from {@code LayoutParams(Context c, AttributeSet attrs)}
 * constructor.//from  w  w  w .  j  a  v  a2  s  .c om
 */
public static PercentLayoutInfo getPercentLayoutInfo(Context context, AttributeSet attrs) {
    PercentLayoutInfo info = null;
    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.PercentLayout_Layout);

    int index = R.styleable.PercentLayout_Layout_layout_widthPercent;
    String sizeStr = array.getString(index);
    PercentLayoutInfo.PercentVal percentVal = getPercentVal(sizeStr, true);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent width: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.widthPercent = percentVal;
    }
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_heightPercent);
    percentVal = getPercentVal(sizeStr, false);

    if (sizeStr != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent height: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.heightPercent = percentVal;
    }

    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginPercent,
    // 1, 1, -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginPercent);
    // just for judge
    percentVal = getPercentVal(sizeStr, false);

    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.leftMarginPercent = getPercentVal(sizeStr, true);
        info.topMarginPercent = getPercentVal(sizeStr, false);
        info.rightMarginPercent = getPercentVal(sizeStr, true);
        info.bottomMarginPercent = getPercentVal(sizeStr, false);
    }
    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginLeftPercent,
    // 1, 1,
    // -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginLeftPercent);
    percentVal = getPercentVal(sizeStr, true);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent left margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.leftMarginPercent = percentVal;
    }

    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginTopPercent,
    // 1, 1,
    // -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginTopPercent);
    percentVal = getPercentVal(sizeStr, false);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent top margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.topMarginPercent = percentVal;
    }
    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginRightPercent,
    // 1, 1,
    // -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginRightPercent);
    percentVal = getPercentVal(sizeStr, true);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent right margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.rightMarginPercent = percentVal;
    }
    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginBottomPercent,
    // 1, 1,
    // -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginBottomPercent);
    percentVal = getPercentVal(sizeStr, false);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent bottom margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.bottomMarginPercent = percentVal;
    }
    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginStartPercent,
    // 1, 1,
    // -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginStartPercent);
    percentVal = getPercentVal(sizeStr, true);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent start margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.startMarginPercent = percentVal;
    }
    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginEndPercent,
    // 1, 1,
    // -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginEndPercent);
    percentVal = getPercentVal(sizeStr, true);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent end margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.endMarginPercent = percentVal;
    }

    // textSizePercent
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_textSizePercent);
    percentVal = getPercentVal(sizeStr, false);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent text size: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.textSizePercent = percentVal;
    }

    // maxWidth
    percentVal = getPercentVal(array, R.styleable.PercentLayout_Layout_layout_maxWidthPercent, true);
    if (percentVal != null) {
        checkForInfoExists(info);
        info.maxWidthPercent = percentVal;
    }
    // maxHeight
    percentVal = getPercentVal(array, R.styleable.PercentLayout_Layout_layout_maxHeightPercent, false);
    if (percentVal != null) {
        checkForInfoExists(info);
        info.maxHeightPercent = percentVal;
    }
    // minWidth
    percentVal = getPercentVal(array, R.styleable.PercentLayout_Layout_layout_minWidthPercent, true);
    if (percentVal != null) {
        checkForInfoExists(info);
        info.minWidthPercent = percentVal;
    }
    // minHeight
    percentVal = getPercentVal(array, R.styleable.PercentLayout_Layout_layout_minHeightPercent, false);
    Log.d(TAG, "minHeight = " + percentVal);
    if (percentVal != null) {
        checkForInfoExists(info);
        info.minHeightPercent = percentVal;
    }

    array.recycle();
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "constructed: " + info);
    }
    return info;
}

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

@Override
public void onFinishInputView(boolean finishingInput) {
    super.onFinishInputView(finishingInput);
    LogUtils.log(this, Log.VERBOSE, "onFinishInputView");

    Host host = getHost();/*from  w  w  w .ja  v a2s .  c  o  m*/
    if (host != null) {
        host.onFinishInputView(finishingInput);
    }
}

From source file:com.digipom.manteresting.android.service.cache.CacheService.java

/**
 * Returns the decoded bitmap, if available, or null if not.
 *//* w  ww . ja v a2 s  .co m*/
public Bitmap getOnly(String originalUriFromJson) {
    if (LoggerConfig.canLog(Log.VERBOSE)) {
        Log.v(TAG, "getOnly(" + originalUriFromJson + ")");
    }

    final BitmapWithCategory bitmapWithCategory = bitmapMemoryCache.get(originalUriFromJson);

    if (bitmapWithCategory != null) {
        return bitmapWithCategory.bitmap;
    } else {
        return null;
    }
}

From source file:com.radicaldynamic.groupinform.tasks.DownloadFormsTask.java

@Override
protected HashMap<String, String> doInBackground(ArrayList<FormDetails>... values) {
    ArrayList<FormDetails> toDownload = values[0];

    int total = toDownload.size();
    int count = 1;

    HashMap<String, String> result = new HashMap<String, String>();

    for (int i = 0; i < total; i++) {
        FormDetails fd = toDownload.get(i);
        publishProgress(fd.formName, Integer.valueOf(count).toString(), Integer.valueOf(total).toString());

        String message = "";

        try {/*from  w ww  .j a  va  2s.  co m*/
            // get the xml file
            // if we've downloaded a duplicate, this gives us the file
            File dl = downloadXform(fd.formName, fd.downloadUrl);

            // BEGIN custom
            //                String[] projection = {
            //                        FormsColumns._ID, FormsColumns.FORM_FILE_PATH
            //                };
            //                String[] selectionArgs = {
            //                    dl.getAbsolutePath()
            //                };
            //                String selection = FormsColumns.FORM_FILE_PATH + "=?";
            //                Cursor alreadyExists =
            //                    Collect.getInstance()
            //                            .getContentResolver()
            //                            .query(FormsColumns.CONTENT_URI, projection, selection, selectionArgs,
            //                                null);
            //
            //                Uri uri = null;
            //                if (alreadyExists.getCount() <= 0) {
            //                    // doesn't exist, so insert it
            //                    ContentValues v = new ContentValues();
            //                    v.put(FormsColumns.FORM_FILE_PATH, dl.getAbsolutePath());
            //
            //                    HashMap<String, String> formInfo = FileUtils.parseXML(dl);
            //                    v.put(FormsColumns.DISPLAY_NAME, formInfo.get(FileUtils.TITLE));
            //                    v.put(FormsColumns.MODEL_VERSION, formInfo.get(FileUtils.MODEL));
            //                    v.put(FormsColumns.UI_VERSION, formInfo.get(FileUtils.UI));
            //                    v.put(FormsColumns.JR_FORM_ID, formInfo.get(FileUtils.FORMID));
            //                    v.put(FormsColumns.SUBMISSION_URI, formInfo.get(FileUtils.SUBMISSIONURI));
            //                    uri =
            //                        Collect.getInstance().getContentResolver()
            //                                .insert(FormsColumns.CONTENT_URI, v);
            //                } else {
            //                    alreadyExists.moveToFirst();
            //                    uri =
            //                        Uri.withAppendedPath(FormsColumns.CONTENT_URI,
            //                            alreadyExists.getString(alreadyExists.getColumnIndex(FormsColumns._ID)));
            //                }
            // END custom

            if (fd.manifestUrl != null) {
                // BEGIN custom
                //                    Cursor c =
                //                        Collect.getInstance().getContentResolver()
                //                                .query(uri, null, null, null, null);
                //                    if (c.getCount() > 0) {
                //                        // should be exactly 1
                //                        c.moveToFirst();
                //
                //                        String error =
                //                            downloadManifestAndMediaFiles(
                //                                c.getString(c.getColumnIndex(FormsColumns.FORM_MEDIA_PATH)), fd,
                //                                count, total);
                //                        if (error != null) {
                //                            message += error;
                //                        }
                //                    }
                String error = downloadManifestAndMediaFiles(dl.getParent(), fd, count, total);

                if (error != null) {
                    message += error;
                }
                // END custom
            } else {
                // TODO: manifest was null?
                Log.e(t, "Manifest was null.  PANIC");
            }

            // BEGIN custom
            HashMap<String, String> formInfo = FileUtils.parseXML(dl);

            // Create form document and add attachments; commit to database
            FormDefinition fDoc = new FormDefinition();
            fDoc.setName(formInfo.get(FileUtils.TITLE));
            fDoc.setModelVersion(formInfo.get(FileUtils.MODEL));
            fDoc.setUiVersion(formInfo.get(FileUtils.UI));
            fDoc.setJavaRosaId(formInfo.get(FileUtils.FORMID));
            fDoc.setSubmissionUri(formInfo.get(FileUtils.SUBMISSIONURI));
            fDoc.setStatus(FormDefinition.Status.active);
            fDoc.setXmlHash(FileUtils.getMd5Hash(dl));
            Collect.getInstance().getDbService().getDb().create(fDoc);

            String revision = fDoc.getRevision();

            for (File f : dl.getParentFile().listFiles()) {
                String fileName = f.getName();
                String attachmentName = fileName;

                if (Collect.Log.VERBOSE)
                    Log.v(Collect.LOGTAG, t + ": attaching " + fileName + " to " + fDoc.getId());

                if (fileName.equals(dl.getName()))
                    attachmentName = "xml";

                String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1);
                String contentType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);

                FileInputStream fis = new FileInputStream(f);
                AttachmentInputStream ais = new AttachmentInputStream(attachmentName, fis, contentType,
                        f.length());
                revision = Collect.getInstance().getDbService().getDb().createAttachment(fDoc.getId(), revision,
                        ais);
                fis.close();
            }

            // Remove temporary download directory
            FileUtilsExtended.deleteFolder(dl.getParent());
            // END custom
        } catch (SocketTimeoutException se) {
            se.printStackTrace();
            message += se.getMessage();
            // BEGIN custom
        } catch (DuplicateXFormFile e) {
            message = " SKIPPED (duplicate)";
            // END custom
        } catch (Exception e) {
            e.printStackTrace();
            if (e.getCause() != null) {
                message += e.getCause().getMessage();
            } else {
                message += e.getMessage();
            }
        }
        count++;
        if (message.equalsIgnoreCase("")) {
            message = Collect.getInstance().getString(R.string.success);
        }
        result.put(fd.formName, message);
    }

    return result;
}

From source file:com.magicmod.mmweather.engine.YahooWeatherProvider.java

private JSONObject fetchResults(String url) {
    String response = HttpRetriever.retrieve(url);
    if (response == null) {
        return null;
    }/*from   w ww .  j a  v a  2  s.  c  om*/

    if (Log.isLoggable(TAG, Log.VERBOSE)) {
        Log.v(TAG, "Request URL is " + url + ", response is " + response);
    }

    try {
        JSONObject rootObject = new JSONObject(response);
        return rootObject.getJSONObject("query").getJSONObject("results");
    } catch (JSONException e) {
        Log.w(TAG, "Received malformed places data (url=" + url + ")", e);
    }

    return null;
}

From source file:mobisocial.musubi.util.UriImage.java

/**
 * Returns the bytes for this UriImage. If the uri for the image is remote,
 * then this code must not be run on the main thread.
 *///from w ww .j  a va  2 s.c  om
public byte[] getResizedImageData(int widthLimit, int heightLimit, int byteLimit, boolean square)
        throws IOException {
    if (!mDecodedBounds) {
        decodeBoundsInfo();
        mDecodedBounds = true;
    }
    InputStream input = null;
    try {
        int inDensity = 0;
        int targetDensity = 0;
        BitmapFactory.Options read_options = new BitmapFactory.Options();
        read_options.inJustDecodeBounds = true;
        input = openInputStream(mUri);
        BitmapFactory.decodeStream(input, null, read_options);
        if (read_options.outWidth > widthLimit || read_options.outHeight > heightLimit) {
            //we need to scale
            if (read_options.outWidth / widthLimit > read_options.outHeight / heightLimit) {
                //width is the large edge
                if (read_options.outWidth * heightLimit > widthLimit * read_options.outHeight) {
                    //incoming image is wider than target
                    inDensity = read_options.outWidth;
                    targetDensity = widthLimit;
                } else {
                    //incoming image is taller than target
                    inDensity = read_options.outHeight;
                    targetDensity = heightLimit;

                }
            } else {
                //height is the long edge, swap the limits
                if (read_options.outWidth * widthLimit > heightLimit * read_options.outHeight) {
                    //incoming image is wider than target
                    inDensity = read_options.outWidth;
                    targetDensity = heightLimit;
                } else {
                    //incoming image is taller than target
                    inDensity = read_options.outHeight;
                    targetDensity = widthLimit;

                }
            }
        } else {
            //no scale
            if (read_options.outWidth > read_options.outHeight) {
                inDensity = targetDensity = read_options.outWidth;
            } else {
                inDensity = targetDensity = read_options.outHeight;
            }
        }

        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG,
                    "getResizedImageData: wlimit=" + widthLimit + ", hlimit=" + heightLimit + ", sizeLimit="
                            + byteLimit + ", mWidth=" + mWidth + ", mHeight=" + mHeight + ", initialRatio="
                            + targetDensity + "/" + inDensity);
        }

        ByteArrayOutputStream os = null;
        int attempts = 1;

        int lowMemoryReduce = 1;
        do {
            BitmapFactory.Options options = new BitmapFactory.Options();
            options.inDensity = inDensity;
            options.inSampleSize = lowMemoryReduce;
            options.inScaled = lowMemoryReduce == 1;
            options.inTargetDensity = targetDensity;
            //no purgeable because we are only trying to resave this
            if (input != null)
                input.close();
            input = openInputStream(mUri);
            int quality = IMAGE_COMPRESSION_QUALITY;
            try {
                Bitmap b = BitmapFactory.decodeStream(input, null, options);
                if (b == null) {
                    return null;
                }
                if (options.outWidth > widthLimit + 1 || options.outHeight > heightLimit + 1) {
                    // The decoder does not support the inSampleSize option.
                    // Scale the bitmap using Bitmap library.
                    int scaledWidth;
                    int scaledHeight;
                    scaledWidth = options.outWidth * targetDensity / inDensity;
                    scaledHeight = options.outHeight * targetDensity / inDensity;

                    if (Log.isLoggable(TAG, Log.VERBOSE)) {
                        Log.v(TAG, "getResizedImageData: retry scaling using " + "Bitmap.createScaledBitmap: w="
                                + scaledWidth + ", h=" + scaledHeight);
                    }

                    if (square) {
                        int w = b.getWidth();
                        int h = b.getHeight();
                        int dim = Math.min(w, h);
                        b = Bitmap.createBitmap(b, (w - dim) / 2, (h - dim) / 2, dim, dim);
                        scaledWidth = dim;
                        scaledHeight = dim;
                    }
                    Bitmap b2 = Bitmap.createScaledBitmap(b, scaledWidth, scaledHeight, false);
                    b.recycle();
                    b = b2;
                    if (b == null) {
                        return null;
                    }
                }

                Matrix matrix = new Matrix();
                if (mRotation != 0f) {
                    matrix.preRotate(mRotation);
                }

                Bitmap old = b;
                b = Bitmap.createBitmap(old, 0, 0, old.getWidth(), old.getHeight(), matrix, true);

                // Compress the image into a JPG. Start with MessageUtils.IMAGE_COMPRESSION_QUALITY.
                // In case that the image byte size is still too large reduce the quality in
                // proportion to the desired byte size. Should the quality fall below
                // MINIMUM_IMAGE_COMPRESSION_QUALITY skip a compression attempt and we will enter
                // the next round with a smaller image to start with.
                os = new ByteArrayOutputStream();
                b.compress(CompressFormat.JPEG, quality, os);
                int jpgFileSize = os.size();
                if (jpgFileSize > byteLimit) {
                    int reducedQuality = quality * byteLimit / jpgFileSize;
                    //always try to squish it before computing the new size
                    if (reducedQuality < MINIMUM_IMAGE_COMPRESSION_QUALITY) {
                        reducedQuality = MINIMUM_IMAGE_COMPRESSION_QUALITY;
                    }
                    quality = reducedQuality;

                    if (Log.isLoggable(TAG, Log.VERBOSE)) {
                        Log.v(TAG, "getResizedImageData: compress(2) w/ quality=" + quality);
                    }

                    os = new ByteArrayOutputStream();
                    b.compress(CompressFormat.JPEG, quality, os);
                }
                b.recycle(); // done with the bitmap, release the memory
            } catch (java.lang.OutOfMemoryError e) {
                Log.w(TAG, "getResizedImageData - image too big (OutOfMemoryError), will try "
                        + " with smaller scale factor, cur scale factor", e);
                lowMemoryReduce *= 2;
                // fall through and keep trying with a smaller scale factor.
            }
            if (true || Log.isLoggable(TAG, Log.VERBOSE)) {
                Log.v(TAG,
                        "attempt=" + attempts + " size=" + (os == null ? 0 : os.size()) + " width="
                                + options.outWidth + " height=" + options.outHeight + " Ratio=" + targetDensity
                                + "/" + inDensity + " quality=" + quality);
            }
            //move halfway to the target
            targetDensity = (os == null) ? (int) (targetDensity * .8)
                    : (targetDensity * byteLimit / os.size() + targetDensity) / 2;
            attempts++;
        } while ((os == null || os.size() > byteLimit) && attempts < NUMBER_OF_RESIZE_ATTEMPTS);

        return os == null ? null : os.toByteArray();
    } catch (Throwable t) {
        Log.e(TAG, t.getMessage(), t);
        return null;
    } finally {
        if (input != null) {
            try {
                input.close();
            } catch (IOException e) {
                Log.e(TAG, e.getMessage(), e);
            }
        }
    }
}