/** Updates Jitsi icon notification to reflect current global status. */ public void updateJitsiIconNotification() { String status; if (getGlobalStatus().isOnline()) { // At least one provider is online status = JitsiApplication.getResString(R.string.service_gui_ONLINE); } else { // There are no active providers so we consider to be in // the offline state status = JitsiApplication.getResString(R.string.service_gui_OFFLINE); } int notificationID = OSGiService.getGeneralNotificationId(); if (notificationID == -1) { logger.debug( "Not displaying status notification because" + " there's no global notification icon available."); return; } AndroidUtils.updateGeneralNotification( JitsiApplication.getGlobalContext(), notificationID, JitsiApplication.getResString(R.string.app_name), status, System.currentTimeMillis()); }
/** * Shows <tt>AuthorizationRequestedDialog</tt> for the request with given <tt>id</tt>. * * @param id request identifier for which new dialog will be displayed. */ public static void showDialog(Long id) { Context ctx = JitsiApplication.getGlobalContext(); Intent showIntent = new Intent(ctx, AuthorizationRequestedDialog.class); showIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); showIntent.putExtra(EXTRA_REQUEST_ID, id); ctx.startActivity(showIntent); }
/** * Indicates that a protocol provider connection has failed. * * @param protocolProvider the <tt>ProtocolProviderService</tt>, which connection failed * @param loginManagerCallback the <tt>LoginManager</tt> implementation, which is managing the * process */ public void protocolProviderConnectionFailed( final ProtocolProviderService protocolProvider, final LoginManager loginManagerCallback) { AccountID accountID = protocolProvider.getAccountID(); AndroidUtils.showAlertConfirmDialog( JitsiApplication.getGlobalContext(), JitsiApplication.getResString(R.string.service_gui_ERROR), JitsiApplication.getResString( R.string.service_gui_CONNECTION_FAILED_MSG, accountID.getUserID(), accountID.getService()), JitsiApplication.getResString(R.string.service_gui_RETRY), new DialogActivity.DialogListener() { public boolean onConfirmClicked(DialogActivity dialog) { loginManagerCallback.login(protocolProvider); return true; } public void onDialogCancelled(DialogActivity dialog) {} }); }
/** * Creates new call to given <tt>destination</tt> using selected <tt>provider</tt>. * * @param context the android context * @param destination target callee name. * @param provider the provider that will be used to make a call. */ public static void createCall( final Context context, final String destination, final ProtocolProviderService provider) { if (createCallThread != null) { logger.warn("Another call is already being created"); return; } else if (CallManager.getActiveCallsCount() > 0) { logger.warn("Another call is in progress"); return; } final long dialogId = ProgressDialogFragment.showProgressDialog( JitsiApplication.getResString(R.string.service_gui_OUTGOING_CALL), JitsiApplication.getResString(R.string.service_gui_OUTGOING_CALL_MSG, destination)); createCallThread = new Thread("Create call thread") { public void run() { try { CallManager.createCall(provider, destination); } catch (Throwable t) { logger.error("Error creating the call: " + t.getMessage(), t); AndroidUtils.showAlertDialog( context, context.getString(R.string.service_gui_ERROR), t.getMessage()); } finally { if (DialogActivity.waitForDialogOpened(dialogId)) { DialogActivity.closeDialog(JitsiApplication.getGlobalContext(), dialogId); } else { logger.error("Failed to wait for the dialog: " + dialogId); } createCallThread = null; } } }; createCallThread.start(); }
/** * Returns TRUE if the application is visible and FALSE otherwise. This method is meant to be used * by the systray service in order to detect the visibility of the application. * * @return <code>true</code> if the application is visible and <code>false</code> otherwise. * @see #setVisible(boolean) */ public boolean isVisible() { return JitsiApplication.getCurrentActivity() != null; }