use of android.support.v7.app.ActionBar.LayoutParams in project focus-android by mozilla-mobile.
the class SearchEngineListPreference method refreshSearchEngineViews.
private void refreshSearchEngineViews(Context context, SearchEngineManager sem) {
if (searchEngineGroup == null) {
// so searchEngineGroup is not set yet.
return;
}
final String defaultSearchEngine = sem.getDefaultSearchEngine(context).getIdentifier();
searchEngineGroup.removeAllViews();
final LayoutInflater layoutInflater = LayoutInflater.from(context);
final RecyclerView.LayoutParams layoutParams = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
for (int i = 0; i < searchEngines.size(); i++) {
final SearchEngine engine = searchEngines.get(i);
final String engineId = engine.getIdentifier();
final CompoundButton engineItem = makeButtonFromSearchEngine(engine, layoutInflater, context.getResources());
engineItem.setId(i);
engineItem.setTag(engineId);
if (engineId.equals(defaultSearchEngine)) {
updateDefaultItem(engineItem);
}
searchEngineGroup.addView(engineItem, layoutParams);
}
}
use of android.support.v7.app.ActionBar.LayoutParams in project 91Pop by DanteAndroid.
the class MeiZiTuAdapter method convert.
@Override
protected void convert(BaseViewHolder helper, MeiZiTu item) {
ImageView imageView = helper.getView(R.id.iv_item_mei_zi_tu);
GlideApp.with(helper.itemView.getContext()).load(buildGlideUrl(item.getThumbUrl())).transition(new DrawableTransitionOptions().crossFade(300)).into(imageView);
int height;
if (!heightMap.containsKey(item.getThumbUrl())) {
height = item.getHeight() * width / item.getWidth();
heightMap.put(item.getThumbUrl(), height);
} else {
height = heightMap.get(item.getThumbUrl());
}
StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) helper.itemView.getLayoutParams();
layoutParams.height = height;
helper.itemView.setLayoutParams(layoutParams);
}
use of android.support.v7.app.ActionBar.LayoutParams in project 91Pop by DanteAndroid.
the class Mm99Adapter method convert.
@Override
protected void convert(final BaseViewHolder helper, final Mm99 item) {
final ImageView imageView = helper.getView(R.id.iv_item_99_mm);
GlideApp.with(helper.itemView.getContext()).asBitmap().load(item.getImgUrl()).transition(new BitmapTransitionOptions().crossFade(300)).into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
imageView.setImageBitmap(resource);
int height;
if (!heightMap.containsKey(item.getImgUrl())) {
height = resource.getHeight() * width / item.getImgWidth();
heightMap.put(item.getImgUrl(), height);
} else {
height = heightMap.get(item.getImgUrl());
}
StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) helper.itemView.getLayoutParams();
layoutParams.height = height;
helper.itemView.setLayoutParams(layoutParams);
}
});
}
use of android.support.v7.app.ActionBar.LayoutParams in project 91Pop by DanteAndroid.
the class PigAvAdapter method convert.
@Override
protected void convert(BaseViewHolder helper, PigAv item) {
helper.setText(R.id.tv_item_pig_av_title, item.getTitle());
int height;
if (!heightMap.containsKey(item.getImgUrl())) {
height = item.getImgHeight() * width / item.getImgWidth() + 15;
heightMap.put(item.getImgUrl(), height);
} else {
height = heightMap.get(item.getImgUrl());
}
AppCompatImageView imageView = helper.getView(R.id.iv_item_pig_av_img);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) imageView.getLayoutParams();
layoutParams.height = height;
imageView.setLayoutParams(layoutParams);
GlideApp.with(helper.itemView).load(item.getImgUrl()).placeholder(R.drawable.placeholder).transition(new DrawableTransitionOptions().crossFade(300)).into(imageView);
}
use of android.support.v7.app.ActionBar.LayoutParams in project AgentWebX5 by Justson.
the class ScrollingUtil method isRecyclerViewToTop.
public static boolean isRecyclerViewToTop(RecyclerView recyclerView) {
if (recyclerView != null) {
RecyclerView.LayoutManager manager = recyclerView.getLayoutManager();
if (manager == null) {
return true;
}
if (manager.getItemCount() == 0) {
return true;
}
int firstChildTop = 0;
if (recyclerView.getChildCount() > 0) {
// 处理item高度超过一屏幕时的情况
View firstVisibleChild = recyclerView.getChildAt(0);
if (firstVisibleChild != null && firstVisibleChild.getMeasuredHeight() >= recyclerView.getMeasuredHeight()) {
if (android.os.Build.VERSION.SDK_INT < 14) {
return !(ViewCompat.canScrollVertically(recyclerView, -1) || recyclerView.getScrollY() > 0);
} else {
return !ViewCompat.canScrollVertically(recyclerView, -1);
}
}
// 如果RecyclerView的子控件数量不为0,获取第一个子控件的top
// 解决item的topMargin不为0时不能触发下拉刷新
View firstChild = recyclerView.getChildAt(0);
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) firstChild.getLayoutParams();
firstChildTop = firstChild.getTop() - layoutParams.topMargin - getRecyclerViewItemTopInset(layoutParams) - recyclerView.getPaddingTop();
}
if (manager instanceof LinearLayoutManager) {
LinearLayoutManager layoutManager = (LinearLayoutManager) manager;
if (layoutManager.findFirstCompletelyVisibleItemPosition() < 1 && firstChildTop == 0) {
return true;
}
} else if (manager instanceof StaggeredGridLayoutManager) {
StaggeredGridLayoutManager layoutManager = (StaggeredGridLayoutManager) manager;
int[] out = layoutManager.findFirstCompletelyVisibleItemPositions(null);
if (out[0] < 1 && firstChildTop == 0) {
return true;
}
}
}
return false;
}
Aggregations