AI 144568: am: CL 144567 am: CL 144565 Improve the JetBoy samples

- use theme instead of window feature to remove titlebar
  - remove useless Layouts
  - Make custom view works in layout editor.
  - remove some warnings
  Original author: xav
  Merged from: //branches/cupcake/...
  Original author: android-build

Automated import of CL 144568
This commit is contained in:
Xavier Ducrohet
2009-04-03 17:49:30 -07:00
committed by The Android Open Source Project
parent dfd26a838a
commit c775995df3
4 changed files with 94 additions and 161 deletions

View File

@@ -25,7 +25,6 @@ import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
@@ -55,12 +54,8 @@ public class JetBoy extends Activity implements View.OnClickListener {
* @param savedInstanceState - The previous instance of this app
*/
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// turn off the window's title bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
// get handles to the JetView from XML and the JET thread.
@@ -91,9 +86,8 @@ public class JetBoy extends Activity implements View.OnClickListener {
* @param v The object which has been clicked
*/
public void onClick(View v) {
// this is the first screen
if (mJetBoyThread.getGameState() == mJetBoyThread.STATE_START) {
if (mJetBoyThread.getGameState() == JetBoyThread.STATE_START) {
mButton.setText("PLAY!");
mTextView.setVisibility(View.VISIBLE);
@@ -102,7 +96,7 @@ public class JetBoy extends Activity implements View.OnClickListener {
}
// we have entered game play, now we about to start running
else if (mJetBoyThread.getGameState() == mJetBoyThread.STATE_PLAY) {
else if (mJetBoyThread.getGameState() == JetBoyThread.STATE_PLAY) {
mButton.setVisibility(View.INVISIBLE);
mTextView.setVisibility(View.INVISIBLE);
mTimerView.setVisibility(View.VISIBLE);