Search in sources :

Example 96 with LinearLayoutManager

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);
}
Also used : WeatherAdapter(com.xiecc.seeWeather.modules.main.adapter.WeatherAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 97 with LinearLayoutManager

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;
}
Also used : PerfectClickListener(com.example.jingbin.cloudreader.utils.PerfectClickListener) ImageView(android.widget.ImageView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) View(android.view.View)

Example 98 with LinearLayoutManager

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;
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 99 with LinearLayoutManager

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;
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 100 with LinearLayoutManager

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;
}
Also used : Context(android.content.Context) Bundle(android.os.Bundle) Drawable(android.graphics.drawable.Drawable) TimelineAdapter(com.keylesspalace.tusky.adapter.TimelineAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TimelineReceiver(com.keylesspalace.tusky.receiver.TimelineReceiver)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1976 RecyclerView (android.support.v7.widget.RecyclerView)1085 View (android.view.View)822 TextView (android.widget.TextView)352 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)235 ArrayList (java.util.ArrayList)204 ImageView (android.widget.ImageView)186 Intent (android.content.Intent)150 Toolbar (android.support.v7.widget.Toolbar)134 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)131 GridLayoutManager (android.support.v7.widget.GridLayoutManager)125 BindView (butterknife.BindView)124 Bundle (android.os.Bundle)109 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)105 Nullable (android.support.annotation.Nullable)98 ViewGroup (android.view.ViewGroup)82 Context (android.content.Context)81 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)80 AdapterView (android.widget.AdapterView)70 List (java.util.List)69