Init.java :  » App » androidjustice » banzhuan » listen » Android Open Source

Android Open Source » App » androidjustice 
androidjustice » banzhuan » listen » Init.java
package banzhuan.listen;

//**CLASS **

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.view.WindowManager;

public class Init extends Activity implements OnClickListener {

  public boolean reg = false; // 
  public String username = null; // ;
  public String useratri = null; //  int[];
  // TXT 

  public ImageButton imnewgame = null;
  public ImageButton implay = null;
  ImageView initanim = null;
  AnimationDrawable animintro = null;
  public static boolean click = false;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
    // 

    setContentView(R.layout.init);

    Animation buttonalpha = AnimationUtils.loadAnimation(this,
        R.anim.ani_buttonalpha);
    Animation buttonclick = AnimationUtils.loadAnimation(this,
        R.anim.ani_buttonclick);

    imnewgame = (ImageButton) findViewById(R.id.imnewgame);
    imnewgame.setOnClickListener(new ButtonListener());
    findViewById(R.id.imnewgame).startAnimation(buttonalpha);

    implay = (ImageButton) findViewById(R.id.implayed);
    implay.setOnClickListener(new Played());
    findViewById(R.id.implayed).startAnimation(buttonalpha);

    initanim = (ImageView) findViewById(R.id.ImageViewinit);
    initanim.setOnClickListener(this);
    animintro = (AnimationDrawable) initanim.getBackground();

  }

  @Override
  public void onClick(View v) {
    // TODO Auto-generated method stub
    if (!click) {

      animintro.start();
      click = true;
    } else {
      animintro.stop();
      click = false;
    }
  }

  @Override
  public void onDestroy() {
    super.onDestroy();
  }

  class ButtonListener implements OnClickListener {
    @Override
    public void onClick(View v) {

      Intent serviceIntent;

      serviceIntent = new Intent(Init.this, newgame.class);

      startService(serviceIntent);
      stopService(serviceIntent);

      Intent intent = new Intent();
      intent.setClass(Init.this, LvSelet.class);
      startActivity(intent);

      Init.this.onDestroy();
    }

  }

  class Played implements OnClickListener {
    @Override
    public void onClick(View v) {
      Intent intent = new Intent();
      intent.setClass(Init.this, LvSelet.class);
      startActivity(intent);

      Init.this.finish();
    }
    // 
  }
  // @Override
  /*
   * public boolean onKeyDown(int keyCode, KeyEvent event) {
   * 
   * if (keyCode == KeyEvent.KEYCODE_BACK) { int i=1;
   * 
   * 
   * } return false; }
   */
}
// 
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.