1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-08-13 16:53:50 -04:00

New setting: Hide join and part messages

This commit is contained in:
Sebastian Kaspari 2010-11-18 19:25:26 +01:00
parent 3b50e5a095
commit 82e62db96c
5 changed files with 27 additions and 5 deletions

View File

@ -26,7 +26,10 @@
<string name="key_voice_recognition">voice_recognition</string>
<string name="default_voice_recognition">false</string>
<string name="key_show_joinpart">show_joinpart</string>
<string name="default_show_joinpart">true</string>
<string name="key_vibrate_highlight">vibrate_highlight</string>
<string name="default_vibrate_highlight">true</string>
</resources>

View File

@ -184,4 +184,6 @@
<string name="settings_voice_recognition_desc">Show button for voice recognition</string>
<string name="settings_vibrate_highlight_title">Vibrate on highlight</string>
<string name="settings_vibrate_highlight_desc">Vibrate when your nick is mentioned</string>
<string name="settings_joinpart_title">Show join and part</string>
<string name="settings_joinpart_desc">Show join and part messages in channels</string>
</resources>

View File

@ -65,6 +65,11 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
android:key="@string/key_24h_format"
android:defaultValue="@string/default_24h_format"
android:dependency="@string/key_show_timestamp" />
<CheckBoxPreference
android:title="@string/settings_joinpart_title"
android:summary="@string/settings_joinpart_desc"
android:key="@string/key_show_joinpart"
android:defaultValue="@string/default_show_joinpart" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/settings_misc">
@ -85,6 +90,5 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
android:summary="@string/settings_vibrate_highlight_desc"
android:key="@string/key_vibrate_highlight"
android:defaultValue="@string/default_vibrate_highlight" />
</PreferenceCategory>
</PreferenceScreen>

View File

@ -336,7 +336,7 @@ public class IRCConnection extends PircBot
target
);
service.sendBroadcast(intent);
} else {
} else if (service.getSettings().showJoinAndPart()) {
Message message = new Message(service.getString(R.string.message_join, sender));
message.setIcon(R.drawable.join);
message.setColor(Message.COLOR_GREEN);
@ -516,7 +516,7 @@ public class IRCConnection extends PircBot
target
);
service.sendBroadcast(intent);
} else {
} else if (service.getSettings().showJoinAndPart()) {
Message message = new Message(service.getString(R.string.message_part, sender));
message.setColor(Message.COLOR_GREEN);
message.setIcon(R.drawable.part);

View File

@ -181,5 +181,18 @@ public class Settings
resources.getString(R.string.key_vibrate_highlight),
Boolean.parseBoolean(resources.getString(R.string.default_vibrate_highlight))
);
}
}
/**
* Should join and part messages be displayed?
*
* @return True if joins and parts should be displayed, false otherwise
*/
public boolean showJoinAndPart()
{
return preferences.getBoolean(
resources.getString(R.string.key_show_joinpart),
Boolean.parseBoolean(resources.getString(R.string.default_show_joinpart))
);
}
}