use of android.support.v7.widget.DividerItemDecoration in project MultiType by drakeet.
the class TestPayloadActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
recyclerView.addItemDecoration(new DividerItemDecoration(this, VERTICAL));
MultiTypeAdapter adapter = new MultiTypeAdapter();
recyclerView.setAdapter(adapter);
adapter.register(HeavyItem.class, new HeavyItemViewBinder());
Items items = new Items();
for (int i = 0; i < 30; i++) {
items.add(new HeavyItem("1000" + i));
}
adapter.setItems(items);
adapter.notifyDataSetChanged();
Toast.makeText(this, "Try to click or long click items", Toast.LENGTH_SHORT).show();
}
use of android.support.v7.widget.DividerItemDecoration in project FlexibleAdapter by davideas.
the class FragmentExpandableSections method initializeRecyclerView.
@SuppressWarnings({ "ConstantConditions", "NullableProblems" })
private void initializeRecyclerView(Bundle savedInstanceState) {
// Initialize Adapter and RecyclerView
// ExampleAdapter makes use of stableIds, I strongly suggest to implement 'item.hashCode()'
mAdapter = new ExampleAdapter(DatabaseService.getInstance().getDatabaseList(), getActivity());
// Experimenting NEW features (v5.0.0)
mAdapter.expandItemsAtStartUp().setAutoCollapseOnExpand(false).setAutoScrollOnExpand(true).setAnimateToLimit(//Size limit = MAX_VALUE will always animate the changes
Integer.MAX_VALUE).setNotifyMoveOfFilteredItems(//When true, filtering on big list is very slow!
false).setNotifyChangeOfUnfilteredItems(//We have highlighted text while filtering, so let's enable this feature to be consistent with the active filter
true).setAnimationOnScrolling(DatabaseConfiguration.animateOnScrolling).setAnimationOnReverseScrolling(true);
mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
mRecyclerView.setLayoutManager(createNewLinearLayoutManager());
mRecyclerView.setAdapter(mAdapter);
//Size of RV will not change
mRecyclerView.setHasFixedSize(true);
// NOTE: Use default item animator 'canReuseUpdatedViewHolder()' will return true if
// a Payload is provided. FlexibleAdapter is actually sending Payloads onItemChange.
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
// Custom divider item decorator
mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), R.drawable.divider, //Increase to add gap between sections (Works only with LinearLayout!)
0));
// Add FastScroll to the RecyclerView, after the Adapter has been attached the RecyclerView!!!
mAdapter.setFastScroller((FastScroller) getView().findViewById(R.id.fast_scroller), Utils.getColorAccent(getActivity()), (MainActivity) getActivity());
// Experimenting NEW features (v5.0.0)
//Enable long press to drag items
mAdapter.setLongPressDragEnabled(true).setHandleDragEnabled(//Enable handle drag
true);
//.setDisplayHeadersAtStartUp(true); //Show Headers at startUp: (not necessary if Headers are also Expandable)
SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) getView().findViewById(R.id.swipeRefreshLayout);
swipeRefreshLayout.setEnabled(true);
mListener.onFragmentChange(swipeRefreshLayout, mRecyclerView, SelectableAdapter.MODE_IDLE);
// Add 1 Scrollable Header
mAdapter.showLayoutInfo(savedInstanceState == null);
}
use of android.support.v7.widget.DividerItemDecoration in project MVCHelper by LuckyJayce.
the class ABSTestCaseFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
this.inflater = inflater;
View view = inflater.inflate(R.layout.testcase, container, false);
taskHelper = new TaskHelper<>();
GsonBuilder builder = new GsonBuilder();
// 格式化输出
builder.setPrettyPrinting();
// builder.serializeNulls();
builder.addSerializationExclusionStrategy(new ExclusionStrategy() {
@Override
public boolean shouldSkipField(FieldAttributes f) {
// true; //按注解排除
return false;
}
@Override
public boolean shouldSkipClass(Class<?> clazz) {
// 直接排除某个类 ,return true为排除
return clazz == Gson.class || clazz == Bitmap.class;
}
}).create();
gson = builder.create();
recyclerView = (RecyclerView) view.findViewById(R.id.testcase2_recyclerView);
paramsRecyclerView = (LinearLayout) view.findViewById(R.id.testcase2_params_recyclerView);
resultTextView = (TextView) view.findViewById(R.id.testcase2_result_textView);
runButton = (Button) view.findViewById(R.id.testcase2_run_button);
resetButton = (Button) view.findViewById(R.id.testcase2_reset_button);
itemRunButton = view.findViewById(R.id.testcase2_run2_button);
resultStateTextView = (TextView) view.findViewById(R.id.testcase2_resultState_textView);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(tasksAdapter = new TasksAdapter());
// recyclerView.addItemDecoration(new DividerItemDecoration(getContext()));
//
// // paramsRecyclerView.setLayoutManager(new
// // LinearLayoutManager(getContext()));
// // paramsRecyclerView.addItemDecoration(new
// // DividerItemDecoration(getContext()));
// // paramsRecyclerView.setAdapter(paramsAdapter = new ParamsAdapter());
datas = getTestCaseDatas();
resetButton.setOnClickListener(onClickListener);
runButton.setOnClickListener(onClickListener);
itemRunButton.setOnClickListener(onClickListener);
tasksAdapter.setOnItemClickListener(onItemClickListener);
resultTextView.setOnClickListener(onClickListener);
updateRight();
return view;
}
use of android.support.v7.widget.DividerItemDecoration in project Carbon by ZieIony.
the class IconTextListItemActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listcomponent);
Samples.initToolbar(this, getString(R.string.iconTextListItemActivity_title));
RecyclerView recycler = (RecyclerView) findViewById(R.id.recycler);
recycler.setLayoutManager(new LinearLayoutManager(this));
RowListAdapter adapter = new RowListAdapter<>(DefaultIconTextItem.class, IconTextRow::new);
adapter.addFactory(DefaultIconSearchItem.class, parent -> new IconSearchRow(parent, new ArraySearchDataProvider(new String[] {}), filterResults -> {
}));
recycler.setAdapter(adapter);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(new ColorDrawable(Carbon.getThemeColor(this, R.attr.carbon_dividerColor)), getResources().getDimensionPixelSize(R.dimen.carbon_1dip));
dividerItemDecoration.setDrawRules(position -> position == 0);
recycler.addItemDecoration(dividerItemDecoration);
VectorDrawable drawable = new VectorDrawable(getResources(), R.raw.ic_face_24px);
adapter.setItems(Arrays.asList(new DefaultIconSearchItem(this), new DefaultIconTextItem(drawable, "text"), new DefaultIconTextItem(drawable, "text"), new DefaultIconTextItem(drawable, "text"), new DefaultIconTextItem(drawable, "text")));
}
use of android.support.v7.widget.DividerItemDecoration in project remusic by aa112901.
the class AlbumDetailFragment method onCreateView.
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_common, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(mContext);
recyclerView.setLayoutManager(layoutManager);
mAdapter = new AlbumDetailAdapter(null);
recyclerView.setAdapter(mAdapter);
itemDecoration = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL_LIST);
recyclerView.addItemDecoration(itemDecoration);
recyclerView.setHasFixedSize(true);
reloadAdapter();
AlbumInfo albumInfo = MusicUtils.getAlbumInfo(mContext, albumID);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);
((AppCompatActivity) mContext).setSupportActionBar(toolbar);
ab = ((AppCompatActivity) mContext).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle(albumInfo.album_name);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (getActivity() != null)
getActivity().onBackPressed();
}
});
return view;
}
Aggregations