Permalink
Browse files

refine code

  • Loading branch information...
andrewleo committed Jan 31, 2013
1 parent f79e5d2 commit 95aa373de53e645b121253c71ad562d9e2aee63e
@@ -164,7 +164,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
}
/**
* set menu options 设置菜单,初始化程序中的menu选项,可以进行设置,使程序退出
* set menu options
*/
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, Menu.FIRST, 0, "退出").setIcon(
@@ -192,7 +192,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
/**
* create a dialog 创建对话框
* create a dialog
*/
protected Dialog onCreateDialog(int id) {
switch (id) {
@@ -65,7 +65,7 @@ public void onCreate(Bundle savedInstanceState) {
edtTime.setText(time);
chkFloat.setChecked(floatingTag);
// edtTime.setInputType(InputType.TYPE_CLASS_NUMBER); //设置只能输入数字其他不能输入
// edtTime.setInputType(InputType.TYPE_CLASS_NUMBER);
btnSave.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -144,7 +144,7 @@ private void readSettingInfo(Intent intent) {
}
/**
* write the test result to csv service第一次执行的时候需要创建一个csv文件,同时写入一些数据
* write the test result to csv format report
*/
private void createResultCsv() {
Calendar cal = Calendar.getInstance();
@@ -202,16 +202,13 @@ private void createFloatingWindow() {
wmParams.gravity = Gravity.LEFT | Gravity.TOP;
wmParams.x = 0;
wmParams.y = 0;
// 设置悬浮窗口长宽数据
wmParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
wmParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
wmParams.format = 1;
windowManager.addView(viFloatingWindow, wmParams);
viFloatingWindow.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
// 获取相对屏幕的坐标,即以屏幕左上角为原点
x = event.getRawX();
// 25是系统状态栏的高度
y = event.getRawY() - 25;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
@@ -122,7 +122,6 @@ public String getCpuName() {
fomart.setMinimumFractionDigits(2);
readCpuStat();
// 清除arraylist中的值
CpuUsedRatio.clear();
try {
@@ -179,6 +178,7 @@ public String getCpuName() {
}
//TODO coming soon
// public String cpuinfo() {
// String sys_info = "";
// String s;
@@ -293,5 +293,4 @@ public String getCpuName() {
// }
// return "0";
// }
}
@@ -75,7 +75,7 @@ public int getPidMemorySize(int pid, Context context) {
memoryInfo[0].getTotalSharedDirty();
// int memSize = memoryInfo[0].dalvikPrivateDirty;
// TODO 不一定是PSS,可能是其他的
// TODO PSS
int memSize = memoryInfo[0].getTotalPss();
// int memSize = memoryInfo[0].getTotalPrivateDirty();
return memSize;
@@ -4,9 +4,6 @@
import android.view.WindowManager;
public class MyApplication extends Application {
private static final String LOG_TAG = "Emmagee-"
+ MyApplication.class.getSimpleName();
private WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams();
@@ -29,10 +29,10 @@ public long getTrafficInfo() {
long rcvTraffic = -1;
long sndTraffic = -1;
try {
RandomAccessFile raf_r = new RandomAccessFile(rcvPath, "r");
RandomAccessFile raf_s = new RandomAccessFile(sndPath, "r");
rcvTraffic = Long.parseLong(raf_r.readLine());
sndTraffic = Long.parseLong(raf_s.readLine());
RandomAccessFile rafRcv = new RandomAccessFile(rcvPath, "r");
RandomAccessFile rafSnd = new RandomAccessFile(sndPath, "r");
rcvTraffic = Long.parseLong(rafRcv.readLine());
sndTraffic = Long.parseLong(rafSnd.readLine());
} catch (FileNotFoundException e) {
rcvTraffic = -1;
sndTraffic = -1;
@@ -47,9 +47,5 @@ public long getTrafficInfo() {
return -1;
} else
return (rcvTraffic + sndTraffic);
/*
* traf_r = TrafficStats.getUidRxBytes(ActivityMain.uid); traf_s =
* TrafficStats.getUidTxBytes(ActivityMain.uid);
*/
}
}

0 comments on commit 95aa373

Please sign in to comment.