Java Code Examples for com.afollestad.materialdialogs.util.DialogUtils#resolveColor()
The following examples show how to use
com.afollestad.materialdialogs.util.DialogUtils#resolveColor() .
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: ColorChooserDialog.java From OpenHub with GNU General Public License v3.0 | 6 votes |
@ColorInt private int getSelectedColor() { if (colorChooserCustomFrame != null && colorChooserCustomFrame.getVisibility() == View.VISIBLE) { return selectedCustomColor; } int color = 0; if (subIndex() > -1) { color = colorsSub[topIndex()][subIndex()]; } else if (topIndex() > -1) { color = colorsTop[topIndex()]; } if (color == 0) { int fallback = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { fallback = DialogUtils.resolveColor(getActivity(), android.R.attr.colorAccent); } color = DialogUtils.resolveColor(getActivity(), R.attr.colorAccent, fallback); } return color; }
Example 2
Source File: ColorChooserDialog.java From APlayer with GNU General Public License v3.0 | 6 votes |
@ColorInt private int getSelectedColor() { if (mColorChooserCustomFrame != null && mColorChooserCustomFrame.getVisibility() == View.VISIBLE) { return mSelectedCustomColor; } int color = 0; if (subIndex() > -1) { color = mColorsSub[topIndex()][subIndex()]; } else if (topIndex() > -1) { color = mColorsTop[topIndex()]; } if (color == 0) { int fallback = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { fallback = DialogUtils.resolveColor(getActivity(), android.R.attr.colorAccent); } color = DialogUtils.resolveColor(getActivity(), R.attr.colorAccent, fallback); } return color; }
Example 3
Source File: DevicesCommandFragment.java From bleYan with GNU General Public License v2.0 | 6 votes |
protected void invalidateInputMinMaxIndicator(EditText inputMinMax, int currentLength) { if (inputMinMax != null) { int materialBlue = ContextCompat.getColor(getActivity(), com.afollestad.materialdialogs.R.color.md_material_blue_600); int widgetColor = DialogUtils.resolveColor(getActivity(), com.afollestad.materialdialogs.R.attr.colorAccent, materialBlue); if (Build.VERSION.SDK_INT >= 21) { widgetColor = DialogUtils.resolveColor(getActivity(), android.R.attr.colorAccent, widgetColor); } final boolean isDisabled = currentLength > 20; final int colorText = isDisabled ? ContextCompat.getColor(getActivity(), R.color.red) : -1; final int colorWidget = isDisabled ? ContextCompat.getColor(getActivity(), R.color.red) : widgetColor; inputMinMax.setTextColor(colorText); MDTintHelper.setTint(inputMinMax, colorWidget); } }
Example 4
Source File: BleDeviceActivity.java From bleYan with GNU General Public License v2.0 | 6 votes |
protected void invalidateInputMinMaxIndicator(EditText input, int currentLength) { if (input != null) { int materialBlue = ContextCompat.getColor(this, com.afollestad.materialdialogs.R.color.md_material_blue_600); int widgetColor = DialogUtils.resolveColor(this, com.afollestad.materialdialogs.R.attr.colorAccent, materialBlue); if (Build.VERSION.SDK_INT >= 21) { widgetColor = DialogUtils.resolveColor(this, android.R.attr.colorAccent, widgetColor); } final boolean isDisabled = currentLength > 20; final int colorText = isDisabled ? ContextCompat.getColor(this, R.color.red) : -1; final int colorWidget = isDisabled ? ContextCompat.getColor(this, R.color.red) : widgetColor; input.setTextColor(colorText); MDTintHelper.setTint(input, colorWidget); } }
Example 5
Source File: ArtistDetailActivity.java From Orin with GNU General Public License v3.0 | 5 votes |
private void setUpObservableListViewParams() { artistImageViewHeight = getResources().getDimensionPixelSize(R.dimen.header_image_height_artist_profile); toolbarColor = DialogUtils.resolveColor(this, R.attr.defaultFooterColor); int toolbarHeight = Util.getActionBarSize(this); titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height); headerOffset = toolbarHeight; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { headerOffset += getResources().getDimensionPixelSize(R.dimen.status_bar_padding); } }
Example 6
Source File: AlbumDetailActivity.java From Orin with GNU General Public License v3.0 | 5 votes |
private void setUpObservableListViewParams() { albumArtViewHeight = getResources().getDimensionPixelSize(R.dimen.header_image_height); toolbarColor = DialogUtils.resolveColor(this, R.attr.defaultFooterColor); int toolbarHeight = Util.getActionBarSize(this); titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height_album_detail); headerOffset = toolbarHeight; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { headerOffset += getResources().getDimensionPixelSize(R.dimen.status_bar_padding); } }
Example 7
Source File: MaterialEditTextPreference.java From 920-text-editor-v2 with Apache License 2.0 | 5 votes |
private void init(Context context, AttributeSet attrs) { setLayoutResource(context, this, attrs); int fallback; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) fallback = DialogUtils.resolveColor(context, android.R.attr.colorAccent); else fallback = 0; fallback = DialogUtils.resolveColor(context, com.afollestad.materialdialogs.commons.R.attr.colorAccent, fallback); mColor = DialogUtils.resolveColor(context, com.afollestad.materialdialogs.commons.R.attr.md_widget_color, fallback); mEditText = new AppCompatEditText(context, attrs); // Give it an ID so it can be saved/restored mEditText.setId(android.R.id.edit); mEditText.setEnabled(true); }