use of androidx.recyclerview.widget.DividerItemDecoration in project RespawnIRC-Android by FranckRJ.
the class ManageSurveyOfTopicActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_managesurvey);
initToolbar(R.id.toolbar_managesurvey);
Button validateButton = findViewById(R.id.validate_button_managesurvey);
Button addReplyButton = findViewById(R.id.addreply_button_managesurvey);
listOfReplys = findViewById(R.id.reply_list_managesurvey);
titleEdit = findViewById(R.id.title_edit_managesurvey);
adapterForReplys = new SurveyReplysAdapter(this);
validateButton.setOnClickListener(validateButtonClicked);
addReplyButton.setOnClickListener(addReplyButtonClicked);
listOfReplys.setNestedScrollingEnabled(false);
listOfReplys.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
listOfReplys.setLayoutManager(new LinearLayoutManager(this));
listOfReplys.setAdapter(adapterForReplys);
if (getIntent() != null && savedInstanceState == null) {
String title = getIntent().getStringExtra(EXTRA_SURVEY_TITLE);
ArrayList<String> replysList = getIntent().getStringArrayListExtra(EXTRA_SURVEY_REPLYS_LIST);
if (!Utils.stringIsEmptyOrNull(title)) {
titleEdit.setText(title);
}
if (replysList != null) {
for (int i = 0; i < replysList.size(); ++i) {
if (!Utils.stringIsEmptyOrNull(replysList.get(i))) {
adapterForReplys.addReply(replysList.get(i));
}
}
}
} else if (savedInstanceState != null) {
ArrayList<String> newListOfReplysContent = savedInstanceState.getStringArrayList(SAVE_LIST_OF_REPLY_CONTENT);
if (newListOfReplysContent != null) {
adapterForReplys.setReplys(newListOfReplysContent);
}
}
while (adapterForReplys.getItemCount() < 2) {
adapterForReplys.addReply("");
}
}
Aggregations