package agile.hustler.activities;
import java.util.Scanner;
import agile.hustler.Battle.Battle;
import agile.hustler.Characters.Tank;
import agile.hustler.activities.R;
import agile.hustler.activities.R.layout;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
public class FightSplashClient extends Activity {
/** Called when the activity is first created. */
private final int SPLASH_DISPLAY_LENGHT = 3000;
TextView txtName01, txtName02;
Drawable charIcon1, charIcon2;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.fightsplash);
Bundle b = getIntent().getExtras();
final String data = b.getString("key");
final String data2 = b.getString("key2");
Log.d("", data);
Log.d("", data2);
Typeface face = Typeface.createFromAsset(getAssets(),
"fonts/SEVERINA.ttf");
txtName01 = (TextView) findViewById(R.id.PlayerName01);
txtName02 = (TextView) findViewById(R.id.PlayerName02);
txtName01.setTypeface(face);
txtName02.setTypeface(face);
Scanner scanner = new Scanner(data);
scanner.useDelimiter(" ");
String type = scanner.next();
String name = scanner.next();
txtName01.setText(name);
charIcon1 = getResources().getDrawable(R.drawable.dpssmallr);
if (type.toUpperCase().equals("TANK")) {
charIcon1 = getResources().getDrawable(R.drawable.tanksmallr);
} else if (type.toUpperCase().equals("CASTER")) {
charIcon1 = getResources().getDrawable(R.drawable.castersmallr);
}
ImageView imView1 = (ImageView) findViewById(R.id.PlayerFace01);
imView1.setBackgroundDrawable(charIcon1);
Scanner scanner2 = new Scanner(data2);
scanner2.useDelimiter(" ");
String type2 = scanner2.next();
String name2 = scanner2.next();
txtName02.setText(name2);
charIcon2 = getResources().getDrawable(R.drawable.dpssmalll);
if (type2.toUpperCase().equals("TANK")) {
charIcon2 = getResources().getDrawable(R.drawable.tanksmalll);
} else if (type2.toUpperCase().equals("CASTER")) {
charIcon2 = getResources().getDrawable(R.drawable.castersmalll);
}
ImageView imView2 = (ImageView) findViewById(R.id.PlayerFace02);
imView2.setBackgroundDrawable(charIcon2);
/*
* New Handler to start the Menu-Activity and close this Splash-Screen
* after some seconds.
*/
new Handler().postDelayed(new Runnable() {
public void run() {
/* Create an Intent that will start the Menu-Activity. */
Bundle B = new Bundle();
B.putString("key", data);
B.putString("key2", data2);
//B.putString("log", data);
Intent intent = new Intent(FightSplashClient.this,
FightSetupClient.class);
intent.putExtras(B);
startActivity(intent);
finish();
System.gc();
}
}, SPLASH_DISPLAY_LENGHT);
}
}
|