Skip to content

Commit

Permalink
Merge pull request #1013 from zhazhahui9527/master
Browse files Browse the repository at this point in the history
#4 #533 第四次实验
  • Loading branch information
zengsn authored Mar 28, 2019
2 parents 5bc553a + 88c2122 commit e1ab05c
Show file tree
Hide file tree
Showing 10 changed files with 504 additions and 30 deletions.
27 changes: 15 additions & 12 deletions students/soft1714080902232/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".Soft1714080902232Activity"
android:label="Mini Game"/>
<activity android:name=".Soft1714080902232Activity_Start">
android:configChanges="orientation|screenSize|KeyboardHidden"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<activity android:name=".Soft1714080902232Activity_Before"></activity>
<activity
android:name=".Soft1714080902232Activity"
android:label="Mini Game" />
<activity
android:name=".Soft1714080902232Activity_Start"
android:configChanges="orientation|screenSize"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
</manifest>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package edu.hzuapps.androidlabs.soft1714080902232;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import java.util.Timer;
import java.util.TimerTask;

public class Soft1714080902232Activity extends AppCompatActivity {
TextView score_show;
Soft1714080902232Activity_GameView gv;
TextView new_game;
Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
int num =msg.arg1;
score_show.setText(num+"");
}

};
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.soft_1714080902232_activity);
score_show = (TextView) findViewById(R.id.tv_score_show);
gv = (Soft1714080902232Activity_GameView) findViewById(R.id.gv_show);
new_game = (TextView) findViewById(R.id.tv_newgame);
new_game.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0){
gv.GameStart();
gv.score = 0;
}
});

Timer timer = new Timer();
timer.schedule(new TimerTask() {

@Override
public void run() {
Message msg = new Message();
msg.arg1 = gv.score;
handler.sendMessage(msg);
}
}, 80, 150);
score_show.setText(100 + "");

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package edu.hzuapps.androidlabs.soft1714080902232;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class Soft1714080902232Activity_Before extends AppCompatActivity {
Button b1,b2,b3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.soft_1714080902232_activity_before);
b1 =(Button)findViewById(R.id.button1);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v){
Intent intent = new Intent(Soft1714080902232Activity_Before.this, Soft1714080902232Activity.class);
startActivity(intent);
}
});
b2 =(Button)findViewById(R.id.button2);
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(Soft1714080902232Activity_Before.this,"Please look forward",Toast.LENGTH_LONG).show();
}
});
b3 =(Button)findViewById(R.id.button3);
b3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(Soft1714080902232Activity_Before.this,"Please look forward",Toast.LENGTH_LONG).show();
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package edu.hzuapps.androidlabs.soft1714080902232;

import android.content.Context;
import android.view.Gravity;
import android.widget.FrameLayout;
import android.widget.TextView;

public class Soft1714080902232Activity_Card extends FrameLayout {
private TextView text;
private int number=0;
public int getNumber() {
return number;
}

public void setNumber(int number) {
this.number = number;
if(number<2){
text.setText("");
}else{
if(number>=64){
text.setTextColor(0xffffff00);
}else{
text.setTextColor(0xff000000);
}
text.setText(number+"");
}
}

public Soft1714080902232Activity_Card(Context context) {
super(context);
text = new TextView(context);
text.setTextSize(28);
text.setBackgroundColor(0x9966cccc);
text.setGravity(Gravity.CENTER);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(-1,-1);
params.setMargins(10, 10, 0,0);
addView(text,params);
}
}
Loading

0 comments on commit e1ab05c

Please sign in to comment.