mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-25 18:32:15 -05:00
New Setting: Show notices in server window. Closes #47.
This commit is contained in:
parent
b855b7ea92
commit
4262cbcd15
@ -35,4 +35,7 @@
|
||||
|
||||
<string name="key_sound_highlight">sound_highlight</string>
|
||||
<string name="default_sound_highlight">false</string>
|
||||
|
||||
<string name="key_notice_server_window">notice_server_window</string>
|
||||
<string name="default_notice_server_window">false</string>
|
||||
</resources>
|
||||
|
@ -194,4 +194,6 @@
|
||||
<string name="settings_voice_recognition_desc">Show button for voice recognition</string>
|
||||
<string name="settings_joinpartquit_title">Show join, part and quit</string>
|
||||
<string name="settings_joinpartquit_desc">Show join, part and quit messages in channels</string>
|
||||
<string name="settings_noticeserverwindow_title">Notices server window</string>
|
||||
<string name="settings_noticeserverwindow_desc">Show notices in server window</string>
|
||||
</resources>
|
||||
|
@ -70,6 +70,11 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:summary="@string/settings_joinpartquit_desc"
|
||||
android:key="@string/key_show_joinpartquit"
|
||||
android:defaultValue="@string/default_show_joinpartquit" />
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_noticeserverwindow_title"
|
||||
android:summary="@string/settings_noticeserverwindow_desc"
|
||||
android:key="@string/key_notice_server_window"
|
||||
android:defaultValue="@string/default_notice_server_window" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:title="@string/settings_highlight">
|
||||
|
@ -486,12 +486,18 @@ public class IRCConnection extends PircBot
|
||||
notice = Colors.removeFormattingAndColors(notice);
|
||||
|
||||
// Post notice to currently selected conversation
|
||||
Conversation conversation = server.getConversation(server.getSelectedConversation());
|
||||
Conversation conversation;
|
||||
|
||||
if (service.getSettings().showNoticeInServerWindow()) {
|
||||
conversation = server.getConversation(ServerInfo.DEFAULT_NAME);
|
||||
} else {
|
||||
conversation = server.getConversation(server.getSelectedConversation());
|
||||
|
||||
if (conversation == null) {
|
||||
// Fallback: Use ServerInfo view
|
||||
conversation = server.getConversation(ServerInfo.DEFAULT_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
Message message = new Message("-" + sourceNick + "- " + notice);
|
||||
message.setIcon(R.drawable.info);
|
||||
|
@ -208,4 +208,17 @@ public class Settings
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_show_joinpartquit))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should notices be shown in the server window instead in the focused window?
|
||||
*
|
||||
* @return True if notices should be shown in the server window
|
||||
*/
|
||||
public boolean showNoticeInServerWindow()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_notice_server_window),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_notice_server_window))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user