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:at.jclehner.rxdroid.DrugEditFragment.java
public void onBackPressed() { final Intent intent = getActivity().getIntent(); final String action = intent.getAction(); final Drug drug = mWrapper.get(); final String drugName = drug.getName(); if (drugName == null || drugName.length() == 0) { showDrugDiscardDialog();// w ww.j av a 2 s .c om return; } if (Intent.ACTION_EDIT.equals(action)) { if (mDrugHash != drug.hashCode()) { if (LOGV) Util.dumpObjectMembers(TAG, Log.VERBOSE, drug, "drug 2"); showSaveChangesDialog(); return; } } else if (Intent.ACTION_INSERT.equals(action)) { Database.create(drug, 0); Toast.makeText(getActivity(), getString(R.string._toast_saved), Toast.LENGTH_SHORT).show(); } getActivity().finish(); }
From source file:com.google.android.mms.transaction.HttpUtils.java
/** * A helper method to send or retrieve data through HTTP protocol. * * @param token The token to identify the sending progress. * @param url The URL used in a GET request. Null when the method is * HTTP_POST_METHOD.//from w w w .j a v a 2 s.c o m * @param pdu The data to be POST. Null when the method is HTTP_GET_METHOD. * @param method HTTP_POST_METHOD or HTTP_GET_METHOD. * @return A byte array which contains the response data. * If an HTTP error code is returned, an IOException will be thrown. * @throws IOException if any error occurred on network interface or * an HTTP error code(>=400) returned from the server. */ public static byte[] httpConnection(Context context, long token, String url, byte[] pdu, int method, boolean isProxySet, String proxyHost, int proxyPort) throws IOException { if (url == null) { throw new IllegalArgumentException("URL must not be null."); } if (LOCAL_LOGV) { Log.v(TAG, "httpConnection: params list"); Log.v(TAG, "\ttoken\t\t= " + token); Log.v(TAG, "\turl\t\t= " + url); Log.v(TAG, "\tmethod\t\t= " + ((method == HTTP_POST_METHOD) ? "POST" : ((method == HTTP_GET_METHOD) ? "GET" : "UNKNOWN"))); Log.v(TAG, "\tisProxySet\t= " + isProxySet); Log.v(TAG, "\tproxyHost\t= " + proxyHost); Log.v(TAG, "\tproxyPort\t= " + proxyPort); // TODO Print out binary data more readable. //Log.v(TAG, "\tpdu\t\t= " + Arrays.toString(pdu)); } AndroidHttpClient client = null; try { // Make sure to use a proxy which supports CONNECT. URI hostUrl = new URI(url); HttpHost target = new HttpHost(hostUrl.getHost(), hostUrl.getPort(), HttpHost.DEFAULT_SCHEME_NAME); client = createHttpClient(context); HttpRequest req = null; switch (method) { case HTTP_POST_METHOD: ProgressCallbackEntity entity = new ProgressCallbackEntity(context, token, pdu); // Set request content type. entity.setContentType("application/vnd.wap.mms-message"); HttpPost post = new HttpPost(url); post.setEntity(entity); req = post; break; case HTTP_GET_METHOD: req = new HttpGet(url); break; default: Log.e(TAG, "Unknown HTTP method: " + method + ". Must be one of POST[" + HTTP_POST_METHOD + "] or GET[" + HTTP_GET_METHOD + "]."); return null; } // Set route parameters for the request. HttpParams params = client.getParams(); if (isProxySet) { ConnRouteParams.setDefaultProxy(params, new HttpHost(proxyHost, proxyPort)); } req.setParams(params); // Set necessary HTTP headers for MMS transmission. req.addHeader(HDR_KEY_ACCEPT, HDR_VALUE_ACCEPT); { String xWapProfileTagName = MmsConfig.getUaProfTagName(); String xWapProfileUrl = MmsConfig.getUaProfUrl(); if (xWapProfileUrl != null) { if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) { Log.d(LogTag.TRANSACTION, "[HttpUtils] httpConn: xWapProfUrl=" + xWapProfileUrl); } req.addHeader(xWapProfileTagName, xWapProfileUrl); } } // Extra http parameters. Split by '|' to get a list of value pairs. // Separate each pair by the first occurrence of ':' to obtain a name and // value. Replace the occurrence of the string returned by // MmsConfig.getHttpParamsLine1Key() with the users telephone number inside // the value. String extraHttpParams = MmsConfig.getHttpParams(); if (extraHttpParams != null) { String line1Number = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)) .getLine1Number(); String line1Key = MmsConfig.getHttpParamsLine1Key(); String paramList[] = extraHttpParams.split("\\|"); for (String paramPair : paramList) { String splitPair[] = paramPair.split(":", 2); if (splitPair.length == 2) { String name = splitPair[0].trim(); String value = splitPair[1].trim(); if (line1Key != null) { value = value.replace(line1Key, line1Number); } if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(value)) { req.addHeader(name, value); } } } } req.addHeader(HDR_KEY_ACCEPT_LANGUAGE, HDR_VALUE_ACCEPT_LANGUAGE); HttpResponse response = client.execute(target, req); StatusLine status = response.getStatusLine(); if (status.getStatusCode() != 200) { // HTTP 200 is success. throw new IOException("HTTP error: " + status.getReasonPhrase()); } HttpEntity entity = response.getEntity(); byte[] body = null; if (entity != null) { try { if (entity.getContentLength() > 0) { body = new byte[(int) entity.getContentLength()]; DataInputStream dis = new DataInputStream(entity.getContent()); try { dis.readFully(body); } finally { try { dis.close(); } catch (IOException e) { Log.e(TAG, "Error closing input stream: " + e.getMessage()); } } } } finally { if (entity != null) { entity.consumeContent(); } } } return body; } catch (URISyntaxException e) { handleHttpConnectionException(e, url); } catch (IllegalStateException e) { handleHttpConnectionException(e, url); } catch (IllegalArgumentException e) { handleHttpConnectionException(e, url); } catch (SocketException e) { handleHttpConnectionException(e, url); } catch (Exception e) { handleHttpConnectionException(e, url); } finally { if (client != null) { client.close(); } } return null; }
From source file:com.hitomi.basic.view.percentlayout.PercentLayoutHelper.java
private static PercentLayoutInfo setWidthAndHeightVal(TypedArray array, PercentLayoutInfo info) { PercentLayoutInfo.PercentVal percentVal = getPercentVal(array, R.styleable.PercentLayout_Layout_layout_widthPercent, true); if (percentVal != null) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent width: " + percentVal.percent); }// w w w . j a v a 2s .co m info = checkForInfoExists(info); info.widthPercent = percentVal; } percentVal = getPercentVal(array, 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.yzx.frames.tool.view_self.percent.PercentLayoutHelper.java
/** * Constructs a PercentLayoutInfo from attributes associated with a View. Call this method from * {@code LayoutParams(Context c, AttributeSet attrs)} constructor. *//*from ww w .ja v a2s.c o m*/ public static PercentLayoutInfo getPercentLayoutInfo(Context context, AttributeSet attrs) { PercentLayoutInfo info = null; TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.PercentLayout_Layout); float value = array.getFraction(R.styleable.PercentLayout_Layout_layout_widthPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent width: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.widthPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_heightPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent height: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.heightPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.leftMarginPercent = value; info.topMarginPercent = value; info.rightMarginPercent = value; info.bottomMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginLeftPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent left margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.leftMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginTopPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent top margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.topMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginRightPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent right margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.rightMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginBottomPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent bottom margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.bottomMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginStartPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent start margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.startMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginEndPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent end margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.endMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_aspectRatio, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "aspect ratio: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.aspectRatio = value; } array.recycle(); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "constructed: " + info); } return info; }
From source file:com.yxkang.android.percent.PercentLayoutHelper.java
/** * Constructs a PercentLayoutInfo from attributes associated with a View. Call this method from * {@code LayoutParams(Context c, AttributeSet attrs)} constructor. * * @param context Context//from w ww . j a v a 2 s . co m * @param attrs AttributeSet * @return PercentLayoutInfo */ public static PercentLayoutInfo getPercentLayoutInfo(Context context, AttributeSet attrs) { PercentLayoutInfo info = null; TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.PercentLayout_Layout); float value = array.getFraction(R.styleable.PercentLayout_Layout_layout_widthPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent width: " + value); } info = new PercentLayoutInfo(); info.widthPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_heightPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent height: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.heightPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.leftMarginPercent = value; info.topMarginPercent = value; info.rightMarginPercent = value; info.bottomMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginLeftPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent left margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.leftMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginTopPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent top margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.topMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginRightPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent right margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.rightMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginBottomPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent bottom margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.bottomMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginStartPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent start margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.startMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginEndPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent end margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.endMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_aspectRatio, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "aspect ratio: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.aspectRatio = value; } array.recycle(); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "constructed: " + info); } return info; }
From source file:assistive.com.scanme.com.googlecode.eyesfree.utils.AccessibilityNodeInfoUtils.java
/** * Returns whether a node should receive accessibility focus from * navigation. This method should never be called recursively, since it * traverses up the parent hierarchy on every call. * * @see #findFocusFromHover(Context, AccessibilityNodeInfoCompat) */// ww w . j av a 2 s . com public static boolean shouldFocusNode(Context context, AccessibilityNodeInfoCompat node) { if (node == null) { return false; } if (!isVisibleOrLegacy(node)) { LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE, "Don't focus, node is not visible"); return false; } if (FILTER_ACCESSIBILITY_FOCUSABLE.accept(context, node)) { // TODO: This may still result in focusing non-speaking nodes, but it // won't prevent unlabeled buttons from receiving focus. if (node.getChildCount() <= 0) { LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE, "Focus, node is focusable and has no children"); return true; } else if (isSpeakingNode(context, node)) { LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE, "Focus, node is focusable and has something to speak"); return true; } else { LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE, "Don't focus, node is focusable but has nothing to speak"); return false; } } // If this node has no focusable ancestors, but it still has text, // then it should receive focus from navigation and be read aloud. if (!hasMatchingAncestor(context, node, FILTER_ACCESSIBILITY_FOCUSABLE) && hasText(node)) { LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE, "Focus, node has text and no focusable ancestors"); return true; } LogUtils.log(AccessibilityNodeInfoUtils.class, Log.VERBOSE, "Don't focus, failed all focusability tests"); return false; }
From source file:com.tct.fw.ex.photo.adapters.BaseCursorPagerAdapter.java
/** * Swap in a new Cursor, returning the old Cursor. * * @param newCursor The new cursor to be used. * @return Returns the previously set Cursor, or null if there was not one. * If the given new Cursor is the same instance is the previously set * Cursor, null is also returned.//from w w w.j a v a 2 s .c o m */ public Cursor swapCursor(Cursor newCursor) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "swapCursor old=" + (mCursor == null ? -1 : mCursor.getCount()) + "; new=" + (newCursor == null ? -1 : newCursor.getCount())); } if (newCursor == mCursor) { return null; } Cursor oldCursor = mCursor; mCursor = newCursor; if (newCursor != null) { mRowIDColumn = newCursor.getColumnIndex(PhotoContract.PhotoViewColumns.URI); } else { mRowIDColumn = -1; } setItemPosition(); notifyDataSetChanged(); // notify the observers about the new cursor return oldCursor; }
From source file:com.xorcode.andtweet.TweetListActivity.java
/** * Prepare query to the ContentProvider (to the database) and load List of Tweets with data * @param queryIntent//ww w . ja v a 2 s . c om * @param otherThread This method is being accessed from other thread * @param loadOneMorePage load one more page of tweets */ protected void queryListData(Intent queryIntent, boolean otherThread, boolean loadOneMorePage) { // The search query is provided as an "extra" string in the query intent // TODO maybe use mQueryString here... String queryString = queryIntent.getStringExtra(SearchManager.QUERY); Intent intent = getIntent(); if (MyLog.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "doSearchQuery; queryString=\"" + queryString + "\"; TimelineType=" + mTimelineType); } Uri contentUri = Tweets.CONTENT_URI; SelectionAndArgs sa = new SelectionAndArgs(); String sortOrder = Tweets.DEFAULT_SORT_ORDER; // Id of the last (oldest) tweet to retrieve long lastItemId = -1; if (queryString != null && queryString.length() > 0) { // Record the query string in the recent queries suggestions // provider SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, TimelineSearchSuggestionProvider.AUTHORITY, TimelineSearchSuggestionProvider.MODE); suggestions.saveRecentQuery(queryString, null); contentUri = Tweets.SEARCH_URI; contentUri = Uri.withAppendedPath(contentUri, Uri.encode(queryString)); } intent.putExtra(SearchManager.QUERY, queryString); if (!contentUri.equals(intent.getData())) { intent.setData(contentUri); } if (sa.nArgs == 0) { // In fact this is needed every time you want to load next page of // tweets. // So we have to duplicate here everything we set in // com.xorcode.andtweet.TimelineActivity.onOptionsItemSelected() sa.clear(); sa.addSelection(Tweets.TWEET_TYPE + " IN (?, ?)", new String[] { String.valueOf(Tweets.TIMELINE_TYPE_FRIENDS), String.valueOf(Tweets.TIMELINE_TYPE_MENTIONS) }); if (mTimelineType == Tweets.TIMELINE_TYPE_FAVORITES) { sa.addSelection(AndTweetDatabase.Tweets.FAVORITED + " = ?", new String[] { "1" }); } if (mTimelineType == Tweets.TIMELINE_TYPE_MENTIONS) { sa.addSelection(Tweets.MESSAGE + " LIKE ?", new String[] { "%@" + TwitterUser.getTwitterUser().getUsername() + "%" }); } } if (!positionRestored) { // We have to ensure that saved position will be // loaded from database into the list lastItemId = getSavedPosition(true); } int nTweets = 0; if (mCursor != null && !mCursor.isClosed()) { if (positionRestored) { // If position is NOT loaded - this cursor is from other // timeline/search // and we shouldn't care how much rows are there. nTweets = mCursor.getCount(); } if (!otherThread) { mCursor.close(); } } if (lastItemId > 0) { if (sa.nArgs == 0) { sa.addSelection("AndTweetDatabase.Tweets.TWEET_TYPE" + " IN (?, ?)" + ")", new String[] { String.valueOf(Tweets.TIMELINE_TYPE_FRIENDS), String.valueOf(Tweets.TIMELINE_TYPE_MENTIONS) }); } sa.addSelection(Tweets._ID + " >= ?", new String[] { String.valueOf(lastItemId) }); } else { if (loadOneMorePage) { nTweets += PAGE_SIZE; } else if (nTweets < PAGE_SIZE) { nTweets = PAGE_SIZE; } sortOrder += " LIMIT 0," + nTweets; } // This is for testing pruneOldRecords // try { // FriendTimeline fl = new FriendTimeline(TweetListActivity.this, // AndTweetDatabase.Tweets.TIMELINE_TYPE_FRIENDS); // fl.pruneOldRecords(); // // } catch (Exception e) { // e.printStackTrace(); // } mCursor = getContentResolver().query(contentUri, PROJECTION, sa.selection, sa.selectionArgs, sortOrder); if (!otherThread) { createAdapters(); } }
From source file:com.google.android.gcm.GCMRegistrar.java
private static void checkReceiver(Context context, Set<String> allowedReceivers, String action) { PackageManager pm = context.getPackageManager(); String packageName = context.getPackageName(); Intent intent = new Intent(action); intent.setPackage(packageName);//from w w w .ja v a 2 s . co m List<ResolveInfo> receivers = pm.queryBroadcastReceivers(intent, PackageManager.GET_INTENT_FILTERS); if (receivers.isEmpty()) { throw new IllegalStateException("No receivers for action " + action); } if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "Found " + receivers.size() + " receivers for action " + action); } // make sure receivers match for (ResolveInfo receiver : receivers) { String name = receiver.activityInfo.name; if (!allowedReceivers.contains(name)) { throw new IllegalStateException( "Receiver " + name + " is not set with permission " + GCMConstants.PERMISSION_GCM_INTENTS); } } }
From source file:org.andstatus.app.util.MyLog.java
/** * Shortcut for verbose messages of the application *///from w w w . j ava 2 s . co m public static int v(Object objTag, Throwable tr) { String tag = objTagToString(objTag); int i = 0; if (isLoggable(tag, Log.VERBOSE)) { logToFile(VERBOSE, tag, null, tr); i = Log.v(tag, "", tr); } return i; }