org.chromium.chrome.R Java Examples

The following examples show how to use org.chromium.chrome.R. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CastNotificationControl.java    From delion with Apache License 2.0 6 votes vote down vote up
public void show(PlayerState initialState) {
    mMediaRouteController.addUiListener(this);
    // TODO(aberent): investigate why this is necessary, and whether we are handling
    // it correctly. Also add code to restore it when Chrome is resumed.
    mAudioManager.requestAudioFocus(this, AudioManager.USE_DEFAULT_STREAM_TYPE,
            AudioManager.AUDIOFOCUS_GAIN);
    Intent contentIntent = new Intent(mContext, ExpandedControllerActivity.class);
    contentIntent.putExtra(MediaNotificationUma.INTENT_EXTRA_NAME,
            MediaNotificationUma.SOURCE_MEDIA_FLING);
    mNotificationBuilder = new MediaNotificationInfo.Builder()
            .setPaused(false)
            .setPrivate(false)
            .setIcon(R.drawable.ic_notification_media_route)
            .setContentIntent(contentIntent)
            .setLargeIcon(mMediaRouteController.getPoster())
            .setDefaultLargeIcon(R.drawable.cast_playing_square)
            .setId(R.id.remote_notification)
            .setListener(this);
    mState = initialState;
    updateNotification();
    mIsShowing = true;
}
 
Example #2
Source File: AutofillProfileEditor.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View v = super.onCreateView(inflater, container, savedInstanceState);

    mInflater = inflater;
    mAddressFields = new CompatibilityTextInputLayout[AddressField.NUM_FIELDS];

    mPhoneText = (EditText) v.findViewById(R.id.phone_number_edit);
    mPhoneLabel = (CompatibilityTextInputLayout) v.findViewById(R.id.phone_number_label);
    mEmailText = (EditText) v.findViewById(R.id.email_address_edit);
    mEmailLabel = (CompatibilityTextInputLayout) v.findViewById(R.id.email_address_label);
    mWidgetRoot = (ViewGroup) v.findViewById(R.id.autofill_profile_widget_root);
    mCountriesDropdown = (Spinner) v.findViewById(R.id.spinner);

    TextView countriesLabel = (TextView) v.findViewById(R.id.spinner_label);
    countriesLabel.setText(v.getContext().getString(R.string.autofill_profile_editor_country));

    mAutofillProfileBridge = new AutofillProfileBridge();

    populateCountriesDropdown();
    createAndPopulateEditFields();
    initializeButtons(v);

    return v;
}
 
Example #3
Source File: ClearBrowsingDataPreferences.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the Array of time periods. Options are displayed in the same order as they appear
 * in the array.
 */
private TimePeriodSpinnerOption[] getTimePeriodSpinnerOptions() {
    Activity activity = getActivity();

    TimePeriodSpinnerOption[] options = new TimePeriodSpinnerOption[] {
            new TimePeriodSpinnerOption(TimePeriod.LAST_HOUR,
                    activity.getString(R.string.clear_browsing_data_period_hour)),
            new TimePeriodSpinnerOption(TimePeriod.LAST_DAY,
                    activity.getString(R.string.clear_browsing_data_period_day)),
            new TimePeriodSpinnerOption(TimePeriod.LAST_WEEK,
                    activity.getString(R.string.clear_browsing_data_period_week)),
            new TimePeriodSpinnerOption(TimePeriod.FOUR_WEEKS,
                    activity.getString(R.string.clear_browsing_data_period_four_weeks)),
            new TimePeriodSpinnerOption(TimePeriod.EVERYTHING,
                    activity.getString(R.string.clear_browsing_data_period_everything))};

    return options;
}
 
Example #4
Source File: ContextualSearchPeekPromoControl.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * @param panel             The panel.
 * @param context           The Android Context used to inflate the View.
 * @param container         The container View used to inflate the View.
 * @param resourceLoader    The resource loader that will handle the snapshot capturing.
 */
public ContextualSearchPeekPromoControl(OverlayPanel panel,
                                        Context context,
                                        ViewGroup container,
                                        DynamicResourceLoader resourceLoader) {
    super(panel, R.layout.contextual_search_peek_promo_text_view,
            R.id.contextual_search_peek_promo_text_view, context, container, resourceLoader);

    final float dpToPx = context.getResources().getDisplayMetrics().density;

    mDefaultHeightPx = context.getResources().getDimensionPixelOffset(
            R.dimen.contextual_search_peek_promo_height);
    mPaddingPx = context.getResources().getDimensionPixelOffset(
            R.dimen.contextual_search_peek_promo_padding);

    mRippleMinimumWidthPx = RIPPLE_MINIMUM_WIDTH_DP * dpToPx;
    mRippleMaximumWidthPx = panel.getMaximumWidthPx();
}
 
Example #5
Source File: ToolbarPhone.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #6
Source File: DownloadManagerUi.java    From delion with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #7
Source File: DistilledPagePrefsView.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onFinishInflate() {
    super.onFinishInflate();
    mRadioGroup = (RadioGroup) findViewById(R.id.radio_button_group);
    mColorModeButtons.put(Theme.LIGHT,
            initializeAndGetButton(R.id.light_mode, Theme.LIGHT));
    mColorModeButtons.put(Theme.DARK,
            initializeAndGetButton(R.id.dark_mode, Theme.DARK));
    mColorModeButtons.put(Theme.SEPIA,
            initializeAndGetButton(R.id.sepia_mode, Theme.SEPIA));
    mColorModeButtons.get(mDistilledPagePrefs.getTheme()).setChecked(true);

    mFontScaleSeekBar = (SeekBar) findViewById(R.id.font_size);
    mFontScaleTextView = (TextView) findViewById(R.id.font_size_percentage);

    mFontFamilySpinner = (Spinner) findViewById(R.id.font_family);
    initFontFamilySpinner();

    // Setting initial progress on font scale seekbar.
    onChangeFontScaling(mDistilledPagePrefs.getFontScaling());
    mFontScaleSeekBar.setOnSeekBarChangeListener(this);
}
 
Example #8
Source File: DualControlLayout.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a standardized Button that can be used for DualControlLayouts showing buttons.
 *
 * @param isPrimary Whether or not the button is meant to act as a "Confirm" button.
 * @param text      Text to display on the button.
 * @param listener  Listener to alert when the button has been clicked.
 * @return Button that can be used in the view.
 */
public static Button createButtonForLayout(
        Context context, boolean isPrimary, String text, OnClickListener listener) {
    int lightActiveColor =
            ApiCompatibilityUtils.getColor(context.getResources(), R.color.light_active_color);

    if (isPrimary) {
        ButtonCompat primaryButton = new ButtonCompat(context, lightActiveColor, false);
        primaryButton.setId(R.id.button_primary);
        primaryButton.setOnClickListener(listener);
        primaryButton.setText(text);
        primaryButton.setTextColor(Color.WHITE);
        return primaryButton;
    } else {
        Button secondaryButton = ButtonCompat.createBorderlessButton(context);
        secondaryButton.setId(R.id.button_secondary);
        secondaryButton.setOnClickListener(listener);
        secondaryButton.setText(text);
        secondaryButton.setTextColor(lightActiveColor);
        return secondaryButton;
    }
}
 
Example #9
Source File: DoNotTrackPreference.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.do_not_track_preferences);
    getActivity().setTitle(R.string.do_not_track_title);

    ChromeSwitchPreference doNotTrackSwitch =
            (ChromeSwitchPreference) findPreference(PREF_DO_NOT_TRACK_SWITCH);

    boolean isDoNotTrackEnabled = PrefServiceBridge.getInstance().isDoNotTrackEnabled();
    doNotTrackSwitch.setChecked(isDoNotTrackEnabled);

    doNotTrackSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            PrefServiceBridge.getInstance().setDoNotTrackEnabled((boolean) newValue);
            return true;
        }
    });
}
 
Example #10
Source File: StripLayoutHelper.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Displays the tab menu below the anchor tab.
 * @param anchorTab The tab the menu will be anchored to
 */
private void showTabMenu(StripLayoutTab anchorTab) {
    // 1. Bring the anchor tab to the foreground.
    int tabIndex = TabModelUtils.getTabIndexById(mModel, anchorTab.getId());
    TabModelUtils.setIndex(mModel, tabIndex);

    // 2. Anchor the popupMenu to the view associated with the tab
    View tabView = TabModelUtils.getCurrentTab(mModel).getView();
    mTabMenu.setAnchorView(tabView);

    // 3. Set the vertical offset to align the tab menu with bottom of the tab strip
    int verticalOffset =
            -(tabView.getHeight()
                    - (int) mContext.getResources().getDimension(R.dimen.tab_strip_height))
            - ((MarginLayoutParams) tabView.getLayoutParams()).topMargin;
    mTabMenu.setVerticalOffset(verticalOffset);

    // 4. Set the horizontal offset to align the tab menu with the right side of the tab
    int horizontalOffset = Math.round((anchorTab.getDrawX() + anchorTab.getWidth())
                                   * mContext.getResources().getDisplayMetrics().density)
            - mTabMenu.getWidth()
            - ((MarginLayoutParams) tabView.getLayoutParams()).leftMargin;
    mTabMenu.setHorizontalOffset(horizontalOffset);

    mTabMenu.show();
}
 
Example #11
Source File: TranslatePreferences.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int itemId = item.getItemId();
    if (itemId == R.id.menu_id_targeted_help) {
        HelpAndFeedback.getInstance(getActivity())
                .show(getActivity(), getString(R.string.help_context_translate),
                        Profile.getLastUsedProfile(), null);
        return true;
    } else if (itemId == R.id.menu_id_reset) {
        PrefServiceBridge.getInstance().resetTranslateDefaults();
        Toast.makeText(getActivity(), getString(
                R.string.translate_prefs_toast_description),
                Toast.LENGTH_SHORT).show();
        return true;
    }
    return false;
}
 
Example #12
Source File: SingleCategoryPreferences.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Read which category we should be showing.
    String category = "";
    if (getArguments() != null) {
        category = getArguments().getString(EXTRA_CATEGORY, "");
        mCategory = SiteSettingsCategory.fromString(category);
    }
    if (mCategory == null) {
        mCategory = SiteSettingsCategory.fromString(SiteSettingsCategory.CATEGORY_ALL_SITES);
    }
    if (!mCategory.showStorageSites()) {
        return super.onCreateView(inflater, container, savedInstanceState);
    } else {
        return inflater.inflate(R.layout.storage_preferences, container, false);
    }
}
 
Example #13
Source File: NewTabPageView.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Shows the most visited placeholder ("Nothing to see here") if there are no most visited
 * items and there is no search provider logo.
 */
private void updateMostVisitedPlaceholderVisibility() {
    boolean showPlaceholder = mHasReceivedMostVisitedSites
            && mMostVisitedLayout.getChildCount() == 0
            && !mSearchProviderHasLogo;

    mNoSearchLogoSpacer.setVisibility(
            (mSearchProviderHasLogo || showPlaceholder) ? View.GONE : View.INVISIBLE);

    if (showPlaceholder) {
        if (mMostVisitedPlaceholder == null) {
            ViewStub mostVisitedPlaceholderStub = (ViewStub) mNewTabPageLayout
                    .findViewById(R.id.most_visited_placeholder_stub);

            mMostVisitedPlaceholder = mostVisitedPlaceholderStub.inflate();
        }
        mMostVisitedLayout.setVisibility(GONE);
        mMostVisitedPlaceholder.setVisibility(VISIBLE);
    } else if (mMostVisitedPlaceholder != null) {
        mMostVisitedLayout.setVisibility(VISIBLE);
        mMostVisitedPlaceholder.setVisibility(GONE);
    }
}
 
Example #14
Source File: DataReductionPreferences.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.data_reduction_preferences);
    getActivity().setTitle(R.string.data_reduction_title);
    boolean isEnabled =
            DataReductionProxySettings.getInstance().isDataReductionProxyEnabled();
    mIsEnabled = !isEnabled;
    mWasEnabledAtCreation = isEnabled;
    updatePreferences(isEnabled);

    setHasOptionsMenu(true);

    if (getActivity() != null) {
        mFromPromo = IntentUtils.safeGetBooleanExtra(getActivity().getIntent(),
                DataReductionPromoSnackbarController.FROM_PROMO, false);
    }
}
 
Example #15
Source File: DoNotTrackPreference.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.do_not_track_preferences);
    getActivity().setTitle(R.string.do_not_track_title);

    ChromeSwitchPreference doNotTrackSwitch =
            (ChromeSwitchPreference) findPreference(PREF_DO_NOT_TRACK_SWITCH);

    boolean isDoNotTrackEnabled = PrefServiceBridge.getInstance().isDoNotTrackEnabled();
    doNotTrackSwitch.setChecked(isDoNotTrackEnabled);

    doNotTrackSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            PrefServiceBridge.getInstance().setDoNotTrackEnabled((boolean) newValue);
            return true;
        }
    });
}
 
Example #16
Source File: TabWebContentsDelegateAndroid.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public boolean takeFocus(boolean reverse) {
    Activity activity = mTab.getActivity();
    if (activity == null) return false;
    if (reverse) {
        View menuButton = activity.findViewById(R.id.menu_button);
        if (menuButton == null || !menuButton.isShown()) {
            menuButton = activity.findViewById(R.id.document_menu_button);
        }
        if (menuButton != null && menuButton.isShown()) {
            return menuButton.requestFocus();
        }

        View tabSwitcherButton = activity.findViewById(R.id.tab_switcher_button);
        if (tabSwitcherButton != null && tabSwitcherButton.isShown()) {
            return tabSwitcherButton.requestFocus();
        }
    } else {
        View urlBar = activity.findViewById(R.id.url_bar);
        if (urlBar != null) return urlBar.requestFocus();
    }
    return false;
}
 
Example #17
Source File: BookmarkWidgetProvider.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void performUpdate(Context context,
        AppWidgetManager appWidgetManager, int[] appWidgetIds) {
    for (int appWidgetId : appWidgetIds) {
        Intent updateIntent = new Intent(context, BookmarkWidgetService.class);
        updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
        updateIntent.setData(Uri.parse(updateIntent.toUri(Intent.URI_INTENT_SCHEME)));

        int layoutId = shouldShowIconsOnly(appWidgetManager, appWidgetId)
                ? R.layout.bookmark_widget_icons_only
                : R.layout.bookmark_widget;
        RemoteViews views = new RemoteViews(context.getPackageName(), layoutId);
        views.setRemoteAdapter(R.id.bookmarks_list, updateIntent);

        appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.bookmarks_list);
        Intent ic = new Intent(context, BookmarkWidgetProxy.class);
        views.setPendingIntentTemplate(R.id.bookmarks_list,
                PendingIntent.getBroadcast(context, 0, ic,
                PendingIntent.FLAG_UPDATE_CURRENT));
        appWidgetManager.updateAppWidget(appWidgetId, views);
    }
}
 
Example #18
Source File: DownloadManagerUi.java    From delion with Apache License 2.0 6 votes vote down vote up
private void update(long usedBytes) {
    Context context = mSpaceUsedTextView.getContext();

    if (mFileSystemBytes == Long.MAX_VALUE) {
        try {
            mFileSystemBytes = mFileSystemBytesTask.get();
        } catch (Exception e) {
            Log.e(TAG, "Failed to get file system size.");
        }

        // Display how big the storage is.
        String fileSystemReadable = Formatter.formatFileSize(context, mFileSystemBytes);
        mSpaceTotalTextView.setText(context.getString(
                R.string.download_manager_ui_space_used, fileSystemReadable));
    }

    // Indicate how much space has been used by downloads.
    int percentage =
            mFileSystemBytes == 0 ? 0 : (int) (100.0 * usedBytes / mFileSystemBytes);
    mSpaceBar.setProgress(percentage);
    mSpaceUsedTextView.setText(Formatter.formatFileSize(context, usedBytes));
}
 
Example #19
Source File: RecentTabsRowAdapter.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
void configureChildView(int childPosition, ViewHolder viewHolder) {
    if (isMoreButton(childPosition)) {
        Resources resources = mActivity.getResources();
        String text = resources.getString(R.string.recent_tabs_show_more);
        viewHolder.textView.setText(text);
        Drawable drawable =  ApiCompatibilityUtils.getDrawable(
                resources, R.drawable.more_horiz);
        ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(
                viewHolder.textView, drawable, null, null, null);
    } else {
        CurrentlyOpenTab openTab = getChild(childPosition);
        viewHolder.textView.setText(TextUtils.isEmpty(openTab.getTitle()) ? openTab.getUrl()
                : openTab.getTitle());
        loadLocalFavicon(viewHolder, openTab.getUrl());
    }
}
 
Example #20
Source File: SignOutDialogFragment.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    mGaiaServiceType = AccountManagementScreenHelper.GAIA_SERVICE_TYPE_NONE;
    if (getArguments() != null) {
        mGaiaServiceType = getArguments().getInt(
                SHOW_GAIA_SERVICE_TYPE_EXTRA, mGaiaServiceType);
    }

    String managementDomain = SigninManager.get(getActivity()).getManagementDomain();
    String message;
    if (managementDomain == null) {
        message = getActivity().getResources().getString(R.string.signout_message);
    } else {
        message = getActivity().getResources().getString(
                R.string.signout_managed_account_message, managementDomain);
    }

    return new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
            .setTitle(R.string.signout_title)
            .setPositiveButton(R.string.signout_dialog_positive_button, this)
            .setNegativeButton(R.string.cancel, this)
            .setMessage(message)
            .create();
}
 
Example #21
Source File: UpgradeActivity.java    From delion with Apache License 2.0 5 votes vote down vote up
private void continueApplicationLaunch() {
    if (mIsDestroyed) return;

    ApiCompatibilityUtils.finishAndRemoveTask(this);
    if (mIntentToFireAfterUpgrade != null && ApplicationStatus.hasVisibleActivities()) {
        startActivity(mIntentToFireAfterUpgrade);
        overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        mIntentToFireAfterUpgrade = null;
    }
}
 
Example #22
Source File: NewTabPageView.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
MostVisitedDesign(Context context) {
    Resources res = context.getResources();
    mDesiredIconSize = res.getDimensionPixelSize(R.dimen.most_visited_icon_size);
    // On ldpi devices, mDesiredIconSize could be even smaller than ICON_MIN_SIZE_PX.
    mMinIconSize = Math.min(mDesiredIconSize, ICON_MIN_SIZE_PX);
    int desiredIconSizeDp = Math.round(
            mDesiredIconSize / res.getDisplayMetrics().density);
    int iconColor = ApiCompatibilityUtils.getColor(
            getResources(), R.color.default_favicon_background_color);
    mIconGenerator = new RoundedIconGenerator(context, desiredIconSizeDp, desiredIconSizeDp,
            ICON_CORNER_RADIUS_DP, iconColor, ICON_TEXT_SIZE_DP);
}
 
Example #23
Source File: InfoBarControlLayout.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Creates and adds a control that shows a review rating score.
 *
 * @param rating Fractional rating out of 5 stars.
 */
public View addRatingBar(float rating) {
    View ratingLayout = LayoutInflater.from(getContext()).inflate(
            R.layout.infobar_control_rating, this, false);
    addView(ratingLayout, new ControlLayoutParams());

    RatingBar ratingView = (RatingBar) ratingLayout.findViewById(R.id.control_rating);
    ratingView.setRating(rating);
    return ratingView;
}
 
Example #24
Source File: ColorUtils.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * @return The base color for the textbox given a toolbar background color.
 */
public static int getTextBoxColorForToolbarBackground(Resources res, Tab tab, int color) {
    if (shouldUseOpaqueTextboxBackground(color)) {
        // NTP should have no visible textbox in the toolbar, so just return the toolbar's
        // background color.
        if (tab.getNativePage() instanceof NewTabPage) {
            return ApiCompatibilityUtils.getColor(res, R.color.ntp_bg);
        }

        return Color.WHITE;
    }
    return getColorWithOverlay(color, Color.WHITE, LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA);
}
 
Example #25
Source File: RecentTabsRowAdapter.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public View getGroupView(boolean isExpanded, View convertView, ViewGroup parent) {
    if (convertView == null) {
        int layout = mIsVisible
                ? R.layout.recent_tabs_group_separator_visible
                : R.layout.recent_tabs_group_separator_invisible;
        convertView = LayoutInflater.from(mActivity).inflate(layout, parent, false);
    }
    return convertView;
}
 
Example #26
Source File: SigninAndSyncView.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * A convenience method to inflate and initialize a SigninAndSyncView.
 * @param parent A parent used to provide LayoutParams (the SigninAndSyncView will not be
 *     attached).
 * @param listener Listener for user interactions.
 * @param accessPoint Where the SigninAndSyncView is used.
 */
public static SigninAndSyncView create(ViewGroup parent, Listener listener,
        @AccessPoint int accessPoint) {
    SigninAndSyncView signinView = (SigninAndSyncView) LayoutInflater.from(parent.getContext())
            .inflate(R.layout.signin_and_sync_view, parent, false);
    signinView.init(listener, accessPoint);
    return signinView;
}
 
Example #27
Source File: AccountSigninView.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private String getSettingsControlDescription(boolean childAccount) {
    if (childAccount) {
        return getResources().getString(R.string.signin_signed_in_settings_description) + '\n'
                + getResources().getString(R.string.signin_signed_in_description_uca_addendum);
    } else {
        return getResources().getString(R.string.signin_signed_in_settings_description);
    }
}
 
Example #28
Source File: PhysicalWebPreferenceFragment.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.physical_web_preferences);
    getActivity().setTitle(R.string.physical_web_pref_title);
    initPhysicalWebSwitch();
    initLaunchButton();
}
 
Example #29
Source File: PreferenceCategoryWithButton.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindView(final View view) {
    super.onBindView(view);
    // On pre-L devices, PreferenceCategoryWithButtonStyle is reused for PreferenceCategory,
    // which needs a top padding of 16dp; we don't want this top padding for
    // PreferenceCategoryWithButton views.
    view.setPadding(view.getPaddingLeft(), 0, view.getPaddingRight(), view.getPaddingBottom());
    View button = view.findViewById(android.R.id.icon);
    button.setOnClickListener(this);

    if (!TextUtils.isEmpty(mContentDescription)) {
        button.setContentDescription(mContentDescription);
    }
}
 
Example #30
Source File: PaymentRequestSection.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private View createEditIcon(GridLayout parent, int rowIndex) {
    View editorIcon = LayoutInflater.from(parent.getContext())
                              .inflate(R.layout.payment_option_edit_icon, null);

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

    editorIcon.setOnClickListener(OptionSection.this);
    return editorIcon;
}