本文整理汇总了Java中com.joanzapata.iconify.Icon类的典型用法代码示例。如果您正苦于以下问题:Java Icon类的具体用法?Java Icon怎么用?Java Icon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Icon类属于com.joanzapata.iconify包,在下文中一共展示了Icon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showError
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
/**
* Show the error notification as a modal dialog, according to the provided details.
*
* @param errorResId The resource ID of the error message.
* @param icon The error icon. This is currently ignored here.
* @param actionTextResId The resource ID of the action button text.
* @param actionListener The callback to be invoked when the action button is clicked.
*/
@Override
public void showError(@StringRes final int errorResId,
@Nullable final Icon icon,
@StringRes final int actionTextResId,
@Nullable final View.OnClickListener actionListener) {
if (baseFragment.isResumed()) {
AlertDialogFragment.newInstance(0, errorResId,
actionListener == null ? null :
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
actionListener.onClick(((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE));
}
}
).show(baseFragment.getChildFragmentManager(), null);
}
}
示例2: setupNavItem
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
private void setupNavItem(int item, Icon icon) {
MenuItem navItem = navigationView.getMenu().findItem(item);
int color = ContextCompat.getColor(this, R.color.colorTextPrimary);
SpannableString s = new SpannableString(navItem.getTitle());
s.setSpan(new ForegroundColorSpan(color), 0, s.length(), 0);
navItem.setTitle(s);
navItem.setIcon(new IconDrawable(this, icon).color(color));
}
示例3: CustomTypefaceSpan
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
public CustomTypefaceSpan(@NonNull TextView view, @NonNull Icon icon,
@NonNull Typeface type, @Size float iconSizePx,
@FloatRange(from = -1f, to = 1f) float iconSizeRatio,
@ColorInt int iconColor, @NonNull Animation animation,
boolean baselineAligned) {
this.view = view;
this.animation = animation;
this.baselineAligned = baselineAligned;
this.icon = String.valueOf(icon.character());
this.type = type;
this.iconSizePx = iconSizePx;
this.iconSizeRatio = iconSizeRatio;
this.iconColor = iconColor;
this.mirrorable = SDK_INT >= JELLY_BEAN_MR1 && icon.supportsRtl();
}
示例4: IconFontDescriptorWrapper
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
public IconFontDescriptorWrapper(@NonNull IconFontDescriptor iconFontDescriptor) {
this.iconFontDescriptor = iconFontDescriptor;
iconsByKey = new HashMap<String, Icon>();
Icon[] characters = iconFontDescriptor.characters();
for (int i = 0, charactersLength = characters.length; i < charactersLength; i++) {
Icon icon = characters[i];
iconsByKey.put(icon.key(), icon);
}
}
示例5: getIcon
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
@Nullable
public final Icon getIcon() {
Drawable drawable = getDrawable();
if (drawable instanceof IconDrawable) {
return ((IconDrawable) drawable).getIcon();
}
return null;
}
示例6: showErrorMessage
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
/**
* Shows the error message with the given icon, if the web page failed to load
*
* @param errorMsg The error message to show
* @param errorIcon The error icon to show with the error message
*/
private void showErrorMessage(@StringRes int errorMsg, @NonNull Icon errorIcon) {
if (!pageIsLoaded) {
tryToClearWebView();
showErrorView(getResources().getString(errorMsg), errorIcon);
}
}
示例7: showErrorView
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
private void showErrorView(@NonNull String errorMsg, @NonNull Icon errorIcon) {
if (isManuallyReloadable) {
fullScreenErrorNotification.showError(errorMsg, errorIcon, R.string.lbl_reload, new OnClickListener() {
@Override
public void onClick(View v) {
onRefresh();
}
});
} else {
fullScreenErrorNotification.showError(errorMsg, errorIcon, 0, null);
}
}
示例8: getIndeterminateIcon
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
@Nullable
public final Icon getIndeterminateIcon() {
Drawable drawable = getIndeterminateDrawable();
if (drawable instanceof IconDrawable) {
return ((IconDrawable) drawable).getIcon();
}
return null;
}
示例9: bindNumberCommentsView
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
private void bindNumberCommentsView(NumberResponsesViewHolder holder, DiscussionComment response) {
String text;
Icon icon;
int numChildren = response == null ? 0 : response.getChildCount();
if (response.getChildCount() == 0) {
if (discussionThread.isClosed() || courseData.isDiscussionBlackedOut()) {
text = context.getString(R.string.discussion_add_comment_disabled_title);
icon = FontAwesomeIcons.fa_lock;
} else {
text = context.getString(R.string.number_responses_or_comments_add_comment_label);
icon = FontAwesomeIcons.fa_comment;
}
} else {
text = context.getResources().getQuantityString(
R.plurals.number_responses_or_comments_comments_label, numChildren, numChildren);
icon = FontAwesomeIcons.fa_comment;
}
holder.numberResponsesOrCommentsLabel.setText(text);
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(
holder.numberResponsesOrCommentsLabel,
new IconDrawable(context, icon)
.colorRes(context, R.color.edx_brand_gray_base)
.sizeRes(context, R.dimen.edx_small),
null, null, null);
}
示例10: showErrorMessage
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
private void showErrorMessage(String errorMsg, @NonNull Icon errorIcon) {
errorTextView.setVisibility(View.VISIBLE);
errorTextView.setText(errorMsg);
errorTextView.setCompoundDrawablesWithIntrinsicBounds(null,
new IconDrawable(this, errorIcon)
.sizeRes(this, R.dimen.content_unavailable_error_icon_size)
.colorRes(this, R.color.edx_brand_gray_back),
null, null
);
}
示例11: addDetectedValueHeader
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
private static void addDetectedValueHeader(@NonNull ListView listView, @StringRes int labelRes, @NonNull String labelKey, @NonNull String labelValue, @NonNull String value, @NonNull Icon icon) {
final TextView textView = (TextView) LayoutInflater.from(listView.getContext()).inflate(R.layout.edx_selectable_list_item, listView, false);
{
final SpannableString labelValueSpan = new SpannableString(labelValue);
labelValueSpan.setSpan(new ForegroundColorSpan(listView.getResources().getColor(R.color.edx_brand_gray_base)), 0, labelValueSpan.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
textView.setText(ResourceUtil.getFormattedString(listView.getContext().getResources(), labelRes, labelKey, labelValueSpan));
}
Context context = textView.getContext();
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(textView,
new IconDrawable(context, icon)
.sizeRes(context, R.dimen.edx_base)
.colorRes(context, R.color.edx_brand_gray_back)
, null, null, null);
listView.addHeaderView(textView, new FormOption(labelValue, value), true);
}
示例12: FragmentItemModel
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
public FragmentItemModel(@NonNull Class<? extends Fragment> fragmentClass, @NonNull CharSequence title,
Icon icon, Bundle args, FragmentStateListener listener) {
if (args != null) {
args.setClassLoader(fragmentClass.getClassLoader());
}
this.fragmentClass = fragmentClass;
this.title = title;
this.icon = icon;
this.args = args;
this.listener = listener;
}
示例13: showError
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
/**
* Show the error notification with the message appropriate for the provided error.
*
* @param context The Context, to be used for checking connectivity status.
* @param error The error that occurred while attempting to retrieve from or deliver to the
* remote server. This may be an {@link IOException} if the request failed due to a
* network failure, an {HttpResponseStatusException} if the failure was due to
* receiving an error code, or any {@link Throwable} implementation if one was
* thrown unexpectedly while creating the request or processing the response.
* @param actionTextResId The resource ID of the action button text.
* @param actionListener The callback to be invoked when the action button is clicked.
*/
public void showError(@NonNull final Context context, @NonNull final Throwable error,
@StringRes int actionTextResId,
@Nullable View.OnClickListener actionListener) {
@StringRes
final int errorResId = ErrorUtils.getErrorMessageRes(context, error, this);
final Icon icon = ErrorUtils.getErrorIcon(error);
if (errorResId == R.string.app_version_unsupported) {
actionTextResId = R.string.label_update;
actionListener = AppStoreUtils.OPEN_APP_IN_APP_STORE_CLICK_LISTENER;
}
showError(errorResId, icon, actionTextResId, actionListener);
}
示例14: showError
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
/**
* Show the error notification as a persistent Snackbar, according to the provided details.
*
* @param errorResId The resource ID of the error message.
* @param icon The error icon. This is ignored here, since Snackbar doesn't really support
* icons.
* @param actionTextResId The resource ID of the action button text.
* @param actionListener The callback to be invoked when the action button is clicked.
*/
@Override
public void showError(@StringRes final int errorResId,
@Nullable final Icon icon,
@StringRes final int actionTextResId,
@Nullable final View.OnClickListener actionListener) {
if (snackbar == null) {
snackbar = Snackbar.make(view, errorResId, LENGTH_INDEFINITE);
if (actionTextResId != 0) {
// SnackBar automatically dimisses when the action item is pressed.
// This workaround has been implemented to by pass that behaviour.
snackbar.setAction(actionTextResId, new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
snackbar.addCallback(new BaseTransientBottomBar.BaseCallback<Snackbar>() {
@Override
public void onDismissed(Snackbar transientBottomBar, int event) {
super.onDismissed(transientBottomBar, event);
snackbar = null;
}
});
// By applying the listener to the button like we have done below, the Snackbar
// doesn't automatically dismiss and we have to manually dismiss it.
final Button actionButton = (Button) snackbar.getView().findViewById(android.support.design.R.id.snackbar_action);
actionButton.setOnClickListener(actionListener);
snackbar.show();
}
}
示例15: showError
import com.joanzapata.iconify.Icon; //导入依赖的package包/类
/**
* Show the error notification as an overlay message on top of the content area, according to
* the provided details.
* <p>
* The root view will be determined by walking up the view tree to see if there is any view with
* the ID of {@link R.id#content_error R.id.content_error}. If one is found, then that would be
* used as the root. If not, then if the content view's parent is already a FrameLayout, then
* that would be used; otherwise a new one will be created, inserted as the new parent, and used
* as the root.
*
* @param errorMsg The error message.
* @param icon The error icon.
* @param actionTextResId The resource ID of the action button text.
* @param actionListener The callback to be invoked when the action button is clicked.
*/
public void showError(@NonNull final String errorMsg,
@Nullable final Icon icon,
@StringRes final int actionTextResId,
@Nullable final View.OnClickListener actionListener) {
final ViewGroup root = findSuitableAncestorLayout();
if (root == null) return;
final View layoutView = root.findViewById(R.id.content_error);
if (layoutView instanceof ViewGroup) {
errorLayout = (ViewGroup) layoutView;
} else {
final LayoutInflater layoutInflater = LayoutInflater.from(view.getContext());
errorLayout = (ViewGroup) layoutInflater.inflate(R.layout.content_error, root, false);
root.addView(errorLayout);
}
final TextView messageView = (TextView) errorLayout.findViewById(R.id.content_error_text);
final Button actionButton = (Button) errorLayout.findViewById(R.id.content_error_action);
final IconImageView iconView = (IconImageView) errorLayout.findViewById(R.id.content_error_icon);
messageView.setText(errorMsg);
if (icon == null) {
iconView.setVisibility(GONE);
} else {
iconView.setVisibility(VISIBLE);
iconView.setIcon(icon);
}
if (actionTextResId == 0 || actionListener == null) {
actionButton.setVisibility(GONE);
} else {
actionButton.setVisibility(VISIBLE);
actionButton.setText(actionTextResId);
actionButton.setOnClickListener(actionListener);
}
view.setVisibility(GONE);
errorLayout.setVisibility(VISIBLE);
}