private Employee getTestEmployee() { if (employees == null) { toast("Employees have not been loaded."); return null; } for (Employee e : employees) { if (TEST_EMPLOYEE_NAME.equals(e.getName())) { return e; } } toast("Test employee has not been created."); return null; }
private void updateActiveEmployee(String status, ResultStatus resultStatus, Employee result) { statusActiveEmployeeText.setText( "<" + status + " " + (resultStatus != null ? resultStatus : "") + ": " + DateFormat.getDateTimeInstance().format(new Date()) + ">"); if (result == null) { resultActiveEmployeeText.setText("<no active employee>"); } else { resultActiveEmployeeText.setText(result.getName() + ", " + result.getEmail() + "\n"); } }
private void notifyActiveEmployeeChanged(Employee employee) { String msg; if (employee != null) { msg = String.format("Active employee changed: %s (%s)", employee.getName(), employee.getId()); } else { msg = "Employee logged out"; } Notification n = new Notification.Builder(this) .setContentTitle(msg) .setContentText(msg) .setSmallIcon(android.R.drawable.stat_sys_warning) .getNotification(); NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); n.flags |= Notification.FLAG_AUTO_CANCEL; notificationManager.notify(0, n); }
private void updateEmployees(String status, ResultStatus resultStatus, List<Employee> result) { statusEmployeesText.setText( "<" + status + " " + (resultStatus != null ? resultStatus : "") + ": " + DateFormat.getDateTimeInstance().format(new Date()) + ">"); if (result == null) { resultEmployeesText.setText(""); } else { String employees = ""; for (Employee employee : result) { employees += employee.getName() + ", " + employee.getEmail() + "\n"; } resultEmployeesText.setText(employees); } }