當前位置: 首頁>>代碼示例>>Java>>正文


Java InsetDrawable.getPadding方法代碼示例

本文整理匯總了Java中android.graphics.drawable.InsetDrawable.getPadding方法的典型用法代碼示例。如果您正苦於以下問題:Java InsetDrawable.getPadding方法的具體用法?Java InsetDrawable.getPadding怎麽用?Java InsetDrawable.getPadding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.drawable.InsetDrawable的用法示例。


在下文中一共展示了InsetDrawable.getPadding方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onUpdateBackgroundAndPaddings

import android.graphics.drawable.InsetDrawable; //導入方法依賴的package包/類
@Override
protected void onUpdateBackgroundAndPaddings(Rect searchBarBounds, Rect padding) {
    // Apply the top-bottom padding to the content itself so that the launcher transition is
    // clipped correctly
    mContent.setPadding(0, padding.top, 0, padding.bottom);

    // TODO: Use quantum_panel_dark instead of quantum_panel_shape_dark.
    InsetDrawable background = new InsetDrawable(
            getResources().getDrawable(R.drawable.quantum_panel_shape_dark), padding.left, 0,
            padding.right, 0);
    Rect bgPadding = new Rect();
    background.getPadding(bgPadding);
    mView.setBackground(background);
    getRevealView().setBackground(background.getConstantState().newDrawable());
    mView.updateBackgroundPadding(bgPadding);
}
 
開發者ID:Mr-lin930819,項目名稱:SimplOS,代碼行數:17,代碼來源:WidgetsContainerView.java

示例2: onUpdateBackgroundAndPaddings

import android.graphics.drawable.InsetDrawable; //導入方法依賴的package包/類
private void onUpdateBackgroundAndPaddings(Rect padding) {
    // Apply the top-bottom padding to itself so that the launcher transition is
    // clipped correctly
    setPadding(0, padding.top, 0, padding.bottom);

    InsetDrawable background = new InsetDrawable(mRevealDrawable,
            padding.left, 0, padding.right, 0);
    mRevealView.setBackground(background.getConstantState().newDrawable());
    mContent.setBackground(background);

    // We let the content have a intent background, but still have full width.
    // This allows the scroll bar to be used responsive outside the background bounds as well.
    mContent.setPadding(0, 0, 0, 0);

    Rect bgPadding = new Rect();
    background.getPadding(bgPadding);
    onUpdateBgPadding(padding, bgPadding);
}
 
開發者ID:RunasSudo,項目名稱:FLauncher,代碼行數:19,代碼來源:BaseContainerView.java

示例3: getTextLeft

import android.graphics.drawable.InsetDrawable; //導入方法依賴的package包/類
private int getTextLeft() {
    int left = 0;
    if (getBackground() instanceof InsetDrawable) {
        InsetDrawable back = (InsetDrawable) getBackground();
        Rect padding = new Rect();
        back.getPadding(padding);
        left = padding.left;
    }
    return left;
}
 
開發者ID:yongjhih,項目名稱:android-proguards,代碼行數:11,代碼來源:PasswordEntry.java

示例4: onUpdateBackgroundAndPaddings

import android.graphics.drawable.InsetDrawable; //導入方法依賴的package包/類
@Override
protected void onUpdateBackgroundAndPaddings(Rect searchBarBounds, Rect padding) {
    boolean isRtl = Utilities.isRtl(getResources());
    // Apply the top-bottom padding to the content itself so that the launcher transition is
    // clipped correctly
    mContent.setPadding(0, padding.top, 0, padding.bottom);

    // TODO: Use quantum_panel_dark instead of quantum_panel_shape_dark.
    InsetDrawable background = new InsetDrawable(
            getResources().getDrawable(R.drawable.quantum_panel_shape_dark), padding.left, 0,
            padding.right, 0);
    Rect bgPadding = new Rect();
    background.getPadding(bgPadding);
    mView.setBackground(background);
    getRevealView().setBackground(background.getConstantState().newDrawable());
    mView.updateBackgroundPadding(bgPadding);

    int startInset = mView.getMaxScrollbarWidth();
    int topBottomPadding =  getPaddingTop();
    final boolean useScrollerScrubber = useScroller() && useScrubber();
    if (isRtl) {
        mView.setPadding(padding.left + mView.getMaxScrollbarWidth(),
                topBottomPadding, padding.right + startInset, useScrollerScrubber ?
                mScrubberHeight + topBottomPadding : topBottomPadding);
        if (useScrollerScrubber) {
            mScrubberContainerView.setPadding(padding.left, 0, padding.right, 0);
        }
    } else {
        mView.setPadding(padding.left + startInset, topBottomPadding,
                padding.right + mView.getMaxScrollbarWidth(), useScrollerScrubber ?
                mScrubberHeight + topBottomPadding : topBottomPadding);
        if (useScrollerScrubber) {
            mScrubberContainerView.setPadding(padding.left, 0, padding.right, 0);
            mScrubberContainerView.setEnabled(true);
            mScrubberContainerView.bringToFront();
        }
    }
}
 
開發者ID:talentlo,項目名稱:Trebuchet,代碼行數:39,代碼來源:WidgetsContainerView.java

示例5: onUpdateBackgroundAndPaddings

import android.graphics.drawable.InsetDrawable; //導入方法依賴的package包/類
/**
 * Update the background and padding of the Apps view and children.  Instead of insetting the
 * container view, we inset the background and padding of the recycler view to allow for the
 * recycler view to handle touch events (for fast scrolling) all the way to the edge.
 */
@Override
protected void onUpdateBackgroundAndPaddings(Rect searchBarBounds, Rect padding) {
    boolean isRtl = Utilities.isRtl(getResources());

    // TODO: Use quantum_panel instead of quantum_panel_shape
    InsetDrawable background = new InsetDrawable(
            getResources().getDrawable(R.drawable.quantum_panel_shape), padding.left, 0,
            padding.right, 0);
    Rect bgPadding = new Rect();
    background.getPadding(bgPadding);
    mContainerView.setBackground(background);
    mRevealView.setBackground(background.getConstantState().newDrawable());
    mAppsRecyclerView.updateBackgroundPadding(bgPadding);
    mAdapter.updateBackgroundPadding(bgPadding);

    // Hack: We are going to let the recycler view take the full width, so reset the padding on
    // the container to zero after setting the background and apply the top-bottom padding to
    // the content view instead so that the launcher transition clips correctly.
    mContent.setPadding(0, padding.top, 0, padding.bottom);
    mContainerView.setPadding(0, 0, 0, 0);

    // Pad the recycler view by the background padding plus the start margin (for the section
    // names)
    int startInset = Math.max(mSectionNamesMargin, mAppsRecyclerView.getMaxScrollbarWidth());
    int topBottomPadding = mRecyclerViewTopBottomPadding;
    if (isRtl) {
        mAppsRecyclerView.setPadding(padding.left + mAppsRecyclerView.getMaxScrollbarWidth(),
                topBottomPadding, padding.right + startInset, topBottomPadding);
    } else {
        mAppsRecyclerView.setPadding(padding.left + startInset, topBottomPadding,
                padding.right + mAppsRecyclerView.getMaxScrollbarWidth(), topBottomPadding);
    }

    // Inset the search bar to fit its bounds above the container
    if (mSearchBarView != null) {
        Rect backgroundPadding = new Rect();
        if (mSearchBarView.getBackground() != null) {
            mSearchBarView.getBackground().getPadding(backgroundPadding);
        }
        LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)
                mSearchBarContainerView.getLayoutParams();
        lp.leftMargin = searchBarBounds.left - backgroundPadding.left;
        lp.topMargin = searchBarBounds.top - backgroundPadding.top;
        lp.rightMargin = (getMeasuredWidth() - searchBarBounds.right) - backgroundPadding.right;
        mSearchBarContainerView.requestLayout();
    }
}
 
開發者ID:Mr-lin930819,項目名稱:SimplOS,代碼行數:53,代碼來源:AllAppsContainerView.java

示例6: onUpdateBackgroundAndPaddings

import android.graphics.drawable.InsetDrawable; //導入方法依賴的package包/類
/**
 * Update the background and padding of the Apps view and children.  Instead of insetting the
 * container view, we inset the background and padding of the recycler view to allow for the
 * recycler view to handle touch events (for fast scrolling) all the way to the edge.
 */
@Override
protected void onUpdateBackgroundAndPaddings(Rect searchBarBounds, Rect padding) {
    boolean isRtl = Utilities.isRtl(getResources());

    // TODO: Use quantum_panel instead of quantum_panel_shape
    int bgRes = mGridTheme == GRID_THEME_DARK ? R.drawable.quantum_panel_shape_dark :
            R.drawable.quantum_panel_shape;
    InsetDrawable background = new InsetDrawable(
            getResources().getDrawable(bgRes), padding.left, 0,
            padding.right, 0);
    Rect bgPadding = new Rect();
    background.getPadding(bgPadding);
    mContainerView.setBackground(background);
    mRevealView.setBackground(background.getConstantState().newDrawable());
    mAppsRecyclerView.updateBackgroundPadding(bgPadding);
    mAdapter.updateBackgroundPadding(bgPadding);

    // Hack: We are going to let the recycler view take the full width, so reset the padding on
    // the container to zero after setting the background and apply the top-bottom padding to
    // the content view instead so that the launcher transition clips correctly.
    mContent.setPadding(0, padding.top, 0, padding.bottom);
    mContainerView.setPadding(0, 0, 0, 0);

    // Pad the recycler view by the background padding plus the start margin (for the section
    // names)
    int startInset = Math.max(mSectionNamesMargin, mAppsRecyclerView.getMaxScrollbarWidth());
    int topBottomPadding = mRecyclerViewTopBottomPadding;
    final boolean useScrollerScrubber = useScroller() && useScrubber();
    if (isRtl) {
        mAppsRecyclerView.setPadding(padding.left + mAppsRecyclerView.getMaxScrollbarWidth(),
                topBottomPadding, padding.right + startInset, useScrollerScrubber ?
                mScrubberHeight + topBottomPadding : topBottomPadding);
        if (useScrollerScrubber) {
            mScrubberContainerView.setPadding(padding.left +
                    mAppsRecyclerView.getMaxScrollbarWidth(), 0, padding.right, 0);
        }
    } else {
        mAppsRecyclerView.setPadding(padding.left + startInset, topBottomPadding,
                padding.right + mAppsRecyclerView.getMaxScrollbarWidth(), useScrollerScrubber ?
                mScrubberHeight + topBottomPadding : topBottomPadding);
        if (useScrollerScrubber) {
            mScrubberContainerView.setPadding(padding.left, 0,
                    padding.right + mAppsRecyclerView.getMaxScrollbarWidth(), 0);
        }
    }

    // Inset the search bar to fit its bounds above the container
    if (mSearchBarView != null) {
        Rect backgroundPadding = new Rect();
        if (mSearchBarView.getBackground() != null) {
            mSearchBarView.getBackground().getPadding(backgroundPadding);
        }
        LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)
                mSearchBarContainerView.getLayoutParams();
        lp.leftMargin = searchBarBounds.left - backgroundPadding.left;
        lp.topMargin = searchBarBounds.top - backgroundPadding.top;
        lp.rightMargin = (getMeasuredWidth() - searchBarBounds.right)
                - backgroundPadding.right;
        mSearchBarContainerView.requestLayout();
    }
}
 
開發者ID:talentlo,項目名稱:Trebuchet,代碼行數:67,代碼來源:AllAppsContainerView.java


注:本文中的android.graphics.drawable.InsetDrawable.getPadding方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。