提交 95aa373d 编写于 作者: A andrewleo2013

refine code

上级 f79e5d23
...@@ -164,7 +164,7 @@ public class MainPageActivity extends Activity { ...@@ -164,7 +164,7 @@ public class MainPageActivity extends Activity {
} }
/** /**
* set menu options 设置菜单,初始化程序中的menu选项,可以进行设置,使程序退出 * set menu options
*/ */
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, Menu.FIRST, 0, "退出").setIcon( menu.add(0, Menu.FIRST, 0, "退出").setIcon(
...@@ -192,7 +192,7 @@ public class MainPageActivity extends Activity { ...@@ -192,7 +192,7 @@ public class MainPageActivity extends Activity {
} }
/** /**
* create a dialog 创建对话框 * create a dialog
*/ */
protected Dialog onCreateDialog(int id) { protected Dialog onCreateDialog(int id) {
switch (id) { switch (id) {
......
...@@ -65,7 +65,7 @@ public class SettingsActivity extends Activity { ...@@ -65,7 +65,7 @@ public class SettingsActivity extends Activity {
edtTime.setText(time); edtTime.setText(time);
chkFloat.setChecked(floatingTag); chkFloat.setChecked(floatingTag);
// edtTime.setInputType(InputType.TYPE_CLASS_NUMBER); //设置只能输入数字其他不能输入 // edtTime.setInputType(InputType.TYPE_CLASS_NUMBER);
btnSave.setOnClickListener(new OnClickListener() { btnSave.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
......
...@@ -144,7 +144,7 @@ public class EmmageeService extends Service { ...@@ -144,7 +144,7 @@ public class EmmageeService extends Service {
} }
/** /**
* write the test result to csv service第一次执行的时候需要创建一个csv文件,同时写入一些数据 * write the test result to csv format report
*/ */
private void createResultCsv() { private void createResultCsv() {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
...@@ -202,16 +202,13 @@ public class EmmageeService extends Service { ...@@ -202,16 +202,13 @@ public class EmmageeService extends Service {
wmParams.gravity = Gravity.LEFT | Gravity.TOP; wmParams.gravity = Gravity.LEFT | Gravity.TOP;
wmParams.x = 0; wmParams.x = 0;
wmParams.y = 0; wmParams.y = 0;
// 设置悬浮窗口长宽数据
wmParams.width = WindowManager.LayoutParams.WRAP_CONTENT; wmParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
wmParams.height = WindowManager.LayoutParams.WRAP_CONTENT; wmParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
wmParams.format = 1; wmParams.format = 1;
windowManager.addView(viFloatingWindow, wmParams); windowManager.addView(viFloatingWindow, wmParams);
viFloatingWindow.setOnTouchListener(new OnTouchListener() { viFloatingWindow.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
// 获取相对屏幕的坐标,即以屏幕左上角为原点
x = event.getRawX(); x = event.getRawX();
// 25是系统状态栏的高度
y = event.getRawY() - 25; y = event.getRawY() - 25;
switch (event.getAction()) { switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
......
...@@ -122,7 +122,6 @@ public class CpuInfo { ...@@ -122,7 +122,6 @@ public class CpuInfo {
fomart.setMinimumFractionDigits(2); fomart.setMinimumFractionDigits(2);
readCpuStat(); readCpuStat();
// 清除arraylist中的值
CpuUsedRatio.clear(); CpuUsedRatio.clear();
try { try {
...@@ -179,6 +178,7 @@ public class CpuInfo { ...@@ -179,6 +178,7 @@ public class CpuInfo {
} }
//TODO coming soon
// public String cpuinfo() { // public String cpuinfo() {
// String sys_info = ""; // String sys_info = "";
// String s; // String s;
...@@ -293,5 +293,4 @@ public class CpuInfo { ...@@ -293,5 +293,4 @@ public class CpuInfo {
// } // }
// return "0"; // return "0";
// } // }
} }
...@@ -75,7 +75,7 @@ public class MemoryInfo { ...@@ -75,7 +75,7 @@ public class MemoryInfo {
memoryInfo[0].getTotalSharedDirty(); memoryInfo[0].getTotalSharedDirty();
// int memSize = memoryInfo[0].dalvikPrivateDirty; // int memSize = memoryInfo[0].dalvikPrivateDirty;
// TODO 不一定是PSS,可能是其他的 // TODO PSS
int memSize = memoryInfo[0].getTotalPss(); int memSize = memoryInfo[0].getTotalPss();
// int memSize = memoryInfo[0].getTotalPrivateDirty(); // int memSize = memoryInfo[0].getTotalPrivateDirty();
return memSize; return memSize;
......
...@@ -4,9 +4,6 @@ import android.app.Application; ...@@ -4,9 +4,6 @@ import android.app.Application;
import android.view.WindowManager; import android.view.WindowManager;
public class MyApplication extends Application { public class MyApplication extends Application {
private static final String LOG_TAG = "Emmagee-"
+ MyApplication.class.getSimpleName();
private WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams(); private WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams();
......
...@@ -29,10 +29,10 @@ public class TrafficInfo { ...@@ -29,10 +29,10 @@ public class TrafficInfo {
long rcvTraffic = -1; long rcvTraffic = -1;
long sndTraffic = -1; long sndTraffic = -1;
try { try {
RandomAccessFile raf_r = new RandomAccessFile(rcvPath, "r"); RandomAccessFile rafRcv = new RandomAccessFile(rcvPath, "r");
RandomAccessFile raf_s = new RandomAccessFile(sndPath, "r"); RandomAccessFile rafSnd = new RandomAccessFile(sndPath, "r");
rcvTraffic = Long.parseLong(raf_r.readLine()); rcvTraffic = Long.parseLong(rafRcv.readLine());
sndTraffic = Long.parseLong(raf_s.readLine()); sndTraffic = Long.parseLong(rafSnd.readLine());
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
rcvTraffic = -1; rcvTraffic = -1;
sndTraffic = -1; sndTraffic = -1;
...@@ -47,9 +47,5 @@ public class TrafficInfo { ...@@ -47,9 +47,5 @@ public class TrafficInfo {
return -1; return -1;
} else } else
return (rcvTraffic + sndTraffic); return (rcvTraffic + sndTraffic);
/*
* traf_r = TrafficStats.getUidRxBytes(ActivityMain.uid); traf_s =
* TrafficStats.getUidTxBytes(ActivityMain.uid);
*/
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册