Browse Source

修正部分sonar严重

wuyong3 6 years ago
parent
commit
9287e751ca

+ 1 - 1
ipu-mobile-ui/src/main/java/com/ai/ipu/mobile/ui/chart/util/ColorCategory.java

152
		return color;
152
		return color;
153
	}
153
	}
154
	
154
	
155
	public static int[] DEFAULT_COLORS;
155
	public static final int[] DEFAULT_COLORS;
156
	static {
156
	static {
157
		DEFAULT_COLORS = new int[] { Red.getColor(), Orange.getColor(),
157
		DEFAULT_COLORS = new int[] { Red.getColor(), Orange.getColor(),
158
				Yellow.getColor(), Green.getColor(), Blue.getColor(),
158
				Yellow.getColor(), Green.getColor(), Blue.getColor(),

+ 6 - 4
ipu-mobile-ui/src/main/java/com/ai/ipu/mobile/ui/comp/dialog/YMPickerDialog.java

4
import java.text.SimpleDateFormat;
4
import java.text.SimpleDateFormat;
5
import java.util.Calendar;
5
import java.util.Calendar;
6

6

7
import com.ai.ipu.mobile.util.IpuMobileLog;
8

7
import android.app.DatePickerDialog;
9
import android.app.DatePickerDialog;
8
import android.content.Context;
10
import android.content.Context;
9
import android.view.View;
11
import android.view.View;
47
				l.setVisibility(View.GONE);
49
				l.setVisibility(View.GONE);
48
			} catch (SecurityException e) {
50
			} catch (SecurityException e) {
49
				// TODO Auto-generated catch block
51
				// TODO Auto-generated catch block
50
				e.printStackTrace();
52
				IpuMobileLog.e(getClass().getSimpleName(), e.getMessage(), e);
51
			} catch (NoSuchFieldException e) {
53
			} catch (NoSuchFieldException e) {
52
				// TODO Auto-generated catch block
54
				// TODO Auto-generated catch block
53
				e.printStackTrace();
55
				IpuMobileLog.e(getClass().getSimpleName(), e.getMessage(), e);
54
			} catch (IllegalArgumentException e) {
56
			} catch (IllegalArgumentException e) {
55
				// TODO Auto-generated catch block
57
				// TODO Auto-generated catch block
56
				e.printStackTrace();
58
				IpuMobileLog.e(getClass().getSimpleName(), e.getMessage(), e);
57
			} catch (IllegalAccessException e) {
59
			} catch (IllegalAccessException e) {
58
				// TODO Auto-generated catch block
60
				// TODO Auto-generated catch block
59
				e.printStackTrace();
61
				IpuMobileLog.e(getClass().getSimpleName(), e.getMessage(), e);
60
			}
62
			}
61

63

62
		}
64
		}

+ 4 - 0
ipu-plugin-basic/src/main/java/com/ai/ipu/mobile/activity/DownloadFileActivity.java

34
				switch (msg.what) {
34
				switch (msg.what) {
35
				case 0:
35
				case 0:
36
					pBar.setMax(fileSize);
36
					pBar.setMax(fileSize);
37
					pBar.setProgress(uploadFileSize);
38
					int result0 = uploadFileSize * 100 / fileSize;
39
					tView.setText(uploadFileSize+"/"+fileSize+"("+result0 + "%)");
40
					break;
37
				case 1:
41
				case 1:
38
					pBar.setProgress(uploadFileSize);
42
					pBar.setProgress(uploadFileSize);
39
					int result = uploadFileSize * 100 / fileSize;
43
					int result = uploadFileSize * 100 / fileSize;

+ 2 - 1
ipu-plugin-basic/src/main/java/com/ai/ipu/mobile/plugin/MobileAudio.java

11
import com.ai.ipu.mobile.common.simplemedia.activity.SARecorder;
11
import com.ai.ipu.mobile.common.simplemedia.activity.SARecorder;
12
import com.ai.ipu.mobile.frame.IIpuMobile;
12
import com.ai.ipu.mobile.frame.IIpuMobile;
13
import com.ai.ipu.mobile.frame.plugin.Plugin;
13
import com.ai.ipu.mobile.frame.plugin.Plugin;
14
import com.ai.ipu.mobile.util.IpuMobileLog;
14

15

15
/**
16
/**
16
 * 录音
17
 * 录音
61
				mp.prepare();
62
				mp.prepare();
62
				mp.start();
63
				mp.start();
63
			} catch (Exception e) {
64
			} catch (Exception e) {
64
				e.printStackTrace();
65
				IpuMobileLog.e(TAG, e.getMessage(), e);
65
			}
66
			}
66
		}
67
		}
67
	}
68
	}

+ 6 - 5
ipu-plugin-basic/src/main/java/com/ai/ipu/mobile/plugin/MobileDB.java

6
import com.ai.ipu.mobile.common.db.DBHelper;
6
import com.ai.ipu.mobile.common.db.DBHelper;
7
import com.ai.ipu.mobile.frame.IIpuMobile;
7
import com.ai.ipu.mobile.frame.IIpuMobile;
8
import com.ai.ipu.mobile.frame.plugin.Plugin;
8
import com.ai.ipu.mobile.frame.plugin.Plugin;
9
import com.ai.ipu.mobile.util.IpuMobileLog;
9
import com.ai.ipu.mobile.util.IpuMobileUtility;
10
import com.ai.ipu.mobile.util.IpuMobileUtility;
10
import com.ailk.common.data.IData;
11
import com.ailk.common.data.IData;
11
import com.ailk.common.data.IDataset;
12
import com.ailk.common.data.IDataset;
85
			}
86
			}
86

87

87
		} catch (Exception e) {
88
		} catch (Exception e) {
88
			e.printStackTrace();
89
			IpuMobileLog.e(TAG, e.getMessage(), e);
89
			return ERROR;
90
			return ERROR;
90
		} finally {
91
		} finally {
91
			DBHelper.close(dbName);
92
			DBHelper.close(dbName);
114
			dao.insert(table, new DataMap(insertData));
115
			dao.insert(table, new DataMap(insertData));
115
			return SUCCESS;
116
			return SUCCESS;
116
		} catch (Exception e) {
117
		} catch (Exception e) {
117
			e.printStackTrace();
118
			IpuMobileLog.e(TAG, e.getMessage(), e);
118
			return ERROR;
119
			return ERROR;
119
		} finally {
120
		} finally {
120
			DBHelper.close(dbName);
121
			DBHelper.close(dbName);
162
			}
163
			}
163
			return SUCCESS;
164
			return SUCCESS;
164
		} catch (Exception e) {
165
		} catch (Exception e) {
165
			e.printStackTrace();
166
			IpuMobileLog.e(TAG, e.getMessage(), e);
166
			return ERROR;
167
			return ERROR;
167
		} finally {
168
		} finally {
168
			DBHelper.close(dbName);
169
			DBHelper.close(dbName);
211
			}
212
			}
212
			return SUCCESS;
213
			return SUCCESS;
213
		} catch (Exception e) {
214
		} catch (Exception e) {
214
			e.printStackTrace();
215
			IpuMobileLog.e(TAG, e.getMessage(), e);
215
			return ERROR;
216
			return ERROR;
216
		} finally {
217
		} finally {
217
			DBHelper.close(dbName);
218
			DBHelper.close(dbName);
286
			}
287
			}
287
			return resultDatas.toString();
288
			return resultDatas.toString();
288
		} catch (Exception e) {
289
		} catch (Exception e) {
289
			e.printStackTrace();
290
			IpuMobileLog.e(TAG, e.getMessage(), e);
290
			return ERROR;
291
			return ERROR;
291
		} finally {
292
		} finally {
292
			DBHelper.close(dbName);
293
			DBHelper.close(dbName);

+ 1 - 1
ipu-plugin-basic/src/main/java/com/ai/ipu/mobile/plugin/MobileDevice.java

16

16

17
public class MobileDevice extends Plugin {
17
public class MobileDevice extends Plugin {
18
	private static final int INIT_NFC = 1;
18
	private static final int INIT_NFC = 1;
19
	private static String nfcCallback;
19
	private String nfcCallback;
20

20

21
	public MobileDevice(IIpuMobile ipumobile) {
21
	public MobileDevice(IIpuMobile ipumobile) {
22
		super(ipumobile);
22
		super(ipumobile);

+ 2 - 2
ipu-plugin-basic/src/main/java/com/ai/ipu/mobile/plugin/MobileNetWork.java

356
				Intent intent = new Intent(context, ShareByBluetoothActivity.class);
356
				Intent intent = new Intent(context, ShareByBluetoothActivity.class);
357
				context.startActivity(intent);
357
				context.startActivity(intent);
358
			} catch (Exception e) {
358
			} catch (Exception e) {
359
				e.printStackTrace();
359
				IpuMobileLog.e(TAG, e.getMessage(), e);
360
				Toast.makeText(context, "蓝牙初始化出错!", Toast.LENGTH_LONG);
360
				Toast.makeText(context, "蓝牙初始化出错!", Toast.LENGTH_LONG);
361
			}
361
			}
362
		} else {
362
		} else {
370
						try {
370
						try {
371
							bluetoothTools.sendFile(ApkUtil.getCurrApk());
371
							bluetoothTools.sendFile(ApkUtil.getCurrApk());
372
						} catch (Exception e) {
372
						} catch (Exception e) {
373
							e.printStackTrace();
373
							IpuMobileLog.e(TAG, e.getMessage(), e);
374
						}
374
						}
375
					}
375
					}
376
				});
376
				});

+ 3 - 2
ipu-plugin-basic/src/main/java/com/ai/ipu/mobile/plugin/MobileScreenLock.java

12
import com.ai.ipu.mobile.frame.IIpuMobile;
12
import com.ai.ipu.mobile.frame.IIpuMobile;
13
import com.ai.ipu.mobile.frame.config.ServerConfig;
13
import com.ai.ipu.mobile.frame.config.ServerConfig;
14
import com.ai.ipu.mobile.frame.plugin.Plugin;
14
import com.ai.ipu.mobile.frame.plugin.Plugin;
15
import com.ai.ipu.mobile.util.IpuMobileLog;
15
import com.ailk.common.data.IData;
16
import com.ailk.common.data.IData;
16
import com.ailk.common.data.impl.DataMap;
17
import com.ailk.common.data.impl.DataMap;
17

18

77
					callback(dataParam);
78
					callback(dataParam);
78

79

79
				} catch (Exception e) {
80
				} catch (Exception e) {
80
					e.printStackTrace();
81
					IpuMobileLog.e(TAG, e.getMessage(), e);
81
				}
82
				}
82
			} else if (resultCode == ScreenUnlockActivity.SCREEN_UNLOCK_FORGET) {
83
			} else if (resultCode == ScreenUnlockActivity.SCREEN_UNLOCK_FORGET) {
83
				try {
84
				try {
85
					MobileUI plugin = ipumobile.getPluginManager().getPlugin(MobileUI.class);
86
					MobileUI plugin = ipumobile.getPluginManager().getPlugin(MobileUI.class);
86
					plugin.openPage(forgetPageAction, null);
87
					plugin.openPage(forgetPageAction, null);
87
				} catch (Exception e) {
88
				} catch (Exception e) {
88
					e.printStackTrace();
89
					IpuMobileLog.e(TAG, e.getMessage(), e);
89
				}
90
				}
90
			}
91
			}
91
		}
92
		}

+ 10 - 10
ipu-plugin-basic/src/main/java/com/ai/ipu/mobile/plugin/MobileUI.java

64
import com.ailk.common.data.impl.DataMap;
64
import com.ailk.common.data.impl.DataMap;
65

65

66
public class MobileUI extends Plugin {
66
public class MobileUI extends Plugin {
67
	private static SimpleProgressDialog progressDialog = null;
67
	private SimpleProgressDialog progressDialog = null;
68
	private final int REQUEST_CODE_CUSTOM_DIALOG = 100;
68
	private final int REQUEST_CODE_CUSTOM_DIALOG = 100;
69
	private final int REQUEST_CODE_CUSTOM_WINDOW = 200;
69
	private final int REQUEST_CODE_CUSTOM_WINDOW = 200;
70
	private final int REQUEST_CODE_SLIDING_MENU = 300;
70
	private final int REQUEST_CODE_SLIDING_MENU = 300;
553

553

554
			public void run() {
554
			public void run() {
555
				clear();// 防止重复打开等待对话框
555
				clear();// 防止重复打开等待对话框
556
				MobileUI.progressDialog = new SimpleProgressDialog(
556
				progressDialog = new SimpleProgressDialog(
557
						MobileUI.this.context);
557
						MobileUI.this.context);
558
				MobileUI.progressDialog
558
				progressDialog
559
						.setProgressStyle(ProgressDialog.STYLE_SPINNER);// 圆形状以及STYLE_HORIZONTAL
559
						.setProgressStyle(ProgressDialog.STYLE_SPINNER);// 圆形状以及STYLE_HORIZONTAL
560
																		// 条状
560
																		// 条状
561
				if (title != null && !title.equals("") && !title.equals(NULL)) {
561
				if (title != null && !title.equals("") && !title.equals(NULL)) {
562
					MobileUI.progressDialog.setTitle(title);
562
					progressDialog.setTitle(title);
563
				}
563
				}
564
				MobileUI.progressDialog.setMessage(msg);
565
				MobileUI.progressDialog.setCancelable(cancelable);
566
				MobileUI.progressDialog.setCanceledOnTouchOutside(false);
564
				progressDialog.setMessage(msg);
565
				progressDialog.setCancelable(cancelable);
566
				progressDialog.setCanceledOnTouchOutside(false);
567
				/*
567
				/*
568
				 * Object obj = cache.get(MobileCache.LOADING_DIALOG_POSITION);
568
				 * Object obj = cache.get(MobileCache.LOADING_DIALOG_POSITION);
569
				 * obj = refleck.getStaticProperty("android.view.Gravity",
569
				 * obj = refleck.getStaticProperty("android.view.Gravity",
570
				 * obj.toString());
570
				 * obj.toString());
571
				 */
571
				 */
572
				MobileUI.progressDialog.getProgressDialog().getWindow()
572
				progressDialog.getProgressDialog().getWindow()
573
						.setGravity(Gravity.CENTER); // 居上
573
						.setGravity(Gravity.CENTER); // 居上
574
				MobileUI.progressDialog.getProgressDialog()
574
				progressDialog.getProgressDialog()
575
						.setOnCancelListener(
575
						.setOnCancelListener(
576
								new DialogInterface.OnCancelListener() {
576
								new DialogInterface.OnCancelListener() {
577
									public void onCancel(DialogInterface dialog) {
577
									public void onCancel(DialogInterface dialog) {
578
										clear();// 设置取消按钮的事件,可以让setCancelable(false)也失效
578
										clear();// 设置取消按钮的事件,可以让setCancelable(false)也失效
579
									}
579
									}
580
								});
580
								});
581
				MobileUI.progressDialog.build().show();
581
				progressDialog.build().show();
582
			}
582
			}
583
		};
583
		};
584
		this.context.runOnUiThread(runnable);
584
		this.context.runOnUiThread(runnable);