当前位置: 首页>>代码示例>>Java>>正文


Java ApiCompatibilityUtils.setPaddingRelative方法代码示例

本文整理汇总了Java中org.chromium.base.ApiCompatibilityUtils.setPaddingRelative方法的典型用法代码示例。如果您正苦于以下问题:Java ApiCompatibilityUtils.setPaddingRelative方法的具体用法?Java ApiCompatibilityUtils.setPaddingRelative怎么用?Java ApiCompatibilityUtils.setPaddingRelative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.chromium.base.ApiCompatibilityUtils的用法示例。


在下文中一共展示了ApiCompatibilityUtils.setPaddingRelative方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMeasure

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int width = MeasureSpec.getSize(widthMeasureSpec);
    int height = MeasureSpec.getSize(heightMeasureSpec);

    if (width >= 2 * mIllustration.getWidth() && width > height) {
        mPromoContent.setOrientation(LinearLayout.HORIZONTAL);
        setMaxChildWidth(mMaxChildWidthHorizontal);
        ApiCompatibilityUtils.setPaddingRelative(
                mIllustration, 0, 0, mIllustrationPaddingSide, 0);
    } else {
        mPromoContent.setOrientation(LinearLayout.VERTICAL);
        setMaxChildWidth(mMaxChildWidth);
        mIllustration.setPadding(0, 0, 0, mIllustrationPaddingBottom);
    }

    setMaxChildHeight(height - mFrameHeightMargin);
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:20,代码来源:DataReductionPromoView.java

示例2: setUpPadding

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
 * Sets up padding for the entry
 */
private void setUpPadding(FolderListEntry entry, TextView textView) {
    int paddingStart = mBasePadding + Math.min(entry.mDepth, MAX_FOLDER_DEPTH)
            * mPaddingIncrement;
    ApiCompatibilityUtils.setPaddingRelative(textView, paddingStart, 0,
            mBasePadding, 0);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:10,代码来源:BookmarkFolderSelectActivity.java

示例3: setShouldShowButtonsWhenUnfocused

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
 * @param shouldShowButtons Whether buttons should be displayed in the URL bar when it's not
 *                          focused.
 */
public void setShouldShowButtonsWhenUnfocused(boolean shouldShowButtons) {
    mShouldShowButtonsWhenUnfocused = shouldShowButtons;
    updateButtonVisibility();
    ApiCompatibilityUtils.setPaddingRelative(mUrlBar,
            ApiCompatibilityUtils.getPaddingStart(mUrlBar),
            mUrlBar.getPaddingTop(),
            mShouldShowButtonsWhenUnfocused ? mUrlBarEndPaddingWithButtons :
                    mUrlBarEndPaddingWithoutButtons,
            mUrlBar.getPaddingBottom());
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:15,代码来源:LocationBarTablet.java

示例4: OmniboxSuggestionsList

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
 * Constructs a new list designed for containing omnibox suggestions.
 * @param context Context used for contained views.
 */
public OmniboxSuggestionsList(Context context) {
    super(context, null, android.R.attr.dropDownListViewStyle);
    setDivider(null);
    setFocusable(true);
    setFocusableInTouchMode(true);

    mSuggestionHeight = context.getResources().getDimensionPixelOffset(
            R.dimen.omnibox_suggestion_height);
    mSuggestionAnswerHeight = context.getResources().getDimensionPixelOffset(
            R.dimen.omnibox_suggestion_answer_height);

    int paddingTop = context.getResources().getDimensionPixelOffset(
            R.dimen.omnibox_suggestion_list_padding_top);
    int paddingBottom = context.getResources().getDimensionPixelOffset(
            R.dimen.omnibox_suggestion_list_padding_bottom);
    ApiCompatibilityUtils.setPaddingRelative(this, 0, paddingTop, 0, paddingBottom);

    Drawable background = getSuggestionPopupBackground();
    setBackground(background);
    background.getPadding(mTempRect);

    mBackgroundVerticalPadding =
            mTempRect.top + mTempRect.bottom + getPaddingTop() + getPaddingBottom();

    mAnchorView = LocationBarLayout.this.getRootView().findViewById(R.id.toolbar);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:31,代码来源:LocationBarLayout.java

示例5: updateIncognitoBadgePadding

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private void updateIncognitoBadgePadding() {
    // This can be triggered in the super.onFinishInflate, so we need to null check in this
    // place only.
    if (mIncognitoBadge == null) return;

    if (findViewById(R.id.location_bar_icon).getVisibility() == GONE) {
        ApiCompatibilityUtils.setPaddingRelative(
                mIncognitoBadge, 0, 0, mIncognitoBadgePadding, 0);
    } else {
        ApiCompatibilityUtils.setPaddingRelative(mIncognitoBadge, 0, 0, 0, 0);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:13,代码来源:LocationBarPhone.java

示例6: onCreateView

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
@Override
public View onCreateView(ViewGroup parent) {
    View view = super.onCreateView(parent);

    if (mNoBottomSpacing) {
        ApiCompatibilityUtils.setPaddingRelative(
                view,
                ApiCompatibilityUtils.getPaddingStart(view),
                view.getPaddingTop(),
                ApiCompatibilityUtils.getPaddingEnd(view),
                0);
    }

    ((TextView) view.findViewById(android.R.id.summary)).setMovementMethod(
            LinkMovementMethod.getInstance());

    // The icon is aligned to the top of the text view, which can be higher than the
    // ascender line of the text, and makes it look aligned improperly.
    TextView textView = (TextView) view.findViewById(
            getTitle() != null ? android.R.id.title : android.R.id.summary);
    FontMetrics metrics = textView.getPaint().getFontMetrics();
    ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
    ApiCompatibilityUtils.setPaddingRelative(
            icon, 0, (int) java.lang.Math.ceil(metrics.ascent - metrics.top), 0, 0);

    return view;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:28,代码来源:TextMessageWithLinkAndIconPreference.java

示例7: onFinishInflate

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
@Override
public void onFinishInflate() {
    super.onFinishInflate();
    mLocationBar = (LocationBarTablet) findViewById(R.id.location_bar);

    mHomeButton = (TintedImageButton) findViewById(R.id.home_button);
    mBackButton = (TintedImageButton) findViewById(R.id.back_button);
    mForwardButton = (TintedImageButton) findViewById(R.id.forward_button);
    mReloadButton = (TintedImageButton) findViewById(R.id.refresh_button);
    mShowTabStack = DeviceClassManager.isAccessibilityModeEnabled(getContext())
            || CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_TABLET_TAB_STACK);

    mTabSwitcherButtonDrawable =
            TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), false);
    mTabSwitcherButtonDrawableLight =
            TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), true);

    mAccessibilitySwitcherButton = (ImageButton) findViewById(R.id.tab_switcher_button);
    mAccessibilitySwitcherButton.setImageDrawable(mTabSwitcherButtonDrawable);
    updateSwitcherButtonVisibility(mShowTabStack);

    mBookmarkButton = (TintedImageButton) findViewById(R.id.bookmark_button);

    mMenuButton = (TintedImageButton) findViewById(R.id.menu_button);
    mMenuButtonWrapper.setVisibility(View.VISIBLE);

    if (mAccessibilitySwitcherButton.getVisibility() == View.GONE
            && mMenuButtonWrapper.getVisibility() == View.GONE) {
        ApiCompatibilityUtils.setPaddingRelative((View) mMenuButtonWrapper.getParent(), 0, 0,
                getResources().getDimensionPixelSize(R.dimen.tablet_toolbar_end_padding), 0);
    }

    mSaveOfflineButton = (TintedImageButton) findViewById(R.id.save_offline_button);

    // Initialize values needed for showing/hiding toolbar buttons when the activity size
    // changes.
    mShouldAnimateButtonVisibilityChange = false;
    mToolbarButtonsVisible = true;
    mToolbarButtons = new TintedImageButton[] {mBackButton, mForwardButton, mReloadButton};
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:41,代码来源:ToolbarTablet.java

示例8: setStartPaddingBasedOnButtonVisibility

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
 * Sets the toolbar start padding based on whether the buttons are visible.
 * @param buttonsVisible Whether the toolbar buttons are visible.
 */
private void setStartPaddingBasedOnButtonVisibility(boolean buttonsVisible) {
    buttonsVisible = buttonsVisible || mHomeButton.getVisibility() == View.VISIBLE;

    ApiCompatibilityUtils.setPaddingRelative(this,
            buttonsVisible ? mStartPaddingWithButtons : mStartPaddingWithoutButtons,
            getPaddingTop(),
            ApiCompatibilityUtils.getPaddingEnd(this),
            getPaddingBottom());
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:14,代码来源:ToolbarTablet.java

示例9: showCertificateChain

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private void showCertificateChain(byte[][] derData) {
    for (int i = 0; i < derData.length; i++) {
        addCertificate(derData[i]);
    }
    ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(mContext,
            android.R.layout.simple_spinner_item,
            mTitles) {
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            TextView view = (TextView) super.getView(position, convertView, parent);
            // Add extra padding on the end side to avoid overlapping the dropdown arrow.
            ApiCompatibilityUtils.setPaddingRelative(view, mPadding, mPadding, mPadding * 2,
                    mPadding);
            return view;
        }
    };
    arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    LinearLayout dialogContainer = new LinearLayout(mContext);
    dialogContainer.setOrientation(LinearLayout.VERTICAL);

    TextView title = new TextView(mContext);
    title.setText(R.string.certtitle);
    ApiCompatibilityUtils.setTextAlignment(title, View.TEXT_ALIGNMENT_VIEW_START);
    ApiCompatibilityUtils.setTextAppearance(title, android.R.style.TextAppearance_Large);
    title.setTypeface(title.getTypeface(), Typeface.BOLD);
    title.setPadding(mPadding, mPadding, mPadding, mPadding / 2);
    dialogContainer.addView(title);

    Spinner spinner = new Spinner(mContext);
    ApiCompatibilityUtils.setTextAlignment(spinner, View.TEXT_ALIGNMENT_VIEW_START);
    spinner.setAdapter(arrayAdapter);
    spinner.setOnItemSelectedListener(this);
    spinner.setDropDownWidth(ViewGroup.LayoutParams.MATCH_PARENT);
    // Remove padding so that dropdown has same width as the spinner.
    spinner.setPadding(0, 0, 0, 0);
    dialogContainer.addView(spinner);

    LinearLayout certContainer = new LinearLayout(mContext);
    certContainer.setOrientation(LinearLayout.VERTICAL);
    for (int i = 0; i < mViews.size(); ++i) {
        LinearLayout certificateView = mViews.get(i);
        if (i != 0) {
            certificateView.setVisibility(LinearLayout.GONE);
        }
        certContainer.addView(certificateView);
    }
    ScrollView scrollView = new ScrollView(mContext);
    scrollView.addView(certContainer);
    dialogContainer.addView(scrollView);

    showDialogForView(dialogContainer);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:54,代码来源:CertificateViewer.java

示例10: onFinishInflate

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    mSigninChooseView = (AccountSigninChooseView) findViewById(R.id.account_signin_choose_view);
    mSigninChooseView.setAddNewAccountObserver(new AccountSigninChooseView.Observer() {
        @Override
        public void onAddNewAccount() {
            mListener.onNewAccount();
            RecordUserAction.record("Signin_AddAccountToDevice");
        }
    });

    mPositiveButton = (ButtonCompat) findViewById(R.id.positive_button);
    mNegativeButton = (Button) findViewById(R.id.negative_button);
    mMoreButton = (Button) findViewById(R.id.more_button);

    // A workaround for Android support library ignoring padding set in XML. b/20307607
    int padding = getResources().getDimensionPixelSize(R.dimen.fre_button_padding);
    ApiCompatibilityUtils.setPaddingRelative(mPositiveButton, padding, 0, padding, 0);
    ApiCompatibilityUtils.setPaddingRelative(mNegativeButton, padding, 0, padding, 0);

    // TODO(peconn): Ensure this is changed to R.string.cancel when used in Settings > Sign In.
    mCancelButtonTextId = R.string.no_thanks;

    mSigninConfirmationView =
            (AccountSigninConfirmationView) findViewById(R.id.signin_confirmation_view);
    mSigninConfirmationView.setScrolledToBottomObserver(
            new AccountSigninConfirmationView.Observer() {
                @Override
                public void onScrolledToBottom() {
                    setUpMoreButtonVisible(false);
                }
            });
    mSigninAccountImage = (ImageView) findViewById(R.id.signin_account_image);
    mSigninAccountName = (TextView) findViewById(R.id.signin_account_name);
    mSigninAccountEmail = (TextView) findViewById(R.id.signin_account_email);
    mSigninSettingsControl = (TextView) findViewById(R.id.signin_settings_control);
    // For the spans to be clickable.
    mSigninSettingsControl.setMovementMethod(LinkMovementMethod.getInstance());
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:42,代码来源:AccountSigninView.java


注:本文中的org.chromium.base.ApiCompatibilityUtils.setPaddingRelative方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。