Android Open Source - android-simlple-minefield Main Activity






From Project

Back to project page android-simlple-minefield.

License

The source code is released under:

Apache License

If you think the Android project android-simlple-minefield 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.trabo.minefield;
/*from   w w  w .  j av  a  2 s . c  o  m*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.trabo.minefield.utils.AppContract;

/**
 * @author Andriy Petruk <andrii.petruk{at}gmail.com>
 * @date 23.06.14.
 */
public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_activity);

        findViewById(R.id.easy_game_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startGame(AppContract.GameType.EASY);
            }
        });

        findViewById(R.id.normal_game_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startGame(AppContract.GameType.NORMAL);
            }
        });

        findViewById(R.id.hard_game_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startGame(AppContract.GameType.HARD);
            }
        });
        findViewById(R.id.high_score_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this, HighScoresActivity.class));
            }
        });
    }

    private void startGame(AppContract.GameType gameType) {
        Intent intent = new Intent(MainActivity.this, GameActivity.class);
        intent.putExtra(GameActivity.GAME_TYPE_KEY, gameType.ordinal());
        startActivity(intent);
    }
}




Java Source Code List

com.trabo.minefield.CellOnTouchListener.java
com.trabo.minefield.GameActivity.java
com.trabo.minefield.HighScoresActivity.java
com.trabo.minefield.MainActivity.java
com.trabo.minefield.MineFieldListener.java
com.trabo.minefield.MineModel.java
com.trabo.minefield.MinefieldAdapter.java
com.trabo.minefield.MinefieldView.java
com.trabo.minefield.utils.AppContract.java
com.trabo.minefield.utils.AppUtils.java
com.trabo.minefield.utils.MineGridUtils.java