use of android.support.v7.widget.LinearLayoutManager in project SeeWeather by xcc3641.
the class MainFragment method initView.
private void initView() {
if (mRefreshLayout != null) {
mRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light);
mRefreshLayout.setOnRefreshListener(() -> mRefreshLayout.postDelayed(this::load, 1000));
}
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mAdapter = new WeatherAdapter(mWeather);
mRecyclerView.setAdapter(mAdapter);
}
use of android.support.v7.widget.LinearLayoutManager in project CloudReader by youlookwhat.
the class OneFragment method setAdapter.
private void setAdapter(HotMovieBean hotMovieBean) {
LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
bindingView.listOne.setLayoutManager(mLayoutManager);
// 加上这两行代码,下拉出提示才不会产生出现刷新头的bug,不加拉不下来
bindingView.listOne.setPullRefreshEnabled(false);
bindingView.listOne.clearHeader();
bindingView.listOne.setLoadingMoreEnabled(false);
// 需加,不然滑动不流畅
bindingView.listOne.setNestedScrollingEnabled(false);
bindingView.listOne.setHasFixedSize(false);
if (mHeaderView == null) {
mHeaderView = View.inflate(getContext(), R.layout.header_item_one, null);
View llMovieTop = mHeaderView.findViewById(R.id.ll_movie_top);
ImageView ivImg = (ImageView) mHeaderView.findViewById(R.id.iv_img);
ImgLoadUtil.displayRandom(3, ConstantsImageUrl.ONE_URL_01, ivImg);
llMovieTop.setOnClickListener(new PerfectClickListener() {
@Override
protected void onNoDoubleClick(View v) {
DoubanTopActivity.start(v.getContext());
}
});
}
bindingView.listOne.addHeaderView(mHeaderView);
oneAdapter.clear();
oneAdapter.addAll(hotMovieBean.getSubjects());
bindingView.listOne.setAdapter(oneAdapter);
oneAdapter.notifyDataSetChanged();
isFirst = false;
}
use of android.support.v7.widget.LinearLayoutManager in project CloudReader by youlookwhat.
the class AndroidFragment method setAdapter.
/**
* 设置adapter
*/
private void setAdapter(GankIoDataBean mAndroidBean) {
mAndroidAdapter.clear();
mAndroidAdapter.addAll(mAndroidBean.getResults());
bindingView.xrvAndroid.setLayoutManager(new LinearLayoutManager(getActivity()));
bindingView.xrvAndroid.setAdapter(mAndroidAdapter);
mAndroidAdapter.notifyDataSetChanged();
bindingView.xrvAndroid.refreshComplete();
mIsFirst = false;
}
use of android.support.v7.widget.LinearLayoutManager in project CloudReader by youlookwhat.
the class CustomFragment method setAdapter.
/**
* 设置adapter
*/
private void setAdapter(GankIoDataBean mCustomBean) {
if (mHeaderView == null) {
mHeaderView = View.inflate(getContext(), R.layout.header_item_gank_custom, null);
bindingView.xrvCustom.addHeaderView(mHeaderView);
}
initHeader(mHeaderView);
boolean isAll = SPUtils.getString("gank_cala", "全部").equals("全部");
mAndroidAdapter.clear();
mAndroidAdapter.setAllType(isAll);
mAndroidAdapter.addAll(mCustomBean.getResults());
bindingView.xrvCustom.setLayoutManager(new LinearLayoutManager(getActivity()));
bindingView.xrvCustom.setAdapter(mAndroidAdapter);
mAndroidAdapter.notifyDataSetChanged();
mIsFirst = false;
}
use of android.support.v7.widget.LinearLayoutManager in project Tusky by Vavassor.
the class TimelineFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Bundle arguments = getArguments();
kind = Kind.valueOf(arguments.getString("kind"));
if (kind == Kind.TAG || kind == Kind.USER) {
hashtagOrId = arguments.getString("hashtag_or_id");
}
final View rootView = inflater.inflate(R.layout.fragment_timeline, container, false);
// Setup the SwipeRefreshLayout.
Context context = getContext();
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout);
swipeRefreshLayout.setOnRefreshListener(this);
// Setup the RecyclerView.
recyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view);
recyclerView.setHasFixedSize(true);
layoutManager = new LinearLayoutManager(context);
recyclerView.setLayoutManager(layoutManager);
DividerItemDecoration divider = new DividerItemDecoration(context, layoutManager.getOrientation());
Drawable drawable = ThemeUtils.getDrawable(context, R.attr.status_divider_drawable, R.drawable.status_divider_dark);
divider.setDrawable(drawable);
recyclerView.addItemDecoration(divider);
adapter = new TimelineAdapter(this);
recyclerView.setAdapter(adapter);
timelineReceiver = new TimelineReceiver(adapter);
LocalBroadcastManager.getInstance(context.getApplicationContext()).registerReceiver(timelineReceiver, TimelineReceiver.getFilter(kind));
return rootView;
}
Aggregations