Skip to content

Commit

Permalink
Merge pull request #925 from OldFatPHP/master
Browse files Browse the repository at this point in the history
#95 #97 Lab9 已完成全部
  • Loading branch information
zengsn authored Jun 14, 2016
2 parents fc60bb3 + 05a0e10 commit 63bd1bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package edu.hzuapps.androidworks.homeworks.net1314080903121;
package com.xiaoyuantong.activity;

import android.content.Context;
import android.hardware.SensorManager;
Expand All @@ -13,6 +13,8 @@
import android.widget.ImageView;
import android.widget.TextView;

import com.xiaoyuantong.R;

public class Net1314080903121Activity extends Activity {
private ImageView iv;
private TextView mint;
Expand All @@ -35,7 +37,7 @@ public void handleMessage(Message msg) {
// 添加更新ui的代码
if (!isstop) {
updateView();
mHandler.sendEmptyMessageDelayed(1, 1000);
mHandler.sendEmptyMessageDelayed(1, 1000);//一秒重新运行一次
}
break;
case 0:
Expand All @@ -57,29 +59,31 @@ private void initViews() {
sec = (TextView) findViewById(R.id.sec);
reset = (Button) findViewById(R.id.reset);
start = (Button) findViewById(R.id.start);
//reset点击事件
reset.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub

//把时间设为0
mint.setText("00");
sec.setText("00");
start.setText("start");
timeusedinsec=0;
isstop=true;
timeusedinsec=0;//计时置0
isstop=true;//停止
}
});
//start点击事件
start.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
mHandler.removeMessages(1);
String aaa=start.getText().toString();
if(aaa.equals("start")){
if(aaa.equals("start")){//如果是"start"开始计时
mHandler.sendEmptyMessage(1);
isstop = false;
start.setText("pause");
}else {
}else {//如果是"pause"
mHandler.sendEmptyMessage(0);
isstop = true;
start.setText("start");
Expand All @@ -88,6 +92,7 @@ public void onClick(View arg0) {
}
});
}
//更新时间的显示
private void updateView() {
timeusedinsec += 1;
int minute = (int) (timeusedinsec / 60)%60;
Expand Down
Binary file added app/src/main/res/drawable/linjunfeng.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 63bd1bd

Please sign in to comment.