本文整理汇总了Java中com.joanzapata.iconify.IconDrawable类的典型用法代码示例。如果您正苦于以下问题:Java IconDrawable类的具体用法?Java IconDrawable怎么用?Java IconDrawable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IconDrawable类属于com.joanzapata.iconify包,在下文中一共展示了IconDrawable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: IconImageView
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
public IconImageView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
final TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.IconImageView, defStyleAttr, 0);
ColorStateList colorStateList = a.getColorStateList(R.styleable.IconImageView_iconColor);
if (colorStateList != null) {
this.colorStateList = colorStateList;
}
String iconKey = a.getString(R.styleable.IconImageView_iconName);
if (iconKey != null) {
IconDrawable drawable = new IconDrawable(context, iconKey);
switch (Animation.values()[a.getInt(R.styleable.IconImageView_iconAnimation,
Animation.NONE.ordinal())]) {
case SPIN:
drawable.spin();
break;
case PULSE:
drawable.pulse();
break;
}
setImageDrawable(drawable);
}
a.recycle();
}
示例2: setIconAnimation
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
public void setIconAnimation(@NonNull Animation animation, boolean restart) {
Drawable drawable = getDrawable();
if (drawable instanceof IconDrawable) {
IconDrawable iconDrawable = (IconDrawable) drawable;
switch (animation) {
case SPIN:
iconDrawable.spin();
break;
case PULSE:
iconDrawable.pulse();
break;
case NONE:
iconDrawable.stop();
break;
}
if (restart && getVisibility() == VISIBLE) {
iconDrawable.setVisible(true, true);
}
}
}
示例3: IconImageButton
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
public IconImageButton(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
final TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.IconImageView, defStyleAttr, 0);
ColorStateList colorStateList = a.getColorStateList(R.styleable.IconImageView_iconColor);
if (colorStateList != null) {
this.colorStateList = colorStateList;
}
String iconKey = a.getString(R.styleable.IconImageView_iconName);
if (iconKey != null) {
IconDrawable drawable = new IconDrawable(context, iconKey);
switch (Animation.values()[a.getInt(R.styleable.IconImageView_iconAnimation,
Animation.NONE.ordinal())]) {
case SPIN:
drawable.spin();
break;
case PULSE:
drawable.pulse();
break;
}
setImageDrawable(drawable);
}
a.recycle();
}
示例4: AuthorLayoutViewHolder
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
public AuthorLayoutViewHolder(View itemView) {
profileRow = (ViewGroup) itemView;
profileImageView = (ImageView) itemView.findViewById(R.id.profile_image);
authorTextView = (TextView) itemView.findViewById(R.id.discussion_author_text_view);
dateTextView = (TextView) itemView.findViewById(R.id.discussion_date_text_view);
answerTextView = (TextView) itemView.findViewById(R.id.discussion_responses_answer_text_view);
final Context context = answerTextView.getContext();
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(
answerTextView,
new IconDrawable(context, FontAwesomeIcons.fa_check_square_o)
.sizeRes(context, R.dimen.edx_base)
.colorRes(context, R.color.edx_success_accent),
null, null, null);
RoboGuice.getInjector(context).injectMembers(this);
}
示例5: onStart
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
@Override
protected void onStart() {
super.onStart();
if (searchQuery != null) {
setTitle(getString(R.string.discussion_posts_search_title));
return;
}
if (discussionTopic != null && discussionTopic.getName() != null) {
if (discussionTopic.isFollowingType()) {
SpannableString title = new SpannableString(" " + discussionTopic.getName());
IconDrawable starIcon = new IconDrawable(this, FontAwesomeIcons.fa_star)
.colorRes(this, R.color.white)
.sizeRes(this, R.dimen.edx_base)
.tint(null); // IconDrawable is tinted by default, but we don't want it to be tinted here
starIcon.setBounds(0, 0, starIcon.getIntrinsicWidth(), starIcon.getIntrinsicHeight());
ImageSpan iSpan = new ImageSpan(starIcon, ImageSpan.ALIGN_BASELINE);
title.setSpan(iSpan, 0, 1, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
setTitle(title);
} else {
setTitle(discussionTopic.getName());
}
}
}
示例6: createField
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
private static TextView createField(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent, @NonNull final FormField field, @NonNull final String value, boolean readOnly, @NonNull View.OnClickListener onClickListener) {
final TextView textView = (TextView) inflater.inflate(R.layout.edit_user_profile_field, parent, false);
final SpannableString formattedValue = new SpannableString(value);
formattedValue.setSpan(new ForegroundColorSpan(parent.getResources().getColor(R.color.edx_brand_gray_base)), 0, formattedValue.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
textView.setText(ResourceUtil.getFormattedString(parent.getResources(), R.string.edit_user_profile_field, new HashMap<String, CharSequence>() {{
put("label", field.getLabel());
put("value", formattedValue);
}}));
Context context = parent.getContext();
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(
textView, null, null, new IconDrawable(context, FontAwesomeIcons.fa_angle_right)
.colorRes(context, R.color.edx_brand_gray_back)
.sizeDp(context, 24), null);
if (readOnly) {
textView.setEnabled(false);
textView.setBackgroundColor(textView.getResources().getColor(R.color.edx_brand_gray_x_back));
} else {
textView.setOnClickListener(onClickListener);
}
parent.addView(textView);
return textView;
}
示例7: IconProgressBar
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
public IconProgressBar(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
final TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.IconProgressBar, defStyleAttr, 0);
ColorStateList colorStateList = a.getColorStateList(
R.styleable.IconProgressBar_indeterminateIconColor);
this.colorStateList = colorStateList != null ? colorStateList :
ColorStateList.valueOf(DEFAULT_COLOR);
String iconKey = a.getString(R.styleable.IconProgressBar_indeterminateIconName);
if (iconKey != null) {
IconDrawable drawable = new IconDrawable(context, iconKey);
if (a.getBoolean(R.styleable.IconProgressBar_indeterminateIconPulse, false)) {
// Change animation mode to pulse without running it, as the
// animation is controlled by the ProgressBar implementation.
drawable.pulse();
drawable.stop();
}
setIndeterminateDrawable(drawable);
}
a.recycle();
}
示例8: updatePausePlay
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
public void updatePausePlay() {
if (mRoot == null || mPauseButton == null || mPlayer == null) {
return;
}
if (mPlayer.isPlaying()) {
mPauseButton.setImageDrawable(new IconDrawable(getContext(), FontAwesomeIcons.fa_pause)
.colorRes(getContext(), R.color.white));
mPauseButton.setContentDescription(getContext().getResources()
.getString(R.string.video_player_pause));
} else {
mPauseButton.setImageDrawable(new IconDrawable(getContext(), FontAwesomeIcons.fa_play)
.colorRes(getContext(),R.color.white));
mPauseButton.setContentDescription(getContext().getResources()
.getString(R.string.video_player_play));
}
}
示例9: getMaterialAboutList
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
@NonNull
@Override
protected MaterialAboutList getMaterialAboutList(@NonNull Context context)
{
MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder();
appCardBuilder.addItem(new MaterialAboutTitleItem.Builder()
.text(getString(R.string.app_name))
.icon(R.drawable.ic_app)
.build());
appCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text("Licenses")
.icon(new IconDrawable(context, FontAwesomeIcons.fa_file_text).sizeDp(18))
.setOnClickAction(() ->
context.startActivity(LicenseActivity.createIntent(context)))
.build());
MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder();
authorCardBuilder.title("Author");
authorCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text("Josh Laird")
.subText("London, UK")
.icon(new IconDrawable(context, FontAwesomeIcons.fa_user).sizeDp(18))
.build());
authorCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text("Fork on Github")
.icon(new IconDrawable(context, FontAwesomeIcons.fa_github).sizeDp(18))
.setOnClickAction(() ->
{
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://github.com/jbmlaird"));
startActivity(intent);
})
.build());
return new MaterialAboutList(appCardBuilder.build(), authorCardBuilder.build());
}
示例10: buildMaterialAboutCard
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
/**
* Convenience builder for the {@link MaterialAboutCard}s.
*
* @param c Activity context
* @param text Library name
* @param license Library license
* @param year Library year copyright
* @param author Library author
* @return Built MaterialAboutCard
*/
private MaterialAboutCard buildMaterialAboutCard(Context c, String text, int license, String year, String author)
{
MaterialAboutCard.Builder builder = new MaterialAboutCard.Builder();
builder.addItem(new MaterialAboutActionItem.Builder()
.text(text)
.subText(String.format(getString(license), year, author))
.icon(new IconDrawable(c, FontAwesomeIcons.fa_book).sizeDp(18))
.setIconGravity(MaterialAboutActionItem.GRAVITY_TOP)
.build());
return builder.build();
}
示例11: onCreateView
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_map, container, false);
((FloatingActionButton) view.findViewById(R.id.myFAB)).setImageDrawable(new IconDrawable(getContext(), MaterialIcons.md_directions_walk).colorRes(R.color.white));
drawer = (SlidingUpPanelLayout)view.findViewById(R.id.sliding_layout);
drawer.setPanelSlideListener(new DrawerListener());
fab = (FloatingActionButton)view.findViewById(R.id.myFAB);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (selectedMarker != null) {
LatLng ll = selectedMarker.getPosition();
Uri directionsUri = Uri.parse("google.navigation:q=" + ll.latitude + "," + ll.longitude + "&mode=w");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, directionsUri);
startActivity(mapIntent);
}
}
});
setUpMapIfNeeded();
if (savedInstanceState != null){
processBundle(savedInstanceState);
} else {
processBundle(getArguments());
}
trolleyMan.startUpdates();
return view;
}
示例12: refresh
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
private void refresh(){
txtHash.setText(document.hash);
txtPath.setText(document.path);
txtCreated.setText(getDate(document.created_at));
if(document.stamped_at==null || document.stamped_at==0){
txtStamped.setText("Processing...");
btnShow.setVisibility(View.GONE);
}else {
txtStamped.setText(getDate(document.stamped_at));
btnShow.setVisibility(View.VISIBLE);
}
btnShow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
clipboard.setText(document.stamp);
//ClipData clip = ClipData.newPlainText(label, text);
//clipboard.setPrimaryClip(clip);
}
});
// Set the imageview retrieved from the document
try {
Uri uri = Uri.parse(document.path);
Bitmap bitmap = decodeImageFile(uri,400,400);
if(bitmap==null)
throw new Exception();
imageView.setImageBitmap(bitmap);
}catch (Exception e ) {
e.printStackTrace();
//imageView.setVisibility(View.GONE);
imageView.setImageDrawable( new IconDrawable(this,FontAwesomeIcons.fa_file).colorRes(R.color.accent).sizeDp(50) );
}
}
示例13: setupNavItem
import com.joanzapata.iconify.IconDrawable; //导入依赖的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));
}
示例14: setActive
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
private void setActive(int item) {
NavService.getInstance().currentNav = item;
NavBaseActivity.activeMenuItem = navigationView.getMenu().findItem(item);
int color = ContextCompat.getColor(this, R.color.colorAccent);
SpannableString s = new SpannableString(NavBaseActivity.activeMenuItem.getTitle());
s.setSpan(new ForegroundColorSpan(color), 0, s.length(), 0);
NavBaseActivity.activeMenuItem.setTitle(s);
IconDrawable activeIcon = (IconDrawable) NavBaseActivity.activeMenuItem.getIcon();
activeIcon.color(color);
}
示例15: afterViews
import com.joanzapata.iconify.IconDrawable; //导入依赖的package包/类
@AfterViews
void afterViews() {
setSupportActionBar(toolbar);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawerLayout, toolbar, R.string.nav_drawer_open, R.string.nav_drawer_close);
drawerLayout.setDrawerListener(toggle);
toggle.syncState();
navView.setNavigationItemSelectedListener(this);
txtName = (TextView) navView.getHeaderView(0).findViewById(R.id.txtName);
txtEmail = (TextView) navView.getHeaderView(0).findViewById(R.id.txtEmail);
avatar = (ImageView) navView.getHeaderView(0).findViewById(R.id.avatar);
Glide.with(this)
.load("https://cdn1.iconfinder.com/data/icons/free-98-icons/32/user-128.png")
.placeholder(new IconDrawable(this, FontAwesomeIcons.fa_user))
.error(new IconDrawable(this, FontAwesomeIcons.fa_user))
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
.fitCenter()
.dontAnimate()
.into(avatar);
mopubAdd.setAdUnitId("d4a0aba637d64a9f9a05a575fa757ac2");
mopubAdd.loadAd();
}