use of android.support.v7.widget.RecyclerView.Recycler in project iNGAGE by davis123123.
the class RecentCommentsFragment method crossFadeRecyler.
private void crossFadeRecyler() {
adapter = new RecentCommentsAdapter(getContext());
recycler = (RecyclerView) rootView.findViewById(R.id.rvRecentComments);
final LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
recycler.setLayoutManager(layoutManager);
recycler.setAdapter(adapter);
for (int i = 0; i < UserProfileActivity.recentComments.size(); i++) {
// Log.i("STATE", "recent comment : " + UserProfileActivity.recentComments.get(i).thread_title + ", " + UserProfileActivity.recentComments.get(i).recent_comment);
adapter.add(UserProfileActivity.recentComments.get(i));
}
adapter.notifyDataSetChanged();
// if no recent activities/comments, then show message
if (adapter.getItemCount() == 0) {
recycler.setVisibility(View.GONE);
RelativeLayout rlMessage = (RelativeLayout) rootView.findViewById(R.id.rlMessage);
rlMessage.setAlpha(0f);
rlMessage.setVisibility(View.VISIBLE);
// Animate the content view to 100% opacity, and clear any animation
// listener set on the view.
rlMessage.animate().alpha(1f).setDuration(mShortAnimationDuration).setListener(null);
// Animate the loading view to 0% opacity. After the animation ends,
// set its visibility to GONE as an optimization step (it won't
// participate in layout passes, etc.)
mLoadingView.animate().alpha(0f).setDuration(mShortAnimationDuration).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mLoadingView.setVisibility(View.GONE);
}
});
// ImageView icon = (ImageView) rootView.findViewById(R.id.ivIcon);
// icon.setColorFilter(getContext().getResources().getColor(R.color.dark_gray));
} else {
recycler.setAlpha(0f);
recycler.setVisibility(View.VISIBLE);
// Animate the content view to 100% opacity, and clear any animation
// listener set on the view.
recycler.animate().alpha(1f).setDuration(mShortAnimationDuration).setListener(null);
}
// Animate the loading view to 0% opacity. After the animation ends,
// set its visibility to GONE as an optimization step (it won't
// participate in layout passes, etc.)
mLoadingView.animate().alpha(0f).setDuration(mShortAnimationDuration).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mLoadingView.setVisibility(View.GONE);
}
});
}
use of android.support.v7.widget.RecyclerView.Recycler in project FastDev4Android by jiangqqlmj.
the class CustomLinearLayoutManager method onMeasure.
@Override
public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state, int widthSpec, int heightSpec) {
View view = recycler.getViewForPosition(0);
if (view != null) {
measureChild(view, widthSpec, heightSpec);
int mWidth = View.MeasureSpec.getSize(widthSpec);
int mHeight = view.getMeasuredHeight();
setMeasuredDimension(mWidth, mHeight);
}
}
use of android.support.v7.widget.RecyclerView.Recycler in project AwesomeRecyclerView by forceLain.
the class AwesomeLayoutManager method fillUp.
private void fillUp(@Nullable View anchorView, RecyclerView.Recycler recycler) {
int anchorPos;
int anchorTop = 0;
if (anchorView != null) {
anchorPos = getPosition(anchorView);
anchorTop = getDecoratedTop(anchorView);
} else {
anchorPos = mAnchorPos;
}
boolean fillUp = true;
int pos = anchorPos - 1;
int viewBottom = anchorTop;
int viewHeight = (int) (getHeight() * ITEM_HEIGHT_PERCENT);
final int widthSpec = View.MeasureSpec.makeMeasureSpec(getWidth(), View.MeasureSpec.EXACTLY);
final int heightSpec = View.MeasureSpec.makeMeasureSpec(getHeight(), View.MeasureSpec.EXACTLY);
while (fillUp && pos >= 0) {
View view = viewCache.get(pos);
if (view == null) {
view = recycler.getViewForPosition(pos);
addView(view, 0);
measureChildWithDecorationsAndMargin(view, widthSpec, heightSpec);
int decoratedMeasuredWidth = getDecoratedMeasuredWidth(view);
layoutDecorated(view, 0, viewBottom - viewHeight, decoratedMeasuredWidth, viewBottom);
} else {
attachView(view, 0);
viewCache.remove(pos);
}
viewBottom = getDecoratedTop(view);
fillUp = (viewBottom > 0);
pos--;
}
}
use of android.support.v7.widget.RecyclerView.Recycler in project AwesomeRecyclerView by forceLain.
the class AwesomeLayoutManager method fillDown.
private void fillDown(@Nullable View anchorView, RecyclerView.Recycler recycler) {
int anchorPos;
int anchorTop = 0;
if (anchorView != null) {
anchorPos = getPosition(anchorView);
anchorTop = getDecoratedTop(anchorView);
} else {
anchorPos = mAnchorPos;
}
int pos = anchorPos;
boolean fillDown = true;
int height = getHeight();
int viewTop = anchorTop;
int itemCount = getItemCount();
int viewHeight = (int) (getHeight() * ITEM_HEIGHT_PERCENT);
final int widthSpec = View.MeasureSpec.makeMeasureSpec(getWidth(), View.MeasureSpec.EXACTLY);
final int heightSpec = View.MeasureSpec.makeMeasureSpec(getHeight(), View.MeasureSpec.EXACTLY);
while (fillDown && pos < itemCount) {
View view = viewCache.get(pos);
if (view == null) {
view = recycler.getViewForPosition(pos);
addView(view);
measureChildWithDecorationsAndMargin(view, widthSpec, heightSpec);
int decoratedMeasuredWidth = getDecoratedMeasuredWidth(view);
layoutDecorated(view, 0, viewTop, decoratedMeasuredWidth, viewTop + viewHeight);
} else {
attachView(view);
viewCache.remove(pos);
}
viewTop = getDecoratedBottom(view);
fillDown = viewTop <= height;
pos++;
}
}
use of android.support.v7.widget.RecyclerView.Recycler in project Colorful by garretyoder.
the class ColorPickerDialog method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_colorpicker);
recycler = ((RecyclerView) findViewById(R.id.colorful_color_picker_recycler));
toolbar = ((Toolbar) findViewById(R.id.colorful_color_picker_toolbar));
toolbar.setNavigationOnClickListener(this);
toolbar.setBackgroundColor(getContext().getResources().getColor(Colorful.getThemeDelegate().getPrimaryColor().getColorRes()));
toolbar.setTitle(R.string.select_color);
toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_48px);
recycler.setLayoutManager(new GridLayoutManager(getContext(), 4));
ColorPickerAdapter adapter = new ColorPickerAdapter(getContext());
adapter.setOnItemClickListener(this);
recycler.setAdapter(adapter);
}
Aggregations