android.support.v7.widget.DividerItemDecoration Java Examples

The following examples show how to use android.support.v7.widget.DividerItemDecoration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContactsListFragment.java    From chat21-android-sdk with GNU Affero General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "ContactsListFragment.onCreateView");
    View view = inflater.inflate(R.layout.fragment_contacts_list, container, false);

    // init RecyclerView
    recyclerViewContacts = view.findViewById(R.id.contacts_list);
    recyclerViewContacts.addItemDecoration(new ItemDecoration(getContext(),
            DividerItemDecoration.VERTICAL,
            getResources().getDrawable(R.drawable.decorator_activity_contact_list)));
    lmRvContacts = new LinearLayoutManager(getActivity());
    recyclerViewContacts.setLayoutManager(lmRvContacts);
    updateContactListAdapter(contactsSynchronizer.getContacts());

    // no contacts layout
    noContactsLayout = view.findViewById(R.id.layout_no_contacts);
    toggleNoContactsLayoutVisibility(contactsListAdapter.getItemCount());

    return view;
}
 
Example #2
Source File: WrapRecyclerViewItemActivity.java    From Gloading with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    RecyclerView recyclerView = new RecyclerView(this);
    setContentView(recyclerView);
    DisplayMetrics dm = getResources().getDisplayMetrics();
    size = dm.widthPixels >> 1;

    GridLayoutManager layoutManager = new GridLayoutManager(this, 2);
    layoutManager.setOrientation(OrientationHelper.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    RecyclerAdapter adapter = new RecyclerAdapter(initData());
    recyclerView.setAdapter(adapter);
}
 
Example #3
Source File: HomeFragment.java    From WanAndroid with MIT License 6 votes vote down vote up
@Override
protected void initView() {
    initData();
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
    linearLayoutManager.setOrientation(OrientationHelper.VERTICAL);
    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));

    FrameLayout headView = (FrameLayout) LayoutInflater.from(getContext()).inflate(R.layout.banner_home, null);
    homeBanner = headView.findViewById(R.id.home_banner);
    headView.removeView(homeBanner);
    homeBanner.setImageLoader(new HomeBannerLoader());
    homeBanner.setImages(bannerList);
    homeBanner.start();

    commonArticleAdapter = new CommonArticleAdapter(R.layout.item_article, articleList);
    commonArticleAdapter.addHeaderView(homeBanner);
    commonArticleAdapter.setEnableLoadMore(true);

    recyclerView.setAdapter(commonArticleAdapter);
    refreshAndloadMore();
}
 
Example #4
Source File: NestedBehaviorActivity.java    From AndroidDemo with MIT License 6 votes vote down vote up
@Override
    protected void init() {
//        text = findViewById(R.id.text);
        recyclerView = findViewById(R.id.recyclerView);

        recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
        recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
        List<String> data = new ArrayList<>();
        for (int i = 0; i < 30; i++) {
            data.add("behavior data " + i);
        }
        SimpleRecyclerAdapter simpleRecyclerAdapter = new SimpleRecyclerAdapter(this, data);
        recyclerView.setAdapter(simpleRecyclerAdapter);

//        bottomSheetBehavior = BottomSheetBehavior.from(text);
//        bottomSheetBehavior.setHideable(true);
    }
 
Example #5
Source File: StylistProcessTextFragment.java    From text_converter with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    String input = getArguments().getString(KEY_INPUT);

    RecyclerView mListResult = view.findViewById(R.id.recycler_view);
    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
    mListResult.setLayoutManager(layoutManager);
    mListResult.addItemDecoration(new DividerItemDecoration(getContext(), layoutManager.getOrientation()));

    mAdapter = new StylishProcessTextAdapter(getContext());
    if (getActivity() instanceof OnTextSelectedListener) {
        mAdapter.setListener((OnTextSelectedListener) getActivity());
    }
    mListResult.setAdapter(mAdapter);

    convert(input);
}
 
Example #6
Source File: SliceTestActivity.java    From incubator-weex-playground with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  try {
    WXSDKEngine.registerModule("searchEvent", SearchModule.class);
  } catch (WXException e) {
    e.printStackTrace();
  }
  setContentView(R.layout.activity_slice_test);
  mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
  mReportTextView = (TextView) findViewById(R.id.report_text);

  mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
  mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
  mAdapter = new WXInstanceAdapter();
  mRecyclerView.setAdapter(mAdapter);
}
 
Example #7
Source File: ItemActivity.java    From Fairy with Apache License 2.0 6 votes vote down vote up
private void initView() {
    RecyclerView recycleView = findViewById(R.id.recycle_main);
    adapter = new MyAdapter(this);
    itemTouchCallback = new MyItemTouchCallback(this,
                                                       adapter,
                                                       ItemTouchHelper.UP | ItemTouchHelper.DOWN,
                                                       ItemTouchHelper.LEFT | ItemTouchHelper.END);
    ItemTouchHelper itemTouchHelper = new ItemTouchHelper(itemTouchCallback);

    recycleView.setLayoutManager(new LinearLayoutManager(this));
    recycleView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
    recycleView.setAdapter(adapter);
    adapter.addAll(new ArrayList<>());
    itemTouchHelper.attachToRecyclerView(recycleView);

    adapter.setOnClickListener(position -> {
        viewModel.setTempPosition(position);
        Intent intent = new Intent(ItemActivity.this, LogcatActivity.class);
        LogcatItem item = adapter.get(position);
        intent.putExtra(LogcatActivity.LOGCAT_ITEM, item);
        startActivityForResult(intent, ITEM_REQUEST_CODE);
    });
}
 
Example #8
Source File: ChooseMusicActivity.java    From PLDroidShortVideo with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_choose_music);

    mMusicRecyclerView = findViewById(R.id.music_list);

    mAudioFiles = MediaUtils.getLocalAudios(getApplicationContext());
    mMusicAdapter = new ChooseMusicAdapter(mAudioFiles);
    mMusicAdapter.setVideoDuration(getIntent().getLongExtra("videoDurationMs", 0L));
    mMusicAdapter.setOnMusicClickListener(this);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this,
            LinearLayoutManager.VERTICAL, false);
    mMusicRecyclerView.setLayoutManager(layoutManager);
    mMusicRecyclerView.addItemDecoration(
            new DividerItemDecoration(getApplicationContext(), DividerItemDecoration.VERTICAL));
    mMusicRecyclerView.setAdapter(mMusicAdapter);

    initPlayer();
}
 
Example #9
Source File: GoodsListActivity.java    From enjoyshop with Apache License 2.0 6 votes vote down vote up
/**
 * 展示数据
 */
private void showData() {

    if (datas != null && datas.size() > 0) {
        mTxtSummary.setText("共有" + datas.size() + "件商品");
    } else {
        mLlSummary.setVisibility(View.GONE);
        ToastUtils.showUiToast(GoodsListActivity.this,"暂无商品信息");
        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));

}
 
Example #10
Source File: TweetsSQLiteFragment.java    From storio with Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);

    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(tweetsAdapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setHasFixedSize(true);
    recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));

    uiStateController = new UiStateController.Builder()
            .withLoadingUi(view.findViewById(R.id.tweets_loading_ui))
            .withErrorUi(view.findViewById(R.id.tweets_error_ui))
            .withEmptyUi(view.findViewById(R.id.tweets_empty_ui))
            .withContentUi(recyclerView)
            .build();
}
 
Example #11
Source File: FloatingStylishService.java    From text_converter with GNU General Public License v3.0 6 votes vote down vote up
@NonNull
@Override
protected View onCreateView(@NonNull ViewGroup parent) {
    mGenerator = new StylistGenerator(getContext());

    View view = LayoutInflater.from(getContext()).inflate(R.layout.floating_stylish, parent, false);
    mInput = view.findViewById(R.id.edit_input);

    mAdapter = new ResultAdapter(getContext(), R.layout.list_item_style_floating);

    mListResult = view.findViewById(R.id.recycler_view);
    mListResult.setLayoutManager(new LinearLayoutManager(getContext()));
    mListResult.setHasFixedSize(true);
    mListResult.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
    mListResult.setAdapter(mAdapter);

    mInput.addTextChangedListener(this);
    return view;
}
 
Example #12
Source File: RegisteredApplicationFragment.java    From MiPushFramework with GNU General Public License v3.0 6 votes vote down vote up
@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);


    swipeRefreshLayout = new SwipeRefreshLayout(getActivity());
    swipeRefreshLayout.setOnRefreshListener(this);
    swipeRefreshLayout.addView(view);

    loadPage();
    return swipeRefreshLayout;
}
 
Example #13
Source File: RecentTracksFragment.java    From QuickLyric with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setRetainInstance(true);
    setHasOptionsMenu(true);
    View layout = inflater.inflate(R.layout.recent_tracks_view, container, false);
    mRecyclerView = layout.findViewById(R.id.track_list_view);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new RecentTracksAdapter(getActivity());
    mRecyclerView.setAdapter(mAdapter);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
            mLayoutManager.getOrientation());
    mRecyclerView.addItemDecoration(dividerItemDecoration);
    mRecyclerView.setNestedScrollingEnabled(false);
    flipper = layout.findViewById(R.id.recents_viewflipper);
    TextView emptyText = layout.findViewById(R.id.local_empty_database_textview);
    String str = getActivity().getResources().getString(R.string.recents_empty_database);
    emptyText.setText(str);
    chooseView();
    return layout;
}
 
Example #14
Source File: ChatGroupsListFragment.java    From chat21-android-sdk with GNU Affero General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_chat_groups_list, container, false);

    // init RecyclerView
    recyclerViewChatGroups = view.findViewById(R.id.chat_groups_list);
    recyclerViewChatGroups.addItemDecoration(new ItemDecoration(getContext(),
            DividerItemDecoration.VERTICAL,
            getResources().getDrawable(R.drawable.decorator_activity_my_groups_list)));
    lmRvChatGroups = new LinearLayoutManager(getActivity());
    recyclerViewChatGroups.setLayoutManager(lmRvChatGroups);
    updateChatGroupsListAdapter(chatGroupsSynchronizer.getChatGroups());

    // no contacts layout
    noChatGroupsLayout = view.findViewById(R.id.layout_no_groups);
    toggleNoContactsLayoutVisibility(chatGroupsListAdapter.getItemCount());

    chatGroupsSynchronizer.addGroupsListener(this);
    chatGroupsSynchronizer.connect();

    return view;
}
 
Example #15
Source File: NotificationActivity.java    From 1Rramp-Android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_notification);
  ButterKnife.bind(this);
  mNotifications = new ArrayList<>();
  DividerItemDecoration itemDecor = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL);
  Drawable drawable = getResources().getDrawable(R.drawable.notification_divider);
  itemDecor.setDrawable(drawable);
  mHandler = new Handler();
  notificationAdapter = new NotificationAdapter();
  recyclerView.setLayoutManager(new LinearLayoutManager(this));
  recyclerView.addItemDecoration(itemDecor);
  recyclerView.setAdapter(notificationAdapter);
  backBtn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
      finish();
    }
  });
  listenToNotifications();
}
 
Example #16
Source File: ContactsListActivity.java    From Identiconizer with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_contacts_list);
    mRecyclerView = findViewById(R.id.recycler_view);
    mRecyclerView.setHasFixedSize(true);
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));

    mCursor = getContacts();
    mAdapter = new ContactsCursorAdapter(this, mCursor);
    mRecyclerView.setAdapter(mAdapter);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle(R.string.identicons_contacts_list_title);
}
 
Example #17
Source File: EventFragment.java    From MiPushFramework with GNU General Public License v3.0 6 votes vote down vote up
@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.addOnScrollListener(new OnLoadMoreListener() {
        @Override
        public void onLoadMore() {
            loadPage();
        }
    });

    swipeRefreshLayout = new SwipeRefreshLayout(getActivity());
    swipeRefreshLayout.setOnRefreshListener(this);
    swipeRefreshLayout.addView(view);
    return swipeRefreshLayout;
}
 
Example #18
Source File: RecyclerViewActivity.java    From EtsyBlur with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recycler_view);

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    recyclerView.setHasFixedSize(true);
    recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
    recyclerView.setAdapter(new ListItemRecyclerViewAdapter(ListItemDataProvider.generateSample(this, 5)));

    blurringView = (BlurringView) findViewById(R.id.blurring_view);
    blurringView.blurredView(recyclerView);
}
 
Example #19
Source File: AmmoDetailFragment.java    From Companion-For-PUBG-Android with MIT License 6 votes vote down vote up
@Override
public void onViewCreated(final View view,
                          @Nullable final Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final Bundle args = getArguments();
    if (args == null) {
        throw new IllegalStateException("Missing arguments");
    }
    final Ammo ammo = (Ammo) args.getSerializable(ARG_AMMO);
    if (ammo == null) {
        throw new IllegalStateException("Missing Ammo");
    }
    setNameText(ammo.getName());
    setAmmoImageView(ammo.getImageUrl());
    if (this.weaponsRecycler != null) {
        final WeaponList weapons = PUBGApplication.getInstance().getItems().getCategories().getWeaponCategory().getWeaponsUsingAmmo(ammo.getId());
        ItemRecyclerViewAdapter<Weapon> adapter = new ItemRecyclerViewAdapter<>((weapons));
        adapter.setListener(this);
        final DividerItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL);
        this.weaponsRecycler.addItemDecoration(itemDecoration);
        this.weaponsRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));

        this.weaponsRecycler.setAdapter(adapter);
    }

}
 
Example #20
Source File: ItemTabFragment.java    From Companion-For-PUBG-Android with MIT License 6 votes vote down vote up
@Override
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final Bundle args = getArguments();
    if (args == null || !args.containsKey(ARG_CATEGORY_NAME)) {
        return;
    }
    final Category.Name categoryName = (Category.Name) args.getSerializable(ARG_CATEGORY_NAME);
    if (this.recyclerView == null || categoryName == null) {
        return;
    }
    final Category<Item> category = PUBGApplication.getInstance().getItems().getCategories().get(categoryName);
    if (category == null) {
        return;
    }
    final DividerItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL);
    this.recyclerView.addItemDecoration(itemDecoration);
    this.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    final ItemRecyclerViewAdapter<Item> adapter = new ItemRecyclerViewAdapter<>(category.getItems());
    adapter.setListener(this);
    this.recyclerView.setAdapter(adapter);
}
 
Example #21
Source File: MainActivity.java    From Database-First with Apache License 2.0 6 votes vote down vote up
@Override
public void showUsers(List<User> users) {
    Log.d(TAG, "showUsers() returned: " + users.size());
    // use this setting to improve performance if you know that changes
    // in content do not change the layout size of the RecyclerView
    recyclerViewUser.setHasFixedSize(true);

    // use a linear layout manager
    layoutManager = new LinearLayoutManager(this);
    recyclerViewUser.setLayoutManager(layoutManager);

    //add divider for spacing
    recyclerViewUser.addItemDecoration(new DividerItemDecoration(getApplicationContext(),
            DividerItemDecoration.VERTICAL));

    // specify an adapter (see also next example)
    userRecyclerViewAdapter = new UserRecyclerViewAdapter(getApplicationContext(), users);
    recyclerViewUser.setAdapter(userRecyclerViewAdapter);
}
 
Example #22
Source File: FileListFragment.java    From mua with MIT License 6 votes vote down vote up
public void setRecyclerView() {
    if (StorageHelper.isExternalStorageReadable()) {
        entityList = FileUtils.listFiles(rootPath);
        if (entityList != null && entityList.isEmpty()) {
            emptyList.setVisibility(View.VISIBLE);
        } else {
            emptyList.setVisibility(View.GONE);
            adapter = new FilesAdapter(entityList);
            fileListRecyclerView.setLayoutManager(new LinearLayoutManager(context));
            fileListRecyclerView.setItemAnimator(new DefaultItemAnimator());
            fileListRecyclerView.addItemDecoration(new DividerItemDecoration(context,
                    DividerItemDecoration.VERTICAL));
            fileListRecyclerView.setAdapter(adapter);
        }
    } else {
        Toast.makeText(context, R.string.toast_message_sdcard_unavailable,
                Toast.LENGTH_SHORT).show();
    }
}
 
Example #23
Source File: AbstractListContactsFragment.java    From RememBirthday with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the fragment layout
    View rootView = inflater.inflate(R.layout.fragment_list_contacts, container, false);

    // Gets the ListView from the View list of the parent activity
    contactsListView = (RecyclerView) rootView.findViewById(R.id.fragment_list_contacts_recyclerview_contacts);
    contactsListView.setHasFixedSize(true);
    contactsListView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
    linearLayoutManager = new LinearLayoutManager(getContext());
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    contactsListView.setLayoutManager(linearLayoutManager);

    return rootView;
}
 
Example #24
Source File: BleActivity.java    From Android-BLE with Apache License 2.0 5 votes vote down vote up
private void initAdapter() {
    bleRssiDevices = new ArrayList<>();
    adapter = new ScanAdapter(this, bleRssiDevices);
    recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
    recyclerView.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.VERTICAL));
    recyclerView.getItemAnimator().setChangeDuration(300);
    recyclerView.getItemAnimator().setMoveDuration(300);
    recyclerView.setAdapter(adapter);
}
 
Example #25
Source File: NewAudioBookPresenter.java    From YAAB with GNU General Public License v3.0 5 votes vote down vote up
public void setRecycler(RecyclerView rv) {
    LinearLayoutManager lm = new LinearLayoutManager(context);
    rv.setLayoutManager(lm);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(rv.getContext(),
            lm.getOrientation());
    rv.addItemDecoration(dividerItemDecoration);
    ArrayList<AudioBook> items = new ArrayList<>();
    adapter = new AudioBookAdapter(context, items, this);
    rv.setAdapter(adapter);
    interactor.loadNewAudioBooks();
}
 
Example #26
Source File: FolderChooser.java    From screenrecorder with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initRecyclerView() {
    rv.setHasFixedSize(true);
    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
    rv.setLayoutManager(layoutManager);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(getContext(), layoutManager.getOrientation());
    rv.addItemDecoration(dividerItemDecoration);
    if (!isDirectoryEmpty()) {
        adapter = new DirectoryRecyclerAdapter(getContext(), this, directories);
        rv.setAdapter(adapter);
    }
    tv_currentDir.setText(currentDir.getPath());
}
 
Example #27
Source File: MainActivity.java    From jsoup-annotations with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #28
Source File: HomeFragment.java    From POCenter with MIT License 5 votes vote down vote up
@Override
protected void initView(View view) {
    bind = DataBindingUtil.bind(view);

    // init recycler view
    homeAdapter = new HomeAdapter(new ArrayList<ProjectBean>(0));
    bind.rv.setAdapter(homeAdapter);
    bind.rv.setLayoutManager(new LinearLayoutManager(getContext()));
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
    dividerItemDecoration.setDrawable(getResources().getDrawable(R.drawable.shape_drive_line));
    bind.rv.addItemDecoration(dividerItemDecoration);

    initEvent();
}
 
Example #29
Source File: AllAudioBookPresenter.java    From YAAB with GNU General Public License v3.0 5 votes vote down vote up
public void setRecycler(RecyclerView rv) {
    LinearLayoutManager lm = new LinearLayoutManager(context);
    rv.setLayoutManager(lm);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(rv.getContext(),
            lm.getOrientation());
    rv.addItemDecoration(dividerItemDecoration);
    ArrayList<AudioBook> items = new ArrayList<>();
    adapter = new AudioBookAdapter(context, items, this);
    rv.setAdapter(adapter);
    interactor.loadAllAudioBooks();
}
 
Example #30
Source File: FolderChooserPresenter.java    From YAAB with GNU General Public License v3.0 5 votes vote down vote up
public void initializeList(RecyclerView rv) {
    LinearLayoutManager lm = new LinearLayoutManager(context);
    rv.setLayoutManager(lm);
    adapter = new FolderChooserAdapter(context, new ArrayList<Folder>(), this);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(rv.getContext(),
            lm.getOrientation());
    rv.addItemDecoration(dividerItemDecoration);
    rv.setAdapter(adapter);
    interactor.loadFolders(null);
}