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.android.mms.ui.ComposeMessageActivity.java

private void saveDraft(boolean isStopping) {
    if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
        LogTag.debug("saveDraft");
    }//  www. j  a v  a  2s.c  o m
    // TODO: Do something better here.  Maybe make discard() legal
    // to call twice and make isEmpty() return true if discarded
    // so it is caught in the clause above this one?
    if (mWorkingMessage.isDiscarded()) {
        return;
    }

    if (!mWaitingForSubActivity && !mWorkingMessage.isWorthSaving()
            && (!isRecipientsEditorVisible() || recipientCount() == 0)) {
        if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
            log("not worth saving, discard WorkingMessage and bail");
        }
        mWorkingMessage.discard();
        return;
    }

    mWorkingMessage.saveDraft(isStopping);

    if (mToastForDraftSave) {
        Toast.makeText(this, R.string.message_saved_as_draft, Toast.LENGTH_SHORT).show();
    }
}

From source file:com.android.mms.ui.ComposeMessageActivity.java

private void resetMessage() {
    if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
        log("resetMessage");
    }/*from  w  w w  .  j a va2  s .  c o  m*/

    // Make the attachment editor hide its view.
    mAttachmentEditor.hideView();
    mAttachmentEditorScrollView.setVisibility(View.GONE);

    // Hide the subject editor.
    showSubjectEditor(false);

    // Focus to the text editor.
    mTextEditor.requestFocus();

    // We have to remove the text change listener while the text editor gets cleared and
    // we subsequently turn the message back into SMS. When the listener is listening while
    // doing the clearing, it's fighting to update its counts and itself try and turn
    // the message one way or the other.
    mTextEditor.removeTextChangedListener(mTextEditorWatcher);

    // Clear the text box.
    TextKeyListener.clear(mTextEditor.getText());

    mWorkingMessage.clearConversation(mConversation, false);
    mWorkingMessage = WorkingMessage.createEmpty(this);
    mWorkingMessage.setConversation(mConversation);

    hideRecipientEditor();
    drawBottomPanel();

    // "Or not", in this case.
    updateSendButtonState();

    // Our changes are done. Let the listener respond to text changes once again.
    mTextEditor.addTextChangedListener(mTextEditorWatcher);

    // Close the soft on-screen keyboard if we're in landscape mode so the user can see the
    // conversation.
    if (mIsLandscape) {
        hideKeyboard();
    }

    mLastRecipientCount = 0;
    mSendingMessage = false;
    invalidateOptionsMenu();
}

From source file:com.android.mms.ui.ComposeMessageActivity.java

/**
 * smoothScrollToEnd will scroll the message list to the bottom if the list is already near
 * the bottom. Typically this is called to smooth scroll a newly received message into view.
 * It's also called when sending to scroll the list to the bottom, regardless of where it is,
 * so the user can see the just sent message. This function is also called when the message
 * list view changes size because the keyboard state changed or the compose message field grew.
 *
 * @param force always scroll to the bottom regardless of current list position
 * @param listSizeChange the amount the message list view size has vertically changed
 *///from   www.  j av  a 2 s. co  m
private void smoothScrollToEnd(boolean force, int listSizeChange) {
    int lastItemVisible = mMsgListView.getLastVisiblePosition();
    int lastItemInList = mMsgListAdapter.getCount() - 1;
    if (lastItemVisible < 0 || lastItemInList < 0) {
        if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
            Log.v(TAG, "smoothScrollToEnd: lastItemVisible=" + lastItemVisible + ", lastItemInList="
                    + lastItemInList + ", mMsgListView not ready");
        }
        return;
    }

    View lastChildVisible = mMsgListView.getChildAt(lastItemVisible - mMsgListView.getFirstVisiblePosition());
    int lastVisibleItemBottom = 0;
    int lastVisibleItemHeight = 0;
    if (lastChildVisible != null) {
        lastVisibleItemBottom = lastChildVisible.getBottom();
        lastVisibleItemHeight = lastChildVisible.getHeight();
    }

    if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
        Log.v(TAG, "smoothScrollToEnd newPosition: " + lastItemInList + " mLastSmoothScrollPosition: "
                + mLastSmoothScrollPosition + " first: " + mMsgListView.getFirstVisiblePosition()
                + " lastItemVisible: " + lastItemVisible + " lastVisibleItemBottom: " + lastVisibleItemBottom
                + " lastVisibleItemBottom + listSizeChange: " + (lastVisibleItemBottom + listSizeChange)
                + " mMsgListView.getHeight() - mMsgListView.getPaddingBottom(): "
                + (mMsgListView.getHeight() - mMsgListView.getPaddingBottom()) + " listSizeChange: "
                + listSizeChange);
    }
    // Only scroll if the list if we're responding to a newly sent message (force == true) or
    // the list is already scrolled to the end. This code also has to handle the case where
    // the listview has changed size (from the keyboard coming up or down or the message entry
    // field growing/shrinking) and it uses that grow/shrink factor in listSizeChange to
    // compute whether the list was at the end before the resize took place.
    // For example, when the keyboard comes up, listSizeChange will be negative, something
    // like -524. The lastChild listitem's bottom value will be the old value before the
    // keyboard became visible but the size of the list will have changed. The test below
    // add listSizeChange to bottom to figure out if the old position was already scrolled
    // to the bottom. We also scroll the list if the last item is taller than the size of the
    // list. This happens when the keyboard is up and the last item is an mms with an
    // attachment thumbnail, such as picture. In this situation, we want to scroll the list so
    // the bottom of the thumbnail is visible and the top of the item is scroll off the screen.
    int listHeight = mMsgListView.getHeight();
    boolean lastItemTooTall = lastVisibleItemHeight > listHeight;
    boolean willScroll = force || ((listSizeChange != 0 || lastItemInList != mLastSmoothScrollPosition)
            && lastVisibleItemBottom + listSizeChange <= listHeight - mMsgListView.getPaddingBottom());
    if (willScroll || (lastItemTooTall && lastItemInList == lastItemVisible)) {
        if (Math.abs(listSizeChange) > SMOOTH_SCROLL_THRESHOLD) {
            // When the keyboard comes up, the window manager initiates a cross fade
            // animation that conflicts with smooth scroll. Handle that case by jumping the
            // list directly to the end.
            if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
                Log.v(TAG, "keyboard state changed. setSelection=" + lastItemInList);
            }
            if (lastItemTooTall) {
                // If the height of the last item is taller than the whole height of the list,
                // we need to scroll that item so that its top is negative or above the top of
                // the list. That way, the bottom of the last item will be exposed above the
                // keyboard.
                mMsgListView.setSelectionFromTop(lastItemInList, listHeight - lastVisibleItemHeight);
            } else {
                mMsgListView.setSelection(lastItemInList);
            }
        } else if (lastItemInList - lastItemVisible > MAX_ITEMS_TO_INVOKE_SCROLL_SHORTCUT) {
            if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
                Log.v(TAG, "too many to scroll, setSelection=" + lastItemInList);
            }
            mMsgListView.setSelection(lastItemInList);
        } else {
            if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
                Log.v(TAG, "smooth scroll to " + lastItemInList);
            }
            if (lastItemTooTall) {
                // If the height of the last item is taller than the whole height of the list,
                // we need to scroll that item so that its top is negative or above the top of
                // the list. That way, the bottom of the last item will be exposed above the
                // keyboard. We should use smoothScrollToPositionFromTop here, but it doesn't
                // seem to work -- the list ends up scrolling to a random position.
                mMsgListView.setSelectionFromTop(lastItemInList, listHeight - lastVisibleItemHeight);
            } else {
                mMsgListView.smoothScrollToPosition(lastItemInList);
            }
            mLastSmoothScrollPosition = lastItemInList;
        }
    }
}

From source file:com.android.mms.ui.ComposeMessageActivity.java

@Override
public void onUpdate(final Contact updated) {
    // Using an existing handler for the post, rather than conjuring up a new one.
    mMessageListItemHandler.post(new Runnable() {
        @Override/*from w  w  w . ja  va2s .co m*/
        public void run() {
            ContactList recipients = isRecipientsEditorVisible()
                    ? mRecipientsEditor.constructContactsFromInput(false)
                    : getRecipients();
            if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
                log("[CMA] onUpdate contact updated: " + updated);
                log("[CMA] onUpdate recipients: " + recipients);
            }
            updateTitle(recipients);

            // The contact information for one (or more) of the recipients has changed.
            // Rebuild the message list so each MessageItem will get the last contact info.
            ComposeMessageActivity.this.mMsgListAdapter.notifyDataSetChanged();

            // Don't do this anymore. When we're showing chips, we don't want to switch from
            // chips to text.
            //                if (mRecipientsEditor != null) {
            //                    mRecipientsEditor.populate(recipients);
            //                }
        }
    });
}