-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathActivity1.java
More file actions
71 lines (53 loc) · 2.33 KB
/
Activity1.java
File metadata and controls
71 lines (53 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.example.mygame;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class Activity1 extends Activity implements View.OnClickListener {
public GameView gameView;
FrameLayout frame;
RelativeLayout relative;
Button b1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Long highscore = Long.valueOf(0);
getIntent().getLongExtra("Highscore", highscore);
Member m = new Member(getIntent().getStringExtra("Name"), getIntent().getStringExtra("Password"), highscore);
gameView = new GameView(this, m);
b1 = new Button(this);
b1.setText("QUIT GAME");
b1.setTextSize(20);
b1.setId(1000013);
frame = new FrameLayout(this);
relative = new RelativeLayout(this);
RelativeLayout.LayoutParams but1 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
RelativeLayout.LayoutParams but3 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
relative.setLayoutParams(but3);
but1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
but1.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
b1.setLayoutParams(but1);
b1.setOnClickListener(this);
relative.addView(b1);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
frame.addView(gameView);
frame.addView(relative);
setContentView(frame);
}
@Override
public void onClick(View v) {
this.finish();
}
}