Example usage for android.util Log DEBUG

List of usage examples for android.util Log DEBUG

Introduction

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

Prototype

int DEBUG

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

Click Source Link

Document

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

Usage

From source file:com.android.calendar.month.MonthByWeekFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    if (mIsMiniMonth) {
        return null;
    }//  w ww  .  j a  v  a2s.com
    CursorLoader loader;
    synchronized (mUpdateLoader) {
        mFirstLoadedJulianDay = Time.getJulianDay(mSelectedDay.toMillis(true), mSelectedDay.gmtoff)
                - (mNumWeeks * 7 / 2);
        mEventUri = updateUri();
        String where = updateWhere();

        loader = new CursorLoader(getActivity(), mEventUri, Event.EVENT_PROJECTION, where,
                null /* WHERE_CALENDARS_SELECTED_ARGS */, INSTANCES_SORT_ORDER);
        loader.setUpdateThrottle(LOADER_THROTTLE_DELAY);
    }
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "Returning new loader with uri: " + mEventUri);
    }
    return loader;
}

From source file:com.example.android.wearable.speedtracker.WearableMainActivity.java

private void requestLocation() {
    Log.d(TAG, "requestLocation()");

    /*/*w  w w. jav  a2 s .  c  om*/
     * mGpsPermissionApproved covers 23+ (M+) style permissions. If that is already approved or
     * the device is pre-23, the app uses mSaveGpsLocation to save the user's location
     * preference.
     */
    if (mGpsPermissionApproved) {

        LocationRequest locationRequest = LocationRequest.create()
                .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY).setInterval(UPDATE_INTERVAL_MS)
                .setFastestInterval(FASTEST_INTERVAL_MS);

        LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, locationRequest, this)
                .setResultCallback(new ResultCallback<Status>() {

                    @Override
                    public void onResult(Status status) {
                        if (status.getStatus().isSuccess()) {
                            if (Log.isLoggable(TAG, Log.DEBUG)) {
                                Log.d(TAG, "Successfully requested location updates");
                            }
                        } else {
                            Log.e(TAG, "Failed in requesting location updates, " + "status code: "
                                    + status.getStatusCode() + ", message: " + status.getStatusMessage());
                        }
                    }
                });
    }
}

From source file:com.android.contacts.ContactSaveService.java

@Override
protected void onHandleIntent(final Intent intent) {
    if (intent == null) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "onHandleIntent: could not handle null intent");
        }//w  w w .ja  va2s  .co  m
        return;
    }
    if (!PermissionsUtil.hasPermission(this, WRITE_CONTACTS)) {
        Log.w(TAG, "No WRITE_CONTACTS permission, unable to write to CP2");
        // TODO: add more specific error string such as "Turn on Contacts
        // permission to update your contacts"
        showToast(R.string.contactSavedErrorToast);
        return;
    }

    // Call an appropriate method. If we're sure it affects how incoming phone calls are
    // handled, then notify the fact to in-call screen.
    String action = intent.getAction();
    if (ACTION_NEW_RAW_CONTACT.equals(action)) {
        createRawContact(intent);
    } else if (ACTION_SAVE_CONTACT.equals(action)) {
        saveContact(intent);
    } else if (ACTION_CREATE_GROUP.equals(action)) {
        createGroup(intent);
    } else if (ACTION_RENAME_GROUP.equals(action)) {
        renameGroup(intent);
    } else if (ACTION_DELETE_GROUP.equals(action)) {
        deleteGroup(intent);
    } else if (ACTION_UPDATE_GROUP.equals(action)) {
        updateGroup(intent);
    } else if (ACTION_SET_STARRED.equals(action)) {
        setStarred(intent);
    } else if (ACTION_SET_SUPER_PRIMARY.equals(action)) {
        setSuperPrimary(intent);
    } else if (ACTION_CLEAR_PRIMARY.equals(action)) {
        clearPrimary(intent);
    } else if (ACTION_DELETE_MULTIPLE_CONTACTS.equals(action)) {
        deleteMultipleContacts(intent);
    } else if (ACTION_DELETE_CONTACT.equals(action)) {
        deleteContact(intent);
    } else if (ACTION_SPLIT_CONTACT.equals(action)) {
        splitContact(intent);
    } else if (ACTION_JOIN_CONTACTS.equals(action)) {
        joinContacts(intent);
    } else if (ACTION_JOIN_SEVERAL_CONTACTS.equals(action)) {
        joinSeveralContacts(intent);
    } else if (ACTION_SET_SEND_TO_VOICEMAIL.equals(action)) {
        setSendToVoicemail(intent);
    } else if (ACTION_SET_RINGTONE.equals(action)) {
        setRingtone(intent);
    } else if (ACTION_UNDO.equals(action)) {
        undo(intent);
    } else if (ACTION_SLEEP.equals(action)) {
        sleepForDebugging(intent);
    }

    sState.onFinish(intent);
    notifyStateChanged();
}

From source file:com.android.im.imps.HttpDataChannel.java

private void trySend(Primitive p) throws IOException {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {//from www .j  a  v  a 2 s .  c o m
        mSerializer.serialize(p, out);
    } catch (SerializerException e) {
        mTxManager.notifyErrorResponse(p.getTransactionID(), ImErrorInfo.SERIALIZER_ERROR,
                "Internal serializer error, primitive: " + p.getType());
        out.close();
        return;
    }

    HttpPost req = new HttpPost(mPostUri);
    req.addHeader(mContentTypeHeader);
    if (mMsisdnHeader != null) {
        req.addHeader(mMsisdnHeader);
    }
    ByteArrayEntity entity = new ByteArrayEntity(out.toByteArray());
    req.setEntity(entity);

    mLastActive = SystemClock.elapsedRealtime();
    if (Log.isLoggable(ImpsLog.TAG, Log.DEBUG)) {
        long sendBytes = entity.getContentLength() + 176 /* approx. header length */;
        ImpsLog.log(mConnection.getLoginUserName() + " >> " + p.getType() + " HTTP payload approx. " + sendBytes
                + " bytes");
    }
    if (Log.isLoggable(ImpsLog.PACKET_TAG, Log.DEBUG)) {
        ImpsLog.dumpRawPacket(out.toByteArray());
        ImpsLog.dumpPrimitive(p);
    }

    HttpResponse res = mHttpClient.execute(req);
    StatusLine statusLine = res.getStatusLine();
    HttpEntity resEntity = res.getEntity();

    InputStream in = resEntity.getContent();

    if (Log.isLoggable(ImpsLog.PACKET_TAG, Log.DEBUG)) {
        Log.d(ImpsLog.PACKET_TAG, statusLine.toString());
        Header[] headers = res.getAllHeaders();
        for (Header h : headers) {
            Log.d(ImpsLog.PACKET_TAG, h.toString());
        }
        int len = (int) resEntity.getContentLength();
        if (len > 0) {
            byte[] content = new byte[len];
            int offset = 0;
            int bytesRead = 0;
            do {
                bytesRead = in.read(content, offset, len);
                offset += bytesRead;
                len -= bytesRead;
            } while (bytesRead > 0);
            in.close();
            ImpsLog.dumpRawPacket(content);
            in = new ByteArrayInputStream(content);
        }
    }

    try {
        if (statusLine.getStatusCode() != HttpURLConnection.HTTP_OK) {
            mTxManager.notifyErrorResponse(p.getTransactionID(), statusLine.getStatusCode(),
                    statusLine.getReasonPhrase());
            return;
        }
        if (resEntity.getContentLength() == 0) {
            // empty responses are only valid for Polling-Request or
            // server initiated transactions
            if ((p.getTransactionMode() != TransactionMode.Response)
                    && !p.getType().equals(ImpsTags.Polling_Request)) {
                mTxManager.notifyErrorResponse(p.getTransactionID(), ImErrorInfo.ILLEGAL_SERVER_RESPONSE,
                        "bad response from server");
            }
            return;
        }

        Primitive response = mParser.parse(in);

        if (Log.isLoggable(ImpsLog.PACKET_TAG, Log.DEBUG)) {
            ImpsLog.dumpPrimitive(response);
        }

        if (Log.isLoggable(ImpsLog.TAG, Log.DEBUG)) {
            long len = 2 + resEntity.getContentLength() + statusLine.toString().length() + 2;
            Header[] headers = res.getAllHeaders();
            for (Header header : headers) {
                len += header.getName().length() + header.getValue().length() + 4;
            }
            ImpsLog.log(mConnection.getLoginUserName() + " << " + response.getType() + " HTTP payload approx. "
                    + len + "bytes");
        }

        if (!mReceiveQueue.offer(response)) {
            // This is almost impossible for a LinkedBlockingQueue.
            // We don't even bother to assign an error code for it.
            mTxManager.notifyErrorResponse(p.getTransactionID(), ImErrorInfo.UNKNOWN_ERROR,
                    "receiving queue full");
        }
    } catch (ParserException e) {
        ImpsLog.logError(e);
        mTxManager.notifyErrorResponse(p.getTransactionID(), ImErrorInfo.PARSER_ERROR,
                "Parser error, received a bad response from server");
    } finally {
        //consume all the content so that the connection can be re-used.
        resEntity.consumeContent();
    }
}

From source file:com.samsung.richnotification.RichNotification.java

/**
 * Executes the request and returns PluginResult.
 *
 * @param action/*from   w  w  w  . j a v a2 s.c  om*/
 *            The action to execute.
 * @param data
 *            JSONArray of arguments for the plugin.
 * @param callbackContext
 *            The callback id used when calling back into JavaScript.
 * @return A PluginResult object with a status and message.
 */
@Override
public boolean execute(String action, JSONArray data, CallbackContext callbackContext) throws JSONException {

    if (Log.isLoggable(RICHNOTI, Log.DEBUG))
        Log.d(TAG, "execute(): callbackID - " + callbackContext.getCallbackId());
    mContext = this.cordova.getActivity();

    // Do not allow apis if metadata is missing
    if (!pluginMetadata) {
        callbackContext.error("METADATA_MISSING");
        Log.e(TAG, "Metadata is missing");
        return false;
    }

    if (action.equals("isSupported")) {
        if (isRichNotificationSupported(callbackContext)) {
            callbackContext.success();
            return true;
        }
        return false;
    }

    else if (action.equals("registerEventListeners")) {
        return registerRichNotificationEventListeners(callbackContext);
    }

    else if (action.equals("send")) {
        return sendRichNotification(data, callbackContext);
    }

    else if (action.equals("dismiss")) {
        String uuid = data.getString(0); // There will be just one array-element i.e. the UUID
        return dismissRichNotification(uuid, callbackContext);
    }

    else if (action.equals("isConnected")) {
        // initRichNotification will throw the DEVICE_NOT_CONNECTED error
        if (!initRichNotification(callbackContext)) {
            Log.e(TAG, "Initialization failed.");
            return false;
        } else {
            if (Log.isLoggable(RICHNOTI, Log.DEBUG))
                Log.d(TAG, "Connected to gear");
            callbackContext.success();
            return true;
        }
    }
    return true;
}

From source file:com.radicaldynamic.groupinform.activities.AccountFolderList.java

public static void fetchFolderList(boolean fetchAnyway) {
    if (Collect.getInstance().getIoService().isSignedIn() || fetchAnyway) {
        if (Collect.Log.DEBUG)
            Log.d(Collect.LOGTAG, t + "fetching list of folders");
    } else {/*w w  w .ja va 2  s  . c  o  m*/
        if (Collect.Log.DEBUG)
            Log.d(Collect.LOGTAG, t + "not signed in, skipping folder list fetch");
        return;
    }

    // Try to ping the service to see if it is "up"
    String folderListUrl = Collect.getInstance().getInformOnlineState().getServerUrl() + "/folder/list";
    String getResult = HttpUtils.getUrlData(folderListUrl);
    JSONObject jsonFolderList;

    try {
        jsonFolderList = (JSONObject) new JSONTokener(getResult).nextValue();

        String result = jsonFolderList.optString(InformOnlineState.RESULT, InformOnlineState.ERROR);

        if (result.equals(InformOnlineState.OK)) {
            // Write out list of jsonFolders for later retrieval by loadFoldersList()
            JSONArray jsonFolders = jsonFolderList.getJSONArray("folders");

            try {
                // Write out a folder list cache file
                FileOutputStream fos = new FileOutputStream(
                        new File(Collect.getInstance().getCacheDir(), FileUtilsExtended.FOLDER_CACHE_FILE));
                fos.write(jsonFolders.toString().getBytes());
                fos.close();
            } catch (Exception e) {
                if (Collect.Log.ERROR)
                    Log.e(Collect.LOGTAG, t + "unable to write folder cache: " + e.toString());
                e.printStackTrace();
            }
        } else {
            // There was a problem.. handle it!
        }
    } catch (NullPointerException e) {
        // Communication error
        if (Collect.Log.ERROR)
            Log.e(Collect.LOGTAG, t + "no getResult to parse.  Communication error with node.js server?");
        e.printStackTrace();
    } catch (JSONException e) {
        // Parse error (malformed result)
        if (Collect.Log.ERROR)
            Log.e(Collect.LOGTAG, t + "failed to parse getResult " + getResult);
        e.printStackTrace();
    }
}

From source file:com.android.calendar.month.MonthByWeekFragment.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    synchronized (mUpdateLoader) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "Found " + data.getCount() + " cursor entries for uri " + mEventUri);
        }//  w w  w. j a va2s. com
        CursorLoader cLoader = (CursorLoader) loader;
        if (mEventUri == null) {
            mEventUri = cLoader.getUri();
            updateLoadedDays();
        }
        if (cLoader.getUri().compareTo(mEventUri) != 0) {
            // We've started a new query since this loader ran so ignore the
            // result
            return;
        }
        ArrayList<Event> events = new ArrayList<Event>();
        Event.buildEventsFromCursor(events, data, mContext, mFirstLoadedJulianDay, mLastLoadedJulianDay);
        ((MonthByWeekAdapter) mAdapter).setEvents(mFirstLoadedJulianDay,
                mLastLoadedJulianDay - mFirstLoadedJulianDay + 1, events);
    }
}

From source file:KSView.PercentLayoutHelper.java

/**
 * Constructs a PercentLayoutInfo from attributes associated with a View. Call this method from
 * {@code LayoutParams(Context c, AttributeSet attrs)} constructor.
 */// w ww  . java2 s  .  c o m
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);
    LogUtil.d(TAG, "minHeight = " + percentVal);
    if (percentVal != null) {
        checkForInfoExists(info);
        info.minHeightPercent = percentVal;
    }

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

From source file:com.example.percentlayout.view.PercentLayoutHelper.java

/**
 * Constructs a PercentLayoutInfo from attributes associated with a View. Call this method from
 * {@code LayoutParams(Context c, AttributeSet attrs)} constructor.
 *//*w  w  w .  j a  va 2 s. c  o m*/
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.irccloud.android.IRCCloudApplicationBase.java

@Override
public void onLowMemory() {
    super.onLowMemory();
    if (!NetworkConnection.getInstance().isVisible()) {
        Crashlytics.log(Log.DEBUG, "IRCCloud",
                "Received low memory warning in the background, cleaning backlog in all buffers");
        BuffersList buffersList = BuffersList.getInstance();
        EventsList eventsList = EventsList.getInstance();
        for (Buffer b : buffersList.getBuffers()) {
            if (!b.getScrolledUp())
                eventsList.pruneEvents(b.getBid());
        }/* w  w w.j ava2s. c om*/
    }
}