use of com.nolanlawson.keepscore.data.EditablePlayerAdapter in project KeepScore by nolanlawson.
the class OrganizePlayersActivity method setUpWidgets.
private void setUpWidgets() {
okButton = (Button) findViewById(R.id.button_ok);
okButton.setOnClickListener(this);
cancelButton = (Button) findViewById(R.id.button_cancel);
cancelButton.setOnClickListener(this);
adapter = new EditablePlayerAdapter(this, game.getPlayerScores());
setListAdapter(adapter);
adapter.setOnChangeListener(new Runnable() {
@Override
public void run() {
// update the Add Player button if necessary
supportInvalidateOptionsMenu();
}
});
adapter.setOnDeleteListener(new Callback<PlayerScore>() {
@Override
public void onCallback(PlayerScore playerScore) {
// i.e. there's something the user might regret deleting
if (playerScore.getHistory() != null && playerScore.getHistory().size() > 0) {
deletedPlayersToWarnAbout.add(playerScore.toDisplayName(OrganizePlayersActivity.this).toString());
}
}
});
((DragSortListView) getListView()).setDropListener(adapter);
}
Aggregations