本文整理汇总了Java中org.chromium.content.R类的典型用法代码示例。如果您正苦于以下问题:Java R类的具体用法?Java R怎么用?Java R使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
R类属于org.chromium.content包,在下文中一共展示了R类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startTracing
import org.chromium.content.R; //导入依赖的package包/类
/**
* Start profiling to the specified file. Returns true on success.
*
* Only one TracingControllerAndroid can be running at the same time. If another profiler
* is running when this method is called, it will be cancelled. If this
* profiler is already running, this method does nothing and returns false.
*
* @param filename The name of the file to output the profile data to.
* @param showToasts Whether or not we want to show toasts during this profiling session.
* When we are timing the profile run we might not want to incur extra draw overhead of showing
* notifications about the profiling system.
* @param categories Which categories to trace. See TracingControllerAndroid::BeginTracing()
* (in content/public/browser/trace_controller.h) for the format.
* @param traceOptions Which trace options to use. See
* TraceOptions::TraceOptions(const std::string& options_string)
* (in base/trace_event/trace_event_impl.h) for the format.
*/
public boolean startTracing(String filename, boolean showToasts, String categories,
String traceOptions) {
mShowToasts = showToasts;
if (isTracing()) {
// Don't need a toast because this shouldn't happen via the UI.
Log.e(TAG, "Received startTracing, but we're already tracing");
return false;
}
// Lazy initialize the native side, to allow construction before the library is loaded.
initializeNativeControllerIfNeeded();
if (!nativeStartTracing(mNativeTracingControllerAndroid, categories,
traceOptions.toString())) {
logAndToastError(mContext.getString(R.string.profiler_error_toast));
return false;
}
logForProfiler(String.format(PROFILER_STARTED_FMT, categories));
showToast(mContext.getString(R.string.profiler_started_toast) + ": " + categories);
mFilename = filename;
mIsTracing = true;
return true;
}
示例2: getView
import org.chromium.content.R; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View layout = convertView;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(mContext);
layout = inflater.inflate(R.layout.date_time_suggestion, parent, false);
}
TextView labelView = (TextView) layout.findViewById(R.id.date_time_suggestion_value);
TextView sublabelView = (TextView) layout.findViewById(R.id.date_time_suggestion_label);
if (position == getCount() - 1) {
labelView.setText(mContext.getText(R.string.date_picker_dialog_other_button_label));
sublabelView.setText("");
} else {
labelView.setText(getItem(position).localizedValue());
sublabelView.setText(getItem(position).label());
}
return layout;
}
示例3: MonthPicker
import org.chromium.content.R; //导入依赖的package包/类
public MonthPicker(Context context, double minValue, double maxValue) {
super(context, minValue, maxValue);
getPositionInYearSpinner().setContentDescription(
getResources().getString(R.string.accessibility_date_picker_month));
// initialization based on locale
mShortMonths =
DateFormatSymbols.getInstance(Locale.getDefault()).getShortMonths();
// logic duplicated from android.widget.DatePicker
if (usingNumericMonths()) {
// We're in a locale where a date should either be all-numeric, or all-text.
// All-text would require custom NumberPicker formatters for day and year.
for (int i = 0; i < mShortMonths.length; ++i) {
mShortMonths[i] = String.format("%d", i + 1);
}
}
// initialize to current date
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
init(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), null);
}
示例4: TwoFieldDatePickerDialog
import org.chromium.content.R; //导入依赖的package包/类
/**
* @param context The context the dialog is to run in.
* @param theme the theme to apply to this dialog
* @param callBack How the parent is notified that the date is set.
* @param year The initial year of the dialog.
* @param weekOfYear The initial week of the dialog.
*/
public TwoFieldDatePickerDialog(Context context,
int theme,
OnValueSetListener callBack,
int year,
int positionInYear,
double minValue,
double maxValue) {
super(context, theme);
mCallBack = callBack;
setButton(BUTTON_POSITIVE, context.getText(
R.string.date_picker_dialog_set), this);
setButton(BUTTON_NEGATIVE, context.getText(android.R.string.cancel),
(OnClickListener) null);
setIcon(0);
mPicker = createPicker(context, minValue, maxValue);
setView(mPicker);
mPicker.init(year, positionInYear, this);
}
示例5: initializeTextProcessingMenu
import org.chromium.content.R; //导入依赖的package包/类
/**
* Intialize the menu items for processing text, if there is any.
*/
private void initializeTextProcessingMenu(Menu menu) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M
|| !isSelectActionModeAllowed(MENU_ITEM_PROCESS_TEXT)) {
return;
}
PackageManager packageManager = mContext.getPackageManager();
List<ResolveInfo> supportedActivities =
packageManager.queryIntentActivities(createProcessTextIntent(), 0);
for (int i = 0; i < supportedActivities.size(); i++) {
ResolveInfo resolveInfo = supportedActivities.get(i);
CharSequence label = resolveInfo.loadLabel(mContext.getPackageManager());
menu.add(R.id.select_action_menu_text_processing_menus, Menu.NONE,
MENU_ITEM_ORDER_TEXT_PROCESS_START + i, label)
.setIntent(createProcessTextIntentForResolveInfo(resolveInfo))
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
}
示例6: share
import org.chromium.content.R; //导入依赖的package包/类
/**
* Perform a share action.
*/
@VisibleForTesting
void share() {
RecordUserAction.record("MobileActionMode.Share");
String query = sanitizeQuery(getSelectedText(), MAX_SHARE_QUERY_LENGTH);
if (TextUtils.isEmpty(query)) return;
Intent send = new Intent(Intent.ACTION_SEND);
send.setType("text/plain");
send.putExtra(Intent.EXTRA_TEXT, query);
try {
Intent i = Intent.createChooser(send, mContext.getString(R.string.actionbar_share));
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(i);
} catch (android.content.ActivityNotFoundException ex) {
// If no app handles it, do nothing.
}
}
示例7: createPasteMenu
import org.chromium.content.R; //导入依赖的package包/类
private void createPasteMenu(ActionMode mode, Menu menu) {
mode.setTitle(DeviceFormFactor.isTablet()
? mContext.getString(R.string.actionbar_textselection_title)
: null);
mode.setSubtitle(null);
SelectionPopupController.initializeMenu(mContext, mode, menu);
if (!mDelegate.canPaste()) menu.removeItem(R.id.select_action_menu_paste);
if (!mDelegate.canSelectAll()) menu.removeItem(R.id.select_action_menu_select_all);
if (!mDelegate.canPasteAsPlainText()) {
menu.removeItem(R.id.select_action_menu_paste_as_plain_text);
}
// TODO(ctzsm): Remove runtime title set after O SDK rolls.
MenuItem item = menu.findItem(R.id.select_action_menu_paste_as_plain_text);
if (item != null) {
item.setTitle(mContext.getResources().getIdentifier(
"paste_as_plain_text", "string", "android"));
}
menu.removeItem(R.id.select_action_menu_cut);
menu.removeItem(R.id.select_action_menu_copy);
menu.removeItem(R.id.select_action_menu_share);
menu.removeItem(R.id.select_action_menu_web_search);
}
示例8: onActionItemClicked
import org.chromium.content.R; //导入依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
int id = item.getItemId();
if (id == R.id.select_action_menu_paste) {
mDelegate.paste();
mode.finish();
}
if (id == R.id.select_action_menu_paste_as_plain_text) {
mDelegate.pasteAsPlainText();
mode.finish();
}
if (id == R.id.select_action_menu_select_all) {
mDelegate.selectAll();
mode.finish();
}
return true;
}
示例9: TwoFieldDatePickerDialog
import org.chromium.content.R; //导入依赖的package包/类
/**
* @param context The context the dialog is to run in.
* @param theme the theme to apply to this dialog
* @param callBack How the parent is notified that the date is set.
* @param year The initial year of the dialog.
* @param weekOfYear The initial week of the dialog.
*/
public TwoFieldDatePickerDialog(Context context,
int theme,
OnValueSetListener callBack,
int year,
int positionInYear,
long minValue,
long maxValue) {
super(context, theme);
mCallBack = callBack;
setButton(BUTTON_POSITIVE, context.getText(
R.string.date_picker_dialog_set), this);
setButton(BUTTON_NEGATIVE, context.getText(android.R.string.cancel),
(OnClickListener) null);
setIcon(0);
mPicker = createPicker(context, minValue, maxValue);
setView(mPicker);
mPicker.init(year, positionInYear, this);
}
示例10: startTracing
import org.chromium.content.R; //导入依赖的package包/类
/**
* Start profiling to a new file in the Downloads directory.
*
* Calls #startTracing(String, boolean, String, boolean) with a new timestamped filename.
* @see #startTracing(String, boolean, String, boolean)
*/
public boolean startTracing(boolean showToasts, String categories,
boolean recordContinuously) {
mShowToasts = showToasts;
String state = Environment.getExternalStorageState();
if (!Environment.MEDIA_MOUNTED.equals(state)) {
logAndToastError(
mContext.getString(R.string.profiler_no_storage_toast));
return false;
}
// Generate a hopefully-unique filename using the UTC timestamp.
// (Not a huge problem if it isn't unique, we'll just append more data.)
SimpleDateFormat formatter = new SimpleDateFormat(
"yyyy-MM-dd-HHmmss", Locale.US);
formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
File dir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_DOWNLOADS);
File file = new File(
dir, "chrome-profile-results-" + formatter.format(new Date()));
return startTracing(file.getPath(), showToasts, categories, recordContinuously);
}
示例11: createActionMenu
import org.chromium.content.R; //导入依赖的package包/类
private void createActionMenu(ActionMode mode, Menu menu) {
mode.getMenuInflater().inflate(R.menu.select_action_menu, menu);
if (!mEditable || !canPaste()) {
menu.removeItem(R.id.select_action_menu_paste);
}
if (!mEditable) {
menu.removeItem(R.id.select_action_menu_cut);
}
if (mEditable || !mActionHandler.isShareAvailable()) {
menu.removeItem(R.id.select_action_menu_share);
}
if (mEditable || mIncognito || !mActionHandler.isWebSearchAvailable()) {
menu.removeItem(R.id.select_action_menu_web_search);
}
}
示例12: onActionItemClicked
import org.chromium.content.R; //导入依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
int id = item.getItemId();
if (id == R.id.select_action_menu_select_all) {
mActionHandler.selectAll();
} else if (id == R.id.select_action_menu_cut) {
mActionHandler.cut();
} else if (id == R.id.select_action_menu_copy) {
mActionHandler.copy();
mode.finish();
} else if (id == R.id.select_action_menu_paste) {
mActionHandler.paste();
} else if (id == R.id.select_action_menu_share) {
mActionHandler.share();
mode.finish();
} else if (id == R.id.select_action_menu_web_search) {
mActionHandler.search();
mode.finish();
} else {
return false;
}
return true;
}
示例13: onActionItemClicked
import org.chromium.content.R; //导入依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
if (!mHelper.isActionModeValid()) return true;
if (item.getItemId() == R.id.select_action_menu_web_search) {
search();
mHelper.finishActionMode();
} else {
return mHelper.onActionItemClicked(mode, item);
}
return true;
}
示例14: getOverlayCornerRadius
import org.chromium.content.R; //导入依赖的package包/类
private static float getOverlayCornerRadius(Context context) {
if (sOverlayCornerRadius == 0) {
try {
sOverlayCornerRadius = context.getResources().getDimension(
R.dimen.link_preview_overlay_radius);
} catch (Resources.NotFoundException e) {
Log.w(TAG, "No corner radius resource for PopupZoomer overlay found.");
sOverlayCornerRadius = 1.0f;
}
}
return sOverlayCornerRadius;
}
示例15: getOverlayDrawable
import org.chromium.content.R; //导入依赖的package包/类
/**
* Gets the drawable that should be used to frame the zooming popup, loading
* it from the resource bundle if not already cached.
*/
private static Drawable getOverlayDrawable(Context context) {
if (sOverlayDrawable == null) {
try {
sOverlayDrawable = ApiCompatibilityUtils.getDrawable(context.getResources(),
R.drawable.ondemand_overlay);
} catch (Resources.NotFoundException e) {
Log.w(TAG, "No drawable resource for PopupZoomer overlay found.");
sOverlayDrawable = new ColorDrawable();
}
sOverlayPadding = new Rect();
sOverlayDrawable.getPadding(sOverlayPadding);
}
return sOverlayDrawable;
}