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


Java ApiCompatibilityUtils.setMarginEnd方法代码示例

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


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

示例1: initialize

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
 * Initializes the view with the correct strings.
 *
 * @param title   Title of the webpage.
 * @param origin  Origin of the webpage.
 */
public void initialize(String title, String origin) {
    ((TextView) findViewById(R.id.page_title)).setText(title);
    ((TextView) findViewById(R.id.hostname)).setText(origin);

    // Remove the close button, then expand the page information to take up the space formerly
    // occupied by the X.
    View toRemove = findViewById(R.id.close_button);
    ((ViewGroup) toRemove.getParent()).removeView(toRemove);

    int titleEndMargin = getContext().getResources().getDimensionPixelSize(
            R.dimen.payments_section_large_spacing);
    View pageInfoGroup = findViewById(R.id.page_info);
    ApiCompatibilityUtils.setMarginEnd(
            (MarginLayoutParams) pageInfoGroup.getLayoutParams(), titleEndMargin);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:22,代码来源:PaymentRequestUiErrorView.java

示例2: SectionSeparator

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/** Creates the View and adds it to the parent at the given index. */
public SectionSeparator(ViewGroup parent, int index) {
    super(parent.getContext());
    Resources resources = parent.getContext().getResources();
    setBackgroundColor(ApiCompatibilityUtils.getColor(
            resources, R.color.payments_section_separator));
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            LayoutParams.MATCH_PARENT,
            resources.getDimensionPixelSize(R.dimen.payments_section_separator_height));

    int margin = resources.getDimensionPixelSize(R.dimen.payments_section_large_spacing);
    ApiCompatibilityUtils.setMarginStart(params, margin);
    ApiCompatibilityUtils.setMarginEnd(params, margin);
    parent.addView(this, index, params);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:PaymentRequestSection.java

示例3: updateLayoutParams

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
@Override
protected void updateLayoutParams() {
    // Calculate the bookmark/delete button margins.
    int lastButtonSpace;
    if (mSaveOfflineButton.getVisibility() == View.VISIBLE) {
        MarginLayoutParams saveOfflineLayoutParams =
                (MarginLayoutParams) mSaveOfflineButton.getLayoutParams();
        lastButtonSpace = ApiCompatibilityUtils.getMarginEnd(saveOfflineLayoutParams);
    } else {
        MarginLayoutParams micLayoutParams = (MarginLayoutParams) mMicButton.getLayoutParams();
        lastButtonSpace = ApiCompatibilityUtils.getMarginEnd(micLayoutParams);
    }

    if (mMicButton.getVisibility() == View.VISIBLE
            || mSaveOfflineButton.getVisibility() == View.VISIBLE) {
        lastButtonSpace += mMicButtonWidth;
    }

    final MarginLayoutParams deleteLayoutParams =
            (MarginLayoutParams) mDeleteButton.getLayoutParams();
    final MarginLayoutParams bookmarkLayoutParams =
            (MarginLayoutParams) mBookmarkButton.getLayoutParams();

    ApiCompatibilityUtils.setMarginEnd(deleteLayoutParams, lastButtonSpace);
    ApiCompatibilityUtils.setMarginEnd(bookmarkLayoutParams, lastButtonSpace);

    mDeleteButton.setLayoutParams(deleteLayoutParams);
    mBookmarkButton.setLayoutParams(bookmarkLayoutParams);

    super.updateLayoutParams();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:32,代码来源:LocationBarTablet.java

示例4: inflateTabSwitchingResources

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private void inflateTabSwitchingResources() {
    mToggleTabStackButton = (ImageView) findViewById(R.id.tab_switcher_button);
    mNewTabButton = (NewTabButton) findViewById(R.id.new_tab_button);

    mToggleTabStackButton.setClickable(false);
    Resources resources = getResources();
    mTabSwitcherButtonDrawable =
            TabSwitcherDrawable.createTabSwitcherDrawable(resources, false);
    mTabSwitcherButtonDrawableLight =
            TabSwitcherDrawable.createTabSwitcherDrawable(resources, true);
    mToggleTabStackButton.setImageDrawable(mTabSwitcherButtonDrawable);
    mTabSwitcherModeViews.add(mNewTabButton);

    // Ensure that the new tab button will not draw over the toolbar buttons if the
    // translated string is long.  Set a margin to the size of the toolbar button container
    // for the new tab button.
    WindowManager wm = (WindowManager) getContext().getSystemService(
            Context.WINDOW_SERVICE);
    Point screenSize = new Point();
    wm.getDefaultDisplay().getSize(screenSize);

    mToolbarButtonsContainer.measure(
            MeasureSpec.makeMeasureSpec(screenSize.x, MeasureSpec.AT_MOST),
            MeasureSpec.makeMeasureSpec(screenSize.y, MeasureSpec.AT_MOST));

    ApiCompatibilityUtils.setMarginEnd(getFrameLayoutParams(mNewTabButton),
            mToolbarButtonsContainer.getMeasuredWidth());
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:29,代码来源:ToolbarPhone.java

示例5: createLabel

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private TextView createLabel(GridLayout parent, int rowIndex, boolean optionIconExists,
        boolean editIconExists, boolean isEnabled) {
    Context context = parent.getContext();
    Resources resources = context.getResources();

    // By default, the label appears to the right of the "button" in the second column.
    // + If there is no button, no option and edit icon, the label spans the whole row.
    // + If there is no option and edit icon, the label spans three columns.
    // + If there is no edit icon or option icon, the label spans two columns.
    // + Otherwise, the label occupies only its own column.
    int columnStart = 1;
    int columnSpan = 1;
    if (!optionIconExists) columnSpan++;
    if (!editIconExists) columnSpan++;

    TextView labelView = new TextView(context);
    if (mRowType == OPTION_ROW_TYPE_OPTION) {
        // Show the string representing the PaymentOption.
        ApiCompatibilityUtils.setTextAppearance(labelView, isEnabled
                ? R.style.PaymentsUiSectionDefaultText
                : R.style.PaymentsUiSectionDisabledText);
        labelView.setText(convertOptionToString(
                mOption, mDelegate.isBoldLabelNeeded(OptionSection.this)));
        labelView.setEnabled(isEnabled);
    } else if (mRowType == OPTION_ROW_TYPE_ADD) {
        // Shows string saying that the user can add a new option, e.g. credit card no.
        String typeface = resources.getString(R.string.roboto_medium_typeface);
        int textStyle = resources.getInteger(R.integer.roboto_medium_textstyle);
        int buttonHeight = resources.getDimensionPixelSize(
                R.dimen.payments_section_add_button_height);

        ApiCompatibilityUtils.setTextAppearance(
                labelView, R.style.PaymentsUiSectionAddButtonLabel);
        labelView.setMinimumHeight(buttonHeight);
        labelView.setGravity(Gravity.CENTER_VERTICAL);
        labelView.setTypeface(Typeface.create(typeface, textStyle));
    } else if (mRowType == OPTION_ROW_TYPE_DESCRIPTION) {
        // The description spans all the columns.
        columnStart = 0;
        columnSpan = 4;

        ApiCompatibilityUtils.setTextAppearance(
                labelView, R.style.PaymentsUiSectionDescriptiveText);
    } else if (mRowType == OPTION_ROW_TYPE_WARNING) {
        // Warnings use three columns.
        columnSpan = 3;
        ApiCompatibilityUtils.setTextAppearance(
                labelView, R.style.PaymentsUiSectionWarningText);
    }

    // The label spans two columns if no option or edit icon, or spans three columns if
    // no option and edit icons. Setting the view width to 0 forces it to stretch.
    GridLayout.LayoutParams labelParams = new GridLayout.LayoutParams(
            GridLayout.spec(rowIndex, 1, GridLayout.CENTER),
            GridLayout.spec(columnStart, columnSpan, GridLayout.FILL));
    labelParams.topMargin = mVerticalMargin;
    labelParams.width = 0;
    if (optionIconExists) {
        // Margin at the end of the label instead of the start of the option icon to
        // allow option icon in the the next row align with the end of label (include
        // end margin) when edit icon exits in that row, like below:
        // ---Label---------------------[label margin]|---option icon---|
        // ---Label---[label margin]|---option icon---|----edit icon----|
        ApiCompatibilityUtils.setMarginEnd(labelParams, mLargeSpacing);
    }
    parent.addView(labelView, labelParams);

    labelView.setOnClickListener(OptionSection.this);
    return labelView;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:71,代码来源:PaymentRequestSection.java

示例6: expand

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/** Expand the separator to be the full width of the dialog. */
public void expand() {
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) getLayoutParams();
    ApiCompatibilityUtils.setMarginStart(params, 0);
    ApiCompatibilityUtils.setMarginEnd(params, 0);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:7,代码来源:PaymentRequestSection.java

示例7: prepareEditor

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
 * Create the visual representation of the EditorModel.
 *
 * This would be more optimal as a RelativeLayout, but because it's dynamically generated, it's
 * much more human-parsable with inefficient LinearLayouts for half-width controls sharing rows.
 */
private void prepareEditor() {
    // Ensure the layout is empty.
    removeTextChangedListenersAndInputFilters();
    mDataView = (ViewGroup) mLayout.findViewById(R.id.contents);
    mDataView.removeAllViews();
    mFieldViews.clear();
    mEditableTextFields.clear();
    mDropdownFields.clear();

    // Add Views for each of the {@link EditorFields}.
    for (int i = 0; i < mEditorModel.getFields().size(); i++) {
        EditorFieldModel fieldModel = mEditorModel.getFields().get(i);
        EditorFieldModel nextFieldModel = null;

        boolean isLastField = i == mEditorModel.getFields().size() - 1;
        boolean useFullLine = fieldModel.isFullLine();
        if (!isLastField && !useFullLine) {
            // If the next field isn't full, stretch it out.
            nextFieldModel = mEditorModel.getFields().get(i + 1);
            if (nextFieldModel.isFullLine()) useFullLine = true;
        }

        if (useFullLine) {
            addFieldViewToEditor(mDataView, fieldModel);
        } else {
            // Create a LinearLayout to put it and the next view side by side.
            LinearLayout rowLayout = new LinearLayout(mContext);
            mDataView.addView(rowLayout);

            View firstView = addFieldViewToEditor(rowLayout, fieldModel);
            View lastView = addFieldViewToEditor(rowLayout, nextFieldModel);

            LinearLayout.LayoutParams firstParams =
                    (LinearLayout.LayoutParams) firstView.getLayoutParams();
            LinearLayout.LayoutParams lastParams =
                    (LinearLayout.LayoutParams) lastView.getLayoutParams();

            firstParams.width = 0;
            firstParams.weight = 1;
            ApiCompatibilityUtils.setMarginEnd(firstParams, mHalfRowMargin);
            lastParams.width = 0;
            lastParams.weight = 1;
            i = i + 1;
        }
    }

    // Add the footer.
    mDataView.addView(mFooter);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:56,代码来源:EditorView.java


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