本文整理汇总了Java中org.chromium.ui.R类的典型用法代码示例。如果您正苦于以下问题:Java R类的具体用法?Java R怎么用?Java R使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
R类属于org.chromium.ui包,在下文中一共展示了R类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPostExecute
import org.chromium.ui.R; //导入依赖的package包/类
@Override
protected void onPostExecute(Uri result) {
mCameraOutputUri = result;
if (mCameraOutputUri == null && captureCamera()) {
onFileNotSelected();
return;
}
Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
camera.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION
| Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
camera.putExtra(MediaStore.EXTRA_OUTPUT, mCameraOutputUri);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
camera.setClipData(ClipData.newUri(
mWindowAndroid.getApplicationContext().getContentResolver(),
UiUtils.IMAGE_FILE_PATH, mCameraOutputUri));
}
if (mDirectToCamera) {
mWindow.showIntent(camera, mCallback, R.string.low_memory_error);
} else {
launchSelectFileWithCameraIntent(true, camera);
}
}
示例2: getView
import org.chromium.ui.R; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View layout = convertView;
if (convertView == null) {
LayoutInflater inflater =
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layout = inflater.inflate(R.layout.autofill_text, null);
}
TextView labelView = (TextView) layout.findViewById(R.id.autofill_label);
labelView.setText(getItem(position).mLabel);
TextView sublabelView = (TextView) layout.findViewById(R.id.autofill_sublabel);
CharSequence sublabel = getItem(position).mSublabel;
if (TextUtils.isEmpty(sublabel)) {
sublabelView.setVisibility(View.GONE);
} else {
sublabelView.setText(sublabel);
sublabelView.setVisibility(View.VISIBLE);
}
return layout;
}
示例3: setPrimaryClipNoException
import org.chromium.ui.R; //导入依赖的package包/类
public void setPrimaryClipNoException(ClipData clip) {
try {
mClipboardManager.setPrimaryClip(clip);
} catch (Exception ex) {
// Ignore any exceptions here as certain devices have bugs and will fail.
String text = mContext.getString(R.string.copy_to_clipboard_failure_message);
Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show();
}
}
示例4: ButtonCompat
import org.chromium.ui.R; //导入依赖的package包/类
private ButtonCompat(
Context context, int buttonColor, boolean buttonRaised, AttributeSet attrs) {
// To apply the ButtonCompat style to this view, use a ContextThemeWrapper to overlay the
// ButtonCompatThemeOverlay, which simply sets the buttonStyle to @style/ButtonCompat.
super(new ContextThemeWrapper(context, R.style.ButtonCompatOverlay), attrs);
getBackground().mutate();
setButtonColor(buttonColor);
setRaised(buttonRaised);
}
示例5: updateButtonBackgroundL
import org.chromium.ui.R; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void updateButtonBackgroundL() {
ColorStateList csl = new ColorStateList(
new int[][] { { -android.R.attr.state_enabled }, {} },
new int[] { DISABLED_COLOR, mColor });
GradientDrawable shape = (GradientDrawable)
((RippleDrawable) getBackground()).getDrawable(0);
shape.mutate();
shape.setColor(csl);
}
示例6: TextViewWithLeading
import org.chromium.ui.R; //导入依赖的package包/类
public TextViewWithLeading(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TextViewWithLeading, 0, 0);
if (a.hasValue(R.styleable.TextViewWithLeading_leading)) {
final float leading = a.getDimension(R.styleable.TextViewWithLeading_leading, 0f);
final float oldLeading = getPaint().getFontMetrics(null);
setLineSpacing(leading - oldLeading, 1f);
}
a.recycle();
}
示例7: AutofillPopup
import org.chromium.ui.R; //导入依赖的package包/类
/**
* Creates an AutofillWindow with specified parameters.
* @param context Application context.
* @param anchorView View anchored for popup.
* @param autofillDelegate An object that handles the calls to the native AutofillPopupView.
*/
public AutofillPopup(Context context, View anchorView, AutofillDelegate autofillDelegate) {
super(context, anchorView);
mContext = context;
mAutofillDelegate = autofillDelegate;
setOnItemClickListener(this);
setOnDismissListener(this);
disableHideOnOutsideTap();
setContentDescriptionForAccessibility(
mContext.getString(R.string.autofill_popup_content_description));
}
示例8: AutofillPopup
import org.chromium.ui.R; //导入依赖的package包/类
/**
* Creates an AutofillWindow with specified parameters.
* @param context Application context.
* @param viewAndroidDelegate View delegate used to add and remove views.
* @param autofillCallback A object that handles the calls to the native AutofillPopupView.
*/
public AutofillPopup(Context context, ViewAndroidDelegate viewAndroidDelegate,
AutofillPopupDelegate autofillCallback) {
super(context, null, 0, R.style.AutofillPopupWindow);
mContext = context;
mViewAndroidDelegate = viewAndroidDelegate ;
mAutofillCallback = autofillCallback;
setOnItemClickListener(this);
mAnchorView = mViewAndroidDelegate.acquireAnchorView();
mAnchorView.setId(R.id.autofill_popup_window);
mAnchorView.setTag(this);
mViewAndroidDelegate.setAnchorViewPosition(mAnchorView, mAnchorX, mAnchorY, mAnchorWidth,
mAnchorHeight);
mLayoutChangeListener = new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
if (v == mAnchorView) AutofillPopup.this.show();
}
};
mAnchorView.addOnLayoutChangeListener(mLayoutChangeListener);
setAnchorView(mAnchorView);
}
示例9: getDesiredWidth
import org.chromium.ui.R; //导入依赖的package包/类
/**
* Get desired popup window width by calculating the maximum text length from Autofill data.
* @param data Autofill suggestion data.
* @return The popup window width in DIP.
*/
private float getDesiredWidth(ArrayList<AutofillSuggestion> data) {
if (mLabelViewPaint == null || mSublabelViewPaint == null) {
LayoutInflater inflater =
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.autofill_text, null);
TextView labelView = (TextView) layout.findViewById(R.id.autofill_label);
mLabelViewPaint = labelView.getPaint();
TextView sublabelView = (TextView) layout.findViewById(R.id.autofill_sublabel);
mSublabelViewPaint = sublabelView.getPaint();
}
float maxTextWidth = 0;
Rect bounds = new Rect();
for (int i = 0; i < data.size(); ++i) {
bounds.setEmpty();
String label = data.get(i).mLabel;
if (!TextUtils.isEmpty(label)) {
mLabelViewPaint.getTextBounds(label, 0, label.length(), bounds);
}
float labelWidth = bounds.width();
bounds.setEmpty();
String sublabel = data.get(i).mSublabel;
if (!TextUtils.isEmpty(sublabel)) {
mSublabelViewPaint.getTextBounds(sublabel, 0, sublabel.length(), bounds);
}
float localMax = Math.max(labelWidth, bounds.width());
maxTextWidth = Math.max(maxTextWidth, localMax);
}
// Scale it down to make it unscaled by screen density.
maxTextWidth = maxTextWidth / mContext.getResources().getDisplayMetrics().density;
// Adding padding.
return maxTextWidth + TEXT_PADDING_DP;
}
示例10: onIntentCompleted
import org.chromium.ui.R; //导入依赖的package包/类
/**
* Callback method to handle the intent results and pass on the path to the native
* SelectFileDialog.
* @param window The window that has access to the application activity.
* @param resultCode The result code whether the intent returned successfully.
* @param contentResolver The content resolver used to extract the path of the selected file.
* @param results The results of the requested intent.
*/
@Override
public void onIntentCompleted(WindowAndroid window, int resultCode,
ContentResolver contentResolver, Intent results) {
if (resultCode != Activity.RESULT_OK) {
onFileNotSelected();
return;
}
if (results == null) {
// If we have a successful return but no data, then assume this is the camera returning
// the photo that we requested.
nativeOnFileSelected(mNativeSelectFileDialog, mCameraOutputUri.getPath(), "");
// Broadcast to the media scanner that there's a new photo on the device so it will
// show up right away in the gallery (rather than waiting until the next time the media
// scanner runs).
window.sendBroadcast(new Intent(
Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, mCameraOutputUri));
return;
}
if (ContentResolver.SCHEME_FILE.equals(results.getData().getScheme())) {
nativeOnFileSelected(mNativeSelectFileDialog,
results.getData().getSchemeSpecificPart(), "");
return;
}
if (ContentResolver.SCHEME_CONTENT.equals(results.getScheme())) {
nativeOnFileSelected(mNativeSelectFileDialog,
results.getData().toString(),
resolveFileName(results.getData(),
contentResolver));
return;
}
onFileNotSelected();
window.showError(R.string.opening_file_error);
}
示例11: setPrimaryClipNoException
import org.chromium.ui.R; //导入依赖的package包/类
private void setPrimaryClipNoException(ClipData clip) {
try {
mClipboardManager.setPrimaryClip(clip);
} catch (Exception ex) {
// Ignore any exceptions here as certain devices have bugs and will fail.
String text = mContext.getString(R.string.copy_to_clipboard_failure_message);
Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show();
}
}
示例12: AutofillListAdapter
import org.chromium.ui.R; //导入依赖的package包/类
AutofillListAdapter(Context context,
ArrayList<AutofillSuggestion> objects,
Set<Integer> separators) {
super(context, R.layout.autofill_text, objects);
mSeparators = separators;
mContext = context;
}
示例13: AutofillPopup
import org.chromium.ui.R; //导入依赖的package包/类
/**
* Creates an AutofillWindow with specified parameters.
* @param context Application context.
* @param viewAndroidDelegate View delegate used to add and remove views.
* @param autofillCallback A object that handles the calls to the native AutofillPopupView.
*/
public AutofillPopup(Context context, ViewAndroidDelegate viewAndroidDelegate,
AutofillPopupDelegate autofillCallback) {
super(context, null, 0, R.style.AutofillPopupWindow);
mContext = context;
mViewAndroidDelegate = viewAndroidDelegate;
mAutofillCallback = autofillCallback;
setOnItemClickListener(this);
mAnchorView = mViewAndroidDelegate.acquireAnchorView();
mAnchorView.setId(R.id.autofill_popup_window);
mAnchorView.setTag(this);
mViewAndroidDelegate.setAnchorViewPosition(mAnchorView, mAnchorX, mAnchorY, mAnchorWidth,
mAnchorHeight);
mLayoutChangeListener = new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
if (v == mAnchorView) AutofillPopup.this.show();
}
};
mAnchorView.addOnLayoutChangeListener(mLayoutChangeListener);
setAnchorView(mAnchorView);
}
示例14: createBorderlessButton
import org.chromium.ui.R; //导入依赖的package包/类
/**
* Returns a new borderless material-style button.
*/
public static Button createBorderlessButton(Context context) {
return new Button(new ContextThemeWrapper(context, R.style.ButtonCompatBorderlessOverlay));
}
示例15: getColorFromAttributeSet
import org.chromium.ui.R; //导入依赖的package包/类
private static int getColorFromAttributeSet(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ButtonCompat, 0, 0);
int color = a.getColor(R.styleable.ButtonCompat_buttonColor, Color.WHITE);
a.recycle();
return color;
}