Android Open Source - CrossOutXtreme Triangle Of Circles






From Project

Back to project page CrossOutXtreme.

License

The source code is released under:

Copyright (c) 2014, Matthew Koontz All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...

If you think the Android project CrossOutXtreme 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.crossoutxtrem;
//from   w w w .  j  av  a  2  s . com
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;

import com.crossoutxtrem.Statistics;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.DialogInterface.OnClickListener;
import android.content.SharedPreferences.Editor;
import android.media.AudioManager;
import android.os.Bundle;
import android.view.View;

public class TriangleOfCircles extends Activity implements OnClickListener
{
  public static boolean soundOn;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mainmenu);
    startup();
    }
    
    private void startup()
    {
      SharedPreferences prefs = this.getSharedPreferences("TriangleOfCircles", Context.MODE_PRIVATE);
      AI.currentDifficulty=prefs.getInt("diff", 0);
        int sound = prefs.getInt("sound", -1);
        if (sound==-1)
        {
          AlertDialog messageBox = new AlertDialog.Builder(this).create();
      messageBox.setTitle("Sound");
      messageBox.setMessage("Would you like to enable sound for this game (you can change this at any time in the \"Options\" menu)?");
      messageBox.setButton("Yes", this);
      messageBox.setButton2("No", this);
      messageBox.show();
        }
        else if (sound==0)
        {
          soundOn = false;
        }
        else
        {
          soundOn = true;
          this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
        }
    }
    
    public void twoPlayerButtonClicked(View view)
    {
    Intent tpIntent = new Intent(view.getContext(), TPOptions.class);
    startActivity(tpIntent);
    }
    
    public void singlePlayerButtonClicked(View view)
    {
      Intent spIntent = new Intent(view.getContext(), SPOptions.class);
      startActivity(spIntent);
    }
    
    public void optionsClicked(View view)
    {
      Intent oIntent = new Intent(view.getContext(), Options.class);
      startActivity(oIntent);
    }
    
    public void htpClicked(View view)
    {
      Intent oIntent = new Intent(view.getContext(), HowToPlay.class);
      startActivity(oIntent);
    }
    
    public void statsClicked(View view)
    {
      Intent oIntent = new Intent(view.getContext(), Statistics.class);
      startActivity(oIntent);
    }

  public void aboutClicked(View view)
  {
    Intent oIntent = new Intent(view.getContext(), About.class);
    startActivity(oIntent);
  }
    
    public void onClick(DialogInterface dialog, int which)
  {
    if (which==-1)
    {
      soundOn = true;
      this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
    }
    else
    {
      soundOn = false;
    }
    int sound = 0;
    if (soundOn)
      sound = 1;
    Editor editor = this.getSharedPreferences("TriangleOfCircles", Context.MODE_PRIVATE).edit();
    editor.putInt("diff", AI.currentDifficulty);
    editor.putInt("sound", sound);
    editor.commit();
  }
    
    public void onResume()
    {
      super.onResume();
      if (soundOn)
        this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
      else
        this.setVolumeControlStream(AudioManager.STREAM_RING);
    }
}




Java Source Code List

com.crossoutxtrem.AI.java
com.crossoutxtrem.About.java
com.crossoutxtrem.BoardMove.java
com.crossoutxtrem.BoardView.java
com.crossoutxtrem.Board.java
com.crossoutxtrem.Circle.java
com.crossoutxtrem.ColorPicker.java
com.crossoutxtrem.Combination.java
com.crossoutxtrem.EasyAI.java
com.crossoutxtrem.HardAI.java
com.crossoutxtrem.HowToPlay.java
com.crossoutxtrem.Move.java
com.crossoutxtrem.MyAdViewListener.java
com.crossoutxtrem.Options.java
com.crossoutxtrem.PreviousBoardMove.java
com.crossoutxtrem.SPOptions.java
com.crossoutxtrem.SinglePlayerGame.java
com.crossoutxtrem.Statistics.java
com.crossoutxtrem.SuperAI.java
com.crossoutxtrem.TPOptions.java
com.crossoutxtrem.TriangleOfCircles.java
com.crossoutxtrem.TwoPlayerGame.java