Search in sources :

Example 1 with DragSortListView

use of com.nolanlawson.keepscore.widget.dragndrop.DragSortListView 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);
}
Also used : EditablePlayerAdapter(com.nolanlawson.keepscore.data.EditablePlayerAdapter) DragSortListView(com.nolanlawson.keepscore.widget.dragndrop.DragSortListView) PlayerScore(com.nolanlawson.keepscore.db.PlayerScore)

Aggregations

EditablePlayerAdapter (com.nolanlawson.keepscore.data.EditablePlayerAdapter)1 PlayerScore (com.nolanlawson.keepscore.db.PlayerScore)1 DragSortListView (com.nolanlawson.keepscore.widget.dragndrop.DragSortListView)1