~vedu/mafia-android/master

« back to all changes in this revision

Viewing changes to src/com/vedant/mafia/RoundEndsActivity.java

  • Committer: Vedant Agrwala
  • Date: 2013-11-14 09:10:05 UTC
  • Revision ID: vedant.kota@gmail.com-20131114091005-mv8oabe8o4fugzo8
Initial work

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package com.vedant.mafia;
 
2
 
 
3
import android.app.Activity;
 
4
import android.os.Bundle;
 
5
import android.view.Menu;
 
6
import android.view.View;
 
7
import android.widget.ArrayAdapter;
 
8
import android.widget.Spinner;
 
9
import android.widget.TextView;
 
10
 
 
11
public class RoundEndsActivity extends Activity {
 
12
        private final static String HEADING = "City rises to ";
 
13
 
 
14
        private Spinner dataSpinner;
 
15
 
 
16
        @Override
 
17
        protected void onCreate(Bundle savedInstanceState) {
 
18
                super.onCreate(savedInstanceState);
 
19
                setContentView(R.layout.activity_round_ends);
 
20
                String heading = getIntent().getStringExtra(GameController.PLAYER_NAME);
 
21
                if (heading == null)
 
22
                        heading = HEADING + "no death";
 
23
                else
 
24
                        heading = HEADING + "death of " + heading;
 
25
                ((TextView) findViewById(R.id.roundEndsHeading)).setText(heading);
 
26
                
 
27
                ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
 
28
                                android.R.layout.simple_spinner_item, GameController.db().names);
 
29
                adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
 
30
                dataSpinner.setAdapter(adapter);
 
31
        }
 
32
 
 
33
        @Override
 
34
        public boolean onCreateOptionsMenu(Menu menu) {
 
35
                // Inflate the menu; this adds items to the action bar if it is present.
 
36
                getMenuInflater().inflate(R.menu.round_ends, menu);
 
37
                return false;
 
38
        }
 
39
        
 
40
        public void voteOutCLicked(View v){
 
41
                GameController.votedOut((String)dataSpinner.getSelectedItem());
 
42
        }
 
43
 
 
44
}