android.view.View.AccessibilityDelegate#org.chromium.base.ApiCompatibilityUtils源码实例Demo

下面列出了android.view.View.AccessibilityDelegate#org.chromium.base.ApiCompatibilityUtils 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: AndroidChromium   文件: ToolbarPhone.java
/**
 * Constructs a ToolbarPhone object.
 * @param context The Context in which this View object is created.
 * @param attrs The AttributeSet that was specified with this View.
 */
public ToolbarPhone(Context context, AttributeSet attrs) {
    super(context, attrs);
    mToolbarSidePadding = getResources().getDimensionPixelOffset(
            R.dimen.toolbar_edge_padding);
    mLocationBarVerticalMargin =
            getResources().getDimensionPixelOffset(R.dimen.location_bar_vertical_margin);
    mLocationBarBackgroundCornerRadius =
            getResources().getDimensionPixelOffset(R.dimen.location_bar_corner_radius);
    mProgressBackBackgroundColorWhite = ApiCompatibilityUtils.getColor(getResources(),
            R.color.progress_bar_background_white);
    mLightModeDefaultColor =
            ApiCompatibilityUtils.getColor(getResources(), R.color.light_mode_tint);
    mDarkModeDefaultColor =
            ApiCompatibilityUtils.getColor(getResources(), R.color.dark_mode_tint);
}
 
源代码2 项目: AndroidChromium   文件: IncognitoNewTabPageView.java
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    mScrollView = (NewTabPageScrollView) findViewById(R.id.ntp_scrollview);
    mScrollView.setBackgroundColor(
            ApiCompatibilityUtils.getColor(getResources(), R.color.ntp_bg_incognito));

    // FOCUS_BEFORE_DESCENDANTS is needed to support keyboard shortcuts. Otherwise, pressing
    // any shortcut causes the UrlBar to be focused. See ViewRootImpl.leaveTouchMode().
    mScrollView.setDescendantFocusability(FOCUS_BEFORE_DESCENDANTS);

    View learnMore = findViewById(R.id.learn_more);
    learnMore.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mManager.loadIncognitoLearnMore();
        }
    });
}
 
源代码3 项目: 365browser   文件: VisibleNetworks.java
/**
 * Compares the specified object with this VisibleCell for equality.  Returns
 * {@code true} if the given object is a VisibleWifi and has identical values for
 * all of its fields except timestampMs.
 */
@Override
public boolean equals(Object object) {
    if (!(object instanceof VisibleCell)) {
        return false;
    }
    VisibleCell that = (VisibleCell) object;
    return ApiCompatibilityUtils.objectEquals(mRadioType, that.radioType())
            && ApiCompatibilityUtils.objectEquals(mCellId, that.cellId())
            && ApiCompatibilityUtils.objectEquals(
                       mLocationAreaCode, that.locationAreaCode())
            && ApiCompatibilityUtils.objectEquals(
                       mMobileCountryCode, that.mobileCountryCode())
            && ApiCompatibilityUtils.objectEquals(
                       mMobileNetworkCode, that.mobileNetworkCode())
            && ApiCompatibilityUtils.objectEquals(
                       mPrimaryScramblingCode, that.primaryScramblingCode())
            && ApiCompatibilityUtils.objectEquals(mPhysicalCellId, that.physicalCellId())
            && ApiCompatibilityUtils.objectEquals(
                       mTrackingAreaCode, that.trackingAreaCode());
}
 
源代码4 项目: AndroidChromium   文件: FindToolbarPhone.java
@Override
protected void updateVisualsForTabModel(boolean isIncognito) {
    int queryTextColorId;
    if (isIncognito) {
        setBackgroundResource(R.color.incognito_primary_color);
        ColorStateList white = ApiCompatibilityUtils.getColorStateList(getResources(),
                R.color.light_mode_tint);
        mFindNextButton.setTint(white);
        mFindPrevButton.setTint(white);
        mCloseFindButton.setTint(white);
        queryTextColorId = R.color.find_in_page_query_white_color;
    } else {
        setBackgroundColor(Color.WHITE);
        ColorStateList dark = ApiCompatibilityUtils.getColorStateList(getResources(),
                R.color.dark_mode_tint);
        mFindNextButton.setTint(dark);
        mFindPrevButton.setTint(dark);
        mCloseFindButton.setTint(dark);
        queryTextColorId = R.color.find_in_page_query_color;
    }
    mFindQuery.setTextColor(
            ApiCompatibilityUtils.getColor(getContext().getResources(), queryTextColorId));
}
 
源代码5 项目: delion   文件: PaymentRequestSection.java
private View createIcon(GridLayout parent, int rowIndex) {
    // The icon has a pre-defined width.
    ImageView icon = new ImageView(parent.getContext());
    icon.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
    icon.setBackgroundResource(R.drawable.payments_ui_logo_bg);
    icon.setImageResource(mOption.getDrawableIconId());
    icon.setMaxWidth(mIconMaxWidth);

    // The icon floats to the right of everything.
    GridLayout.LayoutParams iconParams = new GridLayout.LayoutParams(
            GridLayout.spec(rowIndex, 1, GridLayout.CENTER), GridLayout.spec(2, 1));
    iconParams.topMargin = mVerticalMargin;
    ApiCompatibilityUtils.setMarginStart(iconParams, mLargeSpacing);
    parent.addView(icon, iconParams);

    icon.setOnClickListener(OptionSection.this);
    return icon;
}
 
源代码6 项目: AndroidChromium   文件: RecentTabsGroupView.java
@Override
public void onFinishInflate() {
    super.onFinishInflate();
    mDeviceIcon = (ImageView) findViewById(R.id.device_icon);
    mTimeLabel = (TextView) findViewById(R.id.time_label);
    mDeviceLabel = (TextView) findViewById(R.id.device_label);
    mExpandCollapseIcon = (ImageView) findViewById(R.id.expand_collapse_icon);

    // Create drawable for expand/collapse arrow.
    LevelListDrawable collapseIcon = new LevelListDrawable();
    collapseIcon.addLevel(DRAWABLE_LEVEL_COLLAPSED, DRAWABLE_LEVEL_COLLAPSED,
            TintedDrawable.constructTintedDrawable(getResources(), R.drawable.ic_expanded));
    TintedDrawable collapse =
            TintedDrawable.constructTintedDrawable(getResources(), R.drawable.ic_collapsed);
    collapse.setTint(
            ApiCompatibilityUtils.getColorStateList(getResources(), R.color.blue_mode_tint));
    collapseIcon.addLevel(DRAWABLE_LEVEL_EXPANDED, DRAWABLE_LEVEL_EXPANDED, collapse);
    mExpandCollapseIcon.setImageDrawable(collapseIcon);
}
 
源代码7 项目: 365browser   文件: WebappActivity.java
private void initializeWebappData() {
    if (mWebappInfo.displayMode() == WebDisplayMode.FULLSCREEN) {
        enterImmersiveMode();
    }

    final int backgroundColor = ColorUtils.getOpaqueColor(mWebappInfo.backgroundColor(
            ApiCompatibilityUtils.getColor(getResources(), R.color.webapp_default_bg)));

    mSplashScreen = new FrameLayout(this);
    mSplashScreen.setBackgroundColor(backgroundColor);

    ViewGroup contentView = (ViewGroup) findViewById(android.R.id.content);
    contentView.addView(mSplashScreen);

    mWebappUma.splashscreenVisible();
    mWebappUma.recordSplashscreenBackgroundColor(mWebappInfo.hasValidBackgroundColor()
            ? WebappUma.SPLASHSCREEN_COLOR_STATUS_CUSTOM
            : WebappUma.SPLASHSCREEN_COLOR_STATUS_DEFAULT);
    mWebappUma.recordSplashscreenThemeColor(mWebappInfo.hasValidThemeColor()
            ? WebappUma.SPLASHSCREEN_COLOR_STATUS_CUSTOM
            : WebappUma.SPLASHSCREEN_COLOR_STATUS_DEFAULT);

    initializeSplashScreenWidgets(backgroundColor);
}
 
/**
 * Shows the work profile badge if it is needed.
 */
private void addWorkProfileBadge(RemoteViews view) {
    Resources resources = mContext.getResources();
    DisplayMetrics metrics = resources.getDisplayMetrics();
    int size = dpToPx(WORK_PROFILE_BADGE_SIZE_DP, metrics);
    int[] colors = new int[size * size];

    // Create an immutable bitmap, so that it can not be reused for painting a badge into it.
    Bitmap bitmap = Bitmap.createBitmap(colors, size, size, Bitmap.Config.ARGB_8888);

    Drawable inputDrawable = new BitmapDrawable(resources, bitmap);
    Drawable outputDrawable = ApiCompatibilityUtils.getUserBadgedDrawableForDensity(
            mContext, inputDrawable, null /* badgeLocation */, metrics.densityDpi);

    // The input bitmap is immutable, so the output drawable will be a different instance from
    // the input drawable if the work profile badge was applied.
    if (inputDrawable != outputDrawable && outputDrawable instanceof BitmapDrawable) {
        view.setImageViewBitmap(
                R.id.work_profile_badge, ((BitmapDrawable) outputDrawable).getBitmap());
        view.setViewVisibility(R.id.work_profile_badge, View.VISIBLE);
    }
}
 
源代码9 项目: 365browser   文件: UiUtils.java
/**
 * Gets the set of locales supported by the current enabled Input Methods.
 * @param context A {@link Context} instance.
 * @return A possibly-empty {@link Set} of locale strings.
 */
public static Set<String> getIMELocales(Context context) {
    LinkedHashSet<String> locales = new LinkedHashSet<String>();
    InputMethodManager imManager =
            (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    List<InputMethodInfo> enabledMethods = imManager.getEnabledInputMethodList();
    for (int i = 0; i < enabledMethods.size(); i++) {
        List<InputMethodSubtype> subtypes =
                imManager.getEnabledInputMethodSubtypeList(enabledMethods.get(i), true);
        if (subtypes == null) continue;
        for (int j = 0; j < subtypes.size(); j++) {
            String locale = ApiCompatibilityUtils.getLocale(subtypes.get(j));
            if (!TextUtils.isEmpty(locale)) locales.add(locale);
        }
    }
    return locales;
}
 
源代码10 项目: AndroidChromium   文件: ToolbarTablet.java
@Override
protected void updateBookmarkButton(boolean isBookmarked, boolean editingAllowed) {
    if (isBookmarked) {
        mBookmarkButton.setImageResource(R.drawable.btn_star_filled);
        // Non-incognito mode shows a blue filled star.
        mBookmarkButton.setTint(isIncognito()
                ? mLightModeTint
                : ApiCompatibilityUtils.getColorStateList(
                        getResources(), R.color.blue_mode_tint));
        mBookmarkButton.setContentDescription(getContext().getString(
                R.string.edit_bookmark));
    } else {
        mBookmarkButton.setImageResource(R.drawable.btn_star);
        mBookmarkButton.setTint(isIncognito() ? mLightModeTint : mDarkModeTint);
        mBookmarkButton.setContentDescription(getContext().getString(
                R.string.accessibility_menu_bookmark));
    }
    mBookmarkButton.setEnabled(editingAllowed);
}
 
源代码11 项目: 365browser   文件: IncognitoNewTabPage.java
/**
 * Constructs an Incognito NewTabPage.
 * @param activity The activity used to create the new tab page's View.
 */
public IncognitoNewTabPage(Activity activity) {
    mActivity = activity;

    mTitle = activity.getResources().getString(R.string.button_new_tab);
    mBackgroundColor =
            ApiCompatibilityUtils.getColor(activity.getResources(), R.color.ntp_bg_incognito);
    mThemeColor = ApiCompatibilityUtils.getColor(activity.getResources(),
            R.color.incognito_primary_color);

    LayoutInflater inflater = LayoutInflater.from(activity);
    mIncognitoNewTabPageView = (IncognitoNewTabPageView) inflater.inflate(useMDIncognitoNTP()
                    ? R.layout.new_tab_page_incognito_md
                    : R.layout.new_tab_page_incognito,
            null);
    mIncognitoNewTabPageView.initialize(mIncognitoNewTabPageManager);

    if (!useMDIncognitoNTP()) {
        TextView newTabIncognitoMessage = (TextView) mIncognitoNewTabPageView.findViewById(
                R.id.new_tab_incognito_message);
        newTabIncognitoMessage.setText(
                activity.getResources().getString(R.string.new_tab_incognito_message));
    }
}
 
源代码12 项目: delion   文件: SnackbarView.java
void adjustViewPosition() {
    mParent.getWindowVisibleDisplayFrame(mCurrentVisibleRect);
    // Only update if the visible frame has changed, otherwise there will be a layout loop.
    if (!mCurrentVisibleRect.equals(mPreviousVisibleRect)) {
        mPreviousVisibleRect.set(mCurrentVisibleRect);

        int keyboardHeight = mParent.getHeight() - mCurrentVisibleRect.bottom
                + mCurrentVisibleRect.top;
        MarginLayoutParams lp = getLayoutParams();
        lp.bottomMargin = keyboardHeight;
        if (mIsTablet) {
            int margin = mParent.getResources()
                    .getDimensionPixelSize(R.dimen.snackbar_margin_tablet);
            ApiCompatibilityUtils.setMarginStart(lp, margin);
            lp.bottomMargin += margin;
            int width = mParent.getResources()
                    .getDimensionPixelSize(R.dimen.snackbar_width_tablet);
            lp.width = Math.min(width, mParent.getWidth() - 2 * margin);
        }
        mView.setLayoutParams(lp);
    }
}
 
源代码13 项目: 365browser   文件: CustomTabTabPersistencePolicy.java
/**
 * Given a list of metadata files, determine which are applicable for deletion based on the
 * deletion strategy of Custom Tabs.
 *
 * @param currentTimeMillis The current time in milliseconds
 *                          ({@link System#currentTimeMillis()}.
 * @param allMetadataFiles The complete list of all metadata files to check.
 * @return The list of metadata files that are applicable for deletion.
 */
protected static List<File> getMetadataFilesForDeletion(
        long currentTimeMillis, List<File> allMetadataFiles) {
    Collections.sort(allMetadataFiles, new Comparator<File>() {
        @Override
        public int compare(File lhs, File rhs) {
            long lhsModifiedTime = lhs.lastModified();
            long rhsModifiedTime = rhs.lastModified();

            // Sort such that older files (those with an lower timestamp number) are at the
            // end of the sorted listed.
            return ApiCompatibilityUtils.compareLong(rhsModifiedTime, lhsModifiedTime);
        }
    });

    List<File> stateFilesApplicableForDeletion = new ArrayList<File>();
    for (int i = 0; i < allMetadataFiles.size(); i++) {
        File file = allMetadataFiles.get(i);
        long fileAge = currentTimeMillis - file.lastModified();
        if (i >= MAXIMUM_STATE_FILES || fileAge >= STATE_EXPIRY_THRESHOLD) {
            stateFilesApplicableForDeletion.add(file);
        }
    }
    return stateFilesApplicableForDeletion;
}
 
源代码14 项目: delion   文件: DownloadManagerUi.java
SpaceDisplay(final ViewGroup parent) {
    mSpaceUsedTextView = (TextView) parent.findViewById(R.id.space_used_display);
    mSpaceTotalTextView = (TextView) parent.findViewById(R.id.space_total_display);
    mSpaceBar = (ProgressBar) parent.findViewById(R.id.space_bar);

    mFileSystemBytesTask = new AsyncTask<Void, Void, Long>() {
        @Override
        protected Long doInBackground(Void... params) {
            StatFs statFs = new StatFs(Environment.getExternalStoragePublicDirectory(
                    Environment.DIRECTORY_DOWNLOADS).getPath());
            long totalBlocks = ApiCompatibilityUtils.getBlockCount(statFs);
            long blockSize = ApiCompatibilityUtils.getBlockSize(statFs);
            long fileSystemBytes = totalBlocks * blockSize;
            return fileSystemBytes;
        }
    };
    mFileSystemBytesTask.execute();
}
 
源代码15 项目: delion   文件: DownloadManagerUi.java
/**
 * Initializes the UI for the given Activity.
 *
 * @param activity Activity that is showing the UI.
 */
public void initialize(DownloadManagerUiDelegate delegate, Activity activity) {
    mDelegate = delegate;

    mActionBarDrawerToggle = new ActionBarDrawerToggle(activity,
            this, (Toolbar) findViewById(R.id.action_bar),
            R.string.accessibility_bookmark_drawer_toggle_btn_open,
            R.string.accessibility_bookmark_drawer_toggle_btn_close);
    addDrawerListener(mActionBarDrawerToggle);
    mActionBarDrawerToggle.syncState();

    FadingShadowView shadow = (FadingShadowView) findViewById(R.id.shadow);
    if (DeviceFormFactor.isLargeTablet(getContext())) {
        shadow.setVisibility(View.GONE);
    } else {
        shadow.init(ApiCompatibilityUtils.getColor(getResources(),
                R.color.toolbar_shadow_color), FadingShadow.POSITION_TOP);
    }

    mSpaceDisplay.update(0);

    ((Toolbar) findViewById(R.id.action_bar)).setTitle(R.string.menu_downloads);
}
 
源代码16 项目: 365browser   文件: ToolbarTablet.java
@Override
protected void updateBookmarkButton(boolean isBookmarked, boolean editingAllowed) {
    if (isBookmarked) {
        mBookmarkButton.setImageResource(R.drawable.btn_star_filled);
        // Non-incognito mode shows a blue filled star.
        mBookmarkButton.setTint(isIncognito()
                ? mLightModeTint
                : ApiCompatibilityUtils.getColorStateList(
                        getResources(), R.color.blue_mode_tint));
        mBookmarkButton.setContentDescription(getContext().getString(
                R.string.edit_bookmark));
    } else {
        mBookmarkButton.setImageResource(R.drawable.btn_star);
        mBookmarkButton.setTint(isIncognito() ? mLightModeTint : mDarkModeTint);
        mBookmarkButton.setContentDescription(getContext().getString(
                R.string.accessibility_menu_bookmark));
    }
    mBookmarkButton.setEnabled(editingAllowed);
}
 
源代码17 项目: delion   文件: UrlBar.java
@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
    mFocused = focused;
    if (!focused) mAutocompleteSpan.clearSpan();
    super.onFocusChanged(focused, direction, previouslyFocusedRect);

    if (focused && mFirstFocusTimeMs == 0) {
        mFirstFocusTimeMs = SystemClock.elapsedRealtime();
        if (mOmniboxLivenessListener != null) mOmniboxLivenessListener.onOmniboxFocused();
    }

    if (focused) StartupMetrics.getInstance().recordFocusedOmnibox();

    // When unfocused, force left-to-right rendering at the paragraph level (which is desired
    // for URLs). Right-to-left runs are still rendered RTL, but will not flip the whole URL
    // around. This is consistent with OmniboxViewViews on desktop. When focused, render text
    // normally (to allow users to make non-URL searches and to avoid showing Android's split
    // insertion point when an RTL user enters RTL text).
    if (focused) {
        ApiCompatibilityUtils.setTextDirection(this, TEXT_DIRECTION_INHERIT);
    } else {
        ApiCompatibilityUtils.setTextDirection(this, TEXT_DIRECTION_LTR);
    }
    // Always align to the same as the paragraph direction (LTR = left, RTL = right).
    ApiCompatibilityUtils.setTextAlignment(this, TEXT_ALIGNMENT_TEXT_START);
}
 
源代码18 项目: delion   文件: SuggestionView.java
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    if (getMeasuredWidth() == 0) return;

    if (mSuggestion.getType() != OmniboxSuggestionType.SEARCH_SUGGEST_TAIL) {
        mContentsView.resetTextWidths();
    }

    boolean refineVisible = mRefineView.getVisibility() == VISIBLE;
    boolean isRtl = ApiCompatibilityUtils.isLayoutRtl(this);
    int contentsViewOffsetX = isRtl && refineVisible ? mRefineWidth : 0;
    mContentsView.layout(
            contentsViewOffsetX,
            0,
            contentsViewOffsetX + mContentsView.getMeasuredWidth(),
            mContentsView.getMeasuredHeight());
    int refineViewOffsetX = isRtl ? 0 : getMeasuredWidth() - mRefineWidth;
    mRefineView.layout(
            refineViewOffsetX,
            0,
            refineViewOffsetX + mRefineWidth,
            mContentsView.getMeasuredHeight());
}
 
源代码19 项目: 365browser   文件: SuggestionView.java
/**
 * Sets a description line for the omnibox suggestion.
 *
 * @param str The description text.
 * @param isUrl Whether this text is a URL (as opposed to a normal string).
 */
private void showDescriptionLine(Spannable str, boolean isUrl) {
    TextView textLine = mContentsView.mTextLine2;
    if (textLine.getVisibility() != VISIBLE) {
        textLine.setVisibility(VISIBLE);
    }
    textLine.setText(str, BufferType.SPANNABLE);

    // Force left-to-right rendering for URLs. See UrlBar constructor for details.
    if (isUrl) {
        textLine.setTextColor(URL_COLOR);
        ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_LTR);
    } else {
        textLine.setTextColor(getStandardFontColor());
        ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_INHERIT);
    }
}
 
源代码20 项目: AndroidChromium   文件: LocationBarLayout.java
/**
 * Call to force the UI to update the state of various buttons based on whether or not the
 * current tab is incognito.
 */
@Override
public void updateVisualsForState() {
    if (updateUseDarkColors() || mIsEmphasizingHttpsScheme != shouldEmphasizeHttpsScheme()) {
        updateSecurityIcon(getSecurityLevel());
    }
    ColorStateList colorStateList = ApiCompatibilityUtils.getColorStateList(getResources(),
            mUseDarkColors ? R.color.dark_mode_tint : R.color.light_mode_tint);
    mMicButton.setTint(colorStateList);
    mDeleteButton.setTint(colorStateList);

    setNavigationButtonType(mNavigationButtonType);
    mUrlBar.setUseDarkTextColors(mUseDarkColors);

    if (mSuggestionList != null) {
        mSuggestionList.setBackground(getSuggestionPopupBackground());
    }
    mSuggestionListAdapter.setUseDarkColors(mUseDarkColors);
}
 
源代码21 项目: AndroidChromium   文件: PaymentRequestSection.java
@Override
protected void createMainSectionContent(LinearLayout mainSectionLayout) {
    Context context = mainSectionLayout.getContext();

    mExtraTextViews = new TextView[3];
    for (int i = 0; i < mExtraTextViews.length; i++) {
        mExtraTextViews[i] = new TextView(context);
        ApiCompatibilityUtils.setTextAppearance(
                mExtraTextViews[i], R.style.PaymentsUiSectionDefaultText);
        mainSectionLayout.addView(
                mExtraTextViews[i], new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
                                            LayoutParams.WRAP_CONTENT));
    }
}
 
源代码22 项目: AndroidChromium   文件: SuggestionView.java
private int getUrlBarLeftOffset() {
    if (DeviceFormFactor.isTablet(getContext())) {
        mUrlBar.getLocationInWindow(mViewPositionHolder);
        return mViewPositionHolder[0];
    } else {
        return ApiCompatibilityUtils.isLayoutRtl(this) ? mPhoneUrlBarLeftOffsetRtlPx
                : mPhoneUrlBarLeftOffsetPx;
    }
}
 
源代码23 项目: 365browser   文件: BottomSheetContentController.java
private void updateVisuals(boolean isIncognitoTabModelSelected) {
    setBackgroundResource(isIncognitoTabModelSelected ? R.color.incognito_primary_color
                                                      : R.color.default_primary_color);

    ColorStateList tint = ApiCompatibilityUtils.getColorStateList(getResources(),
            isIncognitoTabModelSelected ? R.color.bottom_nav_tint_incognito
                                        : R.color.bottom_nav_tint);
    setItemIconTintList(tint);
    setItemTextColor(tint);
}
 
源代码24 项目: AndroidChromium   文件: ContextualSearchPanel.java
/**
 * @param context The current Android {@link Context}.
 * @param updateHost The {@link LayoutUpdateHost} used to request updates in the Layout.
 * @param eventHost The {@link EventFilterHost} for propagating events.
 * @param panelManager The object managing the how different panels are shown.
 */
public ContextualSearchPanel(Context context, LayoutUpdateHost updateHost,
            EventFilterHost eventHost, OverlayPanelManager panelManager) {
    super(context, updateHost, eventHost, panelManager);
    mSceneLayer = createNewContextualSearchSceneLayer();
    mPanelMetrics = new ContextualSearchPanelMetrics();

    mBarShadowHeightPx = ApiCompatibilityUtils.getDrawable(mContext.getResources(),
            R.drawable.contextual_search_bar_shadow).getIntrinsicHeight();
    mEndButtonWidthDp = mPxToDp * (float) mContext.getResources().getDimensionPixelSize(
            R.dimen.contextual_search_end_button_width);
}
 
源代码25 项目: 365browser   文件: PromoDialog.java
protected PromoDialog(Context context) {
    super(context, R.style.PromoDialog);

    mScrimView = new FrameLayout(context);
    mScrimView.setBackgroundColor(ApiCompatibilityUtils.getColor(
            context.getResources(), R.color.modal_dialog_scrim_color));
    LayoutInflater.from(context).inflate(R.layout.promo_dialog_layout, mScrimView, true);

    mDialogLayout = (PromoDialogLayout) mScrimView.findViewById(R.id.promo_dialog_layout);
    mDialogLayout.initialize(getDialogParams());
}
 
源代码26 项目: 365browser   文件: ContentSettingsResources.java
/**
 * Returns the Drawable object of the icon for a content type with a disabled tint.
 */
public static Drawable getDisabledIcon(int contentType, Resources resources) {
    Drawable icon = ApiCompatibilityUtils.getDrawable(resources, getIcon(contentType));
    icon.mutate();
    int disabledColor = ApiCompatibilityUtils.getColor(resources,
            R.color.primary_text_disabled_material_light);
    icon.setColorFilter(disabledColor, PorterDuff.Mode.SRC_IN);
    return icon;
}
 
源代码27 项目: 365browser   文件: AppMenuIconRowFooter.java
private void updateBookmarkMenuItem(BookmarkBridge bookmarkBridge, Tab currentTab) {
    mBookmarkButton.setEnabled(bookmarkBridge.isEditBookmarksEnabled());

    if (currentTab.getBookmarkId() != Tab.INVALID_BOOKMARK_ID) {
        mBookmarkButton.setImageResource(R.drawable.btn_star_filled);
        mBookmarkButton.setContentDescription(mActivity.getString(R.string.edit_bookmark));
        mBookmarkButton.setTint(ApiCompatibilityUtils.getColorStateList(
                getResources(), R.color.blue_mode_tint));
    } else {
        mBookmarkButton.setImageResource(R.drawable.btn_star);
        mBookmarkButton.setContentDescription(
                mActivity.getString(R.string.accessibility_menu_bookmark));
    }
}
 
源代码28 项目: delion   文件: CertificateViewer.java
private TextView addLabel(LinearLayout certificateView, String label) {
    TextView t = new TextView(mContext);
    ApiCompatibilityUtils.setTextAlignment(t, View.TEXT_ALIGNMENT_VIEW_START);
    t.setPadding(mPadding, mPadding / 2, mPadding, 0);
    t.setText(label);
    t.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
    t.setTextColor(ApiCompatibilityUtils.getColor(mContext.getResources(),
            R.color.connection_info_popup_text));
    certificateView.addView(t);
    return t;
}
 
源代码29 项目: delion   文件: CertificateViewer.java
private void addValue(LinearLayout certificateView, String value) {
    TextView t = new TextView(mContext);
    ApiCompatibilityUtils.setTextAlignment(t, View.TEXT_ALIGNMENT_VIEW_START);
    t.setText(value);
    t.setPadding(mPadding, 0, mPadding, mPadding / 2);
    t.setTextColor(ApiCompatibilityUtils.getColor(mContext.getResources(),
            R.color.connection_info_popup_text));
    certificateView.addView(t);
}
 
源代码30 项目: AndroidChromium   文件: UrlBar.java
/**
 * Sets the {@link UrlBar}'s text direction based on focus and contents.
 *
 * Should be called whenever focus or text contents change.
 */
private void fixupTextDirection() {
    // When unfocused, force left-to-right rendering at the paragraph level (which is desired
    // for URLs). Right-to-left runs are still rendered RTL, but will not flip the whole URL
    // around. This is consistent with OmniboxViewViews on desktop. When focused, render text
    // normally (to allow users to make non-URL searches and to avoid showing Android's split
    // insertion point when an RTL user enters RTL text). Also render text normally when the
    // text field is empty (because then it displays an instruction that is not a URL).
    if (mFocused || length() == 0) {
        ApiCompatibilityUtils.setTextDirection(this, TEXT_DIRECTION_INHERIT);
    } else {
        ApiCompatibilityUtils.setTextDirection(this, TEXT_DIRECTION_LTR);
    }
}