android.view.MenuItem.OnMenuItemClickListener#org.chromium.chrome.R源码实例Demo

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

源代码1 项目: delion   文件: ClearBrowsingDataPreferences.java
/**
 * 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;
}
 
源代码2 项目: AndroidChromium   文件: DualControlLayout.java
/**
 * 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;
    }
}
 
@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);
    }
}
 
源代码4 项目: AndroidChromium   文件: TranslatePreferences.java
@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;
}
 
源代码5 项目: AndroidChromium   文件: DoNotTrackPreference.java
@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;
        }
    });
}
 
@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;
}
 
源代码7 项目: AndroidChromium   文件: BookmarkWidgetProvider.java
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);
    }
}
 
源代码8 项目: delion   文件: CastNotificationControl.java
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;
}
 
源代码9 项目: AndroidChromium   文件: RecentTabsRowAdapter.java
@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());
    }
}
 
源代码10 项目: delion   文件: DownloadManagerUi.java
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));
}
 
源代码11 项目: delion   文件: NewTabPageView.java
/**
 * 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);
    }
}
 
@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);
    }
}
 
源代码13 项目: delion   文件: StripLayoutHelper.java
/**
 * 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();
}
 
源代码14 项目: delion   文件: DoNotTrackPreference.java
@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;
        }
    });
}
 
源代码15 项目: delion   文件: ContextualSearchPeekPromoControl.java
/**
 * @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();
}
 
源代码16 项目: 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();
}
 
源代码17 项目: 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);
}
 
源代码18 项目: delion   文件: DistilledPagePrefsView.java
@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);
}
 
源代码19 项目: AndroidChromium   文件: AutofillProfileEditor.java
@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;
}
 
源代码20 项目: AndroidChromium   文件: SignOutDialogFragment.java
@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();
}
 
源代码21 项目: AndroidChromium   文件: WebappActivity.java
@Override
public void postInflationStartup() {
    initializeWebappData();

    super.postInflationStartup();
    WebappControlContainer controlContainer =
            (WebappControlContainer) findViewById(R.id.control_container);
    mUrlBar = (WebappUrlBar) controlContainer.findViewById(R.id.webapp_url_bar);
}
 
源代码22 项目: AndroidChromium   文件: CastSessionImpl.java
@Override
public void stopApplication() {
    if (mStoppingApplication) return;

    if (isApiClientInvalid()) return;

    mStoppingApplication = true;
    Cast.CastApi.stopApplication(mApiClient, mSessionId)
            .setResultCallback(new ResultCallback<Status>() {
                @Override
                public void onResult(Status status) {
                    mMessageHandler.onApplicationStopped();
                    // TODO(avayvod): handle a failure to stop the application.
                    // https://crbug.com/535577

                    Set<String> namespaces = new HashSet<String>(mNamespaces);
                    for (String namespace : namespaces) unregisterNamespace(namespace);
                    mNamespaces.clear();

                    mSessionId = null;
                    mApiClient = null;

                    mRouteProvider.onSessionClosed();
                    mStoppingApplication = false;

                    MediaNotificationManager.clear(R.id.presentation_notification);
                }
            });
}
 
源代码23 项目: delion   文件: ItemChooserDialog.java
public ItemAdapter(Context context, int resource) {
    super(context, resource);

    mInflater = LayoutInflater.from(context);

    mBackgroundHighlightColor = ApiCompatibilityUtils.getColor(getContext().getResources(),
            R.color.light_active_color);
    mDefaultTextColor = ApiCompatibilityUtils.getColor(getContext().getResources(),
            R.color.default_text_color);
}
 
源代码24 项目: AndroidChromium   文件: SyncErrorCardPreference.java
@Override
protected View onCreateView(ViewGroup parent) {
    View view = super.onCreateView(parent);
    TextView title = (TextView) view.findViewById(android.R.id.title);
    title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
    title.setTypeface(Typeface.create("sans-serif-medium", Typeface.NORMAL));
    title.setTextColor(ApiCompatibilityUtils.getColor(
            getContext().getResources(), R.color.input_underline_error_color));
    return view;
}
 
源代码25 项目: AndroidChromium   文件: CardUnmaskPrompt.java
public void disableAndWaitForVerification() {
    setInputsEnabled(false);
    setOverlayVisibility(View.VISIBLE);
    mVerificationProgressBar.setVisibility(View.VISIBLE);
    mVerificationView.setText(R.string.autofill_card_unmask_verification_in_progress);
    mVerificationView.announceForAccessibility(mVerificationView.getText());
    setInputError(null);
}
 
源代码26 项目: AndroidChromium   文件: OfflinePageUtils.java
/**
 * Shows the "reload" snackbar for the given tab.
 * @param activity The activity owning the tab.
 * @param snackbarController Class to show the snackbar.
 */
public static void showReloadSnackbar(Context context, SnackbarManager snackbarManager,
        final SnackbarController snackbarController, int tabId) {
    if (tabId == Tab.INVALID_TAB_ID) return;

    Log.d(TAG, "showReloadSnackbar called with controller " + snackbarController);
    Snackbar snackbar =
            Snackbar.make(context.getString(R.string.offline_pages_viewing_offline_page),
                    snackbarController, Snackbar.TYPE_ACTION, Snackbar.UMA_OFFLINE_PAGE_RELOAD)
                    .setSingleLine(false).setAction(context.getString(R.string.reload), tabId);
    snackbar.setDuration(sSnackbarDurationMs);
    snackbarManager.showSnackbar(snackbar);
}
 
源代码27 项目: delion   文件: AccountSigninView.java
private void setNegativeButtonVisible(boolean enabled) {
    if (enabled) {
        mNegativeButton.setVisibility(View.VISIBLE);
        findViewById(R.id.positive_button_end_padding).setVisibility(View.GONE);
    } else {
        mNegativeButton.setVisibility(View.GONE);
        findViewById(R.id.positive_button_end_padding).setVisibility(View.INVISIBLE);
    }
}
 
源代码28 项目: delion   文件: PaymentRequestSection.java
/**
 * Constructs an OptionSection.
 *
 * @param context     Context to pull resources from.
 * @param sectionName Title of the section to display.
 * @param emptyLabel  An optional string to display when no item is selected.
 * @param delegate    Delegate to alert when something changes in the dialog.
 */
public OptionSection(Context context, String sectionName, @Nullable CharSequence emptyLabel,
        SectionDelegate delegate) {
    super(context, sectionName, delegate);
    mVerticalMargin = context.getResources().getDimensionPixelSize(
            R.dimen.payments_section_small_spacing);
    mEmptyLabel = emptyLabel;
    mIconMaxWidth = context.getResources().getDimensionPixelSize(
            R.dimen.payments_section_logo_width);
    setSummaryText(emptyLabel, null);
}
 
源代码29 项目: delion   文件: PaymentRequestSection.java
private View createLoadingSpinner() {
    ViewGroup spinnyLayout = (ViewGroup) LayoutInflater.from(getContext()).inflate(
            R.layout.payment_request_spinny, null);

    TextView textView = (TextView) spinnyLayout.findViewById(R.id.message);
    textView.setText(getContext().getString(R.string.payments_checking_option));

    return spinnyLayout;
}
 
源代码30 项目: delion   文件: StackTab.java
/**
 * Helper function that gather the static constants from values/dimens.xml.
 * @param context The Android Context.
 */
public static void resetDimensionConstants(Context context) {
    Resources res = context.getResources();
    final float pxToDp = 1.0f / res.getDisplayMetrics().density;
    sStackedTabVisibleSize =
            res.getDimensionPixelOffset(R.dimen.stacked_tab_visible_size) * pxToDp;
    sStackBufferWidth = res.getDimensionPixelOffset(R.dimen.stack_buffer_width) * pxToDp;
    sStackBufferHeight = res.getDimensionPixelOffset(R.dimen.stack_buffer_height) * pxToDp;
}