Android Open Source - android-simlple-minefield Minefield View






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 a  va  2  s . c o m*/
import android.content.Context;
import android.util.AttributeSet;
import android.widget.GridLayout;

/**
 * @author Andriy Petruk <andrii.petruk{at}gmail.com>
 * @date 23.06.14.
 */
public class MinefieldView extends GridLayout {
    public MinefieldView(Context context) {
        super(context);
    }

    public MinefieldView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MinefieldView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public void setAdapter(MinefieldAdapter minefieldAdapter) {
        removeAllViews();

        int width = minefieldAdapter.getWidth();
        int height = minefieldAdapter.getHeight();

        setColumnCount(width);

        for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++) {
                addView(minefieldAdapter.getView(y, x));
            }
        }
    }
}




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