Search in sources :

Example 1 with SurveyReplysAdapter

use of com.franckrj.respawnirc.jvcforum.jvcforumtools.SurveyReplysAdapter 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("");
    }
}
Also used : SurveyReplysAdapter(com.franckrj.respawnirc.jvcforum.jvcforumtools.SurveyReplysAdapter) Button(android.widget.Button) ArrayList(java.util.ArrayList) DividerItemDecoration(androidx.recyclerview.widget.DividerItemDecoration) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Aggregations

Button (android.widget.Button)1 DividerItemDecoration (androidx.recyclerview.widget.DividerItemDecoration)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 SurveyReplysAdapter (com.franckrj.respawnirc.jvcforum.jvcforumtools.SurveyReplysAdapter)1 ArrayList (java.util.ArrayList)1