use of com.gh4a.widget.DividerItemDecoration in project gh4a by slapperwan.
the class LoadingListFragmentBase method onCreateContentView.
@Override
protected View onCreateContentView(LayoutInflater inflater, ViewGroup parent) {
View view = inflater.inflate(R.layout.list_fragment_content, parent, false);
mEmptyViewContainer = view.findViewById(R.id.empty_view_container);
TextView emptyView = view.findViewById(android.R.id.empty);
int emptyTextResId = getEmptyTextResId();
if (emptyTextResId != 0) {
emptyView.setText(emptyTextResId);
}
mLayoutManager = new LinearLayoutManager(view.getContext());
mRecyclerView = view.findViewById(R.id.list);
mRecyclerView.setLayoutManager(mLayoutManager);
onRecyclerViewInflated(mRecyclerView, inflater);
if (hasDividers()) {
mRecyclerView.addItemDecoration(new DividerItemDecoration(view.getContext()));
}
if (!hasCards()) {
mRecyclerView.setBackgroundResource(UiUtils.resolveDrawable(getActivity(), R.attr.listBackground));
}
mFastScroller = view.findViewById(R.id.fast_scroller);
mFastScroller.attachRecyclerView(mRecyclerView);
mFastScroller.setVisibility(View.VISIBLE);
mFastScroller.setOnHandleTouchListener((v, event) -> {
switch(event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
getBaseActivity().setRightDrawerLockedClosed(true);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
getBaseActivity().setRightDrawerLockedClosed(false);
break;
}
return false;
});
return view;
}
use of com.gh4a.widget.DividerItemDecoration in project gh4a by slapperwan.
the class IssueLabelListActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.generic_list);
setContentShown(false);
mAdapter = new IssueLabelAdapter(this);
mAdapter.setOnItemClickListener(this);
RecyclerView recyclerView = findViewById(R.id.list);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.addItemDecoration(new DividerItemDecoration(this));
recyclerView.setTag(R.id.FloatingActionButtonScrollEnabled, new Object());
recyclerView.setAdapter(mAdapter);
CoordinatorLayout rootLayout = getRootLayout();
mFab = (FloatingActionButton) getLayoutInflater().inflate(R.layout.add_fab, rootLayout, false);
mFab.setOnClickListener(this);
rootLayout.addView(mFab);
updateFabVisibility();
loadLabels(false);
if (savedInstanceState != null) {
if (savedInstanceState.containsKey(STATE_KEY_ADDED_LABEL)) {
mAddedLabel = savedInstanceState.getParcelable(STATE_KEY_EDITING_LABEL);
mAdapter.add(mAddedLabel);
startEditing(mAddedLabel);
} else if (savedInstanceState.containsKey(STATE_KEY_EDITING_LABEL)) {
IssueLabelAdapter.EditableLabel label = savedInstanceState.getParcelable(STATE_KEY_EDITING_LABEL);
int count = mAdapter.getCount();
for (int i = 0; i < count; i++) {
IssueLabelAdapter.EditableLabel item = mAdapter.getItem(i);
if (item.name().equals(label.name())) {
item.editedName = label.editedName;
item.editedColor = label.editedColor;
startEditing(item);
break;
}
}
}
}
}
Aggregations