List of usage examples for android.util Log VERBOSE
int VERBOSE
To view the source code for android.util Log VERBOSE.
Click Source Link
From source file:com.google.android.marvin.mytalkback.CursorGranularityManager.java
/** * Attempt to navigate within the currently locked node at the current * granularity. You should call either {@link #setGranularityAt} or * {@link #adjustGranularityAt} before calling this method. * * @return The result of navigation, which is always {@link #NOT_SUPPORTED} * if there is no locked node or if the requested granularity is * {@link CursorGranularity#DEFAULT}. *//*from w ww . j av a 2 s . c om*/ public int navigate(int action) { if (mLockedNode == null) { return NOT_SUPPORTED; } final CursorGranularity requestedGranularity = getRequestedGranularity(); if ((requestedGranularity == null) || (requestedGranularity == CursorGranularity.DEFAULT)) { return NOT_SUPPORTED; } // Handle web granularity separately. if (CursorGranularity.isWebGranularity(requestedGranularity)) { return navigateWeb(action, requestedGranularity); } final Bundle arguments = new Bundle(); final int count = mNavigableNodes.size(); final int increment; switch (action) { case AccessibilityNodeInfoCompat.ACTION_NEXT_AT_MOVEMENT_GRANULARITY: increment = 1; if (mCurrentNodeIndex < 0) { mCurrentNodeIndex++; } break; case AccessibilityNodeInfoCompat.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY: increment = -1; if (mCurrentNodeIndex >= count) { mCurrentNodeIndex--; } break; default: return NOT_SUPPORTED; } while ((mCurrentNodeIndex >= 0) && (mCurrentNodeIndex < count)) { if (mSelectionModeActive) { arguments.putBoolean(AccessibilityNodeInfoCompat.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, true); } arguments.putInt(AccessibilityNodeInfoCompat.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT, requestedGranularity.value); final AccessibilityNodeInfoCompat currentNode = mNavigableNodes.get(mCurrentNodeIndex); if (currentNode.performAction(action, arguments)) { return SUCCESS; } LogUtils.log(this, Log.VERBOSE, "Failed to move with granularity %s, trying next node", requestedGranularity.name()); // If movement failed, advance to the next node and try again. mCurrentNodeIndex += increment; } return HIT_EDGE; }
From source file:com.xorcode.andtweet.TweetListActivity.java
@Override protected void onResume() { super.onResume(); if (MyLog.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "onResume"); }/*from w w w .j ava2 s. co m*/ if (TwitterUser.getTwitterUser().getCredentialsVerified() == CredentialsVerified.SUCCEEDED) { if (!TwitterUser.getTwitterUser().getSharedPreferences().getBoolean("loadedOnce", false)) { TwitterUser.getTwitterUser().getSharedPreferences().edit().putBoolean("loadedOnce", true).commit(); // One-time "manually" load tweets from the Internet for the new TwitterUser manualReload(); } } }
From source file:com.icenler.lib.view.support.percentlayout.PercentLayoutHelper.java
private static PercentLayoutInfo setWidthAndHeightVal(TypedArray array, PercentLayoutInfo info) { PercentLayoutInfo.PercentVal percentVal = getPercentVal(array, com.zhy.android.percent.support.R.styleable.PercentLayout_Layout_layout_widthPercent, true); if (percentVal != null) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent width: " + percentVal.percent); }// www . j a v a 2 s. co m info = checkForInfoExists(info); info.widthPercent = percentVal; } percentVal = getPercentVal(array, com.zhy.android.percent.support.R.styleable.PercentLayout_Layout_layout_heightPercent, false); if (percentVal != null) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent height: " + percentVal.percent); } info = checkForInfoExists(info); info.heightPercent = percentVal; } return info; }
From source file:com.google.android.dialer.provider.DialerProvider.java
private <T> T execute(Callable<T> callable, String name, long time, TimeUnit timeUnit) { FutureCallable<T> futureCallable = new FutureCallable<T>(callable); FutureTask<T> future = new FutureTask<T>(futureCallable); futureCallable.setFuture(future);/*w w w . j av a2 s . c o m*/ synchronized (mActiveTasks) { mActiveTasks.addLast(future); if (Log.isLoggable("DialerProvider", Log.VERBOSE)) { Log.v("DialerProvider", "Currently running tasks: " + mActiveTasks.size()); } while (mActiveTasks.size() > 8) { Log.w("DialerProvider", "Too many tasks, canceling one"); mActiveTasks.removeFirst().cancel(true); } } if (Log.isLoggable("DialerProvider", Log.VERBOSE)) { Log.v("DialerProvider", "Starting task " + name); } new Thread(future, name).start(); try { if (Log.isLoggable("DialerProvider", Log.VERBOSE)) { Log.v("DialerProvider", "Getting future " + name); } return future.get(time, timeUnit); } catch (InterruptedException e) { Log.w("DialerProvider", "Task was interrupted: " + name); Thread.currentThread().interrupt(); } catch (ExecutionException e) { Log.w("DialerProvider", "Task threw an exception: " + name, e); } catch (TimeoutException e) { Log.w("DialerProvider", "Task timed out: " + name); future.cancel(true); } catch (CancellationException e) { Log.w("DialerProvider", "Task was cancelled: " + name); } // TODO: Is this appropriate? return null; }
From source file:com.digipom.manteresting.android.fragment.NailFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); serviceConnector = new ServiceConnector<CacheService>(CacheService.class, getActivity(), this); serviceConnector.startAndBindService(); nailAdapter = new NailCursorAdapter(this.getActivity().getApplicationContext(), serviceConnector); setListAdapter(nailAdapter);/*w w w . j a v a2 s . c om*/ registerForContextMenu(listView); if (LoggerConfig.canLog(Log.VERBOSE)) { LoaderManager.enableDebugLogging(true); } getLoaderManager().initLoader(LOADER_ID, null, this); // This is a little bit heavy, but means we'll be doing a sync each // time we initialize the fragment. doSync(); }
From source file:mobisocial.noteshere.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 ww w. java 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. } 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); } } } }
From source file:com.android.screenspeak.CursorGranularityManager.java
/** * Attempt to navigate within the currently locked node at the current * granularity. You should call either {@link #setGranularityAt} or * {@link #adjustGranularityAt} before calling this method. * * @return The result of navigation, which is always {@link #NOT_SUPPORTED} * if there is no locked node or if the requested granularity is * {@link CursorGranularity#DEFAULT}. *//* www.j a v a 2 s .co m*/ public int navigate(int action) { if (mLockedNode == null) { return NOT_SUPPORTED; } final CursorGranularity requestedGranularity = mCurrentGranularity; if ((requestedGranularity == null) || (requestedGranularity == CursorGranularity.DEFAULT)) { return NOT_SUPPORTED; } // Handle web granularity separately. if (requestedGranularity.isWebGranularity()) { return navigateWeb(action, requestedGranularity); } final Bundle arguments = new Bundle(); final int count = mNavigableNodes.size(); final int increment; switch (action) { case AccessibilityNodeInfoCompat.ACTION_NEXT_AT_MOVEMENT_GRANULARITY: increment = 1; if (mCurrentNodeIndex < 0) { mCurrentNodeIndex++; } break; case AccessibilityNodeInfoCompat.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY: increment = -1; if (mCurrentNodeIndex >= count) { mCurrentNodeIndex--; } break; default: return NOT_SUPPORTED; } while ((mCurrentNodeIndex >= 0) && (mCurrentNodeIndex < count)) { if (isSelectionModeActive()) { arguments.putBoolean(AccessibilityNodeInfoCompat.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, true); } arguments.putInt(AccessibilityNodeInfoCompat.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT, requestedGranularity.value); final AccessibilityNodeInfoCompat currentNode = mNavigableNodes.get(mCurrentNodeIndex); if (PerformActionUtils.performAction(currentNode, action, arguments)) { return SUCCESS; } LogUtils.log(this, Log.VERBOSE, "Failed to move with granularity %s, trying next node", requestedGranularity.name()); // If movement failed, advance to the next node and try again. mCurrentNodeIndex += increment; } return HIT_EDGE; }
From source file:com.digipom.manteresting.android.service.cache.CacheService.java
/** * Loads the bitmap only, to ensure it's cached for when we request it. * These requests will be done at normal priority, in LIFO order. The width * is used to determine the minimum quality required. *///from ww w . j a v a 2s.c om public void loadOnlyLifoAsync(String originalUriFromJson, int requestedWidth) { if (LoggerConfig.canLog(Log.VERBOSE)) { Log.v(TAG, "loadOnlyLifoAsync(" + originalUriFromJson + ", " + requestedWidth + ")"); } if (bitmapMemoryCache != null && !isCachedBitmapAdequateForWidth(originalUriFromJson, requestedWidth)) { queueOrUpdateRunnable(originalUriFromJson, requestedWidth, null, System.nanoTime()); } }
From source file:com.android.mms.ui.MailBoxMessageContent.java
public void saveToContact() { String address = mMsgFrom;//ww w .j a v a2 s .c om if (TextUtils.isEmpty(address)) { if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) { Log.v(TAG, " saveToContact fail for null address! "); } return; } // address must be a single recipient Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); intent.setType(Contacts.CONTENT_ITEM_TYPE); if (Mms.isEmailAddress(address)) { intent.putExtra(ContactsContract.Intents.Insert.EMAIL, address); } else { intent.putExtra(ContactsContract.Intents.Insert.PHONE, address); intent.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE); } intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); this.startActivity(intent); }
From source file:com.icenler.lib.view.support.percentlayout.PercentLayoutHelper.java
private static PercentLayoutInfo setTextSizeSupportVal(TypedArray array, PercentLayoutInfo info) { //textSizePercent PercentLayoutInfo.PercentVal percentVal = getPercentVal(array, com.zhy.android.percent.support.R.styleable.PercentLayout_Layout_layout_textSizePercent, false); if (percentVal != null) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent text size: " + percentVal.percent); }//from w w w.j a v a 2 s. c o m info = checkForInfoExists(info); info.textSizePercent = percentVal; } return info; }