org.chromium.ui.R Java Examples
The following examples show how to use
org.chromium.ui.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: AutofillListAdapter.java From android-chromium with BSD 2-Clause "Simplified" License | 6 votes |
@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; }
Example #2
Source File: AutofillListAdapter.java From android-chromium with BSD 2-Clause "Simplified" License | 6 votes |
@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; }
Example #3
Source File: SelectFileDialog.java From 365browser with Apache License 2.0 | 6 votes |
@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); } }
Example #4
Source File: AutofillPopup.java From 365browser with Apache License 2.0 | 5 votes |
/** * 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)); }
Example #5
Source File: AutofillPopup.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * 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; }
Example #6
Source File: AutofillPopup.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * 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); }
Example #7
Source File: AutofillPopup.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * 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; }
Example #8
Source File: AutofillPopup.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * 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); }
Example #9
Source File: TextViewWithLeading.java From 365browser with Apache License 2.0 | 5 votes |
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(); }
Example #10
Source File: ButtonCompat.java From 365browser with Apache License 2.0 | 5 votes |
@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); }
Example #11
Source File: ButtonCompat.java From 365browser with Apache License 2.0 | 5 votes |
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); }
Example #12
Source File: Clipboard.java From 365browser with Apache License 2.0 | 5 votes |
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(); } }
Example #13
Source File: AutofillListAdapter.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
AutofillListAdapter(Context context, ArrayList<AutofillSuggestion> objects) { super(context, R.layout.autofill_text, objects); mContext = context; }
Example #14
Source File: ButtonCompat.java From 365browser with Apache License 2.0 | 4 votes |
private static boolean getRaisedStatusFromAttributeSet(Context context, AttributeSet attrs) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ButtonCompat, 0, 0); boolean raised = a.getBoolean(R.styleable.ButtonCompat_buttonRaised, true); a.recycle(); return raised; }
Example #15
Source File: ButtonCompat.java From 365browser with Apache License 2.0 | 4 votes |
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; }
Example #16
Source File: AutofillListAdapter.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
AutofillListAdapter(Context context, ArrayList<AutofillSuggestion> objects) { super(context, R.layout.autofill_text, objects); mContext = context; }
Example #17
Source File: ButtonCompat.java From 365browser with Apache License 2.0 | 4 votes |
/** * Returns a new borderless material-style button. */ public static Button createBorderlessButton(Context context) { return new Button(new ContextThemeWrapper(context, R.style.ButtonCompatBorderlessOverlay)); }