本文整理汇总了Java中android.support.v4.view.ViewCompat.jumpDrawablesToCurrentState方法的典型用法代码示例。如果您正苦于以下问题:Java ViewCompat.jumpDrawablesToCurrentState方法的具体用法?Java ViewCompat.jumpDrawablesToCurrentState怎么用?Java ViewCompat.jumpDrawablesToCurrentState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.ViewCompat
的用法示例。
在下文中一共展示了ViewCompat.jumpDrawablesToCurrentState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateMenuView
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void updateMenuView(boolean cleared) {
ViewGroup parent = this.mMenuView;
if (parent != null) {
int childIndex = 0;
if (this.mMenu != null) {
this.mMenu.flagActionItems();
ArrayList<MenuItemImpl> visibleItems = this.mMenu.getVisibleItems();
int itemCount = visibleItems.size();
for (int i = 0; i < itemCount; i++) {
MenuItemImpl item = (MenuItemImpl) visibleItems.get(i);
if (shouldIncludeItem(childIndex, item)) {
View convertView = parent.getChildAt(childIndex);
MenuItemImpl oldItem = convertView instanceof ItemView ? ((ItemView) convertView).getItemData() : null;
View itemView = getItemView(item, convertView, parent);
if (item != oldItem) {
itemView.setPressed(false);
ViewCompat.jumpDrawablesToCurrentState(itemView);
}
if (itemView != convertView) {
addItemView(itemView, childIndex);
}
childIndex++;
}
}
}
while (childIndex < parent.getChildCount()) {
if (!filterLeftoverView(parent, childIndex)) {
childIndex++;
}
}
}
}
示例2: onBindViewHolder
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(final BookmarkViewHolder holder, int position) {
ViewCompat.jumpDrawablesToCurrentState(holder.itemView);
final HistoryItem web = mBookmarks.get(position);
holder.txtTitle.setText(web.getTitle());
if (web.isFolder()) {
holder.favicon.setImageBitmap(mFolderBitmap);
} else if (web.getBitmap() == null) {
holder.favicon.setImageBitmap(mWebpageBitmap);
holder.favicon.setTag(web.getUrl().hashCode());
final String url = web.getUrl();
Subscription oldSubscription = mFaviconFetchSubscriptions.get(url);
SubscriptionUtils.safeUnsubscribe(oldSubscription);
final Subscription faviconSubscription = mFaviconModel.faviconForUrl(url, web.getTitle())
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.main())
.subscribe(new SingleOnSubscribe<Bitmap>() {
@Override
public void onItem(@Nullable Bitmap item) {
mFaviconFetchSubscriptions.remove(url);
Object tag = holder.favicon.getTag();
if (tag != null && tag.equals(url.hashCode())) {
holder.favicon.setImageBitmap(item);
}
web.setBitmap(item);
}
});
mFaviconFetchSubscriptions.put(url, faviconSubscription);
} else {
holder.favicon.setImageBitmap(web.getBitmap());
}
}