Search in sources :

Example 1 with GameResult

use of se.oort.diplicity.apigen.GameResult in project android-diplicity by zond.

the class GameActivity method showGameResults.

public void showGameResults() {
    setVisibility(View.GONE, R.id.solo_winner_label, R.id.solo_winner, R.id.dias_members_label, R.id.dias_members, R.id.nmr_game_members_label, R.id.nmr_game_members, R.id.eliminated_members_label, R.id.eliminated_members);
    hideAllExcept(R.id.game_results_view);
    final ScrollView gameResultsView = (ScrollView) findViewById(R.id.game_results_view);
    gameResultsView.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            flickFrameLayout.onTouchEvent(motionEvent);
            gameResultsView.onTouchEvent(motionEvent);
            return true;
        }
    });
    if (game.Finished) {
        handleReq(gameResultService.GameResultLoad(game.ID), new Sendable<SingleContainer<GameResult>>() {

            @Override
            public void send(SingleContainer<GameResult> gameResultSingleContainer) {
                MemberListPopulater populater = new MemberListPopulater();
                if (gameResultSingleContainer.Properties.SoloWinnerUser != null && !gameResultSingleContainer.Properties.SoloWinnerUser.equals("")) {
                    populater.populate(R.id.solo_winner, Arrays.asList(gameResultSingleContainer.Properties.SoloWinnerUser));
                    setVisibility(View.VISIBLE, R.id.solo_winner, R.id.solo_winner_label);
                }
                if (gameResultSingleContainer.Properties.DIASUsers != null) {
                    populater.populate(R.id.dias_members, gameResultSingleContainer.Properties.DIASUsers);
                    setVisibility(View.VISIBLE, R.id.dias_members, R.id.dias_members_label);
                }
                if (gameResultSingleContainer.Properties.EliminatedUsers != null) {
                    populater.populate(R.id.eliminated_members, gameResultSingleContainer.Properties.EliminatedUsers);
                    setVisibility(View.VISIBLE, R.id.eliminated_members, R.id.eliminated_members_label);
                }
                if (gameResultSingleContainer.Properties.NMRUsers != null) {
                    populater.populate(R.id.nmr_game_members, gameResultSingleContainer.Properties.NMRUsers);
                    setVisibility(View.VISIBLE, R.id.nmr_game_members, R.id.nmr_game_members_label);
                }
                if (gameResultSingleContainer.Properties.Scores != null) {
                    ((MemberTable) findViewById(R.id.scored_members)).setScores(gameResultSingleContainer.Properties.Scores);
                    populater.populate(R.id.scored_members, gameResultSingleContainer.Properties.AllUsers);
                    setVisibility(View.VISIBLE, R.id.scored_members, R.id.scored_members_label);
                }
            }
        }, getResources().getString(R.string.loading_game_result));
    }
}
Also used : SingleContainer(se.oort.diplicity.apigen.SingleContainer) ScrollView(android.widget.ScrollView) GameResult(se.oort.diplicity.apigen.GameResult) NavigationView(android.support.design.widget.NavigationView) UserView(se.oort.diplicity.UserView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) ScrollView(android.widget.ScrollView) MotionEvent(android.view.MotionEvent)

Aggregations

NavigationView (android.support.design.widget.NavigationView)1 MotionEvent (android.view.MotionEvent)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 ScrollView (android.widget.ScrollView)1 TextView (android.widget.TextView)1 UserView (se.oort.diplicity.UserView)1 GameResult (se.oort.diplicity.apigen.GameResult)1 SingleContainer (se.oort.diplicity.apigen.SingleContainer)1