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

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    setIntent(intent);/* w  ww  .  ja va 2  s .c  o m*/

    Conversation conversation = null;
    mSentMessage = false;

    // If we have been passed a thread_id, use that to find our
    // conversation.

    // Note that originalThreadId might be zero but if this is a draft and we save the
    // draft, ensureThreadId gets called async from WorkingMessage.asyncUpdateDraftSmsMessage
    // the thread will get a threadId behind the UI thread's back.
    long originalThreadId = mConversation.getThreadId();
    long threadId = intent.getLongExtra(THREAD_ID, 0);
    Uri intentUri = intent.getData();

    boolean sameThread = false;
    if (threadId > 0) {
        conversation = Conversation.get(this, threadId, false);
    } else {
        if (mConversation.getThreadId() == 0) {
            // We've got a draft. Make sure the working recipients are synched
            // to the conversation so when we compare conversations later in this function,
            // the compare will work.
            mWorkingMessage.syncWorkingRecipients();
        }
        // Get the "real" conversation based on the intentUri. The intentUri might specify
        // the conversation by a phone number or by a thread id. We'll typically get a threadId
        // based uri when the user pulls down a notification while in ComposeMessageActivity and
        // we end up here in onNewIntent. mConversation can have a threadId of zero when we're
        // working on a draft. When a new message comes in for that same recipient, a
        // conversation will get created behind CMA's back when the message is inserted into
        // the database and the corresponding entry made in the threads table. The code should
        // use the real conversation as soon as it can rather than finding out the threadId
        // when sending with "ensureThreadId".
        conversation = Conversation.get(this, intentUri, false);
    }

    if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
        log("onNewIntent: data=" + intentUri + ", thread_id extra is " + threadId + ", new conversation="
                + conversation + ", mConversation=" + mConversation);
    }

    // this is probably paranoid to compare both thread_ids and recipient lists,
    // but we want to make double sure because this is a last minute fix for Froyo
    // and the previous code checked thread ids only.
    // (we cannot just compare thread ids because there is a case where mConversation
    // has a stale/obsolete thread id (=1) that could collide against the new thread_id(=1),
    // even though the recipient lists are different)
    sameThread = ((conversation.getThreadId() == mConversation.getThreadId()
            || mConversation.getThreadId() == 0) && conversation.equals(mConversation));

    if (sameThread) {
        log("onNewIntent: same conversation");
        if (mConversation.getThreadId() == 0) {
            mConversation = conversation;
            mWorkingMessage.setConversation(mConversation);
            updateThreadIdIfRunning();
            invalidateOptionsMenu();
        }
    } else {
        if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
            log("onNewIntent: different conversation");
        }
        saveDraft(false); // if we've got a draft, save it first

        initialize(null, originalThreadId);
    }
    loadMessagesAndDraft(0);
}

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

@Override
protected void onStart() {
    super.onStart();
    boolean isSmsEnabled = MmsConfig.isSmsEnabled(this);
    if (isSmsEnabled != mIsSmsEnabled) {
        mIsSmsEnabled = isSmsEnabled;/*from   w w  w .  ja  v  a2 s . com*/
        invalidateOptionsMenu();
    }

    initFocus();

    // Register a BroadcastReceiver to listen on HTTP I/O process.
    registerReceiver(mHttpProgressReceiver, mHttpProgressFilter);

    registerReceiver(mDelayedSendProgressReceiver, DELAYED_SEND_COUNTDOWN_FILTER);

    // figure out whether we need to show the keyboard or not.
    // if there is draft to be loaded for 'mConversation', we'll show the keyboard;
    // otherwise we hide the keyboard. In any event, delay loading
    // message history and draft (controlled by DEFER_LOADING_MESSAGES_AND_DRAFT).
    int mode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;

    if (DraftCache.getInstance().hasDraft(mConversation.getThreadId())) {
        mode |= WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE;
    } else if (mConversation.getThreadId() <= 0) {
        // For composing a new message, bring up the softkeyboard so the user can
        // immediately enter recipients. This call won't do anything on devices with
        // a hard keyboard.
        mode |= WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE;
    } else {
        mode |= WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN;
    }

    getWindow().setSoftInputMode(mode);

    // reset mMessagesAndDraftLoaded
    mMessagesAndDraftLoaded = false;
    long threadId = mWorkingMessage.getConversation().getThreadId();
    // Same recipient for ForwardMms will not load draft
    if (MessageUtils.sSameRecipientList.contains(threadId)) {
        mShouldLoadDraft = false;
    }

    if (!DEFER_LOADING_MESSAGES_AND_DRAFT) {
        loadMessagesAndDraft(1);
    } else {
        // HACK: force load messages+draft after max delay, if it's not already loaded.
        // this is to work around when coming out of sleep mode. WindowManager behaves
        // strangely and hides the keyboard when it should be shown, or sometimes initially
        // shows it when we want to hide it. In that case, we never get the onSizeChanged()
        // callback w/ keyboard shown, so we wouldn't know to load the messages+draft.
        mHandler.postDelayed(new Runnable() {
            public void run() {
                loadMessagesAndDraft(2);
            }
        }, LOADING_MESSAGES_AND_DRAFT_MAX_DELAY_MS);
    }

    // Update the fasttrack info in case any of the recipients' contact info changed
    // while we were paused. This can happen, for example, if a user changes or adds
    // an avatar associated with a contact.
    mWorkingMessage.syncWorkingRecipients();

    if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
        log("update title, mConversation=" + mConversation.toString());
    }

    updateTitle(mConversation.getRecipients());

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
}

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

/**
 * Load message history and draft. This method should be called from main thread.
 * @param debugFlag shows where this is being called from
 *///from w w w. ja  v  a  2 s .c om
private void loadMessagesAndDraft(int debugFlag) {
    if (!mSendDiscreetMode && !mMessagesAndDraftLoaded) {
        if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
            Log.v(TAG, "### CMA.loadMessagesAndDraft: flag=" + debugFlag);
        }
        loadMessageContent();
        boolean drawBottomPanel = true;
        if (mShouldLoadDraft) {
            if (loadDraft()) {
                drawBottomPanel = false;
            }
        }
        if (drawBottomPanel) {
            drawBottomPanel();
        }
        mMessagesAndDraftLoaded = true;
    }
}

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

@Override
protected void onResume() {
    super.onResume();

    // OLD: get notified of presence updates to update the titlebar.
    // NEW: we are using ContactHeaderWidget which displays presence, but updating presence
    //      there is out of our control.
    //Contact.startPresenceObserver();

    addRecipientsListeners();//w ww  .  j  a v a2  s.  c o m

    if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
        log("update title, mConversation=" + mConversation.toString());
    }

    // There seems to be a bug in the framework such that setting the title
    // here gets overwritten to the original title.  Do this delayed as a
    // workaround.
    mMessageListItemHandler.postDelayed(new Runnable() {
        @Override
        public void run() {
            ContactList recipients = isRecipientsEditorVisible()
                    ? mRecipientsEditor.constructContactsFromInput(false)
                    : getRecipients();
            updateTitle(recipients);
        }
    }, 100);

    // Load the selected input type
    SharedPreferences prefs = PreferenceManager
            .getDefaultSharedPreferences((Context) ComposeMessageActivity.this);
    mInputMethod = Integer.parseInt(prefs.getString(MessagingPreferenceActivity.INPUT_TYPE,
            Integer.toString(InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE)));
    mTextEditor.setInputType(InputType.TYPE_CLASS_TEXT | mInputMethod | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT
            | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE);

    TelephonyManager tm = (TelephonyManager) getSystemService(Service.TELEPHONY_SERVICE);
    if (MessagingPreferenceActivity.getSmartCallEnabled((Context) ComposeMessageActivity.this)
            && tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
        mMultiSensorManager.enable();
    }

    mIsRunning = true;
    updateThreadIdIfRunning();
    mConversation.markAsRead(true);
}

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

@Override
protected void onPause() {
    super.onPause();

    if (DEBUG) {/*  w  w w . j a  v  a 2s  .c  o m*/
        Log.v(TAG, "onPause: setCurrentlyDisplayedThreadId: " + MessagingNotification.THREAD_NONE);
    }
    MessagingNotification.setCurrentlyDisplayedThreadId(MessagingNotification.THREAD_NONE);

    // OLD: stop getting notified of presence updates to update the titlebar.
    // NEW: we are using ContactHeaderWidget which displays presence, but updating presence
    //      there is out of our control.
    //Contact.stopPresenceObserver();

    removeRecipientsListeners();

    if (MessagingPreferenceActivity.getSmartCallEnabled((Context) ComposeMessageActivity.this)) {
        mMultiSensorManager.disable();
    }

    // remove any callback to display a progress spinner
    if (mAsyncDialog != null) {
        mAsyncDialog.clearPendingProgressDialog();
    }

    // Remember whether the list is scrolled to the end when we're paused so we can rescroll
    // to the end when resumed.
    if (mMsgListAdapter != null && mMsgListView.getLastVisiblePosition() >= mMsgListAdapter.getCount() - 1) {
        mSavedScrollPosition = Integer.MAX_VALUE;
    } else {
        mSavedScrollPosition = mMsgListView.getFirstVisiblePosition();
    }
    if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
        Log.v(TAG, "onPause: mSavedScrollPosition=" + mSavedScrollPosition);
    }

    mConversation.markAsRead(true);
    mIsRunning = false;
}

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

@Override
protected void onStop() {
    super.onStop();

    // No need to do the querying when finished this activity
    mBackgroundQueryHandler.cancelOperation(MESSAGE_LIST_QUERY_TOKEN);

    // Allow any blocked calls to update the thread's read status.
    mConversation.blockMarkAsRead(false);

    if (mMsgListAdapter != null) {
        // Close the cursor in the ListAdapter if the activity stopped.
        Cursor cursor = mMsgListAdapter.getCursor();

        if (cursor != null && !cursor.isClosed()) {
            cursor.close();/*from  w  w w  .j a  va2  s .  com*/
        }

        mMsgListAdapter.changeCursor(null);
        mMsgListAdapter.cancelBackgroundLoading();
    }

    if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
        log("save draft");
    }
    saveDraft(true);

    // set 'mShouldLoadDraft' to true, so when coming back to ComposeMessageActivity, we would
    // load the draft, unless we are coming back to the activity after attaching a photo, etc,
    // in which case we should set 'mShouldLoadDraft' to false.
    mShouldLoadDraft = true;

    // Cleanup the BroadcastReceiver.
    unregisterReceiver(mHttpProgressReceiver);
    unregisterReceiver(mDelayedSendProgressReceiver);
}

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

private void addImage(Uri uri, boolean append) {
    if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
        log("addImage: append=" + append + ", uri=" + uri);
    }/*from w  w w  .j a  v  a 2  s .c  om*/

    int result = mWorkingMessage.setAttachment(WorkingMessage.IMAGE, uri, append);

    if (result == WorkingMessage.IMAGE_TOO_LARGE || result == WorkingMessage.MESSAGE_SIZE_EXCEEDED) {
        if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
            log("resize image " + uri);
        }
        MessageUtils.resizeImageAsync(ComposeMessageActivity.this, uri, mAttachmentEditorHandler,
                mResizeImageCallback, append);
        return;
    }
    handleAddAttachmentError(result, R.string.type_picture);
}

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

/**
 * Initialize all UI elements from resources.
 *//*from  w  ww. j  a v  a  2s .  c o  m*/
private void initResourceRefs() {
    mMsgListView = (MessageListView) findViewById(R.id.history);
    mMsgListView.setDivider(null); // no divider so we look like IM conversation.

    // called to enable us to show some padding between the message list and the
    // input field but when the message list is scrolled that padding area is filled
    // in with message content
    mMsgListView.setClipToPadding(false);

    mMsgListView.setOnSizeChangedListener(new OnSizeChangedListener() {
        public void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
            if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
                Log.v(TAG, "onSizeChanged: w=" + width + " h=" + height + " oldw=" + oldWidth + " oldh="
                        + oldHeight);
            }

            if (!mMessagesAndDraftLoaded && (oldHeight - height > SMOOTH_SCROLL_THRESHOLD)) {
                // perform the delayed loading now, after keyboard opens
                loadMessagesAndDraft(3);
            }

            // The message list view changed size, most likely because the keyboard
            // appeared or disappeared or the user typed/deleted chars in the message
            // box causing it to change its height when expanding/collapsing to hold more
            // lines of text.
            smoothScrollToEnd(false, height - oldHeight);
        }
    });

    mBottomPanel = findViewById(R.id.bottom_panel);
    mTextEditor = (EditText) findViewById(R.id.embedded_text_editor);
    mTextEditor.setOnEditorActionListener(this);
    mTextEditor.addTextChangedListener(mTextEditorWatcher);
    mTextEditor.setFilters(new InputFilter[] { new LengthFilter(MmsConfig.getMaxTextLimit()) });
    mTextCounter = (TextView) findViewById(R.id.text_counter);
    mSendButtonMms = (TextView) findViewById(R.id.send_button_mms);
    mSendButtonSms = (ImageButton) findViewById(R.id.send_button_sms);
    mSendButtonMms.setOnClickListener(this);
    mSendButtonSms.setOnClickListener(this);
    mTopPanel = findViewById(R.id.recipients_subject_linear);
    mTopPanel.setFocusable(false);
    mAttachmentEditor = (AttachmentEditor) findViewById(R.id.attachment_editor);
    mAttachmentEditor.setHandler(mAttachmentEditorHandler);
    mAttachmentEditorScrollView = findViewById(R.id.attachment_editor_scroll_view);
}

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

private void startMsgListQuery(int token) {
    if (mSendDiscreetMode) {
        return;/*from  w  w w.j a va  2 s . co  m*/
    }
    Uri conversationUri = mConversation.getUri();

    if (conversationUri == null) {
        log("##### startMsgListQuery: conversationUri is null, bail!");
        return;
    }

    long threadId = mConversation.getThreadId();
    if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
        log("startMsgListQuery for " + conversationUri + ", threadId=" + threadId + " token: " + token
                + " mConversation: " + mConversation);
    }

    // Cancel any pending queries
    mBackgroundQueryHandler.cancelOperation(token);
    try {
        // Kick off the new query
        mBackgroundQueryHandler.startQuery(token, threadId /* cookie */, conversationUri, PROJECTION, null,
                null, null);
    } catch (SQLiteException e) {
        SqliteWrapper.checkSQLiteException(this, e);
    }
}

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

/**
 * Load the draft//from w  w w  . j  av  a  2  s.  c  o m
 *
 * If mWorkingMessage has content in memory that's worth saving, return false.
 * Otherwise, call the async operation to load draft and return true.
 */
private boolean loadDraft() {
    if (mWorkingMessage.isWorthSaving()) {
        Log.w(TAG, "CMA.loadDraft: called with non-empty working message, bail");
        return false;
    }

    if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
        log("CMA.loadDraft");
    }

    mWorkingMessage = WorkingMessage.loadDraft(this, mConversation, new Runnable() {
        @Override
        public void run() {
            // It decides whether or not to display the subject editText view,
            // according to the situation whether there's subject
            // or the editText view is visible before leaving it.
            drawTopPanel(isSubjectEditorVisible());
            drawBottomPanel();
            updateSendButtonState();
        }
    });

    // WorkingMessage.loadDraft() can return a new WorkingMessage object that doesn't
    // have its conversation set. Make sure it is set.
    mWorkingMessage.setConversation(mConversation);

    return true;
}