Java 类android.support.v7.widget.DividerItemDecoration 实例源码

项目:Plamber-Android    文件:SelectLanguageFragamnt.java   
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_select_language, container, false);
    ButterKnife.bind(this, v);

    mRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecycler.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
    visibleProgress(mProgress, true);
    workAPI.getAllLanguage(new StringListCallback() {
        @Override
        public void onSuccess(@NonNull List<String> stringsList) {
            languages.clear();
            languages.addAll(stringsList);
            actionSelectLanguage();
        }

        @Override
        public void onError(@NonNull Throwable t) {

        }
    });
    return v;
}
项目:NotifyTools    文件:ViewBuilder.java   
public void initView(){
  //initdata();
  poemData = new ArrayList<SongCi>();

  poemRecyclerView = (RecyclerView) cxt.findViewById(R.id.recycler_view);

  poemAdapter = new PoemAdapter(cxt, poemData,poemRecyclerView);
  poemRecyclerView.setAdapter(poemAdapter);//设置适配器
  poemRecyclerView.setVerticalScrollBarEnabled(true);
  //设置布局管理器 , 将布局设置成纵向
  LinearLayoutManager
      linerLayoutManager = new LinearLayoutManager(cxt, LinearLayoutManager.VERTICAL, false);
  poemRecyclerView.setLayoutManager(linerLayoutManager);

  //设置分隔线
  poemRecyclerView.addItemDecoration(new DividerItemDecoration(cxt , DividerItemDecoration.VERTICAL));

  //设置增加或删除条目动画
  poemRecyclerView.setItemAnimator(new DefaultItemAnimator());

}
项目:GitHub    文件:SampleActivity.java   
@Override protected void setUpAdapter() {
  if (null != getSupportActionBar()) {
    getSupportActionBar().setDisplayHomeAsUpEnabled(false);
  }

  SampleAdapter sampleAdapter =
      new SampleAdapter(new BaseViewHolder.OnItemClickListener<String>() {
        @Override public void onItemClick(View view, String item) {
          gotoNextActivity(dataList.indexOf(item));
        }
      });

  LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext());
  recyclerView.setLayoutManager(linearLayoutManager);
  recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
  recyclerView.setAdapter(sampleAdapter);

  sampleAdapter.setDataList(populateData());
}
项目:MyRepository    文件:RecyclerviewTestActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recyclerview_test);
        ButterKnife.bind(this);

        LinearLayoutManager layoutManager = new LinearLayoutManager
                (this,LinearLayoutManager.VERTICAL,false);
//        GridLayoutManager gridLayoutManager = new GridLayoutManager(this,2);
//        StaggeredGridLayoutManager staggeredLayoutManager = new StaggeredGridLayoutManager
//                (2,StaggeredGridLayoutManager.VERTICAL);
        recyclerview.setLayoutManager(layoutManager);
        recyclerview.addItemDecoration
                (new DividerItemDecoration(this,DividerItemDecoration.VERTICAL));

//        requestData();
        getRemoteData();



    }
项目:SocEltech    文件:MainActivity.java   
private void setupRecyclerView() {
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.addItemDecoration(new DividerItemDecoration(this, layoutManager
            .getOrientation()));
    recyclerView.addOnItemTouchListener(new RecyclerItemClickListener(this, new RecyclerItemClickListener.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            Intent intent = new Intent(MainActivity.this, TestViewActivity.class);
            intent.putExtra(TestViewActivity.ARG_TEST_ID, socTests.get(position).getId());
            startActivity(intent);
        }
    }));

    socTests = daoSession.getSocTestDao().loadAll();

    adapter = new TestRecyclerViewAdapter(socTests);
    recyclerView.setAdapter(adapter);
    adapter.notifyDataSetChanged();
}
项目:CleanArchitechture    文件:TeamMvvmFragment.java   
@Override
public void initData(Bundle savedInstanceState) {
    mViewDataBinding.rvTeam.addItemDecoration(new DividerItemDecoration(getThis(), DividerItemDecoration.VERTICAL));
    mViewDataBinding.rvTeam.setAdapter(mAdapter);
    if (getArguments() != null) {
        int seasion = getArguments().getInt("Seasion ID");
        mSeasionName = getArguments().getString("Seasion Name");
        mViewModel.getResults(seasion).observe(this, new Observer<Resource<List<TeamModel>>>() {
            @Override
            public void onChanged(@Nullable Resource<List<TeamModel>> listResource) {
                mViewDataBinding.setResource(listResource);
                mViewDataBinding.executePendingBindings();
                if (listResource != null && listResource.data != null) {
                    mAdapter.updateData(listResource.data);
                }
            }
        });
    }

}
项目:cniao5    文件:ShopCartFragment.java   
/**
 * 获取数据
 */
private void showData() {

    List<ShoppingCart> carts = mCartShopProvider.getAll();

    if (carts == null) {
        initEmptyView();           //如果数据为空,显示空的试图
        return;
    }

    /**
     * 购物车数据不为空
     */
    mAdapter = new ShopCartAdapter(getContext(), carts, mCheckBox, mTextTotal);
    mRecyclerView.setAdapter(mAdapter);
    //recyclerView本身存在一个bug,在删 添加数据同时进行时,会报错:
    // java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder
    // adapter positionViewHolder{42319ed8 position=1 id=-1, oldPos=0, pLpos:0 scrap
    // tmpDetached no parent}
    //需要 重写LinearLayoutManager
    mRecyclerView.setLayoutManager(new WrapContentLinearLayoutManager(getContext(),
            LinearLayoutManager.VERTICAL, false));
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(),
            DividerItemDecoration.VERTICAL));

}
项目:cniao5    文件:GoodsListActivity.java   
/**
 * 展示数据
 */
private void showData() {

    if (datas != null && datas.size() > 0) {
        mTxtSummary.setText("共有" + datas.size() + "件商品");
    } else {
        mLlSummary.setVisibility(View.GONE);
        ToastUtils.setGravity(Gravity.CENTER, 0, 0);
        ToastUtils.showShortSafe("暂无商品信息");
        return;
    }

    mAdatper = new HotGoodsAdapter(datas, this);
    mRecyclerview.setAdapter(mAdatper);
    if (actionType == ACTION_LIST) {
        mRecyclerview.setLayoutManager(new LinearLayoutManager(this));
    } else {
        mRecyclerview.setLayoutManager(new GridLayoutManager(this, 2));
    }

    mRecyclerview.setItemAnimator(new DefaultItemAnimator());
    mRecyclerview.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration
            .HORIZONTAL));

}
项目:gigreminder    文件:ArtistsFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_artists, container, false);
    ButterKnife.bind(this, rootView);

    adapter = new ListAdapter(getContext(), uiModel);
    adapter.setOnItemClickListener(createOnArtistClickListener());

    artistsView.setHasFixedSize(true);
    artistsView.setAdapter(adapter);
    artistsView.setLayoutManager(new LinearLayoutManager(getContext()));
    artistsView.addItemDecoration(new DividerItemDecoration(getContext(),
            LinearLayoutManager.VERTICAL));

    listHelper = new ListViewHelper(artistsView, emptyListView, loadingProgressView);

    FloatingActionButton addArtistButton = (FloatingActionButton) getActivity().findViewById(
            R.id.fab_add_artist);
    addArtistButton.setOnClickListener(v -> {
        presenter.sendUiEvent(OpenNewArtistEvent.INSTANCE);
    });

    return rootView;
}
项目:javaide    文件:DiagnosticFragment.java   
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mRecyclerView = view.findViewById(R.id.recycler_view);
    mRecyclerView.setHasFixedSize(true);
    mAdapter = new DiagnosticAdapter(getContext(), new ArrayList<Diagnostic>());
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext(),
            DividerItemDecoration.VERTICAL));
    mAdapter.setListener(new DiagnosticAdapter.OnItemClickListener() {
        @Override
        public void onClick(Diagnostic diagnostic) {
            if (presenter != null) presenter.click(diagnostic);
        }
    });
}
项目:GoSCELE    文件:CourseAllFragment.java   
@Override
public void initialize(Bundle savedInstanceState) {
    super.initialize(savedInstanceState);
    presenter.runProvider(this);

    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.addItemDecoration(new DividerItemDecoration(this.getContext(), LinearLayoutManager.VERTICAL));

    refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            presenter.runProvider(CourseAllFragment.this, true);
        }
    });
}
项目:SmartRefreshLayout    文件:ViewPagerUsingFragment.java   
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mRecyclerView = (RecyclerView) view;

    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext(),DividerItemDecoration.VERTICAL));
    mRecyclerView.setAdapter(mAdapter = new BaseRecyclerAdapter<Void>(initData(), simple_list_item_2) {
        @Override
        protected void onBindViewHolder(SmartViewHolder holder, Void model, int position) {
            holder.text(android.R.id.text1, String.format(Locale.CHINA, "第%02d条数据", position));
            holder.text(android.R.id.text2, String.format(Locale.CHINA, "这是测试的第%02d条数据", position));
            holder.textColorId(android.R.id.text2, R.color.colorTextAssistant);
        }
    });
}
项目:DMS    文件:RecyclerViewUtils.java   
public static void setupRecyclerView(EmptySupportedRecyclerView recyclerView,
                                     Context context, View emptyView) {

    // set view to display when there is any content
    recyclerView.setEmptyView(emptyView);

    recyclerView.setHasFixedSize(true);

    // set layout manager as linear
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
    recyclerView.setLayoutManager(linearLayoutManager);

    // add divider between items
    DividerItemDecoration dividerItemDecoration =
            new DividerItemDecoration(context, linearLayoutManager.getOrientation());
    recyclerView.addItemDecoration(dividerItemDecoration);
}
项目:MovieApp    文件:GenreFragment.java   
private void init(View view) {
    unbinder = ButterKnife.bind(this, view);

    activity = (AppCompatActivity) getActivity();

    activity.setSupportActionBar(toolbar);
    ActionBar actionBar = activity.getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(title);
    }

    LinearLayoutManager layoutManager
            = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.addItemDecoration(new DividerItemDecoration(activity, layoutManager.getOrientation()));
    recyclerView.setHasFixedSize(true);
    recyclerView.setMotionEventSplittingEnabled(false);
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(genreAdapter);
}
项目:TMvpSimple-master    文件:MovieActivity.java   
private void initLayout() {
    mProgressBar.setVisibility(View.VISIBLE);
    mSwipeRefreshLayout.setVisibility(View.GONE);
    mSwipeRefreshLayout.setColorSchemeResources(R.color.colorAccent,
            android.R.color.holo_red_light,
            android.R.color.holo_orange_light,
            android.R.color.holo_green_light);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            isRefresh = true;
            mPresenter.getMovie(10, 10);
        }
    });
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.addItemDecoration(new DividerItemDecoration(this,
            DividerItemDecoration.VERTICAL));
}
项目:CodeWatch    文件:ProjectsFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    Icepick.restoreInstanceState(this, savedInstanceState);
    rootView = inflater.inflate(R.layout.fragment_projects, container, false);
    unbinder = ButterKnife.bind(this, rootView);
    hideProgressBar(false);
    context = getActivity();
    if (savedInstanceState == null) {
        firebaseUid = CacheUtils.getFirebaseUserId(context);
    }
    FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance();
    projectsDatabaseRef = firebaseDatabase.getReference()
            .child("users").child(firebaseUid).child("projects");

    projectTimeSpentRef = firebaseDatabase.getReference()
            .child("users").child(firebaseUid).child("timeSpentOnProjects"); // case!

    initializeData();
    projectsAdapter = new ProjectsAdapter(context, projectItemList);
    projectsAdapter.setOnItemSelectedListener(this);
    recyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    recyclerView.setAdapter(projectsAdapter);
    recyclerView.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
    return rootView;
}
项目:leoapp-sources    文件:UserFragment.java   
private void initRecyclerView() {
    rvUsers = view.findViewById(R.id.recyclerView);
    userClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            int  position    = rvUsers.getChildAdapterPosition(view);
            User clickedUser = userArray[position];
            startActivity(new Intent(getContext(), ChatActivity.class)
                    .putExtra("uid", clickedUser.uid)
                    .putExtra("cid", Utils.getController().getMessengerDatabase().getChatWith(clickedUser.uid))
                    .putExtra("cname", clickedUser.uname)
                    .putExtra("ctype", Chat.ChatType.PRIVATE.toString()));
        }
    };

    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
    DividerItemDecoration mDividerItemDecoration = new DividerItemDecoration(
            rvUsers.getContext(),
            linearLayoutManager.getOrientation()
    );
    rvUsers.addItemDecoration(mDividerItemDecoration);
    rvUsers.setLayoutManager(linearLayoutManager);

    userArray = Utils.getController().getMessengerDatabase().getUsers();
    rvUsers.setAdapter(new UserAdapter(getActivity().getLayoutInflater(), userArray, userClickListener));
}
项目:quire    文件:GroupChannelListFragment.java   
private void setUpRecyclerView() {
    mLayoutManager = new LinearLayoutManager(getContext());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setAdapter(mChannelListAdapter);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));

    // If user scrolls to bottom of the list, loads more channels.
    mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            if (mLayoutManager.findLastVisibleItemPosition() == mChannelListAdapter.getItemCount() - 1) {
                loadNextChannelList();
            }
        }
    });
}
项目:HeadlineNews    文件:BaseNewsDetailActivity.java   
@Override
protected void initViews() {
    /** findViewById */
    mScrollView = (UIScrollView) findViewById(R.id.id_content_sv);
    mContentFl = (RelativeLayout) findViewById(R.id.id_content_fl);
    mCommentRv = (RecyclerView) findViewById(R.id.id_recycler_view);
    mCommentCountTv = (UIBadgeView) findViewById(R.id.id_comment_count_tv);

    /** RecyclerView */
    mCommentRv.setLayoutManager(new LinearLayoutManager(this));
    mCommentRv.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));

    /** StateView */
    mStateView = StateView.inject(mContentFl);
    mStateView.setLoadingResource(R.layout.page_loading);
    mStateView.setEmptyResource(R.layout.page_no_comment);
    mStateView.setRetryResource(R.layout.page_net_error);

    /** NewsDetailHeader */
    mNewsDetailHeader = (NewsDetailHeader) findViewById(R.id.id_news_detail_header);
}
项目:adapters-android    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    RecyclerView rcViewList = (RecyclerView) findViewById(R.id.rc_item);
    rcViewList.setAdapter(new ItemAdapter(generateFakeItems(), new OnItemClickListener() {
        @Override
        public void onItemClick(int position) {
            startActivity(new Intent(MainActivity.this, FragmentPagerActivity.class));
        }
    }));
    rcViewList.setLayoutManager(new LinearLayoutManager(this));
    rcViewList.addItemDecoration(new DividerItemDecoration(this,
                                                           DividerItemDecoration.VERTICAL));
}
项目:Ghost-Android    文件:OpenSourceLibsActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setLayout(R.layout.activity_open_source_libs);

    setSupportActionBar(mToolbar);
    //noinspection ConstantConditions
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowTitleEnabled(false);

    // sort alphabetically
    Collections.sort(LIBRARIES, (lhs, rhs) -> lhs.name.compareTo(rhs.name));

    mLibsAdapter = new LibsAdapter(this, LIBRARIES, v -> {
        int pos = mLibsList.getChildLayoutPosition(v);
        if (pos == RecyclerView.NO_POSITION) return;
        Library library = mLibsAdapter.getItem(pos);
        AppUtils.openUri(this, library.url);
    });
    mLibsList.setAdapter(mLibsAdapter);
    mLibsList.setLayoutManager(new LinearLayoutManager(this));
    mLibsList.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
}
项目:Blockly    文件:DownloadActivity.java   
private void init() {
    btReturn = (Button) findViewById(R.id.back_bt);

    btReturn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    recyclerView = (RecyclerView) findViewById(R.id.rv_download);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));

    recyclerView.setAdapter(new ItemAdapter(fileListContents));
    recyclerView.addItemDecoration(new DividerItemDecoration(this,
            DividerItemDecoration.VERTICAL));
}
项目:Architecture    文件:TopRepoListActivity.java   
private void setupProductListView() {
  final LinearLayoutManager layoutManager = new LinearLayoutManager(
      this,
      LinearLayoutManager.VERTICAL,
      false);

  rvRepoList.setLayoutManager(layoutManager);

  rvRepoList.addItemDecoration(new DividerItemDecoration(
      this,
      LinearLayoutManager.VERTICAL));

  rvRepoList.setHasFixedSize(true);

  rvRepoList.addOnScrollListener(new InfiniteScrollListener(
      layoutManager,
      3,
      () -> store.dispatch(LoadTopRepoAction.LOAD_MORE)));

  adapter = productListAdapter();
  rvRepoList.setAdapter(adapter);
}
项目:SuperNatives    文件:HeroesListActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    AndroidInjection.inject(this);
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_heroes_list);
    context = this;

    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context,
            LinearLayoutManager.VERTICAL, false);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(context,
            linearLayoutManager.getOrientation());
    binding.rvHeroes.setLayoutManager(linearLayoutManager);
    binding.rvHeroes.addItemDecoration(dividerItemDecoration);
    binding.rvHeroes.setAdapter(heroesAdapter);
    binding.fastScroll.setRecyclerView(binding.rvHeroes);

    heroesAdapter.setOnClickListener(position -> presenter.onSuperHeroClicked(position));

    binding.btnTryAgain.setOnClickListener(v -> presenter.getSuperHeroes());

    binding.btnTryAgain.performClick();
}
项目:MiPushFramework    文件:EventFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    RecyclerView view = new RecyclerView(getActivity());
    view.setLayoutManager(new LinearLayoutManager(getActivity(),
            LinearLayoutManager.VERTICAL, false));
    view.setAdapter(mAdapter);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(view.getContext(),
            LinearLayoutManager.VERTICAL);
    view.addItemDecoration(dividerItemDecoration);
    view.setOnScrollListener(new OnLoadMoreListener() {
        @Override
        public void onLoadMore() {
            loadPage();
        }
    });
    return view;
}
项目:StickyHeaderDecoration    文件:MainActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        recyclerView = ((RecyclerView) findViewById(R.id.main_recyclerView));
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        mAdapter = new ItemAdapter();
        recyclerView.setAdapter(mAdapter);

//        mDecoration = new StickyHeaderDecoration(mAdapter);
        mDecoration = new StickyHeaderDecoration(new SimpleTextHeader() {
            @Override
            protected CharSequence getHeaderContent(int childPos) {
                return "Header " + getHeaderId(childPos);
            }

            @Override
            public long getHeaderId(int childAdapterPosition) {
                return childAdapterPosition / 14;
            }
        });
        recyclerView.addItemDecoration(mDecoration);
        recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
    }
项目:HabitUp    文件:ViewHabitEventActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
//        Log.i("HabitUpDEBUG", "ViewHabitEventActivity onCreate");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_events);
        events = new ArrayList<>();
        eventListView = (RecyclerView) findViewById(R.id.event_list);
        eventListView.setHasFixedSize(true);

        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setAutoMeasureEnabled(true);
        eventListView.setLayoutManager(layoutManager);

        RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL);
        eventListView.addItemDecoration(itemDecoration);
    }
项目:MultiViewAdapter    文件:SampleActivity.java   
@Override protected void setUpAdapter() {
  if (null != getSupportActionBar()) {
    getSupportActionBar().setDisplayHomeAsUpEnabled(false);
  }

  SampleAdapter sampleAdapter =
      new SampleAdapter(new BaseViewHolder.OnItemClickListener<String>() {
        @Override public void onItemClick(View view, String item) {
          gotoNextActivity(dataList.indexOf(item));
        }
      });

  LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext());
  recyclerView.setLayoutManager(linearLayoutManager);
  recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
  recyclerView.setAdapter(sampleAdapter);

  sampleAdapter.setDataList(populateData());
}
项目:IssaRecipe-master    文件:RecipeList.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mBinding = DataBindingUtil.setContentView(this, R.layout.activity_recipe_list);

    mRetrofit = new Retrofit.Builder()
            .baseUrl(Constants.BASE_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .build();
    mRecipeApi = mRetrofit.create(RecipeApi.class);

    handleRecipeSearch(getIntent().getExtras().getString(Constants.INGREDIENT_QUERY), 1);

    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    mBinding.recipeList.setLayoutManager(layoutManager);
    mBinding.recipeList.setHasFixedSize(true);

    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
            layoutManager.getOrientation());
    dividerItemDecoration.setDrawable(ContextCompat.getDrawable(this, R.drawable.list_divider));
    mBinding.recipeList.addItemDecoration(dividerItemDecoration);
}
项目:Plamber-Android    文件:LibraryFragment.java   
@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragmnet_library, container, false);
    ButterKnife.bind(this, v);

    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
    return v;
}
项目:ANNO1404-Warenrechner-App    文件:MaterialOverviewFragment.java   
@Override
protected void onViewCreated(View parent) {
    getGameActivity().component().inject(this);

    registerLifecycle(adapter);
    listRV.setLayoutManager(new LinearLayoutManager(getContext()));
    listRV.setItemAnimator(new DefaultItemAnimator());
    listRV.setAdapter(adapter);

    listRV.addItemDecoration(new DividerItemDecoration(
            getContext(), DividerItemDecoration.VERTICAL
    ));
}
项目:fussroll    文件:ActivitiesActivity.java   
public void checkForNewUpdates(int opt) {

        SimpleDateFormat entireDate = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
        String localEntireDate = entireDate.format(new Date());
        //Log.i("activities", "Local date is "+localEntireDate);

        DatabaseHandler databaseHandler = new DatabaseHandler(this);
        listLogsPrevious = databaseHandler.getActivities(getIntent().getStringExtra(userPhoneNumber));
        databaseHandler.close();

        if(listLogsPrevious != null && opt == 0) {

            String fetchDate = listLogsPrevious.get(0).getDate();

            if(!localEntireDate.equals(fetchDate))
                textView.setText(coolDateString(fetchDate));
            else
                textView.setText(R.string.today);

            activitiesAdapter = new ActivitiesAdapter(this, listLogsPrevious);
            LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
            linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
            recyclerView.setLayoutManager(linearLayoutManager);
            recyclerView.setAdapter(activitiesAdapter);

            //For adding dividers in the list
            DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), linearLayoutManager.getOrientation());
            dividerItemDecoration.setDrawable(ContextCompat.getDrawable(activity, R.drawable.line_divider));
            recyclerView.addItemDecoration(dividerItemDecoration);

        }

        getActivitiesOfUser(getIntent().getStringExtra(userPhoneNumber), localEntireDate, textView);

    }
项目:Tusky    文件:SavedTootActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_saved_toot);

    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar bar = getSupportActionBar();
    if (bar != null) {
        bar.setTitle(getString(R.string.title_saved_toot));
        bar.setDisplayHomeAsUpEnabled(true);
        bar.setDisplayShowHomeEnabled(true);
    }

    RecyclerView recyclerView = findViewById(R.id.recycler_view);
    noContent = findViewById(R.id.no_content);
    recyclerView.setHasFixedSize(true);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    recyclerView.setLayoutManager(layoutManager);
    DividerItemDecoration divider = new DividerItemDecoration(
            this, layoutManager.getOrientation());
    Drawable drawable = ThemeUtils.getDrawable(this, R.attr.status_divider_drawable,
            R.drawable.status_divider_dark);
    divider.setDrawable(drawable);
    recyclerView.addItemDecoration(divider);
    adapter = new SavedTootAdapter(this);
    recyclerView.setAdapter(adapter);
}
项目:CleanArchitechture    文件:SoccerSeasonMvpFragment.java   
@Override
protected void initData(Bundle savedInstanceState) {
    mAdapter.setOnSoccerSeasonItemClick(this);
    mRv.setLayoutManager(new LinearLayoutManager(getThis()));
    mRv.addItemDecoration(new DividerItemDecoration(getThis(), DividerItemDecoration.VERTICAL));
    mRv.setHasFixedSize(true);
    mRv.setAdapter(mAdapter);
    presenter.getSession();
}
项目:RecyclerViewIntermediate    文件:ItemFragment.java   
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_item_list, container, false);

        if (view instanceof RecyclerView) {
            recyclerView = (RecyclerView) view;
            Context context = view.getContext();

            smallDivider = context.getDrawable(R.drawable.divider_drawable);
            gridDecoration = new GridDividerItemDecoration(smallDivider, smallDivider, NUM_COLUMNS);

            if (mFragType <= FRAG_LINEAR) {
                recyclerView.setLayoutManager(new LinearLayoutManager(context));

                recyclerView.addItemDecoration(
                        new DividerItemDecoration(recyclerView.getContext(),
                                DividerItemDecoration.VERTICAL));
            } else if (mFragType == FRAG_GRID) {
                recyclerView.setLayoutManager(new GridLayoutManager(context, NUM_COLUMNS));
                //Use the custom Item Decoration class
//                recyclerView.addItemDecoration(new GridDividerDecoration(recyclerView.getContext()));

//                //Large divider on bottom
//                Drawable lgDivider = context.getDrawable(R.drawable.divider_lg);
//                recyclerView.addItemDecoration(
//                        new GridDividerItemDecoration(lgDivider, lgDivider, NUM_COLUMNS));
//
//                //Medium Divider in middle
//                Drawable medDivider = context.getDrawable(R.drawable.divider_med);
//                recyclerView.addItemDecoration(
//                        new GridDividerItemDecoration(medDivider, medDivider, NUM_COLUMNS));
//
//                //Small divider on top
//                Drawable smallDivider = context.getDrawable(R.drawable.divider_sm);
//                recyclerView.addItemDecoration(
//                        new GridDividerItemDecoration(smallDivider, smallDivider, NUM_COLUMNS));
            } else if (mFragType == FRAG_STAG_GRID) {
                recyclerView.setLayoutManager(new StaggeredGridLayoutManager(NUM_COLUMNS, StaggeredGridLayoutManager.VERTICAL));

            }
            MyItemRecyclerViewAdapter adapter = new MyItemRecyclerViewAdapter(DummyContent.ITEMS, mListener);
            recyclerView.setAdapter(adapter);

            ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(adapter);
            itemTouchHelper = new ItemTouchHelper(callback);
            itemTouchHelper.attachToRecyclerView(recyclerView);
        }
        return view;
    }
项目:item-reaper    文件:ItemsFragment.java   
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mLargeScreen = getResources().getBoolean(R.bool.large_layout);
    ItemListener itemListener = new ItemListener() {
        @Override
        public void onItemClick(Item item) {
            mPresenter.openItemDetails(item.getId());
        }
    };
    mItemsAdapter = new ItemsAdapter(new ArrayList<Item>(), itemListener);
    mDividerItemDecoration = new DividerItemDecoration(getContext(),
            DividerItemDecoration.VERTICAL);
    mDividerItemDecoration.setDrawable(ContextCompat.getDrawable(getContext(),
            R.drawable.divider));

    if (savedInstanceState != null) {
        if (savedInstanceState.getSerializable(EXTRA_DELETED_ITEM) != null) {
            mDeletedItem = (Item) savedInstanceState.getSerializable(EXTRA_DELETED_ITEM);
        }
        if (savedInstanceState.getString(STATE_ITEM_QUERY) != null) {
            mQuery = savedInstanceState.getString(STATE_ITEM_QUERY);
        } else {
            mQuery = null;
        }
        mCurrentSort = savedInstanceState.getInt(STATE_CURRENT_SORT, SORT_BY_EXPIRY);
    }
    mFirebaseStorage = FirebaseStorage.getInstance();
    mSearching = false;
    mSharedPreferencesHelper
            = new SharedPreferencesHelper(getActivity().getPreferences(Context.MODE_PRIVATE));
    setRetainInstance(true);
}
项目:HutHelper    文件:FreshmanGuideActivity.java   
@Override
protected void doBusiness() {
    toolbarTitle.setText("新生攻略");
    recyclerView.setLayoutManager(new LinearLayoutManager(context, OrientationHelper.VERTICAL, false));
    adapter = new FreshmanGuideAdapter(context, dataList);
    recyclerView.setAdapter(adapter);
    recyclerView.addItemDecoration(new DividerItemDecoration(context, OrientationHelper.VERTICAL));
    freshmanGuidePresenter = new FreshmanGuidePresenter(this, this);
    freshmanGuidePresenter.showGuideList();
}
项目:jsoup-annotations    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    list = (RecyclerView) findViewById(R.id.list);
    list.setLayoutManager(new LinearLayoutManager(this));
    list.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
    scrape.start();
}
项目:GoSCELE    文件:AboutFragment.java   
@Override
public void initialize(Bundle savedInstanceState) {
    super.initialize(savedInstanceState);

    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), LinearLayoutManager.VERTICAL));
    recyclerView.setAdapter(presenter.buildAdapter(getContext()));
}
项目:HLOLI    文件:SearchResultActivity.java   
@Override
public void initView() {
    keyword = getIntent().getStringExtra(KEYWORD);
    initBaseToolBar(keyword, true);
    recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
    recyclerView.addItemDecoration(new DividerItemDecoration(mContext, LinearLayoutManager.VERTICAL));
    adapter = new SearchResultAdapter(mContext, recyclerView);
    recyclerView.setAdapter(adapter);
    adapter.setOnMoreDataLoadListener(this);
    mPresenter.searchArticles(keyword, false);
}