Android Open Source - Game-of-thrones-trivia Main Menu Activity






From Project

Back to project page Game-of-thrones-trivia.

License

The source code is released under:

MIT License

If you think the Android project Game-of-thrones-trivia listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.GameOfThrones.Trivia.ui;
//from  www .  jav a 2s . co  m
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.GameOfThrones.Trivia.R;

/**
 * Main Menu of application.
 * 
 * @author andre
 * 
 */
/**
 * @author andre
 * 
 */
public class MainMenuActivity extends DynamicBackgroundActivity implements
    OnClickListener {
  /**
   * Navigation to other sections of the App
   */
  Button email, highScore, about, characterGame;

  /**
   * Used to indicate that a a activity startedForResult returned successfully
   */
  final static int GAME_ACTIVITY_RESULT_CODE = 1;

  /*
   * (non-Javadoc)
   * 
   * @see
   * com.GameOfThrones.Trivia.SuperActivities.DynamicBackgroundActivity#onCreate
   * (android.os.Bundle)
   */
  /**
   * Initializes instance variables and displays disclaimer and updates if the
   * situation is appropriate
   */
  @Override
  public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.main_menu);
    email = (Button) findViewById(R.id.mainEmail);
    highScore = (Button) findViewById(R.id.highScore);
    about = (Button) findViewById(R.id.about);
    characterGame = (Button) findViewById(R.id.game);
    characterGame.setOnClickListener(this);
    highScore.setOnClickListener(this);
    email.setOnClickListener(this);
    about.setOnClickListener(this);

    showPopUpMessage(new int[] { R.string.disclaimer_ },   false);

    showPopUpMessage(new int[] { R.string.updates,
        R.string.license }, false);
  }

  /*
   * (non-Javadoc)
   * 
   * @see android.view.View.OnClickListener#onClick(android.view.View)
   */
  /*
   * (non-Javadoc)
   * 
   * @see android.view.View.OnClickListener#onClick(android.view.View)
   */
  public void onClick(View v) {
    switch (v.getId()) {
    case R.id.game:
      nextActivity(TriviaSelectionActivity.class);
      break;
    case R.id.mainEmail:
      sendMail("Concerns about Spartacus app");
      break;
    case R.id.highScore:
      Intent scoreIntent = new Intent(this, HighScoreActivity.class);
      startActivity(scoreIntent);
      break;
    case R.id.about:
      Intent aboutIntent = new Intent(this, AboutActivity.class);
      startActivity(aboutIntent);
      break;
    }
  }

  /*
   * (non-Javadoc)
   * 
   * @see android.app.Activity#onActivityResult(int, int,
   * android.content.Intent)
   */
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
    case GAME_ACTIVITY_RESULT_CODE:
      if (resultCode == RESULT_OK) {
        finish();
      }
      break;
    }
  }

  /**
   * onDestroy() - cleans up instance variables
   */
  public void onDestoy() {
    super.onDestroy();
    email = null;
    highScore = null;
    about = null;
    characterGame = null;
  }

  /*
   * (non-Javadoc)
   * 
   * @see com.GameOfThrones.Trivia.SuperActivities.DynamicBackgroundActivity#
   * getBackgroundLayout()
   */
  @Override
  protected int getBackgroundLayout() {
    // TODO Auto-generated method stub
    return R.id.menuActivity;
  }

}




Java Source Code List

com.GameOfThrones.Trivia.core.CharacterToQuestionsMap.java
com.GameOfThrones.Trivia.core.GameCharacter.java
com.GameOfThrones.Trivia.core.HighScore.java
com.GameOfThrones.Trivia.core.OutOfQuestionsException.java
com.GameOfThrones.Trivia.core.QuestionCollection.java
com.GameOfThrones.Trivia.core.Question.java
com.GameOfThrones.Trivia.core.Session.java
com.GameOfThrones.Trivia.core.SimpleIterator.java
com.GameOfThrones.Trivia.core.TriviaGame.java
com.GameOfThrones.Trivia.data.HighScorePrefs.java
com.GameOfThrones.Trivia.data.RequestWebService.java
com.GameOfThrones.Trivia.data.StringsXMLFileData.java
com.GameOfThrones.Trivia.ui.AboutActivity.java
com.GameOfThrones.Trivia.ui.DynamicBackgroundActivity.java
com.GameOfThrones.Trivia.ui.GameActivity.java
com.GameOfThrones.Trivia.ui.HighScoreActivity.java
com.GameOfThrones.Trivia.ui.MainMenuActivity.java
com.GameOfThrones.Trivia.ui.ResultsActivity.java
com.GameOfThrones.Trivia.ui.TriviaSelectionActivity.java
com.GameOfThrones.Trivia.ui.music.MusicService.java
com.GameOfThrones.Trivia.util.GeneralAlgorithms.java
com.Spartacus.TriviaTest.TriviaMenuActivityTest.java
com.Spartacus.Trivia.utilTest.GeneralAlgorithmsTest.java