Android Open Source - TuxPuz Special Tux Level






From Project

Back to project page TuxPuz.

License

The source code is released under:

GNU General Public License

If you think the Android project TuxPuz 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.pkh.tuxpuz;
/*from   www .  j av  a  2  s.co  m*/
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.ImageButton;

import com.Database.pkh.PuzzleDatabase;

public class SpecialTuxLevel extends Activity implements OnClickListener{

  Intent normalIntent;
  /** Called when the activity is first created. */
  ImageButton marioTux_btn,roboTux_btn,ninjaTux_btn,cowboyTux_btn;
  PuzzleDatabase mdb=new PuzzleDatabase(this);
  Cursor c;
  int level13,level14,level15,level16;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      setContentView(R.layout.special_tux_level );
      mdb.openDB();
      
      marioTux_btn=(ImageButton) findViewById(R.id.marioTux);
      roboTux_btn=(ImageButton) findViewById(R.id.roboTux);
      ninjaTux_btn=(ImageButton) findViewById(R.id.ninjaTux);
      cowboyTux_btn=(ImageButton) findViewById(R.id.cowboyTux);
      
      marioTux_btn.setOnClickListener(this);
      roboTux_btn.setOnClickListener(this);
      ninjaTux_btn.setOnClickListener(this);
      cowboyTux_btn.setOnClickListener(this);
      // TODO Auto-generated method stub
      c=mdb.getStatusdata();
      
      if(c.moveToFirst()){
        level13=c.getInt(13);
        level14=c.getInt(14);
        level15=c.getInt(15);
        level16=c.getInt(16);
        
      }
  }

  @Override
  public void onClick(View v) {
    // TODO Auto-generated method stub
    int id=v.getId();
    switch(id){
      
      //Intent for 4x4 medi puzzle
      case R.id.marioTux:
        if(level13==1){
        normalIntent=new Intent(getApplicationContext(), Puzzle_4x4.class);
        normalIntent.putExtra("ImageID", R.id.marioTux);
        marioTux_btn.setImageResource(R.drawable.trans);
        startActivity(normalIntent);
        }
        break;
      case R.id.roboTux:
        if(level14==1){
        normalIntent=new Intent(getApplicationContext(), Puzzle_3x3_medium.class);
        normalIntent.putExtra("ImageID", R.id.roboTux);
        roboTux_btn.setImageResource(R.drawable.trans);
        startActivity(normalIntent);
        }
        break;
      case R.id.ninjaTux:
        if(level15==1){
        normalIntent=new Intent(getApplicationContext(), Puzzle_4x4_medium.class);
        normalIntent.putExtra("ImageID", R.id.ninjaTux);
        ninjaTux_btn.setImageResource(R.drawable.trans);
        startActivity(normalIntent);
        }
        break;
      case R.id.cowboyTux:
        if(level16==1){
        normalIntent=new Intent(getApplicationContext(), Puzzle_4x4_medium.class);
        normalIntent.putExtra("ImageID", R.id.cowboyTux);
        cowboyTux_btn.setImageResource(R.drawable.trans);
        startActivity(normalIntent);
        }
        break;
      }
    
  }
  private void database_check() {
    // TODO Auto-generated method stub
     c=mdb.getStatusdata();
        
        if(c.moveToFirst()){
          level13=c.getInt(13);
          level14=c.getInt(14);
          level15=c.getInt(15);
          level16=c.getInt(16);
          
        }
        if(level13==1)
          marioTux_btn.setImageResource(R.drawable.trans);
        if(level14==1)
          roboTux_btn.setImageResource(R.drawable.trans);
        if(level15==1)
          ninjaTux_btn.setImageResource(R.drawable.trans);
        if(level16==1)
          cowboyTux_btn.setImageResource(R.drawable.trans);
  }
  @Override
  protected void onResume() {
    // TODO Auto-generated method stub
    
    super.onResume();
    database_check();
  }
  @Override
  public void onBackPressed() {
    // TODO Auto-generated method stub
    super.onBackPressed();
    mdb.closeDB();
    
    
    finish();
  }

}




Java Source Code List

com.CustomizedClasses.pkh.CustomDialogSucces.java
com.CustomizedClasses.pkh.CustomizeArrayList.java
com.CustomizedClasses.pkh.ShuffleClass.java
com.Database.pkh.PuzzleDatabase.java
com.fragment.pkh.Frag_example.java
com.fragment.pkh.MenuFragment.java
com.helperclass_medium.pkh.GestureSwipe_medium.java
com.helperclass_medium.pkh.SpriteSheet.java
com.helperclasses.pkh.GestureSwipe_easy.java
com.helperclasses.pkh.SpriteSheet.java
com.pkh.tuxpuz.AnimProjt.java
com.pkh.tuxpuz.FacebookPage.java
com.pkh.tuxpuz.FragmentActivity.java
com.pkh.tuxpuz.GeekSelector.java
com.pkh.tuxpuz.HelpView.java
com.pkh.tuxpuz.ImagePuzzle.java
com.pkh.tuxpuz.MenuScreen.java
com.pkh.tuxpuz.Puzzle_3X3.java
com.pkh.tuxpuz.Puzzle_3x3_medium.java
com.pkh.tuxpuz.Puzzle_4x4.java
com.pkh.tuxpuz.Puzzle_4x4_medium.java
com.pkh.tuxpuz.SelectionClass.java
com.pkh.tuxpuz.SpecialTuxLevel.java
com.pkh.tuxpuz.SplashScreen.java