package com.base.basepedo.ui;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import com.base.basepedo.R;
import com.base.basepedo.service.StepDcretor;
import com.base.basepedo.service.StepService;

public class MainActivity extends AppCompatActivity implements Handler.Callback{
	private TextView text_step;
	private final int STEPSHOW = 1;
	private Handler mHandler;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		mHandler = new Handler(this);
		text_step = (TextView) findViewById(R.id.text_step);

		Intent intent = new Intent(this, StepService.class);
		startService(intent);
	}

	@Override
	protected void onResume() {
		super.onResume();
		mHandler.sendEmptyMessage(STEPSHOW);
	}

	@Override
	public boolean handleMessage(Message msg) {
		switch (msg.what) {
			case STEPSHOW:
				mHandler.removeMessages(STEPSHOW);
				text_step.setText(StepDcretor.CURRENT_SETP + "");
				mHandler.sendEmptyMessageDelayed(STEPSHOW, 150);
				break;
		}
		return false;
	}
}

@@ -468,23 +468,24 @@
 al int S
-TEPSHOW
+HOW_STEP
  = 1;%0A%09p
@@ -509,16 +509,52 @@
 andler;%0A
+%09private long TIME_INTERVAL = 150;%0A%0A
 %0A%09@Overr
@@ -951,23 +951,24 @@
 essage(S
-TEPSHOW
+HOW_STEP
 );%0A%09%7D%0A%0A%09
@@ -1053,23 +1053,24 @@
 %09%09case S
-TEPSHOW
+HOW_STEP
 :%0A%09%09%09%09mH
@@ -1092,23 +1092,24 @@
 ssages(S
-TEPSHOW
+HOW_STEP
 );%0A%09%09%09%09t
@@ -1125,16 +1125,33 @@
 setText(
+Integer.toString(
 StepDcre
@@ -1170,13 +1170,9 @@
 SETP
- + %22%22
+)
 );%0A%09
@@ -1212,20 +1212,31 @@
 ed(S
-TEPSHOW, 150
+HOW_STEP, TIME_INTERVAL
 );%0A%09

修整一些参数的说明，优化代码结构