| | |
| | | import com.hdl.photovoltaic.widget.ConfirmationCancelDialog; |
| | | import com.hdl.photovoltaic.widget.ConfirmationExceptionDialog; |
| | | import com.hdl.photovoltaic.widget.FlashingBoxDialog; |
| | | import com.hdl.photovoltaic.widget.FlashingIconBoxDialog; |
| | | |
| | | /** |
| | | * 线程逻辑 |
| | |
| | | handler.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Toast.makeText(context, text, Toast.LENGTH_SHORT).show(); |
| | | FlashingBoxDialog flashingBoxDialog = new FlashingBoxDialog(context, 1500); |
| | | flashingBoxDialog.setContent(text); |
| | | flashingBoxDialog.show(); |
| | | // Toast.makeText(context, text, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | } |
| | |
| | | handler.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // FlashingBoxDialog flashingIconBoxDialog = new FlashingBoxDialog(context, 1500); |
| | | // flashingIconBoxDialog.setContent(hdlException.getMsg() + "(" + hdlException.getCode() + ")"); |
| | | // flashingIconBoxDialog.show(); |
| | | Toast.makeText(context, hdlException.getMsg() + "(" + hdlException.getCode() + ")", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | |
| | | handler.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | |
| | | Toast.makeText(context, resId, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | |
| | | |
| | | |
| | | /** |
| | | * 错误提示框(蓝湖上样式) |
| | | * 全局弹出框,错误提示框(蓝湖上样式) |
| | | * |
| | | * @param isBoolean 图标(true使用成功图标,false使用成功图标) |
| | | * @param isBoolean 图标(true使用成功图标,false使用失败图标) |
| | | * @param msg 信息 |
| | | * @param code 状态 |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 错误提示框(蓝湖上样式) |
| | | * 全局弹出框,错误提示框(蓝湖上样式) |
| | | * |
| | | * @param isBoolean 图标(true使用成功图标,false使用成功图标) |
| | | * @param isBoolean 图标(true使用成功图标,false使用失败图标) |
| | | * @param msg 信息 |
| | | * @param code 状态 |
| | | * @param millisecond 设置延时时间关闭弹窗(单位ms) |
| | | */ |
| | | public static void tipFlashingBox(Context context, boolean isBoolean, String msg, int code, int millisecond) { |
| | | if (context == null) { |
| | | return; |
| | | } |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | FlashingBoxDialog flashingBoxDialog = new FlashingBoxDialog(context, millisecond); |
| | | FlashingIconBoxDialog flashingIconBoxDialog = new FlashingIconBoxDialog(context, millisecond); |
| | | if (isBoolean) { |
| | | Drawable drawable = AppCompatResources.getDrawable(context, R.drawable.tip_succeed); |
| | | flashingBoxDialog.setImage(drawable); |
| | | flashingIconBoxDialog.setImage(drawable); |
| | | } else { |
| | | Drawable drawable = AppCompatResources.getDrawable(context, R.drawable.tip_fail); |
| | | flashingBoxDialog.setImage(drawable); |
| | | flashingIconBoxDialog.setImage(drawable); |
| | | } |
| | | flashingBoxDialog.setContent(msg + "\r\n(" + code + ")"); |
| | | flashingBoxDialog.show(); |
| | | if (code == 0) { |
| | | //成功不需要增加状态码 |
| | | flashingIconBoxDialog.setContent(msg); |
| | | } else { |
| | | flashingIconBoxDialog.setContent(msg + "(" + code + ")"); |
| | | } |
| | | flashingIconBoxDialog.show(); |
| | | } |
| | | }, null, null); |
| | | } |
| | |
| | | * @return 调用栈 |
| | | */ |
| | | private static String getStackTrace(Exception ex) { |
| | | StringBuilder sb = new StringBuilder(""); |
| | | StringBuilder sb = new StringBuilder(); |
| | | StackTraceElement[] trace = ex.getStackTrace(); |
| | | for (StackTraceElement stackTraceElement : trace) { |
| | | sb.append(stackTraceElement).append("\n"); |