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.providers.contacts.ContactsSyncAdapter.java

public static void updateSubscribedFeeds(ContentResolver cr, String account) {
    Set<String> feedsToSync = Sets.newHashSet();
    feedsToSync.add(getGroupsFeedForAccount(account));
    addContactsFeedsToSync(cr, account, feedsToSync);

    Cursor c = SubscribedFeeds.Feeds.query(cr, sSubscriptionProjection,
            SubscribedFeeds.Feeds.AUTHORITY + "=? AND " + SubscribedFeeds.Feeds._SYNC_ACCOUNT + "=?",
            new String[] { Contacts.AUTHORITY, account }, null);
    try {//from  ww w .  j a  v  a2s. c o m
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "scanning over subscriptions with authority " + Contacts.AUTHORITY + " and account "
                    + account);
        }
        c.moveToNext();
        while (!c.isAfterLast()) {
            String feedInCursor = c.getString(1);
            if (feedsToSync.contains(feedInCursor)) {
                feedsToSync.remove(feedInCursor);
                c.moveToNext();
            } else {
                c.deleteRow();
            }
        }
        c.commitUpdates();
    } finally {
        c.close();
    }

    // any feeds remaining in feedsToSync need a subscription
    for (String feed : feedsToSync) {
        SubscribedFeeds.addFeed(cr, feed, account, Contacts.AUTHORITY, ContactsClient.SERVICE);

        // request a sync of this feed
        Bundle extras = new Bundle();
        extras.putString(ContentResolver.SYNC_EXTRAS_ACCOUNT, account);
        extras.putString("feed", feed);
        cr.startSync(Contacts.CONTENT_URI, extras);
    }
}

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

public static Uri saveBitmapAsPart(Context context, Uri messageUri, Bitmap bitmap) throws MmsException {

    ByteArrayOutputStream os = new ByteArrayOutputStream();
    bitmap.compress(CompressFormat.JPEG, IMAGE_COMPRESSION_QUALITY, os);

    PduPart part = new PduPart();

    part.setContentType("image/jpeg".getBytes());
    String contentId = "Image" + System.currentTimeMillis();
    part.setContentLocation((contentId + ".jpg").getBytes());
    part.setContentId(contentId.getBytes());
    part.setData(os.toByteArray());//from www .  j  a v  a2s  .  c  om

    Uri retVal = PduPersister.getPduPersister(context).persistPart(part, ContentUris.parseId(messageUri), null);

    if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
        log("saveBitmapAsPart: persisted part with uri=" + retVal);
    }

    return retVal;
}

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

/**
 * Looks to see if there are any valid parts of the attachment that can be copied to a SD card.
 * @param msgId// w ww .ja  v a  2 s  .c  om
 */
private boolean haveSomethingToCopyToSDCard(long msgId) {
    PduBody body = null;
    try {
        body = SlideshowModel.getPduBody(this, ContentUris.withAppendedId(Mms.CONTENT_URI, msgId));
    } catch (MmsException e) {
        Log.e(TAG, "haveSomethingToCopyToSDCard can't load pdu body: " + msgId);
    }
    if (body == null) {
        return false;
    }

    boolean result = false;
    int partNum = body.getPartsNum();
    for (int i = 0; i < partNum; i++) {
        PduPart part = body.getPart(i);
        String type = new String(part.getContentType());

        if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
            log("[CMA] haveSomethingToCopyToSDCard: part[" + i + "] contentType=" + type);
        }

        if (ContentType.isImageType(type) || ContentType.isVideoType(type) || ContentType.isAudioType(type)
                || DrmUtils.isDrmType(type)) {
            result = true;
            break;
        }
    }
    return result;
}

From source file:android.app.FragmentManager.java

void restoreAllState(Parcelable state, ArrayList<Fragment> nonConfig) {
    // If there is no saved state at all, then there can not be
    // any nonConfig fragments either, so that is that.
    if (state == null)
        return;/*from  w  ww .  j av a  2  s.  co  m*/
    FragmentManagerState fms = (FragmentManagerState) state;
    if (fms.mActive == null)
        return;

    // First re-attach any non-config instances we are retaining back
    // to their saved state, so we don't try to instantiate them again.
    if (nonConfig != null) {
        for (int i = 0; i < nonConfig.size(); i++) {
            Fragment f = nonConfig.get(i);
            if (DEBUG)
                Log.v(TAG, "restoreAllState: re-attaching retained " + f);
            FragmentState fs = fms.mActive[f.mIndex];
            fs.mInstance = f;
            f.mSavedViewState = null;
            f.mBackStackNesting = 0;
            f.mInLayout = false;
            f.mAdded = false;
            f.mTarget = null;
            if (fs.mSavedFragmentState != null) {
                fs.mSavedFragmentState.setClassLoader(mActivity.getClassLoader());
                f.mSavedViewState = fs.mSavedFragmentState
                        .getSparseParcelableArray(FragmentManagerImpl.VIEW_STATE_TAG);
            }
        }
    }

    // Build the full list of active fragments, instantiating them from
    // their saved state.
    mActive = new ArrayList<Fragment>(fms.mActive.length);
    if (mAvailIndices != null) {
        mAvailIndices.clear();
    }
    for (int i = 0; i < fms.mActive.length; i++) {
        FragmentState fs = fms.mActive[i];
        if (fs != null) {
            Fragment f = fs.instantiate(mActivity, mParent);
            if (DEBUG)
                Log.v(TAG, "restoreAllState: active #" + i + ": " + f);
            mActive.add(f);
            // Now that the fragment is instantiated (or came from being
            // retained above), clear mInstance in case we end up re-restoring
            // from this FragmentState again.
            fs.mInstance = null;
        } else {
            mActive.add(null);
            if (mAvailIndices == null) {
                mAvailIndices = new ArrayList<Integer>();
            }
            if (DEBUG)
                Log.v(TAG, "restoreAllState: avail #" + i);
            mAvailIndices.add(i);
        }
    }

    // Update the target of all retained fragments.
    if (nonConfig != null) {
        for (int i = 0; i < nonConfig.size(); i++) {
            Fragment f = nonConfig.get(i);
            if (f.mTargetIndex >= 0) {
                if (f.mTargetIndex < mActive.size()) {
                    f.mTarget = mActive.get(f.mTargetIndex);
                } else {
                    Log.w(TAG, "Re-attaching retained fragment " + f + " target no longer exists: "
                            + f.mTargetIndex);
                    f.mTarget = null;
                }
            }
        }
    }

    // Build the list of currently added fragments.
    if (fms.mAdded != null) {
        mAdded = new ArrayList<Fragment>(fms.mAdded.length);
        for (int i = 0; i < fms.mAdded.length; i++) {
            Fragment f = mActive.get(fms.mAdded[i]);
            if (f == null) {
                throwException(
                        new IllegalStateException("No instantiated fragment for index #" + fms.mAdded[i]));
            }
            f.mAdded = true;
            if (DEBUG)
                Log.v(TAG, "restoreAllState: added #" + i + ": " + f);
            if (mAdded.contains(f)) {
                throw new IllegalStateException("Already added!");
            }
            mAdded.add(f);
        }
    } else {
        mAdded = null;
    }

    // Build the back stack.
    if (fms.mBackStack != null) {
        mBackStack = new ArrayList<BackStackRecord>(fms.mBackStack.length);
        for (int i = 0; i < fms.mBackStack.length; i++) {
            BackStackRecord bse = fms.mBackStack[i].instantiate(this);
            if (DEBUG) {
                Log.v(TAG, "restoreAllState: back stack #" + i + " (index " + bse.mIndex + "): " + bse);
                LogWriter logw = new LogWriter(Log.VERBOSE, TAG);
                PrintWriter pw = new PrintWriter(logw);
                bse.dump("  ", pw, false);
            }
            mBackStack.add(bse);
            if (bse.mIndex >= 0) {
                setBackStackIndex(bse.mIndex, bse);
            }
        }
    } else {
        mBackStack = null;
    }
}

From source file:android.app.FragmentManager.java

void restoreAllState(Parcelable state, ArrayList<Fragment> nonConfig) {
    // If there is no saved state at all, then there can not be
    // any nonConfig fragments either, so that is that.
    if (state == null)
        return;// w ww .  j av a2 s  .  co  m
    FragmentManagerState fms = (FragmentManagerState) state;
    if (fms.mActive == null)
        return;

    // First re-attach any non-config instances we are retaining back
    // to their saved state, so we don't try to instantiate them again.
    if (nonConfig != null) {
        for (int i = 0; i < nonConfig.size(); i++) {
            Fragment f = nonConfig.get(i);
            if (DEBUG)
                Log.v(TAG, "restoreAllState: re-attaching retained " + f);
            FragmentState fs = fms.mActive[f.mIndex];
            fs.mInstance = f;
            f.mSavedViewState = null;
            f.mBackStackNesting = 0;
            f.mInLayout = false;
            f.mAdded = false;
            f.mTarget = null;
            if (fs.mSavedFragmentState != null) {
                fs.mSavedFragmentState.setClassLoader(mActivity.getClassLoader());
                f.mSavedViewState = fs.mSavedFragmentState
                        .getSparseParcelableArray(FragmentManagerImpl.VIEW_STATE_TAG);
                f.mSavedFragmentState = fs.mSavedFragmentState;
            }
        }
    }

    // Build the full list of active fragments, instantiating them from
    // their saved state.
    mActive = new ArrayList<Fragment>(fms.mActive.length);
    if (mAvailIndices != null) {
        mAvailIndices.clear();
    }
    for (int i = 0; i < fms.mActive.length; i++) {
        FragmentState fs = fms.mActive[i];
        if (fs != null) {
            Fragment f = fs.instantiate(mActivity, mParent);
            if (DEBUG)
                Log.v(TAG, "restoreAllState: active #" + i + ": " + f);
            mActive.add(f);
            // Now that the fragment is instantiated (or came from being
            // retained above), clear mInstance in case we end up re-restoring
            // from this FragmentState again.
            fs.mInstance = null;
        } else {
            mActive.add(null);
            if (mAvailIndices == null) {
                mAvailIndices = new ArrayList<Integer>();
            }
            if (DEBUG)
                Log.v(TAG, "restoreAllState: avail #" + i);
            mAvailIndices.add(i);
        }
    }

    // Update the target of all retained fragments.
    if (nonConfig != null) {
        for (int i = 0; i < nonConfig.size(); i++) {
            Fragment f = nonConfig.get(i);
            if (f.mTargetIndex >= 0) {
                if (f.mTargetIndex < mActive.size()) {
                    f.mTarget = mActive.get(f.mTargetIndex);
                } else {
                    Log.w(TAG, "Re-attaching retained fragment " + f + " target no longer exists: "
                            + f.mTargetIndex);
                    f.mTarget = null;
                }
            }
        }
    }

    // Build the list of currently added fragments.
    if (fms.mAdded != null) {
        mAdded = new ArrayList<Fragment>(fms.mAdded.length);
        for (int i = 0; i < fms.mAdded.length; i++) {
            Fragment f = mActive.get(fms.mAdded[i]);
            if (f == null) {
                throwException(
                        new IllegalStateException("No instantiated fragment for index #" + fms.mAdded[i]));
            }
            f.mAdded = true;
            if (DEBUG)
                Log.v(TAG, "restoreAllState: added #" + i + ": " + f);
            if (mAdded.contains(f)) {
                throw new IllegalStateException("Already added!");
            }
            mAdded.add(f);
        }
    } else {
        mAdded = null;
    }

    // Build the back stack.
    if (fms.mBackStack != null) {
        mBackStack = new ArrayList<BackStackRecord>(fms.mBackStack.length);
        for (int i = 0; i < fms.mBackStack.length; i++) {
            BackStackRecord bse = fms.mBackStack[i].instantiate(this);
            if (DEBUG) {
                Log.v(TAG, "restoreAllState: back stack #" + i + " (index " + bse.mIndex + "): " + bse);
                LogWriter logw = new LogWriter(Log.VERBOSE, TAG);
                PrintWriter pw = new FastPrintWriter(logw, false, 1024);
                bse.dump("  ", pw, false);
                pw.flush();
            }
            mBackStack.add(bse);
            if (bse.mIndex >= 0) {
                setBackStackIndex(bse.mIndex, bse);
            }
        }
    } else {
        mBackStack = null;
    }
}

From source file:app.umitems.greenclock.widget.sgv.StaggeredGridView.java

/**
 * Calculate and cache the {@link LayoutRecord}s for all positions up to mFirstPosition.
 * mFirstPosition is the position that layout will start from, but we need to know where all
 * views preceding it will be laid out so that mFirstPosition will be laid out at the correct
 * position.  If this is not done, mFirstPosition will be laid out at the first empty space
 * possible (i.e., top left), and this may not be the correct position in the overall layout.
 *
 * This can be optimized if we don't need to guard against jagged edges in the grid or if
 * mFirstChangedPosition is set to a non-zero value (so we can skip calculating some views).
 *///from   w w  w.  j  a  v  a2  s  .c o m
private void calculateLayoutStartOffsets(int offset) {
    // Bail early if we don't guard against jagged edges or if nothing has changed before
    // mFirstPosition.
    // Also check that we're not at the top of the list because sometimes grid padding isn't set
    // until after mItemTops and mItemBottoms arrays have been initialized, so we should
    // go through and compute the right layout start offset for mFirstPosition = 0.
    if (mFirstPosition != 0 && (!mGuardAgainstJaggedEdges || mFirstPosition < mFirstChangedPosition)) {
        // At this time, we know that mItemTops should be the same, because
        // nothing has changed before view at mFirstPosition. The only thing
        // we need to do is to reset mItemBottoms. The result should be the
        // same, if we don't bail early and execute the following code
        // again. Notice that mItemBottoms always equal to mItemTops after
        // this method.
        System.arraycopy(mItemTops, 0, mItemBottoms, 0, mColCount);
        return;
    }

    final int colWidth = (getWidth() - getPaddingLeft() - getPaddingRight() - mItemMargin * (mColCount - 1))
            / mColCount;

    Arrays.fill(mItemTops, getPaddingTop());
    Arrays.fill(mItemBottoms, getPaddingTop());

    // Since we will be doing a pass to calculate all views up to mFirstPosition, it is likely
    // that all existing {@link LayoutRecord}s will be stale, so clear it out to avoid
    // accidentally the re-use of stale values.
    //
    // Note: We cannot just invalidate all layout records after mFirstPosition because it is
    // possible that this layout pass is caused by a down sync from the server that may affect
    // the layout of views from position 0 to mFirstPosition - 1.
    if (mDataChanged) {
        mLayoutRecords.clear();
    }

    for (int i = 0; i < mFirstPosition; i++) {
        LayoutRecord rec = mLayoutRecords.get(i);

        if (mDataChanged || rec == null) {
            final View view = obtainView(i, null);
            final LayoutParams lp = (LayoutParams) view.getLayoutParams();

            final int heightSpec;
            if (lp.height == LayoutParams.WRAP_CONTENT) {
                heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
            } else {
                heightSpec = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.EXACTLY);
            }

            final int span = Math.min(mColCount, lp.span);
            final int widthSize = colWidth * span + mItemMargin * (span - 1);
            final int widthSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY);

            view.measure(widthSpec, heightSpec);
            final int height = view.getMeasuredHeight();

            if (rec == null) {
                rec = new LayoutRecord();
                mLayoutRecords.put(i, rec);
            }

            rec.height = height;
            rec.id = lp.id;
            rec.span = span;

            // We're not actually using this view, so add this back to the recycler.
            mRecycler.addScrap(view);
        }

        int nextColumn = getNextColumnDown();

        // Given the span, check if there's enough space to put this view at this column.
        // IMPORTANT Use the same logic in {@link #layoutChildren}.
        if (rec.span > 1) {
            if (mIsRtlLayout) {
                if (nextColumn + 1 < rec.span) {
                    nextColumn = mColCount - 1;
                }
            } else {
                if (mColCount - nextColumn < rec.span) {
                    nextColumn = 0;
                }
            }
        }
        rec.column = nextColumn;

        // Place the top of this child beneath the last by finding the lowest coordinate across
        // the columns that this child will span.  For LTR layout, we scan across from left to
        // right, and for RTL layout, we scan from right to left.
        // TODO: Consolidate this logic with getNextRecordDown() in the future, as that method
        // already calculates the margins for us.  This will keep the implementation consistent
        // with layoutChildren(), fillUp() and fillDown().
        int lowest = mItemBottoms[nextColumn] + mItemMargin;
        if (rec.span > 1) {
            for (int spanIndex = 0; spanIndex < rec.span; spanIndex++) {
                final int index = mIsRtlLayout ? nextColumn - spanIndex : nextColumn + spanIndex;
                final int bottom = mItemBottoms[index] + mItemMargin;
                if (bottom > lowest) {
                    lowest = bottom;
                }
            }
        }

        for (int spanIndex = 0; spanIndex < rec.span; spanIndex++) {
            final int col = mIsRtlLayout ? nextColumn - spanIndex : nextColumn + spanIndex;
            mItemBottoms[col] = lowest + rec.height;

            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log.v(TAG, " position: " + i + " bottoms: ");
                for (int j = 0; j < mColCount; j++) {
                    Log.v(TAG, "    mItemBottoms[" + j + "]: " + mItemBottoms[j]);
                }
            }
        }
    }

    // mItemBottoms[] at this point contains the values of all views up to mFirstPosition.  To
    // figure out where view at mFirstPosition will be laid out, we'll need to find the column
    // that is the highest (i.e., i where mItemBottoms[i] <= mItemBottoms[j] for all j
    // from 0 to mColCount.)
    int highestValue = Integer.MAX_VALUE;
    for (int k = 0; k < mColCount; k++) {
        if (mItemBottoms[k] < highestValue) {
            highestValue = mItemBottoms[k];
        }
    }

    // Adjust the offsets in each column so that values in mItemTops[] and mItemBottoms[]
    // reflect coordinates on screen.  These offsets will be the actual values where layout
    // will start from, otherwise, we'd naively start at (leftPadding, topPadding) for
    // mFirstPosition.
    for (int k = 0; k < mColCount; k++) {
        mItemBottoms[k] = mItemBottoms[k] - highestValue + offset;
        mItemTops[k] = mItemBottoms[k];

        // Log.v(TAG, "Adjusting to offset = mItemBottoms[" + k + "]: " + mItemBottoms[k]);
    }
}

From source file:se.oort.clockify.widget.sgv.StaggeredGridView.java

/**
 * Calculate and cache the {@link LayoutRecord}s for all positions up to mFirstPosition.
 * mFirstPosition is the position that layout will start from, but we need to know where all
 * views preceding it will be laid out so that mFirstPosition will be laid out at the correct
 * position.  If this is not done, mFirstPosition will be laid out at the first empty space
 * possible (i.e., top left), and this may not be the correct position in the overall layout.
 *
 * This can be optimized if we don't need to guard against jagged edges in the grid or if
 * mFirstChangedPosition is set to a non-zero value (so we can skip calculating some views).
 *///from  w ww.  j a va  2s . co m
private void calculateLayoutStartOffsets(int offset) {
    // Bail early if we don't guard against jagged edges or if nothing has changed before
    // mFirstPosition.
    // Also check that we're not at the top of the list because sometimes grid padding isn't set
    // until after mItemTops and mItemBottoms arrays have been initialized, so we should
    // go through and compute the right layout start offset for mFirstPosition = 0.
    if (mFirstPosition != 0 && (!mGuardAgainstJaggedEdges || mFirstPosition < mFirstChangedPosition)) {
        // At this time, we know that mItemTops should be the same, because
        // nothing has changed before view at mFirstPosition. The only thing
        // we need to do is to reset mItemBottoms. The result should be the
        // same, if we don't bail early and execute the following code
        // again. Notice that mItemBottoms always equal to mItemTops after
        // this method.
        System.arraycopy(mItemTops, 0, mItemBottoms, 0, mColCount);
        return;
    }

    final int colWidth = (getWidth() - getPaddingLeft() - getPaddingRight() - mItemMargin * (mColCount - 1))
            / mColCount;

    Arrays.fill(mItemTops, getPaddingTop());
    Arrays.fill(mItemBottoms, getPaddingTop());

    // Since we will be doing a pass to calculate all views up to mFirstPosition, it is likely
    // that all existing {@link LayoutRecord}s will be stale, so clear it out to avoid
    // accidentally the re-use of stale values.
    //
    // Note: We cannot just invalidate all layout records after mFirstPosition because it is
    // possible that this layout pass is caused by a down sync from the server that may affect
    // the layout of views from position 0 to mFirstPosition - 1.
    if (mDataChanged) {
        mLayoutRecords.clear();
    }

    for (int i = 0; i < mFirstPosition; i++) {
        LayoutRecord rec = mLayoutRecords.get(i);

        if (mDataChanged || rec == null) {
            final View view = obtainView(i, null);
            final LayoutParams lp = (LayoutParams) view.getLayoutParams();

            final int heightSpec;
            if (lp.height == LayoutParams.WRAP_CONTENT) {
                heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
            } else {
                heightSpec = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.EXACTLY);
            }

            final int span = Math.min(mColCount, lp.span);
            final int widthSize = colWidth * span + mItemMargin * (span - 1);
            final int widthSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY);

            view.measure(widthSpec, heightSpec);
            final int height = view.getMeasuredHeight();

            if (rec == null) {
                rec = new LayoutRecord();
                mLayoutRecords.put(i, rec);
            }

            rec.height = height;
            rec.id = lp.id;
            rec.span = span;

            // We're not actually using this view, so add this back to the recycler.
            mRecycler.addScrap(view);
        }

        int nextColumn = getNextColumnDown();

        // Given the span, check if there's enough space to put this view at this column.
        // IMPORTANT Use the same logic in {@link #layoutChildren}.
        if (rec.span > 1) {
            if (mIsRtlLayout) {
                if (nextColumn + 1 < rec.span) {
                    nextColumn = mColCount - 1;
                }
            } else {
                if (mColCount - nextColumn < rec.span) {
                    nextColumn = 0;
                }
            }
        }
        rec.column = nextColumn;

        // Place the top of this child beneath the last by finding the lowest coordinate across
        // the columns that this child will span.  For LTR layout, we scan across from left to
        // right, and for RTL layout, we scan from right to left.
        // TODO: Consolidate this logic with getNextRecordDown() in the future, as that method
        // already calculates the margins for us.  This will keep the implementation consistent
        // with layoutChildren(), fillUp() and fillDown().
        int lowest = mItemBottoms[nextColumn] + mItemMargin;
        if (rec.span > 1) {
            for (int spanIndex = 0; spanIndex < rec.span; spanIndex++) {
                final int index = mIsRtlLayout ? nextColumn - spanIndex : nextColumn + spanIndex;
                final int bottom = mItemBottoms[index] + mItemMargin;
                if (bottom > lowest) {
                    lowest = bottom;
                }
            }
        }

        for (int spanIndex = 0; spanIndex < rec.span; spanIndex++) {
            final int col = mIsRtlLayout ? nextColumn - spanIndex : nextColumn + spanIndex;
            mItemBottoms[col] = lowest + rec.height;

            if (Log.isLoggable(LOG_TAG, Log.VERBOSE)) {
                Log.v(LOG_TAG, " position: " + i + " bottoms: ");
                for (int j = 0; j < mColCount; j++) {
                    Log.v(LOG_TAG, "    mItemBottoms[" + j + "]: " + mItemBottoms[j]);
                }
            }
        }
    }

    // mItemBottoms[] at this point contains the values of all views up to mFirstPosition.  To
    // figure out where view at mFirstPosition will be laid out, we'll need to find the column
    // that is the highest (i.e., i where mItemBottoms[i] <= mItemBottoms[j] for all j
    // from 0 to mColCount.)
    int highestValue = Integer.MAX_VALUE;
    for (int k = 0; k < mColCount; k++) {
        if (mItemBottoms[k] < highestValue) {
            highestValue = mItemBottoms[k];
        }
    }

    // Adjust the offsets in each column so that values in mItemTops[] and mItemBottoms[]
    // reflect coordinates on screen.  These offsets will be the actual values where layout
    // will start from, otherwise, we'd naively start at (leftPadding, topPadding) for
    // mFirstPosition.
    for (int k = 0; k < mColCount; k++) {
        mItemBottoms[k] = mItemBottoms[k] - highestValue + offset;
        mItemTops[k] = mItemBottoms[k];

        // Log.v(TAG, "Adjusting to offset = mItemBottoms[" + k + "]: " + mItemBottoms[k]);
    }
}

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

private void showSubjectEditor(boolean show) {
    if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
        log("" + show);
    }/*from   w w  w  .ja v  a2s .c  o  m*/

    if (mSubjectTextEditor == null) {
        // Don't bother to initialize the subject editor if
        // we're just going to hide it.
        if (show == false) {
            return;
        }
        mSubjectTextEditor = (EditText) findViewById(R.id.subject);
        mSubjectTextEditor.setFilters(new InputFilter[] { new LengthFilter(MmsConfig.getMaxSubjectLength()) });
    }

    mSubjectTextEditor.setOnKeyListener(show ? mSubjectKeyListener : null);

    if (show) {
        mSubjectTextEditor.addTextChangedListener(mSubjectEditorWatcher);
    } else {
        mSubjectTextEditor.removeTextChangedListener(mSubjectEditorWatcher);
    }

    mSubjectTextEditor.setText(mWorkingMessage.getSubject());
    mSubjectTextEditor.setVisibility(show ? View.VISIBLE : View.GONE);
    hideOrShowTopPanel();
}

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

public void initialize(Bundle savedInstanceState, long originalThreadId) {
    // Create a new empty working message.
    mWorkingMessage = WorkingMessage.createEmpty(this);

    // Read parameters or previously saved state of this activity. This will load a new
    // mConversation
    initActivityState(savedInstanceState);

    if (LogTag.SEVERE_WARNING && originalThreadId != 0 && originalThreadId == mConversation.getThreadId()) {
        LogTag.warnPossibleRecipientMismatch(
                "ComposeMessageActivity.initialize: " + " threadId didn't change from: " + originalThreadId,
                this);
    }//from   w  w w .j  a va 2 s  .c  o  m

    log("savedInstanceState = " + savedInstanceState + " intent = " + getIntent() + " mConversation = "
            + mConversation);

    if (cancelFailedToDeliverNotification(getIntent(), this)) {
        // Show a pop-up dialog to inform user the message was
        // failed to deliver.
        undeliveredMessageDialog(getMessageDate(null));
    }
    cancelFailedDownloadNotification(getIntent(), this);

    // Set up the message history ListAdapter
    initMessageList();

    mShouldLoadDraft = true;

    // Load the draft for this thread, if we aren't already handling
    // existing data, such as a shared picture or forwarded message.
    boolean isForwardedMessage = false;
    // We don't attempt to handle the Intent.ACTION_SEND when saveInstanceState is non-null.
    // saveInstanceState is non-null when this activity is killed. In that case, we already
    // handled the attachment or the send, so we don't try and parse the intent again.
    if (savedInstanceState == null && (handleSendIntent() || handleForwardedMessage())) {
        mShouldLoadDraft = false;
    }

    // Let the working message know what conversation it belongs to
    mWorkingMessage.setConversation(mConversation);

    // Show the recipients editor if we don't have a valid thread. Hide it otherwise.
    if (mConversation.getThreadId() <= 0) {
        // Hide the recipients editor so the call to initRecipientsEditor won't get
        // short-circuited.
        hideRecipientEditor();
        initRecipientsEditor();
    } else {
        hideRecipientEditor();
    }

    updateSendButtonState();

    drawTopPanel(false);
    if (!mShouldLoadDraft) {
        // We're not loading a draft, so we can draw the bottom panel immediately.
        drawBottomPanel();
    }

    onKeyboardStateChanged();

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

    updateTitle(mConversation.getRecipients());

    if (isForwardedMessage && isRecipientsEditorVisible()) {
        // The user is forwarding the message to someone. Put the focus on the
        // recipient editor rather than in the message editor.
        mRecipientsEditor.requestFocus();
    }

    mMsgListAdapter.setIsGroupConversation(mConversation.getRecipients().size() > 1);
}