Android Open Source - Phylane Main Menu






From Project

Back to project page Phylane.

License

The source code is released under:

COPYRIGHT 2014 TRISTON JONES

If you think the Android project Phylane 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.lvadt.phylane.activity;
/*from   w w  w. j  a  v  a 2 s .  c om*/
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.lvadt.phylane.R;
import com.lvadt.phylane.utils.Sound;

//May eventually change to a OnTouchListener depending on how the menu
//turns out
public class MainMenu extends Activity implements OnClickListener{

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mainmenu);
    ImageView s = (ImageView) findViewById(R.id.ivStart);
    ImageView o = (ImageView) findViewById(R.id.ivOption);
    ImageView q = (ImageView) findViewById(R.id.ivQuit);
    s.setOnClickListener(this);
    o.setOnClickListener(this);
    q.setOnClickListener(this);
        Sound sPlayer = new Sound();
        sPlayer.playMusic(MainMenu.this, R.raw.maintheme);
  }

  @Override
  public void onClick(View v) {
    switch(v.getId()){
    case R.id.ivStart:
      SharedPreferences getPrefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
      boolean tutorial = getPrefs.getBoolean("tut_enable", true);
      if(tutorial){
        //If the tutorial is enabled, start it, disable the preference
        getPrefs.edit().putBoolean("tut_enable", false);
        getPrefs.edit().apply();
                Intent i = new Intent(MainMenu.this, LoadScreen.class);
                i.putExtra("class", "com.lvadt.phylane.activity.Tutorial");
                startActivity(i);
                MainMenu.this.finish();
      }
      else{
        StartGame();
        MainMenu.this.finish();
      }
      break;
    case R.id.ivOption:
      Intent i = new Intent(MainMenu.this, Prefs.class);
      startActivity(i);
      break;
    case R.id.ivQuit:
      super.finish();
      break;
    }
  }

  public void StartGame(){
        Intent i = new Intent(MainMenu.this, LoadScreen.class);
        i.putExtra("class", "com.lvadt.phylane.activity.HomeScreen");
        startActivity(i);
  }
}




Java Source Code List

com.lvadt.phylane.BuildConfig.java
com.lvadt.phylane.activity.Fly.java
com.lvadt.phylane.activity.HomeScreen.java
com.lvadt.phylane.activity.LevelComplete.java
com.lvadt.phylane.activity.LoadScreen.java
com.lvadt.phylane.activity.MainMenu.java
com.lvadt.phylane.activity.MessagePopup.java
com.lvadt.phylane.activity.Prefs.java
com.lvadt.phylane.activity.Splash.java
com.lvadt.phylane.activity.Store.java
com.lvadt.phylane.activity.Tutorial.java
com.lvadt.phylane.graphics.GLRenderer.java
com.lvadt.phylane.graphics.Sprite.java
com.lvadt.phylane.model.GameObject.java
com.lvadt.phylane.model.Level.java
com.lvadt.phylane.model.LoadingScreens.java
com.lvadt.phylane.model.Objects.java
com.lvadt.phylane.model.Plane.java
com.lvadt.phylane.model.Player.java
com.lvadt.phylane.model.WorldObject.java
com.lvadt.phylane.physics.Physics.java
com.lvadt.phylane.utils.Data.java
com.lvadt.phylane.utils.OnSwipeTouchListener.java
com.lvadt.phylane.utils.Sound.java