use of com.gh4a.adapter.IssueLabelAdapter 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