Commit Graph

119 Commits

Author SHA1 Message Date
Steven Luo 9a8bf44d63 Do something sane for private messages where the sender is our nick
As of now, private messages where the sender is our nick end up in
a query window targeted at us.  Show these messages in the query window
of the target instead, which is probably what we want.

This is useful for use with irssi proxy, which will send messages sent
by another client attached to the proxy to us in this way.

(Note that this patch makes a change to PircBot to pass the target of a
private message to the onPrivateMessage handler.)
2011-06-08 23:11:28 +02:00
Steven Luo 159cb8195d Remember switched conversations across screen orientation changes
As of now, the activity does not remember whether a conversation is
switched across configuration changes (such as screen rotations).  Fix
this by adding onSaveInstanceState() and onRestoreInstanceState()
callbacks in the activity to pass this information to the new instance.

To make the implementation of this simpler, all code to configure the
MessageListView, which was duplicated in several places in the codebase,
has been moved to the MessageListView's constructor.

While we're at it, make the padding setting independent of screen
density instead of specifying in fixed pixels (equivalent to specifying
the value in dp instead of px), and increase the padding for switched
views.  This ensures that message text isn't obscured by the gradient at
the edges of the ConversationGallery, which started happening when we
began caching MessageListViews in the DeckAdapter.
2011-06-08 23:11:28 +02:00
Steven Luo c9ed28767d Actually deliver actions to existing private message windows 2011-06-08 23:11:28 +02:00
Steven Luo ae1b574997 Dispose of IRCConnections properly to avoid leaking IRCService objects
Each IRCConnection starts an input thread and an output thread when
created; if not stopped, these threads continue to hold the IRCService,
resulting in a leak when the service is stopped.  Fix this by using
PircBot's dispose() to stop the threads when disposing of the
IRCConnection.
2011-06-08 23:11:28 +02:00
Steven Luo ffe73b7c9f Hold MessageListAdapters and MessageListViews in DeckAdapter to avoid leaks
There are at least two significant memory leaks in Yaaic, which cause
the client to force close after a few hours with an
OutOfMemoryException:

(1) The IRCService holds Conversation objects, which contain a
MessageListAdapter, which have references to the ConversationActivity
context.  This causes Activity contexts to outlast the Activity, causing
a significant memory leak over time.

Fix this by holding the MessageListAdapter in the ConversationActivity's
DeckAdapter instead of in the Conversation objects.  The DeckAdapter's
lifecycle matches that of the Activity, so this prevents the leak.

(2) Every call to DeckAdapter.getView()/renderConversation() creates a
new MessageListView and adds it to the deck.  But adding the view to
the deck causes the deck to take a reference to the view, leaking the
MessageListView until the Activity is finished.  (This has the effect of
exacerbating the first leak, since the Activity context holds a
reference to the deck.)

Fix this leak by caching MessageListViews in the DeckAdapter, and
returning an existing MessageListView for a Conversation in getView() if
one already exists.
2011-06-08 23:11:28 +02:00
Steven Luo c4504be725 Notify the user on receipt of all private messages, not just ones with nick mentions
You'd rarely use someone's nick in a privmsg with them, and this matches
the behavior of other clients.
2011-06-08 23:11:28 +02:00
Steven Luo 464430ee74 Add FLAG_ACTIVITY_NEW_TASK to notification intents
According to
http://developer.android.com/reference/android/app/Notification.html#contentIntent
we should do this.  Suppresses a log message when tapping on our status
bar notification.
2011-06-08 23:11:27 +02:00
Steven Luo caf3272f71 Ensure privmsg with mention of user's nick opens new query when appropriate
If a private message that should open a new query window contains a
mention of the user's nick, the expected new window fails to open
because the isMentioned() path tries to use
server.getConversation().setStatus(), and server.getConversation() is
null in this case.  Fix this by moving the attempt to highlight the
window to a point where a conversation is guaranteed to exist.
2011-06-08 23:11:27 +02:00
Steven Luo f1b57c9e25 Don't scroll to a conversation in onCreate() unless it was previously selected
This has two advantages:
(1) The activity remembers which conversation was last selected if it's
    destroyed (e.g. via the Back button) and then recreated with the connection
    still running.
(2) It prevents onCreate() from clearing all the mentioned notifications for
    the conversations in that activity.
2011-06-08 23:11:27 +02:00
Matt Mastracci ac4fa4a104 Add _ to ident chars, update comment 2011-04-24 20:53:40 -06:00
Sebastian Kaspari 1e5f016012 DeckAdapter: getView(): If no conversation is available (anymore) for the requested position, return an empty TextView. Fixes #56. 2011-04-15 20:39:33 +02:00
Sebastian Kaspari 50a6047edd On own nick change: Display message in server info window (Your are now known as ...). Fixes #51. 2011-04-15 20:30:46 +02:00
Sebastian Kaspari c6dbe8cc18 Remove color codes if the mirc colors option is off. Fixes #57 2011-04-14 22:53:38 +02:00
Sebastian Kaspari 86e0812741 Ooops, fix @author javadoc tag in classes: MircColors, Smilies 2011-04-13 00:14:40 +02:00
Sebastian Kaspari 4e266e1bb7 ConversationActivity: onCreate(): Check if server is returned by getServerById() - Fixes #55 2011-04-12 23:44:39 +02:00
Sebastian Kaspari 9387a02068 ConversationActivity: onStatusUpdate(): Check if service is already connected and initialized - Fixes #54 2011-04-12 23:37:11 +02:00
Sebastian Kaspari ded6485f6b Database: isTitleUsed(): Escape server title (SQLiteException) - Fixes #53 2011-04-12 23:30:00 +02:00
Sebastian Kaspari b3fd4157dc JoinActivity: Set cursor position 2011-04-12 23:05:09 +02:00
Sebastian Kaspari dd07bd358a Bugfix: Only automatically change nickname on server code 433 if not already registered with server 2011-04-12 22:23:51 +02:00
Sebastian Kaspari 591dc8f763 MircColors/Smilies: Code formatting and documentation 2011-03-27 20:02:06 +02:00
Sebastian Kaspari 673598ad31 Added licence header to new files 2011-03-27 19:53:05 +02:00
liato ac1a07894f Add support for graphical smilies in chat. 2011-03-27 19:51:47 +02:00
liato 92a1e93bc1 Use TextUtils.concat to concatenate 2011-03-27 19:43:51 +02:00
liato eea82e506f Rename Colors class and methods. 2011-03-27 19:42:47 +02:00
liato 2189d2c05f Remove tagsoup dependency. Improve mIRC color code parsing speed. 2011-03-27 19:42:05 +02:00
liato 7c4abe0c9c Render colors correctly in topics and other foreground colored places. 2011-03-27 19:41:13 +02:00
liato 59c70a750d Fix mirc color bug by changing the tagsoup schema and making the font tag restartable. 2011-03-27 19:40:47 +02:00
liato 624f8c5014 Add support for mIRC colors. 2011-03-27 19:40:26 +02:00
liato e612d3b09c Render html in messages to spannables. 2011-03-27 19:37:35 +02:00
liato 1f9c8efcca Fix nullpointerexception. 2011-03-27 17:16:38 +02:00
liato 1ebea8f7d6 Use integer division to calculate gallert item width. 2011-03-27 17:13:09 +02:00
liato b49ead73ad Fix width issues in gallery. 2011-03-27 17:10:54 +02:00
Sebastian Kaspari 7563437343 Server: Fix typo in addConversation() 2011-03-15 23:59:49 +01:00
Sebastian Kaspari 4262cbcd15 New Setting: Show notices in server window. Closes #47. 2011-03-15 20:53:47 +01:00
Sebastian Kaspari b855b7ea92 Hide join/part setting now hides quit messages too 2011-03-15 20:42:35 +01:00
Sebastian Kaspari 49f067cd67 IRCConnection: Formatting 2011-03-15 20:12:12 +01:00
Sebastian Kaspari 488924546f Fix unit test MessageTest after refactoring 2011-03-14 22:32:28 +01:00
Sebastian Kaspari 95f3c4b255 Some more simple refactorings 2011-03-14 22:15:13 +01:00
Sebastian Kaspari 1c8076ec53 Refactoring of Message class 2011-03-11 22:07:39 +01:00
liato a3ebf8d5d0 Handle auto joins after the user has registered with the server. 2011-03-09 08:54:28 +01:00
Sebastian Kaspari 84d45c5f5c Refactor ConversationSwitcher: onDraw() - May throw ConcurrentModificationException 2011-03-06 14:21:58 +01:00
Sebastian Kaspari 635b90b5da Fix NullPointerException when using upercase characters in command names 2011-03-06 14:03:34 +01:00
Sebastian Kaspari 7845ad73f0 Refactor ChannelList to ConversationGallery - Moved to view package, added javadoc and licence header 2011-03-06 11:21:28 +01:00
Thomas Martitz f4637ac582 Use a different color for join/part/quit for the circles in the ConversationSwitcher view.
This makes it easier to ignore unintersting messages wihout turning off the setting to show joins/parts/quits.
Once circle is colored for a new message, the join/part/quit cannot override it anymore.
2011-03-06 11:11:17 +01:00
Thomas Martitz 70b5ee876d Tweak some nick colors to be better readable on Yaaic's dark background. 2011-03-06 11:00:54 +01:00
Thomas Martitz db91a85676 Reduce sensitivity of the channel gallery view.
Higher scroll speeds are reduced stronger.
2011-03-06 11:00:02 +01:00
Thomas Martitz 7120bb48ea Work around duplicated activities.
With activity:launchMode = standard, we get duplicated activities
depending on the task the app was started in. In order to avoid
stacking up of this duplicated activities we keep a count of this
root activity and let it finish if it already exists

Launching the app via the notification icon creates a new task,
and there doesn't seem to be a way around this so this is needed
2011-03-06 10:59:22 +01:00
Sebastian Kaspari 97c382c893 ServerListAdapter: Updated color codes 2011-02-11 12:54:48 +01:00
Sebastian Kaspari b3e26c626b ServerListAdapter: Change server label color in list depending on connect state 2011-02-08 23:58:04 +01:00
Sebastian Kaspari 669113610a New user action view and new actions: reply, query 2011-02-05 16:04:36 +01:00
Sebastian Kaspari d8b1a0218f Added 2011 to licence header 2011-02-05 13:00:12 +01:00
Sebastian Kaspari 0fb2338f9c Code cleanup (Formatting) 2011-01-25 21:02:27 +01:00
Sebastian Kaspari feaf1d4aea Fix sound notification 2011-01-15 23:38:56 +01:00
Sebastian Kaspari 7c63155cfb Fix voice recognition: Only add top match to the text input (and code cleanup) 2011-01-15 23:17:24 +01:00
Sebastian Kaspari e68ef9c8c2 Ident: Add "-" to the list of allowed characters 2011-01-15 22:52:16 +01:00
Sebastian Kaspari e0b4b3d25d Allow chars '[' and ']' in ident 2010-12-17 23:37:00 +01:00
Sebastian Kaspari e014165a17 New setting: Play (notification) sound on highlight 2010-12-17 22:29:33 +01:00
Sebastian Kaspari 4b3e47c799 Set vibration pattern (default does not always work) 2010-12-17 22:19:36 +01:00
Sebastian Kaspari 890fc1c50f Settings: typo 2010-11-21 12:58:17 +01:00
Sebastian Kaspari 82e62db96c New setting: Hide join and part messages 2010-11-18 19:25:26 +01:00
Sebastian Kaspari 6c3597ff80 IRCConnection: Just a bracket fix 2010-11-18 18:55:19 +01:00
Sebastian Kaspari 02b7ec1741 Replace all tabs with four spaces! 2010-11-18 18:52:19 +01:00
Sebastian Kaspari f3f195f631 IRCService: Added javadoc 2010-11-18 18:47:12 +01:00
Sebastian Kaspari ce0650d711 IRCService: Fixed a NullPointerException 2010-11-18 18:43:37 +01:00
Sebastian Kaspari 6d2a6bff14 IRCService: imports 2010-11-18 18:33:22 +01:00
liato 3708a9c60c Small modification to the nick matching regular expression. 2010-11-17 02:53:08 +01:00
liato f5b5b99adb Improve detection for nickname in messages. This will prevent notifications from poping up when a word contains the nickname. 2010-11-17 02:36:52 +01:00
liato 81f2c94b87 Added setting to vibrate on highlight. 2010-11-17 01:32:09 +01:00
Sebastian Kaspari 1250c10d9c Merged application and test project into one repository 2010-11-07 08:35:45 +01:00