List of usage examples for android.app Notification FLAG_NO_CLEAR
int FLAG_NO_CLEAR
To view the source code for android.app Notification FLAG_NO_CLEAR.
Click Source Link
From source file:com.frostwire.android.gui.NotificationUpdateDemon.java
private void setupNotification() { if (!ConfigurationManager.instance() .getBoolean(Constants.PREF_KEY_GUI_ENABLE_PERMANENT_STATUS_NOTIFICATION)) { return;//www. j a v a 2 s . c o m } RemoteViews remoteViews = new RemoteViews(mParentContext.getPackageName(), R.layout.view_permanent_status_notification); PendingIntent showFrostWireIntent = createShowFrostwireIntent(); PendingIntent shutdownIntent = createShutdownIntent(); remoteViews.setOnClickPendingIntent(R.id.view_permanent_status_shutdown, shutdownIntent); remoteViews.setOnClickPendingIntent(R.id.view_permanent_status_text_title, showFrostWireIntent); Notification notification = new NotificationCompat.Builder(mParentContext, Constants.FROSTWIRE_NOTIFICATION_CHANNEL_ID).setSmallIcon(R.drawable.frostwire_notification_flat) .setContentIntent(showFrostWireIntent).setContent(remoteViews).build(); notification.flags |= Notification.FLAG_NO_CLEAR; notificationViews = remoteViews; notificationObject = notification; }
From source file:com.github.sryze.wirebug.DebugStatusService.java
private void updateStatus() { Log.i(TAG, "Performing a status update..."); boolean isEnabled = DebugManager.isTcpDebuggingEnabled(); if (isEnabled != isCurrentlyEnabled) { Log.i(TAG, String.format("Status has changed to %s", isEnabled ? "enabled" : "disabled")); sendStatusChangedBroadcast(isEnabled); } else {/*from ww w . j a v a 2 s .co m*/ Log.i(TAG, "Status is unchanged"); } if (keyguardManager.inKeyguardRestrictedInputMode() && preferences.getBoolean("disable_on_lock", false)) { Log.i(TAG, "Disabling debugging because disable_on_lock is true"); DebugManager.setTcpDebuggingEnabled(false); } if (isEnabled) { boolean isConnectedToWifi = NetworkUtils.isConnectedToWifi(connectivityManager); Log.d(TAG, String.format("Connected to Wi-Fi: %s", isConnectedToWifi ? "yes" : "no")); Intent contentIntent = new Intent(this, MainActivity.class); contentIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); Intent stopIntent = new Intent(this, DebugStatusService.class); stopIntent.setAction(ACTION_STOP); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this); notificationBuilder.setSmallIcon(R.drawable.ic_notification) .setContentTitle(getString(R.string.notification_title)) .setContentIntent( PendingIntent.getActivity(this, 0, contentIntent, PendingIntent.FLAG_CANCEL_CURRENT)) .addAction(R.drawable.ic_stop, getString(R.string.notification_action_stop), PendingIntent.getService(this, 0, stopIntent, PendingIntent.FLAG_CANCEL_CURRENT)); if (isConnectedToWifi) { notificationBuilder.setContentText(String.format(getString(R.string.notification_text), NetworkUtils.getWifiIpAddressString(wifiManager), NetworkUtils.getWifiNetworkName(wifiManager))); } else { notificationBuilder.setContentText(getString(R.string.notification_text_not_connected)); } if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { notificationBuilder.setCategory(Notification.CATEGORY_STATUS) .setVisibility(Notification.VISIBILITY_PUBLIC); } Notification notification = notificationBuilder.build(); notification.flags |= Notification.FLAG_NO_CLEAR; notificationManager.notify(STATUS_NOTIFICATION_ID, notification); } else { Log.d(TAG, "Canceling the notification"); notificationManager.cancel(STATUS_NOTIFICATION_ID); } if (isEnabled && preferences.getBoolean("stay_awake", false)) { if (wakeLock != null && !wakeLock.isHeld()) { Log.i(TAG, "Acquiring a wake lock because stay_awake is true"); wakeLock.acquire(); } } else { if (wakeLock != null && wakeLock.isHeld()) { Log.i(TAG, "Releasing the wake lock"); wakeLock.release(); } } isCurrentlyEnabled = isEnabled; }
From source file:org.universAAL.android.services.MiddlewareService.java
@Override public void onCreate() { // This is where MW is created as it is called once when service is instantiated. Make sure it runs forever. super.onCreate(); Log.v(TAG, "Create"); mPercentage = 0;//from w ww. jav a2 s.c o m // Ongoing notification is mandatory after Android 4.0 Intent notificationIntent = new Intent(this, HandlerActivity.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, Intent.FLAG_ACTIVITY_NEW_TASK); NotificationCompat.Builder builder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_notif) .setContentTitle(getString(R.string.notif_title)).setContentText(getString(R.string.notif_text)) .setContentIntent(contentIntent).setPriority(NotificationCompat.PRIORITY_MIN); Notification notif = builder.build(); notif.flags |= Notification.FLAG_NO_CLEAR; startForeground(ONGOING_NOTIFICATION, notif); //Load initial config through Config utility. Changing config requires restart the MW service to take effect. Config.load(getApplicationContext()); // These properties must be set here, not from file System.setProperty("java.net.preferIPv4Stack", "true"); System.setProperty("java.net.preferIPv6Stack", "false"); System.setProperty("java.net.preferIPv4Addresses", "true"); System.setProperty("java.net.preferIPv6Addresses", "false"); System.setProperty("jgroups.use.jdk_logger ", "true"); System.setProperty("net.slp.port", "5555"); System.setProperty("org.universAAL.middleware.peer.is_coordinator", Boolean.toString(Config.isServiceCoord())); // This is for setting IP manually, just in case (set it everytime you // get a new IP). If not set, it seems it also works, but SLP keeps // working on multicast for a while after Wifi is turned off. // System.setProperty("net.slp.interfaces", "192.168.0.126"); // This is for not blocking the sockets when reconnecting (check its // javadoc). Common sense would suggest to set it false, but it still // works without doing so. // System.setProperty("http.keepAlive", "false"); // Google had the wonderful idea in Android 5.0 of not enabling WIFI // connection when it does not have internet access, and fall back to // data connection. So in 5.0 we have to deliberately request WIFI and // set it as the process connection when it "becomes" available. And // pray that WIFI is ON by the time we make our checks... if (Config.isWifiAllowed()) { requestLollipopWifi(); } // Create (dont use yet) the multicast lock. Make it not counted: this app only uses one lock WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); mLock = wifi.createMulticastLock("uaal_multicast"); mLock.setReferenceCounted(false); // Set the static platform of SLP (for logging and stuff). Do it here cause its static (!) SLPCore.platform = AndroidContext.THE_CONTEXT; // Start the MW! Put all the above inside thread too? Cmon, its fast! Also, notification must be there new Thread(new Runnable() { public void run() { // Start the MW in onCreate makes sure it is running before // handling any intents. The only problem is when stopping the // MW and an intent comes... TODO addPercent(1); mCurrentWIFI = checkWifi();//Set the initial status of WIFI // 1. Stop-start the connector modules. Use jSLP only IF WIFI enabled, and WIFI==WIFI_HOME or WIFI_NOT_SET if (Config.isWifiAllowed() && (mCurrentWIFI == AppConstants.WIFI_HOME || mCurrentWIFI == AppConstants.WIFI_NOTSET)) { restartConnector(true); } else { restartConnector(false); } // 2. Start the MW modules startMiddleware(); // 3. Register the ontologies // It appears ont service does run in separate thread > race cond: AP ont may not be reg before handler // That is why I moved to a static method instead of ACTION_ONT_REG_ALL intent TODO retrofit OntologyService OntologyService.registerOntologies(MiddlewareService.this); addPercent(25); // 4. Start UI handler TODO start handler in last place if (Config.isUIHandler()) { startHandler(); } else { addPercent(5);//startHandler() adds 5 when finished } // 5. Start GW IF WIFI==NOT_ON or WIFI==STRANGER (or if ALWAYS) if (isGWrequired()) { startGateway(); } addPercent(10); // 6. Register the apps Intent scan = new Intent(AppConstants.ACTION_PCK_REG_ALL); scan.setClass(MiddlewareService.this, ScanService.class); startService(scan); } }, TAG_THREAD_CREATE).start(); Log.v(TAG, "Created"); }
From source file:uk.org.openseizuredetector.client.SdClientService.java
/** * Show a notification while this service is running. *///from w w w .j av a 2 s . c om private void showNotification() { Log.v(TAG, "showNotification()"); CharSequence text = "Alarm Client for OpenSeizureDetector Running"; Notification notification = new Notification(R.drawable.star_of_life_24x24, text, System.currentTimeMillis()); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, ClientActivity.class), 0); notification.setLatestEventInfo(this, "Alarm Client for OpenSeizureDetector", text, contentIntent); notification.flags |= Notification.FLAG_NO_CLEAR; mNM = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNM.notify(NOTIFICATION_ID, notification); }
From source file:net.digitalfeed.pdroidalternative.intenthandler.PackageChangeHandler.java
private void displayNotification(Context context, NotificationType notificationType, String packageName, String label) {/*from w ww.ja va 2 s . c o m*/ //This pattern is essentially taken from //https://developer.android.com/guide/topics/ui/notifiers/notifications.html Resources res = context.getResources(); //TODO: Fix the icon in the notification bar Notification.Builder builder = new Notification.Builder(context).setPriority(Notification.PRIORITY_MAX) .setSmallIcon(R.drawable.notification_icon); //.setLargeIcon(res.getDrawable(R.drawable.allow_icon)) String appLabel = DBInterface.getInstance(context).getApplicationLabel(packageName); Log.d("PDroidAlternative", "new packagename is " + packageName); Log.d("PDroidAlternative", "app label is " + appLabel); switch (notificationType) { case newinstall: builder.setContentTitle(appLabel + " " + res.getString(R.string.notification_newinstall_title)) .setContentText(res.getString(R.string.notification_newinstall_text)); break; case update: builder.setContentTitle(appLabel + " " + res.getString(R.string.notification_update_title)) .setContentText(res.getString(R.string.notification_update_text)); break; } Intent packageDetailIntent = new Intent(context, AppDetailActivity.class); packageDetailIntent.putExtra(AppDetailActivity.BUNDLE_PACKAGE_NAME, packageName); packageDetailIntent.putExtra(AppDetailActivity.BUNDLE_IN_APP, false); packageDetailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK & Intent.FLAG_ACTIVITY_CLEAR_TASK); TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addParentStack(AppDetailActivity.class); stackBuilder.addNextIntent(packageDetailIntent); PendingIntent pendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(pendingIntent); Notification builtNotification = builder.build(); builtNotification.flags = builtNotification.flags | Notification.FLAG_AUTO_CANCEL | Notification.FLAG_NO_CLEAR; NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0, builtNotification); }
From source file:com.evandroid.musica.broadcastReceiver.MusicBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { /** Google Play Music //bool streaming long position //long albumId String album //bool currentSongLoaded String track //long ListPosition long ListSize //long id bool playing //long duration int previewPlayType //bool supportsRating int domain //bool albumArtFromService String artist //int rating bool local //bool preparing bool inErrorState *//*from w w w. j a va 2 s.c o m*/ Bundle extras = intent.getExtras(); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context); boolean lengthFilter = sharedPref.getBoolean("pref_filter_20min", true); if (extras != null) try { extras.getInt("state"); } catch (BadParcelableException e) { return; } if (extras == null || extras.getInt("state") > 1 //Tracks longer than 20min are presumably not songs || (lengthFilter && (extras.get("duration") instanceof Long && extras.getLong("duration") > 1200000) || (extras.get("duration") instanceof Double && extras.getDouble("duration") > 1200000) || (extras.get("duration") instanceof Integer && extras.getInt("duration") > 1200)) || (lengthFilter && (extras.get("secs") instanceof Long && extras.getLong("secs") > 1200000) || (extras.get("secs") instanceof Double && extras.getDouble("secs") > 1200000) || (extras.get("secs") instanceof Integer && extras.getInt("secs") > 1200))) return; String artist = extras.getString("artist"); String track = extras.getString("track"); long position = extras.containsKey("position") ? extras.getLong("position") : -1; if (extras.get("position") instanceof Double) position = Double.valueOf(extras.getDouble("position")).longValue(); boolean isPlaying = extras.getBoolean("playing", true); if (intent.getAction().equals("com.amazon.mp3.metachanged")) { artist = extras.getString("com.amazon.mp3.artist"); track = extras.getString("com.amazon.mp3.track"); } else if (intent.getAction().equals("com.spotify.music.metadatachanged")) isPlaying = spotifyPlaying; else if (intent.getAction().equals("com.spotify.music.playbackstatechanged")) spotifyPlaying = isPlaying; if ((artist == null || "".equals(artist)) //Could be problematic || (track == null || "".equals(track) || track.startsWith("DTNS"))) // Ignore one of my favorite podcasts return; SharedPreferences current = context.getSharedPreferences("current_music", Context.MODE_PRIVATE); String currentArtist = current.getString("artist", ""); String currentTrack = current.getString("track", ""); SharedPreferences.Editor editor = current.edit(); editor.putString("artist", artist); editor.putString("track", track); editor.putLong("position", position); editor.putBoolean("playing", isPlaying); if (isPlaying) { long currentTime = System.currentTimeMillis(); editor.putLong("startTime", currentTime); } editor.apply(); autoUpdate = autoUpdate || sharedPref.getBoolean("pref_auto_refresh", false); int notificationPref = Integer.valueOf(sharedPref.getString("pref_notifications", "0")); if (autoUpdate && App.isActivityVisible()) { Intent internalIntent = new Intent("Broadcast"); internalIntent.putExtra("artist", artist).putExtra("track", track); LyricsViewFragment.sendIntent(context, internalIntent); forceAutoUpdate(false); } SQLiteDatabase db = new DatabaseHelper(context).getReadableDatabase(); boolean inDatabase = DatabaseHelper.presenceCheck(db, new String[] { artist, track, artist, track }); db.close(); if (notificationPref != 0 && isPlaying && (inDatabase || OnlineAccessVerifier.check(context))) { Intent activityIntent = new Intent("com.geecko.QuickLyric.getLyrics").putExtra("TAGS", new String[] { artist, track }); Intent wearableIntent = new Intent("com.geecko.QuickLyric.SEND_TO_WEARABLE").putExtra("artist", artist) .putExtra("track", track); PendingIntent openAppPending = PendingIntent.getActivity(context, 0, activityIntent, PendingIntent.FLAG_CANCEL_CURRENT); PendingIntent wearablePending = PendingIntent.getBroadcast(context, 8, wearableIntent, PendingIntent.FLAG_CANCEL_CURRENT); NotificationCompat.Action wearableAction = new NotificationCompat.Action.Builder(R.drawable.ic_watch, context.getString(R.string.wearable_prompt), wearablePending).build(); NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context); NotificationCompat.Builder wearableNotifBuilder = new NotificationCompat.Builder(context); if ("0".equals(sharedPref.getString("pref_theme", "0"))) notifBuilder.setColor(context.getResources().getColor(R.color.primary)); notifBuilder.setSmallIcon(R.drawable.ic_notif).setContentTitle(context.getString(R.string.app_name)) .setContentText(String.format("%s - %s", artist, track)).setContentIntent(openAppPending) .setVisibility(-1) // Notification.VISIBILITY_SECRET .setGroup("Lyrics_Notification").setGroupSummary(true); wearableNotifBuilder.setSmallIcon(R.drawable.ic_notif) .setContentTitle(context.getString(R.string.app_name)) .setContentText(String.format("%s - %s", artist, track)).setContentIntent(openAppPending) .setVisibility(-1) // Notification.VISIBILITY_SECRET .setGroup("Lyrics_Notification").setOngoing(false).setGroupSummary(false) .extend(new NotificationCompat.WearableExtender().addAction(wearableAction)); if (notificationPref == 2) { notifBuilder.setOngoing(true).setPriority(-2); // Notification.PRIORITY_MIN } else notifBuilder.setPriority(-1); // Notification.PRIORITY_LOW Notification notif = notifBuilder.build(); Notification wearableNotif = wearableNotifBuilder.build(); if (notificationPref == 2) notif.flags |= Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT; else notif.flags |= Notification.FLAG_AUTO_CANCEL; NotificationManagerCompat.from(context).notify(0, notif); try { context.getPackageManager().getPackageInfo("com.google.android.wearable.app", PackageManager.GET_META_DATA); NotificationManagerCompat.from(context).notify(8, wearableNotif); } catch (PackageManager.NameNotFoundException ignored) { } } else if (track.equals(current.getString("track", ""))) NotificationManagerCompat.from(context).cancel(0); }
From source file:dk.dr.radio.afspilning.AfspillerIkonOgNotifikation.java
@SuppressLint("NewApi") public static Notification lavNotification(Context ctx) { String kanalNavn = ""; try {/* w w w.j ava2 s . c om*/ kanalNavn = DRData.instans.afspiller.getLydkilde().getKanal().navn; } catch (Exception e) { Log.rapporterFejl(e); } // TODO fjern try-catch efter nogle mneder i drift. 9. okt 2014 NotificationCompat.Builder b = new NotificationCompat.Builder(ctx).setSmallIcon(R.drawable.dr_notifikation) .setContentTitle(ctx.getString(R.string.dr_radio)).setContentText(kanalNavn).setOngoing(true) .setAutoCancel(false).setVisibility(NotificationCompat.VISIBILITY_PUBLIC).setPriority(1001) // holder den verst .setContentIntent(PendingIntent.getActivity(ctx, 0, new Intent(ctx, Hovedaktivitet.class), 0)); // PendingIntent er til at pege p aktiviteten der skal startes hvis // brugeren vlger notifikationen b.setContent( AfspillerIkonOgNotifikation.lavRemoteViews(AfspillerIkonOgNotifikation.TYPE_notifikation_lille)); Notification notification = b.build(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { // A notification's big view appears only when the notification is expanded, // which happens when the notification is at the top of the notification drawer, // or when the user expands the notification with a gesture. // Expanded notifications are available starting with Android 4.1. notification.bigContentView = AfspillerIkonOgNotifikation .lavRemoteViews(AfspillerIkonOgNotifikation.TYPE_notifikation_stor); } notification.flags |= (Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT | Notification.PRIORITY_HIGH | Notification.FLAG_FOREGROUND_SERVICE); return notification; }
From source file:com.gsma.rcs.ri.RcsServiceNotifManager.java
private void addImsConnectionNotification(boolean connected, String label) { Intent intent = new Intent(ACTION_VIEW_SETTINGS); PendingIntent contentIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intent, 0); String title = this.getString(R.string.notification_title_rcs_service); Notification notif = buildImsConnectionNotification(contentIntent, title, label, connected); notif.flags = Notification.FLAG_NO_CLEAR | Notification.FLAG_FOREGROUND_SERVICE; NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(NOTIF_ID, notif); }
From source file:org.fairphone.peaceofmind.PeaceOfMindBroadCastReceiver.java
/** * Sets the Peace of mind icon on the notification bar * @param putIcon if true the icon is put otherwise it is removed * @param wasInterrupted when true, an extra notification is sent to inform the user that Peace of mind was ended *///from w w w . j a v a 2 s .co m private void setPeaceOfMindIconInNotificationBar(boolean putIcon, boolean wasInterrupted) { NotificationManager manager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); if (putIcon) { //just in case the user didn't clear it manager.cancel(PEACE_OF_MIND_INTERRUPTED_NOTIFICATION); NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext) .setSmallIcon(R.drawable.peace_system_bar_icon) .setContentTitle(mContext.getResources().getString(R.string.app_name)) .setContentText(mContext.getResources().getString(R.string.peace_on_notification)); Intent resultIntent = new Intent(mContext, PeaceOfMindActivity.class); TaskStackBuilder stackBuilder = TaskStackBuilder.create(mContext); // Adds the back stack for the Intent (but not the Intent itself) stackBuilder.addParentStack(PeaceOfMindActivity.class); // Adds the Intent that starts the Activity to the top of the stack stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(resultPendingIntent); Notification notificationWhileRunnig = builder.build(); notificationWhileRunnig.flags |= Notification.FLAG_NO_CLEAR; // Add notification manager.notify(PEACE_OF_MIND_ON_NOTIFICATION, notificationWhileRunnig); } else { manager.cancel(PEACE_OF_MIND_ON_NOTIFICATION); //send a notification saying that the peace was ended if (wasInterrupted) { NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext) .setSmallIcon(R.drawable.peace_system_bar_icon).setAutoCancel(true) .setContentTitle(mContext.getResources().getString(R.string.app_name)) .setContentText(mContext.getResources().getString(R.string.peace_off_notification)) .setTicker(mContext.getResources().getString(R.string.peace_off_notification)); manager.notify(PEACE_OF_MIND_INTERRUPTED_NOTIFICATION, builder.build()); } } }
From source file:com.ubergeek42.WeechatAndroid.service.RelayService.java
public boolean connect() { // Load the preferences host = prefs.getString("host", null); pass = prefs.getString("password", "password"); port = prefs.getString("port", "8001"); stunnelCert = prefs.getString("stunnel_cert", ""); stunnelPass = prefs.getString("stunnel_pass", ""); sshHost = prefs.getString("ssh_host", ""); sshUser = prefs.getString("ssh_user", ""); sshPass = prefs.getString("ssh_pass", ""); sshPort = prefs.getString("ssh_port", "22"); sshKeyfile = prefs.getString("ssh_keyfile", ""); optimize_traffic = prefs.getBoolean("optimize_traffic", false); // If no host defined, signal them to edit their preferences if (host == null) { Intent i = new Intent(this, WeechatPreferencesActivity.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); NotificationCompat.Builder builder = new NotificationCompat.Builder(this); builder.setContentIntent(contentIntent).setSmallIcon(R.drawable.ic_notification) .setContentTitle(getString(R.string.app_version)) .setContentText(getString(R.string.notification_update_settings)) .setTicker(getString(R.string.notification_update_settings_details)) .setWhen(System.currentTimeMillis()); Notification notification = builder.getNotification(); notification.flags |= Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR; notificationManger.notify(NOTIFICATION_ID, notification); return false; }//from www . ja v a 2 s . co m // Only connect if we aren't already connected if ((relayConnection != null) && (relayConnection.isConnected())) { return false; } shutdown = false; bufferManager = new BufferManager(); hotlistManager = new HotlistManager(); hotlistManager.setBufferManager(bufferManager); msgHandler = new LineHandler(bufferManager); nickHandler = new NicklistHandler(bufferManager); hotlistHandler = new HotlistHandler(bufferManager, hotlistManager); hotlistHandler.registerHighlightHandler(this); relayConnection = new RelayConnection(host, port, pass); String connType = prefs.getString("connection_type", "plain"); if (connType.equals("ssh")) { relayConnection.setSSHHost(sshHost); relayConnection.setSSHUsername(sshUser); relayConnection.setSSHPort(sshPort); relayConnection.setSSHPassword(sshPass); relayConnection.setSSHKeyFile(sshKeyfile); relayConnection.setConnectionType(ConnectionType.SSHTUNNEL); } else if (connType.equals("stunnel")) { relayConnection.setStunnelCert(stunnelCert); relayConnection.setStunnelKey(stunnelPass); relayConnection.setConnectionType(ConnectionType.STUNNEL); } else if (connType.equals("ssl")) { relayConnection.setConnectionType(ConnectionType.SSL); relayConnection.setSSLKeystore(sslKeystore); } else { relayConnection.setConnectionType(ConnectionType.DEFAULT); } relayConnection.setConnectionHandler(this); relayConnection.connect(); return true; }