Android Open Source - BounceMe Menu Activity






From Project

Back to project page BounceMe.

License

The source code is released under:

MIT License

If you think the Android project BounceMe 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.cse3345.f13.martin;
//from www . j  a  va 2s . c  o  m
import android.app.Activity;
import android.content.Intent;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

public class MenuActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    /*
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        */
        
    setContentView(R.layout.activity_menu);
    
    //get the systemwide typeFace and applies it
    Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/shades.ttf");
    ViewGroup parent = ((ViewGroup)getWindow().getDecorView());
    setTypeFace(tf, parent);

    
    
    //play button pulled and when click goes to the a grid adapter
    Button play = (Button) findViewById(R.id.playButton);
    
    play.setOnClickListener(new OnClickListener() {
      
      @Override
      public void onClick(View v) {
        Intent i = new Intent(MenuActivity.this, LevelPicker.class);
         startActivity(i);        
      }
    });
    
    
    //credit button pulled and goes to the creditsACtivity
    Button credit = (Button) findViewById(R.id.creditsButton);
    
    credit.setOnClickListener(new View.OnClickListener() {
      
      @Override
      public void onClick(View v) {
        Intent i = new Intent(MenuActivity.this, CreditActivity.class);
         startActivity(i);
      }
    });
    
    
    //settings button pulled and goes to the setActivity
    Button settings = (Button) findViewById(R.id.settingsButton);
    
    settings.setOnClickListener(new View.OnClickListener() {
      
      @Override
      public void onClick(View v) {
        Intent i = new Intent(MenuActivity.this, SetActivity.class);
         startActivity(i);
      }
    });
    
    //tutorial button pulled and goes to the tutActivity
    Button tut = (Button) findViewById(R.id.tutButton);
    
    tut.setOnClickListener(new View.OnClickListener() {
      
      @Override
      public void onClick(View v) {
        Intent i = new Intent(MenuActivity.this, TutActivity.class);
         startActivity(i);
      }
    });
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu, menu);
    return true;
  }
  
  //function to set the typeFcae for all text in this View
  public static void setTypeFace(Typeface custom, ViewGroup parent){
    for(int i = 0; i < parent.getChildCount(); i++){
      View v = parent.getChildAt(i);
      if(v instanceof ViewGroup){
        setTypeFace(custom, (ViewGroup) v);
      }else if(v instanceof TextView){
        TextView tv = (TextView) v;
        tv.setTypeface(custom);
        tv.setPaintFlags(tv.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
      }else if(v instanceof Button){
        Button b = (Button) v;
        b.setTypeface(custom);
        b.setPaintFlags(b.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);        
      }
    }
  }

}




Java Source Code List

com.cse3345.f13.martin.Ball.java
com.cse3345.f13.martin.CreditActivity.java
com.cse3345.f13.martin.Goal.java
com.cse3345.f13.martin.LevelGen.java
com.cse3345.f13.martin.LevelPicker.java
com.cse3345.f13.martin.Level.java
com.cse3345.f13.martin.MenuActivity.java
com.cse3345.f13.martin.PlaySurfaceView.java
com.cse3345.f13.martin.SetActivity.java
com.cse3345.f13.martin.Sling.java
com.cse3345.f13.martin.TutActivity.java
com.cse3345.f13.martin.Wall.java
com.cse3345.f13.martin.WinActivity.java
com.example.bounceme.Ball.java
com.example.bounceme.CreditActivity.java
com.example.bounceme.Goal.java
com.example.bounceme.GridAdapter.java
com.example.bounceme.Level.java
com.example.bounceme.MenuActivity.java
com.example.bounceme.PlaySurfaceView.java
com.example.bounceme.SetActivity.java
com.example.bounceme.Sling.java
com.example.bounceme.WinActivity.java
com.example.bounceme.levelGen.java
com.example.bounceme.levelPicker.java